9
0
mirror of https://github.com/Auxilor/EcoJobs.git synced 2025-12-19 23:19:16 +00:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Will FP
d5eea9549f libreforge-updater 2025-08-01 10:03:49 +01:00
Will FP
744f5bf4b0 Merge pull request #37 from Exanthiax/master
Update Job.kt
2025-08-01 09:40:03 +01:00
Exanthiax
1a6c879305 Update Job.kt 2025-07-16 18:32:52 +01:00
Will FP
682446aa90 libreforge-updater 2025-07-05 16:44:53 +01:00
Will FP
2e2f44a387 libreforge-updater 2025-07-04 09:49:51 +01:00
2 changed files with 21 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ import com.willfp.eco.util.NumberUtils
import com.willfp.eco.util.NumberUtils.evaluateExpression
import com.willfp.eco.util.formatEco
import com.willfp.eco.util.toNiceString
import com.willfp.eco.util.toNumeral
import com.willfp.ecojobs.EcoJobsPlugin
import com.willfp.ecojobs.api.activeJobs
import com.willfp.ecojobs.api.canJoinJob
@@ -310,8 +311,9 @@ class Job(
}
fun injectPlaceholdersInto(lore: List<String>, player: Player, forceLevel: Int? = null): List<String> {
val withPlaceholders = lore.map {
it.replace("%percentage_progress%", (player.getJobProgress(this) * 100).toNiceString())
val withPlaceholders = lore.map { line ->
var result = line
.replace("%percentage_progress%", (player.getJobProgress(this) * 100).toNiceString())
.replace("%current_xp%", player.getJobXP(this).toNiceString())
.replace("%required_xp%", this.getFormattedExpForLevel(player.getJobLevel(this) + 1))
.replace("%description%", this.description).replace("%job%", this.name)
@@ -319,6 +321,20 @@ class Job(
.replace("%level_numeral%", NumberUtils.toNumeral(forceLevel ?: player.getJobLevel(this)))
.replace("%join_price%", this.joinPrice.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()
val processed = mutableListOf<List<String>>()

View File

@@ -1,5 +1,5 @@
#libreforge-updater
#Sat Mar 29 14:21:51 GMT 2025
#Fri Aug 01 10:03:49 BST 2025
kotlin.code.style=official
libreforge-version=4.75.0
version=3.73.0
libreforge-version=4.77.0
version=3.75.0