Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package virtuous.model.players.skills;
- import virtuous.Config;
- import virtuous.model.content.Task;
- import virtuous.model.players.Client;
- import virtuous.model.players.Player;
- //import virtuous.util.Operations;
- /**
- * RuneCrafting.java
- *
- * @author Sanity
- *
- **/
- public class Runecrafting {
- private Client c;
- public Runecrafting(Client c) {
- this.c = c;
- }
- /**
- * Rune essence ID constant.
- */
- private static final int RUNE_ESS = 1436;
- /**
- * Pure essence ID constant.
- */
- private static final int PURE_ESS = 7936;
- /**
- * An array containing the rune item numbers.
- */
- public int[] runes = {556 /*Air*/, 558 /*Mind*/, 555 /*Water*/, 557 /*Earth*/, 554 /*Fire*/, 559 /*Body*/, 564 /*Cosmic*/, 562 /*Chaos*/, 9075 /*Astral*/,
- 561 /*Nature*/, 563 /*Law*/, 560 /*Death*/, 565 /*Blood*/, 566 /*Soul*/};
- /**
- * An array containing the object IDs of the runecrafting altars.
- */
- //Air Mind Water Earth Fire Body Cosmic Chaos Astral Nature Law Death Blood Soul
- public int[] altarIDs = { 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 17010, 2486, 2487, 2488, 2489, 2490};
- /**
- * 2D Array containing the IDs of both the runecrafting altars and their respective talismans needed.
- */
- 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} };
- /**
- * 2D Array containing the levels required to craft the specific rune.
- */
- 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}};
- public int[] runecraftExp = { 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44 };
- /**
- * Replaces essence in the inventory with the specified rune.
- */
- private void replaceEssence(int essType, int runeID, int multiplier, int index) {
- int exp = runecraftExp[index];
- while(c.getItems().playerHasItem(essType)) {
- c.getItems().deleteItem(essType, 1);
- c.getItems().addItem(runeID, multiplier);
- c.getPA().addSkillXP((int) (c.isDoingTask ? (exp * Config.RUNECRAFTING_EXPERIENCE * Task.TASK_XP_MULTIPLIER) : exp * Config.RUNECRAFTING_EXPERIENCE) , Player.RUNECRAFTING);
- }
- if(c.isDoingTask && c.taskId == 6) {
- if(c.taskProgress < c.amount) {
- c.taskProgress++;
- c.getTask().taskProgress2();
- } else {
- c.getTask().taskReward(6);
- }
- }
- }
- public boolean hasCorrectTalisman(int altarID)
- {
- for (int[] i : TALISMANS)
- if (i[0] == altarID && c.getItems().playerHasItem(i[1]))
- return true;
- return false;
- }
- /**
- * Crafts the specific rune.
- */
- public void craftRunes(int altarID)
- {
- int runeID = 0;
- for (int i = 0; i < altarIDs.length; i++)
- if (altarID == altarIDs[i])
- runeID = runes[i];
- for (int i = 0; i < craftLevelReq.length; i++)
- {
- if (runeID == craftLevelReq[i][0])
- {
- if (c.playerLevel[20] >= craftLevelReq[i][1])
- {
- if (c.getItems().playerHasItem(RUNE_ESS) || c.getItems().playerHasItem(PURE_ESS))
- {
- if (hasCorrectTalisman(altarID) || altarID == 17010)
- {
- 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);
- c.forceAnim(791);
- // c.frame174(481, 0, 0); for sound
- c.gfx100(186);
- c.getPA().setPlayerInformation();
- return;
- }
- c.sendMessage("[@red@RUNECRAFT@bla@] You need to have the correct talisman to craft runes!");
- return;
- }
- c.sendMessage("[@red@RUNECRAFT@bla@] You need to have essence to craft runes!");
- return;
- }
- c.sendMessage("[@red@RUNECRAFT@bla@] You need a Runecrafting level of @red@" + craftLevelReq[i][1] + " @bla@to craft this rune.");
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement