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