Jump to content

Search the Community

Showing results for tags 'rewrote'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. Hey guys well i wrote a castleWars tutorial almost 3 years ago! Original thread: [URL="http://www.****************/runescape-development/rs-503-client-server/tutorials/274631-614-80-castlewars-sort-custom-i-guess.html"]http://www.****************/runescape-development/rs-503-client-server/tutorials/274631-614-80-castlewars-sort-custom-i-guess.html[/URL] I had a look at the other day and I got to say it was horrible lol Its mostly just the game play but some things will need to be added and a few more checks will have to be made I would say this is about 50% complete. Anyway so I re-did the class which I'm giving out but I will not be giving you all the objects, well all small parts. You will have to figure out how to make it work ;) It's easy enough all you're doing is calling the methods in the class. Example: Leaving of a team via portal: You would just type this code in the object id: [code]CastleWars wars = new CastleWars(); wars.leaveTeamLobby(p);[/code] What you get so far with this class: You join the lobby Via portal. When there is enough players to start a game, the game starts. The in-game timer is set to 10 mins. Kill a player in-game to add points to your team. When timer hits 0 or zammy team/sara team player count hits 0 the game will end. Depending on if your team won(I.e Team having the most kills), lost or drew depends on how many points you will received. CastleWars.java [code] package dragonkk.rs2rsps.model.minigames; import java.util.ArrayList; import java.util.List; import org.world.event.Event; import org.world.event.EventManager; import com.google.common.math.DoubleMath; import dragonkk.rs2rsps.Server; import dragonkk.rs2rsps.events.Task; import dragonkk.rs2rsps.model.Item; import dragonkk.rs2rsps.model.World; import dragonkk.rs2rsps.model.player.Equipment; import dragonkk.rs2rsps.model.player.Mask; import dragonkk.rs2rsps.model.player.Player; import dragonkk.rs2rsps.net.Frames; import dragonkk.rs2rsps.rsobjects.RSObjectsRegion; import dragonkk.rs2rsps.util.Misc; import dragonkk.rs2rsps.util.RSObject; import dragonkk.rs2rsps.util.RSTile; /* * CastleWars * * [MENTION=52317]auth[/MENTION]or Crezzy 100% * */ public class CastleWars { // rewards interface id : 60 private int[] startCoords = { 2427 , 3076 , 2371 , 3130 }; private static int[] timer = { 0 , 0 }; private static byte[] kills = { 0 , 0 }; private static boolean gameStarted = false; private boolean timerStarted = false; private boolean zamHighSara = zamTeam.size () > saraTeam.size (); private boolean saraHighZam = saraTeam.size () > zamTeam.size (); private Item zamFlagId = new Item ( 4039 ); private Item saraFlagId = new Item ( 4037 ); public static List <Player> saraTeam = new ArrayList <Player> (); public static List <Player> zamTeam = new ArrayList <Player> (); public static List <Player> inLobby = new ArrayList <Player> (); public static List <Player> inGame = new ArrayList <Player> (); private int setTimeInGame() { switch ( inLobby.size () ) { case 2: return 300; case 3: case 4: return 400; case 5: case 6: return 500; default: return 600; } } private boolean enoughPlayers() { return saraTeam.size () >= 1 & zamTeam.size () >= 1; } private boolean canEndGame() { return timer[1] == 0 || zamTeam.size () <= 0 || saraTeam.size () <= 0 && gameStarted == true; } private boolean atCw( Player p ) { return p.getLocation ().getX () >= 2368 && p.getLocation ().getX () <= 2431 && p.getLocation ().getY () >= 3069 && p.getLocation ().getY () <= 3138; } private void removeAddList( Player p1, boolean saraList, boolean adding ) { synchronized ( inLobby ) { synchronized ( saraTeam ) { synchronized ( zamTeam ) { switch ( add ) { String add = adding ? "true" : "false"; case "true": inLobby.add ( p1 ); if ( saraList ) saraTeam.add ( p1 ); else zamTeam.add ( p1 ); break; case "false": inLobby.remove ( p1 ); if ( saraList ) saraTeam.remove ( p1 ); else zamTeam.remove ( p1 ) ; break; } } } } } private void addRemovePlayersToInGameList( boolean adding,boolean removingAll ) { synchronized ( inGame ) { if ( adding ) { inGame.addAll ( zamTeam ); inGame.addAll ( saraTeam ); } else { if(removingAll){ inLobby.removeAll ( inGame ); zamTeam.clear (); saraTeam.clear (); inGame.clear (); } else { inLobby.removeAll( inGame); } } } } public void leaveTeamLobby( Player p ) { handleTeamCape ( p, false ); p.getMask ().getRegion ().teleport ( 2441, 3090, 0, 0 ); p.getFrames ().sendCloseOverlay (); p.getFrames ().sendChatMessage ( 0, saraTeam.contains ( p ) ? "You leave the Saradomin team." : "You leave the Zamarok team." ); removeAddList ( p, saraTeam.contains ( p ) ? true : false, false ); } public void joinTeamLobby( Player p, int object ) { boolean bool = object == ( 4387 ); if ( zamHighSara && !bool ) { p.getFrames ().sendChatMessage ( 0, "To many players in the Zamorak Team. Please join Saradomin Team!" ); return; } if ( saraHighZam && bool ) { p.getFrames ().sendChatMessage ( 0, "To many players in the Saradomin Team. Please join Zamorak Team!" ); return; } p.getFrames ().sendOverlay ( 57 ); p.getMask ().getRegion ().teleport ( bool ? 2376 : 2424, bool ? 9488 : 9527, 0, 0 ); removeAddList ( p, bool ? true : false, true ); handleTeamCape ( p, true ); p.getFrames ().sendChatMessage ( 0, "You join the" + ( bool ? "Saradomin team" : "Zamorak team!" ) ); processLobbyTimer (); } public void handleTeamCape( Player p, boolean adding ) { Item saraCloakId = new Item ( 4041 ); Item zamCloakId = new Item ( 4042 ); p.getEquipment (); if ( adding ) { p.getEquipment ().removeSlot ( Equipment.SLOT_CAPE ); p.getEquipment ().removeSlot ( Equipment.SLOT_HAT ); p.getEquipment ().set ( Equipment.SLOT_CAPE, saraTeam.contains ( p ) ? saraCloakId : zamCloakId ); } else { p.getEquipment ().removeSlot ( Equipment.SLOT_CAPE ); p.getEquipment ().removeSlot ( Equipment.SLOT_HAT ); p.getInventory ().deleteItem ( saraTeam.contains ( p ) ? 4041 : 4042, 10 ); } } public void randomTeamPortal( Player p ) { removeAddList ( p, saraHighZam ? true : false, true ); handleTeamCape ( p, true ); p.getFrames ().sendOverlay ( 57 ); p.getMask ().getRegion ().teleport ( saraHighZam ? 2376 : 2424, saraHighZam ? 9488 : 9527, 0, 0 ); p.getFrames ().sendChatMessage ( 0, "You join the" + ( saraHighZam ? "Saradomin team" : "Zamorak team" + "!" ) ); processLobbyTimer (); } public void loginLogout( Player p, boolean logginIn ) { if ( atCw ( p ) || inLobby.contains ( p ) ) if ( logginIn == true ) { removeFlag ( p, false ); p.getMask ().getRegion ().teleport ( 2441, 3090, 0, 0 ); p.getFrames ().sendChatMessage ( 0, "You logged out so you auto left the game!" ); } else removeAddList ( p, saraTeam.contains ( p ) ? true : false, false ); } private void cwPlay() { EventManager.submit ( new Event ( 1000 ) { @ Override public void execute() { if ( timer[1] >= 1 ) { timer[1]--; for ( Player p : inGame ) { if(inLobby.contains(p)) addRemovePlayersToInGameList(false, false); p.getFrames ().sendString ( "" + timer[1] / 60 + " Mins left", 58, 6 ); if ( !atCw ( p ) ) { removeAddList ( p, saraTeam.contains ( p ) ? true : false, false ); continue; } if ( canEndGame () ) { gameEnd (); this.stop (); } } } } } ); } private void processLobbyTimer() { if ( enoughPlayers () ) { if ( !timerStarted ) timer[0] = 60; EventManager.submit ( new Event ( 1000 ) { @ Override public void execute() { for ( final Player pl : inLobby ) { pl.getFrames ().sendString ( gameStarted ? "Currently game underway. Time remaining = " + timer[1] / 60 + " Mins left" : "Waiting for players to join the other team.", 57, 0 ); continue; } if ( timer[0] >= 1 && gameStarted == false ) { timer[0]--; timerStarted = true; for ( final Player pl : inLobby ) pl.getFrames ().sendString ( zamTeam.size () == 0 || saraTeam.size () == 0 ? "Waiting for players to join the other team." : "Time untill next game = " + timer[0], 57, 0 ); } if ( timer[0] <= 1 ) if ( zamTeam.size () == 0 || saraTeam.size () == 0 ) { timerStarted = false; this.stop (); } else { gameStart (); this.stop (); } } } ); } } private void gameStart() { addRemovePlayersToInGameList ( true , false); cwPlay (); gameStarted = true; timerStarted = false; timer[1] = setTimeInGame (); for ( Player pl : inLobby ) { boolean bool = saraTeam.contains ( pl ); pl.getFrames ().sendOverlay ( 58 ); pl.getFrames ().sendChatMessage ( 0, "Game has started. Good luck" + ( bool ? "Saradomin" : "Zamorak" + "!" ) ); pl.getMask ().getRegion ().teleport ( startCoords[bool ? 0 : 2], startCoords[bool ? 1 : 3], 1, 0 ); } } public void cwDeath( final Player p ) { if ( atCw ( p ) ) { boolean saraDeath = saraTeam.contains ( p ); p.getMask ().getRegion ().teleport ( startCoords[( saraDeath ? 0 : 2 )], startCoords[( saraDeath ? 1 : 3 )], 1, 0 ); kills[saraDeath ? 1 : 0]++; for ( Player pl : inGame ) { pl.getFrames ().sendString ( "Saradomin deaths = " + kills[0], 58, 0 ); pl.getFrames ().sendString ( "Zamarok deaths = " + kills[1], 58, 1 ); } if ( p.getEquipment ().contains ( zamFlagId ) || p.getEquipment ().contains ( saraFlagId ) ) removeFlag ( p, false ); } } public void gameEnd() { gameStarted = false; handleWinner (); for ( Player pl : inGame ) { pl.getMask ().getRegion ().teleport ( 2441 + Misc.random ( 5 ), 3090 + Misc.random ( 5 ), 0, 0 ); pl.getFrames ().sendCloseOverlay (); handleTeamCape ( pl, false ); pl.getFrames ().sendChatMessage ( 1, "Game Has Ended." ); } addRemovePlayersToInGameList ( false , true); kills[0] = 0; kills[1] = 0; } private void handleWinner() { for ( Player pl : inGame ) { if ( kills[0] > kills[1] ) { pl.getFrames () .sendChatMessage ( 1, saraTeam.contains ( pl ) ? "Congratz your team wins the game, You have received get 5 points for winning!" : "To bad Zamorak, your team loses the game. You have received 2 points for your effort." ); pl.cwpoints += saraTeam.contains ( pl ) ? 5 : 2; } else if ( kills[1] > kills[0] ) { pl.getFrames () .sendChatMessage ( 1, zamTeam.contains ( pl ) ? "Congratz Zamorak! Your team wins the game. You have received 5 points for winning!" : "To bad Saradomin, your team loses the game. You have received 2 points for your effort." ); pl.cwpoints += zamTeam.contains ( pl ) ? 5 : 2; } else if ( kills[0] == kills[1] ) { pl.getFrames ().sendChatMessage ( 1, "No points were scored during the game. " ); pl.getFrames ().sendChatMessage ( 1, "As a result no CastleWars points will be rewarded." ); } else { pl.getFrames ().sendChatMessage ( 1, "The game was a tie. Both teams received 3 Point each for the effort." ); pl.cwpoints += 3; } } } public void handleTakeFlag( Player p, int object ) { boolean zamFlag = object == 4903; RSTile flagTile = new RSTile ( zamFlag ? (short) 2370 : 2429, zamFlag ? (short) 3133 : 3074, (byte) 3, 0 ); if ( zamFlag && zamTeam.contains ( p ) && p.getLocation ().getDistance ( flagTile ) <= 2 ) { p.getFrames ().sendChatMessage ( 1, "You can't take your own team Flag!" ); return; } if ( !zamFlag && saraTeam.contains ( p ) && p.getLocation ().getDistance ( flagTile ) <= 2 ) { p.getFrames ().sendChatMessage ( 1, "You can't take your own team Flag!" ); return; } p.getEquipment (); p.getEquipment ().removeSlot ( Equipment.SLOT_WEAPON ); p.getEquipment ().removeSlot ( Equipment.SLOT_SHIELD ); p.getEquipment ().set ( Equipment.SLOT_WEAPON, zamFlag ? zamFlagId : saraFlagId ); for ( Player pl : inGame ) { pl.getFrames ().removeMapObject ( flagTile ); // pl.getHinticonmanager().addHintIcon(p, 1, -1, true); } } public void removeFlag( Player p, boolean capped ) { if ( atCw ( p ) ) { boolean zamFlag = p.getEquipment ().getWeaponId () == 4039; p.getEquipment ().deleteItem ( zamFlag ? 4039 : 4037, 1 ); if ( !capped ) { for ( Player pl : inGame ) { pl.getFrames ().sendChatMessage ( 1, ( zamFlag ? "Zamarok" : "Saradomin" ) + " flag has been dropped and is no longer able to be captured." ); } } } } public void flagCap( Player p ) { if ( p.getEquipment ().getWeaponId () == 4039 || p.getEquipment ().getWeaponId () == 4037 ) { for ( Player pl : inGame ) { pl.getFrames ().sendChatMessage ( 1, "" + p.getUsername ().toString () + " has just captured the "+ (p.getEquipment ().getWeaponId () == 4039 ? "Zamorak " : "Saradomin ")+"flag!" ); pl.getFrames ().sendChatMessage ( 1, "10 Kills have been awarded to the " + ( p.getEquipment ().getWeaponId () == 4039 ? "Zamorak team!" : "Saradomin Team!" ) ); } kills[p.getEquipment ().getWeaponId () == 4039 ? 1 : 0] += 10; removeFlag ( p, true ); } } public void resetCw() { for ( Player pl : inGame ) { pl.getMask ().getRegion ().teleport ( 2441, 3090, 0, 0 ); pl.getFrames ().sendChatMessage ( 1, "CastleWars reset by an admin." ); pl.getFrames ().sendCloseOverlay (); } for ( Player pl1 : inLobby ) { pl1.getMask ().getRegion ().teleport ( 2441, 3090, 0, 0 ); pl1.getFrames ().sendChatMessage ( 1, "CastleWars reset by an admin." ); pl1.getFrames ().sendCloseOverlay (); } gameStarted = false; zamTeam.clear (); saraTeam.clear (); inGame.clear (); inLobby.clear (); kills[0] = 0; kills[1] = 0; timer[0] = 0; timer[1] = 0; } } [/code] 100% credits me aka Crezzy Feedback and constructive criticism will be thanked.
  2. I'm releasing my PheroxScape today, so please do not leach it. I fully wrote the combat system from scratch and it is flawless. Clipping animations and many other things are fixed. This would be a really good server base to use. [B]Download[/B] - [url]http://www.mediafire.com/?zqce2vfv6985p75[/url] [IMG]http://i.imgur.com/f0xNd.png[/IMG] [IMG]http://i.imgur.com/NTU5I.png[/IMG]
×