Change star discovery bonus xp to be gradually disbursed instead of lump-sump.

This commit is contained in:
Avi Weinstock 2021-12-08 23:15:14 +00:00 committed by Ceikry
parent 2afb484c07
commit d3fc957356
3 changed files with 21 additions and 6 deletions

View file

@ -66,4 +66,5 @@
- Add remote kicking support to the Management Server - Add remote kicking support to the Management Server
- Added Christmas Event :) - Added Christmas Event :)
- Added snow toggle to client config - Added snow toggle to client config
< --- ABOVE Released December 4, 2021 https://gitlab.com/2009scape/2009scape/-/tags/Dec-4-2021 ---- > < --- ABOVE Released December 4, 2021 https://gitlab.com/2009scape/2009scape/-/tags/Dec-4-2021 ---- >
- Shooting star discovery bonus xp is now gradually disbursed instead of lump-sump.

View file

@ -34,8 +34,10 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin
} }
//checks if the star has been discovered and if not, awards the bonus xp. Xp can be awarded regardless of mining level as per the wiki. //checks if the star has been discovered and if not, awards the bonus xp. Xp can be awarded regardless of mining level as per the wiki.
if (!star.isDiscovered) { if (!star.isDiscovered) {
player.skills.addExperience(Skills.MINING, 75 * player.skills.getStaticLevel(Skills.MINING).toDouble()) val bonusXp = 75 * player.skills.getStaticLevel(Skills.MINING)
player.incrementAttribute("/save:shooting-star:bonus-xp", bonusXp)
Repository.sendNews(player.username + " is the discoverer of the crashed star near " + star.location + "!") Repository.sendNews(player.username + " is the discoverer of the crashed star near " + star.location + "!")
player.sendMessage("You have ${player.skills.experienceMutiplier * player.getAttribute("shooting-star:bonus-xp", 0).toDouble()} bonus xp towards mining stardust.")
ScoreboardManager.submit(player) ScoreboardManager.submit(player)
star.isDiscovered = true star.isDiscovered = true
return player.skills.getLevel(Skills.MINING) >= star.miningLevel return player.skills.getLevel(Skills.MINING) >= star.miningLevel
@ -71,7 +73,19 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin
star.dustLeft = 1 star.dustLeft = 1
} }
star.decDust() star.decDust()
player.skills.addExperience(Skills.MINING,star.level.exp.toDouble())
val bonusXp = player.getAttribute("shooting-star:bonus-xp", 0).toDouble()
var xp = star.level.exp.toDouble()
if(bonusXp > 0) {
val delta = Math.min(bonusXp, xp)
player.incrementAttribute("/save:shooting-star:bonus-xp", (-delta).toInt())
xp += delta;
if(player.getAttribute("shooting-star:bonus-xp", 0) <= 0) {
player.sendMessage("You have obtained all of your bonus xp from the star.")
}
}
player.skills.addExperience(Skills.MINING, xp)
if (ShootingStarOptionHandler.getStarDust(player) < 200) { if (ShootingStarOptionHandler.getStarDust(player) < 200) {
player.inventory.add(Item(ShootingStarOptionHandler.STAR_DUST, 1)) player.inventory.add(Item(ShootingStarOptionHandler.STAR_DUST, 1))
} }
@ -118,4 +132,4 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin
val clientRatio: Double = Math.random() * ((level - star.miningLevel) * (1.0 + tool.ratio)) val clientRatio: Double = Math.random() * ((level - star.miningLevel) * (1.0 + tool.ratio))
return hostRatio < clientRatio return hostRatio < clientRatio
} }
} }

View file

@ -271,7 +271,7 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) {
ContentAPI.addItem(player, bonusId, bonusBaseAmt) ContentAPI.addItem(player, bonusId, bonusBaseAmt)
ContentAPI.sendMessage(player, colorize("%RYour ring shines brightly as if surging with energy and then fades out.")) ContentAPI.sendMessage(player, colorize("%RYour ring shines brightly as if surging with energy and then fades out."))
} else if(RandomFunction.roll(25)){ } else if(RandomFunction.roll(25)){
player.savedData.globalData.starSpriteDelay = 0L getStoreFile()[player.username.toLowerCase()] = false //flag daily as uncompleted
ContentAPI.sendMessage(player, colorize("%RYour ring vibrates briefly as if surging with power, and then stops.")) ContentAPI.sendMessage(player, colorize("%RYour ring vibrates briefly as if surging with power, and then stops."))
} }
} }
@ -280,4 +280,4 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) {
return ServerStore.getArchive("daily-shooting-star") return ServerStore.getArchive("daily-shooting-star")
} }
} }