kLabMouse wrote:Technology wrote:Maybe kore should also accept the name_with_underscores notation?
Or may-be name in "..." or '...' like: "Bowman Scroll 4"
how about using "itemname"
like this
change on script src/FileParsers.pm
Code: Select all
($key, $args) = lc($line) =~ /([\s\S]+?)[\s]+(\d+[\s\S]*)/;
change to
Code: Select all
if ($line =~ /"/) {
($key, $args_text) = $line =~ /^"([\s\S]+?)" (\d+[\s\S]*)/i;
}
else {
($key, $args_text) = $line =~ /^([\s\S]+?) (\d+[\s\S]*)/i;
}
FileParsers.pm
Code: Select all
sub parseItemsControl {
my $file = shift;
my $r_hash = shift;
undef %{$r_hash};
my ($key, $args_text, %cache);
my $reader = new Utils::TextReader($file);
while (!$reader->eof()) {
my $line = $reader->readLine();
$line =~ s/\x{FEFF}//g;
next if ($line =~ /^#/);
$line =~ s/[\r\n]//g;
$line =~ s/\s+$//g;
if ($line =~ /"/) {
($key, $args_text) = $line =~ /^"([\s\S]+?)" (\d+[\s\S]*)/i;
}
else {
($key, $args_text) = $line =~ /^([\s\S]+?) (\d+[\s\S]*)/i;
}
next if ($key eq "");
if ($cache{$args_text}) {
$r_hash->{$key} = $cache{$args_text};
} else {
my @args = split / /, $args_text;
my %item = (
keep => $args[0],
storage => $args[1],
sell => $args[2],
cart_add => $args[3],
cart_get => $args[4]
);
# Cache similar entries to save memory.
$r_hash->{$key} = $cache{$args_text} = \%item;
}
}
return 1;
}