mirror of
https://github.com/Auxilor/EcoJobs.git
synced 2025-12-20 15:39:26 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5eea9549f | ||
|
|
744f5bf4b0 | ||
|
|
1a6c879305 | ||
|
|
682446aa90 | ||
|
|
2e2f44a387 |
@@ -17,6 +17,7 @@ import com.willfp.eco.util.NumberUtils
|
|||||||
import com.willfp.eco.util.NumberUtils.evaluateExpression
|
import com.willfp.eco.util.NumberUtils.evaluateExpression
|
||||||
import com.willfp.eco.util.formatEco
|
import com.willfp.eco.util.formatEco
|
||||||
import com.willfp.eco.util.toNiceString
|
import com.willfp.eco.util.toNiceString
|
||||||
|
import com.willfp.eco.util.toNumeral
|
||||||
import com.willfp.ecojobs.EcoJobsPlugin
|
import com.willfp.ecojobs.EcoJobsPlugin
|
||||||
import com.willfp.ecojobs.api.activeJobs
|
import com.willfp.ecojobs.api.activeJobs
|
||||||
import com.willfp.ecojobs.api.canJoinJob
|
import com.willfp.ecojobs.api.canJoinJob
|
||||||
@@ -310,8 +311,9 @@ class Job(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun injectPlaceholdersInto(lore: List<String>, player: Player, forceLevel: Int? = null): List<String> {
|
fun injectPlaceholdersInto(lore: List<String>, player: Player, forceLevel: Int? = null): List<String> {
|
||||||
val withPlaceholders = lore.map {
|
val withPlaceholders = lore.map { line ->
|
||||||
it.replace("%percentage_progress%", (player.getJobProgress(this) * 100).toNiceString())
|
var result = line
|
||||||
|
.replace("%percentage_progress%", (player.getJobProgress(this) * 100).toNiceString())
|
||||||
.replace("%current_xp%", player.getJobXP(this).toNiceString())
|
.replace("%current_xp%", player.getJobXP(this).toNiceString())
|
||||||
.replace("%required_xp%", this.getFormattedExpForLevel(player.getJobLevel(this) + 1))
|
.replace("%required_xp%", this.getFormattedExpForLevel(player.getJobLevel(this) + 1))
|
||||||
.replace("%description%", this.description).replace("%job%", this.name)
|
.replace("%description%", this.description).replace("%job%", this.name)
|
||||||
@@ -319,6 +321,20 @@ class Job(
|
|||||||
.replace("%level_numeral%", NumberUtils.toNumeral(forceLevel ?: player.getJobLevel(this)))
|
.replace("%level_numeral%", NumberUtils.toNumeral(forceLevel ?: player.getJobLevel(this)))
|
||||||
.replace("%join_price%", this.joinPrice.getDisplay(player))
|
.replace("%join_price%", this.joinPrice.getDisplay(player))
|
||||||
.replace("%leave_price%", this.leavePrice.getDisplay(player))
|
.replace("%leave_price%", this.leavePrice.getDisplay(player))
|
||||||
|
|
||||||
|
val level = forceLevel ?: player.getJobLevel(this)
|
||||||
|
val regex = Regex("%level_(-?\\d+)(_numeral)?%")
|
||||||
|
|
||||||
|
// Handle dynamic %level_X% and %level_X_numeral%
|
||||||
|
result = regex.replace(result) { match ->
|
||||||
|
val offset = match.groupValues[1].toIntOrNull() ?: return@replace match.value
|
||||||
|
val isNumeral = match.groupValues[2].isNotEmpty()
|
||||||
|
val newLevel = level + offset
|
||||||
|
|
||||||
|
if (isNumeral) newLevel.toNumeral() else newLevel.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
|
|
||||||
val processed = mutableListOf<List<String>>()
|
val processed = mutableListOf<List<String>>()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#libreforge-updater
|
#libreforge-updater
|
||||||
#Sat Mar 29 14:21:51 GMT 2025
|
#Fri Aug 01 10:03:49 BST 2025
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
libreforge-version=4.75.0
|
libreforge-version=4.77.0
|
||||||
version=3.73.0
|
version=3.75.0
|
||||||
|
|||||||
Reference in New Issue
Block a user