예제 #1
0
 public void lightFire(int slot) {
   if (c.duelStatus >= 5) {
     c.sendMessage("Why am I trying to light a fire in the duel arena?");
     return;
   }
   if (c.playerLevel[c.playerFiremaking] >= level[slot]) {
     if (c.getItems().playerHasItem(590) && c.getItems().playerHasItem(logs[slot])) {
       if (System.currentTimeMillis() - lastLight > DELAY) {
         c.startAnimation(733, 0);
         c.getItems().deleteItem(logs[slot], c.getItems().getItemSlot(logs[slot]), 1);
         c.getPA().addSkillXP(logs[slot] * Config.FIREMAKING_EXPERIENCE, c.playerFiremaking);
         Objects fire = new Objects(2732, c.getX(), c.getY(), 0, -1, 10, 3);
         Objects fire2 = new Objects(592, c.getX(), c.getY(), 0, -1, 10, 60);
         Server.objectHandler.addObject(fire);
         Server.objectHandler.addObject(fire2);
         c.sendMessage("You light the fire.");
         c.getPA().walkTo(-1, 0);
         c.turnPlayerTo(c.getX() + 1, c.getY());
         this.lastLight = System.currentTimeMillis();
         // c.getPA().frame1();
         resetAnim = true;
       }
     }
   }
 }
예제 #2
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);
       }
     }
   }
 }
예제 #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) {
    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;
    }
  }
예제 #5
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;
    }
  }
예제 #6
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;
    }
  }