@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;
    }
  }
示例#2
0
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {

    if (packetType == PART1) {
      c.getOutStream().createFrame(27);
      XremoveSlot = c.getInStream().readSignedWordBigEndian();
      XinterfaceID = c.getInStream().readUnsignedWordA();
      XremoveID = c.getInStream().readSignedWordBigEndian();
    }

    if (packetType == PART2) {
      Xamount = c.getInStream().readDWord();
      switch (XinterfaceID) {
        case 5064:
          c.getItems().bankItem(c.playerItems[XremoveSlot], XremoveSlot, Xamount);
          break;

        case 5382:
          c.getItems().fromBank(c.playerItems[XremoveSlot], XremoveSlot, Xamount);
          break;

        case 3322:
          if (c.duelStatus <= 0) {
            c.getTradeAndDuel().tradeItem(XremoveID, XremoveSlot, Xamount);
          } else {
            c.getTradeAndDuel().stakeItem(XremoveID, XremoveSlot, Xamount);
          }
          break;

        case 3415:
          if (c.duelStatus <= 0) {
            c.getTradeAndDuel().fromTrade(XremoveID, XremoveSlot, Xamount);
          }
          break;

        case 6669:
          c.getTradeAndDuel().fromDuel(XremoveID, XremoveSlot, Xamount);
          break;
      }
    }
  }
示例#3
0
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {
    int itemId = c.getInStream().readUnsignedWordA();
    c.getInStream().readUnsignedByte();
    c.getInStream().readUnsignedByte();
    int slot = c.getInStream().readUnsignedWordA();
    if (c.arenas()) {
      c.sendMessage("You can't drop items inside the arena!");
      return;
    }
    if (c.playerItemsN[slot] != 0 && itemId != -1 && c.playerItems[slot] == itemId + 1) {
      if (!c.getItems().playerHasItem(itemId, 1, slot)) {
        c.sendMessage("Stop cheating!");
        return;
      }
    }

    boolean droppable = true;
    for (int i : Config.UNDROPPABLE_ITEMS) {
      if (i == itemId) {
        droppable = true;
        break;
      }
    }
    if (c.playerItemsN[slot] != 0 && itemId != -1 && c.playerItems[slot] == itemId + 1) {
      if (droppable) {
        if (c.underAttackBy > 0) {
          if (c.getShops().getItemShopValue(itemId) > 1000) {
            c.sendMessage("You may not drop items worth more than 1000 while in combat.");
            return;
          }
        }
        Server.itemHandler.createGroundItem(
            c, itemId, c.getX(), c.getY(), c.playerItemsN[slot], c.getId());
        c.getItems().deleteItem(itemId, slot, c.playerItemsN[slot]);
      } else {
        c.sendMessage("This items cannot be dropped.");
      }
    }
  }
示例#4
0
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {
    int junk = c.getInStream().readSignedWordBigEndianA();
    int itemSlot = c.getInStream().readUnsignedWordA();
    int itemId = c.getInStream().readUnsignedWordBigEndian();
    if (itemId != c.playerItems[itemSlot] - 1) {
      return;
    }
    switch (itemId) {
      case 2827: // Draynor River Bank
        c.clueScrollMap(7113, "1");
        break;
      case 2829: // Behind the Wizard's Tower
        c.clueScrollMap(9275, "1");
        break;
      case 3518: // North of Falador, right near the statue
        c.clueScrollMap(17537, "1");
        break;
      case 3520: // Varrock East Mine
        c.clueScrollMap(7045, "1");
        break;
      case 3522: // Search the Crate at the Goblin's Houses near Castle Wars
        c.clueScrollMap(9454, "1");
        break;
      case 3524: // Building in West Rimmington
        c.clueScrollMap(9839, "1");
        break;
      case 3525: // Edge of the Ranged Guild
        c.clueScrollMap(7162, "2");
        break;
      case 3598: // Falador Rock Garden
        c.clueScrollMap(7271, "2");
        break;
      case 3599: // Outside of the Monks House near McDoogle Woods
        c.clueScrollMap(9108, "2");
        break;
      case 3601: // Search the Crate in the Black Knight's Fortress
        c.clueScrollMap(9507, "2");
        break;
      case 3602: // Chaos Altar West of the Khazard Battlefield (south west of Ardougne), dig right
        // behind the altar
        c.clueScrollMap(17888, "2");
        break;
      case 7236: // Miscellania, just to the East of the entrance to the Castle grounds.
        c.clueScrollMap(17687, "2");
        break;
      case 7239: // Behind the House in Yanille Map
        c.clueScrollMap(9043, "3");
        break;
      case 7241: // Level 50 wilderness, directly to the West of the larger volcano, to the
        // Southeast of the Agility Course
        c.clueScrollMap(17620, "3");
        break;
      case 7286: // Just to the South of the Legends Guild entrance, to the Northeast of Ardougne
        c.clueScrollMap(17634, "3");
        break;
      case 7288: // Crate, Clocktower, South of the Ardougne Castle
        c.clueScrollMap(9720, "3");
        break;
      case 7290: // Hobgoblin Point (Crafting Guild)
        c.clueScrollMap(4305, "3");
        break;
      case 7292: // In a Building in West Ardougne
        c.clueScrollMap(9359, "3");
        break;
        /* Text Clue Scrolls */
      case 2678: // Talk to the Mage of Zamorak
        c.clueScroll(
            "Dressed in red,",
            "evil to the core,",
            "chaos is my path,",
            "peace be for none,",
            "ALL HAIL ZAMORAK!",
            "",
            "",
            "",
            "1");
        break;
      case 2831: // Talk to Romeo in Varrock Centre.
        c.clueScroll(
            "In an empty town,",
            "all alone I stand",
            "day after day, wishing",
            "that someone would just",
            "say 'hey', my love is",
            "asleep and I do nothing,",
            "destined for solitude I am...",
            "",
            "1");
        break;
      case 2833: // Talk to Emily in the Falador Bar.
        c.clueScroll(
            "You can have a cold one on me ",
            "and maybe more if you",
            "play your cards right.",
            "",
            "",
            "",
            "",
            "",
            "1");
        break;
      case 2835: // Talk to Tracker Gnome 1 outside of Falador Gates.
        c.clueScroll(
            "Gathering information on the",
            "giant breed known as 'humans' is",
            "tough work, thankfully the",
            "f-guards here can't see me!",
            "",
            "",
            "",
            "",
            "1");
        break;
      case 2837: // Talk to the Tracker Gnome 2 in Varrock Castle Courtyard.
        c.clueScroll(
            "Gathering information on the",
            "giant breed known as 'humans' is",
            "tough work, thankfully the",
            "v-guards here don't suspect me!",
            "",
            "",
            "",
            "",
            "1");
        break;
      case 2839: // Talk to the Tracker Gnome 3 in Ardougne Centre.
        c.clueScroll(
            "Gathering information on the",
            "giant breed known as 'humans' is",
            "tough work, thankfully the",
            "a-guards here don't suspect me!",
            "",
            "",
            "",
            "",
            "1");
        break;
      case 2841:
        c.clueScroll("", "", "", "", "", "", "", "", "2");
        break;
      case 2843:
        c.clueScroll("", "", "", "", "", "", "", "", "2");
        break;
      case 2845:
        c.clueScroll("", "", "", "", "", "", "", "", "2");
        break;
      case 2847:
        c.clueScroll("", "", "", "", "", "", "", "", "2");
        break;
      case 2848:
        c.clueScroll("", "", "", "", "", "", "", "", "2");
        break;
      case 2849:
        c.clueScroll("", "", "", "", "", "", "", "", "2");
        break;
      case 2851:
        c.clueScroll("", "", "", "", "", "", "", "", "3");
        break;
      case 2853:
        c.clueScroll("", "", "", "", "", "", "", "", "3");
        break;
      case 2855:
        c.clueScroll("", "", "", "", "", "", "", "", "3");
        break;
      case 2856:
        c.clueScroll("", "", "", "", "", "", "", "", "3");
        break;
      case 2857:
        c.clueScroll("", "", "", "", "", "", "", "", "3");
        break;
      case 2858:
        c.clueScroll("", "", "", "", "", "", "", "", "3");
        break;
        /* Reward Chests */
      case 2826: // Tier 1 Chest
        c.completeLevel1();
        c.getItems().deleteItem(2826, c.getItems().getItemSlot(2826), 1);
        break;
      case 2828: // Tier 2 Chest
        c.completeLevel2();
        c.getItems().deleteItem(2828, c.getItems().getItemSlot(2828), 1);
        break;
      case 2830: // Tier 3 Chest
        c.completeLevel3();
        c.getItems().deleteItem(2830, c.getItems().getItemSlot(2830), 1);
        break;
    }
    if (itemId == 8007) {
      c.getItems().deleteItem(8007, c.getItems().getItemSlot(8007), 1);
      c.getPA().teleTabTeleport(3213, 3423, 0, "teleTab");
    }
    if (itemId == 8008) {
      c.getItems().deleteItem(8008, c.getItems().getItemSlot(8008), 1);
      c.getPA().teleTabTeleport(3224, 3218, 0, "teleTab");
    }
    if (itemId == 8009) {
      c.getItems().deleteItem(8009, c.getItems().getItemSlot(8009), 1);
      c.getPA().teleTabTeleport(2965, 3383, 0, "teleTab");
    }
    if (itemId == 8010) {
      c.getItems().deleteItem(8010, c.getItems().getItemSlot(8010), 1);
      c.getPA().teleTabTeleport(2757, 3477, 0, "teleTab");
    }
    if (itemId == 8011) {
      c.getItems().deleteItem(8011, c.getItems().getItemSlot(8011), 1);
      c.getPA().teleTabTeleport(2653, 3283, 0, "teleTab");
    }
    if (itemId == 8012) {
      c.getItems().deleteItem(8012, c.getItems().getItemSlot(8012), 1);
      c.getPA().teleTabTeleport(2546, 3112, 0, "teleTab");
    }
    if (itemId == 8013) {
      c.getItems().deleteItem(8013, c.getItems().getItemSlot(8013), 1);
      c.getPA().teleTabTeleport(3086, 3499, 0, "teleTab");
    }
    if (itemId == 4447) {
      for (int i = 0; i < 5; i++) {
        c.playerLevel[0] = 99;
        c.playerLevel[1] = 99;
        c.playerLevel[2] = 99;
        c.playerLevel[3] = 99;
        c.playerLevel[4] = 99;
        c.playerLevel[6] = 99;
        c.playerXP[i] = c.getPA().getXPForLevel(100);
        c.playerXP[6] = c.getPA().getXPForLevel(100);
        c.getPA().refreshSkill(i);
        c.getPA().refreshSkill(6);
        c.getItems().deleteItem(4447, 1);
        c.logout();
      }
      c.getPA().requestUpdates();
    }

    if (itemId == 6796) {
      c.playerLevel[0] = 99;
      c.playerLevel[2] = 99;
      c.playerLevel[3] = 99;
      c.playerLevel[4] = 99;
      c.playerLevel[6] = 99;
      c.playerXP[0] = c.getPA().getXPForLevel(100);
      c.playerXP[2] = c.getPA().getXPForLevel(100);
      c.playerXP[3] = c.getPA().getXPForLevel(100);
      c.playerXP[4] = c.getPA().getXPForLevel(100);
      c.playerXP[6] = c.getPA().getXPForLevel(100);
      c.getPA().refreshSkill(0);
      c.getPA().refreshSkill(2);
      c.getPA().refreshSkill(3);
      c.getPA().refreshSkill(4);
      c.getPA().refreshSkill(6);
      c.getItems().deleteItem(6796, 1);
      c.logout();
    }

    if (itemId == 15272) {
      if (System.currentTimeMillis() - c.foodDelay >= 1500 && c.playerLevel[3] > 0) {
        c.getCombat().resetPlayerAttack();
        c.attackTimer += 2;
        c.startAnimation(829);
        c.getItems().deleteItem(15272, 1);
        if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3])) {
          c.playerLevel[3] += 23;
          if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
            c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
        }
        c.foodDelay = System.currentTimeMillis();
        c.getPA().refreshSkill(3);
        c.sendMessage("You eat the Rocktail.");
      }
      c.playerLevel[3] += 10;
      if (c.playerLevel[3] > (c.getLevelForXP(c.playerXP[3]) * 1.11 + 1)) {
        c.playerLevel[3] = (int) (c.getLevelForXP(c.playerXP[3]) * 1.11);
      }
      c.getPA().refreshSkill(3);
      return;
    }
    if (itemId == 2528) {
      c.getItems().deleteItem(2528, 1);
      c.getPA().showInterface(2808);
    }
    // Begin artifacts by Hirukos
    if (itemId >= 14876 && itemId <= 14892) {
      int a = itemId;
      String YEYAF = "<col=1532693>You Exchanged Your Artifact For</col> ";
      if (a == 14876) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 10000000);
        c.sendMessage(YEYAF + "<col=1532693>10 million Coins!</col>");
      }
      if (a == 14877) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 2000000);
        c.sendMessage(YEYAF + "<col=1532693>2 million Coins!</col>");
      }
      if (a == 14878) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 1500000);
        c.sendMessage(YEYAF + "<col=1532693>1.5 million Coins!</col>");
      }
      if (a == 14879) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 1000000);
        c.sendMessage(YEYAF + "<col=1532693>1 million Coins!</col>");
      }
      if (a == 14880) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 800000);
        c.sendMessage(YEYAF + "<col=1532693>800,000 Coins!</col>");
      }
      if (a == 14881) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 600000);
        c.sendMessage(YEYAF + "<col=1532693>600,000 Coins!</col>");
      }
      if (a == 14882) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 540000);
        c.sendMessage(YEYAF + "<col=1532693>540,000 Coins!</col>");
      }
      if (a == 14883) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 400000);
        c.sendMessage(YEYAF + "<col=1532693>400,000 Coins!</col>");
      }
      if (a == 14884) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 300000);
        c.sendMessage(YEYAF + "<col=1532693>300,000 Coins!</col>");
      }
      if (a == 14885) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 200000);
        c.sendMessage(YEYAF + "<col=1532693>200,000 Coins!</col>");
      }
      if (a == 14886) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 150000);
        c.sendMessage(YEYAF + "<col=1532693>150,000 Coins!</col>");
      }
      if (a == 14887) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 100000);
        c.sendMessage(YEYAF + "<col=1532693>100,000 Coins!</col>");
      }
      if (a == 14888) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 80000);
        c.sendMessage(YEYAF + "<col=1532693>80,000 Coins!</col>");
      }
      if (a == 14889) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 60000);
        c.sendMessage(YEYAF + "<col=1532693>60,000 Coins!</col>");
      }
      if (a == 14890) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 40000);
        c.sendMessage(YEYAF + "<col=1532693>40,000 Coins!</col>");
      }
      if (a == 14891) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 20000);
        c.sendMessage(YEYAF + "<col=1532693>20,000 Coins!</col>");
      }
      if (a == 14892) {
        c.getItems().deleteItem(a, 1);
        c.getItems().addItem(995, 10000);
        c.sendMessage(YEYAF + "<col=1532693>10,000 Coins!</col>");
      }
    }
    // End of artifacts By Hirukos

    if (itemId == 5509) {
      c.getPA().addSmallPouch();
    }
    if (itemId == 5510) {
      c.getPA().addMediumPouch();
    }
    if (itemId == 5511) {
      c.getPA().addMediumPouch();
    }
    if (itemId == 5512) {
      c.getPA().addLargePouch();
    }
    if (itemId == 5513) {
      c.getPA().addLargePouch();
    }
    if (itemId == 5514) {
      c.getPA().addGiantPouch();
    }
    if (itemId == 5515) {
      c.getPA().addGiantPouch();
    }
    if (c.getHerblore().isUnidHerb(itemId)) c.getHerblore().handleHerbClick(itemId);
    if (c.getFood().isFood(itemId)) c.getFood().eat(itemId, itemSlot);
    // ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot);
    if (c.getPotions().isPotion(itemId)) c.getPotions().handlePotion(itemId, itemSlot);
    if (Prayer.playerBones(c, itemId)) {
      Prayer.buryBones(c, itemId, itemSlot);
    }
    if (itemId == 952) {
      if (c.inArea(3553, 3301, 3561, 3294)) {
        c.teleTimer = 3;
        c.newLocation = 1;
      } else if (c.inArea(3550, 3287, 3557, 3278)) {
        c.teleTimer = 3;
        c.newLocation = 2;
      } else if (c.inArea(3561, 3292, 3568, 3285)) {
        c.teleTimer = 3;
        c.newLocation = 3;
      } else if (c.inArea(3570, 3302, 3579, 3293)) {
        c.teleTimer = 3;
        c.newLocation = 4;
      } else if (c.inArea(3571, 3285, 3582, 3278)) {
        c.teleTimer = 3;
        c.newLocation = 5;
      } else if (c.inArea(3562, 3279, 3569, 3273)) {
        c.teleTimer = 3;
        c.newLocation = 6;
      } else if (c.inArea(2986, 3370, 3013, 3388)) {
        c.teleTimer = 3;
        c.newLocation = 7;
      }
    }
  }
示例#5
0
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {
    if (packetType == 248 || packetType == 164) {
      c.faceUpdate(0);
      if (c.SSPLIT == false) {
        c.npcIndex = 0;
        c.playerIndex = 0;
      } else {
      }
      if (c.followId > 0 || c.followId2 > 0) c.getPA().resetFollow();
    }
    c.fishing = false;
    if (!c.isBanking && !c.inTrade) {
      c.getPA().removeAllWindows();
    }
    if (c.duelRule[1] && c.duelStatus == 5) {
      if (Server.playerHandler.players[c.duelingWith] != null) {
        if (!c.goodDistance(
                c.getX(),
                c.getY(),
                Server.playerHandler.players[c.duelingWith].getX(),
                Server.playerHandler.players[c.duelingWith].getY(),
                1)
            || c.attackTimer == 0) {
          c.sendMessage("Walking has been disabled in this duel!");
        }
      }
      c.playerIndex = 0;
      return;
    }

    if (c.freezeTimer > 0) {
      if (Server.playerHandler.players[c.playerIndex] != null) {
        if (c.goodDistance(
                c.getX(),
                c.getY(),
                Server.playerHandler.players[c.playerIndex].getX(),
                Server.playerHandler.players[c.playerIndex].getY(),
                1)
            && packetType != 98) {
          c.playerIndex = 0;
          return;
        }
      }
      if (packetType != 98) {
        c.sendMessage("A magical force stops you from moving.");
        c.playerIndex = 0;
      }
      return;
    }

    if (System.currentTimeMillis() - c.lastSpear < 4000) {
      c.sendMessage("You have been stunned.");
      c.playerIndex = 0;
      return;
    }

    if (packetType == 98) {
      c.mageAllowed = true;
      c.fishing = false;
    }

    if (c.sit == true) {
      c.sendMessage("::unsit before you can start walking again!");
      return;
    }

    if ((c.duelStatus >= 1 && c.duelStatus <= 4) || c.duelStatus == 6) {
      if (c.duelStatus == 6) {
        c.getTradeAndDuel().claimStakedItems();
      }
      return;
    }

    if (c.respawnTimer > 3) {
      return;
    }
    if (System.currentTimeMillis() - c.lastEmote <= 7000) {
      return;
    }
    if (c.inTrade) {
      c.sendMessage("Please use the Decline option.");
      return;
    }
    if (c.isBanking) {
      c.getPA().closeAllWindows();
    }
    if (c.isShopping == true) {
      c.isShopping = false;
    }
    if (packetType == 248) {
      packetSize -= 14;
    }
    c.newWalkCmdSteps = (packetSize - 5) / 2;
    if (++c.newWalkCmdSteps > c.walkingQueueSize) {
      c.newWalkCmdSteps = 0;
      return;
    }

    c.getNewWalkCmdX()[0] = c.getNewWalkCmdY()[0] = 0;

    int firstStepX = c.getInStream().readSignedWordBigEndianA() - c.getMapRegionX() * 8;
    for (int i = 1; i < c.newWalkCmdSteps; i++) {
      c.getNewWalkCmdX()[i] = c.getInStream().readSignedByte();
      c.getNewWalkCmdY()[i] = c.getInStream().readSignedByte();
    }

    int firstStepY = c.getInStream().readSignedWordBigEndian() - c.getMapRegionY() * 8;
    c.setNewWalkCmdIsRunning(c.getInStream().readSignedByteC() == 1);
    for (int i1 = 0; i1 < c.newWalkCmdSteps; i1++) {
      c.getNewWalkCmdX()[i1] += firstStepX;
      c.getNewWalkCmdY()[i1] += firstStepY;
    }
  }
示例#6
0
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {
    c.getInStream().readSignedWordBigEndianA();
    int itemSlot = c.getInStream().readUnsignedWordA();
    int itemId = c.getInStream().readUnsignedWordBigEndian();
    if (!c.getItems().playerHasItem(itemId, 1)) { // , itemSlot
      return;
    }
    if (itemId != c.playerItems[itemSlot] - 1) {
      return;
    }
    if (itemId >= 5509 && itemId <= 5514) {
      Pouches.fillEssencePouch(c, itemId);
      return;
    }
    //		if (itemId == 11941) {
    //			c.getBag().showContents(c);
    //			c.showLootingBagContents();
    //		}
    TabData tabData = TabData.forId(itemId);
    if (tabData != null) c.getTablet().useTeleTab(c, itemSlot, tabData);
    if (itemId == 3144) {
      if (c.duelRule[6]) {
        c.sendMessage("You may not eat in this duel.");
        return;
      }
      if ((System.currentTimeMillis() - c.karamDelay >= 2000) && c.playerLevel[3] > 0) {
        c.getCombat().resetPlayerAttack();
        c.attackTimer += 2;
        c.startAnimation(829);
        c.getItems().deleteItem(itemId, itemSlot, 1);
        if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3])) {
          c.playerLevel[3] += 18;
          if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
            c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
        }
        c.karamDelay = System.currentTimeMillis();
        c.getPA().refreshSkill(3);
        c.sendMessage("You eat the karambwan.");
        return;
      }
    }
    if (itemId == 11740) {
      if (c.getItems().freeSlots() > 0 && c.getItems().playerHasItem(11740, 1)) {
        c.getItems().deleteItem(11740, 1);
        c.getItems().addItem(11230, 500);
        c.sendMessage("You have received 500 Dragon Darts.");
      } else if (c.getItems().freeSlots() == 0 && c.getItems().playerHasItem(11740, 1)) {
        c.getItems().deleteItem(11740, 1);
        c.getItems().addItemToBank(11230, 500);
        c.sendMessage("You have received 500 Dragon Darts.");
      }
    }
    if (itemId == 3801) {
      c.startAnimation(1330);
      c.forcedChat("Arghh! Matey... That's some tasty Rum!");
      c.getPA().requestUpdates();
    }
    if (itemId == 761) {
      if (c.time <= 0) {
        c.getItems().deleteItem(itemId, 1);
        c.doubleEXPTicket(1800);
      } else {
        c.sendMessage("You currently already have double experience.");
      }
    }
    if (itemId == 455) {
      c.bossPasses += 5;
      c.getItems().deleteItem(itemId, 1);
      c.sendMessage(
          "You now have "
              + c.bossPasses
              + " free boss passes! You can use this for Zulrah and other upcoming bosses!");
    }
    /*
     * if (itemId == 952) { c.getBarrows().spadeDigging();
     * c.sendMessage("This is in progress.."); return; }
     */
    // Dice bag
    if (itemId == 5073) {
      c.getItems().addItem(5075, 1);
      c.getItems().handleNests(itemId);
    }
    if (itemId == 7509 && c.playerLevel[c.playerHitpoints] >= 1) {
      c.startAnimation(829);
      c.dealDamage(1);
      c.handleHitMask(1);
      c.forcedChat("Ow! I nearly broke a tooth!");
      c.getPA().refreshSkill(3);
    }
    if (itemId == 1917) {
      c.startAnimation(2770);
      c.sendMessage("You drink the beer.");
      c.playerStandIndex = 2770;
      c.playerTurnIndex = 2769;
      c.playerWalkIndex = 2769;
      c.playerTurn180Index = 2769;
      c.playerTurn90CWIndex = 2769;
      c.playerTurn90CCWIndex = 2769;
      c.playerRunIndex = 2769;
      c.updateRequired = true;
      c.getPA().walkableInterface(14600);
      c.getItems().deleteItem(1917, 1);
    }
    /* Mystery box */
    MysteryBox.handleBox(c, itemId);
    /** Hard Clue Scroll * */
    if (itemId == 2714) { // Easy Clue Scroll Casket
      c.getItems().deleteItem(itemId, 1);
      c.getPA().addClueReward(c, 0);
    }
    if (itemId == 2802) { // Medium Clue Scroll Casket
      c.getItems().deleteItem(itemId, 1);
      c.getPA().addClueReward(c, 1);
    }
    if (itemId == 2775 || itemId == 2789) { // Hard Clue Scroll Casket
      c.getItems().deleteItem(itemId, 1);
      c.getPA().addClueReward(c, 2);
    }
    if (itemId == 2713) {
      c.getPA().showInterface(17537);
    }
    if (itemId == 2712) {
      c.getPA().showInterface(9043);
    }
    if (itemId == 2711) {
      c.getPA().showInterface(7271);
    }
    if (itemId == 2710) {
      c.getPA().showInterface(7045);
    }
    if (itemId == 2709) {
      c.getPA().showInterface(9275);
    }
    if (itemId == 2708) {
      c.getPA().showInterface(7113);
    }
    if (itemId == 2707) {
      c.getPA().showInterface(17634);
    }
    if (itemId == 2706) {
      c.getPA().showInterface(17620);
    }
    if (itemId == 2705) {
      c.getPA().showInterface(4305);
    }
    if (itemId == 2704) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("In a lair of a Boss lies", 6971);
      c.getPA().sendNewString("the next clue scroll!", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2703) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("I seek another cluse just", 6971);
      c.getPA().sendNewString("west of the fountain, at the origin!", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2702) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("We are here lying to protect", 6971);
      c.getPA().sendNewString("the castle that we truely love!", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2701) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("This has to be bob's favorite", 6971);
      c.getPA().sendNewString("training spot in-game.", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2700) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("We all love water, especially", 6971);
      c.getPA().sendNewString("from big, clean, fountains!", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2699) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("near the wilderness", 6971);
      c.getPA().sendNewString("where the road begins to end.", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2698) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("We stall seek history within", 6971);
      c.getPA().sendNewString("the ancient museum.", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2697) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("We party with pete", 6971);
      c.getPA().sendNewString("within a city named ....", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2696) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("The Mage Of Change!", 6971);
      c.getPA().sendNewString("Go Find him at varrock!", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2695) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("These fish must be hot!", 6971);
      c.getPA().sendNewString("We shall call this, Lava Fishing", 6972);
      c.getPA().showInterface(6965);
    }
    // if(itemId == 2694) {
    // c.sendMessage("My loved one..Once murdered in front of my eyes..I couldn't save her..");
    // }
    if (itemId == 2693) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("This village contains torches,", 6971);
      c.getPA().sendNewString("rocks, and some kind of stronghold.", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2692) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("We shall thieve Master Farmers!", 6971);
      c.getPA().sendNewString("I wonder where I can find them...", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2691) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("arggggghhh mate,", 6971);
      c.getPA().sendNewString("Would you like some beer?", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2690) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("Can'd fish!", 6971);
      c.getPA().sendNewString("Lies the next clue or casket matey!!", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2689) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("Ew, a scorpian.", 6971);
      c.getPA().sendNewString("Why are these mines so messed up!", 6972);
      c.getPA().showInterface(6965);
    }
    if (itemId == 2688) {
      for (int i = 6968; i < 6976; i++) {
        c.getPA().sendNewString("", i);
      }
      c.getPA().sendNewString("You Can Duel.", 6971);
      c.getPA().sendNewString("But You seek Truesure at the bank?", 6972);
      c.getPA().showInterface(6965);
    }
    /** Hard Clue Scroll * */
    if (c.safeAreas(2969, 3411, 2974, 3415) & (c.getItems().playerHasItem(2713, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2713, c.getItems().getItemSlot(2713), 1);
      c.getItems().addItem(2712, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(2613, 3075, 2619, 3080) & (c.getItems().playerHasItem(2712, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2712, c.getItems().getItemSlot(2712), 1);
      c.getItems().addItem(2711, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3030, 3394, 3049, 3401) & (c.getItems().playerHasItem(2711, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2711, c.getItems().getItemSlot(2711), 1);
      c.getItems().addItem(2775, 1);
      c.sendMessage("You recieve a HARD Casket!");
    } else if (c.safeAreas(3285, 3371, 3291, 3375) & (c.getItems().playerHasItem(2710, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2710, c.getItems().getItemSlot(2710), 1);
      c.getItems().addItem(2709, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3106, 3148, 3113, 3154) & (c.getItems().playerHasItem(2709, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2709, c.getItems().getItemSlot(2709), 1);
      c.getItems().addItem(2775, 1);
      c.sendMessage("You recieve a HARD Casket!");
    } else if (c.safeAreas(3092, 3213, 3104, 3225) & (c.getItems().playerHasItem(2708, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2708, c.getItems().getItemSlot(2708), 1);
      c.getItems().addItem(2775, 1);
      c.sendMessage("You recieve a HARD Casket!");
    } else if (c.safeAreas(2721, 3337, 2724, 3342) & (c.getItems().playerHasItem(2707, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2707, c.getItems().getItemSlot(2707), 1);
      c.getItems().addItem(2706, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3016, 3907, 3026, 3915) & (c.getItems().playerHasItem(2706, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2706, c.getItems().getItemSlot(2706), 1);
      c.getItems().addItem(2705, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(2903, 3287, 2909, 3300) & (c.getItems().playerHasItem(2705, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2705, c.getItems().getItemSlot(2705), 1);
      c.getItems().addItem(2775, 1);
      c.sendMessage("You recieve a HARD Casket!");
      /** Easy Clue Scrolls * */
    } else if (c.safeAreas(2259, 4680, 2287, 4711) & (c.getItems().playerHasItem(2704, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2704, c.getItems().getItemSlot(2704), 1);
      c.getItems().addItem(2703, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3217, 3207, 3225, 3213) & (c.getItems().playerHasItem(2703, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2703, c.getItems().getItemSlot(2703), 1);
      c.getItems().addItem(2702, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(2962, 3331, 2987, 3351) & (c.getItems().playerHasItem(2702, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2702, c.getItems().getItemSlot(2702), 1);
      c.getItems().addItem(2714, 1);
      c.sendMessage("You recieve a EASY Casket!");
    } else if (c.safeAreas(3253, 3256, 3265, 3296) & (c.getItems().playerHasItem(2701, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2701, c.getItems().getItemSlot(2701), 1);
      c.getItems().addItem(2700, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3208, 3421, 3220, 3435) & (c.getItems().playerHasItem(2700, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2700, c.getItems().getItemSlot(2700), 1);
      c.getItems().addItem(2699, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3084, 3486, 3086, 3488) & (c.getItems().playerHasItem(2699, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2699, c.getItems().getItemSlot(2699), 1);
      c.getItems().addItem(2698, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3253, 3445, 3261, 3453) & (c.getItems().playerHasItem(2698, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2698, c.getItems().getItemSlot(2698), 1);
      c.getItems().addItem(2714, 1);
      c.sendMessage("You recieve a EASY Casket!");
      /** Medium Clue Scrolls * */
    } else if (c.safeAreas(2953, 3365, 2977, 3392) & (c.getItems().playerHasItem(2697, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2697, c.getItems().getItemSlot(2697), 1);
      c.getItems().addItem(2696, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3202, 3424, 3259, 9873) & (c.getItems().playerHasItem(2696, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2696, c.getItems().getItemSlot(2696), 1);
      c.getItems().addItem(2695, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(2875, 9763, 2904, 9776) & (c.getItems().playerHasItem(2695, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2695, c.getItems().getItemSlot(2695), 1);
      c.getItems().addItem(2802, 1);
      c.sendMessage("You recieve a MEDIUM Casket!");
    } else if (c.safeAreas(3074, 3407, 3085, 3436) & (c.getItems().playerHasItem(2693, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2693, c.getItems().getItemSlot(2693), 1);
      c.getItems().addItem(2692, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3074, 3245, 3085, 3255) & (c.getItems().playerHasItem(2692, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2692, c.getItems().getItemSlot(2692), 1);
      c.getItems().addItem(2691, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3044, 3255, 3055, 3259) & (c.getItems().playerHasItem(2691, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2691, c.getItems().getItemSlot(2691), 1);
      c.getItems().addItem(2802, 1);
      c.sendMessage("You recieve a MEDIUM Casket!");
    } else if (c.safeAreas(3506, 3496, 3508, 3497) & (c.getItems().playerHasItem(2690, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2690, c.getItems().getItemSlot(2690), 1);
      c.getItems().addItem(2689, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3032, 9756, 3056, 9804) & (c.getItems().playerHasItem(2689, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2689, c.getItems().getItemSlot(2689), 1);
      c.getItems().addItem(2688, 1);
      c.sendMessage("You recieve another scroll.");
    } else if (c.safeAreas(3381, 3268, 3382, 3269) & (c.getItems().playerHasItem(2688, 1))) {
      c.getPA().removeAllWindows();
      c.getItems().deleteItem(2688, c.getItems().getItemSlot(2688), 1);
      c.getItems().addItem(2802, 1);
      c.sendMessage("You recieve a MEDIUM Casket!");
    }
    if (itemId == 405) {
      if (c.getItems().playerHasItem(405, 1)) {
        c.getItems().deleteItem(405, 1);
        c.getItems().addItem(995, 2500000);
      }
    }
    if (itemId == 13192) {
      if (c.getItems().playerHasItem(13192, 1)) {
        c.getItems().deleteItem(13192, 1);
        c.donPoints += 1000;
        c.playerRights = 4;
        c.logout();
      }
    }
    if (itemId == 13190) {
      if (c.getItems().playerHasItem(13190, 1)) {
        c.getItems().deleteItem(13190, 1);
        c.getItems().addItemToBank(761, 1);
        c.donPoints += 2000;
        c.playerRights = 5;
        c.logout();
      }
    }
    if (itemId == 13187) {
      if (c.getItems().playerHasItem(13187, 1)) {
        c.getItems().deleteItem(13187, 1);
        c.getItems().addItemToBank(12892, 1);
        c.getItems().addItemToBank(761, 2);
        c.donPoints += 5000;
        c.playerRights = 6;
      }
    }

    if (itemId == 6950) {
      if (c.playerMagicBook == 0) {
        if (c.playerLevel[6] >= 94) {
          if (System.currentTimeMillis() - c.lastVeng > 30000) {
            c.vengOn = true;
            c.lastVeng = System.currentTimeMillis();
            c.startAnimation(4410);
            c.gfx100(726);
          } else {
            c.sendMessage("You have to wait 30 seconds before you can use this spell again.");
          }
        } else {
          c.sendMessage("Your magic level has to be over 94 to use this spell.");
        }
      } else {
        c.sendMessage("You must be on the regular spellbook to use this spell.");
      }
    }

    if (itemId == 5073) {
      // c.getItems().addItem(5075, 1);
      // c.getItems().deleteItem(5073, 1);
      // c.getItems().handleNests(itemId);
    }
    if (itemId >= 5509 && itemId <= 5514) {
      int pouch = -1;
      int a = itemId;
      if (a == 5509) pouch = 0;
      if (a == 5510) pouch = 1;
      if (a == 5512) pouch = 2;
      if (a == 5514) pouch = 3;
      c.getPA().fillPouch(pouch);
      return;
    }
    if (itemId == 15084) {
      if (System.currentTimeMillis() - c.diceDelay >= 5000 && c.playerRights == 3
          || c.playerRights == 8) {
        /*c.clan.sendDiceChat(c, " has rolled a " + Misc.random(100)
        		+ " on the percentile dice.");
        c.startAnimation(827);
        c.diceDelay = System.currentTimeMillis();*/
        c.sendMessage("This feature is currently disabled");
      }
    }
    if (Cleaning.handleCleaning(c, itemId, itemSlot)) return;
    /*
     * if (c.getHerblore().isUnidHerb(itemId))
     * c.getHerblore().handleHerbClick(itemId);
     */
    if (c.getFood().isFood(itemId)) c.getFood().eat(itemId, itemSlot);
    if (c.getPrayer().isBone(itemId)) c.getPrayer().buryBone(itemId, itemSlot);
    if (c.getPotions().isPotion(itemId)) c.getPotions().handlePotion(itemId, itemSlot);
    /*
     * if (itemId == 952) { if(c.inArea(3553, 3301, 3561, 3294)) {
     * c.teleTimer = 3; c.newLocation = 1; } else if(c.inArea(3550, 3287,
     * 3557, 3278)) { c.teleTimer = 3; c.newLocation = 2; } else
     * if(c.inArea(3561, 3292, 3568, 3285)) { c.teleTimer = 3; c.newLocation
     * = 3; } else if(c.inArea(3570, 3302, 3579, 3293)) { c.teleTimer = 3;
     * c.newLocation = 4; } else if(c.inArea(3571, 3285, 3582, 3278)) {
     * c.teleTimer = 3; c.newLocation = 5; } else if(c.inArea(3562, 3279,
     * 3569, 3273)) { c.teleTimer = 3; c.newLocation = 6; } }
     */
    if (c.getHerblore().isUnidHerb(itemId)) c.getHerblore().handleHerbClick(itemId);
    // ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot);
    if (c.getPrayer().isBone(itemId)) c.getPrayer().buryBone(itemId, itemSlot);
    if (itemId == 952) {
      c.getBarrows().spadeDigging();
      return;
    }
  }
示例#7
0
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {
    /*if(c.openDuel) {
    	Client o = (Client) Server.playerHandler.players[c.duelingWith];
    	c.openDuel = false;
    	o.openDuel = false;
    	c.getPA().closeAllWindows();
    	o.getPA().closeAllWindows();
    }*/
    if (c.getAgility().doingAgility) {
      return;
    }

    if (c.loggedIn == 0) {
      c.getDH().sendDialogues(691, 2244);
      return;
    }
    c.walkingToItem = false;
    c.isWc = false;
    c.clickNpcType = 0;
    c.clickObjectType = 0;
    if (c.isBanking) c.isBanking = false;
    if (c.tradeStatus >= 0) {
      c.tradeStatus = 0;
    }
    if (c.inTrade) {
      Client o = (Client) Server.playerHandler.players[c.tradeWith];
      o.tradeAccepted = false;
      c.tradeAccepted = false;
      o.tradeStatus = 0;
      c.tradeStatus = 0;
      c.tradeConfirmed = false;
      c.tradeConfirmed2 = false;
      c.sendMessage("@red@Trade has been declined.");
      o.sendMessage("@red@Other player has declined the trade.");
      // Misc.println("trade reset");
      c.getTradeAndDuel().declineTrade();
      return;
    }
    if (packetType == 248 || packetType == 164) {
      c.faceUpdate(0);
      c.npcIndex = 0;
      c.playerIndex = 0;
      if (c.followId > 0 || c.followId2 > 0) c.getPA().resetFollow();
    }
    if (c.canWalk == false) {
      return;
    }
    c.getPA().removeAllWindows();
    if (c.duelRule[1] && c.duelStatus == 5) {
      if (Server.playerHandler.players[c.duelingWith] != null) {
        if (!c.goodDistance(
                c.getX(),
                c.getY(),
                Server.playerHandler.players[c.duelingWith].getX(),
                Server.playerHandler.players[c.duelingWith].getY(),
                1)
            || c.attackTimer == 0) {
          c.sendMessage("Walking has been disabled in this duel!");
        }
      }
      c.playerIndex = 0;
      return;
    }
    if (c.stopPlayerSkill) {
      SkillHandler.resetPlayerSkillVariables(c);
      c.stopPlayerSkill = false;
    }

    if (c.freezeTimer > 0) {
      if (Server.playerHandler.players[c.playerIndex] != null) {
        if (c.goodDistance(
                c.getX(),
                c.getY(),
                Server.playerHandler.players[c.playerIndex].getX(),
                Server.playerHandler.players[c.playerIndex].getY(),
                1)
            && packetType != 98) {
          c.playerIndex = 0;
          return;
        }
      }
      if (packetType != 98) {
        c.sendMessage("A magical force stops you from moving.");
        c.playerIndex = 0;
      }
      return;
    }

    if (System.currentTimeMillis() - c.lastSpear < 4000) {
      c.sendMessage("You have been stunned.");
      c.playerIndex = 0;
      return;
    }

    if (packetType == 98) {
      c.mageAllowed = true;
    }

    if (c.duelStatus == 6) {
      c.getTradeAndDuel().claimStakedItems();
      return;
    }

    if (c.duelStatus >= 1 && c.duelStatus <= 4) {
      Client o = (Client) Server.playerHandler.players[c.duelingWith];
      c.duelStatus = 0;
      o.duelStatus = 0;
      // c.sendMessage("@red@The challange has been declined.");
      // o.sendMessage("@red@Other player has declined the challange.");
      // Misc.println("trade reset");
      o.getTradeAndDuel().declineDuel();
      c.getTradeAndDuel().declineDuel();
      // return;
    }

    if (c.respawnTimer > 3) {
      return;
    }
    if (c.inTrade) {
      return;
    }
    if (packetType == 248) {
      packetSize -= 14;
    }
    c.newWalkCmdSteps = (packetSize - 5) / 2;
    if (++c.newWalkCmdSteps > c.walkingQueueSize) {
      c.newWalkCmdSteps = 0;
      return;
    }

    c.getNewWalkCmdX()[0] = c.getNewWalkCmdY()[0] = 0;

    int firstStepX = c.getInStream().readSignedWordBigEndianA() - c.getMapRegionX() * 8;
    for (int i = 1; i < c.newWalkCmdSteps; i++) {
      c.getNewWalkCmdX()[i] = c.getInStream().readSignedByte();
      c.getNewWalkCmdY()[i] = c.getInStream().readSignedByte();
    }

    int firstStepY = c.getInStream().readSignedWordBigEndian() - c.getMapRegionY() * 8;
    c.setNewWalkCmdIsRunning((c.getInStream().readSignedByteC() == 1));
    // c.isResting = false;
    for (int i1 = 0; i1 < c.newWalkCmdSteps; i1++) {
      c.getNewWalkCmdX()[i1] += firstStepX;
      c.getNewWalkCmdY()[i1] += firstStepY;
    }
  }
示例#8
0
  public void processPacket(final Client client, int i, int j) {
    client.clickObjectType = client.objectX = client.objectId = client.objectY = 0;
    client.objectYOffset = client.objectXOffset = 0;
    client.getPA().resetFollow();
    client.isWc = false;
    client.isArrowing = false;
    client.isStringing = false;
    client.isSkilling[client.playerFletching] = false;
    client.isSkilling[client.playerSmithing] = false;
    Cooking.resetCooking(client);
    client.getPA().resetFollow();
    client.followId = 0;
    if (client.jumpingDitch) return;
    if (!client.canClick) return;
    if (client.isDead) return;
    if (client.doingAgility) {
      GnomeCourse.resetAgilityWalk(client);
    }

    switch (i) {
      default:
        break;

      case 132:
        client.objectX = client.getInStream().readSignedWordBigEndianA();
        client.objectId = client.getInStream().readUnsignedWord();
        client.objectY = client.getInStream().readUnsignedWordA();
        /*if(client.goodDistance(client.getX(), client.getY(), client.objectX, client.objectY, 1)) {
        	if (Doors.getSingleton().handleDoor(client.objectId, client.objectX, client.objectY, client.heightLevel)) {
        	}
        }*/
        client.turnPlayerTo(client.objectX, client.objectY);
        client.objectDistance = 1;
        /*	if (client.playerRights >= 3
        		&& client.playerName.equalsIgnoreCase("Pegasus")) {
        	Misc.println((new StringBuilder()).append("objectId: ")
        			.append(client.objectId).append("  ObjectX: ")
        			.append(client.objectX).append("  objectY: ")
        			.append(client.objectY).append(" Xoff: ")
        			.append(client.getX() - client.objectX)
        			.append(" Yoff: ")
        			.append(client.getY() - client.objectY).toString());
        } else if (client.playerRights == 3) {
        	client.sendMessage((new StringBuilder()).append("objectId: ")
        			.append(client.objectId).append(" objectX: ")
        			.append(client.objectX).append(" objectY: ")
        			.append(client.objectY).toString());
        }*/

        RSObjectDefinition obj = RSObjectDefinition.valueOf(client.objectId);

        if (obj == null || obj.getId() != client.objectId) {
          return;
        }

        if (obj.name != null) {
          String name = obj.name.toLowerCase(); // i think its same id just rotated
          // probably.

          // if (name.contains("door") || name.contains("gate")) {
          /*if (obj.id == 26760) {// ah i know, checking for orientation wont work here this way, xd, yo doesnt this server have doors.cfg LOL idk
          	//Door door = new Door(obj, client.objectX, client.objectY, client.heightLevel);
          	//System.out.println("Door clicked at "+client.objectX+", "+client.objectY+", "+door.getDoorPosition(obj)+", "+door.getInverseObject().getId()+", "+door.getGameObject().getId());
          	DoorManager.handle(client, DoorManager.wildDoor);// its closed.
          	return;
          }*/
          if (obj.id == 11726) {
            DoorManager.handle(client, DoorManager.snakeDoor);
            return;
          }
        }

        if (Math.abs(client.getX() - client.objectX) > 25
            || Math.abs(client.getY() - client.objectY) > 25) {
          client.resetWalkingQueue();
        } else {
          for (int k = 0; k < client.getRunecrafting().altarID.length; k++) {
            if (client.objectId == client.getRunecrafting().altarID[k]) {
              client.getRunecrafting().craftRunes(client.objectId);
            }
          }
          switch (client.objectId) {
            case 23271:
              if (3522 < client.absY) client.objectDistance = 2;
              break;
            case 17010:
              if (client.playerMagicBook == 0) {
                client.sendMessage("You switch spellbook to lunar magic.");
                client.setSidebarInterface(6, 29999);
                client.playerMagicBook = 2;
                client.autocasting = false;
                client.autocastId = -1;
                client.getPA().resetAutocast();
                break;
              }
              if (client.playerMagicBook == 1) {
                client.sendMessage("You switch spellbook to lunar magic.");
                client.setSidebarInterface(6, 29999);
                client.playerMagicBook = 2;
                client.autocasting = false;
                client.autocastId = -1;
                client.getPA().resetAutocast();
                break;
              }
              if (client.playerMagicBook == 2) {
                client.setSidebarInterface(6, 1151);
                client.playerMagicBook = 0;
                client.autocasting = false;
                client.sendMessage("You feel a drain on your memory.");
                client.autocastId = -1;
                client.getPA().resetAutocast();
                break;
              }
              break;
            case 410:
              if (client.playerMagicBook == 0) {
                client.setSidebarInterface(6, 29999);
                client.playerMagicBook = 2;
                client.autocasting = false;
                client.sendMessage("An ancient wisdomin fills your mind.");
                client.autocastId = -1;
                client.getPA().resetAutocast();
              } else {
                client.setSidebarInterface(6, 1151);
                client.playerMagicBook = 0;
                client.autocasting = false;
                client.sendMessage("You feel a drain on your memory.");
                client.autocastId = -1;
                client.getPA().resetAutocast();
              }
              break;

            case 1733:
              client.objectYOffset = 2;
              break;

            case 21764:
            case 3044:
              client.objectDistance = 3;
              break;

            case 245:
              client.objectYOffset = -1;
              client.objectDistance = 0;
              break;

            case 272:
              client.objectYOffset = 1;
              client.objectDistance = 0;
              break;

            case 273:
              client.objectYOffset = 1;
              client.objectDistance = 0;
              break;

            case 246:
              client.objectYOffset = 1;
              client.objectDistance = 0;
              break;

            case 4493:
            case 4494:
            case 4495:
            case 4496:
              client.objectDistance = 5;
              break;

            case 6522:
            case 10229:
              client.objectDistance = 2;
              break;

            case 8959:
              client.objectYOffset = 1;
              break;

            case 4417:
              if (client.objectX == 2425 && client.objectY == 3074) {
                client.objectYOffset = 2;
              }
              break;

            case 4420:
              if (client.getX() >= 2383 && client.getX() <= 2385) {
                client.objectYOffset = 1;
              } else {
                client.objectYOffset = -2;
              }
              // fall through

            case 409:
            case 6552:
              client.objectDistance = 2;
              break;

            case 2878:
            case 2879:
              client.objectDistance = 3;
              break;

            case 2558:
              client.objectDistance = 0;
              if (client.absX > client.objectX && client.objectX == 3044) {
                client.objectXOffset = 1;
              }
              if (client.absY > client.objectY) {
                client.objectYOffset = 1;
              }
              if (client.absX < client.objectX && client.objectX == 3038) {
                client.objectXOffset = -1;
              }
              break;

            case 9356:
              client.objectDistance = 2;
              break;

            case 1815:
            case 1816:
            case 5959:
            case 5960:
              client.objectDistance = 0;
              break;

            case 9293:
              client.objectDistance = 2;
              break;

            case 4418:
              if (client.objectX == 2374 && client.objectY == 3131) {
                client.objectYOffset = -2;
              } else if (client.objectX == 2369 && client.objectY == 3126) {
                client.objectXOffset = 2;
              } else if (client.objectX == 2380 && client.objectY == 3127) {
                client.objectYOffset = 2;
              } else if (client.objectX == 2369 && client.objectY == 3126) {
                client.objectXOffset = 2;
              } else if (client.objectX == 2374 && client.objectY == 3131) {
                client.objectYOffset = -2;
              }
              break;

            case 9706:
              client.objectDistance = 0;
              client.objectXOffset = 1;
              break;

            case 9707:
              client.objectDistance = 0;
              client.objectYOffset = -1;
              break;

            case 4419:
            case 6707:
              client.objectYOffset = 3;
              break;

            case 6823:
              client.objectDistance = 2;
              client.objectYOffset = 1;
              break;

            case 6706:
              client.objectXOffset = 2;
              break;

            case 6772:
              client.objectDistance = 2;
              client.objectYOffset = 1;
              break;

            case 6705:
              client.objectYOffset = -1;
              break;

            case 6822:
              client.objectDistance = 2;
              client.objectYOffset = 1;
              break;

            case 6704:
              client.objectYOffset = -1;
              break;

            case 6773:
              client.objectDistance = 2;
              client.objectXOffset = 1;
              client.objectYOffset = 1;
              break;

            case 6703:
              client.objectXOffset = -1;
              break;

            case 6771:
              client.objectDistance = 2;
              client.objectXOffset = 1;
              client.objectYOffset = 1;
              break;

            case 6702:
              client.objectXOffset = -1;
              break;

            case 6821:
              client.objectDistance = 2;
              client.objectXOffset = 1;
              client.objectYOffset = 1;
              break;

            case 1276:
            case 1278:
            case 1281:
            case 1306:
            case 1307:
            case 1308:
            case 1309:
              client.objectDistance = 3;
              break;

            default:
              client.objectDistance = 1;
              client.objectXOffset = 0;
              client.objectYOffset = 0;
              break;
          }
          if (client.destinationReached()) {
            client.turnPlayerTo(client.objectX, client.objectY);
            client.getActions().firstClickObject(client.objectId, client.objectX, client.objectY);
          } else {
            client.clickObjectType = 1;
          }
        }
        break;

      case 252:
        client.objectId = client.getInStream().readUnsignedWordBigEndianA();
        client.objectY = client.getInStream().readSignedWordBigEndian();
        client.objectX = client.getInStream().readUnsignedWordA();
        client.objectDistance = 1;
        /*if (client.playerRights >= 3) {
        	Misc.println((new StringBuilder()).append("objectId: ")
        			.append(client.objectId).append("  ObjectX: ")
        			.append(client.objectX).append("  objectY: ")
        			.append(client.objectY).append(" Xoff: ")
        			.append(client.getX() - client.objectX)
        			.append(" Yoff: ")
        			.append(client.getY() - client.objectY).toString());
        }*/
        switch (client.objectId) {
          case 6162:
          case 6163:
          case 6164:
          case 6165:
          case 6166:
            client.objectDistance = 2;
            break;

          default:
            client.objectDistance = 1;
            client.objectXOffset = 0;
            client.objectYOffset = 0;
            break;
        }
        if (client.destinationReached()) {
          client.turnPlayerTo(client.objectX, client.objectY);
          client.getActions().secondClickObject(client.objectId, client.objectX, client.objectY);
        } else {
          client.clickObjectType = 2;
        }
        break;

      case 70: // 'F'
        client.objectX = client.getInStream().readSignedWordBigEndian();
        client.objectY = client.getInStream().readUnsignedWord();
        client.objectId = client.getInStream().readUnsignedWordBigEndianA();
        /*if (client.playerRights >= 3) {
        	Misc.println((new StringBuilder()).append("objectId: ")
        			.append(client.objectId).append("  ObjectX: ")
        			.append(client.objectX).append("  objectY: ")
        			.append(client.objectY).append(" Xoff: ")
        			.append(client.getX() - client.objectX)
        			.append(" Yoff: ")
        			.append(client.getY() - client.objectY).toString());
        }*/
        switch (client.objectId) {
          default:
            client.objectDistance = 1;
            break;
        }
        client.objectXOffset = 0;
        client.objectYOffset = 0;
        if (client.destinationReached()) {
          client.turnPlayerTo(client.objectX, client.objectY);
          client.getActions().thirdClickObject(client.objectId, client.objectX, client.objectY);
        } else {
          client.clickObjectType = 3;
        }
        break;
    }
  }