Adblock breaks this site

[Snippet] Runecrafting & Abyss Rifts [PI]

Discussion in 'RuneScape Programming' started by 01053, Aug 10, 2016.

  1. 01053

    01053 Member

    Joined:
    Aug 8, 2016
    Posts:
    36
    Referrals:
    0
    Sythe Gold:
    40
    [Snippet] Runecrafting & Abyss Rifts [PI]

    Runecrafting & Abyss Rifts for Altars

    [​IMG]

    Create a new class and name it Runecrafting, put this code inside it:​

    Code:
    package com.perception.model.players.skills.Runecrafting;
    
    import com.perception.model.players.Player;
    
    /**
    * @Author 01053
    */
    
    public class Runecrafting {
    
        private static enum AltarData {
    
            Air_Altar(14897, 556, 5527, 5, 190, new int[] {1, 11, 22, 33, 44, 55, 66, 77, 88, 99}),
            Mind_Altar(14898, 558, 5529, 6, 200, new int[] {1, 14, 28, 42, 56, 70, 84, 98}),
            Water_Altar(14899, 555, 5531, 7, 210, new int[] {5, 19, 38, 57, 76, 95}),
            Earth_Altar(14900, 557, 5535, 8, 220, new int[] {9, 26, 52, 78}),
            Fire_Altar(14901, 554, 5537, 9, 230, new int[] {14, 35, 70}),
            Body_Altar(14902, 559, 5533, 10, 250, new int[] {20, 46, 92}),
            Cosmic_Altar(14903, 564, 5539, 11, 280, new int[] {27, 59}),
            Chaos_Altar(14906, 562, 5543, 12, 310, new int[] {35, 74}),
            Nature_Altar(14905, 561, 5541, 13, 330, new int[] {44, 91}),
            Law_Altar(14904, 563, 5545, 14, 360, new int[] {54}),
            Death_Altar(14907, 560, 5547, 15, 380, new int[] {65}),
            Astral_Altar(14911, 9075, 5547, 15, 390, new int[] {40, 82}),
            Blood_Altar(27978, 565, 5549, 16, 410, new int[] {77}),
            Soul_Altar(27980, 566, 5551, 17, 430, new int[] {90});
    
            private int altarType, runeType, tiaraType, experience;
            private double tiaraBonus;
            private int[] multiplier;
    
            private AltarData(int altarType, int runeType, int tiaraType, double tiaraBonus, int experience, int[] multiplier) {
                this.altarType = altarType;
                this.runeType = runeType;
                this.tiaraType = tiaraType;
                this.tiaraBonus = tiaraBonus;
                this.experience = experience;
                this.multiplier = multiplier;
            }
    
            public int getAltarId() {
                return altarType;
            }
    
            public int getRuneId() {
                return runeType;
            }
    
            public int getTiaraId() {
                return tiaraType;
            }
    
            public double getTiaraBonus() {
                return tiaraBonus;
            }
    
            public double getXp() {
                return experience;
            }
    
            public int getLevel() {
                return multiplier[0];
            }
        }
    
        public static void Craft(final Player c, final int objectId) {
            for (AltarData r : AltarData.values()) {
                if (objectId == r.getAltarId()) {
                    if (c.playerLevel[20] >= r.getLevel()) {
                        if (c.getItems().playerHasItem(1436)) {
                            c.animation(791);
                            c.gfx100(186);
                            int multiplier = 1;
                            for (int i = 1; i < r.multiplier.length; i++) {
                                if (c.playerLevel[20] >= r.multiplier[i]) {
                                    multiplier = i;
                                }
                            }
                            if(r == AltarData.Nature_Altar)
                                multiplier *= 2;
                            while(c.getItems().playerHasItem(1436) && (c.playerEquipment[c.playerHat] == r.getTiaraId()) ) {
                                c.getItems().deleteItem(1436, 1);
                                c.getItems().addItem(r.getRuneId(), multiplier);
                                c.getPA().addSkillXP((int) (r.getXp() + r.getTiaraBonus()) * 3, 20);
                            }
                            while (c.getItems().playerHasItem(1436) && (c.playerEquipment[c.playerHat] != r.getTiaraId())) {
                                c.getItems().deleteItem(1436, 1);
                                c.getItems().addItem(r.getRuneId(), multiplier);
                                c.getPA().addSkillXP((int) (r.getXp()) * 3, 20);
                            }
                        }
                    } else {
                        c.sendMessage("You need a runecrafting level of " + r.getLevel() + " to craft this rune.");
                        return;
                    }
                }
            }
        }
    }
    

    Create a new class and call it Rifts, put this code inside of it:​
    Code:
    package com.perception.model.players.skills.Runecrafting;
    
    import com.perception.model.players.Player;
    
    /**
    * @author 01053
    */
    
    public class Rifts {
    
        private static enum riftData {
            Air_Rift(25378, 1, 2841, 4829, 0),
            Mind_Rift(25379, 2, 2793, 4828, 0),
            Water_Rift(25376, 5, 2725, 4832, 0),
            Earth_Rift(24972, 9, 2655, 4830, 0),
            Fire_Rift(24971, 14, 2574, 4848, 0),
            Body_Rift(24973, 20, 2521, 4835, 0),
            Cosmic_Rift(24974, 27, 2162, 4833, 0),
            Chaos_Rift(24976, 35, 2281, 4837, 0),
            Nature_Rift(24975, 44, 2400, 4835, 0),
            Law_Rift(25034, 54, 2464, 4818, 0),
            Death_Rift(25035, 65, 2208, 4830, 0),
            Blood_Rift(25380, 77, 1716, 3827, 0),
            Soul_Rift(25377, 90, 1813, 3852, 0);
    
            private int riftType, requirement, coordX, coordY, height;
    
            private riftData(int riftType, int requirement, int coordX, int coordY, int height) {
                this.riftType = riftType;
                this.requirement = requirement;
                this.coordX = coordX;
                this.coordY = coordY;
                this.height = height;
            }
    
            public int getRiftId() {
                return riftType;
            }
    
            public int getRequiredLevel() {
                return requirement;
            }
    
            public int getCoordinateX() {
                return coordX;
            }
    
            public int getCoordinateY() {
                return coordY;
            }
    
            public int getHeight() {
                return height;
            }
        }
    
        public static void teleport(final Player c, final int objectId) {
            for (riftData r : riftData.values()) {
                if (objectId == r.getRiftId()) {
                    if (c.playerLevel[20] >= r.getRequiredLevel()) {
                        c.getPA().movePlayer(r.getCoordinateX(), r.getCoordinateY(), r.getHeight());
                    } else {
                        c.sendMessage("You need a runecrafting level of " + r.getRequiredLevel() + " to teleport to this altar.");
                    }
                }
            }
        }
    }
    Inside of ClickObject.java below the switch statement for the first click action add:​

    Code:
                Runecrafting.Craft(c, c.objectId);
                Rifts.teleport(c, c.objectId);
     
    Last edited: Aug 10, 2016
  2. Sebast

    Sebast Every lie we tell incurs a debt to the truth
    $100 USD Donor New

    Joined:
    Jul 26, 2016
    Posts:
    2,426
    Referrals:
    1
    Sythe Gold:
    1,755
    Vouch Thread:
    Click Here
    Discord Unique ID:
    1225102150045143093
    Discord Username:
    absi.98
    M
    Detective Secret Santa
    [Snippet] Runecrafting & Abyss Rifts [PI]

    You used to own Dreamscape? And good job. Could be done in another way.
     
    Last edited: Aug 10, 2016
  3. 01053

    01053 Member

    Joined:
    Aug 8, 2016
    Posts:
    36
    Referrals:
    0
    Sythe Gold:
    40
    [Snippet] Runecrafting & Abyss Rifts [PI]

    Yes I did, and yes there's many ways to do it :) I wrote this quite a while ago just thought I'd get things going in this section.
     
    Sebast likes this.
  4. Wonderland

    Wonderland spokesman

    Joined:
    Oct 28, 2012
    Posts:
    10,442
    Referrals:
    0
    Sythe Gold:
    1,154
    [Snippet] Runecrafting & Abyss Rifts [PI]

    Thanks for sharing.
     
  5. Fiber Optic

    Fiber Optic Member
    Banned

    Joined:
    Jul 30, 2016
    Posts:
    67
    Referrals:
    0
    Sythe Gold:
    86
    [Snippet] Runecrafting & Abyss Rifts [PI]

    Thanks for the contribution, im sure alot of aspiring coders will appreciate this.
     
  6. Decimate

    Decimate Grand Master
    Decimate Donor You Shall Not Pass

    Joined:
    Jan 6, 2016
    Posts:
    3,662
    Referrals:
    1
    Sythe Gold:
    840
    Discord Unique ID:
    677937710572503108
    Discord Username:
    decimate
    I saw Matthew Nitro Booster
    [Snippet] Runecrafting & Abyss Rifts [PI]

    Looks decent. If you're proud of it, that's all that matters. :D
     
    Last edited: Aug 10, 2016
  7. LitePixels

    LitePixels Active Member

    Joined:
    Jul 5, 2016
    Posts:
    115
    Referrals:
    0
    Sythe Gold:
    85
    [Snippet] Runecrafting & Abyss Rifts [PI]

    Thanks for sharing very helpful indeed
     
< [667 Snippet] Spotlight concept | Need Alpha testers ASAP >


 
 
Adblock breaks this site