armark1ng

Untitled

Sep 10th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. private ItemModify[] generateItemModify(Item[] items, Item[] cosmetics) {
  2. ItemModify[] modify = new ItemModify[15];
  3. for (int slotId = 0; slotId < modify.length; slotId++) {
  4. int id = items[slotId] == null ? -1 : items[slotId].getId();
  5. if (id == 32152 || id == 32153 || id == 20768 || id == 20770 || id == 20772 || id == 20767 || id == 20769
  6. || id == 20771)
  7. setItemModifyColor(items[slotId], slotId, modify, id == 32151 || id == 20768 || id == 20767
  8. ? player.getMaxedCapeCustomized() : player.getCompletionistCapeCustomized());
  9. else if (id == 20708 || id == 20709) {
  10. ClansManager manager = player.getClanManager();
  11. if (manager == null)
  12. continue;
  13. int[] colors = manager.getClan().getMottifColors();
  14. setItemModifyColor(items[slotId], slotId, modify, colors);
  15. setItemModifyTexture(items[slotId], slotId, modify,
  16. new short[] { (short) ClansManager.getMottifTexture(manager.getClan().getMottifTop()),
  17. (short) ClansManager.getMottifTexture(manager.getClan().getMottifBottom()) });
  18. } else if (player.getAuraManager().isActivated() && slotId == Equipment.SLOT_AURA) {
  19. int auraId = player.getEquipment().getAuraId();
  20. if (auraId == -1)
  21. continue;
  22. int modelId = player.getAuraManager().getAuraModelId();
  23. int modelId2 = player.getAuraManager().getAuraModelId2();
  24. setItemModifyModel(items[slotId], slotId, modify, modelId, modelId, modelId2, modelId2, -1, -1);
  25. }
  26. }
  27. return modify;
  28. }
  29.  
  30. private void setItemModifyModel(Item item, int slotId, ItemModify[] modify, int maleModelId1, int femaleModelId1,
  31. int maleModelId2, int femaleModelId2, int maleModelId3, int femaleModelId3) {
  32. ItemDefinitions defs = item.getDefinitions();
  33. if (defs.getMaleWornModelId1() == -1 || defs.getFemaleWornModelId1() == -1)
  34. return;
  35. if (modify[slotId] == null)
  36. modify[slotId] = new ItemModify();
  37. modify[slotId].maleModelId1 = maleModelId1;
  38. modify[slotId].femaleModelId1 = femaleModelId1;
  39. if (defs.getMaleWornModelId2() != -1 || defs.getFemaleWornModelId2() != -1) {
  40. modify[slotId].maleModelId2 = maleModelId2;
  41. modify[slotId].femaleModelId2 = femaleModelId2;
  42. }
  43. if (defs.getMaleWornModelId3() != -1 || defs.getFemaleWornModelId3() != -1) {
  44. modify[slotId].maleModelId2 = maleModelId3;
  45. modify[slotId].femaleModelId2 = femaleModelId3;
  46. }
  47. }
  48.  
  49. private void setItemModifyTexture(Item item, int slotId, ItemModify[] modify, short[] textures) {
  50. ItemDefinitions defs = item.getDefinitions();
  51. if (defs.originalTextureColors == null || defs.originalTextureColors.length != textures.length)
  52. return;
  53. if (Arrays.equals(textures, defs.originalTextureColors))
  54. return;
  55. if (modify[slotId] == null)
  56. modify[slotId] = new ItemModify();
  57. modify[slotId].textures = textures;
  58. }
  59.  
  60. private void setItemModifyColor(Item item, int slotId, ItemModify[] modify, int[] colors) {
  61. ItemDefinitions defs = item.getDefinitions();
  62. if (defs.originalModelColors == null || defs.originalModelColors.length != colors.length)
  63. return;
  64. if (Arrays.equals(colors, defs.originalModelColors))
  65. return;
  66. if (modify[slotId] == null)
  67. modify[slotId] = new ItemModify();
  68. modify[slotId].colors = colors;
  69. }
  70.  
  71. private static class ItemModify {
  72.  
  73. private int[] colors;
  74. private short[] textures;
  75. private int maleModelId1;
  76. private int femaleModelId1;
  77. private int maleModelId2;
  78. private int femaleModelId2;
  79. private int maleModelId3;
  80. private int femaleModelId3;
  81.  
  82. private ItemModify() {
  83. maleModelId1 = femaleModelId1 = -1;
  84. maleModelId2 = femaleModelId2 = -2;
  85. maleModelId3 = femaleModelId3 = -2;
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment