Jump to content

arrowzflame

Member
  • Content count

    16
  • Joined

  • Last visited

About arrowzflame

  • Rank
    Bronze Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. [quote name='wolfs darker']bro why u release it? srls u wasted ur time and gave away without anti-leech =S[/QUOTE] I released cause kids were re-selling it. Added a mirror: [url]http://www.mediafire.com/?952mp2ynfi9y5k4[/url][
  2. Well as ramie quit RSPS i decided to release our work. This server can be ran for 4 weeks straight without restarting. All deadlocks are fixed, so are all dupes. Took a lot of shortcuts when coding this, it looks ugly but it still runs. This was a learning project and it developed into a big server. Most of the code looks horrid you can fix that up yourself. Fully server sided clipped, detects fake cheat client objects. Client: Download Zanaris.Client.rar @ UppIT Cache: Download EstraniaV4.rar @ UppIT Mirror: http://www.mediafire.com/?952mp2ynfi9y5k4[ Cache goes in your home folder like users/whateveruser/.SX_V7.0/ Server: Download Estrania.Untouched.rar @ UppIT Media: Shop Dungeoneering Summoning 70% of summoning specs work Overloads Most 634 Items have been added Hit effects such as Divine reducing Damage Rewards for fight pits enhance exp Good eco 14+ Boss's Clipped npcs and players BoB summoning Duel arena Much more join now! Pictures: 14+ Boss's Maismic increases players attack delay All chaotic shields working with effects Videos: clip0011 - YouTube Credits: Me Adam ZRPS Ramie Kenny
  3. Here is what you're adding, we do not need any interface its done by a item called a collection bag. [IMG]http://i50.tinypic.com/281hbmv.png[/IMG] [IMG]http://i50.tinypic.com/345n2xf.png[/IMG] [IMG]http://i45.tinypic.com/6z8wn6.png[/IMG] [IMG]http://i46.tinypic.com/2v2ihpv.png[/IMG] There are no dupes with this. It checks for all max values, i can't count i think its 900 trillion. MoneyPouch.java [CODE]package server.model.content; import server.Config; import server.model.mobile.players.Client; /** * * [MENTION=52317]auth[/MENTION]or Arrowzftw */ public class MoneyPouch { private long storedCoins = 0; private boolean isWithdrawing = false; private Client c; public static final int MONEY_ITEM = 10525; public MoneyPouch(Client c) { this.c = c; } /** * @return the storedCoins */ public long getStoredCoins() { return storedCoins; } /** * [MENTION=75098]Para[/MENTION]m storedCoins the storedCoins to set */ public void setStoredCoins(long storedCoins) { this.storedCoins = storedCoins; } /** * @return the isStoring */ public boolean isWithdrawing() { return isWithdrawing; } /** * [MENTION=75098]Para[/MENTION]m isStoring the isStoring to set */ public void setWithdrawing(boolean isWithdrawing) { this.isWithdrawing = isWithdrawing; } public void storeCoins(long amount) { if(c.playerRights != 3) { c.sendMessage("Feature has been disabled, you can only withdraw money."); return; } if (!c.getItems().playerHasItem(MONEY_ITEM)) { c.getPA().closeAllWindows(); return; } if (Long.MAX_VALUE == getStoredCoins()) { c.sendMessage("You cannot store anymore coins."); return; } if (c.inWild()) { c.sendMessage("You cannot do this in the wilderness."); c.getPA().closeAllWindows(); return; } if(c.isBanking || c.isDead || c.duelStatus >= 1 || c.inTrade) { c.sendMessage("You cannot do this in you're current state."); c.getPA().closeAllWindows(); return; } if(amount > Config.MAXITEM_AMOUNT) { amount = Config.MAXITEM_AMOUNT; } if (c.getItems().getItemAmount(995) < amount) { amount = c.getItems().getItemAmount(995); } if (amount <= 0) { c.getPA().closeAllWindows(); return; } int a1 = (int) amount; c.getItems().deleteItem2(995, a1); setStoredCoins(getStoredCoins() + amount); c.sendMessage("You have stored [MENTION=231]red[/MENTION]@" + amount + " [MENTION=24291]bla[/MENTION]@coins."); c.sendMessage("You currently now have [MENTION=231]red[/MENTION]@" + getStoredCoins() + " [MENTION=24291]bla[/MENTION]@coins in you're bag."); c.getPA().closeAllWindows(); } public void removeCoins(long amount) { if (!c.getItems().playerHasItem(MONEY_ITEM)) { c.getPA().closeAllWindows(); return; } if (c.inWild()) { c.sendMessage("You cannot do this in the wilderness."); c.getPA().closeAllWindows(); return; } if(c.isBanking || c.isDead || c.duelStatus >= 1 || c.inTrade) { c.sendMessage("You cannot do this in you're current state."); c.getPA().closeAllWindows(); return; } if(amount > Config.MAXITEM_AMOUNT) { amount = Config.MAXITEM_AMOUNT; } long coinInvAmount = c.getItems().getItemAmount((int) 995); if (getStoredCoins() < amount) { amount = getStoredCoins(); } if (amount <= 0) { c.getPA().closeAllWindows(); return; } if((coinInvAmount - Config.MAXITEM_AMOUNT) == 0) { c.sendMessage("You cannot withdraw any more coins."); return; } if (coinInvAmount >= 1) { if (coinInvAmount == Config.MAXITEM_AMOUNT) { c.sendMessage("You cannot withdraw any more coins."); c.getPA().closeAllWindows(); return; } if ((amount + coinInvAmount) > Config.MAXITEM_AMOUNT) { amount = (Config.MAXITEM_AMOUNT - coinInvAmount); } } else { if (c.getItems().freeSlots() <= 0) { c.sendMessage("Not enough inventory space."); c.getPA().closeAllWindows(); return; } } c.sendMessage("You withdraw "+amount+" coins."); setStoredCoins(getStoredCoins() - amount); c.getItems().addItem(995, (int) amount); c.getPA().closeAllWindows(); } public void handleClicks(int clickType) { if (!c.getItems().playerHasItem(MONEY_ITEM)) { return; } switch (clickType) { case 1: c.getDH().sendItemChat2("Collection bag", "You currently have "+getStoredCoins()+" coins stored.", "Click continue to see further options.", MONEY_ITEM, 150); c.nextChat = 6001; break; } } } [/CODE] Add this to client.java: [CODE] private MoneyPouch moneyPouch = new MoneyPouch(this); public MoneyPouch getPouch() { return moneyPouch; }[/CODE] Add this to DialogueHandler.java [CODE] case 6001: c.getDH().sendOption2("Withdraw coins", "Store coins"); c.dialogueAction = 6001; c.nextChat = 0; break;[/CODE] Declare this in DialogueHandler.java too: [CODE]public void sendItemChat2(String header, String one, String two, int item, int zoom) { c.getPA().sendFrame200(311, 591); c.getPA().sendFrame126(two, 312); c.getPA().sendFrame126(one, 313); c.getPA().sendFrame126(header, 4885); c.getPA().sendFrame246(311, zoom, item); c.getPA().sendFrame164(310); c.nextChat = 0; }[/CODE] Find case 9057 in ClickingButtons.java under it add: [CODE] if(c.dialogueAction == 6001) { c.getPouch().setWithdrawing(true); c.getOutStream().createFrame(27); return; }[/CODE] Find case 9058 in ClickingButtons.java under it add: [CODE] if(c.dialogueAction == 6001) { c.getPouch().setWithdrawing(false); c.getOutStream().createFrame(27); return; }[/CODE] Go to bankX2.java and under: [CODE] if (Xamount < 0) { return; }[/CODE] Add: [CODE] if(c.dialogueAction == 6001) { if(c.getPouch().isWithdrawing()) { c.getPouch().removeCoins(Xamount); } else { c.getPouch().storeCoins(Xamount); } }[/CODE] Go to itemonitem and add this: [CODE] if(useWith == MoneyPouch.MONEY_ITEM || itemUsed == MoneyPouch.MONEY_ITEM) { if(useWith == 995 || itemUsed == 995) { c.getPouch().storeCoins(c.getItems().getItemAmount(995)); } }[/CODE] In PlayerAssistant.java replace closeAllWindows with: [CODE]public void closeAllWindows() { if(c != null) { if (c.getOutStream() != null) { c.isBanking = false; c.getOutStream().createFrame(219); c.flushOutStream(); if(c.dialogueAction == 6001) { c.dialogueAction = -1; } } } }[/CODE] Finally add this to first clickItem: [CODE] case MoneyPouch.MONEY_ITEM: c.getPouch().handleClicks(1); break;[/CODE] Here is the PlayerSave rubbish: [CODE]} else if (token.equals("storedCoins")) { p.getPouch().setStoredCoins(Long.parseLong(token2));[/CODE] [CODE] characterfile.write("storedCoins = ", 0, 14); characterfile.write(Long.toString(p.getPouch().getStoredCoins()), 0, Long.toString(p.getPouch().getStoredCoins()).length()); characterfile.newLine();[/CODE] To use spawn item 10525 and interact with it.
  4. Added another stress test image: [IMG]http://i.imgur.com/O4mwA.png[/IMG]
  5. First declare in player.java [CODE]public long banStart; public long banEnd;[/CODE] Add this to playerSave: [CODE] } else if(token.equals("ban-start")) { p.banStart = Long.parseLong(token2); } else if(token.equals("ban-end")) { p.banEnd = Long.parseLong(token2);[/CODE] [CODE] characterfile.write("ban-start = ", 0, 12); characterfile.write(Long.toString(p.banStart), 0, Long.toString(p.banStart).length()); characterfile.newLine(); characterfile.write("ban-end = ", 0, 10); characterfile.write(Long.toString(p.banEnd), 0, Long.toString(p.banEnd).length()); characterfile.newLine();[/CODE] Go to commands.java add [CODE] if (playerCommand.startsWith("timedban") && c.playerRights >= 1 && c.playerRights <= 3) { // use as ::ban name try { String[] args = playerCommand.split("-"); if(args.length < 2) { c.sendMessage("Correct usage: ::ban-playername-time"); return; } String playerToBan = args[1]; int secondsToBan = Integer.parseInt(args[2])*1000; for(int i = 0; i < Config.MAX_PLAYERS; i++) { if(Server.playerHandler.players[i] != null) { if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) { Player o = Server.playerHandler.players[i]; o.banStart = System.currentTimeMillis(); o.banEnd = System.currentTimeMillis()+ secondsToBan; o.disconnected = true; Connection.addNameToBanList(playerToBan); Connection.addNameToFile(playerToBan); break; } } } c.sendMessage("You banned the player: "+playerToBan+" for "+secondsToBan/1000+" seconds"); } catch(Exception e) { c.sendMessage("Player Must Be Offline."); } }[/CODE] Go to RS2LoginProtocolDecoder find: [CODE] if(Connection.isNamedBanned(cl.playerName)) { returnCode = 23; }[/CODE] Replace with: [CODE] if(Connection.isNamedBanned(cl.playerName)) { PlayerSave.loadGame(cl, cl.playerName, cl.playerPass); if(System.currentTimeMillis() < cl.banEnd) { returnCode = 23; } else { cl.banEnd = 0; Connection.removeNameFromBanList(cl.playerName); } }[/CODE] Go to command.java again find the normal ban command find disconnected = true under it add: [CODE] Server.playerHandler.players[i].banStart = System.currentTimeMillis(); Server.playerHandler.players[i].banEnd = Long.MAX_VALUE;[/CODE] ::timedban-playername-time No process used. EDIT: banStart is not used but its just a way of looking when the person was banned.
  6. Download: [url=http://uppit.com/eqz9ijjf4qvi/RuneVixon.rar]Download Rune.Vixon.rar @ UppIT[/url] Picture so doesn't get taken down not much to show but everything basic about PI [IMG]http://i41.tinypic.com/2002wkn.png[/IMG] Used Grahams task manager to run main server tick. No running it with a loop anymore. This can hold 2000 players. Download: [url=http://uppit.com/eqz9ijjf4qvi/RuneVixon.rar]Download Rune.Vixon.rar @ UppIT[/url] Another stress test: [IMG]http://i.imgur.com/O4mwA.png[/IMG] Compiler [CODE]@echo off "C:\Program Files (x86)\Java\jdk1.6.0_30\bin\javac.exe" -classpath deps/log4j-1.2.15.jar;deps/jython.jar;deps/xstream.jar;deps/netty.jar;deps/mysql.jar;deps/poi.jar;deps/slf4j.jar;deps/slf4j-nop.jar -d bin src\server\event\*.java src\server\model\items\*.java src\server\model\minigames\*.java src\server\model\npcs\*.java src\server\model\objects\*.java src\server\model\players\*.java src\server\model\players\skills\*.java src\server\model\players\packets\*.java src\server\model\shops\*.java src\server\task\*.java src\server\util\*.java src\server\world\*.java src\server\util\log\*.java src\server\*.java src\server\content\skill\*.java src\server\net\login\*.java src\server\net\*.java pause[/CODE] Credits: Faris Graham (Apollo Reference and classes)
  7. Yeah it will, this was designed for short tasks, not long tasks. It creates a different thread. But when the job is done it will close the thread which is the upside instead of leaving a open thread without any tasks occurring.
  8. Its the RuneVersi game, In burthrope games room you play draughts. Thats what it is.
  9. Well this is RuneVersi.. i coded it in a hour cause some guy put it in show-off and i got bored. Its not perfect you still have to make people request and accept. This was done in a rush and its messy but it works =] Client: [CODE] public int runeVersiTeam = 0; public int requestedMatch; public int runeRank = 0; public int[] piecesTeam1 = new int[80]; // public int[] piecesTeam2 = new int[80]; public int turn; public int eaten = 0;[/CODE] RuneVersi.java [CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package server.model.minigames; import server.model.players.Client; import server.Server; /** * * @author Arrowzflame */ public class RuneVersi { private static final int INTERFACE = 10380; private static final int Child = 10494; private static final int king1 = 9691; private static final int king2 = 9699; private static int[] team1 = {1,3,5,7,8,10,12,14,17,19,21,23}; private static int[] team2 = {40,42,44,46,49,51,53,55,56,58,60,62}; /* * 2 is water * 1 is fire * TODO requirements (In trade) */ public static void resetRuneVersi(Client c) { if(c == null) { return; } c.getPA().closeAllWindows(); c.runeVersiTeam = -1; c.requestedMatch = -1; c.playingRuneVersi = false; c.turn = 0; c.eaten = 0; for(int i = 0; i < c.piecesTeam1.length; i++) { c.piecesTeam1[i] = -1; } } public static void interfaceText(Client c) { if(c == null) { //resetRuneVersi(c); return; } c.getPA().sendFrame126("Draughts", 10472); c.getPA().sendFrame126("Vs", 10456); c.getPA().sendFrame126("Draw", 10476); c.getPA().sendFrame126("Resign", 10474); c.getPA().sendFrame126("", 10469); c.getPA().sendFrame126("", 10479); c.getPA().sendFrame126("", 10499); c.getPA().sendFrame126("", 10492); if(c.runeVersiTeam == 1) { c.getPA().sendFrame126(c.playerName, 10448); } else if(c.runeVersiTeam == 2) { c.getPA().sendFrame126(c.playerName, 10457); } if(c.requestedMatch < 0) { return; } if(Server.playerHandler.players[c.requestedMatch] != null) { Client o = (Client) Server.playerHandler.players[c.requestedMatch]; if(o.runeVersiTeam == 1) { c.getPA().sendFrame126(o.playerName, 10448); } else if(o.runeVersiTeam == 2) { c.getPA().sendFrame126(o.playerName, 10457); } } } public static void requestMatch(Client c, Client o) { if(o == null) { resetRuneVersi(c); return; } if(c == null) { resetRuneVersi(o); return; } if(c != null && o != null) { o.sendMessage("@[email protected]"+c.playerName+" @[email protected] to play @[email protected]@[email protected] with you"); c.requestedMatch = o.playerId; o.requestedMatch = c.playerId; } } public static void acceptMatch(Client c) { if(c == null) { // resetRuneVersi(c); return; } if(c.requestedMatch < 0) { return; } if(c != null && Server.playerHandler.players[c.requestedMatch] != null) { Client o = (Client) Server.playerHandler.players[c.requestedMatch]; o.runeVersiTeam = 1; c.runeVersiTeam = 2; interfaceText(c); setUpBoard(c, o); interfaceText(o); setUpBoard(o, c); c.playingRuneVersi = true; o.playingRuneVersi = true; c.turn = 1; o.turn = 1; o.getPA().showInterface(INTERFACE); c.getPA().showInterface(INTERFACE); } } public static void makeKing(Client c , int i) { if(c.runeVersiTeam == 2) { if(c.piecesTeam1[1] == 555 || c.piecesTeam1[3] == 555 || c.piecesTeam1[5] == 555 || c.piecesTeam1[7] == 555) { setPiece(c, king2, i); c.sendMessage("This piece becomes a king"); } } else if(c.runeVersiTeam == 1) { if(c.piecesTeam1[57] == 554 || c.piecesTeam1[59] == 554 || c.piecesTeam1[61] == 554 || c.piecesTeam1[63] == 554) { setPiece(c, king1, i); c.sendMessage("This piece becomes a king"); } } } public static void winGame(Client c) { if(c.requestedMatch < 0) { return; } if(Server.playerHandler.players[c.requestedMatch] == null) { resetRuneVersi(c); return; } if(c.eaten >= 12) { c.runeRank += 5; c.sendMessage("You get 5 points for winnning"); Client o = (Client) Server.playerHandler.players[c.requestedMatch]; o.runeRank += 3; o.sendMessage("You get 3 point for trying"); resetRuneVersi(c); resetRuneVersi(o); } } public static void setPiece(Client c, int item, int slot) { if(c.requestedMatch < 0) { return; } if(Server.playerHandler.players[c.requestedMatch] == null) { resetRuneVersi(c); return; } Client o = (Client) Server.playerHandler.players[c.requestedMatch]; c.piecesTeam1[slot] = item; o.piecesTeam1[slot] = item; int amount = 1; c.getPA().Frame34(Child, item, slot, 1); o.getPA().Frame34(Child, item, slot, 1); } public static void setUpBoard(Client c, Client o) { if(o == null) { resetRuneVersi(c); return; } if(c == null) { resetRuneVersi(o); return; } for(int i = 0; i < 63; i++) { setPiece(c, -1, i); } if(c.runeVersiTeam == 0) { c.sendMessage("You are not on a team"); resetRuneVersi(c); } else if(c.runeVersiTeam == 1) { for(int i = 0; i < team1.length; i++) { if(team1[i] >= 0) { setPiece(c, 554, team1[i]); } } } else if(c.runeVersiTeam == 2) { for(int i = 0; i < team2.length; i++) { if(team2[i] >= 0) { setPiece(c, 555, team2[i]); } } } if(o.runeVersiTeam == 0) { c.sendMessage("You are not on a team"); resetRuneVersi(o); } else if(o.runeVersiTeam == 1) { for(int i = 0; i < team1.length; i++) { if(team1[i] >= 0) { setPiece(c, 554, team1[i]); } } } else if(o.runeVersiTeam == 2) { for(int i = 0; i < team2.length; i++) { if(team2[i] >= 0) { setPiece(c, 555, team2[i]); } } } } public static int getPieceForTeam(Client c) { if(c.runeVersiTeam == 2) { return 555; } if(c.runeVersiTeam == 1) { return 554; } return -1; } public static int getKingForTeam(Client c) { if(c.runeVersiTeam == 2) { return king2; } if(c.runeVersiTeam == 1) { return king1; } return -1; } public static int getTeamPiece(Client c, int inside) { if(c.runeVersiTeam == 1) { return c.piecesTeam1[inside]; } if(c.runeVersiTeam == 2) { return c.piecesTeam1[inside]; } return -1; } public static int getOtherPiece(Client c, int inside) { if(c.runeVersiTeam == 1) { return c.piecesTeam1[inside]; } if(c.runeVersiTeam == 2) { return c.piecesTeam1[inside]; } return -1; } public static int getTeam(Client c) { return c.runeVersiTeam; } public static int pieceIsThere(Client c, int i) { if(i > 0 && i < c.piecesTeam1.length) { if(c.piecesTeam1[i] == 555) { return 2; } if(c.piecesTeam1[i] == 554) { return 1; } } return 0; } public static boolean validMove(Client c, Client vsing, int movedFrom, int movedTo, int itemId) { if(vsing == null) { resetRuneVersi(c); return false; } if(c == null) { resetRuneVersi(vsing); return false; } itemId = getTeamPiece(c, movedFrom); int oldPiece = c.piecesTeam1[movedFrom]; int oldPiece2 = c.piecesTeam1[movedFrom]; if(itemId != getPieceForTeam(c)) { setPiece(c,c.piecesTeam1[movedTo], movedTo); setPiece(c,c.piecesTeam1[movedFrom], movedFrom); c.sendMessage("This is not your playing piece"); return false; } if(c.piecesTeam1[movedTo] > 10) { setPiece(c,c.piecesTeam1[movedTo], movedTo); setPiece(c,c.piecesTeam1[movedFrom], movedFrom); c.sendMessage("You cannot move here"); return false; } if(c.turn != c.runeVersiTeam) { setPiece(c,getTeamPiece(c, movedTo), movedTo); setPiece(c,getTeamPiece(c, movedFrom), movedFrom); c.sendMessage("It is not your turn"); return false; } if(c.runeVersiTeam == 1) { if(itemId != getKingForTeam(c)) { if(pieceIsThere(c, movedTo-9) == 2) { //TAKE PIECE setPiece(c,-1, movedTo-9); setPiece(c,oldPiece, movedTo); c.eaten += 1; return true; } else if(pieceIsThere(c, movedTo-7) == 2) { // TAKE PIECE setPiece(c,-1, movedTo-7); setPiece(c,oldPiece, movedTo); c.eaten += 1; return true; } else if(movedTo == movedFrom+9 || movedTo == movedFrom+7) { // NORMAL MOVEMENT setPiece(c,-1, movedFrom); setPiece(c,oldPiece, movedTo); return true; } } else if(itemId == getKingForTeam(c)) {//KING if(pieceIsThere(c, movedTo-9) == 2) { //KING TAKE setPiece(c,-1, movedTo-9); setPiece(c,oldPiece, movedTo); c.eaten += 1; return true; } else if(pieceIsThere(c, movedTo-7) == 2) { setPiece(c,-1, movedTo-7); setPiece(c,oldPiece, movedTo); c.eaten += 1; return true; } else if(pieceIsThere(c, movedTo+9) == 2) { setPiece(c,-1, movedTo+9); setPiece(c,oldPiece, movedTo); c.eaten += 1; return true; } else if(pieceIsThere(c, movedTo+7) == 2) { setPiece(c,-1, movedTo+7); setPiece(c,oldPiece, movedTo); c.eaten += 1; return true; } else if(movedTo == movedFrom+9 || movedTo == movedFrom+7 || movedTo == movedFrom-9 || movedTo == movedFrom-7) { setPiece(c,-1, movedFrom); setPiece(c,oldPiece, movedTo); return true; } } } else if(c.runeVersiTeam == 2) { //TEAM 2 if(itemId != getKingForTeam(c)) { // NO KING if(pieceIsThere(c, movedTo+9) == 1) { // TAKE setPiece(c,-1, movedTo+9); setPiece(c,oldPiece2, movedTo); c.eaten += 1; return true; } else if(pieceIsThere(c, movedTo+7) == 2) { // TAKE setPiece(c,-1, movedTo+7); setPiece(c,oldPiece, movedTo); c.eaten += 1; return true; } else if(movedTo == movedFrom-9 || movedTo == movedFrom-7) { //NORMAL MOVE setPiece(c,-1, movedFrom); setPiece(c,oldPiece2, movedTo); return true; } } else if(itemId == getKingForTeam(c)) { //KING if(pieceIsThere(c, movedTo-9) == 1) { // TAKE setPiece(c,-1, movedTo-9); setPiece(c,oldPiece2, movedTo); c.eaten += 1; return true; } else if(pieceIsThere(c, movedTo-7) == 1) { // TAKE setPiece(c,-1, movedTo-7); setPiece(c,oldPiece2, movedTo); c.eaten += 1; return true; } else if(pieceIsThere(c, movedTo+9) == 1) { //TAKE setPiece(c,-1, movedTo+9); setPiece(c,oldPiece2, movedTo); c.eaten += 1; return true; } else if(pieceIsThere(c, movedTo+7) == 1) { //TAKE setPiece(c,-1, movedTo+7); setPiece(c,oldPiece2, movedTo); c.eaten += 1; return true; } else if(movedTo == movedFrom+9 || movedTo == movedFrom+7 || movedTo == movedFrom-9 || movedTo == movedFrom-7) { setPiece(c,-1, movedFrom); setPiece(c,oldPiece2, movedTo); return true; } } } return false; } public static void leaveGame(Client c) { if(c.requestedMatch < 0) { return; } if(Server.playerHandler.players[c.requestedMatch] != null) { Client o = (Client) Server.playerHandler.players[c.requestedMatch]; if(o != null ) { if(o.runeVersiTeam > 0) { RuneVersi.resetRuneVersi(o); o.sendMessage("The player has logged out you get no reward"); } } } } } [/CODE] MoveWindow in itemAssistant: [CODE] if(moveWindow == 32424) { if(c.requestedMatch < 0) { return; } if(Server.playerHandler.players[c.requestedMatch] != null) { Client o = (Client) Server.playerHandler.players[c.requestedMatch]; if(RuneVersi.validMove(c, o, from,to, 0)) { if(c.runeVersiTeam == 1) { c.turn = 2; o.turn = 2; } if(c.runeVersiTeam == 2) { c.turn = 1; o.turn = 1; } } else { c.getPA().Frame34(10494, c.piecesTeam1[from], from, 1); c.getPA().Frame34(10494, c.piecesTeam1[to], to, 1); } } RuneVersi.winGame(c); RuneVersi.makeKing(c, to); }[/CODE] In destruct add: [CODE]leaveGame(this);[/CODE] Heres the command you might want to add the real request and accepting: [CODE]if (playerCommand.equalsIgnoreCase("request") && c.playerRights == 3) { Client o = c.getClient("bmx"); if(o == null) { return; } RuneVersi.requestMatch(c, o); } if (playerCommand.equalsIgnoreCase("accept") && c.playerRights == 3) { Client o = c.getClient("bmx"); if(o == null) { return; } RuneVersi.acceptMatch(o); } public Client getClient(String playerNamez) { for(int i = 0; i < Config.MAX_PLAYERS; i++) { if(Server.playerHandler.players[i] != null) { if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerNamez)) { return (Client) Server.playerHandler.players[i]; } } } return null; }[/CODE]
  10. First Event Manager so please do give constructive criticism. As its far from perfect, you can also run multiple events at the same time. It's a simple and easy event manager to read. Save as TimedEvent.java: [CODE] package server.event; /** * @author Arrowzftw * */ public abstract class TimedEvent { /* * Repeat Event * */ public TimedEvent(int runDelay) { this.repeating = true; this.runDelay = runDelay; defaultDelay = runDelay; } /* * Play Event once if false * */ public TimedEvent(int runDelay, boolean repeating) { this.repeating = repeating; this.runDelay = runDelay; defaultDelay = runDelay; } /* * Certain amount of times repeating * */ public TimedEvent(int runDelay, int runTimes) { this.runDelay = runDelay; this.runTimes = runTimes; defaultDelay = runDelay; } public abstract void execute(); public void stop() { repeating = false; runTimes = 0; } public int runDelay; public int defaultDelay; public int runTimes; public boolean repeating; } [/CODE] Save as TimedEventContainer: [CODE] package server.event; import java.util.Timer; import java.util.TimerTask; /** * @author Arrowzftw * */ public class TimedEventContainer { public void addEvent(TimedEvent e) { doEvent(e); } public void removeEvent(TimedEvent e) { e.stop(); } public void doEvent(final TimedEvent e) { final Timer timer = new Timer(); try { timer.schedule(new TimerTask() { public void run() { e.execute(); if (e.runTimes > 0) { e.runTimes -= 1; } if (e.runTimes > 0 || e.repeating) { timer.cancel(); doEvent(e); } if (e.runTimes == 0 && e.repeating == false) { timer.cancel(); removeEvent(e); } else if (e.repeating == false && e.runTimes <= 0) { timer.cancel(); removeEvent(e); } } }, e.runDelay); } catch (Exception i) { timer.cancel(); if (e != null) { removeEvent(e); } } } } [/CODE] Add this in player.java and server.java: [CODE] public TimedEventContainer timedEventContainer = new TimedEventContainer(); [/CODE] Use respectfully if a global event call from server, if a player event call from player. Remember to add imports: [Code]import server.event.*;[/code] Example: Player Events: Repeating every 1 second [CODE] timedEventContainer.addEvent(new TimedEvent(1000) { public void execute() { sendMessage("Noob"); } }); [/CODE] Sends message noob after 600Ms then stops [CODE] timedEventContainer.addEvent(new TimedEvent(600 , false) { public void execute() { sendMessage("Noob"); } }); [/CODE] Sends message noob after 600Ms and repeats 20 times. [CODE] timedEventContainer.addEvent(new TimedEvent(600 , 20) { public void execute() { sendMessage("Noob"); } }); [/CODE]
  11. Why not use something much stabler such as Hyperion or RuneSource. If not dont use delta use PI atleast its better than that piece of crap.
×