Open timrwwatson opened 1 year ago
The runes and ammunition table doesn't retrieve the multiple quantity values at all:
Having peaked a little at the wiki code i think it could be a rogue character in the table
the ones that seem to be returned in the resources table such as
or
have  
but all the other examples I've clicked through seem to be missing that character, which makes me think the parsing of strings here might be seeing these as two? separate strings, I don't know java particularly.
Other examples that don't have that rogue character:
Apologies for all the spam but found it fun to try to play with some Java as I don't really know much of it. Ripped out the code above and through it into an online compiler and then ran a few examples through it until I get what looks about right, but these are only vardorvis values, unsure what happens further down the pipeline. But left all the printlines in and different values I was messing around.
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.*;
import java.io.Console;
class HelloWorld {
public static void main(String[] args) {
NumberFormat nf = NumberFormat.getNumberInstance();
String quantityStr = "45; 67 ";
//int quantity = 0;
String firstQuantityStr = null;
quantityStr = quantityStr.replaceAll("–", "-").trim();
String quantityStrOut = "";
try {
String[] quantityStrs = quantityStr.replaceAll("\\s+", "").split("-|;");
//String firstQuantityStr = quantityStrs.length > 0 ? quantityStrs[0] : null;
//quantity = quantity = nf.parse(firstQuantityStr).intValue();
if( quantityStrs.length == 1){
quantityStr = quantityStrs[0];
}else if (quantityStrs.length > 1){
quantityStrOut = quantityStrs[0];
for (String quantity : quantityStrs){
if (quantity == quantityStrs[0]) continue;
quantityStrOut+= "; "+ nf.parse(quantity).intValue();
}
}
System.out.println(Arrays.toString(quantityStrs));
System.out.println(quantityStrOut);
} catch (Exception e) {
}
//System.out.println(quantity);
}
}
(Vardorvis)
It seems like when searching the wiki for different quantity values, it sometimes finds both values, sometimes doesn't. Sometimes it lists it as (noted) sometimes (n)
Reference: