README.md edited online with Bitbucket
[swg-src.git] / dsrc / sku.0 / sys.server / compiled / game / datatables / ship / balance_space_loot.pl
blob587f0026311c937a9f1af2c40d44ec0bec9cd1ea
1 #!/usr/bin/perl
3 # Constants
5 $balance_sheet = "ship_balance.txt";
6 $loot_sheet = "looted_component_balance.txt";
7 $weapon_loot = "components\\weapon.tab";
9 $server_prefix = "\\swg\\current\\dsrc\\sku.0\\sys.server\\compiled\\game\\object\\tangible\\ship\\components";
10 $shared_prefix = "\\swg\\current\\dsrc\\sku.0\\sys.shared\\compiled\\game\\object\\tangible\\ship\\components";
12 ###
13 # main
14 ###
16 # Read our balance sheet.
17 print "\nbalance_space_loot process started\n";
18 #print "Output file: $output_filename\n";
20 # Read balance data.
21 processData();
22 calculateBalance();
23 balanceLoot();
25 ###
26 # sub processData
27 # Overall function for reading the balance sheet.
28 ###
30 sub processData
32 open BALANCE, "<$balance_sheet";
34 while ( <BALANCE> )
36 chop;
37 @fields = split /\t/;
38 if ( /Core Balance Data/ )
40 @header = @fields;
42 elsif ( /Baseline/ )
44 @baseline = @fields;
46 elsif ( /Player Factor/ )
48 @player_factor = @fields;
52 close BALANCE;
55 ###
56 # sub calculateBalance
57 ###
59 sub calculateBalance
61 for ( my $i=0; $i<@header; $i++ )
63 if ( $i == 0 )
65 next;
68 for ( my $tier=1; $tier<6; $tier++ )
70 $key = $header[$i];
71 my $name = $key . "_tier" . $tier;
73 # Modify by the player tier factor.
74 $f = $baseline[$i];
75 if ( $tier > 1 )
77 @factor = split /!/, $player_factor[$i];
78 $pref = $factor[0];
79 $postf = $factor[1];
81 for ( my $x=1; $x<$tier; $x++ )
83 $f *= $pref;
84 $pref *= $postf;
87 $f = sprintf( "%.2f", $f );
88 $balancedata{$name} = $f;
93 ###
94 # sub balanceLoot
95 ###
97 sub balanceLoot
99 # Read balance data from the loot sheet.
100 open LOOT, "<$loot_sheet";
101 while ( <LOOT> )
103 $line = $_;
104 for ( $chunk )
106 /Mass Distribution/ and do { $massb = readBaseline( $line, $massb ); next; };
107 /Reactor Drain Distribution/ and do { $reactorb = readBaseline( $line, $reactorb ); next; };
108 /Armor/ and do { readChunk( $line, \%armor ); next; };
109 /Booster/ and do { readChunk( $line, \%booster ); next; };
110 /Capacitor/ and do { readChunk( $line, \%capacitor ); next; };
111 /Droid Interface/ and do { readChunk( $line, \%droid_interface ); next; };
112 /Engine/ and do { readChunk( $line, \%engine ); next; };
113 /Reactor/ and do { readChunk( $line, \%reactor ); next; };
114 /Shield/ and do { readChunk( $line, \%shield ); next; };
115 /Weapon/ and do { readChunk( $line, \%weapon ); next; };
116 $chunk = (split /\t/, $line)[0];
119 close LOOT;
121 # Generate loot!
122 outputArmor();
123 outputBoosters();
124 outputCapacitors();
125 outputDroidInterface();
126 outputEngines();
127 outputReactors();
128 outputShields();
129 outputWeapons();
133 # sub readBaseline
136 sub readBaseline
138 my ($line, $massb) = @_;
140 # Check for end of chunk.
141 if ( $line eq "\n" )
143 # End of this chunk.
144 $chunk = "";
145 return $massb;
148 # Read some data.
149 chop($line);
150 @fields = split /\t/, $line;
151 if ( $fields[0] ne "BASELINE" )
153 return $line;
159 # sub readChunk
162 sub readChunk
164 my ($line, $mref) = @_;
166 # Check for end of chunk.
167 if ( $line eq "\n" )
169 # End of this chunk.
170 $chunk = "";
171 return;
174 # Read some data.
175 chop($line);
176 @fields = split /\t/, $line;
177 if ( $fields[0] ne "Name" )
179 if ( $fields[0] eq undef )
181 $chunk = "";
182 return;
184 $$mref{$fields[0]} = $line;
189 # sub outputArmor
192 sub outputArmor
194 # Dump the balance data.
195 open ARMOR, ">components\\armor.tab";
196 print ARMOR "strType\tstrComments\tfltCurrentHitpoints\tfltMaximumHitpoints\tfltMaximumArmorHitpointsMod\tfltMaximumArmorHitpoints\tfltCurrentArmorHitpoints\tfltEfficiency\tfltEnergyMaintenanceModifier\tfltEnergyMaintenance\tfltMassModifier\tfltMass\treverseEngineeringLevel\n";
197 print ARMOR "s\tc\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\ti\n";
198 foreach $key (sort(keys %armor))
200 my @fields = split /\t/, $armor{$key};
202 # Determine our tier.
203 $tier = sprintf( "%.0f", $fields[1]/2 );
204 $step = ($fields[1] % 2) == 0;
205 $mod = 1;
206 if ( $step )
208 $mod = 1.25;
210 $cert = $fields[1];
211 if ( $cert == 10 )
213 $cert = "ten";
216 # Name
217 print ARMOR "object/tangible/ship/components/armor/$fields[0].iff" . "\t";
219 # Comments
220 print ARMOR "Do not edit." . "\t";
222 # HP / Armor
223 $hp = $balancedata{"Armor_tier$tier"} * $fields[2] * $mod;
224 $hp = sprintf( "%.3f", $hp );
225 print ARMOR $hp . "\t";
226 print ARMOR $hp . "\t";
227 print ARMOR $fields[3] . "\t";
228 print ARMOR $hp . "\t";
229 print ARMOR $hp ."\t";
231 # Efficiency
232 print ARMOR "1\t";
234 # Energy Maintenance
235 print ARMOR "0\t";
236 print ARMOR "0\t";
238 # Mass
239 @mbaseline = split /\t/, $massb;
240 $mass = $mbaseline[0] * $mbaseline[1] * $fields[4] * $fields[6];
241 $mass = sprintf( "%.3f", $mass );
242 print ARMOR $fields[5] . "\t";
243 print ARMOR $mass . "\t";
245 # Reverse engineering.
246 print ARMOR $fields[1] . "\n";
248 close ARMOR;
250 # Check out the objects from P4?
252 # Create the objects.
253 # foreach $key (keys %armor)
255 # open SERVER_OBJ, ">$server_prefix\\armor\\$key.tpf";
256 # print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
257 # print SERVER_OBJ "\@class tangible_object_template 1\n";
258 # print SERVER_OBJ "\@class object_template 5\n";
259 # print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/armor\/shared_$key.iff\"\n";
260 # print SERVER_OBJ "moveFlags = [ MF_player ]\n";
261 # close SERVER_OBJ;
263 # open SHARED_OBJ, ">$shared_prefix\\armor\\shared_$key.tpf";
264 # print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
265 # print SHARED_OBJ "\@class tangible_object_template 8\n";
266 # print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
267 # print SHARED_OBJ "\@class object_template 7\n";
268 # print SHARED_OBJ "clearFloraRadius = 0\n";
269 # print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
270 # print SHARED_OBJ "detailedDescription = \"space/space_item\" \"".$key."_d\"\n";
271 # print SHARED_OBJ "containerType = CT_none\n";
272 # print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_reactor_s01.apt\"\n";
273 # print SHARED_OBJ "portalLayoutFilename = \"\"\n";
274 # print SHARED_OBJ "clientDataFile = \"\"\n";
275 # print SHARED_OBJ "gameObjectType = GOT_ship_component_armor\n";
276 # close SHARED_OBJ;
279 # Add the objects to P4?
283 # sub outputBoosters
286 sub outputBoosters
288 # Dump the balance data.
289 open BOOSTERS, ">components\\booster.tab";
290 print BOOSTERS "strType\tstrComments\tfltCurrentEnergy\tfltMaximumEnergyModifier\tfltMaximumEnergy\tfltRechargeRateModifier\tfltRechargeRate\tfltConsumptionRateModifier\tfltConsumptionRate\tfltAccelerationModifier\tfltAcceleration\tfltMaxSpeedModifier\tfltMaxSpeed\tfltCurrentHitpoints\tfltMaximumHitpoints\tfltMaximumArmorHitpointsMod\tfltMaximumArmorHitpoints\tfltCurrentArmorHitpoints\tfltEfficiency\tfltEnergyMaintenanceModifier\tfltEnergyMaintenance\tfltMassModifier\tfltMass\treverseEngineeringLevel\n";
291 print BOOSTERS "s\tc\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\ti\n";
292 foreach $key (sort(keys %booster))
294 my @fields = split /\t/, $booster{$key};
296 # Determine our tier.
297 $tier = sprintf( "%.0f", $fields[1]/2 );
298 $step = ($fields[1] % 2) == 0;
299 $mod = 1;
300 if ( $step )
302 $mod = 1.5;
304 $cert = $fields[1];
305 if ( $cert == 10 )
307 $cert = "ten";
310 # Name
311 print BOOSTERS "object/tangible/ship/components/booster/$fields[0].iff" . "\t";
313 # Comments
314 print BOOSTERS "Do not edit." . "\t";
316 # Booster Energy
317 $be = $balancedata{"BoosterEnergy_tier$tier"} * $fields[8] * $mod;
318 $be = sprintf( "%.3f", $be );
319 print BOOSTERS $be . "\t";
320 print BOOSTERS $fields[9] . "\t";
321 print BOOSTERS $be . "\t";
323 # Booster Rate
324 $br = $balancedata{"BoosterRecharge_tier$tier"} * $fields[10] * $mod;
325 $br = sprintf( "%.3f", $br );
326 print BOOSTERS $fields[11] . "\t";
327 print BOOSTERS $br . "\t";
329 # Consumption Rate
330 $bc = $balancedata{"BoosterConsumption_tier$tier"} * $fields[12] * $mod;
331 $bc = sprintf( "%.3f", $bc );
332 print BOOSTERS $fields[13] . "\t";
333 print BOOSTERS $bc . "\t";
335 # Accel
336 $ba = $balancedata{"BoosterAccel_tier$tier"} * $fields[14] * $mod;
337 $ba = sprintf( "%.3f", $ba );
338 print BOOSTERS $fields[15] . "\t";
339 print BOOSTERS $ba . "\t";
341 # Speed
342 $bs = $balancedata{"BoosterSpeed_tier$tier"} * $fields[16] * $mod;
343 $bs = sprintf( "%.3f", $bs );
344 print BOOSTERS $fields[17] . "\t";
345 print BOOSTERS $bs . "\t";
347 # HP
348 $hp = $balancedata{"Component_tier$tier"} * $fields[2] * $mod;
349 $hp = sprintf( "%.3f", $hp );
350 print BOOSTERS $hp . "\t";
351 print BOOSTERS $hp . "\t";
352 print BOOSTERS $fields[3] . "\t";
353 print BOOSTERS $hp/2 . "\t";
354 print BOOSTERS $hp/2 ."\t";
356 # Efficiency
357 print BOOSTERS "1\t";
359 # Energy Maintenance
360 @rbaseline = split /\t/, $reactorb;
361 $maint = $rbaseline[0] * $rbaseline[4] * $fields[4];
362 $maint = sprintf( "%.3f", $maint );
363 print BOOSTERS $fields[5] . "\t";
364 print BOOSTERS $maint . "\t";
366 # Mass
367 @mbaseline = split /\t/, $massb;
368 $mass = $mbaseline[0] * $mbaseline[4] * $fields[6] * $fields[18];
369 $mass = sprintf( "%.3f", $mass );
370 print BOOSTERS $fields[7] . "\t";
371 print BOOSTERS $mass . "\t";
373 # Reverse engineering.
374 print BOOSTERS $fields[1] . "\n";
376 close BOOSTERS;
378 # Check out the objects from P4?
380 # Create the objects.
381 # foreach $key (keys %booster)
383 # open SERVER_OBJ, ">$server_prefix\\booster\\$key.tpf";
384 # print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
385 # print SERVER_OBJ "\@class tangible_object_template 1\n";
386 # print SERVER_OBJ "\@class object_template 5\n";
387 # print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/booster\/shared_$key.iff\"\n";
388 # print SERVER_OBJ "moveFlags = [ MF_player ]\n";
389 # close SERVER_OBJ;
391 # open SHARED_OBJ, ">$shared_prefix\\booster\\shared_$key.tpf";
392 # print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
393 # print SHARED_OBJ "\@class tangible_object_template 8\n";
394 # print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
395 # print SHARED_OBJ "\@class object_template 7\n";
396 # print SHARED_OBJ "clearFloraRadius = 0\n";
397 # print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
398 # print SHARED_OBJ "detailedDescription = \"space/space_item\" \"".$key."_d\"\n";
399 # print SHARED_OBJ "containerType = CT_none\n";
400 # print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_booster_s01.apt\"\n";
401 # print SHARED_OBJ "portalLayoutFilename = \"\"\n";
402 # print SHARED_OBJ "clientDataFile = \"\"\n";
403 # print SHARED_OBJ "gameObjectType = GOT_ship_component_booster\n";
404 # close SHARED_OBJ;
407 # Add the objects to P4?
411 # sub outputCapacitors
414 sub outputCapacitors
416 # Dump the balance data.
417 open CAPACITORS, ">components\\capacitor.tab";
418 print CAPACITORS "strType\tstrComments\tfltCurrentEnergy\tfltMaxEnergyModifier\tfltMaxEnergy\tfltRechargeRateModifier\tfltRechargeRate\tfltCurrentHitpoints\tfltMaximumHitpoints\tfltMaximumArmorHitpointsMod\tfltMaximumArmorHitpoints\tfltCurrentArmorHitpoints\tfltEfficiency\tfltEnergyMaintenanceModifier\tfltEnergyMaintenance\tfltMassModifier\tfltMass\treverseEngineeringLevel\n";
419 print CAPACITORS "s\tc\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\ti\n";
420 foreach $key (sort(keys %capacitor))
422 my @fields = split /\t/, $capacitor{$key};
424 # Determine our tier.
425 $tier = sprintf( "%.0f", $fields[1]/2 );
426 $step = ($fields[1] % 2) == 0;
427 $mod = 1;
428 if ( $step )
430 $mod = 1.5;
432 $cert = $fields[1];
433 if ( $cert == 10 )
435 $cert = "ten";
438 # Name
439 print CAPACITORS "object/tangible/ship/components/weapon_capacitor/$fields[0].iff" . "\t";
441 # Comments
442 print CAPACITORS "Do not edit." . "\t";
444 # Capacitor Energy
445 $ce = $balancedata{"CapacitorEnergy_tier$tier"} * $fields[8] * $mod;
446 $ce = sprintf( "%.3f", $ce );
447 print CAPACITORS $ce . "\t";
448 print CAPACITORS $fields[9] . "\t";
449 print CAPACITORS $ce . "\t";
451 # Capacitor Rate
452 $cr = $balancedata{"CapacitorRegen_tier$tier"} * $fields[10] * $mod;
453 $cr = sprintf( "%.3f", $cr );
454 print CAPACITORS $fields[11] . "\t";
455 print CAPACITORS $cr . "\t";
457 # HP
458 $hp = $balancedata{"Component_tier$tier"} * $fields[2] * $mod;
459 $hp = sprintf( "%.3f", $hp );
460 print CAPACITORS $hp . "\t";
461 print CAPACITORS $hp . "\t";
462 print CAPACITORS $fields[3] . "\t";
463 print CAPACITORS $hp/2 . "\t";
464 print CAPACITORS $hp/2 ."\t";
466 # Efficiency
467 print CAPACITORS "1\t";
469 # Energy Maintenance
470 @rbaseline = split /\t/, $reactorb;
471 $maint = $rbaseline[0] * $rbaseline[5] * $fields[4];
472 $maint = sprintf( "%.3f", $maint );
473 print CAPACITORS $fields[5] . "\t";
474 print CAPACITORS $maint . "\t";
476 # Mass
477 @mbaseline = split /\t/, $massb;
478 $mass = $mbaseline[0] * $mbaseline[5] * $fields[6] * $fields[12];
479 $mass = sprintf( "%.3f", $mass );
480 print CAPACITORS $fields[7] . "\t";
481 print CAPACITORS $mass . "\t";
483 # Reverse engineering.
484 print CAPACITORS $fields[1] . "\n";
486 close CAPACITORS;
488 # Check out the objects from P4?
490 # Create the objects.
491 # foreach $key (keys %capacitor)
493 # open SERVER_OBJ, ">$server_prefix\\weapon_capacitor\\$key.tpf";
494 # print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
495 # print SERVER_OBJ "\@class tangible_object_template 1\n";
496 # print SERVER_OBJ "\@class object_template 5\n";
497 # print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/weapon_capacitor\/shared_$key.iff\"\n";
498 # print SERVER_OBJ "moveFlags = [ MF_player ]\n";
499 # close SERVER_OBJ;
501 # open SHARED_OBJ, ">$shared_prefix\\weapon_capacitor\\shared_$key.tpf";
502 # print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
503 # print SHARED_OBJ "\@class tangible_object_template 8\n";
504 # print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
505 # print SHARED_OBJ "\@class object_template 7\n";
506 # print SHARED_OBJ "clearFloraRadius = 0\n";
507 # print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
508 # print SHARED_OBJ "detailedDescription = \"space/space_item\" \"".$key."_d\"\n";
509 # print SHARED_OBJ "containerType = CT_none\n";
510 # print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_capacitor_s01.apt\"\n";
511 # print SHARED_OBJ "portalLayoutFilename = \"\"\n";
512 # print SHARED_OBJ "clientDataFile = \"\"\n";
513 # print SHARED_OBJ "gameObjectType = GOT_ship_component_capacitor\n";
514 # close SHARED_OBJ;
517 # Add the objects to P4?
521 # sub outputDroidInterface
524 sub outputDroidInterface
526 # Dump the balance data.
527 open DROID_INTERFACES, ">components\\droid_interface.tab";
528 print DROID_INTERFACES "strType\tstrComments\tfltCommandSpeedModifier\tfltCommandSpeed\tfltCurrentHitpoints\tfltMaximumHitpoints\tfltMaximumArmorHitpointsMod\tfltMaximumArmorHitpoints\tfltCurrentArmorHitpoints\tfltEfficiency\tfltEnergyMaintenanceModifier\tfltEnergyMaintenance\tfltMassModifier\tfltMass\treverseEngineeringLevel\n";
529 print DROID_INTERFACES "s\tc\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\ti\n";
530 foreach $key (sort(keys %droid_interface))
532 my @fields = split /\t/, $droid_interface{$key};
534 # Determine our tier.
535 $tier = sprintf( "%.0f", $fields[1]/2 );
536 $step = ($fields[1] % 2) == 0;
537 $mod = 1;
538 if ( $step )
540 $mod = 1.5;
542 $cert = $fields[1];
543 if ( $cert == 10 )
545 $cert = "ten";
548 # Name
549 print DROID_INTERFACES "object/tangible/ship/components/droid_interface/$fields[0].iff" . "\t";
551 # Comments
552 print DROID_INTERFACES "Do not edit." . "\t";
554 # Command Speed
555 $cs = $balancedata{"CommandSpeed_tier$tier"} * $fields[8] * $mod;
556 $cs = sprintf( "%.3f", $cs );
557 print DROID_INTERFACES $fields[9] . "\t";
558 print DROID_INTERFACES $cs . "\t";
560 # HP
561 $hp = $balancedata{"Component_tier$tier"} * $fields[2] * $mod;
562 $hp = sprintf( "%.3f", $hp );
563 print DROID_INTERFACES $hp . "\t";
564 print DROID_INTERFACES $hp . "\t";
565 print DROID_INTERFACES $fields[3] . "\t";
566 print DROID_INTERFACES $hp/2 . "\t";
567 print DROID_INTERFACES $hp/2 ."\t";
569 # Efficiency
570 print DROID_INTERFACES "1\t";
572 # Energy Maintenance
573 @rbaseline = split /\t/, $reactorb;
574 $maint = $rbaseline[0] * $rbaseline[6] * $fields[4];
575 $maint = sprintf( "%.3f", $maint );
576 print DROID_INTERFACES $fields[5] . "\t";
577 print DROID_INTERFACES $maint . "\t";
579 # Mass
580 @mbaseline = split /\t/, $massb;
581 $mass = $mbaseline[0] * $mbaseline[6] * $fields[6] * $fields[10];
582 $mass = sprintf( "%.3f", $mass );
583 print DROID_INTERFACES $fields[7] . "\t";
584 print DROID_INTERFACES $mass . "\t";
586 # Reverse engineering.
587 print DROID_INTERFACES $fields[1] . "\n";
589 close DROID_INTERFACES;
591 # Check out the objects from P4?
593 # Create the objects.
594 # foreach $key (keys %droid_interface)
596 # open SERVER_OBJ, ">$server_prefix\\droid_interface\\$key.tpf";
597 # print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
598 # print SERVER_OBJ "\@class tangible_object_template 1\n";
599 # print SERVER_OBJ "\@class object_template 5\n";
600 # print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/droid_interface\/shared_$key.iff\"\n";
601 # print SERVER_OBJ "moveFlags = [ MF_player ]\n";
602 # close SERVER_OBJ;
604 # open SHARED_OBJ, ">$shared_prefix\\droid_interface\\shared_$key.tpf";
605 # print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
606 # print SHARED_OBJ "\@class tangible_object_template 8\n";
607 # print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
608 # print SHARED_OBJ "\@class object_template 7\n";
609 # print SHARED_OBJ "clearFloraRadius = 0\n";
610 # print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
611 # print SHARED_OBJ "detailedDescription = \"space/space_item\" \"".$key."_d\"\n";
612 # print SHARED_OBJ "containerType = CT_none\n";
613 # print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_droidinterface_s01.apt\"\n";
614 # print SHARED_OBJ "portalLayoutFilename = \"\"\n";
615 # print SHARED_OBJ "clientDataFile = \"\"\n";
616 # print SHARED_OBJ "gameObjectType = GOT_ship_component_droid_interface\n";
617 # close SHARED_OBJ;
620 # Add the objects to P4?
624 # sub outputEngines
627 sub outputEngines
629 # Dump the balance data.
630 open ENGINES, ">components\\engine.tab";
631 print ENGINES "strType\tstrComments\tfltMaxSpeedModifier\tfltMaxSpeed\tfltMaxPitchModifier\tfltMaxPitch\tfltMaxRollModifier\tfltMaxRoll\tfltMaxYawModifier\tfltMaxYaw\tfltCurrentHitpoints\tfltMaximumHitpoints\tfltMaximumArmorHitpointsMod\tfltMaximumArmorHitpoints\tfltCurrentArmorHitpoints\tfltEfficiency\tfltEnergyMaintenanceModifier\tfltEnergyMaintenance\tfltMassModifier\tfltMass\treverseEngineeringLevel\n";
632 print ENGINES "s\tc\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\ti\n";
633 foreach $key (sort(keys %engine))
635 my @fields = split /\t/, $engine{$key};
637 # Determine our tier.
638 $tier = sprintf( "%.0f", $fields[1]/2 );
639 $step = ($fields[1] % 2) == 0;
640 $mod = 1;
641 if ( $step )
643 $mod = 1.25;
645 $cert = $fields[1];
646 if ( $cert == 10 )
648 $cert = "ten";
651 # Name
652 print ENGINES "object/tangible/ship/components/engine/$fields[0].iff" . "\t";
654 # Comments
655 print ENGINES "Do not edit." . "\t";
657 # Max Speed
658 $ms = $balancedata{"EngineSpeed_tier$tier"} * $fields[8] * $mod;
659 print ENGINES $fields[9] . "\t";
660 print ENGINES $ms . "\t";
662 # Pitch
663 $p = $balancedata{"EnginePitch_tier$tier"} * $fields[10] * $mod;
664 print ENGINES $fields[11] . "\t";
665 print ENGINES $p . "\t";
667 # Roll
668 $r = $balancedata{"EngineRoll_tier$tier"} * $fields[12] * $mod;
669 print ENGINES $fields[13] . "\t";
670 print ENGINES $r . "\t";
672 # Yaw
673 $y = $balancedata{"EngineYaw_tier$tier"} * $fields[14] * $mod;
674 print ENGINES $fields[15] . "\t";
675 print ENGINES $y . "\t";
677 # HP
678 $hp = $balancedata{"Component_tier$tier"} * $fields[2] * $mod;
679 print ENGINES $hp . "\t";
680 print ENGINES $hp . "\t";
681 print ENGINES $fields[3] . "\t";
682 print ENGINES $hp/2 . "\t";
683 print ENGINES $hp/2 ."\t";
685 # Efficiency
686 print ENGINES "1\t";
688 # Energy Maintenance
689 @rbaseline = split /\t/, $reactorb;
690 $maint = $rbaseline[0] * $rbaseline[7] * $fields[4];
691 $maint = sprintf( "%.3f", $maint );
692 print ENGINES $fields[5] . "\t";
693 print ENGINES $maint . "\t";
695 # Mass
696 @mbaseline = split /\t/, $massb;
697 $mass = $mbaseline[0] * $mbaseline[7] * $fields[6] * $fields[16];
698 $mass = sprintf( "%.3f", $mass );
699 print ENGINES $fields[7] . "\t";
700 print ENGINES $mass . "\t";
702 # Reverse engineering.
703 print ENGINES $fields[1] . "\n";
705 close ENGINES;
707 # Check out the objects from P4?
709 # Create the objects.
710 # foreach $key (sort(keys %engine))
712 # open SERVER_OBJ, ">$server_prefix\\engine\\$key.tpf";
713 # print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
714 # print SERVER_OBJ "\@class tangible_object_template 1\n";
715 # print SERVER_OBJ "\@class object_template 5\n";
716 # print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/engine\/shared_$key.iff\"\n";
717 # print SERVER_OBJ "moveFlags = [ MF_player ]\n";
718 # close SERVER_OBJ;
720 # open SHARED_OBJ, ">$shared_prefix\\engine\\shared_$key.tpf";
721 # print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
722 # print SHARED_OBJ "\@class tangible_object_template 8\n";
723 # print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
724 # print SHARED_OBJ "\@class object_template 7\n";
725 # print SHARED_OBJ "clearFloraRadius = 0\n";
726 # print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
727 # print SHARED_OBJ "detailedDescription = \"space/space_item\" \"".$key."_d\"\n";
728 # print SHARED_OBJ "containerType = CT_none\n";
729 # print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_engine_s01.apt\"\n";
730 # print SHARED_OBJ "portalLayoutFilename = \"\"\n";
731 # print SHARED_OBJ "clientDataFile = \"\"\n";
732 # print SHARED_OBJ "gameObjectType = GOT_ship_component_engine\n";
733 # close SHARED_OBJ;
736 # Add the objects to P4?
740 # sub outputReactors
743 sub outputReactors
745 # Dump the balance data.
746 open REACTORS, ">components\\reactor.tab";
747 print REACTORS "strType\tstrComments\tfltEnergyGenerationModifier\tfltEnergyGeneration\tfltCurrentHitpoints\tfltMaximumHitpoints\tfltMaximumArmorHitpointsMod\tfltMaximumArmorHitpoints\tfltCurrentArmorHitpoints\tfltEfficiency\tfltEnergyMaintenanceModifier\tfltEnergyMaintenance\tfltMassModifier\tfltMass\treverseEngineeringLevel\n";
748 print REACTORS "s\tc\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\ti\n";
749 foreach $key (sort(keys %reactor))
751 my @fields = split /\t/, $reactor{$key};
753 # Determine our tier.
754 $tier = sprintf( "%.0f", $fields[1]/2 );
755 $step = ($fields[1] % 2) == 0;
756 $mod = 1;
757 if ( $step )
759 $mod = 1.5;
761 $cert = $fields[1];
762 if ( $cert == 10 )
764 $cert = "ten";
767 # Name
768 print REACTORS "object/tangible/ship/components/reactor/$fields[0].iff" . "\t";
770 # Comments
771 print REACTORS "Do not edit." . "\t";
773 # Energy Generation
774 $eg = 10000 * $fields[6];
775 $eg = sprintf( "%.3f", $eg );
776 print REACTORS $fields[7] . "\t";
777 print REACTORS $eg . "\t";
779 # HP / Armor
780 $hp = $balancedata{"Component_tier$tier"} * $fields[2] * $mod;
781 $hp = sprintf( "%.3f", $hp );
782 print REACTORS $hp . "\t";
783 print REACTORS $hp . "\t";
784 print REACTORS $fields[3] . "\t";
785 print REACTORS $hp/2 . "\t";
786 print REACTORS $hp/2 ."\t";
788 # Efficiency & Maintenance
789 print REACTORS "1\t0\t0\t";
791 # Mass
792 @mbaseline = split /\t/, $massb;
793 $mass = $mbaseline[0] * $mbaseline[8] * $fields[4] * $fields[8];
794 $mass = sprintf( "%.3f", $mass );
795 print REACTORS $fields[5] . "\t";
796 print REACTORS $mass . "\t";
798 # Reverse engineering.
799 print REACTORS $fields[1] . "\n";
801 close REACTORS;
803 # Check out the objects from P4?
805 # Create the objects.
806 # foreach $key (keys %reactor)
808 # open SERVER_OBJ, ">$server_prefix\\reactor\\$key.tpf";
809 # print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
810 # print SERVER_OBJ "\@class tangible_object_template 1\n";
811 # print SERVER_OBJ "\@class object_template 5\n";
812 # print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/reactor\/shared_$key.iff\"\n";
813 # print SERVER_OBJ "moveFlags = [ MF_player ]\n";
814 # close SERVER_OBJ;
816 # open SHARED_OBJ, ">$shared_prefix\\reactor\\shared_$key.tpf";
817 # print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
818 # print SHARED_OBJ "\@class tangible_object_template 8\n";
819 # print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
820 # print SHARED_OBJ "\@class object_template 7\n";
821 # print SHARED_OBJ "clearFloraRadius = 0\n";
822 # print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
823 # print SHARED_OBJ "detailedDescription = \"space/space_item\" \"".$key."_d\"\n";
824 # print SHARED_OBJ "containerType = CT_none\n";
825 # print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_reactor_s01.apt\"\n";
826 # print SHARED_OBJ "portalLayoutFilename = \"\"\n";
827 # print SHARED_OBJ "clientDataFile = \"\"\n";
828 # print SHARED_OBJ "gameObjectType = GOT_ship_component_reactor\n";
829 # close SHARED_OBJ;
832 # Add the objects to P4?
836 # sub outputShields
839 sub outputShields
841 # Dump the balance data.
842 open SHIELDS, ">components\\shield.tab";
843 print SHIELDS "strType\tstrComments\tfltShieldRechargeRateModifier\tfltShieldRechargeRate\tfltShieldHitpointsMaximumFrontModifier\tfltShieldHitpointsMaximumFront\tfltShieldHitpointsMaximumBackModifier\tfltShieldHitpointsMaximumBack\tfltCurrentHitpoints\tfltMaximumHitpoints\tfltMaximumArmorHitpointsMod\tfltMaximumArmorHitpoints\tfltCurrentArmorHitpoints\tfltEfficiency\tfltEnergyMaintenanceModifier\tfltEnergyMaintenance\tfltMassModifier\tfltMass\treverseEngineeringLevel\n";
844 print SHIELDS "s\tc\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\ti\n";
845 foreach $key (sort(keys %shield))
847 my @fields = split /\t/, $shield{$key};
849 # Determine our tier.
850 $tier = sprintf( "%.0f", $fields[1]/2 );
851 $step = ($fields[1] % 2) == 0;
852 $mod = 1;
853 if ( $step )
855 $mod = 1.25;
857 $cert = $fields[1];
858 if ( $cert == 10 )
860 $cert = "ten";
863 # Name
864 print SHIELDS "object/tangible/ship/components/shield_generator/$fields[0].iff" . "\t";
866 # Comments
867 print SHIELDS "Do not edit." . "\t";
869 # Shield Recharge
870 $sr = $balancedata{"ShieldRegen_tier$tier"} * $fields[8] * $mod;
871 $sr = sprintf( "%.3f", $sr );
872 print SHIELDS $fields[9] . "\t";
873 print SHIELDS $sr . "\t";
875 # Shield Front
876 $sf = $balancedata{"Shield_tier$tier"} * $fields[10] * $mod;
877 $sf = sprintf( "%.3f", $sf );
878 print SHIELDS $fields[11] . "\t";
879 print SHIELDS $sf . "\t";
881 # Shield Back
882 $sb = $balancedata{"Shield_tier$tier"} * $fields[12] * $mod;
883 $sb = sprintf( "%.3f", $sb );
884 print SHIELDS $fields[13] . "\t";
885 print SHIELDS $sb . "\t";
887 # HP
888 $hp = $balancedata{"Component_tier$tier"} * $fields[2] * $mod;
889 $hp = sprintf( "%.3f", $hp );
890 print SHIELDS $hp . "\t";
891 print SHIELDS $hp . "\t";
892 print SHIELDS $fields[3] . "\t";
893 print SHIELDS $hp/2 . "\t";
894 print SHIELDS $hp/2 ."\t";
896 # Efficiency
897 print SHIELDS "1\t";
899 # Energy Maintenance
900 @rbaseline = split /\t/, $reactorb;
901 $maint = $rbaseline[0] * $rbaseline[3] * $fields[4];
902 $maint = sprintf( "%.3f", $maint );
903 print SHIELDS $fields[5] . "\t";
904 print SHIELDS $maint . "\t";
906 # Mass
907 @mbaseline = split /\t/, $massb;
908 $mass = $mbaseline[0] * $mbaseline[3] * $fields[6] * $fields[14];
909 $mass = sprintf( "%.3f", $mass );
910 print SHIELDS $fields[7] . "\t";
911 print SHIELDS $mass . "\t";
913 # Reverse engineering.
914 print SHIELDS $fields[1] . "\n";
916 close SHIELDS;
918 # Check out the objects from P4?
920 # Create the objects.
921 # foreach $key (keys %shield)
923 # open SERVER_OBJ, ">$server_prefix\\shield_generator\\$key.tpf";
924 # print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
925 # print SERVER_OBJ "\@class tangible_object_template 1\n";
926 # print SERVER_OBJ "\@class object_template 5\n";
927 # print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/shield_generator\/shared_$key.iff\"\n";
928 # print SERVER_OBJ "moveFlags = [ MF_player ]\n";
929 # close SERVER_OBJ;
931 # open SHARED_OBJ, ">$shared_prefix\\shield_generator\\shared_$key.tpf";
932 # print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
933 # print SHARED_OBJ "\@class tangible_object_template 8\n";
934 # print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
935 # print SHARED_OBJ "\@class object_template 7\n";
936 # print SHARED_OBJ "clearFloraRadius = 0\n";
937 # print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
938 # print SHARED_OBJ "detailedDescription = \"space/space_item\" \"".$key."_d\"\n";
939 # print SHARED_OBJ "containerType = CT_none\n";
940 # print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_shield_s01.apt\"\n";
941 # print SHARED_OBJ "portalLayoutFilename = \"\"\n";
942 # print SHARED_OBJ "clientDataFile = \"\"\n";
943 # print SHARED_OBJ "gameObjectType = GOT_ship_component_shield\n";
944 # close SHARED_OBJ;
947 # Add the objects to P4?
951 # sub outputWeapons
954 sub outputWeapons
956 # Dump the balance data.
957 open WEAPONS, ">components\\weapon.tab";
958 print WEAPONS "strType\tstrComments\tfltMinDamageModifier\tfltMinDamage\tfltMaxDamageModifier\tfltMaxDamage\tfltShieldEffectivenessModifier\tfltShieldEffectiveness\tfltArmorEffectivenessModifier\tfltArmorEffectiveness\tfltEnergyPerShotModifier\tfltEnergyPerShot\tfltRefireRateModifier\tfltRefireRate\tfltCurrentHitpoints\tfltMaximumHitpoints\tfltMaximumArmorHitpointsMod\tfltMaximumArmorHitpoints\tfltCurrentArmorHitpoints\tfltEfficiency\tfltEnergyMaintenanceModifier\tfltEnergyMaintenance\tfltMassModifier\tfltMass\treverseEngineeringLevel\n";
959 print WEAPONS "s\tc\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\tf\ti\n";
960 foreach $key (sort(keys %weapon))
962 my @fields = split /\t/, $weapon{$key};
964 # Determine our tier.
965 $tier = sprintf( "%.0f", $fields[1]/2 );
966 $step = ($fields[1] % 2) == 0;
967 $mod = 1;
968 if ( $step )
970 $mod = 1.25;
972 $cert = $fields[1];
973 if ( $cert == 10 )
975 $cert = "ten";
978 # Name
979 print WEAPONS "object/tangible/ship/components/weapon/$fields[0].iff" . "\t";
981 # Comments
982 print WEAPONS "Do not edit." . "\t";
984 # Min Damage
985 $md = $balancedata{"DamageMin_tier$tier"} * $fields[8] * $mod;
986 $md = sprintf( "%.3f", $md );
987 print WEAPONS $fields[9] . "\t";
988 print WEAPONS $md . "\t";
990 # Max Damage
991 $md = $balancedata{"DamageMax_tier$tier"} * $fields[10] * $mod;
992 $md = sprintf( "%.3f", $md );
993 print WEAPONS $fields[11] . "\t";
994 print WEAPONS $md . "\t";
996 # Shield Eff
997 $se = $balancedata{"WeaponEffShield_tier$tier"} * $fields[12] * $mod;
998 $se = sprintf( "%.3f", $se );
999 print WEAPONS $fields[13] . "\t";
1000 print WEAPONS $se . "\t";
1002 # ArmorEff
1003 $ae = $balancedata{"WeaponEffArmor_tier$tier"} * $fields[14] * $mod;
1004 $ae = sprintf( "%.3f", $ae );
1005 print WEAPONS $fields[15] . "\t";
1006 print WEAPONS $ae . "\t";
1008 # Drain
1009 $wd = $balancedata{"WeaponDrain_tier$tier"} * $fields[16] * $mod;
1010 $wd = sprintf( "%.3f", $wd );
1011 print WEAPONS $fields[17] . "\t";
1012 print WEAPONS $wd . "\t";
1014 # Rate
1015 $wr = $balancedata{"WeaponRate_tier$tier"} * $fields[18] * $mod;
1016 # $wr = sprintf( "%.3f", $wr );
1017 print WEAPONS $fields[19] . "\t";
1018 print WEAPONS $wr . "\t";
1020 # HP
1021 $hp = $balancedata{"Component_tier$tier"} * $fields[2] * $mod;
1022 $hp = sprintf( "%.3f", $hp );
1023 print WEAPONS $hp . "\t";
1024 print WEAPONS $hp . "\t";
1025 print WEAPONS $fields[3] . "\t";
1026 print WEAPONS $hp/2 . "\t";
1027 print WEAPONS $hp/2 ."\t";
1029 # Efficiency
1030 print WEAPONS "1\t";
1032 # Energy Maintenance
1033 @rbaseline = split /\t/, $reactorb;
1034 $maint = $rbaseline[0] * $rbaseline[2] * $fields[4];
1035 $maint = sprintf( "%.3f", $maint );
1036 print WEAPONS $fields[5] . "\t";
1037 print WEAPONS $maint . "\t";
1039 # Mass
1040 @mbaseline = split /\t/, $massb;
1041 $mass = $mbaseline[0] * $mbaseline[2] * $fields[6] * $fields[20];
1042 $mass = sprintf( "%.3f", $mass );
1043 print WEAPONS $fields[7] . "\t";
1044 print WEAPONS $mass . "\t";
1046 # Reverse engineering.
1047 print WEAPONS $fields[1] . "\n";
1049 close WEAPONS;
1051 # Check out the objects from P4?
1053 # Create the objects.
1054 # foreach $key (keys %weapon)
1056 # open SERVER_OBJ, ">$server_prefix\\weapon\\$key.tpf";
1057 # print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
1058 # print SERVER_OBJ "\@class tangible_object_template 1\n";
1059 # print SERVER_OBJ "\@class object_template 5\n";
1060 # print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/weapon\/shared_$key.iff\"\n";
1061 # print SERVER_OBJ "moveFlags = [ MF_player ]\n";
1062 # close SERVER_OBJ;
1064 # open SHARED_OBJ, ">$shared_prefix\\weapon\\shared_$key.tpf";
1065 # print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
1066 # print SHARED_OBJ "\@class tangible_object_template 8\n";
1067 # print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
1068 # print SHARED_OBJ "\@class object_template 7\n";
1069 # print SHARED_OBJ "clearFloraRadius = 0\n";
1070 # print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
1071 # print SHARED_OBJ "detailedDescription = \"space/space_item\" \"".$key."_d\"\n";
1072 # print SHARED_OBJ "containerType = CT_none\n";
1073 # print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_weapon_s01.apt\"\n";
1074 # print SHARED_OBJ "portalLayoutFilename = \"\"\n";
1075 # print SHARED_OBJ "clientDataFile = \"\"\n";
1076 # print SHARED_OBJ "gameObjectType = GOT_ship_component_weapon\n";
1077 # close SHARED_OBJ;
1080 # Add the objects to P4?