RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.collectionlog.CollectionLog Class Reference

Public Member Functions

 CollectionLog ()
ArrayList< CollectionLogItemgetLog ()

Static Public Member Functions

static void checkItemDrop (Player player, int npcId, int itemId, int amount)
static boolean clickButton (Player player, int button)
static int getCounter (CollectionLog cl, CollectionLogData data)
static int getLogItemAmount (Player player, CollectionLogData data, int item)
static void increaseCounter (Player player, CollectionLogData data)
static void loadPage (Player player, CollectionLogPage page)
static void logItem (Player player, CollectionLogData data, int item, int amount)
static void onNpcKill (Player player, int npcId)
static void open (Player player)
static void selectLog (Player player, CollectionLogData selected, int slot)
static void selectLogButton (Player player, int slot)
static void sendButtons (Player player, CollectionLogPage page)

Static Public Attributes

static final int INTERFACE_ID = 44500
static final int ITEM_CONTAINER = 44521
static final int KC_ID = 44518
static final int NAME_ID = 44516
static final int OBTAINED_ID = 44517

Private Attributes

ArrayList< CollectionLogItemlog

Detailed Description

Definition at line 13 of file CollectionLog.java.

Constructor & Destructor Documentation

◆ CollectionLog()

com.runehive.content.collectionlog.CollectionLog.CollectionLog ( )

Definition at line 23 of file CollectionLog.java.

23 {
24 log = new ArrayList<>();
25 }

References log.

Referenced by getCounter().

Here is the caller graph for this function:

Member Function Documentation

◆ checkItemDrop()

void com.runehive.content.collectionlog.CollectionLog.checkItemDrop ( Player player,
int npcId,
int itemId,
int amount )
static

Definition at line 164 of file CollectionLog.java.

164 {
165 if (npcId < 1) {
166 return;
167 }
168 for (CollectionLogData data : CollectionLogData.values()) {
169 for(int npc : data.getNpcIds()) {
170 if (npc == npcId) {
171 logItem(player, data, itemId, amount);
172 return;
173 }
174 }
175 }
176 }

References logItem().

Referenced by com.runehive.game.world.entity.mob.npc.drop.NpcDropManager.drop(), and com.runehive.game.world.entity.mob.npc.drop.NpcDropManager.rollDrop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clickButton()

boolean com.runehive.content.collectionlog.CollectionLog.clickButton ( Player player,
int button )
static

Definition at line 128 of file CollectionLog.java.

128 {
129 CollectionLogPage page = CollectionLogPage.forButton(button);
130 if (page != null) {
131 loadPage(player, page);
132 return true;
133 }
134 if (button >= -21013 && button < -20915) {
135 selectLogButton(player, (button - -21013) / 2);
136 return true;
137 }
138 return false;
139 }

References com.runehive.content.collectionlog.CollectionLogPage.forButton(), loadPage(), and selectLogButton().

Here is the call graph for this function:

◆ getCounter()

int com.runehive.content.collectionlog.CollectionLog.getCounter ( CollectionLog cl,
CollectionLogData data )
static

Definition at line 142 of file CollectionLog.java.

142 {
143 for (CollectionLogItem i : cl.getLog()) {
144 if (i.getData() == data) {
145 return i.getCounter();
146 }
147 }
148 return 0;
149 }

References CollectionLog(), and getLog().

Referenced by selectLog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLog()

ArrayList< CollectionLogItem > com.runehive.content.collectionlog.CollectionLog.getLog ( )

Definition at line 27 of file CollectionLog.java.

27 {
28 return this.log;
29 }

Referenced by getCounter(), getLogItemAmount(), increaseCounter(), logItem(), and sendButtons().

Here is the caller graph for this function:

◆ getLogItemAmount()

int com.runehive.content.collectionlog.CollectionLog.getLogItemAmount ( Player player,
CollectionLogData data,
int item )
static

Definition at line 151 of file CollectionLog.java.

151 {
152 for (CollectionLogItem cli : player.getCollectionLog().getLog()) {
153 if (cli.getData() == data) {
154 for (int i = 0; i < cli.getItems().size(); ++i) {
155 if (cli.getItems().get(i).getId() == item) {
156 return cli.getItems().get(i).getAmount();
157 }
158 }
159 }
160 }
161 return 0;
162 }

References com.runehive.game.world.entity.mob.player.Player.getCollectionLog(), and getLog().

Referenced by selectLog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ increaseCounter()

void com.runehive.content.collectionlog.CollectionLog.increaseCounter ( Player player,
CollectionLogData data )
static

Definition at line 218 of file CollectionLog.java.

218 {
219 for (CollectionLogItem cli : player.getCollectionLog().getLog()) {
220 if (cli.getData() == data) {
221 cli.setCounter(cli.getCounter() + 1);
222 return;
223 }
224 }
225 CollectionLogItem addLog = new CollectionLogItem(data);
226 addLog.setCounter(1);
227 player.getCollectionLog().getLog().add(addLog);
228 }

References com.runehive.game.world.entity.mob.player.Player.getCollectionLog(), getLog(), and com.runehive.content.collectionlog.CollectionLogItem.setCounter().

Referenced by com.runehive.content.wintertodt.Wintertodt.award(), com.runehive.content.activity.impl.barrows.BarrowsUtility.generateRewards(), and onNpcKill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadPage()

void com.runehive.content.collectionlog.CollectionLog.loadPage ( Player player,
CollectionLogPage page )
static

Definition at line 45 of file CollectionLog.java.

45 {
46 player.collectionLogPageOpen = page;
47 player.send(new SendConfig(906, page.ordinal()));
48 player.send(new SendConfig(907, 0));
49 sendButtons(player, page);
50
51 ArrayList<CollectionLogData> list = CollectionLogData.getPageList(player.collectionLogPageOpen);
52 CollectionLogData selected = list.get(0);
53 selectLog(player, selected, 0);
54 }

References com.runehive.game.world.entity.mob.player.Player.collectionLogPageOpen, com.runehive.content.collectionlog.CollectionLogData.getPageList(), selectLog(), com.runehive.game.world.entity.mob.player.Player.send(), and sendButtons().

Referenced by clickButton(), and open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ logItem()

void com.runehive.content.collectionlog.CollectionLog.logItem ( Player player,
CollectionLogData data,
int item,
int amount )
static

Definition at line 178 of file CollectionLog.java.

178 {
179 boolean valid = false;
180 for (int i : data.getItems()) {
181 if (i == item) {
182 valid = true;
183 break;
184 }
185 }
186 if (!valid) {
187 return;
188 }
189 for (CollectionLogItem cli : player.getCollectionLog().getLog()) {
190 if (cli.getData() == data) {
191 cli.addItem(item, amount);
192 player.send(new SendMessage("@red@An item was added to your collection log: " + amount + "x " + ItemDefinition.get(item).getName() + "!"));
193 CollectionLogSaving.save(player);
194 return;
195 }
196 }
197 player.send(new SendMessage("@red@An item was added to your collection log: " + amount + "x " + ItemDefinition.get(item).getName() + "!"));
198 CollectionLogItem addLog = new CollectionLogItem(data);
199 addLog.addItem(item, amount);
200 player.getCollectionLog().getLog().add(addLog);
201 CollectionLogSaving.save(player);
202 }

References com.runehive.content.collectionlog.CollectionLogItem.addItem(), com.runehive.game.world.items.ItemDefinition.get(), com.runehive.game.world.entity.mob.player.Player.getCollectionLog(), com.runehive.content.collectionlog.CollectionLogData.getItems(), getLog(), com.runehive.game.world.items.ItemDefinition.getName(), com.runehive.content.collectionlog.CollectionLogSaving.save(), and com.runehive.game.world.entity.mob.player.Player.send().

Referenced by checkItemDrop(), com.runehive.content.activity.impl.barrows.BarrowsUtility.generateRewards(), com.runehive.content.pet.Pets.onObtain(), and com.runehive.content.activity.impl.warriorguild.WarriorGuild.pickupItem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onNpcKill()

void com.runehive.content.collectionlog.CollectionLog.onNpcKill ( Player player,
int npcId )
static

Definition at line 204 of file CollectionLog.java.

204 {
205 if (npcId < 1) {
206 return;
207 }
208 for (CollectionLogData data : CollectionLogData.values()) {
209 for(int npc : data.getNpcIds()) {
210 if (npc == npcId) {
211 increaseCounter(player, data);
212 return;
213 }
214 }
215 }
216 }

References increaseCounter().

Referenced by com.runehive.game.world.entity.mob.npc.NpcDeath.postDeath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open()

void com.runehive.content.collectionlog.CollectionLog.open ( Player player)
static

Definition at line 31 of file CollectionLog.java.

31 {
32 player.interfaceManager.open(INTERFACE_ID);
33
34 if (player.collectionLogPageOpen != null)
35 loadPage(player, player.collectionLogPageOpen);
36 else
37 loadPage(player, CollectionLogPage.BOSSES);
38
39 if (player.collectionLogView != null)
40 selectLog(player, player.collectionLogView, -1);
41 else
42 selectLog(player, CollectionLogData.BARROWS, 0);
43 }

References com.runehive.content.collectionlog.CollectionLogData.BARROWS, com.runehive.content.collectionlog.CollectionLogPage.BOSSES, com.runehive.game.world.entity.mob.player.Player.collectionLogPageOpen, com.runehive.game.world.entity.mob.player.Player.collectionLogView, INTERFACE_ID, com.runehive.game.world.entity.mob.player.Player.interfaceManager, loadPage(), com.runehive.game.world.entity.mob.player.InterfaceManager.open(), and selectLog().

Here is the call graph for this function:

◆ selectLog()

void com.runehive.content.collectionlog.CollectionLog.selectLog ( Player player,
CollectionLogData selected,
int slot )
static

Definition at line 77 of file CollectionLog.java.

77 {
78 if(slot != -1)
79 player.send(new SendConfig(907, slot));
80
81 player.send(new SendString(selected.getName(), NAME_ID));
82
83
84 ArrayList<Item> items = new ArrayList<>();
85
86 int[] itemIds = selected.getItems();
87 int total = itemIds == null ? 0 : itemIds.length;
88
89 if (itemIds != null) {
90 for (int i : itemIds) {
91 items.add(new Item(i, getLogItemAmount(player, selected, i)));
92 }
93 }
94
95 int obtained = 0;
96 for (Item gi : items) {
97 if (gi.getAmount() > 0) {
98 obtained++;
99 }
100 }
101
102 String colorCode = obtained >= total ? "65280" : obtained > 0 ? "FFFF00" : "FF0000";
103 player.send(new SendString("Obtained: <col="+colorCode+">" + obtained + "/" + total + "</col>", OBTAINED_ID));
104
105 String outcome = "";
106 int counter = getCounter(player.getCollectionLog(), selected);
107 if (selected.getType().equals(CollectionCategory.BOSSES))
108 outcome = selected.getName() + " kills: <col=FFFFFF>" + counter + "</col>";
109 else if (selected.getCounterText() != null)
110 outcome = selected.getCounterText() + ": <col=FFFFFF>" + counter + "</col>";
111
112 player.send(new SendString(outcome, KC_ID));
113
114 player.send(new SendItemOnInterface(ITEM_CONTAINER, items.toArray(new Item[0])));
115
116 player.collectionLogView = selected;
117 }

References com.runehive.content.collectionlog.CollectionCategory.BOSSES, com.runehive.game.world.entity.mob.player.Player.getCollectionLog(), getCounter(), com.runehive.content.collectionlog.CollectionLogData.getCounterText(), com.runehive.content.collectionlog.CollectionLogData.getItems(), getLogItemAmount(), com.runehive.content.collectionlog.CollectionLogData.getName(), com.runehive.content.collectionlog.CollectionLogData.getType(), ITEM_CONTAINER, KC_ID, NAME_ID, OBTAINED_ID, and com.runehive.game.world.entity.mob.player.Player.send().

Referenced by loadPage(), open(), and selectLogButton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectLogButton()

void com.runehive.content.collectionlog.CollectionLog.selectLogButton ( Player player,
int slot )
static

Definition at line 119 of file CollectionLog.java.

119 {
120 ArrayList<CollectionLogData> list = CollectionLogData.getPageList(player.collectionLogPageOpen);
121 if (slot > list.size() - 1) {
122 return;
123 }
124 CollectionLogData selected = list.get(slot);
125 selectLog(player, selected, slot);
126 }

References com.runehive.game.world.entity.mob.player.Player.collectionLogPageOpen, com.runehive.content.collectionlog.CollectionLogData.getPageList(), and selectLog().

Referenced by clickButton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendButtons()

void com.runehive.content.collectionlog.CollectionLog.sendButtons ( Player player,
CollectionLogPage page )
static

Definition at line 56 of file CollectionLog.java.

56 {
57 ArrayList<CollectionLogData> list = CollectionLogData.getPageList(page);
58 int index = 44524;
59 for (int i = 0; i < list.size(); ++i, index += 2) {
60 int color = 0;
61 CollectionLogData selected = list.get(i);
62 for (CollectionLogItem cli : player.getCollectionLog().getLog()) {
63 if (cli.getData() == selected) {
64 if (cli.hasClaimed()) {
65 color = 1;
66 }
67 }
68 }
69
70 player.send(new SendString(color > 0 ? "@gre@" + list.get(i).getName() : list.get(i).getName(), index));
71 }
72
73 for(int i = list.size(); i < 17; i++, index += 2)
74 player.send(new SendString("", index));
75 }
val index

References com.runehive.game.world.entity.mob.player.Player.getCollectionLog(), getLog(), com.runehive.content.collectionlog.CollectionLogData.getPageList(), and com.runehive.game.world.entity.mob.player.Player.send().

Referenced by loadPage().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ INTERFACE_ID

final int com.runehive.content.collectionlog.CollectionLog.INTERFACE_ID = 44500
static

Definition at line 15 of file CollectionLog.java.

Referenced by open().

◆ ITEM_CONTAINER

final int com.runehive.content.collectionlog.CollectionLog.ITEM_CONTAINER = 44521
static

Definition at line 19 of file CollectionLog.java.

Referenced by selectLog().

◆ KC_ID

final int com.runehive.content.collectionlog.CollectionLog.KC_ID = 44518
static

Definition at line 18 of file CollectionLog.java.

Referenced by selectLog().

◆ log

ArrayList<CollectionLogItem> com.runehive.content.collectionlog.CollectionLog.log
private

Definition at line 21 of file CollectionLog.java.

Referenced by CollectionLog().

◆ NAME_ID

final int com.runehive.content.collectionlog.CollectionLog.NAME_ID = 44516
static

Definition at line 16 of file CollectionLog.java.

Referenced by selectLog().

◆ OBTAINED_ID

final int com.runehive.content.collectionlog.CollectionLog.OBTAINED_ID = 44517
static

Definition at line 17 of file CollectionLog.java.

Referenced by selectLog().


The documentation for this class was generated from the following file: