RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.itemaction.impl.ClanShowcaseBox Class Reference
Inheritance diagram for com.runehive.content.itemaction.impl.ClanShowcaseBox:
Collaboration diagram for com.runehive.content.itemaction.impl.ClanShowcaseBox:

Public Member Functions

boolean inventory (Player player, Item item, int opcode)
 The execution method of the action.
String name ()
 The name of the action.
Public Member Functions inherited from com.runehive.content.itemaction.ItemAction
int delay ()
 The item click delay of the action.
boolean drop (Player player, Item item)
boolean equipment (Player player, Item item, int opcode)
boolean itemOnItem (Player player, Item first, Item second)
String message (Item item)
 The message of the action.
String toString ()

Detailed Description

Definition at line 15 of file ClanShowcaseBox.java.

Member Function Documentation

◆ inventory()

boolean com.runehive.content.itemaction.impl.ClanShowcaseBox.inventory ( Player player,
Item item,
int opcode )

The execution method of the action.

Reimplemented from com.runehive.content.itemaction.ItemAction.

Definition at line 23 of file ClanShowcaseBox.java.

23 {
24 if (opcode != 1) {
25 return false;
26 }
27 ClanChannel channel = player.clanChannel;
28 if (channel == null) {
29 player.send(new SendMessage("You need to be in a clan to do this!"));
30 return true;
31 }
32 if (channel.getShowcase().showcaseItems.size() >= 28) {
33 player.send(new SendMessage("You have reached the maximum capacity of showcase items you can hold. Please delete an item to proceed."));
34 return true;
35 }
36 ClanLevel level = channel.getDetails().level;
37 List<Item> items = new ArrayList<>();
38
39 for (int reward : ClanUtility.getRewardItems(level)) {
40 Item rewardItem = new Item(reward, 1);
41 for (Item showcase : channel.getShowcaseItems()) {
42 if (rewardItem.getId() != showcase.getId())
43 items.add(rewardItem);
44 }
45 }
46
47 if (items.isEmpty()) {
48 return true;
49 }
50
51 Item showcaseReward = Utility.randomElement(items);
52 player.inventory.remove(item);
53 channel.getShowcase().showcaseItems.add(showcaseReward.getId());
54 channel.message("We just received " + showcaseReward.getName() + " from the showcase box!");
55 return true;
56 }

References com.runehive.game.world.entity.mob.player.Player.clanChannel, com.runehive.content.clanchannel.channel.ClanChannel.getDetails(), com.runehive.game.world.items.Item.getId(), com.runehive.game.world.items.Item.getName(), com.runehive.content.clanchannel.ClanUtility.getRewardItems(), com.runehive.content.clanchannel.channel.ClanChannel.getShowcase(), com.runehive.content.clanchannel.channel.ClanChannel.getShowcaseItems(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.content.clanchannel.channel.ClanDetails.level, com.runehive.content.clanchannel.channel.ClanChannel.message(), com.runehive.util.Utility.randomElement(), com.runehive.game.world.items.containers.ItemContainer.remove(), and com.runehive.game.world.entity.mob.player.Player.send().

Here is the call graph for this function:

◆ name()

String com.runehive.content.itemaction.impl.ClanShowcaseBox.name ( )

The name of the action.

Reimplemented from com.runehive.content.itemaction.ItemAction.

Definition at line 18 of file ClanShowcaseBox.java.

18 {
19 return "Clan Showcase Box";
20 }

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