Package org.moparscape.msc.gs.model.container

Examples of org.moparscape.msc.gs.model.container.Bank


          player.updateWornItems(def.getWieldPos(), def.getSprite());
        }
      }
      player.setInventory(inventory);

      Bank bank = new Bank();
      int bnkCount = p.readShort();
      for (int i = 0; i < bnkCount; i++)
        bank.add(p.readShort(), p.readInt(), true);

      player.setBank(bank);

      int friendCount = p.readShort();
      for (int i = 0; i < friendCount; i++)
View Full Code Here


    if (!player.accessingBank()) {
      player.setSuspiciousPlayer(true);
      player.resetBank();
      return;
    }
    Bank bank = player.getBank();
    Inventory inventory = player.getInventory();
    int itemID, amount, slot;
    switch (pID) {
    case 48: // Close bank
      player.resetBank();
      break;
    case 198: // Deposit item
      itemID = p.readShort();
      amount = p.readInt();
      if (amount < 1 || inventory.countId(itemID) < amount) {
        world.addEntryToSnapshots(new Activity(player.getUsername(),
            player.getUsername() + " tried to deposit ID: "
                + itemID + " amount: " + amount));
        player.setSuspiciousPlayer(true);
        return;
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " deposited ID: "
          + itemID
          + " amount: "
          + amount));
      if (EntityHandler.getItemDef(itemID).isMembers()
          && !World.isMembers()) {
        player.getActionSender().sendMessage(
            "This feature is only avaliable on a members server");
        return;
      }
      if (bank.canHold(itemID, amount)
          && inventory.remove(itemID, amount, false)) {
        bank.add(itemID, amount, false);
      } else {
        player.getActionSender().sendMessage(
            "You don't have room for that in your bank");
      }
      slot = bank.getLastItemSlot(itemID);
      if (slot > -1) {
        player.getActionSender().sendInventory();
        player.getActionSender().updateBankItem(slot, itemID,
            bank.countId(itemID));
      }
      break;
    case 183: // Withdraw item
      itemID = p.readShort();
      amount = p.readInt();
      if (amount < 1 || bank.countId(itemID) < amount) {
        world.addEntryToSnapshots(new Activity(player.getUsername(),
            player.getUsername() + " tried to withdraw ID: "
                + itemID + " amount: " + amount));
        player.setSuspiciousPlayer(true);
        return;
      }
      if (EntityHandler.getItemDef(itemID).isMembers()
          && !World.isMembers()) {
        player.getActionSender().sendMessage(
            "This feature is only avaliable on a members server");
        return;
      }

      if (!inventory.isStackable(itemID) && amount > 1) {
        Logger.println(player.getUsername() + " tried to withdraw ID: "
            + itemID + " amount: " + amount + " unstackable items");
        player.setSuspiciousPlayer(true);
      }

      slot = bank.getLastItemSlot(itemID);
      if (!inventory.canHold(itemID, amount)) {
        amount = inventory.maxSize() - inventory.size();
        if (amount == 0) {
          return;
        }
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " withrew ID: "
          + itemID
          + " amount: "
          + amount));

      if (bank.remove(itemID, amount, false)) {
        inventory.add(itemID, amount, false);
      }

      if (slot > -1) {
        player.getActionSender().sendInventory();
        player.getActionSender().updateBankItem(slot, itemID,
            bank.countId(itemID));
      }
      break;
    }
  }
View Full Code Here

      packet.addShort(i.id);
      packet.addInt(i.amount);
      packet.addByte((byte) (i.wielded ? 1 : 0));
    }

    Bank bnk = player.getBank();
    packet.addShort(bnk.size());
    for (InvItem i : bnk.getItems()) {
      packet.addShort(i.id);
      packet.addInt(i.amount);
    }

    packet.addShort(player.quests.quests().size());
View Full Code Here

TOP

Related Classes of org.moparscape.msc.gs.model.container.Bank

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.