mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 11:42:38 +03:00
Updated Converter
This commit is contained in:
@@ -24,7 +24,6 @@ while (my $line = <CFG>) {
|
||||
else {
|
||||
$small = 0;
|
||||
}
|
||||
|
||||
}
|
||||
elsif ($collect == 1 && $line =~ /^\s*\{\s*"(\w*)",\s*"(\w*)"\s*\}/i) {
|
||||
push(@itemType, {
|
||||
@@ -49,7 +48,7 @@ while (my $line = <CFG>) {
|
||||
$cfg .= "\t\titemChance[] = {\n" if $small == 0;
|
||||
$cfg .= "\t\titemChanceSmall[] = {\n" if $small == 1;
|
||||
for (my $i=0; $i<scalar(@itemType); $i++) {
|
||||
$cfg .= sprintf("\t\t\t%s{\"%s\",\"%s\",%.3f}\n", ($i > 0 ? ',' : ''), $itemType[$i]->{Class}, $itemType[$i]->{Type}, $itemChance[$i]);
|
||||
$cfg .= sprintf("\t\t\t%s{\"%s\",\"%s\",%.2f}\n", ($i > 0 ? ',' : ''), $itemType[$i]->{Class}, $itemType[$i]->{Type}, $itemChance[$i]);
|
||||
}
|
||||
$cfg .= "\t\t};\n";
|
||||
}
|
||||
@@ -59,6 +58,8 @@ while (my $line = <CFG>) {
|
||||
}
|
||||
close(CFG);
|
||||
|
||||
$cfg =~ s/(\d+\.\d+)[0]+\}\s*$/$1}/gm;
|
||||
|
||||
open(NEWCFG,'>', $configFile) or die $!;
|
||||
print NEWCFG $cfg;
|
||||
close(NEWCFG);
|
||||
|
||||
@@ -30,7 +30,7 @@ while (my $line = <CFG>) {
|
||||
$collect = 0;
|
||||
|
||||
for (my $i=0; $i<scalar(@itemType); $i++) {
|
||||
$cfg .= sprintf("\t\t%s{\"%s\",%.3f}\n", ($i > 0 ? ',' : ''), $itemType[$i], $itemChance[$i]);
|
||||
$cfg .= sprintf("\t\t%s{\"%s\",%.2f}\n", ($i > 0 ? ',' : ''), $itemType[$i], $itemChance[$i]);
|
||||
}
|
||||
|
||||
$cfg .= "\t};\n";
|
||||
@@ -41,6 +41,8 @@ while (my $line = <CFG>) {
|
||||
}
|
||||
close(CFG);
|
||||
|
||||
$cfg =~ s/(\d+\.\d+)[0]+\}\s*$/$1}/gm;
|
||||
|
||||
open(NEWCFG,'>', $configFile) or die $!;
|
||||
print NEWCFG $cfg;
|
||||
close(NEWCFG);
|
||||
|
||||
Reference in New Issue
Block a user