RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.shootingstar.ShootingStar Class Reference
Collaboration diagram for com.runehive.content.shootingstar.ShootingStar:

Static Public Member Functions

static void init ()
 Handles initializing the shooting stars event.
static void mine (Player player, GameObject o)
 Handles the mine option of the shooting star.
static void prospect (Player player)
 Handles prospecting the shooting star.

Static Public Attributes

static ShootingStarData shootingStarData
 The current data of the shooting star.
static boolean starHasBeenFound = false
 Checks if the star has been found before.
static int starTick = 30
 Ticks till the next shooting star will spawn.

Static Private Attributes

static final Logger logger = LogManager.getLogger(ShootingStar.class)

Detailed Description

Definition at line 13 of file ShootingStar.java.

Member Function Documentation

◆ init()

void com.runehive.content.shootingstar.ShootingStar.init ( )
static

Handles initializing the shooting stars event.

Definition at line 92 of file ShootingStar.java.

92 {
93 logger.info("Loaded Shooting Stars event.");
94 World.schedule(new Task(1) {
95 @Override
96 protected void execute() {
97 starTick--;
98 if(starTick <= 0) {
99 if(shootingStarData != null) {
100 shootingStarData.destruct();
101 starHasBeenFound = false;
102 }
103
104 shootingStarData = new ShootingStarData();
105 World.sendMessage("@red@A shooting star has just crashed " + shootingStarData.getHint() +" " + shootingStarData.getLocationName() + "!");
106 // DiscordPlugin.sendSimpleMessage("A shooting star has just crashed " + shootingStarData.getHint() +" " + shootingStarData.getLocationName() + "!");
107 //4 Hours in ticks
108 starTick = 24_000;
109 }
110 }
111
112 @Override
113 protected void onCancel(boolean logout) {
114 }
115 });
116 }

References logger, com.runehive.game.world.World.schedule(), com.runehive.game.world.World.sendMessage(), shootingStarData, starHasBeenFound, and starTick.

Here is the call graph for this function:

◆ mine()

void com.runehive.content.shootingstar.ShootingStar.mine ( Player player,
GameObject o )
static

Handles the mine option of the shooting star.

Parameters
player

Definition at line 36 of file ShootingStar.java.

36 {
37 if(!starHasBeenFound) {
38 starHasBeenFound = true;
39 player.dialogueFactory.sendStatement("Congratulations! You were the first person to find this star!").execute();
40 player.skills.addExperience(14, 10000);
41 return;
42 }
43
44 PickaxeData pickaxe = PickaxeData.getBestPickaxe(player).orElse(null);
45
46 if(pickaxe == null) {
47 player.message("You don't have a pickaxe.");
48 return;
49 }
50
51 if (!player.skills.get(Skill.MINING).reqLevel(pickaxe.level)) {
52 player.message("You need a level of " + pickaxe.level + " to use this pickaxe!");
53 return;
54 }
55
56 if(!player.skills.get(Skill.MINING).reqLevel(shootingStarData.getMiningLevel())) {
57 player.dialogueFactory.sendStatement("You need a Mining level of " + shootingStarData.getMiningLevel() + " to mine here.").execute();
58 return;
59 }
60
61 if(!player.inventory.hasCapacityFor(new Item(25527))) {
62 player.message("Not enough space in your inventory.");
63 return;
64 }
65
66 player.message("You swing your pick at the rock.");
67
68 player.animate(pickaxe.animation);
69
70 player.action.execute(new ShootingStarAction(player, pickaxe, o));
71 player.skills.get(Skill.MINING).setDoingSkill(true);
72 }

References com.runehive.game.world.entity.mob.Mob.action, com.runehive.game.world.entity.skill.SkillManager.addExperience(), com.runehive.game.world.entity.mob.Mob.animate(), com.runehive.content.skill.impl.mining.PickaxeData.animation, com.runehive.game.world.entity.mob.player.Player.dialogueFactory, com.runehive.content.dialogue.DialogueFactory.execute(), com.runehive.game.action.ActionManager.execute(), com.runehive.game.world.entity.skill.SkillManager.get(), com.runehive.content.skill.impl.mining.PickaxeData.getBestPickaxe(), com.runehive.game.world.items.containers.ItemContainer.hasCapacityFor(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.content.skill.impl.mining.PickaxeData.level, com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.game.world.entity.skill.Skill.MINING, com.runehive.game.world.entity.skill.Skill.reqLevel(), com.runehive.content.dialogue.DialogueFactory.sendStatement(), com.runehive.game.world.entity.skill.Skill.setDoingSkill(), shootingStarData, com.runehive.game.world.entity.mob.Mob.skills, and starHasBeenFound.

Here is the call graph for this function:

◆ prospect()

void com.runehive.content.shootingstar.ShootingStar.prospect ( Player player)
static

Handles prospecting the shooting star.

Parameters
player

Definition at line 78 of file ShootingStar.java.

78 {
79 if(!starHasBeenFound) {
80 starHasBeenFound = true;
81 player.dialogueFactory.sendStatement("Congratulations! You were the first person to find this star!", "You have been granted 10,000 mining xp!").execute();
82 player.skills.addExperience(14, 10000);
83 return;
84 }
85
86 player.dialogueFactory.sendStatement("This is a size-"+(shootingStarData.starLevel + 1)+" star. A Mining level of at least "+shootingStarData.getMiningLevel()+" is required to", "mine this layer. It has been mined "+shootingStarData.getPercentage()+"% of the way to the next layer.").execute();
87 }

References com.runehive.game.world.entity.skill.SkillManager.addExperience(), com.runehive.game.world.entity.mob.player.Player.dialogueFactory, com.runehive.content.dialogue.DialogueFactory.execute(), com.runehive.content.dialogue.DialogueFactory.sendStatement(), shootingStarData, com.runehive.game.world.entity.mob.Mob.skills, and starHasBeenFound.

Here is the call graph for this function:

Member Data Documentation

◆ logger

final Logger com.runehive.content.shootingstar.ShootingStar.logger = LogManager.getLogger(ShootingStar.class)
staticprivate

Definition at line 15 of file ShootingStar.java.

Referenced by init().

◆ shootingStarData

ShootingStarData com.runehive.content.shootingstar.ShootingStar.shootingStarData
static

The current data of the shooting star.

Definition at line 25 of file ShootingStar.java.

Referenced by init(), mine(), com.runehive.content.shootingstar.ShootingStarAction.mine(), and prospect().

◆ starHasBeenFound

boolean com.runehive.content.shootingstar.ShootingStar.starHasBeenFound = false
static

Checks if the star has been found before.

Definition at line 20 of file ShootingStar.java.

Referenced by init(), mine(), and prospect().

◆ starTick

int com.runehive.content.shootingstar.ShootingStar.starTick = 30
static

Ticks till the next shooting star will spawn.

Definition at line 30 of file ShootingStar.java.

Referenced by init().


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