Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. package virtuous.model.players.skills;
  2.  
  3. import virtuous.Config;
  4. import virtuous.model.content.Task;
  5. import virtuous.model.players.Client;
  6. import virtuous.model.players.Player;
  7. //import virtuous.util.Operations;
  8.  
  9. /**
  10. * RuneCrafting.java
  11. *
  12. * @author Sanity
  13. *
  14. **/
  15.  
  16. public class Runecrafting {
  17.  
  18. private Client c;
  19.  
  20. public Runecrafting(Client c) {
  21. this.c = c;
  22. }
  23.  
  24. /**
  25. * Rune essence ID constant.
  26. */
  27. private static final int RUNE_ESS = 1436;
  28.  
  29. /**
  30. * Pure essence ID constant.
  31. */
  32. private static final int PURE_ESS = 7936;
  33.  
  34. /**
  35. * An array containing the rune item numbers.
  36. */
  37. public int[] runes = {556 /*Air*/, 558 /*Mind*/, 555 /*Water*/, 557 /*Earth*/, 554 /*Fire*/, 559 /*Body*/, 564 /*Cosmic*/, 562 /*Chaos*/, 9075 /*Astral*/,
  38. 561 /*Nature*/, 563 /*Law*/, 560 /*Death*/, 565 /*Blood*/, 566 /*Soul*/};
  39.  
  40. /**
  41. * An array containing the object IDs of the runecrafting altars.
  42. */
  43. //Air Mind Water Earth Fire Body Cosmic Chaos Astral Nature Law Death Blood Soul
  44. public int[] altarIDs = { 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 17010, 2486, 2487, 2488, 2489, 2490};
  45.  
  46. /**
  47. * 2D Array containing the IDs of both the runecrafting altars and their respective talismans needed.
  48. */
  49. public int[][] TALISMANS = { {2478, 1438}, {2479, 1448}, {2480, 1444}, {2481, 1440}, {2482, 1442}, {2483, 1446}, {2484, 1454}, {2485, 1452}, {2486, 1462}, {2487, 1458}, {2488, 1456}, {2489, 1450}, {2490, 1460} };
  50.  
  51. /**
  52. * 2D Array containing the levels required to craft the specific rune.
  53. */
  54. public int[][] craftLevelReq = {{556,1},{558,1},{555,5},{557,9},{554,14},{559,20},{564,27},{562,35},{9075,40},{561,44},{563,54},{560,65},{565,77},{566,92}};
  55.  
  56. public int[] runecraftExp = { 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44 };
  57.  
  58. /**
  59. * Replaces essence in the inventory with the specified rune.
  60. */
  61. private void replaceEssence(int essType, int runeID, int multiplier, int index) {
  62.  
  63. int exp = runecraftExp[index];
  64. while(c.getItems().playerHasItem(essType)) {
  65. c.getItems().deleteItem(essType, 1);
  66. c.getItems().addItem(runeID, multiplier);
  67. c.getPA().addSkillXP((int) (c.isDoingTask ? (exp * Config.RUNECRAFTING_EXPERIENCE * Task.TASK_XP_MULTIPLIER) : exp * Config.RUNECRAFTING_EXPERIENCE) , Player.RUNECRAFTING);
  68. }
  69.  
  70. if(c.isDoingTask && c.taskId == 6) {
  71. if(c.taskProgress < c.amount) {
  72. c.taskProgress++;
  73. c.getTask().taskProgress2();
  74. } else {
  75. c.getTask().taskReward(6);
  76. }
  77. }
  78. }
  79.  
  80. public boolean hasCorrectTalisman(int altarID)
  81. {
  82. for (int[] i : TALISMANS)
  83. if (i[0] == altarID && c.getItems().playerHasItem(i[1]))
  84. return true;
  85. return false;
  86. }
  87.  
  88. /**
  89. * Crafts the specific rune.
  90. */
  91. public void craftRunes(int altarID)
  92. {
  93. int runeID = 0;
  94.  
  95. for (int i = 0; i < altarIDs.length; i++)
  96. if (altarID == altarIDs[i])
  97. runeID = runes[i];
  98.  
  99. for (int i = 0; i < craftLevelReq.length; i++)
  100. {
  101. if (runeID == craftLevelReq[i][0])
  102. {
  103. if (c.playerLevel[20] >= craftLevelReq[i][1])
  104. {
  105. if (c.getItems().playerHasItem(RUNE_ESS) || c.getItems().playerHasItem(PURE_ESS))
  106. {
  107. if (hasCorrectTalisman(altarID) || altarID == 17010)
  108. {
  109. replaceEssence(c.getItems().playerHasItem(RUNE_ESS) ? RUNE_ESS : PURE_ESS, runeID, c.getItems().playerHasItem(RUNE_ESS) ? c.getItems().getItemAmount(RUNE_ESS) : c.getItems().getItemAmount(PURE_ESS), i);
  110. c.forceAnim(791);
  111. // c.frame174(481, 0, 0); for sound
  112. c.gfx100(186);
  113. c.getPA().setPlayerInformation();
  114. return;
  115. }
  116. c.sendMessage("[@red@RUNECRAFT@bla@] You need to have the correct talisman to craft runes!");
  117. return;
  118. }
  119. c.sendMessage("[@red@RUNECRAFT@bla@] You need to have essence to craft runes!");
  120. return;
  121. }
  122. c.sendMessage("[@red@RUNECRAFT@bla@] You need a Runecrafting level of @red@" + craftLevelReq[i][1] + " @bla@to craft this rune.");
  123. return;
  124. }
  125. }
  126. }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement