RECENT NEWS
📢 𝟑𝟎% Discount for all ads only this month ❄️

[PI] PvP System (Safe Zones, PvP Zones, Correct Icons + Changing, Safe Timer)

Eric Gold
power_settings_new
Seen 1 year ago
Steel Warrior (12/15)
Steel Warrior
0
0
0
12 Posts
Posts
0
Warning level
0
Likes
0
Dislikes
Joined: 2022-04-24

Difficulty - 2/10
Time Needed - 15 Minutes
What you are Adding -

Server Sided:

1:
First in player.java open it up and search for:

Code:
public int

in that long list add

Code:
safeTimer = 0,

Next search for:

Code:
public boolean inPirateHouse() {

under that add:

Code:
	/*
	 * Start of PvP Zones, Safe Zones, and Etc.
	 */
	
	public boolean inPvP() {
		return(!inSafeZone());
	}
	
	public boolean inSafeZone() {
		return(inEdgevilleBank() || inWestVarrockBank() || inEastVarrockBank() ||
		   inWestFaladorBank() || inEastFaladorBank() || inCamelotBank() ||
		   inCatherbyBank() || inNorthArdougneBank() ||inSouthArdougneBank() ||
		   grandExchangeRoof());
	}
	
	public boolean inEdgevilleBank() {
		return(absX > 3090 && absX < 3099 && absY > 3487 && absY < 3500);
	}
	
	public boolean inWestVarrockBank() {
		return (absX > 3181 && absX < 3200 && absY > 3431 && absY < 3447);
	} 
	
	public boolean inEastVarrockBank() {
		return(absX > 3249 && absX < 3258 && absY > 3418 && absY < 3425);
	}
	
	public boolean inWestFaladorBank() {
		return(absX > 2941 && absX < 2948 && absY > 3367 && absY < 3374 || absX >= 2948 && absX <= 2949 && absY >= 3368 && absY <= 3369);
	}
	
	public boolean inEastFaladorBank() {
		return(absX > 3008 && absX < 3019 && absY > 3354 && absY < 3359);
	}
	
	public boolean inCamelotBank() {
		return(absX > 2720 && absX < 2731 && absY > 3489 && absY < 3494 || absX > 2723 && absX < 2728 && absY > 3486 && absY < 3490);
	}
	
	public boolean inCatherbyBank() {
		return(absX > 2805 && absX < 2813 && absY > 3437 && absY < 3442);
	}
	
	public boolean inNorthArdougneBank() {
		return(absX > 2611 && absX < 2622 && absY > 3329 && absY <3336);
	}
	
	public boolean inSouthArdougneBank() {
		return(absX > 2648 && absX < 2657 && absY > 3279 && absY < 3288);
	}
	
	public boolean grandExchangeRoof() {
		return(absX > 3153 && absX < 3176 && absY > 3478 && absY < 3501 && heightLevel == 2);
	}

2:
Create a new package server.models.players.pvp; and in it add:

Code:
package server.model.players.pvp;

import server.model.players.Client;

public class PvPHandler {
	
	private Client c;
	
	public PvPHandler(Client c) {
		this.c = c;
	}
	
	/*
	 * Variables
	 */
	public int lowLevel;
	public int highLevel;
	
	/*
	 * Handles Showing of Correct PvP Levels
	 */
	public void pvpLevels() {
		if (c.combatLevel < 15) {
			int lowLevel = 3;
			int highLevel = c.combatLevel + 12;
			if(c.inPvP()) {
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21302);
			} else if(c.inSafeZone() && c.safeTimer <= 0) {
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21202);
			} else if(c.inSafeZone() && c.safeTimer > 0){
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21402);
			}
		}
		if (c.combatLevel > 15 && c.combatLevel < 114) {
			int lowLevel = c.combatLevel - 12;
			int highLevel = c.combatLevel + 12;
			if(c.inPvP()) {
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21302);
			} else if(c.inSafeZone() && c.safeTimer <= 0) {
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21202);
			} else if(c.inSafeZone() && c.safeTimer > 0){
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21402);
			}
		}
		if (c.combatLevel > 114) {
			int lowLevel = c.combatLevel - 12;
			int highLevel = 126;
			if(c.inPvP()) {
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21302);
			} else if(c.inSafeZone() && c.safeTimer <= 0) {
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21202);
			} else if(c.inSafeZone() && c.safeTimer > 0){
				c.getPA().sendFrame126(lowLevel + " - " + highLevel, 21402);
			}
		}
	}

	public static int[][] pvpPointsNeeded = {
		{11694, 30}, {11696, 15}, {11698, 15}, {11700, 15},
		{13362, 50}, {13358, 50}, {13360, 50}, {13355, 50},
		{13354, 50}, {13352, 50}, {13350, 50}, {13348, 50},
		{13346, 50}, {14484, 30}, {18335, 15}, {18349, 60},
		{18351, 60}, {18353, 60}, {18355, 60}, {18357, 60},
		{19669, 15}, {15486, 30}, {13858, 30}, {13861, 30},
		{13864, 30}, {13867, 30}, {13870, 30}, {13873, 30},
		{13876, 30}, {13884, 30}, {13887, 30}, {13890, 30},
		{13893, 30}, {13896, 30}, {13899, 30}, {13902, 30}
	};
	
	public static int[][] pvpKillsNeeded = {
		{11718, 15}, {11720, 15}, {11722, 15},{11724, 15}, {11726, 15}
	};
}

3.
Next open up Client.java and import:

Code:
import server.model.players.pvp.PvPHandler;

and add

Code:
private PvPHandler pvpHandler = new PvPHandler(this);

Under:

Code:
getPA().showOption(5, 0,"Follow", 4);

add this

Code:
safeTimer = 0;

Next find:

Code:
public void process() {

and in it add

Code:
		if(inPvP()) {
			safeTimer = 11;
		}
		if(safeTimer > 0 && !inPvP()) {
			safeTimer--;
		}

Then find:

Code:
if(inWild()) {

under that add

Code:
		} else if (!inPvP() && safeTimer > 0) {
			wildLevel = 12;
			getPA().walkableInterface(21400);
			getPA().sendFrame126("" + safeTimer, 21403);
			pvpHandler.pvpLevels();
		} else if (inPvP()) {
			wildLevel = 12;
			getPA().walkableInterface(21300);
			pvpHandler.pvpLevels();
			getPA().showOption(3, 0, "Attack", 1);
		} else if (inSafeZone()) {
			getPA().walkableInterface(21200);
			pvpHandler.pvpLevels();

4.
In CombatAssistant.java find:

Code:
		if(!Server.playerHandler.players[c.playerIndex].inWild()) {
			c.sendMessage("That player is not in the wilderness.");
			c.stopMovement();
			c.getCombat().resetPlayerAttack();
			return false;
		}
		if(!c.inWild()) {
			c.sendMessage("You are not in the wilderness.");
			c.stopMovement();
			c.getCombat().resetPlayerAttack();
			return false;
		}

replace that with

Code:
		if(!Server.playerHandler.players[c.playerIndex].inPvP() && Server.playerHandler.players[c.playerIndex].safeTimer <= 0) {
			c.sendMessage("@red@That player is not in PvP.");
			c.stopMovement();
			c.getCombat().resetPlayerAttack();
			return false;
		}
		if(c.inSafeZone() && c.safeTimer <= 0) {
			c.sendMessage("@red@You are not in PvP.");
			c.stopMovement();
			c.getCombat().resetPlayerAttack();
			return false;
		}

Client Sided:

1.
Go into RSInterface.java and add

Code:
		PVPInterface(textDrawingAreas);
		PVPInterface2(textDrawingAreas);
		PVPInterface3(textDrawingAreas);

Then add these:

Code:
	public static void PVPInterface(TextDrawingArea[] tda) {
		RSInterface RSinterface = addInterface(21200);
		addSprite(21201, 0, "PvP/NOTINWILD1");
		addText(21202, "", tda, 1, 0xff9040, true, true);
		int last = 2;
		RSinterface.children = new int[last];
		RSinterface.childX = new int[last];
		RSinterface.childY = new int[last];
		setBounds(21201, 400, 285, 0,RSinterface);
		setBounds(21202, 444, 318, 1,RSinterface);
	}
	
	public static void PVPInterface2(TextDrawingArea[] tda) {
		RSInterface RSinterface = addInterface(21300);
		addSprite(21301, 0, "PvP/INWILD1");
		addText(21302, "", tda, 1, 0xff9040, true, true);
		int last = 2;
		RSinterface.children = new int[last];
		RSinterface.childX = new int[last];
		RSinterface.childY = new int[last];
		setBounds(21301, 400, 285, 0,RSinterface);
		setBounds(21302, 444, 318, 1,RSinterface);
	}

	public static void PVPInterface3(TextDrawingArea[] tda) {
		RSInterface RSinterface = addInterface(21400);
		addSprite(21401, 0, "PvP/INCOUNT1");
		addText(21402, "", tda, 1, 0xff9040, true, true);
		addText(21403, "", tda,1,0xffffff, true, true);
		int last = 3;
		RSinterface.children = new int[last];
		RSinterface.childX = new int[last];
		RSinterface.childY = new int[last];
		setBounds(21401, 400, 285, 0,RSinterface);
		setBounds(21402, 444, 318, 1,RSinterface);
		setBounds(21403, 412, 290, 2,RSinterface);
	}

2.
Download these and add to Sprites (updated as of 4/18/15):
[URL=http://**********/stiygchbteyd/PvP.7z[/URL]

Credits:

00
  • Like
Reactions: