newhaven
Welcome to the Ragescape forums! Here will be news on the latest updates and a way for everyone to put there comments in about the game, or talk about whatever else they wish. So Signup and have Fun!
newhaven
Welcome to the Ragescape forums! Here will be news on the latest updates and a way for everyone to put there comments in about the game, or talk about whatever else they wish. So Signup and have Fun!
newhaven
Would you like to react to this message? Create an account in a few clicks or log in to continue.


The Official Ragescape Fourms.
 
HomeLatest imagesSearchRegisterLog in
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Poll
What should the new quest be about?
Mining/Smithing
My works -Programming I_vote_lcap50%My works -Programming I_vote_rcap
 50% [ 8 ]
Crafting
My works -Programming I_vote_lcap0%My works -Programming I_vote_rcap
 0% [ 0 ]
Woodcutting
My works -Programming I_vote_lcap6%My works -Programming I_vote_rcap
 6% [ 1 ]
Combat
My works -Programming I_vote_lcap44%My works -Programming I_vote_rcap
 44% [ 7 ]
Total Votes : 16
Latest topics
» New Haven Update (8-14-13)
My works -Programming I_icon_minitimeThu Aug 15, 2013 1:08 am by Tacos

» Idea for forum
My works -Programming I_icon_minitimeSun Aug 11, 2013 3:04 am by tyrael

» New In-game TOS and Registration TOS + UPDATED WEBSITE!?
My works -Programming I_icon_minitimeSun Aug 11, 2013 12:49 am by tyrael

» Not Dead YET
My works -Programming I_icon_minitimeSun Aug 11, 2013 12:31 am by tyrael

» Question about forum
My works -Programming I_icon_minitimeSat Aug 03, 2013 9:14 am by KING49

» List of Current Staff Members As Of 7/24/13
My works -Programming I_icon_minitimeWed Jul 24, 2013 4:14 am by Davidlov

» Hello!!!!!!!
My works -Programming I_icon_minitimeSun Jun 30, 2013 7:46 pm by Davidlov

» Please use this link to log on
My works -Programming I_icon_minitimeFri Mar 15, 2013 11:07 pm by Davidlov

» Nobody online
My works -Programming I_icon_minitimeTue Mar 12, 2013 10:25 pm by Davidlov

Top posters
Lord Fox
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
national
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
Ko Dbb 121
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
tyrael
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
willzkillz
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
Davidlov
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
misfitblood
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
Perfection
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
KING49
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
i pk ftw
My works -Programming I_vote_lcapMy works -Programming I_voting_barMy works -Programming I_vote_rcap 
Most Viewed Topics
High-scores & Leader-boards
Idea for forum
Ravenscape Unveiling
Question about forum
Torva and Spirit Shields
Future updates outline 4/23/2012
New Monsters
Rage-scape V3 Client
new clan Apocalyptic blightarmour
Ragescape Beta Client V5
Statistics
We have 143 registered users
The newest registered user is yeshdefe

Our users have posted a total of 1524 messages in 274 subjects
Who is online?
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest

None

Most users ever online was 172 on Mon Apr 12, 2021 4:23 am

 

 My works -Programming

Go down 
4 posters
AuthorMessage
Zackz
Noobie
Noobie



Posts : 3
Join date : 2012-05-03

My works -Programming Empty
PostSubject: My works -Programming   My works -Programming I_icon_minitimeThu May 03, 2012 10:53 pm

Hello all, I am relatively new to this server and I want to show you guys some of my code for RSPS's. Sadly, they are for Delta so they cannot be really implemented into the server.

Anyway, here they are.


Construction

Code:

package Server.Other;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class ConstructionHandler
{

public static int maxOBJs = 14973;
   public OBJ objs[] = new OBJ[maxOBJs];
   ConstructionHandler() {
      for(int i = 0; i < maxOBJs; i++) {
         objs[i] = null;
      }
   }
   
   public void newObject(int newObjType, int x, int y, int heightLevel, int rotation, int type) {
      int slot = -1;
      for (int i = 1; i < maxOBJs; i++) {
         if (objs[i] == null) {
            slot = i;
            break;
         }
      }

      if(slot == -1) return;
      OBJ newOBJ = new OBJ(slot, newObjType);
      newOBJ.x = x;
      newOBJ.y = y;
      newOBJ.type = type;
      newOBJ.heightLevel = heightLevel;
      newOBJ.rotation = rotation;
      
   }
   public void newPlayerObject(int newObjType, int x, int y, int heightLevel, int rotation, int type, int OwnerId,int PID) {
      int slot = -1;
      for (int i = 1; i < maxOBJs; i++) {
         if (objs[i] == null) {
            slot = i;
            break;
         }
      }
      client c = (client) server.playerHandler.players[PID];
      if(slot == -1) return;
      OBJ newOBJ = new OBJ(slot, newObjType);
      //System.out.println("CONSTRUCTION: "+PID);
      newOBJ.PID = OwnerId;
      newOBJ.x = x;
      newOBJ.type = type;
      newOBJ.y = y;
      newOBJ.heightLevel = heightLevel;
      newOBJ.rotation = rotation;
      c.AddPOHObj(newOBJ.objType, newOBJ.x, newOBJ.y, newOBJ.heightLevel,newOBJ.rotation,newOBJ.type);
      //c.heightLevel = 0;
   }

   public boolean loadOBJ(int OwnerId,int OBJHEIGHT,int PID) {
   client p;
   String savedName = "";
   p = (client) server.playerHandler.players[OwnerId];
   savedName = p.playerName;
   
      String line = "";
      String token = "";
      String token2 = "";
      String token2_2 = "";
      String[] token3 = new String[10];
      boolean EndOfFile = false;
      BufferedReader characterfile = null;
      try {
         characterfile = new BufferedReader(new FileReader("./Server/Other/config/objectdata/POH/"+p.playerName+".objdata"+OBJHEIGHT));
      } catch (FileNotFoundException fileex) {
         misc.println("error loading file, "+p.playerName+".objdata"+OBJHEIGHT);
         p.playerName = savedName;
         return false;
      }
      try {
         line = characterfile.readLine();
      } catch (IOException ioexception) {
         misc.println("error loading file, "+p.playerName+".objdata"+OBJHEIGHT);
         p.playerName = savedName;
         return false;
      }
      while ((EndOfFile == false) && (line != null)) {
         line = line.trim();
         int spot = line.indexOf("=");
         if (spot > -1) {
            token = line.substring(0, spot);
            token = token.trim();
            token2 = line.substring(spot + 1);
            token2 = token2.trim();
            token2_2 = token2.replaceAll("\t\t", "\t");
            token2_2 = token2_2.replaceAll("\t\t", "\t");
            token2_2 = token2_2.replaceAll("\t\t", "\t");
            token2_2 = token2_2.replaceAll("\t\t", "\t");
            token2_2 = token2_2.replaceAll("\t\t", "\t");
            token3 = token2_2.split("\t");
            if (token.equals("obj")) {
               //if (Integer.parseInt(token3[0]) <= -1)
                  //continue;
               newPlayerObject(Integer.parseInt(token3[0]), Integer.parseInt(token3[1]), Integer.parseInt(token3[2]), Integer.parseInt(token3[4]), Integer.parseInt(token3[5]), Integer.parseInt(token3[3]), OwnerId,PID);
            }
         } else {
            if (line.equals("[ENDOFOBJLIST]")) {
               try {
                  characterfile.close();
               } catch (IOException ioexception) {
               }
               p.playerName = savedName;
               return true;
            }
         }
         try {
            line = characterfile.readLine();
         } catch (IOException ioexception1) {
            EndOfFile = true;
            p.playerName = savedName;
         }
      }
      try {
         characterfile.close();
      } catch (IOException ioexception) {
      }
      p.playerName = savedName;
      return false;
   }
   
   
}

Castle Wars
Code:

package Server.Other;
import java.util.ArrayList;

