47public class CollectionLog {
49 public static final int INTERFACE_ID = 44500;
50 public static final int NAME_ID = 44516;
51 public static final int OBTAINED_ID = 44517;
52 public static final int KC_ID = 44518;
53 public static final int ITEM_CONTAINER = 44521;
55 private ArrayList<CollectionLogItem> log;
57 public CollectionLog() {
58 log =
new ArrayList<>();
61 public ArrayList<CollectionLogItem> getLog() {
65 public static void open(
Player player) {
66 player.interfaceManager.
open(INTERFACE_ID);
68 if (player.collectionLogPageOpen !=
null)
69 loadPage(player, player.collectionLogPageOpen);
73 if (player.collectionLogView !=
null)
74 selectLog(player, player.collectionLogView, -1);
80 player.collectionLogPageOpen = page;
81 player.send(
new SendConfig(906, page.ordinal()));
83 sendButtons(player, page);
85 ArrayList<CollectionLogData> list =
CollectionLogData.getPageList(player.collectionLogPageOpen);
87 selectLog(player, selected, 0);
93 for (
int i = 0; i < list.size(); ++i, index += 2) {
97 if (cli.getData() == selected) {
98 if (cli.hasClaimed()) {
104 player.send(
new SendString(color > 0 ?
"@gre@" + list.get(i).getName() : list.get(i).getName(), index));
107 for(
int i = list.size(); i < 17; i++, index += 2)
115 player.send(
new SendString(selected.getName(), NAME_ID));
118 ArrayList<Item> items =
new ArrayList<>();
120 int[] itemIds = selected.getItems();
121 int total = itemIds ==
null ? 0 : itemIds.length;
123 if (itemIds !=
null) {
124 for (
int i : itemIds) {
125 items.add(
new Item(i, getLogItemAmount(player, selected, i)));
130 for (Item gi : items) {
131 if (gi.getAmount() > 0) {
136 String colorCode = obtained >= total ?
"65280" : obtained > 0 ?
"FFFF00" :
"FF0000";
137 player.send(
new SendString(
"Obtained: <col="+colorCode+
">" + obtained +
"/" + total +
"</col>", OBTAINED_ID));
140 int counter = getCounter(player.getCollectionLog(), selected);
142 outcome = selected.getName() +
" kills: <col=FFFFFF>" + counter +
"</col>";
143 else if (selected.getCounterText() !=
null)
144 outcome = selected.getCounterText() +
": <col=FFFFFF>" + counter +
"</col>";
150 player.collectionLogView = selected;
153 public static void selectLogButton(
Player player,
int slot) {
154 ArrayList<CollectionLogData> list =
CollectionLogData.getPageList(player.collectionLogPageOpen);
155 if (slot > list.size() - 1) {
159 selectLog(player, selected, slot);
162 public static boolean clickButton(
Player player,
int button) {
165 loadPage(player, page);
168 if (button >= -21013 && button < -20915) {
169 selectLogButton(player, (button - -21013) / 2);
178 if (i.getData() == data) {
179 return i.getCounter();
187 if (cli.getData() == data) {
188 for (
int i = 0; i < cli.getItems().size(); ++i) {
189 if (cli.getItems().get(i).getId() == item) {
190 return cli.getItems().get(i).getAmount();
198 public static void checkItemDrop(
Player player,
int npcId,
int itemId,
int amount) {
203 for(
int npc : data.getNpcIds()) {
205 logItem(player, data, itemId, amount);
213 boolean valid =
false;
214 for (
int i : data.getItems()) {
224 if (cli.getData() == data) {
225 cli.addItem(item, amount);
233 addLog.addItem(item, amount);
234 player.getCollectionLog().getLog().add(addLog);
238 public static void onNpcKill(
Player player,
int npcId) {
243 for(
int npc : data.getNpcIds()) {
245 increaseCounter(player, data);
254 if (cli.getData() == data) {
255 cli.setCounter(cli.getCounter() + 1);
260 addLog.setCounter(1);
261 player.getCollectionLog().getLog().add(addLog);