Guest User

Untitled

a guest
Aug 7th, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.60 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. public final class EntityDef {
  4.  
  5. public static EntityDef forID(int i) {
  6. for (int j = 0; j < 20; j++)
  7. if (cache[j].type == (long) i)
  8. return cache[j];
  9. anInt56 = (anInt56 + 1) % 20;
  10. EntityDef entityDef = cache[anInt56] = new EntityDef();
  11. stream.currentOffset = streamIndices[i];
  12. entityDef.type = i;
  13. entityDef.readValues(stream);
  14. if(i == 8443) {
  15. entityDef.actions = new String[5];
  16. entityDef.actions[2] = "Donator Shop";
  17. entityDef.name = "Lucien";
  18. entityDef.anInt91 = 100;
  19. entityDef.anInt86 = 100;
  20. entityDef.aByte68 = 1;
  21. entityDef.description = "The Donator Shop.".getBytes();
  22. }
  23.  
  24. return entityDef;
  25. }
  26.  
  27. public Model method160() {
  28. if (childrenIDs != null) {
  29. EntityDef entityDef = method161();
  30. if (entityDef == null)
  31. return null;
  32. else
  33. return entityDef.method160();
  34. }
  35. if (anIntArray73 == null)
  36. return null;
  37. boolean flag1 = false;
  38. for (int i = 0; i < anIntArray73.length; i++)
  39. if (!Model.method463(anIntArray73[i]))
  40. flag1 = true;
  41. if (flag1)
  42. return null;
  43. Model aclass30_sub2_sub4_sub6s[] = new Model[anIntArray73.length];
  44. for (int j = 0; j < anIntArray73.length; j++)
  45. aclass30_sub2_sub4_sub6s[j] = Model.method462(anIntArray73[j]);
  46. Model model;
  47. if (aclass30_sub2_sub4_sub6s.length == 1)
  48. model = aclass30_sub2_sub4_sub6s[0];
  49. else
  50. model = new Model(aclass30_sub2_sub4_sub6s.length, aclass30_sub2_sub4_sub6s);
  51. if (anIntArray76 != null) {
  52. for (int k = 0; k < anIntArray76.length; k++)
  53. model.method476(anIntArray76[k], anIntArray70[k]);
  54. }
  55. return model;
  56. }
  57.  
  58. public EntityDef method161() {
  59. try {
  60. int j = -1;
  61. if(anInt57 != -1)
  62. {
  63. VarBit varBit = VarBit.cache[anInt57];
  64. int k = varBit.anInt648;
  65. int l = varBit.anInt649;
  66. int i1 = varBit.anInt650;
  67. int j1 = client.anIntArray1232[i1 - l];
  68. j = clientInstance.variousSettings[k] >> l & j1;
  69. } else
  70. if(anInt59 != -1) {
  71. j = clientInstance.variousSettings[anInt59];
  72. }
  73. if(j < 0 || j >= childrenIDs.length || childrenIDs[j] == -1) {
  74. return null;
  75. } else {
  76. return forID(childrenIDs[j]);
  77. }
  78. } catch (Exception e) {
  79. return null;
  80. }
  81. }
  82.  
  83. public static int NPCAMOUNT = 11599;
  84.  
  85. public static void unpackConfig(StreamLoader streamLoader) {
  86. stream = new Stream(streamLoader.getDataForName("npc.dat"));
  87. Stream stream2 = new Stream(streamLoader.getDataForName("npc.idx"));
  88. int totalNPCs = stream2.readUnsignedWord();
  89. System.out.println("602 NPC Amount: " + totalNPCs);
  90. streamIndices = new int[totalNPCs];
  91. int i = 2;
  92. for (int j = 0; j < totalNPCs; j++) {
  93. streamIndices[j] = i;
  94. i += stream2.readUnsignedWord();
  95. }
  96. cache = new EntityDef[20];
  97. for (int k = 0; k < 20; k++)
  98. cache[k] = new EntityDef();
  99. }
  100.  
  101. public static void nullLoader() {
  102. mruNodes = null;
  103. streamIndices = null;
  104. cache = null;
  105. stream = null;
  106. }
  107.  
  108. public Model method164(int j, int k, int ai[]) {
  109. if (childrenIDs != null) {
  110. EntityDef entityDef = method161();
  111. if (entityDef == null)
  112. return null;
  113. else
  114. return entityDef.method164(j, k, ai);
  115. }
  116. Model model = (Model) mruNodes.insertFromCache(type);
  117. if (model == null) {
  118. boolean flag = false;
  119. for (int i1 = 0; i1 < anIntArray94.length; i1++)
  120. if (!Model.method463(anIntArray94[i1]))
  121. flag = true;
  122.  
  123. if (flag)
  124. return null;
  125. Model aclass30_sub2_sub4_sub6s[] = new Model[anIntArray94.length];
  126. for (int j1 = 0; j1 < anIntArray94.length; j1++)
  127. aclass30_sub2_sub4_sub6s[j1] = Model.method462(anIntArray94[j1]);
  128. if (aclass30_sub2_sub4_sub6s.length == 1)
  129. model = aclass30_sub2_sub4_sub6s[0];
  130. else
  131. model = new Model(aclass30_sub2_sub4_sub6s.length, aclass30_sub2_sub4_sub6s);
  132. if (anIntArray76 != null) {
  133. for (int k1 = 0; k1 < anIntArray76.length; k1++)
  134. model.method476(anIntArray76[k1], anIntArray70[k1]);
  135. }
  136. model.method469();
  137. model.method479(64 + anInt85, 850 + anInt92, -30, -50, -30, true);
  138. mruNodes.removeFromCache(model, type);
  139. }
  140. Model model_1 = Model.aModel_1621;
  141. model_1.method464(model, Class36.method532(k) & Class36.method532(j));
  142. if (k != -1 && j != -1)
  143. model_1.method471(ai, j, k);
  144. else if (k != -1)
  145. model_1.method470(k);
  146. if (anInt91 != 128 || anInt86 != 128)
  147. model_1.method478(anInt91, anInt91, anInt86);
  148. model_1.method466();
  149. model_1.anIntArrayArray1658 = null;
  150. model_1.anIntArrayArray1657 = null;
  151. if (aByte68 == 1)
  152. model_1.aBoolean1659 = true;
  153. return model_1;
  154. }
  155.  
  156. private void readValues(Stream stream)
  157. {
  158. do
  159. {
  160. int i = stream.readUnsignedByte();
  161. if(i == 0)
  162. return;
  163. if(i == 1)
  164. {
  165. int j = stream.readUnsignedByte();
  166. anIntArray94 = new int[j];
  167. for(int j1 = 0; j1 < j; j1++)
  168. anIntArray94[j1] = stream.readUnsignedWord();
  169.  
  170. } else
  171. if(i == 2)
  172. name = stream.readString();
  173. else
  174. if(i == 3)
  175. description = stream.readBytes();
  176. else
  177. if(i == 12)
  178. aByte68 = stream.readSignedByte();
  179. else
  180. if(i == 13)
  181. standAnim = stream.readUnsignedWord();
  182. else
  183. if(i == 14)
  184. walkAnim = stream.readUnsignedWord();
  185. else
  186. if(i == 17)
  187. {
  188. walkAnim = stream.readUnsignedWord();
  189. anInt58 = stream.readUnsignedWord();
  190. anInt83 = stream.readUnsignedWord();
  191. anInt55 = stream.readUnsignedWord();
  192. anInt58 = walkAnim;
  193. anInt83 = walkAnim;
  194. anInt55 = walkAnim;
  195. } else
  196. if(i >= 30 && i < 40)
  197. {
  198. if(actions == null)
  199. actions = new String[5];
  200. actions[i - 30] = stream.readString();
  201. if(actions[i - 30].equalsIgnoreCase("hidden"))
  202. actions[i - 30] = null;
  203. } else
  204. if(i == 40)
  205. {
  206. int k = stream.readUnsignedByte();
  207. anIntArray76 = new int[k];
  208. anIntArray70 = new int[k];
  209. for(int k1 = 0; k1 < k; k1++)
  210. {
  211. anIntArray76[k1] = stream.readUnsignedWord();
  212. anIntArray70[k1] = stream.readUnsignedWord();
  213. }
  214.  
  215. } else
  216. if(i == 60)
  217. {
  218. int l = stream.readUnsignedByte();
  219. anIntArray73 = new int[l];
  220. for(int l1 = 0; l1 < l; l1++)
  221. anIntArray73[l1] = stream.readUnsignedWord();
  222.  
  223. } else
  224. if(i == 90)
  225. stream.readUnsignedWord();
  226. else
  227. if(i == 91)
  228. stream.readUnsignedWord();
  229. else
  230. if(i == 92)
  231. stream.readUnsignedWord();
  232. else
  233. if(i == 93)
  234. aBoolean87 = false;
  235. else
  236. if(i == 95)
  237. combatLevel = stream.readUnsignedWord();
  238. else
  239. if(i == 97)
  240. anInt91 = stream.readUnsignedWord();
  241. else
  242. if(i == 98)
  243. anInt86 = stream.readUnsignedWord();
  244. else
  245. if(i == 99)
  246. aBoolean93 = true;
  247. else
  248. if(i == 100)
  249. anInt85 = stream.readSignedByte();
  250. else
  251. if(i == 101)
  252. anInt92 = stream.readSignedByte() * 5;
  253. else
  254. if(i == 102)
  255. anInt75 = stream.readUnsignedWord();
  256. else
  257. if(i == 103)
  258. anInt79 = stream.readUnsignedWord();
  259. else
  260. if(i == 106)
  261. {
  262. anInt57 = stream.readUnsignedWord();
  263. if(anInt57 == 65535)
  264. anInt57 = -1;
  265. anInt59 = stream.readUnsignedWord();
  266. if(anInt59 == 65535)
  267. anInt59 = -1;
  268. int i1 = stream.readUnsignedByte();
  269. childrenIDs = new int[i1 + 1];
  270. for(int i2 = 0; i2 <= i1; i2++)
  271. {
  272. childrenIDs[i2] = stream.readUnsignedWord();
  273. if(childrenIDs[i2] == 65535)
  274. childrenIDs[i2] = -1;
  275. }
  276.  
  277. } else
  278. if(i == 107)
  279. aBoolean84 = false;
  280. } while(true);
  281. }
  282.  
  283. public EntityDef() {
  284. anInt55 = -1;
  285. anInt57 = -1;
  286. anInt58 = -1;
  287. anInt59 = -1;
  288. combatLevel = -1;
  289. anInt64 = 1834;
  290. walkAnim = -1;
  291. aByte68 = 1;
  292. anInt75 = -1;
  293. standAnim = -1;
  294. type = -1L;
  295. anInt79 = 32;
  296. anInt83 = -1;
  297. aBoolean84 = true;
  298. anInt86 = 128;
  299. aBoolean87 = true;
  300. anInt91 = 128;
  301. aBoolean93 = false;
  302. }
  303.  
  304. public int anInt55;
  305. public static int anInt56;
  306. public int anInt57;
  307. public int anInt58;
  308. public int anInt59;
  309. public static Stream stream;
  310. public int combatLevel;
  311. public final int anInt64;
  312. public String name;
  313. public String actions[];
  314. public int walkAnim;
  315. public byte aByte68;
  316. public int[] anIntArray70;
  317. public static int[] streamIndices;
  318. public int[] anIntArray73;
  319. public int anInt75;
  320. public int[] anIntArray76;
  321. public int standAnim;
  322. public long type;
  323. public int anInt79;
  324. public static EntityDef[] cache;
  325. public static client clientInstance;
  326. public int anInt83;
  327. public boolean aBoolean84;
  328. public int anInt85;
  329. public int anInt86;
  330. public boolean aBoolean87;
  331. public int childrenIDs[];
  332. public byte description[];
  333. public int anInt91;
  334. public int anInt92;
  335. public boolean aBoolean93;
  336. public int[] anIntArray94;
  337. public static MRUNodes mruNodes = new MRUNodes(30);
  338. }
Advertisement
Add Comment
Please, Sign In to add comment