Guest User

ObjectDef.java

a guest
Jul 5th, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.87 KB | None | 0 0
  1. // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3)
  4.  
  5. import java.io.*;
  6. import sign.signlink;
  7.  
  8. import java.io.DataInputStream;
  9. import java.io.FileInputStream;
  10. import java.io.DataOutputStream;
  11. import java.io.FileOutputStream;
  12.  
  13. public final class ObjectDef
  14. {
  15. public static ObjectDef forID(int i) {
  16. for(int j = 0; j < 20; j++)
  17. if(cache[j].type == i)
  18. return cache[j];
  19. cacheIndex = (cacheIndex + 1) % 20;
  20. ObjectDef objectDef = cache[cacheIndex];
  21. stream.currentOffset = streamIndices[i];
  22. objectDef.type = i;
  23. objectDef.setDefaults();
  24. objectDef.readValues(stream);
  25. if(i == 3515) {
  26. objectDef.name = "Mysterious cape";
  27. objectDef.description = "Mysterious cape is hanging here.".getBytes();
  28. objectDef.anInt744 = 2;
  29. objectDef.anInt761 = 1;
  30. objectDef.anIntArray773 = new int[1];
  31. objectDef.anIntArray773[0] = 65274;
  32. objectDef.itemActions = new String[5];
  33. objectDef.itemActions[0] = "Investigate";
  34. objectDef.hasActions = true;
  35. objectDef.aBoolean767 = true;
  36. objectDef.aBoolean762 = false;
  37. objectDef.aBoolean769 = false;
  38. }
  39. if (i == 1503) {
  40. objectDef.anIntArray773 = new int[1];
  41. objectDef.anIntArray773[0] = 28124;
  42. objectDef.hasActions = false;
  43. }
  44. if (i == 26392) {
  45. objectDef.anIntArray773 = new int[2];
  46. objectDef.anIntArray773[0] = 27816;
  47. objectDef.anIntArray773[1] = 27836;
  48. objectDef.hasActions = false;
  49. }
  50. if (i == 6788) {
  51. objectDef.anIntArray773 = new int[1];
  52. objectDef.anIntArray773[0] = 28124;
  53. objectDef.hasActions = false;
  54. }
  55. if (i == 8935) {
  56. objectDef.anIntArray773 = new int[1];
  57. objectDef.anIntArray773[0] = 28124;
  58. objectDef.hasActions = false;
  59. }
  60. if (i == 1460) {
  61. objectDef.anIntArray773 = new int[1];
  62. objectDef.anIntArray773[0] = 28124;
  63. objectDef.hasActions = false;
  64. }
  65. if (i == 9383) {
  66. objectDef.anIntArray773 = new int[1];
  67. objectDef.anIntArray773[0] = 28124;
  68. objectDef.hasActions = false;
  69. }
  70. if (i == 1434) {
  71. objectDef.anIntArray773 = new int[1];
  72. objectDef.anIntArray773[0] = 28124;
  73. objectDef.hasActions = false;
  74. }
  75. return objectDef;
  76. }
  77.  
  78. private void setDefaults()
  79. {
  80. anIntArray773 = null;
  81. anIntArray776 = null;
  82. name = null;
  83. description = null;
  84. modifiedModelColors = null;
  85. originalModelColors = null;
  86. anInt744 = 1;
  87. anInt761 = 1;
  88. aBoolean767 = true;
  89. aBoolean757 = true;
  90. hasActions = false;
  91. aBoolean762 = false;
  92. aBoolean769 = false;
  93. aBoolean764 = false;
  94. anInt781 = -1;
  95. anInt775 = 16;
  96. aByte737 = 0;
  97. aByte742 = 0;
  98. itemActions = null;
  99. anInt746 = -1;
  100. anInt758 = -1;
  101. aBoolean751 = false;
  102. aBoolean779 = true;
  103. anInt748 = 128;
  104. anInt772 = 128;
  105. anInt740 = 128;
  106. anInt768 = 0;
  107. anInt738 = 0;
  108. anInt745 = 0;
  109. anInt783 = 0;
  110. aBoolean736 = false;
  111. aBoolean766 = false;
  112. anInt760 = -1;
  113. anInt774 = -1;
  114. anInt749 = -1;
  115. childrenIDs = null;
  116. }
  117.  
  118. public void method574(OnDemandFetcher class42_sub1)
  119. {
  120. if(anIntArray773 == null)
  121. return;
  122. for(int j = 0; j < anIntArray773.length; j++)
  123. class42_sub1.method560(anIntArray773[j] & 0xffff, 0);
  124. }
  125.  
  126. public static void nullLoader()
  127. {
  128. mruNodes1 = null;
  129. mruNodes2 = null;
  130. streamIndices = null;
  131. cache = null;
  132. stream = null;
  133. }
  134.  
  135. public static void unpackConfig(NamedArchive archive)
  136. {
  137. stream = new Stream(archive.getDataForName("loc.dat"));
  138. Stream stream = new Stream(archive.getDataForName("loc.idx"));
  139. int totalObjects = stream.readUnsignedWord();
  140. streamIndices = new int[totalObjects+35000];
  141. int i = 2;
  142. for(int j = 0; j < totalObjects; j++)
  143. {
  144. streamIndices[j] = i;
  145. i += stream.readUnsignedWord();
  146. }
  147. cache = new ObjectDef[20];
  148. for(int k = 0; k < 20; k++)
  149. cache[k] = new ObjectDef();
  150. }
  151.  
  152. public boolean method577(int i)
  153. {
  154. if(anIntArray776 == null)
  155. {
  156. if(anIntArray773 == null)
  157. return true;
  158. if(i != 10)
  159. return true;
  160. boolean flag1 = true;
  161. for(int k = 0; k < anIntArray773.length; k++)
  162. flag1 &= Model.method463(anIntArray773[k] & 0xffff);
  163.  
  164. return flag1;
  165. }
  166. for(int j = 0; j < anIntArray776.length; j++)
  167. if(anIntArray776[j] == i)
  168. return Model.method463(anIntArray773[j] & 0xffff);
  169.  
  170. return true;
  171. }
  172.  
  173. public Model method578(int i, int j, int k, int l, int i1, int j1, int k1)
  174. {
  175. Model model = method581(i, k1, j);
  176. if(model == null)
  177. return null;
  178. if(aBoolean762 || aBoolean769)
  179. model = new Model(aBoolean762, aBoolean769, model);
  180. if(aBoolean762)
  181. {
  182. int l1 = (k + l + i1 + j1) / 4;
  183. for(int i2 = 0; i2 < model.anInt1626; i2++)
  184. {
  185. int j2 = model.anIntArray1627[i2];
  186. int k2 = model.anIntArray1629[i2];
  187. int l2 = k + ((l - k) * (j2 + 64)) / 128;
  188. int i3 = j1 + ((i1 - j1) * (j2 + 64)) / 128;
  189. int j3 = l2 + ((i3 - l2) * (k2 + 64)) / 128;
  190. model.anIntArray1628[i2] += j3 - l1;
  191. }
  192.  
  193. model.method467();
  194. }
  195. return model;
  196. }
  197.  
  198. public boolean method579()
  199. {
  200. if(anIntArray773 == null)
  201. return true;
  202. boolean flag1 = true;
  203. for(int i = 0; i < anIntArray773.length; i++)
  204. flag1 &= Model.method463(anIntArray773[i] & 0xffff);
  205. return flag1;
  206. }
  207.  
  208. public ObjectDef method580()
  209. {
  210. int i = -1;
  211. if(anInt774 != -1)
  212. {
  213. VarBit varBit = VarBit.cache[anInt774];
  214. int j = varBit.anInt648;
  215. int k = varBit.anInt649;
  216. int l = varBit.anInt650;
  217. int i1 = client.anIntArray1232[l - k];
  218. i = clientInstance.variousSettings[j] >> k & i1;
  219. } else
  220. if(anInt749 != -1)
  221. i = clientInstance.variousSettings[anInt749];
  222. if(i < 0 || i >= childrenIDs.length || childrenIDs[i] == -1)
  223. return null;
  224. else
  225. return forID(childrenIDs[i]);
  226. }
  227.  
  228. private Model method581(int j, int k, int l)
  229. {
  230. Model model = null;
  231. long l1;
  232. if(anIntArray776 == null)
  233. {
  234. if(j != 10)
  235. return null;
  236. l1 = (long)((type << 6) + l) + ((long)(k + 1) << 32);
  237. Model model_1 = (Model) mruNodes2.insertFromCache(l1);
  238. if(model_1 != null)
  239. return model_1;
  240. if(anIntArray773 == null)
  241. return null;
  242. boolean flag1 = aBoolean751 ^ (l > 3);
  243. int k1 = anIntArray773.length;
  244. for(int i2 = 0; i2 < k1; i2++)
  245. {
  246. int l2 = anIntArray773[i2];
  247. if(flag1)
  248. l2 += 0x10000;
  249. model = (Model) mruNodes1.insertFromCache(l2);
  250. if(model == null)
  251. {
  252. model = Model.method462(l2 & 0xffff);
  253. if(model == null)
  254. return null;
  255. if(flag1)
  256. model.method477();
  257. mruNodes1.removeFromCache(model, l2);
  258. }
  259. if(k1 > 1)
  260. aModelArray741s[i2] = model;
  261. }
  262.  
  263. if(k1 > 1)
  264. model = new Model(k1, aModelArray741s);
  265. } else
  266. {
  267. int i1 = -1;
  268. for(int j1 = 0; j1 < anIntArray776.length; j1++)
  269. {
  270. if(anIntArray776[j1] != j)
  271. continue;
  272. i1 = j1;
  273. break;
  274. }
  275.  
  276. if(i1 == -1)
  277. return null;
  278. l1 = (long)((type << 6) + (i1 << 3) + l) + ((long)(k + 1) << 32);
  279. Model model_2 = (Model) mruNodes2.insertFromCache(l1);
  280. if(model_2 != null)
  281. return model_2;
  282. int j2 = anIntArray773[i1];
  283. boolean flag3 = aBoolean751 ^ (l > 3);
  284. if(flag3)
  285. j2 += 0x10000;
  286. model = (Model) mruNodes1.insertFromCache(j2);
  287. if(model == null)
  288. {
  289. model = Model.method462(j2 & 0xffff);
  290. if(model == null)
  291. return null;
  292. if(flag3)
  293. model.method477();
  294. mruNodes1.removeFromCache(model, j2);
  295. }
  296. }
  297. boolean flag;
  298. flag = anInt748 != 128 || anInt772 != 128 || anInt740 != 128;
  299. boolean flag2;
  300. flag2 = anInt738 != 0 || anInt745 != 0 || anInt783 != 0;
  301. Model model_3 = new Model(modifiedModelColors == null, Class36.method532(k), l == 0 && k == -1 && !flag && !flag2, model);
  302. if(k != -1)
  303. {
  304. model_3.method469();
  305. model_3.method470(k);
  306. model_3.anIntArrayArray1658 = null;
  307. model_3.anIntArrayArray1657 = null;
  308. }
  309. while(l-- > 0)
  310. model_3.method473();
  311. if(modifiedModelColors != null)
  312. {
  313. for(int k2 = 0; k2 < modifiedModelColors.length; k2++)
  314. model_3.method476(modifiedModelColors[k2], originalModelColors[k2]);
  315.  
  316. }
  317. if(flag)
  318. model_3.method478(anInt748, anInt740, anInt772);
  319. if(flag2)
  320. model_3.method475(anInt738, anInt745, anInt783);
  321. model_3.method479(74, 1000, -90, -580, -90, !aBoolean769);
  322. if(anInt760 == 1)
  323. model_3.anInt1654 = model_3.modelHeight;
  324. mruNodes2.removeFromCache(model_3, l1);
  325. return model_3;
  326. }
  327.  
  328. private void readValues(Stream stream)
  329. {
  330. int flag = -1;
  331. do {
  332. int type = stream.readUnsignedByte();
  333. if(type == 0)
  334. break;
  335. if(type == 1)
  336. {
  337. int len = stream.readUnsignedByte();
  338. if(len > 0)
  339. {
  340. if(anIntArray773 == null || lowMem)
  341. {
  342. anIntArray776 = new int[len];
  343. anIntArray773 = new int[len];
  344. for(int k1 = 0; k1 < len; k1++)
  345. {
  346. anIntArray773[k1] = stream.readUnsignedWord();
  347. anIntArray776[k1] = stream.readUnsignedByte();
  348. }
  349. } else
  350. {
  351. stream.currentOffset += len * 3;
  352. }
  353. }
  354. } else
  355. if(type == 2)
  356. name = stream.readNewString();
  357. else
  358. if(type == 3)
  359. description = stream.readBytes();
  360. else
  361. if(type == 5)
  362. {
  363. int len = stream.readUnsignedByte();
  364. if(len > 0)
  365. {
  366. if(anIntArray773 == null || lowMem)
  367. {
  368. anIntArray776 = null;
  369. anIntArray773 = new int[len];
  370. for(int l1 = 0; l1 < len; l1++)
  371. anIntArray773[l1] = stream.readUnsignedWord();
  372. } else
  373. {
  374. stream.currentOffset += len * 2;
  375. }
  376. }
  377. } else
  378. if(type == 14)
  379. anInt744 = stream.readUnsignedByte();
  380. else
  381. if(type == 15)
  382. anInt761 = stream.readUnsignedByte();
  383. else
  384. if(type == 17)
  385. aBoolean767 = false;
  386. else
  387. if(type == 18)
  388. aBoolean757 = false;
  389. else
  390.  
  391. //if(type == 19)
  392. // hasActions = (stream.readUnsignedByte() == 1);//ENABLE TO FIND OBJECT IDs with BAD MODELS!!!!!
  393. if(type == 19) {
  394. flag = stream.readUnsignedByte();
  395. if(flag == 1)
  396. hasActions = true;
  397. }//Enable to have no names with null and whatever
  398. else
  399. if(type == 21)
  400. aBoolean762 = true;
  401. else
  402. if(type == 22)
  403. aBoolean769 = true;
  404. else
  405. if(type == 23)
  406. aBoolean764 = true;
  407. else
  408. if(type == 24)
  409. {
  410. anInt781 = stream.readUnsignedWord();
  411. if(anInt781 == 65535)
  412. anInt781 = -1;
  413. } else
  414. if(type == 28)
  415. anInt775 = stream.readUnsignedByte();
  416. else
  417. if(type == 29)
  418. aByte737 = stream.readSignedByte();
  419. else
  420. if(type == 39)
  421. aByte742 = stream.readSignedByte();
  422. else
  423. if(type >= 30 && type < 39)
  424. {
  425. if(itemActions == null)
  426. itemActions = new String[5];
  427. itemActions[type - 30] = stream.readNewString();
  428. if(itemActions[type - 30].equalsIgnoreCase("hidden"))
  429. itemActions[type - 30] = null;
  430. } else
  431. if(type == 40)
  432. {
  433. int i1 = stream.readUnsignedByte();
  434. modifiedModelColors = new int[i1];
  435. originalModelColors = new int[i1];
  436. for(int i2 = 0; i2 < i1; i2++)
  437. {
  438. modifiedModelColors[i2] = stream.readUnsignedWord();
  439. originalModelColors[i2] = stream.readUnsignedWord();
  440. }
  441.  
  442. } else
  443. if(type == 60)
  444. anInt746 = stream.readUnsignedWord();
  445. else
  446. if(type == 62)
  447. aBoolean751 = true;
  448. else
  449. if(type == 64)
  450. aBoolean779 = false;
  451. else
  452. if(type == 65)
  453. anInt748 = stream.readUnsignedWord();
  454. else
  455. if(type == 66)
  456. anInt772 = stream.readUnsignedWord();
  457. else
  458. if(type == 67)
  459. anInt740 = stream.readUnsignedWord();
  460. else
  461. if(type == 68)
  462. anInt758 = stream.readUnsignedWord();
  463. else
  464. if(type == 69)
  465. anInt768 = stream.readUnsignedByte();
  466. else
  467. if(type == 70)
  468. anInt738 = stream.readSignedWord();
  469. else
  470. if(type == 71)
  471. anInt745 = stream.readSignedWord();
  472. else
  473. if(type == 72)
  474. anInt783 = stream.readSignedWord();
  475. else
  476. if(type == 73)
  477. aBoolean736 = true;
  478. else
  479. if(type == 74)
  480. aBoolean766 = true;
  481. else
  482. if(type == 75)
  483. anInt760 = stream.readUnsignedByte();
  484. else
  485. if(type == 77)
  486. {
  487. anInt774 = stream.readUnsignedWord();
  488. if(anInt774 == 65535)
  489. anInt774 = -1;
  490. anInt749 = stream.readUnsignedWord();
  491. if(anInt749 == 65535)
  492. anInt749 = -1;
  493. int j1 = stream.readUnsignedByte();
  494. childrenIDs = new int[j1 + 1];
  495. for(int j2 = 0; j2 <= j1; j2++)
  496. {
  497. childrenIDs[j2] = stream.readUnsignedWord();
  498. if(childrenIDs[j2] == 65535)
  499. childrenIDs[j2] = -1;
  500. }
  501. }
  502. } while(true);
  503. if(flag == -1)
  504. {
  505. hasActions = anIntArray773 != null && (anIntArray776 == null || anIntArray776[0] == 10);
  506. if(itemActions != null)
  507. hasActions = true;
  508. }
  509. if(aBoolean766)
  510. {
  511. aBoolean767 = false;
  512. aBoolean757 = false;
  513. }
  514. if(anInt760 == -1)
  515. anInt760 = aBoolean767 ? 1 : 0;
  516. }
  517.  
  518. private ObjectDef()
  519. {
  520. type = -1;
  521. }
  522.  
  523. public boolean aBoolean736;
  524. private byte aByte737;
  525. private int anInt738;
  526. public String name;
  527. private int anInt740;
  528. private static final Model[] aModelArray741s = new Model[4];
  529. private byte aByte742;
  530. public int anInt744;
  531. private int anInt745;
  532. public int anInt746;
  533. private int[] originalModelColors;
  534. private int anInt748;
  535. public int anInt749;
  536. private boolean aBoolean751;
  537. public static boolean lowMem;
  538. private static Stream stream;
  539. public int type;
  540. private static int[] streamIndices;
  541. public boolean aBoolean757;
  542. public int anInt758;
  543. public int childrenIDs[];
  544. private int anInt760;
  545. public int anInt761;
  546. public boolean aBoolean762;
  547. public boolean aBoolean764;
  548. public static client clientInstance;
  549. private boolean aBoolean766;
  550. public boolean aBoolean767;
  551. public int anInt768;
  552. private boolean aBoolean769;
  553. private static int cacheIndex;
  554. private int anInt772;
  555. private int[] anIntArray773;
  556. public int anInt774;
  557. public int anInt775;
  558. private int[] anIntArray776;
  559. public byte description[];
  560. public boolean hasActions;
  561. public boolean aBoolean779;
  562. public static MRUNodes mruNodes2 = new MRUNodes(30);
  563. public int anInt781;
  564. private static ObjectDef[] cache;
  565. private int anInt783;
  566. private int[] modifiedModelColors;
  567. public static MRUNodes mruNodes1 = new MRUNodes(500);
  568. public String itemActions[];
  569.  
  570. }
Advertisement
Add Comment
Please, Sign In to add comment