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

This class simulates drops of an npc and places it on an itemcontainer. More...

Collaboration diagram for com.runehive.content.simulator.DropSimulator:

Static Public Member Functions

static void drawList (Player player, String context)
 Handles drawing the lsit of npcs based off the search context.
static void open (Player player)
 Handles opening the drop simulator itemcontainer.
static void simulate (Player player, Simulation simulation, int id, int amount)
 Handles displaying the simulated drops.

Static Public Attributes

static final Simulation[] CUSTOM_SIMULATIONS = { }

Static Private Attributes

static final int[] DEFAULT = {3080}
 The default NPCs that will have their drops simulated.

Detailed Description

This class simulates drops of an npc and places it on an itemcontainer.

Author
Daniel.

Definition at line 21 of file DropSimulator.java.

Member Function Documentation

◆ drawList()

void com.runehive.content.simulator.DropSimulator.drawList ( Player player,
String context )
static

Handles drawing the lsit of npcs based off the search context.

Definition at line 39 of file DropSimulator.java.

39 {
40 for (int index = 0, string = 26851; index < CUSTOM_SIMULATIONS.length; index++, string++) {
41 Simulation simuation = CUSTOM_SIMULATIONS[index];
42 String name = Utility.formatEnum(simuation.name());
43
44 player.send(new SendTooltip("Open simulator for " + name, string));
45 player.send(new SendString(name, string));
46 }
47
48 List<String> npc = new ArrayList<>();
49 List<Integer> button = new ArrayList<>();
50 for (NpcDefinition definition : NpcDefinition.DEFINITIONS) {
51 if (npc.size() >= 50)
52 break;
53 if (definition == null)
54 continue;
55 if (!NpcDropManager.NPC_DROPS.containsKey(definition.getId())) {
56 continue;
57 }
58 if (!definition.getName().toLowerCase().contains(context.toLowerCase())) {
59 continue;
60 }
61 if (npc.contains(definition.getName()))
62 continue;
63 npc.add(definition.getName());
64 button.add(definition.getId());
65 }
66 int size = npc.size() < 14 ? 14 : npc.size();
67 for (int index = 0, string = 26851 + CUSTOM_SIMULATIONS.length; index < size; index++, string++) {
68 String name = index >= npc.size() ? "" : npc.get(index);
69 player.send(new SendTooltip(name.isEmpty() ? "" : "Open drop simulator for " + name, string));
70 player.send(new SendString(name, string));
71 }
72 player.attributes.set("DROP_SIMULATOR_BUTTON_KEY", button);
73 player.send(new SendScrollbar(26850, size * 15));
74 }
val index

References com.runehive.game.world.entity.mob.Mob.attributes, CUSTOM_SIMULATIONS, com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.DEFINITIONS, com.runehive.util.Utility.formatEnum(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.getId(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.getName(), com.runehive.game.world.entity.mob.npc.drop.NpcDropManager.NPC_DROPS, com.runehive.game.world.entity.mob.player.Player.send(), 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:

◆ open()

void com.runehive.content.simulator.DropSimulator.open ( Player player)
static

Handles opening the drop simulator itemcontainer.

Definition at line 29 of file DropSimulator.java.

29 {
30 int npc = Utility.randomElement(DEFAULT);
31 String name = NpcDefinition.get(npc).getName();
32 drawList(player, name);
33 simulate(player, Simulation.NPC_DROP, npc, 100);
34 player.send(new SendString(name, 26810, true));
35 player.interfaceManager.open(26800);
36 }

References DEFAULT, drawList(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.get(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.getName(), com.runehive.game.world.entity.mob.player.Player.interfaceManager, com.runehive.content.simulator.Simulation.NPC_DROP, com.runehive.game.world.entity.mob.player.InterfaceManager.open(), com.runehive.util.Utility.randomElement(), com.runehive.game.world.entity.mob.player.Player.send(), and simulate().

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

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

◆ simulate()

void com.runehive.content.simulator.DropSimulator.simulate ( Player player,
Simulation simulation,
int id,
int amount )
static

Handles displaying the simulated drops.

Definition at line 77 of file DropSimulator.java.

77 {
78 simulation.execute(player, id, amount);
79 }

References com.runehive.content.simulator.SimulationFunction.execute().

Referenced by open().

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

Member Data Documentation

◆ CUSTOM_SIMULATIONS

final Simulation [] com.runehive.content.simulator.DropSimulator.CUSTOM_SIMULATIONS = { }
static

Definition at line 26 of file DropSimulator.java.

26{ };

Referenced by drawList().

◆ DEFAULT

final int [] com.runehive.content.simulator.DropSimulator.DEFAULT = {3080}
staticprivate

The default NPCs that will have their drops simulated.

Definition at line 24 of file DropSimulator.java.

24{3080};

Referenced by open().


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