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

Handles displaying the npc drops on an itemcontainer. More...

Classes

enum  DropType

Static Public Member Functions

static void display (Player player, NpcDropTable definition)
static void open (Player player)
static void search (Player player, String context, DropType type)

Static Private Attributes

static final String[] DEFAULT

Detailed Description

Handles displaying the npc drops on an itemcontainer.

Author
Daniel

Definition at line 25 of file DropDisplay.java.

Member Function Documentation

◆ display()

void com.runehive.content.DropDisplay.display ( Player player,
NpcDropTable definition )
static

Definition at line 104 of file DropDisplay.java.

104 {
105 int size = definition == null ? 9 : definition.drops.length < 9 ? 9 : definition.drops.length;
106 player.send(new SendScrollbar(54550, definition == null ? 350 : (size * 32)));
107 player.send(new SendString(definition == null ? "" : "Drops: " + definition.drops.length, 54514));
108 player.send(new SendString(definition == null ? "" : "" + NpcDefinition.get(definition.npcIds[0]).getName(), 54513));
109 for (int index = 0, string = 54552; index < size; index++) {
110 boolean valid = definition != null && (index < definition.drops.length && (NpcDefinition.get(definition.npcIds[0]) != null));
111 NpcDrop drop = valid ? definition.drops[index] : null;
112 Item item = valid ? new Item(drop.id, drop.maximum) : null;
113 player.send(new SendItemOnInterfaceSlot(54551, item, index));
114 string++;
115 player.send(new SendString(!valid ? "" : item.getName(), string));
116// player.send(new SendString(!valid ? "" : item.getName() + " (<col=ffffff>" + item.getId() + "</col>)", string));
117 string++;
118 player.send(new SendString(!valid ? "" : Utility.formatDigits(drop.minimum), string));
119 string++;
120 player.send(new SendString(!valid ? "" : Utility.formatDigits(drop.maximum), string));
121 string++;
122 player.send(new SendString(!valid ? "" : drop.type.toString(), string));
123 string++;
124 }
125 }
val index

