Pure Kaos
Posts : 438 Points : 2147595307 Rank : 1 Join date : 2009-08-09 Age : 30 Location : England, Bristol
| Subject: Bounty hunter for you adrian :D Thu Nov 05, 2009 7:30 pm | |
| import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Random; import java.util.concurrent.CopyOnWriteArrayList; import Clansystem.Clanroomcheck; import javax.swing.AbstractAction; import javax.swing.Timer;
/** * * @author Jeff * */ public class BountyHunter {
/** * List of player id's who are inside the low crater */ public static List inLow = new ArrayList();
/** * List of player id's in the medium crater */ public static List inMed = new ArrayList();
/** * List of player id's who are in the high crater */ public static List inHigh = new ArrayList();
/** * Random locations to teleport people when they enter the low level crater */ public static int[][] lowLocations = { { 2712, 9466 }, { 2746, 9445 }, { 2737, 9417 }, { 2699, 9425 } };
/** * Random locations to teleport people when they enter the meduim level * crater */ public static int[][] medLocations = { { 2712, 9466 }, { 2746, 9445 }, { 2737, 9417 }, { 2699, 9425 } };
/** * Random locations to teleport people when they enter the high level crater */ public static int[][] highLocations = { { 2712, 9466 }, { 2746, 9445 }, { 2737, 9417 }, { 2699, 9425 } };
/** * Where people will be teleported when they leave the crater */ public static final int LEAVE_X = 3096; public static final int LEAVE_Y = 3503;
/** * Enters the crater, usage could be in a object ect * * @param playerId * @param craterId */ public void enterCrater(int playerId, int craterId) { client player = (client) PlayerHandler.players[playerId]; if (player == null) { return; } int combat = player.combat; if (craterId == 1) { if (player.combatLevel >= 3 && player.combatLevel <= 55) { player.inCrater = true; player.craterId = craterId; teleInCrater(playerId, craterId); inLow.add(player.playerId); player.sM("You enter the crater.."); assignTarget(playerId); if (player.pickbhskull == 1) player.hint = 1; if (player.pickbhskull == 2) player.hint = 2; if (player.pickbhskull == 3) player.hint = 3; if (player.pickbhskull == 4) player.hint = 4; if (player.pickbhskull == 5) player.hint = 5; } else { player .sM("You need to be between level 3 and level 55 to enter!"); } } else if (craterId == 2) { if (player.combatLevel >= 50 && player.combatLevel <= 100) { player.inCrater = true; player.craterId = craterId; teleInCrater(playerId, craterId); inMed.add(player.playerId); player.sM("You enter the crater.."); assignTarget(playerId); if (player.pickbhskull == 1) player.hint = 1; if (player.pickbhskull == 2) player.hint = 2; if (player.pickbhskull == 3) player.hint = 3; if (player.pickbhskull == 4) player.hint = 4; if (player.pickbhskull == 5) player.hint = 5; } else { player .sM("You need to be between level 50 and level 100 to enter!"); } } else if (craterId == 3) { if (player.combatLevel >= 95) { player.inCrater = true; player.craterId = craterId; teleInCrater(playerId, craterId); inHigh.add(player.playerId); player.sM("You enter the crater.."); assignTarget(playerId); if (player.pickbhskull == 1) player.hint = 1; if (player.pickbhskull == 2) player.hint = 2; if (player.pickbhskull == 3) player.hint = 3; if (player.pickbhskull == 4) player.hint = 4; if (player.pickbhskull == 5) player.hint = 5; } else { player .sM("You need to be level 95 or higher to enter!"); } } }
/** * Teleports them into the crater at random locations which are defined at * the start of this file * * @param playerId * @param craterId */ public void teleInCrater(int playerId, int craterId) { client player = (client) PlayerHandler.players[playerId]; if (craterId == 1) { int rand = new Random().nextInt(lowLocations.length); player.toX = lowLocations[rand][0]; player.toY = lowLocations[rand][1]; } else if (craterId == 2) { int rand = new Random().nextInt(medLocations.length); player.toX = medLocations[rand][0]; player.toY = medLocations[rand][1]; } else if (craterId == 3) { int rand = new Random().nextInt(highLocations.length); player.toX = highLocations[rand][0]; player.toY = highLocations[rand][1]; } }
/** * Assigns a target to the specified player id * * @param playerId * @throws Exception */ public void assignTarget(int playerId) { client player = (client) PlayerHandler.players[playerId]; if (player == null) { return; } if (player.craterId == 1) { player.targetPlayerId = inLow.get(new Random().nextInt(inLow .size())); if (player.targetPlayerId == player.playerId) { if(player.bhtries >= 9) player.sM("@red@You could not be assigned a target!"); System.out.println("Failed target assigning = They were chosen as their own target."); player.sendQuest("Nobody", 16014); player.setInterfaceWalkable(16011); if(player.bhtries < 9){ player.bhtries++; assignTarget(player.playerId); } if(player.bhtries >= 9) player.bhtries = 0; return; } if(player.targetPlayerId == -1) { System.out.println("Failed target assigning = Id -1 was chosen."); assignTarget(player.playerId); player.sendQuest("Nobody", 16014); player.setInterfaceWalkable(16011); return; } player.sendQuest(""+ PlayerHandler.players[player.targetPlayerId].playerName, 16014); player.setInterfaceWalkable(16011); if(PlayerHandler.players[player.targetPlayerId].playerId != -1 && PlayerHandler.players[player.targetPlayerId].playerId != playerId) { player.createArrow(10, PlayerHandler.players[player.targetPlayerId].playerId); } player.bhtries = 0;
} else if (player.craterId == 2) { player.targetPlayerId = inMed.get(new Random().nextInt(inMed .size())); if (player.targetPlayerId == player.playerId) { if(player.bhtries >= 9) player.sM("@red@You could not be assigned a target!"); System.out.println("Failed target assigning = They were chosen as their own target."); player.sendQuest("Nobody", 16014); player.setInterfaceWalkable(16011); if(player.bhtries < 9){ player.bhtries++; assignTarget(player.playerId); } if(player.bhtries >= 9) player.bhtries = 0; return; } if(player.targetPlayerId == -1) { System.out.println("Failed target assigning = Id -1 was chosen."); assignTarget(player.playerId); player.sendQuest("Nobody", 16014); player.setInterfaceWalkable(16011); return; } player.sendQuest(""+ PlayerHandler.players[player.targetPlayerId].playerName, 16014); player.setInterfaceWalkable(16011); if(PlayerHandler.players[player.targetPlayerId].playerId != -1 && PlayerHandler.players[player.targetPlayerId].playerId != playerId) { player.createArrow(10, PlayerHandler.players[player.targetPlayerId].playerId); } player.bhtries = 0; } else if (player.craterId == 3) { player.targetPlayerId = inHigh.get(new Random().nextInt(inHigh .size())); if (player.targetPlayerId == player.playerId) { if(player.bhtries >= 9) player.sM("@red@You could not be assigned a target!"); System.out.println("Failed target assigning = They were chosen as their own target."); player.sendQuest("Nobody", 16014); player.setInterfaceWalkable(16011); if(player.bhtries < 9){ player.bhtries++; assignTarget(player.playerId); } if(player.bhtries >= 9) player.bhtries = 0; return; } if(player.targetPlayerId == -1) { System.out.println("Failed target assigning = Id -1 was chosen."); assignTarget(player.playerId); player.sendQuest("Nobody", 16014); player.setInterfaceWalkable(16011); return; } player.sendQuest(""+ PlayerHandler.players[player.targetPlayerId].playerName, 16014); player.setInterfaceWalkable(16011); if(PlayerHandler.players[player.targetPlayerId].playerId != -1 && PlayerHandler.players[player.targetPlayerId].playerId != playerId) { player.createArrow(10, PlayerHandler.players[player.targetPlayerId].playerId); } player.bhtries = 0; } }
/** * Leaves the crater for the player * * @param playerId */ public void leaveCrater(int playerId) throws Exception { client player = (client) PlayerHandler.players[playerId]; if (player == null || !player.inCrater) { return; } if (player.cantLeavePen > 0) { player.sM("You cant leave for " + player.cantLeavePen + " seconds!"); } else { if (player.craterId == 1) { inLow.remove(playerId); } else if (player.craterId == 2) { inMed.remove(playerId); } else if (player.craterId == 3) { inHigh.remove(playerId); } player.inCrater = false; player.hint = 0; player.toX = LEAVE_X; player.toY = LEAVE_Y; player.sM("You leave the crater!"); } }
/** * Starts the pickup timer and takes one away from it every second * * @param playerId */ @SuppressWarnings("serial") public void startPickupTimer(int playerId) { final client player = (client) PlayerHandler.players[playerId]; player.pickupPenAction = new AbstractAction() {
@Override public void actionPerformed(ActionEvent arg0) { if (player.pickupPen > 0) { player.pickupPen--; } } }; player.pickupPenTimer = new Timer(1000, player.pickupPenAction); player.pickupPenTimer.start(); }
/** * Starts the cant leave timer and takes one from it every second * * @param playerId */ @SuppressWarnings("serial") public void startCantLeaveTimer(int playerId) { final client player = (client) PlayerHandler.players[playerId]; player.cantLeavePenAction = new AbstractAction() {
@Override public void actionPerformed(ActionEvent arg0) { if (player.cantLeavePen > 0) { player.cantLeavePen--; } } }; player.cantLeavePenTimer = new Timer(1000, player.cantLeavePenAction); player.cantLeavePenTimer.start(); }
/** * Stops the pickup timer * * @param playerId */ public void stopPickupTimer(int playerId) { client player = (client) PlayerHandler.players[playerId]; player.pickupPenTimer.stop(); }
/** * Stops the cant leave timer * * @param playerId */ public void stopCantLeaveTimer(int playerId) { client player = (client) PlayerHandler.players[playerId]; player.cantLeavePenTimer.stop(); } } | |
|
Bobibob
Posts : 538 Points : 115764 Rank : 24 Join date : 2009-08-27 Age : 29 Location : uk
| Subject: Re: Bounty hunter for you adrian :D Fri Nov 06, 2009 3:19 am | |
| dont u need an area for it to actually occure in like
else if (command.equalsIgnoreCase("bounty")) { teleportToX = xxxx; teleportToY = yyyy; heightLevel = 0; HelpMenu(); sendMessage("Type ::bhhelp for this menu again"); }
the coordns need to be btween the crators
Last edited by bobibob on Fri Nov 06, 2009 4:41 am; edited 1 time in total | |
|
Bobibob
Posts : 538 Points : 115764 Rank : 24 Join date : 2009-08-27 Age : 29 Location : uk
| Subject: Re: Bounty hunter for you adrian :D Fri Nov 06, 2009 3:20 am | |
| but very nice thanks for finding and getting this | |
|
i iz a veng
Posts : 146 Points : 110250 Rank : -1 Join date : 2009-12-05 Age : 28 Location : birimingham
| Subject: Re: Bounty hunter for you adrian :D Sun Dec 06, 2009 11:26 am | |
| you should make bh in like vaccok sqaure to enter :p | |
|
Sponsored content
| Subject: Re: Bounty hunter for you adrian :D | |
| |
|