Exemplo n.º 1
0
 public void sendSmelting() {
   for (int j = 0; j < SMELT_FRAME.length; j++) {
     c.getPlayerAssistant().sendFrame246(SMELT_FRAME[j], 150, SMELT_BARS[j]);
   }
   c.getPlayerAssistant().sendFrame164(2400);
   c.smeltInterface = true;
 }
Exemplo n.º 2
0
 public static void resetPlayerAttack(Client c) {
   c.usingMagic = false;
   c.npcIndex = 0;
   c.faceUpdate(0);
   c.playerIndex = 0;
   c.getPA().resetFollow();
 }
Exemplo n.º 3
0
  public void setupSkillCapes(int capes, int capes2) {
    synchronized (c) {
      c.getItems().resetItems(3823);
      c.isShopping = true;
      c.myShopId = 14;
      c.getPA().sendFrame248(3824, 3822);
      c.getPA().sendFrame126("reflexion SkillCape Shop", 3901);

      int TotalItems = 0;
      TotalItems = capes2;
      if (TotalItems > Server.shopHandler.MaxShopItems) {
        TotalItems = Server.shopHandler.MaxShopItems;
      }
      c.getOutStream().createFrameVarSizeWord(53);
      c.getOutStream().writeWord(3900);
      c.getOutStream().writeWord(TotalItems);
      int TotalCount = 0;
      for (int i = 0; i < 23; i++) {
        if (c.getLevelForXP(c.playerXP[i]) < 99) continue;
        c.getOutStream().writeByte(1);
        c.getOutStream().writeWordBigEndianA(skillCapes[i] + 2);
        TotalCount++;
      }
      c.getOutStream().endFrameVarSizeWord();
      c.flushOutStream();
    }
  }
 public boolean ExchangedRuneArmourSetSK(
     Client c) { // Rune Full Helm, Rune Platebody, Rune Plateskirt, Rune Kiteshield
   return c.getItems().addItem(1163, 1)
       && c.getItems().addItem(1127, 1)
       && c.getItems().playerHasItem(1093, 1)
       && c.getItems().playerHasItem(1201, 1);
 }
Exemplo n.º 5
0
 private void cleanPatch() {
   if (!patchCleaned) {
     c.getPA().object(PATCH_CLEAN, 2813, 3463, -1, 10);
     patchCleaned = true;
   } else {
     c.sendMessage("You have already cleaned the patch.");
   }
 }
Exemplo n.º 6
0
 /** Shops */
 public void openShop(int ShopID) {
   c.getItems().resetItems(3823);
   resetShop(ShopID);
   c.isShopping = true;
   c.myShopId = ShopID;
   c.getPA().sendFrame248(3824, 3822);
   c.getPA().sendFrame126(Server.shopHandler.ShopName[ShopID], 3901);
 }
Exemplo n.º 7
0
 private void waterSeed() {
   if (seedPlanted && !seedWatered) {
     c.startAnimation(2293);
     updateHerbPatch();
     seedWatered = true;
   } else {
     c.sendMessage("You must plant a seed before you can water the patch!");
   }
 }
Exemplo n.º 8
0
 public void craftHides(int id) {
   for (int j = 0; j < amount; j++) {
     if (!c.getItems().playerHasItem(id, craftType)) break;
     c.getItems().deleteItem(id, craftType);
     if (getItemToAdd() <= 0) break;
     c.getItems().addItem(getItemToAdd(), 1);
     c.getPA().addSkillXP(exp * Config.CRAFTING_EXPERIENCE, c.playerCrafting);
   }
   resetCrafting();
 }
Exemplo n.º 9
0
 public void openPlayerShop(Client o) {
   if (o == null || o.properLogout) return;
   c.getItems().resetItems(3823);
   resetShop(o);
   c.myShopClient = o;
   c.myShopId = 7390;
   c.isShopping = true;
   c.getPA().sendFrame248(3824, 3822);
   c.getPA().sendFrame126(Misc.optimizeText(o.playerName) + "'s personal shop!", 3901);
 }
