Package org.moparscape.msc.gs.model

Examples of org.moparscape.msc.gs.model.InvItem


      player.setSuspiciousPlayer(true);
      player.resetPath();
      return;
    }
    GameObject object = tile.getGameObject();
    InvItem item;
    switch (pID) {
    case 36: // Use Item on Door
      int dir = p.readByte();
      item = player.getInventory().getSlot(p.readShort());
      if (object == null || object.getType() == 0 || item == null) { // This
        // shoudln't
        // happen
        player.setSuspiciousPlayer(true);
        return;
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " used item on door"
          + item.getDef().getName()
          + "("
          + item.id
          + ")"
          + " [CMD: "
          + item.getDef().getCommand()
          + "] ON A DOOR ("
          + tile.getX()
          + "/"
          + tile.getY()
          + ") at: "
          + player.getX() + "/" + player.getY()));

      handleDoor(player, tile, object, dir, item);
      break;
    case 94: // Use Item on GameObject
      item = player.getInventory().getSlot(p.readShort());
      if (object == null || object.getType() == 1 || item == null) { // This
        // shoudln't
        // happen
        player.setSuspiciousPlayer(true);
        return;
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " used item on GameObject"
          + item.getDef().getName()
          + "("
          + item.id
          + ")"
          + " [CMD: "
          + item.getDef().getCommand()
          + "] ON A DOOR ("
          + tile.getX()
          + "/"
          + tile.getY()
          + ") at: "
View Full Code Here


    int idx = (int) p.readShort();
    if (idx < 0 || idx >= player.getInventory().size()) {
      player.setSuspiciousPlayer(true);
      return;
    }
    final InvItem item = player.getInventory().getSlot(idx);
    if (item == null || item.getDef().getCommand().equals("")) {
      player.setSuspiciousPlayer(true);
      return;
    }
    if (item.getDef().isMembers() && Config.f2pWildy
        && player.getLocation().inWilderness() && item.id != 814) {
      player.getActionSender().sendMessage(
          "Can not use a Member item in the wilderness");
      return;
    }
    world.addEntryToSnapshots(new Activity(player.getUsername(), player
        .getUsername()
        + " used item "
        + item.getDef().getName()
        + "("
        + item.id
        + ")"
        + " [CMD: "
        + item.getDef().getCommand()
        + "] at: " + player.getX() + "/" + player.getY()));

    if (player.isBusy()) {
      if (player.inCombat()) {
        player.getActionSender().sendMessage(
            "You cannot do that whilst fighting!");
      }
      return;
    }// sip
    player.resetAll();

    if (item.id == 1263) {
      // player.resetPath(); // This isn't how it's done in RSC
      // player.setBusy(true); // Shouldn't be here
      player.getActionSender()
          .sendMessage("You rest in the sleeping bag");
      showBubble(player, item);
      player.getActionSender().sendEnterSleep();
      player.setSleeping(true);
      // player.setFatigue(0);
      // player.getActionSender().sendFatigue();
      // player.getActionSender().sendMessage("You wake up - feeling refreshed");
      // player.isSleeping = true;
      // player.setBusy(false);
      return;
    }

    if (item.getDef().getCommand().equalsIgnoreCase("identify")) {
      if (!Server.isMembers()) {
        player.getActionSender().sendMessage(
            "This feature is only avaliable on a members server");
        return;
      }
      ItemUnIdentHerbDef herb = ItemAttributes.getUnIdentHerbDef(item.id);
      if (herb == null) {
        return;
      }
      if (player.getMaxStat(15) < herb.getLevelRequired()) {
        player.getActionSender()
            .sendMessage(
                "Your herblaw ability is not high enough to clean this herb.");
        return;
      }
      player.setBusy(true);
      Instance.getDelayedEventHandler().add(new MiniEvent(player) {
        public void action() {
          ItemUnIdentHerbDef herb = ItemAttributes
              .getUnIdentHerbDef(item.id);
          InvItem newItem = new InvItem(herb.getNewId());
          owner.getInventory().remove(item.id, item.amount, false);
          owner.getInventory().add(newItem.id, newItem.amount, false);
          owner.getActionSender().sendMessage(
              "You clean the mud off the "
                  + newItem.getDef().getName() + ".");
          owner.incExp(15, herb.getExp(), true);
          owner.getActionSender().sendStat(15);
          owner.getActionSender().sendInventory();
          owner.setBusy(false);
          return;
View Full Code Here

      Inventory tradeOffer = new Inventory(player);
      player.resetTradeOffer();
      int count = (int) p.readByte();
      for (int slot = 0; slot < count; slot++) {
        InvItem tItem = new InvItem(p.readShort(), p.readInt());
        if (tItem.amount < 1) {
          player.setSuspiciousPlayer(true);
          player.setRequiresOfferUpdate(true);
          continue;
        }
        ItemDef def = tItem.getDef();
        if (!def.canTrade() && !player.isMod()) {
          player.getActionSender().sendMessage(
              def.getName()
                  + " cannot be traded with other players");
          player.setRequiresOfferUpdate(true);
View Full Code Here

      amount = feathers.amount;
    }
    if (item.amount < amount) {
      amount = item.amount;
    }
    InvItem newItem;
    int exp;
    ItemDartTipDef tipDef = null;
    if (item.id == 280) {
      newItem = new InvItem(637, amount);
      exp = amount;
    } else if ((tipDef = EntityHandler.getItemDartTipDef(item.id)) != null) {
      newItem = new InvItem(tipDef.getDartID(), amount);
      exp = (int) (tipDef.getExp() * (double) amount);
    } else {
      return false;
    }
    final int amt = amount;
    final int xp = exp;
    final InvItem newItm = newItem;
    Instance.getDelayedEventHandler().add(new MiniEvent(player) {
      public void action() {
        if (owner.getInventory().remove(feathers.id, amt, false)
            && owner.getInventory().remove(item.id, amt, false)) {
          owner.getActionSender().sendMessage(
View Full Code Here

      return true;
    }
    Instance.getDelayedEventHandler().add(new MiniEvent(player) {
      public void action() {
        if (owner.getInventory().remove(gem.id, gem.amount, false)) {
          InvItem cutGem = new InvItem(gemDef.getGemID(), 1);
          owner.getActionSender().sendMessage(
              "You cut the " + cutGem.getDef().getName());
          owner.getActionSender().sendSound("chisel");
          owner.getInventory().add(cutGem.id, cutGem.amount, false);
          owner.incExp(12, gemDef.getExp(), true);
          owner.getActionSender().sendStat(12);
          owner.getActionSender().sendInventory();
View Full Code Here

      public void action() {
        String[] options = new String[] { "Beer Glass", "Vial", "Orb",
            "Cancel" };
        owner.setMenuHandler(new MenuHandler(options) {
          public void handleReply(final int option, final String reply) {
            InvItem result;
            int reqLvl, exp;
            switch (option) {
            case 0:
              result = new InvItem(620, 1);
              reqLvl = 1;
              exp = 18;
              break;
            case 1:
              result = new InvItem(465, 1);
              reqLvl = 33;
              exp = 35;
              break;
            case 2:
              result = new InvItem(611, 1);
              reqLvl = 46;
              exp = 53;
              break;
            default:
              return;
            }
            if (owner.getCurStat(12) < reqLvl) {
              owner.getActionSender().sendMessage(
                  "You need a crafting level of " + reqLvl
                      + " to make a "
                      + result.getDef().getName() + ".");
              return;
            }
            if (owner.getInventory().remove(glass.id, glass.amount,
                false)) {
              owner.getActionSender().sendMessage(
                  "You make a " + result.getDef().getName());
              owner.getInventory().add(result.id, result.amount,
                  false);
              owner.incExp(12, exp, true);
              owner.getActionSender().sendStat(12);
              owner.getActionSender().sendInventory();
View Full Code Here

      public void action() {
        String[] options = new String[] { "Arrow shafts", "Shortbow",
            "Longbow", "Cancel" };
        owner.setMenuHandler(new MenuHandler(options) {
          public void handleReply(final int option, final String reply) {
            InvItem result;
            int reqLvl, exp;
            switch (option) {
            case 0:
              result = new InvItem(280, cutDef.getShaftAmount());
              reqLvl = cutDef.getShaftLvl();
              exp = cutDef.getShaftExp();
              break;
            case 1:
              result = new InvItem(cutDef.getShortbowID(), 1);
              reqLvl = cutDef.getShortbowLvl();
              exp = cutDef.getShortbowExp();
              break;
            case 2:
              result = new InvItem(cutDef.getLongbowID(), 1);
              reqLvl = cutDef.getLongbowLvl();
              exp = cutDef.getLongbowExp();
              break;
            default:
              return;
            }
            if (owner.getCurStat(9) < reqLvl) {
              owner.getActionSender().sendMessage(
                  "You need a fletching level of " + reqLvl
                      + " to cut that.");
              return;
            }
            if (owner.getInventory().remove(log.id, log.amount,
                false)) {
              owner.getActionSender().sendMessage(
                  "You make a " + result.getDef().getName());
              owner.getInventory().add(result.id, result.amount,
                  false);
              owner.incExp(9, exp, true);
              owner.getActionSender().sendStat(9);
              owner.getActionSender().sendInventory();
View Full Code Here

    if (player.isBusy()) {
      player.resetPath();
      return;
    }
    player.resetAll();
    InvItem item1 = player.getInventory().getSlot(p.readShort());
    InvItem item2 = player.getInventory().getSlot(p.readShort());
    if (item1 == null || item2 == null) {
      player.setSuspiciousPlayer(true);
      return;

    }
    world.addEntryToSnapshots(new Activity(player.getUsername(), player
        .getUsername()
        + " used item "
        + item1.getDef().getName()
        + "("
        + item1.id
        + ")"
        + " [CMD: "
        + item1.getDef().getCommand()
        + "] ON A ANOTHER INV ITEM "
        + item2.getDef().getName()
        + "("
        + item2.id
        + ")"
        + " [CMD: "
        + item2.getDef().getCommand()
        + "] at: " + player.getX() + "/" + player.getY()));

    ItemHerbSecondDef secondDef = null;
    if ((secondDef = EntityHandler.getItemHerbSecond(item1.id, item2.id)) != null
        && doHerbSecond(player, item1, item2, secondDef)) {
View Full Code Here

      public void action() {
        String[] options = new String[] { "Armour", "Gloves", "Boots",
            "Cancel" };
        owner.setMenuHandler(new MenuHandler(options) {
          public void handleReply(final int option, final String reply) {
            InvItem result;
            int reqLvl, exp;
            switch (option) {
            case 0:
              result = new InvItem(15, 1);
              reqLvl = 14;
              exp = 25;
              break;
            case 1:
              result = new InvItem(16, 1);
              reqLvl = 1;
              exp = 14;
              break;
            case 2:
              result = new InvItem(17, 1);
              reqLvl = 7;
              exp = 17;
              break;
            default:
              return;
            }
            if (owner.getCurStat(12) < reqLvl) {
              owner.getActionSender().sendMessage(
                  "You need a crafting level of " + reqLvl
                      + " to make "
                      + result.getDef().getName() + ".");
              return;
            }
            if (owner.getInventory().remove(leather.id,
                leather.amount, false)) {
              owner.getActionSender().sendMessage(
                  "You make some "
                      + result.getDef().getName());
              owner.getInventory().add(result.id, result.amount,
                  false);
              owner.incExp(12, exp, true);
              owner.getActionSender().sendStat(12);
              owner.getActionSender().sendInventory();
View Full Code Here

      }
      Iterator<InvItem> inventory = player.getInventory().getItems()
          .iterator();
      int boneCount = 0;
      while (inventory.hasNext()) {
        InvItem i = inventory.next();
        if (i.id == 20) {
          inventory.remove();
          boneCount++;
        }
      }
View Full Code Here

TOP

Related Classes of org.moparscape.msc.gs.model.InvItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.