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

This class handles emotes from the emote tab and skill cape. More...

Static Public Member Functions

static boolean contains (Player player, EmoteUnlockable emote)
static boolean containsAll (Player player, EmoteUnlockable... emotes)
static void refresh (Player player)
 Handles refreshing the emote tab.
static EmoteUnlockable selectRandom (Player player, EmoteUnlockable... emotes)
static void unlock (Player player, EmoteUnlockable emote)
 Handles unlocking an emote.
static void unlockAll (Player player)
 Handles unlocking all the emotes.
static void updateSkillcape (Player player)
 Updates the skillcape emote.

Detailed Description

This class handles emotes from the emote tab and skill cape.

Author
Daniel | Obey

Definition at line 20 of file EmoteHandler.java.

Member Function Documentation

◆ contains()

boolean com.runehive.content.emote.EmoteHandler.contains ( Player player,
EmoteUnlockable emote )
static

Definition at line 58 of file EmoteHandler.java.

58 {
59 return player.emoteUnlockable.contains(emote);
60 }

References com.runehive.game.world.entity.mob.player.Player.emoteUnlockable.

Referenced by containsAll(), and selectRandom().

Here is the caller graph for this function:

◆ containsAll()

boolean com.runehive.content.emote.EmoteHandler.containsAll ( Player player,
EmoteUnlockable... emotes )
static

Definition at line 62 of file EmoteHandler.java.

62 {
63 for (EmoteUnlockable emote : emotes) {
64 if (!contains(player, emote)) {
65 return false;
66 }
67 }
68 return true;
69 }

References contains().

Referenced by com.runehive.content.itemaction.impl.DrillDemonBox.inventory(), and com.runehive.content.itemaction.impl.MimeBox.inventory().

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

◆ refresh()

void com.runehive.content.emote.EmoteHandler.refresh ( Player player)
static

Handles refreshing the emote tab.

Parameters
playerThe player refreshing the emote tab.

Definition at line 28 of file EmoteHandler.java.

28 {
29 for (Emote emote : Emote.values()) {
30 if (emote.getConfig() != -1) {
31 int flag = emote.activated(player) ? 0 : 1;
32 player.send(new SendConfig(emote.getConfig(), flag));
33 }
34 }
35 updateSkillcape(player);
36 }

References com.runehive.game.world.entity.mob.player.Player.send(), and updateSkillcape().

Referenced by com.runehive.content.itemaction.impl.DrillDemonBox.inventory(), com.runehive.content.itemaction.impl.MimeBox.inventory(), com.runehive.game.world.entity.mob.player.PlayerAssistant.login(), unlock(), and unlockAll().

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

◆ selectRandom()

EmoteUnlockable com.runehive.content.emote.EmoteHandler.selectRandom ( Player player,
EmoteUnlockable... emotes )
static

Definition at line 71 of file EmoteHandler.java.

71 {
72 List<EmoteUnlockable> selected = new ArrayList<>(emotes.length);
73 for (EmoteUnlockable emote : emotes) {
74 if (!contains(player, emote)) {
75 selected.add(emote);
76 }
77 }
78 return selected.isEmpty() ? null : Utility.randomElement(selected);
79 }

References contains(), and com.runehive.util.Utility.randomElement().

Referenced by com.runehive.content.itemaction.impl.DrillDemonBox.inventory(), and com.runehive.content.itemaction.impl.MimeBox.inventory().

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

◆ unlock()

void com.runehive.content.emote.EmoteHandler.unlock ( Player player,
EmoteUnlockable emote )
static

Handles unlocking an emote.

Parameters
playerthe player unlocking the emote.
emoteThe emote being activated.

Definition at line 89 of file EmoteHandler.java.

89 {
90 if (!player.emoteUnlockable.contains(emote)) {
91 player.emoteUnlockable.add(emote);
92 refresh(player);
93 player.send(new SendMessage("Congratulations, you have unlocked the " + Utility.formatEnum(emote.name()) + " emote."));
94 }
95 }

References com.runehive.game.world.entity.mob.player.Player.emoteUnlockable, com.runehive.util.Utility.formatEnum(), refresh(), and com.runehive.game.world.entity.mob.player.Player.send().

Here is the call graph for this function:

◆ unlockAll()

void com.runehive.content.emote.EmoteHandler.unlockAll ( Player player)
static

Handles unlocking all the emotes.

Parameters
playerThe player unlocking all the emotes.

Definition at line 103 of file EmoteHandler.java.

103 {
104 Arrays.stream(EmoteUnlockable.values()).forEach(e -> {
105 if (!player.emoteUnlockable.contains(e)) {
106 player.emoteUnlockable.add(e);
107 }
108 });
109 refresh(player);
110 player.send(new SendMessage("You have successfully unlocked all the emotes."));
111 }

References com.runehive.game.world.entity.mob.player.Player.emoteUnlockable, refresh(), and com.runehive.game.world.entity.mob.player.Player.send().

Here is the call graph for this function:

◆ updateSkillcape()

void com.runehive.content.emote.EmoteHandler.updateSkillcape ( Player player)
static

Updates the skillcape emote.

Parameters
playerThe player instance.

Definition at line 44 of file EmoteHandler.java.

44 {
45 int flag = 1;
46 Item item = player.equipment.get(Equipment.CAPE_SLOT);
47
48 if (item != null) {
49 Skillcape skillcape = Skillcape.forId(item.getId());
50 if (skillcape != null) {
51 flag = 0;
52 }
53 }
54
55 player.send(new SendConfig(1114, flag));
56 }

References com.runehive.game.world.items.containers.equipment.Equipment.CAPE_SLOT, com.runehive.game.world.entity.mob.player.Player.equipment, com.runehive.content.emote.Skillcape.forId(), com.runehive.game.world.items.containers.ItemContainer.get(), com.runehive.game.world.items.Item.getId(), and com.runehive.game.world.entity.mob.player.Player.send().

Referenced by refresh().

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

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