References com.runehive.game.world.entity.mob.npc.drop.NpcDropTable.drops, com.runehive.util.Utility.formatDigits(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.get(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.getName(), com.runehive.game.world.items.Item.getName(), com.runehive.game.world.entity.mob.npc.drop.NpcDrop.id, com.runehive.game.world.entity.mob.npc.drop.NpcDrop.maximum, com.runehive.game.world.entity.mob.npc.drop.NpcDrop.minimum, com.runehive.game.world.entity.mob.npc.drop.NpcDropTable.npcIds, com.runehive.game.world.entity.mob.player.Player.send(), com.runehive.game.world.entity.mob.npc.drop.NpcDropChance.toString(), and com.runehive.game.world.entity.mob.npc.drop.NpcDrop.type.

Referenced by open(), and search().

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

◆ open()

void com.runehive.content.DropDisplay.open ( Player player)
static

Definition at line 49 of file DropDisplay.java.

49 {
50 search(player, Utility.randomElement(DEFAULT), DropType.NPC);
51 List<Integer> key = player.attributes.get("DROP_DISPLAY_KEY", List.class);
52 display(player, NpcDropManager.NPC_DROPS.get(key.get(0)));
53 player.interfaceManager.open(54500);
54 }

References com.runehive.game.world.entity.mob.Mob.attributes, DEFAULT, display(), com.runehive.util.generic.GenericAttributes.get(), com.runehive.game.world.entity.mob.player.Player.interfaceManager, com.runehive.content.DropDisplay.DropType.NPC, com.runehive.game.world.entity.mob.npc.drop.NpcDropManager.NPC_DROPS, com.runehive.game.world.entity.mob.player.InterfaceManager.open(), com.runehive.util.Utility.randomElement(), and search().

Referenced by com.runehive.game.plugin.PluginContext.onClick().

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

◆ search()

void com.runehive.content.DropDisplay.search ( Player player,
String context,
DropType type )
static

Definition at line 56 of file DropDisplay.java.

56 {
57 context = context.trim().toLowerCase();
58 List<String> npc = new ArrayList<>();
59 List<Integer> integer = new ArrayList<>();
60 for (Map.Entry<Integer, NpcDropTable> drop : NpcDropManager.NPC_DROPS.entrySet()) {
61 NpcDropTable definition = drop.getValue();
62 if (NpcDefinition.get(definition.npcIds[0]) == null)
63 continue;
64 String name = NpcDefinition.get(definition.npcIds[0]).getName();
65 if (type == DropType.NPC) {
66 if (name.toLowerCase().contains(context)) {
67 if (!npc.contains(name)) {
68 npc.add(name);
69 integer.add(definition.npcIds[0]);
70 }
71 }
72 } else if (type == DropType.ITEM) {
73 for (NpcDrop item : definition.drops) {
74 String itemName = ItemDefinition.get(item.id).getName();
75 if (itemName.toLowerCase().contains(context)) {
76 if (!npc.contains(name)) {
77 npc.add(name);
78 integer.add(definition.npcIds[0]);
79 }
80 }
81 }
82 }
83 }
84
85 if (integer.isEmpty()) {
86 player.dialogueFactory.sendStatement("No search was found for your entry!").execute();
87 return;
88 }
89
90 int size = npc.size() < 10 ? 10 : npc.size();
91 for (int index = 0, string = 54516; index < size; index++, string += 2) {
92 if (string >= 54551)
93 break;
94 String name = index >= npc.size() ? "" : npc.get(index);
95 player.send(new SendTooltip(name.isEmpty() ? "" : "View drop table of <col=ff9933>" + name, string));
96 player.send(new SendString(name, string + 1));
97 }
98
99 player.attributes.set("DROP_DISPLAY_KEY", integer);
100 player.send(new SendScrollbar(54515, 280));
101 display(player, NpcDropManager.NPC_DROPS.get(0));
102 }

References com.runehive.game.world.entity.mob.Mob.attributes, com.runehive.game.world.entity.mob.player.Player.dialogueFactory, display(), com.runehive.game.world.entity.mob.npc.drop.NpcDropTable.drops, com.runehive.content.dialogue.DialogueFactory.execute(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.get(), com.runehive.game.world.items.ItemDefinition.get(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.getName(), com.runehive.game.world.items.ItemDefinition.getName(), com.runehive.game.world.entity.mob.npc.drop.NpcDrop.id, com.runehive.content.DropDisplay.DropType.ITEM, com.runehive.content.DropDisplay.DropType.NPC, com.runehive.game.world.entity.mob.npc.drop.NpcDropManager.NPC_DROPS, com.runehive.game.world.entity.mob.npc.drop.NpcDropTable.npcIds, com.runehive.game.world.entity.mob.player.Player.send(), com.runehive.content.dialogue.DialogueFactory.sendStatement(), and com.runehive.util.generic.GenericAttributes.set().

Referenced by open().

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

Member Data Documentation

◆ DEFAULT

final String [] com.runehive.content.DropDisplay.DEFAULT
staticprivate
Initial value:
= {
"King black dragon",
"Skotizo",
"Zulrah",
"Callisto",
"Commander",
"Vene",
"Kraken",
"Chaos fanatic",
"Scorpia",
"Corporeal beast",
"Lizard shaman",
"Cerberus",
"Vorkath",
"Skeletal wyverns",
}

Definition at line 32 of file DropDisplay.java.

32 {
33 "King black dragon",
34 "Skotizo",
35 "Zulrah",
36 "Callisto",
37 "Commander",
38 "Vene",
39 "Kraken",
40 "Chaos fanatic",
41 "Scorpia",
42 "Corporeal beast",
43 "Lizard shaman",
44 "Cerberus",
45 "Vorkath",
46 "Skeletal wyverns",
47 };

Referenced by open().


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