Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Fann pet leveling costs Coins/XP and XP/Bits #2604

Open
wants to merge 13 commits into
base: beta
Choose a base branch
from

Conversation

minhperry
Copy link
Contributor

@minhperry minhperry commented Sep 26, 2024

What

https://discord.com/channels/997079228510117908/1192656223741427804

Images

image

image

Changelog New Features

  • Added Fann leveling cost coins per XP and XP per bit. - minhperry

@minhperry minhperry marked this pull request as ready for review September 27, 2024 14:53
@hannibal002 hannibal002 added this to the Version 0.28 milestone Sep 28, 2024
Comment on lines +128 to +139
// To avoid duplicate code
private fun <T> Pattern.read(lore: List<String>, func: (String) -> T): T? {
for (line in lore) {
val linePlain = line.removeColor()
val matcher = matcher(linePlain)
if (matcher.find()) {
val res = matcher.group(1)
return func(res)
}
}
return null
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im sure a function that does this is already in RegexUtils

Comment on lines +165 to +167
for (line in this) {
val linePlain = line.removeColor()
val matcher = durationPattern.matcher(linePlain)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use Pattern.firstMatcher(list)

Comment on lines +118 to +126
private fun MutableList<String>.insertLineAfter(pattern: Pattern, content: String) {
val iter = this.listIterator()
while (iter.hasNext()) {
val line = iter.next().removeColor()
if (pattern.matcher(line).find()) {
iter.add(content)
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a cool function that could be used elsewhere in the mod, maybe move it to a utils class such as collection utils

Comment on lines 25 to 64
private val trainingSlotInventoryPattern by patternGroup.pattern(
"training",
"Training Slot [1-3]",
)
private val anvilPattern by patternGroup.pattern(
"anvil",
"§aBegin Training",
)
private val expEarnedPattern by patternGroup.pattern(
"exp.total",
"""Will earn a total of (\d{1,3}(?:,\d{3})*(?:\.\d+)?|\d+\.?\d*) EXP\.?""",
)
private val dailyExpPattern by patternGroup.pattern(
"exp.daily",
"""EXP Per Day: ([\d,]+)(?: \(\+\d{1,2}(\.\d{1,2})?%\))?""",
)
private val durationPattern by patternGroup.pattern(
"training.duration.pattern",
"""Will take: (?<day>\d+)d (?<hr>\d{1,2})h (?<min>\d{1,2})m (?<sec>\d{1,2})s""",
)
private val coinsPattern by patternGroup.pattern(
"coin",
"""(\d{1,3}(?:,\d{3})*(?:\.\d+)?|\d+\.?\d*) Coins(?: \([1-5]% off\))?""",
)
private val bitsPattern by patternGroup.pattern(
"bits",
"""(\d{1,3}(?:,\d{3})*(?:\.\d+)?|\d+\.?\d*) Bits""",
)
private val desiredLevelPatter by patternGroup.pattern(
"slot24.name.level",
"Desired Level: (200|1?[0-9]?[0-9])",
)
private val userInputPattern by patternGroup.pattern(
"slot24.name.input",
"User Input",
)
private val trainingTypePattern by patternGroup.pattern(
"training.type",
"Type: (Free|Light|Moderate|Expert|Ultra|Turbo!)",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of these need regex tests, they also need named pattern groups and none of them should include triple quotes

@github-actions github-actions bot added the Merge Conflicts There are open merge conflicts with the beta branch. label Oct 22, 2024
Copy link

This pull request has conflicts with the base branch "beta". Please resolve those so we can test out your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge Conflicts There are open merge conflicts with the beta branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants