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

Public Member Functions

void decreaseDust (Player player)
 Handles decreasing the dust for a star.
void decreaseLevel ()
 Handles the decreasing of the star level.
void destruct ()
 Handles removing the star from the game.
String getHint ()
 The current hint of the star location.
int getLevel ()
 Gets the random star level.
String getLocationName ()
 The current location of the star.
int getMiningLevel ()
 The required mining level for the star level.
int getObjectId ()
 The current object id.
int getPercentage ()
 Percentage till the next star level.
int getXPDrop ()
 The xp the player gets for the current star.
 ShootingStarData ()

Public Attributes

int availableDust
 How much dust there currently is in the star.
int[] doubleChance = { 2, 6, 12, 20, 30, 42, 56, 72, 90 }
 The chance of doubling stardust depending on the star level.
int maxDust
 The max dust for this star level.
int[] possibleDust = { 1200, 700, 430, 250, 175, 80, 40, 40, 15 }
 The amount of star dust the player receives for the different star levels.
int[] starIds = { 41229, 41228, 41227, 41226, 41225, 41224, 41223, 41021, }
 All the possible object ids for the different star levels.
int starLevel
 The current level of the star.
ShootingStarLocations starLocation
 The current location of the star.
CustomGameObject starObject
 The game object linked to the star.
int[] xpDrops = { 12, 22, 26, 31, 48, 74, 123, 162, 244 }
 Possible xp drops for the differernt star levels.

Private Attributes

boolean decreaseDouble = false
 See if the dust needs to be removed double.

Detailed Description

Definition at line 11 of file ShootingStarData.java.

Constructor & Destructor Documentation

◆ ShootingStarData()

com.runehive.content.shootingstar.ShootingStarData.ShootingStarData ( )

Definition at line 63 of file ShootingStarData.java.

63 {
64 starLevel = getLevel();
65 maxDust = possibleDust[starLevel];
66 availableDust = maxDust;
67 starLocation = ShootingStarLocations.values()[RandomUtils.inclusive(0, ShootingStarLocations.values().length - 1)];
68
69 System.out.println("starLocation.starPosition " + starLocation.starPosition);
70 starObject = new CustomGameObject(getObjectId(), starLocation.starPosition);
71 starObject.register();
72 }

References availableDust, getLevel(), getObjectId(), com.runehive.util.RandomUtils.inclusive(), maxDust, possibleDust, starLevel, starLocation, and starObject.

Here is the call graph for this function:

Member Function Documentation

◆ decreaseDust()

void com.runehive.content.shootingstar.ShootingStarData.decreaseDust ( Player player)

Handles decreasing the dust for a star.

Definition at line 77 of file ShootingStarData.java.

77 {
78 player.skills.addExperience(Skill.MINING, getXPDrop() * Config.MINING_MODIFICATION);
79 int amount = 1;
80
81 //Handles the double stardust chance
82 int roll = RandomUtils.inclusive(0, 100);
83 if(roll <= doubleChance[starLevel]) amount *= 2;
84
85 player.inventory.add(new Item(25527, amount));
86 availableDust -= decreaseDouble ? amount : amount / 2;
87
88 if(availableDust <= 0) {
89 decreaseLevel();
90 for(Player p : World.getPlayers()) {
91 if(p == null || !(p.action.getCurrentAction() instanceof ShootingStarAction)) continue;
92
93 System.out.println("Reset the mining action for all the players with a shooting star action...");
94 p.action.cancel();
95 p.resetFace();
96 p.skills.get(Skill.MINING).setDoingSkill(false);
97 }
98 }
99 }

References com.runehive.game.world.items.containers.ItemContainer.add(), com.runehive.game.world.entity.skill.SkillManager.addExperience(), availableDust, decreaseDouble, decreaseLevel(), doubleChance, com.runehive.game.world.World.getPlayers(), getXPDrop(), com.runehive.util.RandomUtils.inclusive(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.skill.Skill.MINING, com.runehive.Config.MINING_MODIFICATION, com.runehive.game.world.entity.mob.Mob.skills, and starLevel.

Referenced by com.runehive.content.shootingstar.ShootingStarAction.mine().

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

◆ decreaseLevel()

void com.runehive.content.shootingstar.ShootingStarData.decreaseLevel ( )

Handles the decreasing of the star level.

Definition at line 104 of file ShootingStarData.java.

104 {
105 starLevel--;
106 if(starLevel < 0) {
107 destruct();
108 return;
109 }
110
111 maxDust = possibleDust[starLevel];
112 availableDust = maxDust;
113 starObject.transform(getObjectId());
114 }

References availableDust, destruct(), getObjectId(), maxDust, possibleDust, starLevel, and starObject.

Referenced by decreaseDust().

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

◆ destruct()

void com.runehive.content.shootingstar.ShootingStarData.destruct ( )

Handles removing the star from the game.

Definition at line 119 of file ShootingStarData.java.

119 {
120 starObject.unregister();
121 starObject = null;
122 }

References starObject.

Referenced by decreaseLevel().

Here is the caller graph for this function:

◆ getHint()

String com.runehive.content.shootingstar.ShootingStarData.getHint ( )

The current hint of the star location.

Returns

Definition at line 183 of file ShootingStarData.java.

183 {
184 return starLocation.location[1];
185 }

References starLocation.

◆ getLevel()

int com.runehive.content.shootingstar.ShootingStarData.getLevel ( )

Gets the random star level.

Returns

Definition at line 128 of file ShootingStarData.java.

128 {
129 int[] chances = { 0, 16, 18, 20, 17, 12, 9, 5 }; //, 3
130
131 for (int index = chances.length - 1; index > 0; index--) {
132 int roll = RandomUtils.inclusive(0, 100);
133 if (roll < chances[index])
134 return index;
135 }
136 return 2;
137 }
val index

References com.runehive.util.RandomUtils.inclusive().

Referenced by ShootingStarData().

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

◆ getLocationName()

String com.runehive.content.shootingstar.ShootingStarData.getLocationName ( )

The current location of the star.

Returns

Definition at line 175 of file ShootingStarData.java.

175 {
176 return starLocation.location[0];
177 }

References starLocation.

◆ getMiningLevel()

int com.runehive.content.shootingstar.ShootingStarData.getMiningLevel ( )

The required mining level for the star level.

Returns

Definition at line 151 of file ShootingStarData.java.

151 {
152 return (starLevel + 1) * 10;
153 }

References starLevel.

Referenced by com.runehive.content.shootingstar.ShootingStarAction.mine().

Here is the caller graph for this function:

◆ getObjectId()

int com.runehive.content.shootingstar.ShootingStarData.getObjectId ( )

The current object id.

Returns

Definition at line 143 of file ShootingStarData.java.

143 {
144 return starIds[starLevel];
145 }

References starIds, and starLevel.

Referenced by decreaseLevel(), and ShootingStarData().

Here is the caller graph for this function:

◆ getPercentage()

int com.runehive.content.shootingstar.ShootingStarData.getPercentage ( )

Percentage till the next star level.

Returns

Definition at line 159 of file ShootingStarData.java.

159 {
160 return (maxDust - availableDust) * 100 / maxDust;
161 }

References availableDust, and maxDust.

◆ getXPDrop()

int com.runehive.content.shootingstar.ShootingStarData.getXPDrop ( )

The xp the player gets for the current star.

Returns

Definition at line 167 of file ShootingStarData.java.

167 {
168 return xpDrops[starLevel];
169 }

References starLevel, and xpDrops.

Referenced by decreaseDust().

Here is the caller graph for this function:

Member Data Documentation

◆ availableDust

int com.runehive.content.shootingstar.ShootingStarData.availableDust

How much dust there currently is in the star.

Definition at line 31 of file ShootingStarData.java.

Referenced by decreaseDust(), decreaseLevel(), getPercentage(), com.runehive.content.shootingstar.ShootingStarAction.mine(), and ShootingStarData().

◆ decreaseDouble

boolean com.runehive.content.shootingstar.ShootingStarData.decreaseDouble = false
private

See if the dust needs to be removed double.

Definition at line 16 of file ShootingStarData.java.

Referenced by decreaseDust().

◆ doubleChance

int [] com.runehive.content.shootingstar.ShootingStarData.doubleChance = { 2, 6, 12, 20, 30, 42, 56, 72, 90 }

The chance of doubling stardust depending on the star level.

Definition at line 61 of file ShootingStarData.java.

61{ 2, 6, 12, 20, 30, 42, 56, 72, 90 };

Referenced by decreaseDust().

◆ maxDust

int com.runehive.content.shootingstar.ShootingStarData.maxDust

The max dust for this star level.

Definition at line 36 of file ShootingStarData.java.

Referenced by decreaseLevel(), getPercentage(), and ShootingStarData().

◆ possibleDust

int [] com.runehive.content.shootingstar.ShootingStarData.possibleDust = { 1200, 700, 430, 250, 175, 80, 40, 40, 15 }

The amount of star dust the player receives for the different star levels.

Definition at line 46 of file ShootingStarData.java.

46{ 1200, 700, 430, 250, 175, 80, 40, 40, 15 };

Referenced by decreaseLevel(), and ShootingStarData().

◆ starIds

int [] com.runehive.content.shootingstar.ShootingStarData.starIds = { 41229, 41228, 41227, 41226, 41225, 41224, 41223, 41021, }

All the possible object ids for the different star levels.

Definition at line 41 of file ShootingStarData.java.

41{ 41229, 41228, 41227, 41226, 41225, 41224, 41223, 41021, };

Referenced by getObjectId().

◆ starLevel

int com.runehive.content.shootingstar.ShootingStarData.starLevel

The current level of the star.

Definition at line 26 of file ShootingStarData.java.

Referenced by decreaseDust(), decreaseLevel(), getMiningLevel(), getObjectId(), getXPDrop(), and ShootingStarData().

◆ starLocation

ShootingStarLocations com.runehive.content.shootingstar.ShootingStarData.starLocation

The current location of the star.

Definition at line 21 of file ShootingStarData.java.

Referenced by getHint(), getLocationName(), and ShootingStarData().

◆ starObject

CustomGameObject com.runehive.content.shootingstar.ShootingStarData.starObject

The game object linked to the star.

Definition at line 56 of file ShootingStarData.java.

Referenced by decreaseLevel(), destruct(), and ShootingStarData().

◆ xpDrops

int [] com.runehive.content.shootingstar.ShootingStarData.xpDrops = { 12, 22, 26, 31, 48, 74, 123, 162, 244 }

Possible xp drops for the differernt star levels.

Definition at line 51 of file ShootingStarData.java.

51{ 12, 22, 26, 31, 48, 74, 123, 162, 244 };

Referenced by getXPDrop().


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