SHARE
TWEET

Untitled

a guest Jan 11th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public final class Sequence {
  2.  
  3.     public static void unpackConfig(JagexArchive jagexArchive) {
  4.         //717seq  717 seq length = 16858
  5.         //seq.dat 600 seq length = 13798
  6.         ByteBuffer byteBuffer = new ByteBuffer(jagexArchive.getDataForName("seq.dat"));
  7.         int length600 = byteBuffer.readUnsignedWord();
  8.         System.out.println("sequence length = "+length600);
  9.         cache600 = new Sequence[length600];
  10.         for (int j = 0; j < length600; j++) {
  11.             cache600[j] = new Sequence();
  12.             cache600[j].readValues(byteBuffer);
  13.         }
  14.         byteBuffer = new ByteBuffer(jagexArchive.getDataForName("717seq"));
  15.         int length717 = byteBuffer.readUnsignedWord();
  16.         System.out.println("sequence length = "+length717);
  17.         cache700 = new Sequence[length717];
  18.         for (int j = 0; j < length717; j++) {
  19.             cache700[j] = new Sequence();
  20.             cache700[j].readValues(byteBuffer);
  21.         }
  22.  
  23.     }
  24.  
  25.     public static Sequence forID(int id) {
  26.         if (id > 13798)
  27.             return cache700[id];
  28.         else
  29.             return cache600[id];
  30.     }
  31.  
  32.     public static void destruct() {
  33.         cache700 = null;
  34.         cache600 = null;
  35.     }
  36.  
  37.     public static int length() {
  38.         return cache700.length;
  39.     }
  40.  
  41.     public int getFrameCount(int i) {
  42.         if (i > frameTimes.length)
  43.             return 0;
  44.         int j = frameTimes[i];
  45.         if (j == 0) {
  46.             Animation animation = Animation.forID(frameIds[i]);
  47.             if (animation != null)
  48.                 j = frameTimes[i] = animation.displayLength;
  49.         }
  50.         if (j == 0)
  51.             j = 1;
  52.         return j;
  53.     }
  54.  
  55.     public void readValues(ByteBuffer byteBuffer) {
  56.         do {
  57.             int i = byteBuffer.readUnsignedByte();
  58.             if (i == 0)
  59.                 break;
  60.             if (i == 1) {
  61.                 frameCount = byteBuffer.readUnsignedWord();
  62.                 frameIds = new int[frameCount];
  63.                 interfaceFrames = new int[frameCount];
  64.                 frameTimes = new int[frameCount];
  65.                 for (int i_ = 0; i_ < frameCount; i_++) {
  66.                     frameIds[i_] = byteBuffer.readDWord();
  67.                     interfaceFrames[i_] = -1;
  68.                 }
  69.                 for (int i_ = 0; i_ < frameCount; i_++)
  70.                     frameTimes[i_] = byteBuffer.readUnsignedByte();
  71.             } else if (i == 2)
  72.                 frameStep = byteBuffer.readUnsignedWord();
  73.             else if (i == 3) {
  74.                 int k = byteBuffer.readUnsignedByte();
  75.                 flowControl = new int[k + 1];
  76.                 for (int l = 0; l < k; l++)
  77.                     flowControl[l] = byteBuffer.readUnsignedByte();
  78.                 flowControl[k] = 0x98967f;
  79.             } else if (i == 4)
  80.                 isTurnAnim = true;
  81.             else if (i == 5)
  82.                 interuptebleSignificance = byteBuffer.readUnsignedByte();
  83.             else if (i == 6)
  84.                 rightHandItem = byteBuffer.readUnsignedWord();
  85.             else if (i == 7)
  86.                 leftHandItem = byteBuffer.readUnsignedWord();
  87.             else if (i == 8)
  88.                 shutdownMovement = byteBuffer.readUnsignedByte();
  89.             else if (i == 9)
  90.                 priority2 = byteBuffer.readUnsignedByte();
  91.             else if (i == 10)
  92.                 priority = byteBuffer.readUnsignedByte();
  93.             else if (i == 11)
  94.                 type = byteBuffer.readUnsignedByte();
  95.             else
  96.                 System.out.println("Unrecognized seq.dat config code: " + i);
  97.         } while (true);
  98.         if (frameCount == 0) {
  99.             frameCount = 1;
  100.             frameIds = new int[1];
  101.             frameIds[0] = -1;
  102.             interfaceFrames = new int[1];
  103.             interfaceFrames[0] = -1;
  104.             frameTimes = new int[1];
  105.             frameTimes[0] = -1;
  106.         }
  107.         if (priority2 == -1)
  108.             if (flowControl != null)
  109.                 priority2 = 2;
  110.             else
  111.                 priority2 = 0;
  112.         if (priority == -1) {
  113.             if (flowControl != null) {
  114.                 priority = 2;
  115.                 return;
  116.             }
  117.             priority = 0;
  118.         }
  119.         if(rightHandItem == 65535)
  120.             rightHandItem = 0;
  121.         if(leftHandItem == 65535)
  122.             leftHandItem = 0;
  123.         if (rightHandItem > 0)
  124.             rightHandItem += 3584;
  125.         if (leftHandItem > 0)
  126.             leftHandItem += 3584;
  127.     }
  128.  
  129.     private Sequence() {
  130.         frameStep = -1;
  131.         isTurnAnim = false;
  132.         interuptebleSignificance = 5;
  133.         rightHandItem = -1;
  134.         leftHandItem = -1;
  135.         shutdownMovement = 99;
  136.         priority2 = -1;
  137.         priority = -1;
  138.         type = 2;
  139.     }
  140.  
  141.     static Sequence cache700[];
  142.     static Sequence cache600[];
  143.     public int frameCount;
  144.     public int frameIds[];
  145.     public int interfaceFrames[];
  146.     private int[] frameTimes;
  147.     public int frameStep;
  148.     public int flowControl[];
  149.     public boolean isTurnAnim;
  150.     public int interuptebleSignificance;
  151.     public int rightHandItem;
  152.     public int leftHandItem;
  153.     public int shutdownMovement;
  154.     public int priority2;
  155.     public int priority;
  156.     public int type;
  157. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top