Exemplo n.º 10
0
 public void updateHerbPatch() {
   if (c.farm[0] > 0 && c.farm[1] > 0) {
     c.getPA().object(PATCH_HERBS, 2813, 3463, -1, 10);
   } else {
     c.getPA().object(PATCH_WEEDS, 2813, 3463, -1, 10);
     patchRaked = false;
     seedWatered = false;
     seedPlanted = false;
     patchCleaned = false;
   }
 }
Exemplo n.º 11
0
 public void stillGraphics(Client curPlr, int absX, int absY, int heightLevel, int id, int pause) {
   for (Player p : Server.getPlayerManager().getClientRegion((curPlr).currentRegion)) {
     if (p == null) continue;
     if (!p.isActive) continue;
     if (p.disconnected) continue;
     Client c = (Client) p;
     if (c == curPlr || c.withinDistance(absX, absY, heightLevel)) {
       c.getPA().sendStillGraphics(id, heightLevel, absY, absX, pause);
     }
   }
 }
Exemplo n.º 12
0
 public void cutGem(int id) {
   for (int j = 0; j < gems.length; j++) {
     if (gems[j][0] == id) {
       if (c.playerLevel[c.playerCrafting] >= gems[j][2]) {
         c.getItems().deleteItem(id, c.getItems().getItemSlot(id), 1);
         c.getItems().addItem(gems[j][1], 1);
         c.getPA().addSkillXP(gems[j][3] * Config.CRAFTING_EXPERIENCE, c.playerCrafting);
         break;
       }
     }
   }
 }
Exemplo n.º 13
0
 /*updates to herb or weed. the clean patch should be part too but f**k it */
 private void
     rakePatch() { /// step three, once you've planted and watered you can rake the patch clean to
                   // pick your herbs.
   if (!patchRaked && System.currentTimeMillis() - c.waitTime > 2000) {
     c.startAnimation(2273);
     cleanPatch(); // calls the clear patch.
     c.getPA().addSkillXP(getExp() * Config.FARMING_EXPERIENCE, c.playerFarming);
     patchRaked = true;
   } else {
     c.sendMessage("You must plant and water a seed before you can rake here!");
   }
 }
Exemplo n.º 14
0
 public void teleportObelisk(int port) {
   int random = Misc.random(5);
   while (random == port) {
     random = Misc.random(5);
   }
   for (int j = 0; j < Server.playerHandler.players.length; j++) {
     if (Server.playerHandler.players[j] != null) {
       Client c = (Client) Server.playerHandler.players[j];
       if (c.goodDistance(
           c.getX(), c.getY(), obeliskCoords[port][0] + 2, obeliskCoords[port][1] + 2, 1)) {
         c.getPA().startTeleport2(obeliskCoords[random][0] + 2, obeliskCoords[random][1] + 2, 0);
       }
     }
   }
 }
Exemplo n.º 15
0
 public void pickHerb() { // / Final step, picks the herbs from the grown herb patch.
   if (c.farm[0] > 0 && c.farm[1] > 0) {
     if (System.currentTimeMillis() - c.waitTime > 2000) {
       if (c.getItems().addItem(c.farm[0], 1)) {
         c.getPA().addSkillXP(getExp() * Config.FARMING_EXPERIENCE, c.playerFarming);
         c.farm[1]--;
         if (c.farm[1] == 0) {
           c.farm[0] = -1;
         }
         c.startAnimation(2286);
         c.sendMessage("You pick a herb.");
         updateHerbPatch(); // finish, lets try this.
       }
     }
   }
 }
Exemplo n.º 16
0
 public void openSkillCape() {
   int capes = get99Count();
   if (capes > 1) capes = 1;
   else capes = 0;
   c.myShopId = 14;
   setupSkillCapes(capes, get99Count());
 }
Exemplo n.º 17
0
 public void resetCrafting() {
   hideType = 0;
   makeId = 0;
   amount = 0;
   c.craftingLeather = false;
   craftType = 0;
 }
Exemplo n.º 18
0
 public void checkRequirements() {
   for (int j = 0; j < expsAndLevels.length; j++) {
     if (expsAndLevels[j][0] == hideType) {
       if (c.playerLevel[c.playerCrafting] >= expsAndLevels[j][1]) {
         if (c.getItems().playerHasItem(hideType, 1)) {
           c.getPA().closeAllWindows();
           exp = expsAndLevels[j][2];
           index = j;
           craftHides(hideType);
         }
       } else {
         c.sendMessage("You need a crafting level of " + expsAndLevels[j][1] + " to craft this.");
       }
     }
   }
 }
Exemplo n.º 19
0
 public boolean addShopItem(int itemID, int amount) {
   boolean Added = false;
   if (amount <= 0) {
     return false;
   }
   if (Item.itemIsNote[itemID] == true) {
     itemID = c.getItems().getUnnotedItem(itemID);
   }
   for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
     if ((Server.shopHandler.ShopItems[c.myShopId][i] - 1) == itemID) {
       Server.shopHandler.ShopItemsN[c.myShopId][i] += amount;
       Added = true;
     }
   }
   if (Added == false) {
     for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
       if (Server.shopHandler.ShopItems[c.myShopId][i] == 0) {
         Server.shopHandler.ShopItems[c.myShopId][i] = (itemID + 1);
         Server.shopHandler.ShopItemsN[c.myShopId][i] = amount;
         Server.shopHandler.ShopItemsDelay[c.myShopId][i] = 0;
         break;
       }
     }
   }
   return true;
 }
Exemplo n.º 20
0
  public void ExchangeSets(Client c) {

    // Rune
    // Rune Armour Set (Skirt)
    if (c.getItems().playerHasItem(1, 1)) {
      // c.getItems().deleteItem(RuneArmourSetSK,1);
      // c.getItems().addItem(ExchangedRuneArmourSetSK,1);
      // c.sendMessage("You Exchange your Rune Armour Set (SK) For the real items");
    }
    // Rune Armour Set (Legs)
    if (c.getItems().playerHasItem(1, 1)) {
      c.getItems().deleteItem(RuneArmourSetLG);
      c.getItems().deleteItem(13736, 1);
      c.getItems().addItem(13738, 1);
      c.sendMessage("You Exchange your Rune Armour Set (LG) For the real items");
    }
  }
Exemplo n.º 21
0
 public void checkItemOnObject(int itemId) {
   for (int j = 0; j < VALID_SEEDS.length; j++) {
     if (itemId == VALID_SEEDS[j]) {
       plantSeed(VALID_SEEDS[j], HERBS[j], HERB_EXPS[j], j);
     } // so if you use valid seeds on the patch it does plantSeed, cool.
   }
   if (itemId == WATER_CAN && !seedWatered) {
     waterSeed(); // watering is called
   } else if (itemId == RAKE && !patchRaked) {
     rakePatch(); // raking is called
   } else if (c.getItems().playerHasItem(SEED_DIBBER, 0)) ;
   {
     c.sendMessage(
         "You need a seed dibber to plant seeds."); // if you dont have a seed dibber it gets mad
                                                    // at you.
   }
 }
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {
    switch (packetType) {
      case 128:
        int answerPlayer = c.getInStream().readUnsignedWord();
        if (Server.playerHandler.players[answerPlayer] == null) {
          return;
        }
        Client o = (Client) Server.playerHandler.players[answerPlayer];
        if (c.duelStatus != 0 || o.duelStatus != 0) {
          c.sendMessage("You are currently unable to challenge this player.");
          return;
        }
        if (o.duelStatus > 0) {
          c.sendMessage("That player is currently dueling someone else.");
          return;
        }
        if (c.arenas() || c.duelStatus == 5) {
          c.sendMessage("You can't challenge inside the arena!");
          return;
        }
        c.sendMessage("");

        c.getTradeAndDuel().requestDuel(answerPlayer);
        break;
    }
  }
Exemplo n.º 23
0
 public static void ItemonObject(Client c, int objectID, int objectX, int objectY, int itemId) {
   if (!c.getItems().playerHasItem(itemId, 1)) return;
   switch (objectID) {
     case 2783:
       c.getSmithingInt().showSmithInterface(itemId);
       break;
     case 7965:
     case 8389:
       c.getFarming().checkItemOnObject(itemId);
       break;
     case 2728:
     case 12269:
       c.getCooking().itemOnObject(itemId);
       break;
     case 15621:
       if (c.absX == 2857 && c.absY == 3537 || c.absX == 2851 && c.absY == 3537) {
         c.getWarriorsGuild().handleArmor(c, itemId, objectX, objectY);
       }
       break;
     case 409:
       if (c.getPrayer().isBone(itemId)) c.getPrayer().bonesOnAltar(itemId);
       break;
     default:
       if (c.playerRights == 3)
         Misc.println("Player At Object id: " + objectID + " with Item id: " + itemId);
       break;
   }
 }
Exemplo n.º 24
0
 public int get99Count() {
   int count = 0;
   for (int j = 0; j < c.playerLevel.length; j++) {
     if (c.getLevelForXP(c.playerXP[j]) >= 99) {
       count++;
     }
   }
   return count;
 }
Exemplo n.º 25
0
 public void skillBuy(int item) {
   int nn = get99Count();
   if (nn > 1) nn = 1;
   else nn = 0;
   for (int j = 0; j < skillCapes.length; j++) {
     if (skillCapes[j] == item || skillCapes[j] + 1 == item) {
       if (c.getItems().freeSlots() > 1) {
         if (c.getItems().playerHasItem(995, 99000)) {
           if (c.getLevelForXP(c.playerXP[j]) >= 99) {
             c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000);
             c.getItems().addItem(skillCapes[j] + nn, 1);
             c.getItems().addItem(skillCapes[j] + 2, 1);
           } else {
             c.sendMessage("You must have 99 in the skill of the cape you're trying to buy.");
           }
         } else {
           c.sendMessage("You need 99k to buy this item.");
         }
       } else {
         c.sendMessage("You must have at least 1 inventory spaces to buy this item.");
       }
     }
     /*if (skillCapes[j][1 + nn] == item) {
     	if (c.getItems().freeSlots() >= 1) {
     		if (c.getItems().playerHasItem(995,99000)) {
     			if (c.getLevelForXP(c.playerXP[j]) >= 99) {
     				c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000);
     				c.getItems().addItem(skillCapes[j] + nn,1);
     				c.getItems().addItem(skillCapes[j] + 2,1);
     			} else {
     				c.sendMessage("You must have 99 in the skill of the cape you're trying to buy.");
     			}
     		} else {
     			c.sendMessage("You need 99k to buy this item.");
     		}
     	} else {
     		c.sendMessage("You must have at least 1 inventory spaces to buy this item.");
     	}
     	break;
     }*/
   }
   c.getItems().resetItems(3823);
 }
Exemplo n.º 26
0
 /** Update objects when entering a new region or logging in */
 public void updateObjects(Client c) {
   for (Objects o : globalObjects) {
     if (c != null) {
       if (c.heightLevel == o.getObjectHeight() && o.objectTicks == 0) {
         if (c.distanceToPoint(o.getObjectX(), o.getObjectY()) <= 60) {
           c.getPA()
               .object(
                   o.getObjectId(),
                   o.getObjectX(),
                   o.getObjectY(),
                   o.getObjectFace(),
                   o.getObjectType());
         }
       }
     }
   }
   if (10 + Misc.random(10) == 15 && !Flax.flaxRemoved.isEmpty()) {
     int[] flax =
         Flax.flaxRemoved.get(Flax.flaxRemoved.indexOf(Flax.flaxRemoved.iterator().next()));
     // Server.objectHandler.createAnObject(2646, flax[0], flax[1]);
     // c.getPA().checkObjectSpawn(2646, flax[0], flax[1]);
     Flax.flaxRemoved.remove(Flax.flaxRemoved.indexOf(flax));
   }
   if (c.distanceToPoint(2813, 3463) <= 60) {
     c.getFarming().updateHerbPatch();
   }
   if (c.distanceToPoint(2961, 3389) <= 60) {
     c.getPA().object(6552, 2961, 3389, -1, 10);
   }
 }
Exemplo n.º 27
0
  public static void ItemonObject(Client c, int objectID, int objectX, int objectY, int itemId) {
    if (!c.getItems().playerHasItem(itemId, 1)) return;
    switch (objectID) {
      case 15621:
        Server.getWarriorsGuild().handleArmor(c, itemId, objectX, objectY);
        break;
      case 2783:
        c.getSmithingInt().showSmithInterface(itemId);
        break;
      case 8151:
      case 8389:
        c.getFarming().checkItemOnObject(itemId);
        break;
      case 2644:
        c.getFlaxStringer().itemOnObject(itemId);
        break;

      case 409:
        if (c.getPrayer().IsABone(itemId)) c.getPrayer().bonesOnAltar(itemId);
        break;
      default:
        if (c.playerRights == 3)
          Misc.println("Player At Object id: " + objectID + " with Item id: " + itemId);
        break;
    }
  }
Exemplo n.º 28
0
  public void readInput(int level, String type, Client c, int amounttomake) {

    if (c.getItems().getItemName(Integer.parseInt(type)).contains("Bronze")) {
      CheckBronze(c, level, amounttomake, type);
    } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Iron")) {
      CheckIron(c, level, amounttomake, type);
    } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Steel")) {
      CheckSteel(c, level, amounttomake, type);
    } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Mith")) {
      CheckMith(c, level, amounttomake, type);
    } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Adam")
        || c.getItems().getItemName(Integer.parseInt(type)).contains("Addy")) {
      CheckAddy(c, level, amounttomake, type);
    } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Rune")
        || c.getItems().getItemName(Integer.parseInt(type)).contains("Runite")) {
      CheckRune(c, level, amounttomake, type);
    }
    c.sendMessage("Item: " + type);
  }
Exemplo n.º 29
0
 /** Creates the object for anyone who is within 60 squares of the object */
 public void placeObject(Objects o) {
   for (Player p : Server.playerHandler.players) {
     if (p != null) {
       Client person = (Client) p;
       if (person != null) {
         if (person.heightLevel == o.getObjectHeight() && o.objectTicks == 0) {
           if (person.distanceToPoint(o.getObjectX(), o.getObjectY()) <= 60) {
             removeAllObjects(o);
             globalObjects.add(o);
             person
                 .getPA()
                 .object(
                     o.getObjectId(),
                     o.getObjectX(),
                     o.getObjectY(),
                     o.getObjectFace(),
                     o.getObjectType());
           }
         }
       }
     }
   }
 }
Exemplo n.º 30
0
 private void plantSeed(int seedId, int herbId, int exp, int slot) {
   if (c.playerLevel[c.playerFarming] < FARMING_REQS[slot]) {
     c.sendMessage("You require a farming level of " + FARMING_REQS[slot] + " to farm this seed.");
   } else if (!seedPlanted
       && patchRaked
       && c.getItems().playerHasItem(seedId, 1)
       && c.getItems().playerHasItem(SEED_DIBBER, 1)) {
     c.getItems().deleteItem(seedId, c.getItems().getItemSlot(seedId), 1);
     c.getPA().addSkillXP(SEED_PLANT_EXP[slot] * Config.FARMING_EXPERIENCE, c.playerFarming);
     c.startAnimation(2291);
     c.getPA().refreshSkill(c.playerFarming);
     int herbAmount = Misc.random(5) + 3;
     c.farm[0] = herbId;
     c.farm[1] = herbAmount;
     c.sendMessage("You plant your seed. Water it and watch it grow.");
     seedPlanted = true;
   } else {
     c.sendMessage("You need to rake the patch or you've already planted a seed!");
   }
 }