RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
LostUntradeables.java
1package com.osroyale.game.world.items.containers.impl;
2
3import com.osroyale.game.world.InterfaceConstants;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.game.world.items.Item;
6import com.osroyale.game.world.items.containers.ItemContainer;
7import com.osroyale.game.world.items.containers.pricechecker.PriceChecker;
8import com.osroyale.net.packet.out.SendItemOnInterface;
9import com.osroyale.net.packet.out.SendMessage;
10import com.osroyale.net.packet.out.SendString;
11
44
45public class LostUntradeables extends ItemContainer {
46 private static final int DONATOR_DEPOSIT_BOX_DISPLAY_ID = 57307;
47
48 private final Player player;
49
50 public LostUntradeables(Player player) {
51 super(30, StackPolicy.ALWAYS);
52 this.player = player;
53 }
54
55 public void open() {
56 refresh();
57 player.interfaceManager.open(57300);
58 }
59
60 public void close() {
61 clear(false);
62 refresh();
63 }
64
65 public boolean deposit(Item item) {
66 int id = item.getId();
67 setFiringEvents(false);
68 add(id, item.getAmount());
69 setFiringEvents(true);
70 refresh();
71 return true;
72 }
73
74 public boolean claim(int slot, int id) {
75 if (!player.interfaceManager.isInterfaceOpen(57300)) {
76 return false;
77 }
78
79 Item item = get(slot);
80
81 if (item == null || item.getId() != id) {
82 return false;
83 }
84
85 if (player.inventory.getFreeSlots() == 0) {
86 player.message("You do not have enough free inventory space!");
87 return false;
88 }
89
90 if (!player.inventory.contains(13307, 350)) {
91 player.message("You need 350 blood money to re-claim this item!");
92 return false;
93 }
94
95 if (remove(item.getId(), 1)) {
96 player.inventory.add(id, 1);
97 player.inventory.remove(13307, 350);
98 shift();
99 refresh();
100 }
101 return true;
102 }
103
104 private void refresh() {
105 refresh(player, DONATOR_DEPOSIT_BOX_DISPLAY_ID);
106 }
107
108 @Override
109 public void onRefresh() {
110 player.inventory.refresh();
111 player.send(new SendString(this.size() + "/" + this.capacity(), 57306));
112 player.send(new SendItemOnInterface(DONATOR_DEPOSIT_BOX_DISPLAY_ID, getItems()));
113 }
114}
ItemContainer(int capacity, StackPolicy policy, Item[] items)