public class CastleWars {

   client c;
   static ArrayList<Integer> playersInZamorak = new ArrayList<Integer>();
   static ArrayList<Integer> playersInSaradomin = new ArrayList<Integer>();
   static ArrayList<Integer> totalPlayers = new ArrayList<Integer>();
   public boolean isSaradomin;
   public boolean isZamorak;
   public int[] objects = { 4387, 4408, 4388, 4389, 4390, 4423, 4424, 4417,
         4419, 4464, 1747, 4460, 4463, 4462, 4459, 4461, 4912, 4458, 4469,
         4902, 4418, 4903, 4415, 4911, 4420, 4411, 4381, 4382, 4043, 4470,
         4407, 4406, 4467, 4465, 4427, 4428 };

   public CastleWars(client c) {
      this.c = c;
   }

   public void displayGameFrame() {
      c.sendFrame126("Zamorak: " + Server.Other.server.zamorakScore, 11147);
      c.sendFrame126("Saradomin: " + Server.Other.server.saradominScore, 11148);
      c.sendFrame126("Players: " + totalPlayers.size(), 11154);
      c.sendFrame126(CastleWarsHandler.gameTime + " Time", 11155);
      c.sendFrame126(Server.Other.server.saradominStandardTaken ? "@red@Taken" : "@gre@Safe", 11166);
      c.sendFrame126(Server.Other.server.zamorakStandardTaken ? "@red@Taken" : "@gre@Safe", 11167);
      c.setInterfaceWalkable(11146);
   }

   public void displayRemainingTime() {
      c.sendFrame126("Time until next game: "
            + CastleWarsHandler.gameTime, 11480);
      c.setInterfaceWalkable(11479);
   }

   @SuppressWarnings("static-access")
   public static void startGame() {
      /*
      totalPlayers.addAll(playersInZamorak);
      totalPlayers.addAll(playersInSaradomin);
      System.out.println("New Castle Wars game starting with "
            + totalPlayers.size() + " players.");
      for (int i : playersInZamorak) {
         client c2 = (client) server.playerHandler.players[i];
         c2.toX = (int) (2372 + Math.random() * 3);
         c2.toY = (int) (3131 + Math.random() * 3);
         c2.heightLevel = 1;
      }
      for (int i : playersInSaradomin) {
         client c2 = (client) server.playerHandler.players[i];
         c2.toX = (int) (2427 + Math.random() * 3);
         c2.toY = (int) (3076 + Math.random() * 3);
         c2.heightLevel = 1;
      }
      playersInSaradomin.clear();
      playersInZamorak.clear();
      */
   }

   @SuppressWarnings("static-access")
   public static void endGame() {
      /*
      int[] cwItems = { 4045, 4047, 4049, 4051, 4053, 4060, 1265 };
      for (int i : totalPlayers) {
         client c2 = (client) server.playerHandler.players[i];
         c2.toX = 2441;
         c2.toY = 3090;
         c2.heightLevel = 0;
         c2.playerEquipment[c2.playerCape] = -1;
         c2.playerEquipment[c2.playerHat] = -1;
         c2.playerEquipmentN[c2.playerCape] = 0;
         c2.playerEquipmentN[c2.playerHat] = 0;
         c2.setEquipment(-1, 0, c2.playerCape);
         c2.setEquipment(-1, 0, c2.playerHat);
         c2.sM("Final score: Zamorak " + server.zamorakScore
               + ", Saradomin " + server.saradominScore + ".");
         if (c2.playerEquipment[c2.playerWeapon] == 4037
               || c2.playerEquipment[c2.playerWeapon] == 4039) {
            c2.playerEquipment[c2.playerWeapon] = -1;
            c2.playerEquipmentN[c2.playerWeapon] = 0;
         }
         c2.rainbowpts += 2;
         c2.sM("You gain 2 rainbow points for good effort!");
         if (c2.castlewars.isInSaradomin() && server.saradominScore > server.zamorakScore) {
            c2.sM("@gre@You have won the game!");
            c2.sM("You gain 10 rainbow points.");
         }
         if (c2.castlewars.isInZamorak() && server.zamorakScore > server.saradominScore) {
            c2.sM("@gre@You have won the game!");
            c2.sM("You gain 10 rainbow points.");
         }
         for (int inv = 0; inv < 28; inv++) {
            for (int i2 : cwItems) {
               c2.deleteItem(i2, 1);
            }
         }
      }
      totalPlayers.clear();
      server.saradominScore = 0;
      server.zamorakScore = 0;
      */
   }

   public void removeFromGame() {
      int[] cwItems = { 4045, 4047, 4049, 4051, 4053, 4060, 1265 };
      c.toX = 2441;
      c.toY = 3090;
      c.heightLevel = 0;
      c.playerEquipment[c.playerCape] = -1;
      c.playerEquipment[c.playerHat] = -1;
      c.playerEquipmentN[c.playerCape] = 0;
      c.playerEquipmentN[c.playerHat] = 0;
      c.setEquipment(-1, 0, c.playerCape);
      c.setEquipment(-1, 0, c.playerHat);
      c.sM("You have been removed from the Castle Wars game.");
      if (c.playerEquipment[c.playerWeapon] == 4037) {
         server.saradominStandardTaken = false;
         c.playerEquipment[c.playerWeapon] = -1;
         c.playerEquipmentN[c.playerWeapon] = 0;
         c.setEquipment(-1, 0, c.playerWeapon);
      }
      if (c.playerEquipment[c.playerWeapon] == 4039) {
         server.zamorakStandardTaken = false;
         c.playerEquipment[c.playerWeapon] = -1;
         c.playerEquipmentN[c.playerWeapon] = 0;
         c.setEquipment(-1, 0, c.playerWeapon);
      }
      for (int inv = 0; inv < 28; inv++) {
         for (int i2 : cwItems) {
            c.deleteItem(i2, 1);
         }
      }
   }

   public boolean isInCastleWars() {
      return (c.absX >= 2366 && c.absX <= 2431 && c.absY >= 3071
            && c.absY <= 3137 || c.absX >= 2354 && c.absX <= 2410
            && c.absY >= 9497 && c.absY <= 9545 || c.absX >= 2395
            && c.absX <= 2435 && c.absY >= 9474 && c.absY <= 9511 ? true
            : false);
   }

   public boolean isInZamorak() {
      return (c.absX > 2410 && c.absX < 2429 && c.absY > 9512
            && c.absY < 9535 ? true : false);
   }

   public boolean isInSaradomin() {
      return (c.absX > 2368 && c.absX < 2393 && c.absY > 9481
            && c.absY < 9497 ? true : false);
   }

   public void handleCastleWarsObjects(int object, int objectX, int objectY) {
      /*
      switch (object) {
      case 4387:
         joinSaradomin();
         break;
      case 4408:
         pickSideForMe();
         break;
      case 4388:
         joinZamorak();
         break;
      case 4389:
         leaveSaradomin();
         break;
      case 4390:
         leaveZamorak();
         break;
      case 4406:
         c.toX = 2441;
         c.toY = 3090;
         c.heightLevel = 0;
         c.playerEquipment[c.playerCape] = -1;
         c.playerEquipment[c.playerHat] = -1;
         c.playerEquipmentN[c.playerCape] = 0;
         c.playerEquipmentN[c.playerHat] = 0;
         c.setEquipment(-1, 0, c.playerCape);
         c.setEquipment(-1, 0, c.playerHat);
         c.sM("You leave the game.");
         totalPlayers.remove(totalPlayers.indexOf(c.playerId));
         isSaradomin = false;
         break;
      case 4407:
         c.toX = 2441;
         c.toY = 3090;
         c.heightLevel = 0;
         c.playerEquipment[c.playerCape] = -1;
         c.playerEquipment[c.playerHat] = -1;
         c.playerEquipmentN[c.playerCape] = 0;
         c.playerEquipmentN[c.playerHat] = 0;
         c.setEquipment(-1, 0, c.playerCape);
         c.setEquipment(-1, 0, c.playerHat);
         c.sM("You leave the game.");
         totalPlayers.remove(totalPlayers.indexOf(c.playerId));
         isZamorak = false;
         break;
      case 4458:
         c.addItem(4049, 1);
         break;
      case 459:
         c.addItem(4051, 1);
         break;
      case 4460:
         c.sM("You don't need rocks... :)");
         break;
      case 4462:
         c.addItem(4047, 1);
         break;
      case 4461:
         c.addItem(4053, 1);
         break;
      case 4463:
         c.addItem(4045, 1);
         break;
      case 4464:
         c.addItem(1265, 1);
         break;
      case 4043:
         c.addItem(4460, 1);
         break;
      case 4420:
         if (c.absX == 2383 && c.absY == 3133) {
            c.toX = 2382;
            c.toY = 3130;
         }
         if (c.absX == 2382 && c.absY == 3130) {
            c.toX = 2383;
            c.toY = 3133;
         }
         break;
      case 4411:
         if (c.absX == 2420 && c.absY == 3122) {
            c.toX = 2420;
            c.toY = 3123;
         }
         if (c.absX == 2418 && c.absY == 3125) {
            c.toX = 2419;
            c.toY = 3125;
         }
         if (c.absX == 2420 && c.absY == 3123) {
            c.toX = 2419;
            c.toY = 3123;
         }
         if (c.absX == 2419 && c.absY == 3123) {
            c.toX = 2419;
            c.toY = 3124;
         }
         if (c.absX == 2419 && c.absY == 3123) {
            c.toX = 2420;
            c.toY = 3123;
         }
         if (c.absX == 2419 && c.absY == 3124) {
            c.toX = 2419;
            c.toY = 3123;
         }
         if (c.absX == 2419 && c.absY == 3125) {
            c.toX = 2419;
            c.toY = 3124;
         }
         if (c.absX == 2419 && c.absY == 3124) {
            c.toX = 2419;
            c.toY = 3125;
         }
         if (c.absX == 2419 && c.absY == 3125) {
            c.toX = 2418;
            c.toY = 3125;
         }
         if (c.absX == 2418 && c.absY == 3126) {
            c.toX = 2418;
            c.toY = 3125;
         }
         break;
      case 4415:
         if (objectX == 2374 && objectY == 3133) {
            c.toX = 2374;
            c.toY = 3130;
            c.heightLevel = 2;
         }
         if (objectX == 2380 && objectY == 3127) {
            c.toX = 2380;
            c.toY = 3130;
            c.heightLevel = 0;
         }
         if (c.absX == 2369 && c.absY == 3127) {
            c.toX = 2372;
            c.toY = 3126;
            c.heightLevel = 1;
         }
         if (c.absX == 2419 && c.absY == 3080) {
            c.toX = 2419;
            c.toY = 3077;
            c.heightLevel = 0;
         }
         if (c.absX == 2420 && c.absY == 3080) {
            c.toX = 2419;
            c.toY = 3077;
            c.heightLevel = 0;
         }
         if (c.absX == 2430 && c.absY == 3080) {
            c.toX = 2427;
            c.toY = 3081;
            c.heightLevel = 1;
         }
         if (c.absX == 2426 && c.absY == 3074) {
            c.toX = 2425;
            c.toY = 3077;
            c.heightLevel = 2;
         }
         break;
      case 4418:
         if (c.absX == 2374 && c.absY == 3130) {
            c.toX = 2374;
            c.toY = 3133;
            c.heightLevel = 3;
         }
         if (c.absX == 2372 && c.absY == 3126) {
            c.toX = 2369;
            c.toY = 3127;
            c.heightLevel = 2;
         }
         if (c.absX == 2380 && c.absY == 3130) {
            c.toX = 2380;
            c.toY = 3127;
            c.heightLevel = 1;
         }
         break;
      case 1747:
         if (c.absX == 2378 && c.absY == 3135) {
            c.heightLevel = 1;
         }
         break;
      case 4911:
         if (c.absX == 2378 && c.absY == 3133) {
            c.toX = 2378;
            c.toY = 3133;
            c.heightLevel = 0;
         }
         break;
      case 4469:
         if (!isSaradomin)
            break;
         if (c.absX == 2422 && c.absY == 3076) {
            c.toX = 2423;
            c.toY = 3076;
         }
         if (c.absX == 2423 && c.absY == 3076) {
            c.toX = 2422;
            c.toY = 3076;
         }
         if (c.absX == 2426 && c.absY == 3080) {
            c.toX = 2426;
            c.toY = 3081;
         }
         if (c.absX == 2426 && c.absY == 3081) {
            c.toX = 2426;
            c.toY = 3080;
         }
         break;
      case 4417:
         if (c.absX == 2419 && c.absY == 3077) {
            c.toX = 2419;
            c.toY = 3080;
            c.heightLevel = 1;
         }
         if (c.absX == 2427 && c.absY == 3081) {
            c.toX = 2430;
            c.toY = 3081;
            c.heightLevel = 2;
         }
         if (objectX == 2425 && objectY == 3074) {
            c.toX = 2425;
            c.toY = 3074;
            c.heightLevel = 3;
         }

         break;
      case 4470:
         if (!isZamorak)
            break;
         if (c.absX == 2376 && c.absY == 3131) {
            c.toX = 2377;
            c.toY = 3131;
         }
         if (c.absX == 2377 && c.absY == 3131) {
            c.toX = 2376;
            c.toY = 3131;
         }
         if (c.absX == 2373 && c.absY == 3127) {
            c.toX = 2373;
            c.toY = 3126;
         }
         if (c.absX == 2373 && c.absY == 3126) {
            c.toX = 2373;
            c.toY = 3127;
         }
         break;
      case 4419:
         if (c.absX == 2416 && c.absY == 3074) {
            c.toX = 2417;
            c.toY = 3077;
         }
         if (c.absX == 2417 && c.absY == 3077) {
            c.toX = 2416;
            c.toY = 3074;
         }
         break;
      case 4467:
         if (c.absX == 2384 && c.absY == 3134) {
            c.toX = 2385;
            c.toY = 3134;
         }
         if (c.absX == 2385 && c.absY == 3134) {
            c.toX = 2384;
            c.toY = 3134;
         }
         break;
      case 4465:
         if (c.absX == 2414 && c.absY == 3073) {
            c.toX = 2415;
            c.toY = 3073;
         }
         if (c.absX == 2415 && c.absY == 3073) {
            c.toX = 2414;
            c.toY = 3073;
         }
         break;
      case 4427:
      case 4428:
         if (c.absX == 2373 && c.absY == 3120) {
            c.toX = 2373;
            c.toY = 3119;
         }
         if (c.absX == 2372 && c.absY == 3120) {
            c.toX = 2372;
            c.toY = 3119;
         }
         if (c.absX == 2373 && c.absY == 3119) {
            c.toX = 2373;
            c.toY = 3120;
         }
         if (c.absX == 2372 && c.absY == 3119) {
            c.toX = 2372;
            c.toY = 3120;
         }
         break;
      case 4423:
      case 4424:
         if (c.absX == 2427 && c.absY == 3088) {
            c.toX = 2427;
            c.toY = 3087;
         }
         if (c.absX == 2426 && c.absY == 3088) {
            c.toX = 2426;
            c.toY = 3087;
         }
         if (c.absX == 2427 && c.absY == 3087) {
            c.toX = 2427;
            c.toY = 3088;
         }
         if (c.absX == 2426 && c.absY == 3087) {
            c.toX = 2426;
            c.toY = 3088;
         }
         break;
      case 4903:
         if (c.playerEquipment[c.playerWeapon] != -1 && !isZamorak) {
            break;
         }
         if (server.zamorakStandardTaken && isSaradomin) {
            c.sM("The standard is already taken.");
            break;
         }
         if (c.playerEquipment[c.playerWeapon] == 4037
               && server.saradominStandardTaken) {
            c.playerEquipment[c.playerWeapon] = -1;
            c.setEquipment(-1, 0, c.playerWeapon);
            server.zamorakScore += 1;
            server.saradominStandardTaken = false;
            c.sM("You score!");
         }
         if (isSaradomin) {
            c.playerEquipment[c.playerWeapon] = 4039;
            c.playerEquipmentN[c.playerWeapon] = 1;
            c.setEquipment(4039, 1, c.playerWeapon);
            server.zamorakStandardTaken = true;
            c.sM("You take the standard.");
         }
         break;
      case 4902:
         if (c.playerEquipment[c.playerWeapon] != -1 && isZamorak) {
            break;
         }
         if (server.saradominStandardTaken && isZamorak) {
            c.sM("The standard is already taken.");
            break;
         }
         if (c.playerEquipment[c.playerWeapon] == 4039
               && server.zamorakStandardTaken) {
            c.playerEquipment[c.playerWeapon] = -1;
            c.setEquipment(-1, 0, c.playerWeapon);
            server.saradominScore += 1;
            server.zamorakStandardTaken = false;
            c.sM("You score!");
         }
         if (isZamorak) {
            c.playerEquipment[c.playerWeapon] = 4037;
            c.playerEquipmentN[c.playerWeapon] = 1;
            c.setEquipment(4037, 1, c.playerWeapon);
            server.saradominStandardTaken = true;
            c.sM("You take the standard.");
         }
         break;
      default:
         System.out.println("Undefined castlewar object: " + object);
      }
      
      */

   }

   private void joinZamorak() {
      if (c.playerEquipment[c.playerCape] != -1
            || c.playerEquipment[c.playerHat] != -1) {
         return;
      }
      c.toX = (int) (2424 + Math.random() * 3);
      c.toY = (int) (9527 + Math.random() * 3);
      playersInZamorak.add(c.playerId);
      isZamorak = true;
      c.playerEquipment[c.playerCape] = 4516;
      c.playerEquipment[c.playerHat] = 4515;
      c.playerEquipmentN[c.playerCape] = 1;
      c.playerEquipmentN[c.playerHat] = 1;
      c.setEquipment(4516, 1, c.playerCape);
      c.setEquipment(4515, 1, c.playerHat);
   }

   private void leaveZamorak() {
      c.toX = 2441;
      c.toY = 3090;
      c.heightLevel = 0;
      c.playerEquipment[c.playerCape] = -1;
      c.playerEquipment[c.playerHat] = -1;
      c.playerEquipmentN[c.playerCape] = 0;
      c.playerEquipmentN[c.playerHat] = 0;
      c.sM("You exit the waiting room.");
      playersInZamorak.remove(playersInZamorak.indexOf(c.playerId));
      isZamorak = false;

   }

   private void joinSaradomin() {
      if (c.playerEquipment[c.playerCape] != -1
            || c.playerEquipment[c.playerHat] != -1) {
         return;
      }
      c.toX = (int) (2376 + Math.random() * 3);
      c.toY = (int) (9488 + Math.random() * 3);
      playersInSaradomin.add(c.playerId);
      isSaradomin = true;
      c.playerEquipment[c.playerCape] = 4514;
      c.playerEquipment[c.playerHat] = 4513;
      c.playerEquipmentN[c.playerCape] = 1;
      c.playerEquipmentN[c.playerHat] = 1;
      c.setEquipment(4514, 1, c.playerCape);
      c.setEquipment(4513, 1, c.playerHat);
   }

   private void leaveSaradomin() {
      c.toX = 2441;
      c.toY = 3090;
      c.heightLevel = 0;
      c.playerEquipment[c.playerCape] = -1;
      c.playerEquipment[c.playerHat] = -1;
      c.playerEquipmentN[c.playerCape] = 0;
      c.playerEquipmentN[c.playerHat] = 0;
      c.sM("You exit the waiting room.");
      playersInSaradomin.remove(playersInSaradomin.indexOf(c.playerId));
      isSaradomin = false;
   }

   private void pickSideForMe() {
      if (playersInZamorak.size() == playersInSaradomin.size())
         joinZamorak(); // Cuz Zamorak owns :)
      if (playersInZamorak.size() < playersInSaradomin.size())
         joinZamorak();
      else
         joinSaradomin();

   }
}

Castle Wars Handler

Code:

package Server.Other;

public class CastleWarsHandler {

   public CastleWarsHandler() {
      gameTime = 90;
   }

   public static int gameTime;
   
   public void process() {
   
      if (gameTime > 0) {
         gameTime--;
      } else {
         if (CastleWars.playersInZamorak.size() + CastleWars.playersInSaradomin.size() > 1) {
            CastleWars.startGame();
            c.sM("@dbl@A game of castle wars has started!");
         } else {
            System.out.println("Castlewars game has been delayed... Waiting for players.");
            c.sM("@red@The castle wars game has been delayed due to lack of players!");
         }
         gameTime = 600;
      }
      if (gameTime == 100 && CastleWars.totalPlayers.size() > 0) {
            CastleWars.endGame();
      }
   
   }
}


Hope you liked all of this, lol.
Back to top Go down
national
Ragescape Master
Ragescape Master
national


Posts : 184
Join date : 2012-04-13
Age : 29
Location : Stoke, England!

My works -Programming Empty
PostSubject: Re: My works -Programming   My works -Programming I_icon_minitimeFri May 04, 2012 8:37 am

Any chance you can do coding that can be implemented on this server? I bet tacos and lord fox would love a bit of help with the coding side of the server
Back to top Go down
willzkillz
Ragescape Master
Ragescape Master
willzkillz


Posts : 128
Join date : 2012-04-26
Age : 27
Location : Orlando, Florida

My works -Programming Empty
PostSubject: Re: My works -Programming   My works -Programming I_icon_minitimeFri May 04, 2012 8:41 am

Construction and castle wars would be pretty good... Only downside to castle wars is there are not many people who play.
Back to top Go down
Zackz
Noobie
Noobie



Posts : 3
Join date : 2012-05-03

My works -Programming Empty
PostSubject: Re: My works -Programming   My works -Programming I_icon_minitimeFri May 04, 2012 7:08 pm

I was speaking to Fox, and he said that once I make a vote command for the server I can join the programming team. I'm working on that right now, so we'll see. Smile
Back to top Go down
willzkillz
Ragescape Master
Ragescape Master
willzkillz


Posts : 128
Join date : 2012-04-26
Age : 27
Location : Orlando, Florida

My works -Programming Empty
PostSubject: Re: My works -Programming   My works -Programming I_icon_minitimeFri May 04, 2012 9:15 pm

kewl santa
Back to top Go down
Lord Fox
Ragescaper Supreme
Lord Fox


Posts : 305
Join date : 2012-03-16

My works -Programming Empty
PostSubject: Re: My works -Programming   My works -Programming I_icon_minitimeSat May 05, 2012 3:27 pm

We only have two programmers right now, me and tacos, so it would be nice for some relief :p
Also it can be converted to allstar.
It would be nice of you learned allstar to a better degree.
Back to top Go down
national
Ragescape Master
Ragescape Master
national


Posts : 184
Join date : 2012-04-13
Age : 29
Location : Stoke, England!

My works -Programming Empty
PostSubject: Re: My works -Programming   My works -Programming I_icon_minitimeSun May 06, 2012 9:04 am

the voting button was something i suggested in another thread Razz tbh we need a few more coders, with the ideas and ambitions everyone on this server has it's more than a 2 man job..
Back to top Go down
Sponsored content





My works -Programming Empty
PostSubject: Re: My works -Programming   My works -Programming I_icon_minitime

Back to top Go down
 
My works -Programming
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
newhaven :: General chat :: General Chat-
Jump to: