-
Notifications
You must be signed in to change notification settings - Fork 17
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 suggestion regex for open prefix/suffix on any item #60
Comments
Thanks for the suggestion! Ah, the request for flasks is something I want to do, just not done due to time constraints. Is the ability to roll cloaks with specific needs for heist what you need? Is the open prefix/suffix part important, or is what is needed a way to roll heist gear in general? (like hitting that +1 all jobs). |
So the idea on the Cloaks is to roll : Similarly all the heist tools have : But I am usually too lazy to write the possible best prefix/suffix associated mods so if it was possible to choose which ones you want to add it will be great. |
Nice. I think I better understand the use-case. This would fit well under the heist page, I will work on this when I have time. But it am prioritizing improving the flask page first, but I'll get to this feature. I have a regex generator, so a lot of it is automated, luckily :D |
Out of curiosity, can I ask you what regex generator you are using. |
Its not very optimized in my case, but it runs fast enough (it uses around 1s for around 2000-5000 inputs), but it needs to be pre-processed, so thats why I generate all the regex files upfront. The code (written in Kotlin) is the core part of the generator: fun shortestUnique(query: String, modifiers: List<String>): String {
val cleanQuery = query.cleanInput()
val mods = modifiers.filter { it != query }.joinToString(" ")
.cleanInput()
val resultWithSpace = subStrings(cleanQuery).firstOrNull {
!mods.contains(it)
&& !it.contains(Regex("[|\\n\\\\+]"))
&& !it.endsWith(" ")
}
val resultWithoutSpace = subStrings(cleanQuery).firstOrNull {
!mods.contains(it)
&& !it.contains(" ")
&& !it.contains("-")
&& !it.contains("|")
&& !it.contains("\\")
&& !it.contains("+")
&& !it.endsWith(" ")
}
val spaceLength = resultWithSpace?.length ?: 1000
val nospaceLength = resultWithoutSpace?.length ?: 1000
val regexResult = if (nospaceLength <= spaceLength + 2) resultWithoutSpace else "\"$resultWithSpace\""
val finalResult = regexResult ?: query
val finalWithoutNumbers = finalResult.replace("#", "\\\\d+")
return if (finalWithoutNumbers.contains(" ") && !finalWithoutNumbers.startsWith("\"")) {
"\"$finalWithoutNumbers\""
} else {
finalWithoutNumbers
}
}
fun subStrings(str: String, n: Int = str.length): List<String> {
val substrings = mutableListOf<String>()
for (i in 0 until n) for (j in i + 1..n) {
substrings.add(str.substring(i, j))
}
substrings.sortBy { it.length }
return substrings
} If performance had been an issue I could have made the function |
Just to clarify on the reason why this is generated and not done at client: The generating will take a long time regardless on how well the shortest unique part of the algorithm is running. The thing that takes the most time is fetching all the input the shortest string algorithm needs. For gwennen you need a list of all the unique items in the game, as well as real time data from poe.ninja, this would take a lot of time to do when you enter the page, so all this is prepossessed, generated and cached before the client enters the page. |
Thanks for the code, I don't know Kotlin but I can guess more or less what is happening. Otherwise I did not see the page for flask but yeah it will be the same idea, besides adding a possibility to lock an open prefix or suffix. |
First of all thank you for making this website available.
Seeing the gwennen regex website I had thought how cool it would be to make on for anything in Poe but I would never have been able to make such a nice tool.
One of the reason I wanted to make it is to roll heist items.
Open prefix is
^\s*Name_of_item
Open suffix is
$\s*Name_of_item
Every league I manually roll Choreography on cloacks and +1 to all jobs on each tools , the regex are not long to write but annoying.
Bonus points when your website already calculate possibilities to squeeze as many possible regex for certain mods with character limit in mind.
Sorry I see someone made the same demand for flask months ago so maybe you are not keen on doing it.
The text was updated successfully, but these errors were encountered: