Thread: [508]adding 100% prayer[508]

Page 1 of 3 123 LastLast
Results 1 to 10 of 25
  1. #1 [508]adding 100% prayer[508] 
    Registered Member Wired's Avatar
    Join Date
    Jul 2008
    Age
    31
    Posts
    332
    Thanks given
    0
    Thanks received
    8
    Rep Power
    31
    Description: To add a base for 100% working prayer.

    Difficulty: 3/10

    Assumed Knowledge: Usage of 508 servers, where files are located etc.

    Tested Server: palidino 508 and t3l3nowscape v1(not released)

    Files/Classes Modified/Created: Player.java, ActionButtons.java, Prayer.java

    Procedure
    Step 1: First off we're going to create the Prayer class. Start by making a new file called Prayer.java in palidino76/rs2/io/packets.

    Step 2: Now we're going to create the package and add our imports:
    Code:
    package palidino76.rs2.io.packets;
    import palidino76.rs2.players.Player;
    /*Add more imports when required*/
    then open your class:
    Code:
    public class Prayer {
    Step 3: Now for the most important method of the whole class. This method checks which button is being pressed and activates or de-activates the relevant prayer, Dependant on whether the player is high enough prayer, and has more than 0 prayer points. This method also checks for head icons on prayers that require it. There may be more efficient ways of doing this, I just felt this way was easier and less code. The code is pretty much self explanatory .

    Code:
    	public void Prayer(Player p, int buttonId) {
    		int x = 0;
    		/*Prayer button id's range from 5-57, increasing by 2 each time.*/
    		for(int i = 5; i < 59; i += 2) {
    			/*Checks if the loop mathces the button pressed*/
    			/*Checks if the player has more than 0 prayer points*/
    			if(buttonId == i && p.skillLvl[5] > 0) {
    				/*Checks if the players prayer level is high enough*/
    				if(p.getLevelForXP(5) >= prayerLevel[x]) {
    					/*Switches off other prayers affected by the prayer selected*/
    					switchPrayers(p, x);
    					/*Changes prayer status on/off*/
    					p.prayOn[x] = !p.prayOn[x];
    					/*Changes prayer config status, 0 for off or 1 for on*/
    					p.frames.setConfig(p, prayerConfig[x], p.prayOn[x] ? 1 : 0);
    					/*Checks if the prayer requires a headicon*/
    					if(x >= 16 && x <= 18 || x >= 21 && x <= 24) {
    						if(p.prayOn[x]) {
    						/*Gets the required pray icon if prayer is being switched on*/
    						getHeadIcon(p, x);
    						}
    						else {
    						/*Removes head icon if prayer is being switched off*/
    						p.prayerIcon = -1;
    						}
    					}
    					if(p.prayOn[x]) {
    						/*Increases the rate at which prayer drains if switched on*/
    						p.drainRate += drainRate[x];
    					}
    					else {
    						/*Decreases the rate at which prayer drains if switched off*/
    						p.drainRate -= drainRate[x];
    					}
    					p.appearanceUpdateReq = true;
    					p.updateReq = true;
    				}
    				else {
    					p.frames.sendMessage(p, "You need a prayer level of "+prayerLevel[x]+" to use this.");
    				}
    			}
    			/*Counts which prayer is being used*/
    			x++;
    		}
    	}

    Step 4: Now we need to add some more methods to make the above method work properly. Add these arrays, which check for prayer levels required, which config to turn on/off and what rate the corresponding prayer drains at:

    Code:
    /* Configs for prayers */
        public int prayerConfig[] =
        {83, 84, 85, 862, 863, 86, 87,
        88, 89, 90, 91, 864, 865, 92,
        93, 94, 95, 96, 97, 866, 867,
        98, 99, 100, 1168, 1052, 1053};
    
    	/* Prayer levels required */
    	public int prayerLevel[] =
    	{1, 4, 7, 8, 9, 10, 13,
    	16, 19, 22, 25, 26, 27, 28,
    	31, 34, 37, 40, 43, 44, 45,
    	46, 49, 52, 35, 60, 70};
    
    	/* Drain rate of each prayer */
    	public int drainRate[] =
    	{3, 4, 5, 6, 7, 8, 9,
    	10, 6, 7, 6, 12, 13, 14,
    	15, 16, 17, 18, 19, 20, 21,
    	22, 23, 24, 15, 26, 28};
    You'll also need to add this method, which checks for which head icon is required:
    Code:
    /* Method to check for head icon */
    	public void getHeadIcon(Player p, int i) {
    		switch(i) {
    			case 16:
    			p.prayerIcon = 2;
    			break;
    			case 17:
    			p.prayerIcon = 1;
    			break;
    			case 18:
    			p.prayerIcon = 0;
    			break;
    			case 21:
    			p.prayerIcon = 3;
    			break;
    			case 22:
    			p.prayerIcon = 5;
    			break;
    			case 23:
    			p.prayerIcon = 4;
    			break;
    			case 24:
    			p.prayerIcon = 7;
    			break;
    		}
    	}
    Now for the longest method, which I'm sure there must be a more efficient way of doing, but this is my way of doing it . This method checks which prayers must be switched off when a new prayer is activated:
    Code:
    /* Method to switch prayers */
    	public void switchPrayers(Player p, int i) {
    		switch(i) {
    			/*i represents which prayer is being used*/
    			case 0:
    			/*Array created for prayers to switch off*/
    			int[] off = {5, 13, 3, 4, 11, 12, 19, 20};
    			/*Switches off all prayers in the array*/
    			prayerOff(p, off);
    			break;
    			case 1:
    			int[] off2 = {6, 14, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off2);
    			break;
    			case 2:
    			int[] off3 = {7, 15, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off3);
    			break;
    			case 3:
    			int[] off4 = {0, 1, 2,  5, 13, 6, 14, 7, 15, 4, 11, 12, 19, 20};
    			prayerOff(p, off4);
    			break;
    			case 4:
    			int[] off5 = {0, 1, 2, 5, 13, 6, 14, 7, 15, 3, 11, 12, 19, 20};
    			prayerOff(p, off5);
    			break;
    			case 5:
    			int[] off6 = {0, 13, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off6);
    			break;
    			case 6:
    			int[] off7 = {1, 14, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off7);
    			break;
    			case 7:
    			int[] off8 = {2, 15, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off8);
    			break;
    			case 8:
    			int[] off9 = {9};
    			prayerOff(p, off9);
    			break;
    			case 9:
    			int[] off10 = {8};
    			prayerOff(p, off10);
    			break;
    			case 11:
    			int[] off11 = {5, 13, 6, 14, 7, 15, 4, 3, 12, 19, 20};
    			prayerOff(p, off11);
    			break;
    			case 12:
    			int[] off12 = {5, 13, 6, 14, 7, 15, 3, 11, 4, 19, 20};
    			prayerOff(p, off12);
    			break;
    			case 13:
    			int[] off13 = {5, 0, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off13);
    			break;
    			case 14:
    			int[] off14 = {6, 1, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off14);
    			break;
    			case 15:
    			int[] off15 = {7, 2, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off15);
    			break;
    			case 16:
    			int[] off16 = {17, 18, 21, 22, 23, 24};
    			prayerOff(p, off16);
    			break;
    			case 17:
    			int[] off17 = {16, 18, 21, 22, 23, 24};
    			prayerOff(p, off17);
    			break;
    			case 18:
    			int[] off18 = {17, 16, 21, 22, 23, 24};
    			prayerOff(p, off18);
    			break;
    			case 19:
    			int[] off19 = {5, 13, 6, 14, 7, 15, 4, 11, 12, 3, 20};
    			prayerOff(p, off19);
    			break;
    			case 20:
    			int[] off20 = {5, 13, 6, 14, 7, 15, 3, 11, 12, 19, 4};
    			prayerOff(p, off20);
    			break;
    			case 21:
    			int[] off21 = {17, 18, 16, 22, 23, 24};
    			prayerOff(p, off21);
    			break;
    			case 22:
    			int[] off22 = {17, 18, 21, 16, 23, 24};
    			prayerOff(p, off22);
    			break;
    			case 23:
    			int[] off23 = {17, 18, 21, 22, 16, 24};
    			prayerOff(p, off23);
    			break;
    			case 24:
    			int[] off24 = {17, 18, 21, 22, 16, 23};
    			prayerOff(p, off24);
    			break;
    			case 25:
    			int[] off25 = {0, 1, 2, 5, 6, 7, 13, 14, 15, 26};
    			prayerOff(p, off25);
    			break;
    			case 26:
    			int[] off26 = {0, 1, 2, 5, 6, 7, 13, 14, 15, 25};
    			prayerOff(p, off26);
    			break;
    		}
    	}
    And of course you need to add the prayerOff method to make that work:
    Code:
    	/* Method to switch prayers off */
    	public void prayerOff(Player p, int[] prayers) {
    		for(int z = 0; z < prayers.length; z++) {
    			if(p.prayOn[prayers[z]]) {
    				p.prayOn[prayers[z]] = false;
    				p.frames.setConfig(p, prayerConfig[prayers[z]], 0);
    				p.drainRate -= drainRate[prayers[z]];
    			}
    		}
    	}
    And the final method you will need is resetPrayers, which de-activates all prayers when a player dies or runs out of prayer points:

    Code:
    	/*Resets all prayer configs*/
    	/*Turns off all prayers*/
    	/*Removes headicons*/
    	public void resetPrayers(Player p) {
    		for(int i = 0; i < 21; i++) {
    			if(p.prayOn[i]) {
    			p.prayOn[i] = false;
    			p.frames.setConfig(p, prayerConfig[i], 0);
    			}
    		}
    		p.drainRate = 0;
    		p.prayerIcon = -1;
    		p.appearanceUpdateReq = true;
    		p.updateReq = true;
    	}
    Phew! That was alot of methods . Now close your whole prayer class by placing a final: }
    Now save your final Prayer.java and lets start on some other files.

    Step 5: Open up Player.java, declare all these:
    Code:
        public int prayerDrain = 100;
        public int drainRate = 0;
        public int defLow = 0;
        public int strLow = 1;
        public int atkLow = 2;
        public int rangeLow = 3;
        public int mageLow = 4;
        public int defMid = 5;
        public int strMid = 6;
        public int atkMid = 7;
        public int rapidRestore = 8;
        public int rapidHeal = 9;
        public int protItems = 10;
        public int rangeMid = 11;
        public int mageMid = 12;
        public int defHigh = 13;
        public int strHigh = 14;
        public int atkHigh = 15;
        public int prayMage = 16;
        public int prayRange = 17;
        public int prayMelee = 18;
        public int rangeHigh = 19;
        public int mageHigh = 20;
        public int retribution = 21;
        public int redepmtion = 22;
        public int smite = 23;
        public int praySummon = 24;
        public int chivalry = 25;
        public int piety = 26;
        public boolean prayOn[] = new boolean[27];
    Feel free to remove all the prayer names, I just used it for simplicity coz I couldn't remember all the numbers .

    Now, add this import with the other imports at the top:
    Code:
    import palidino76.rs2.io.packets.Prayer;
    Now, in your Player Process() method add this method, which drains prayer at intervals dependent on which prayers are being used, and resets all prayers when the player runs out of prayer points:

    Code:
    /*prayerDrain is set at 100, lowers by drainRate of all prayers being used*/
    			prayerDrain -= drainRate;
    			/*When prayerDrain becomes 0 or less, players prayer level is decreased by 1.*/
    			if(prayerDrain <= 0 && skillLvl[5] > 0) {
    				skillLvl[5]--;
    				frames.setSkillLvl(this, 5);
    				/*If the players prayer level becomes 0, it resets all prayers in use.*/
    				if(skillLvl[5] <= 0) {
    					Prayer pr = new Prayer();
    					pr.resetPrayers(this);
    					frames.sendMessage(this, "You have run out of prayer points.");
    				}
    				prayerDrain = 100;
    			}
    Now find your applyDead method, or whatever it happens to be called (if you have one, if not ignore this step). And call the resetPrayer method again by adding this somewhere in there:

    Code:
     Prayer pr = new Prayer();
    pr.resetPrayers(this);
    Now you can close and save Player.java.

    Step 6: Now open up ActionButtons.java and add this import:
    Code:
    import palidino76.rs2.io.packets.Prayer;
    Then, under:
    Code:
    switch (interfaceId) {
    add:
    Code:
     		case 271:
    		Prayer pr = new Prayer();
    		pr.Prayer(p, buttonId);
    		break;
    And you're finally done! Compile everything and voila!

    Now all you have to do is make the prayers work, but I'm going to make
    you do that yourself. An example of how it works would be:
    Code:
    if(p.prayOn[p.strLow]) {
    //Code to increase max hit
    }
    or
    Code:
    if(p.prayOn[p.prayMelee]) {
    //Code to make hit 0
    }

    congratulations you have added 100% prayer to your 508 woohoo!

    Deception Super Moderator l 2012.
    Click the sig or die :3
    Reply With Quote  
     

  2. #2  
    IvA V1n
    Guest
    if(p.prayOn[p.prayMelee]) {
    //Code to make hit 0
    }

    You missed an "i" on your last bit of code and very nicely done
    Reply With Quote  
     

  3. #3  
     

    Vastiko's Avatar
    Join Date
    Dec 2006
    Posts
    5,700
    Thanks given
    300
    Thanks received
    663
    Rep Power
    5000
    this is a repost?
    Reply With Quote  
     

  4. #4  
    Registered Member Wired's Avatar
    Join Date
    Jul 2008
    Age
    31
    Posts
    332
    Thanks given
    0
    Thanks received
    8
    Rep Power
    31
    no its not a repost and sorry! lol


    edit: i fixed the missing i =P


    this thing took me all day to post lool!

    Deception Super Moderator l 2012.
    Click the sig or die :3
    Reply With Quote  
     

  5. #5  
     

    Vastiko's Avatar
    Join Date
    Dec 2006
    Posts
    5,700
    Thanks given
    300
    Thanks received
    663
    Rep Power
    5000
    r0fl I new i'd seen it:

    http://www.rune-server.org/showthread.php?t=91817

    Leeched. LOL.
    Reply With Quote  
     

  6. #6  
    ⚓Manic-Owner⚓


    Join Date
    Nov 2007
    Posts
    2,711
    Thanks given
    47
    Thanks received
    9
    Rep Power
    650
    Quote Originally Posted by t3l3now View Post
    Description: To add a base for 100% working prayer.

    Difficulty: 3/10

    Assumed Knowledge: Usage of 508 servers, where files are located etc.

    Tested Server: palidino 508

    Files/Classes Modified/Created: Player.java, ActionButtons.java, Prayer.java

    Procedure
    Step 1: First off we're going to create the Prayer class. Start by making a new file called Prayer.java in palidino76/rs2/io/packets.

    Step 2: Now we're going to create the package and add our imports:
    Code:
    package palidino76.rs2.io.packets;
    import palidino76.rs2.players.Player;
    /*Add more imports when required*/
    then open your class:
    Code:
    public class Prayer {
    Step 3: Now for the most important method of the whole class. This method checks which button is being pressed and activates or de-activates the relevant prayer, Dependant on whether the player is high enough prayer, and has more than 0 prayer points. This method also checks for head icons on prayers that require it. There may be more efficient ways of doing this, I just felt this way was easier and less code. The code is pretty much self explanatory .

    Code:
    	public void Prayer(Player p, int buttonId) {
    		int x = 0;
    		/*Prayer button id's range from 5-57, increasing by 2 each time.*/
    		for(int i = 5; i < 59; i += 2) {
    			/*Checks if the loop mathces the button pressed*/
    			/*Checks if the player has more than 0 prayer points*/
    			if(buttonId == i && p.skillLvl[5] > 0) {
    				/*Checks if the players prayer level is high enough*/
    				if(p.getLevelForXP(5) >= prayerLevel[x]) {
    					/*Switches off other prayers affected by the prayer selected*/
    					switchPrayers(p, x);
    					/*Changes prayer status on/off*/
    					p.prayOn[x] = !p.prayOn[x];
    					/*Changes prayer config status, 0 for off or 1 for on*/
    					p.frames.setConfig(p, prayerConfig[x], p.prayOn[x] ? 1 : 0);
    					/*Checks if the prayer requires a headicon*/
    					if(x >= 16 && x <= 18 || x >= 21 && x <= 24) {
    						if(p.prayOn[x]) {
    						/*Gets the required pray icon if prayer is being switched on*/
    						getHeadIcon(p, x);
    						}
    						else {
    						/*Removes head icon if prayer is being switched off*/
    						p.prayerIcon = -1;
    						}
    					}
    					if(p.prayOn[x]) {
    						/*Increases the rate at which prayer drains if switched on*/
    						p.drainRate += drainRate[x];
    					}
    					else {
    						/*Decreases the rate at which prayer drains if switched off*/
    						p.drainRate -= drainRate[x];
    					}
    					p.appearanceUpdateReq = true;
    					p.updateReq = true;
    				}
    				else {
    					p.frames.sendMessage(p, "You need a prayer level of "+prayerLevel[x]+" to use this.");
    				}
    			}
    			/*Counts which prayer is being used*/
    			x++;
    		}
    	}

    Step 4: Now we need to add some more methods to make the above method work properly. Add these arrays, which check for prayer levels required, which config to turn on/off and what rate the corresponding prayer drains at:

    Code:
    /* Configs for prayers */
        public int prayerConfig[] =
        {83, 84, 85, 862, 863, 86, 87,
        88, 89, 90, 91, 864, 865, 92,
        93, 94, 95, 96, 97, 866, 867,
        98, 99, 100, 1168, 1052, 1053};
    
    	/* Prayer levels required */
    	public int prayerLevel[] =
    	{1, 4, 7, 8, 9, 10, 13,
    	16, 19, 22, 25, 26, 27, 28,
    	31, 34, 37, 40, 43, 44, 45,
    	46, 49, 52, 35, 60, 70};
    
    	/* Drain rate of each prayer */
    	public int drainRate[] =
    	{3, 4, 5, 6, 7, 8, 9,
    	10, 6, 7, 6, 12, 13, 14,
    	15, 16, 17, 18, 19, 20, 21,
    	22, 23, 24, 15, 26, 28};
    You'll also need to add this method, which checks for which head icon is required:
    Code:
    /* Method to check for head icon */
    	public void getHeadIcon(Player p, int i) {
    		switch(i) {
    			case 16:
    			p.prayerIcon = 2;
    			break;
    			case 17:
    			p.prayerIcon = 1;
    			break;
    			case 18:
    			p.prayerIcon = 0;
    			break;
    			case 21:
    			p.prayerIcon = 3;
    			break;
    			case 22:
    			p.prayerIcon = 5;
    			break;
    			case 23:
    			p.prayerIcon = 4;
    			break;
    			case 24:
    			p.prayerIcon = 7;
    			break;
    		}
    	}
    Now for the longest method, which I'm sure there must be a more efficient way of doing, but this is my way of doing it . This method checks which prayers must be switched off when a new prayer is activated:
    Code:
    /* Method to switch prayers */
    	public void switchPrayers(Player p, int i) {
    		switch(i) {
    			/*i represents which prayer is being used*/
    			case 0:
    			/*Array created for prayers to switch off*/
    			int[] off = {5, 13, 3, 4, 11, 12, 19, 20};
    			/*Switches off all prayers in the array*/
    			prayerOff(p, off);
    			break;
    			case 1:
    			int[] off2 = {6, 14, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off2);
    			break;
    			case 2:
    			int[] off3 = {7, 15, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off3);
    			break;
    			case 3:
    			int[] off4 = {0, 1, 2,  5, 13, 6, 14, 7, 15, 4, 11, 12, 19, 20};
    			prayerOff(p, off4);
    			break;
    			case 4:
    			int[] off5 = {0, 1, 2, 5, 13, 6, 14, 7, 15, 3, 11, 12, 19, 20};
    			prayerOff(p, off5);
    			break;
    			case 5:
    			int[] off6 = {0, 13, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off6);
    			break;
    			case 6:
    			int[] off7 = {1, 14, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off7);
    			break;
    			case 7:
    			int[] off8 = {2, 15, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off8);
    			break;
    			case 8:
    			int[] off9 = {9};
    			prayerOff(p, off9);
    			break;
    			case 9:
    			int[] off10 = {8};
    			prayerOff(p, off10);
    			break;
    			case 11:
    			int[] off11 = {5, 13, 6, 14, 7, 15, 4, 3, 12, 19, 20};
    			prayerOff(p, off11);
    			break;
    			case 12:
    			int[] off12 = {5, 13, 6, 14, 7, 15, 3, 11, 4, 19, 20};
    			prayerOff(p, off12);
    			break;
    			case 13:
    			int[] off13 = {5, 0, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off13);
    			break;
    			case 14:
    			int[] off14 = {6, 1, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off14);
    			break;
    			case 15:
    			int[] off15 = {7, 2, 3, 4, 11, 12, 19, 20};
    			prayerOff(p, off15);
    			break;
    			case 16:
    			int[] off16 = {17, 18, 21, 22, 23, 24};
    			prayerOff(p, off16);
    			break;
    			case 17:
    			int[] off17 = {16, 18, 21, 22, 23, 24};
    			prayerOff(p, off17);
    			break;
    			case 18:
    			int[] off18 = {17, 16, 21, 22, 23, 24};
    			prayerOff(p, off18);
    			break;
    			case 19:
    			int[] off19 = {5, 13, 6, 14, 7, 15, 4, 11, 12, 3, 20};
    			prayerOff(p, off19);
    			break;
    			case 20:
    			int[] off20 = {5, 13, 6, 14, 7, 15, 3, 11, 12, 19, 4};
    			prayerOff(p, off20);
    			break;
    			case 21:
    			int[] off21 = {17, 18, 16, 22, 23, 24};
    			prayerOff(p, off21);
    			break;
    			case 22:
    			int[] off22 = {17, 18, 21, 16, 23, 24};
    			prayerOff(p, off22);
    			break;
    			case 23:
    			int[] off23 = {17, 18, 21, 22, 16, 24};
    			prayerOff(p, off23);
    			break;
    			case 24:
    			int[] off24 = {17, 18, 21, 22, 16, 23};
    			prayerOff(p, off24);
    			break;
    			case 25:
    			int[] off25 = {0, 1, 2, 5, 6, 7, 13, 14, 15, 26};
    			prayerOff(p, off25);
    			break;
    			case 26:
    			int[] off26 = {0, 1, 2, 5, 6, 7, 13, 14, 15, 25};
    			prayerOff(p, off26);
    			break;
    		}
    	}
    And of course you need to add the prayerOff method to make that work:
    Code:
    	/* Method to switch prayers off */
    	public void prayerOff(Player p, int[] prayers) {
    		for(int z = 0; z < prayers.length; z++) {
    			if(p.prayOn[prayers[z]]) {
    				p.prayOn[prayers[z]] = false;
    				p.frames.setConfig(p, prayerConfig[prayers[z]], 0);
    				p.drainRate -= drainRate[prayers[z]];
    			}
    		}
    	}
    And the final method you will need is resetPrayers, which de-activates all prayers when a player dies or runs out of prayer points:

    Code:
    	/*Resets all prayer configs*/
    	/*Turns off all prayers*/
    	/*Removes headicons*/
    	public void resetPrayers(Player p) {
    		for(int i = 0; i < 21; i++) {
    			if(p.prayOn[i]) {
    			p.prayOn[i] = false;
    			p.frames.setConfig(p, prayerConfig[i], 0);
    			}
    		}
    		p.drainRate = 0;
    		p.prayerIcon = -1;
    		p.appearanceUpdateReq = true;
    		p.updateReq = true;
    	}
    Phew! That was alot of methods . Now close your whole prayer class by placing a final: }
    Now save your final Prayer.java and lets start on some other files.

    Step 5: Open up Player.java, declare all these:
    Code:
        public int prayerDrain = 100;
        public int drainRate = 0;
        public int defLow = 0;
        public int strLow = 1;
        public int atkLow = 2;
        public int rangeLow = 3;
        public int mageLow = 4;
        public int defMid = 5;
        public int strMid = 6;
        public int atkMid = 7;
        public int rapidRestore = 8;
        public int rapidHeal = 9;
        public int protItems = 10;
        public int rangeMid = 11;
        public int mageMid = 12;
        public int defHigh = 13;
        public int strHigh = 14;
        public int atkHigh = 15;
        public int prayMage = 16;
        public int prayRange = 17;
        public int prayMelee = 18;
        public int rangeHigh = 19;
        public int mageHigh = 20;
        public int retribution = 21;
        public int redepmtion = 22;
        public int smite = 23;
        public int praySummon = 24;
        public int chivalry = 25;
        public int piety = 26;
        public boolean prayOn[] = new boolean[27];
    Feel free to remove all the prayer names, I just used it for simplicity coz I couldn't remember all the numbers .

    Now, add this import with the other imports at the top:
    Code:
    import palidino76.rs2.io.packets.Prayer;
    Now, in your Player Process() method add this method, which drains prayer at intervals dependent on which prayers are being used, and resets all prayers when the player runs out of prayer points:

    Code:
    /*prayerDrain is set at 100, lowers by drainRate of all prayers being used*/
    			prayerDrain -= drainRate;
    			/*When prayerDrain becomes 0 or less, players prayer level is decreased by 1.*/
    			if(prayerDrain <= 0 && skillLvl[5] > 0) {
    				skillLvl[5]--;
    				frames.setSkillLvl(this, 5);
    				/*If the players prayer level becomes 0, it resets all prayers in use.*/
    				if(skillLvl[5] <= 0) {
    					Prayer pr = new Prayer();
    					pr.resetPrayers(this);
    					frames.sendMessage(this, "You have run out of prayer points.");
    				}
    				prayerDrain = 100;
    			}
    Now find your applyDead method, or whatever it happens to be called (if you have one, if not ignore this step). And call the resetPrayer method again by adding this somewhere in there:

    Code:
     Prayer pr = new Prayer();
    pr.resetPrayers(this);
    Now you can close and save Player.java.

    Step 6: Now open up ActionButtons.java and add this import:
    Code:
    import palidino76.rs2.io.packets.Prayer;
    Then, under:
    Code:
    switch (interfaceId) {
    add:
    Code:
     		case 271:
    		Prayer pr = new Prayer();
    		pr.Prayer(p, buttonId);
    		break;
    And you're finally done! Compile everything and voila!

    Now all you have to do is make the prayers work, but I'm going to make
    you do that yourself. An example of how it works would be:
    Code:
    if(p.prayOn[p.strLow]) {
    //Code to increase max hit
    }
    or
    Code:
    if(p.prayOn[p.prayMelee]) {
    //Code to make hit 0
    }

    congratulations you have added 100% prayer to your 508 woohoo!
    gj fffffffffffffffffffffffffffffffff
    MY DISCORD:
    bluejay#1504
    Reply With Quote  
     

  7. #7  
    Registered Member clankilla 1's Avatar
    Join Date
    Feb 2008
    Age
    31
    Posts
    170
    Thanks given
    1
    Thanks received
    6
    Rep Power
    53
    i wonder why this looks the same as skiii code?
    Reply With Quote  
     

  8. #8  
    Registered Member Wired's Avatar
    Join Date
    Jul 2008
    Age
    31
    Posts
    332
    Thanks given
    0
    Thanks received
    8
    Rep Power
    31
    i've had this for like 2 weeks in a notepad on my desktop that noob probably leeched me!

    cause i posted this before a while ago.

    Deception Super Moderator l 2012.
    Click the sig or die :3
    Reply With Quote  
     

  9. #9  
    Banned

    Join Date
    Jan 2007
    Age
    30
    Posts
    4,417
    Thanks given
    3
    Thanks received
    105
    Rep Power
    0
    Quote Originally Posted by t3l3now View Post
    i've had this for like 2 weeks in a notepad on my desktop that noob probably leeched me!

    cause i posted this before a while ago.


    Siggied lol'd @ that
    Reply With Quote  
     

  10. #10  
    Registered Member Wired's Avatar
    Join Date
    Jul 2008
    Age
    31
    Posts
    332
    Thanks given
    0
    Thanks received
    8
    Rep Power
    31
    lmao


    -to small-

    Deception Super Moderator l 2012.
    Click the sig or die :3
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •