README.md edited online with Bitbucket
[swg-src.git] / dsrc / sku.0 / sys.server / compiled / game / datatables / ship / build_space_loot_templates.pl
blob5fb2c7df345cfb05cb8941497f4857c735ba18de
1 #!/usr/bin/perl
3 # Constants
5 $loot_sheet = "looted_component_balance.txt";
6 $ship_components = "j:\\swg\\current\\dsrc\\sku.0\\sys.shared\\compiled\\game\\datatables\\space\\ship_components.tab";
7 $dsrc_server_prefix = "\\swg\\current\\dsrc\\sku.0\\sys.server\\compiled\\game\\object\\tangible\\ship\\components";
8 $dsrc_shared_prefix = "\\swg\\current\\dsrc\\sku.0\\sys.shared\\compiled\\game\\object\\tangible\\ship\\components";
9 $data_server_prefix = "\\swg\\current\\data\\sku.0\\sys.server\\compiled\\game\\object\\tangible\\ship\\components";
10 $data_shared_prefix = "\\swg\\current\\data\\sku.0\\sys.shared\\compiled\\game\\object\\tangible\\ship\\components";
13 ###
14 # MAIN
15 ###
17 readSegments();
19 sub readSegments
21 # Read balance data from the loot sheet.
22 open LOOT, "<$loot_sheet";
23 while ( <LOOT> )
25 $line = $_;
26 for ( $chunk )
28 /Armor/ and do { readChunk( $line, \%armor ); next; };
29 /Booster/ and do { readChunk( $line, \%booster ); next; };
30 /Capacitor/ and do { readChunk( $line, \%capacitor ); next; };
31 /Droid Interface/ and do { readChunk( $line, \%droid_interface ); next; };
32 /Engine/ and do { readChunk( $line, \%engine ); next; };
33 /Reactor/ and do { readChunk( $line, \%reactor ); next; };
34 /Shield/ and do { readChunk( $line, \%shield ); next; };
35 /Weapon/ and do { readChunk( $line, \%weapon ); next; };
36 $chunk = (split /\t/, $line)[0];
39 close LOOT;
41 # Generate loot!
42 makeArmorTemplates();
43 makeBoosterTemplates();
44 makeCapacitorTemplates();
45 makeDroidInterfaceTemplates();
46 makeEngineTemplates();
47 makeReactorTemplates();
48 makeShieldTemplates();
49 makeWeaponTemplates();
53 sub readChunk
55 my ($line, $mref) = @_;
57 # Check for end of chunk.
58 if ( $line eq "\n" )
60 # End of this chunk.
61 $chunk = "";
62 return;
65 # Read some data.
66 chop($line);
67 @fields = split /\t/, $line;
68 if ( $fields[0] ne "Name" )
70 if ( $fields[0] eq undef )
72 $chunk = "";
73 return;
75 $$mref{$fields[0]} = $line;
79 sub makeArmorTemplates
81 foreach $key (keys %armor)
83 print "\nStarting process for key $key";
84 my @fields = split /\t/, $armor{$key};
86 $cert = $fields[1];
87 if ( $cert == 10 )
89 $cert = "ten";
92 open SERVER_OBJ, ">$dsrc_server_prefix\\armor\\$key.tpf";
93 print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
94 print SERVER_OBJ "\@class tangible_object_template 1\n";
95 print SERVER_OBJ "\@class object_template 5\n";
96 print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/armor\/shared_$key.iff\"\n";
97 print SERVER_OBJ "moveFlags = [ MF_player ]\n";
98 close SERVER_OBJ;
100 open SHARED_OBJ, ">$dsrc_shared_prefix\\armor\\shared_$key.tpf";
101 print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
102 print SHARED_OBJ "\@class tangible_object_template 8\n";
103 print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
104 print SHARED_OBJ "\@class object_template 7\n";
105 print SHARED_OBJ "clearFloraRadius = 0\n";
106 print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
107 print SHARED_OBJ "detailedDescription = \"space/space_item\" \"generic_armor_d\"\n";
108 print SHARED_OBJ "containerType = CT_none\n";
109 print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_armor_s01.apt\"\n";
110 print SHARED_OBJ "portalLayoutFilename = \"\"\n";
111 print SHARED_OBJ "clientDataFile = \"\"\n";
112 print SHARED_OBJ "gameObjectType = GOT_ship_component_armor\n";
113 close SHARED_OBJ;
115 my $serverfilename = "$dsrc_server_prefix\\armor\\$key.tpf";
116 my $sharedfilename = "$dsrc_shared_prefix\\armor\\shared_$key.tpf";
118 system( "templatecompiler -compile $serverfilename" );
119 system( "templatecompiler -compile $sharedfilename" );
121 $serverfilename =~ s/\\/\//g;
122 $sharedfilename =~ s/\\/\//g;
124 system( "p4 add //depot" . $serverfilename );
125 system( "p4 add //depot" . $sharedfilename );
127 my $serverfilename = "$data_server_prefix\\armor\\$key.iff";
128 my $sharedfilename = "$data_shared_prefix\\armor\\shared_$key.iff";
130 $serverfilename =~ s/\\/\//g;
131 $sharedfilename =~ s/\\/\//g;
133 system( "p4 add //depot" . $serverfilename );
134 system( "p4 add //depot" . $sharedfilename );
136 open COMPONENTS, "<$ship_components";
138 @file = <COMPONENTS>;
140 close COMPONENTS;
142 my $found = 0;
144 foreach my $y (@file)
147 my @fields = split (/\t/, $y);
148 if ( $fields[1] eq "object/tangible/ship/components/armor/$key.iff")
150 $found = 1;
157 if ($found == 0)
159 open COMPONENTS, ">>$ship_components";
161 print COMPONENTS "$key\tobject/tangible/ship/components/armor/$key.iff\tobject/tangible/ship/components/armor/shared_$key.iff\tarmor\tarm_0\n";
163 close COMPONENTS;
176 sub makeBoosterTemplates
178 foreach $key (keys %booster)
180 print "\nStarting process for key $key";
181 my @fields = split /\t/, $booster{$key};
183 $cert = $fields[1];
184 if ( $cert == 10 )
186 $cert = "ten";
189 open SERVER_OBJ, ">$dsrc_server_prefix\\booster\\$key.tpf";
190 print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
191 print SERVER_OBJ "\@class tangible_object_template 1\n";
192 print SERVER_OBJ "\@class object_template 5\n";
193 print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/booster\/shared_$key.iff\"\n";
194 print SERVER_OBJ "moveFlags = [ MF_player ]\n";
195 close SERVER_OBJ;
197 open SHARED_OBJ, ">$dsrc_shared_prefix\\booster\\shared_$key.tpf";
198 print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
199 print SHARED_OBJ "\@class tangible_object_template 8\n";
200 print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
201 print SHARED_OBJ "\@class object_template 7\n";
202 print SHARED_OBJ "clearFloraRadius = 0\n";
203 print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
204 print SHARED_OBJ "detailedDescription = \"space/space_item\" \"generic_booster_d\"\n";
205 print SHARED_OBJ "containerType = CT_none\n";
206 print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_booster_s01.apt\"\n";
207 print SHARED_OBJ "portalLayoutFilename = \"\"\n";
208 print SHARED_OBJ "clientDataFile = \"\"\n";
209 print SHARED_OBJ "gameObjectType = GOT_ship_component_booster\n";
210 close SHARED_OBJ;
212 my $serverfilename = "$dsrc_server_prefix\\booster\\$key.tpf";
213 my $sharedfilename = "$dsrc_shared_prefix\\booster\\shared_$key.tpf";
215 system( "templatecompiler -compile $serverfilename" );
216 system( "templatecompiler -compile $sharedfilename" );
218 $serverfilename =~ s/\\/\//g;
219 $sharedfilename =~ s/\\/\//g;
221 system( "p4 add //depot" . $serverfilename );
222 system( "p4 add //depot" . $sharedfilename );
224 my $serverfilename = "$data_server_prefix\\booster\\$key.iff";
225 my $sharedfilename = "$data_shared_prefix\\booster\\shared_$key.iff";
227 $serverfilename =~ s/\\/\//g;
228 $sharedfilename =~ s/\\/\//g;
230 system( "p4 add //depot" . $serverfilename );
231 system( "p4 add //depot" . $sharedfilename );
233 open COMPONENTS, "<$ship_components";
235 @file = <COMPONENTS>;
237 close COMPONENTS;
239 my $found = 0;
241 foreach my $y (@file)
244 my @fields = split (/\t/, $y);
245 if ( $fields[1] eq "object/tangible/ship/components/booster/$key.iff")
247 $found = 1;
254 if ($found == 0)
256 open COMPONENTS, ">>$ship_components";
258 print COMPONENTS "$key\tobject/tangible/ship/components/booster/$key.iff\tobject/tangible/ship/components/booster/shared_$key.iff\tbooster\tbst_0\n";
260 close COMPONENTS;
273 sub makeCapacitorTemplates
275 foreach $key (keys %capacitor)
277 print "\nStarting process for key $key";
278 my @fields = split /\t/, $capacitor{$key};
280 $cert = $fields[1];
281 if ( $cert == 10 )
283 $cert = "ten";
286 open SERVER_OBJ, ">$dsrc_server_prefix\\weapon_capacitor\\$key.tpf";
287 print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
288 print SERVER_OBJ "\@class tangible_object_template 1\n";
289 print SERVER_OBJ "\@class object_template 5\n";
290 print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/capacitor\/shared_$key.iff\"\n";
291 print SERVER_OBJ "moveFlags = [ MF_player ]\n";
292 close SERVER_OBJ;
294 open SHARED_OBJ, ">$dsrc_shared_prefix\\weapon_capacitor\\shared_$key.tpf";
295 print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
296 print SHARED_OBJ "\@class tangible_object_template 8\n";
297 print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
298 print SHARED_OBJ "\@class object_template 7\n";
299 print SHARED_OBJ "clearFloraRadius = 0\n";
300 print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
301 print SHARED_OBJ "detailedDescription = \"space/space_item\" \"generic_capacitor_d\"\n";
302 print SHARED_OBJ "containerType = CT_none\n";
303 print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_capacitor_s01.apt\"\n";
304 print SHARED_OBJ "portalLayoutFilename = \"\"\n";
305 print SHARED_OBJ "clientDataFile = \"\"\n";
306 print SHARED_OBJ "gameObjectType = GOT_ship_component_capacitor\n";
307 close SHARED_OBJ;
309 my $serverfilename = "$dsrc_server_prefix\\weapon_capacitor\\$key.tpf";
310 my $sharedfilename = "$dsrc_shared_prefix\\weapon_capacitor\\shared_$key.tpf";
312 system( "templatecompiler -compile $serverfilename" );
313 system( "templatecompiler -compile $sharedfilename" );
315 $serverfilename =~ s/\\/\//g;
316 $sharedfilename =~ s/\\/\//g;
318 system( "p4 add //depot" . $serverfilename );
319 system( "p4 add //depot" . $sharedfilename );
321 my $serverfilename = "$data_server_prefix\\weapon_capacitor\\$key.iff";
322 my $sharedfilename = "$data_shared_prefix\\weapon_capacitor\\shared_$key.iff";
324 $serverfilename =~ s/\\/\//g;
325 $sharedfilename =~ s/\\/\//g;
327 system( "p4 add //depot" . $serverfilename );
328 system( "p4 add //depot" . $sharedfilename );
330 open COMPONENTS, "<$ship_components";
332 @file = <COMPONENTS>;
334 close COMPONENTS;
336 my $found = 0;
338 foreach my $y (@file)
341 my @fields = split (/\t/, $y);
342 if ( $fields[1] eq "object/tangible/ship/components/weapon_capacitor/$key.iff")
344 $found = 1;
351 if ($found == 0)
353 open COMPONENTS, ">>$ship_components";
355 print COMPONENTS "$key\tobject/tangible/ship/components/weapon_capacitor/$key.iff\tobject/tangible/ship/components/weapon_capacitor/shared_$key.iff\tcapacitor\tcap_0\n";
357 close COMPONENTS;
369 sub makeDroidInterfaceTemplates
371 foreach $key (keys %droid_interface)
373 print "\nStarting process for key $key";
374 my @fields = split /\t/, $droid_interface{$key};
376 $cert = $fields[1];
377 if ( $cert == 10 )
379 $cert = "ten";
382 open SERVER_OBJ, ">$dsrc_server_prefix\\droid_interface\\$key.tpf";
383 print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
384 print SERVER_OBJ "\@class tangible_object_template 1\n";
385 print SERVER_OBJ "\@class object_template 5\n";
386 print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/droid_interface\/shared_$key.iff\"\n";
387 print SERVER_OBJ "moveFlags = [ MF_player ]\n";
388 close SERVER_OBJ;
390 open SHARED_OBJ, ">$dsrc_shared_prefix\\droid_interface\\shared_$key.tpf";
391 print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
392 print SHARED_OBJ "\@class tangible_object_template 8\n";
393 print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
394 print SHARED_OBJ "\@class object_template 7\n";
395 print SHARED_OBJ "clearFloraRadius = 0\n";
396 print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
397 print SHARED_OBJ "detailedDescription = \"space/space_item\" \"generic_droid_interface_d\"\n";
398 print SHARED_OBJ "containerType = CT_none\n";
399 print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_droidinterface_s01.apt\"\n";
400 print SHARED_OBJ "portalLayoutFilename = \"\"\n";
401 print SHARED_OBJ "clientDataFile = \"\"\n";
402 print SHARED_OBJ "gameObjectType = GOT_ship_component_droid_interface\n";
403 close SHARED_OBJ;
405 my $serverfilename = "$dsrc_server_prefix\\droid_interface\\$key.tpf";
406 my $sharedfilename = "$dsrc_shared_prefix\\droid_interface\\shared_$key.tpf";
408 system( "templatecompiler -compile $serverfilename" );
409 system( "templatecompiler -compile $sharedfilename" );
411 $serverfilename =~ s/\\/\//g;
412 $sharedfilename =~ s/\\/\//g;
414 system( "p4 add //depot" . $serverfilename );
415 system( "p4 add //depot" . $sharedfilename );
417 my $serverfilename = "$data_server_prefix\\droid_interface\\$key.iff";
418 my $sharedfilename = "$data_shared_prefix\\droid_interface\\shared_$key.iff";
420 $serverfilename =~ s/\\/\//g;
421 $sharedfilename =~ s/\\/\//g;
423 system( "p4 add //depot" . $serverfilename );
424 system( "p4 add //depot" . $sharedfilename );
426 open COMPONENTS, "<$ship_components";
428 @file = <COMPONENTS>;
430 close COMPONENTS;
432 my $found = 0;
434 foreach my $y (@file)
437 my @fields = split (/\t/, $y);
438 if ( $fields[1] eq "object/tangible/ship/components/droid_interface/$key.iff")
440 $found = 1;
447 if ($found == 0)
449 open COMPONENTS, ">>$ship_components";
451 print COMPONENTS "$key\tobject/tangible/ship/components/droid_interface/$key.iff\tobject/tangible/ship/components/droid_interface/shared_$key.iff\tdroid_interface\tddi_0\n";
453 close COMPONENTS;
465 sub makeEngineTemplates
467 foreach $key (keys %engine)
469 print "\nStarting process for key $key";
470 my @fields = split /\t/, $engine{$key};
472 $cert = $fields[1];
473 if ( $cert == 10 )
475 $cert = "ten";
478 open SERVER_OBJ, ">$dsrc_server_prefix\\engine\\$key.tpf";
479 print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
480 print SERVER_OBJ "\@class tangible_object_template 1\n";
481 print SERVER_OBJ "\@class object_template 5\n";
482 print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/engine\/shared_$key.iff\"\n";
483 print SERVER_OBJ "moveFlags = [ MF_player ]\n";
484 close SERVER_OBJ;
486 open SHARED_OBJ, ">$dsrc_shared_prefix\\engine\\shared_$key.tpf";
487 print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
488 print SHARED_OBJ "\@class tangible_object_template 8\n";
489 print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
490 print SHARED_OBJ "\@class object_template 7\n";
491 print SHARED_OBJ "clearFloraRadius = 0\n";
492 print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
493 print SHARED_OBJ "detailedDescription = \"space/space_item\" \"generic_engine_d\"\n";
494 print SHARED_OBJ "containerType = CT_none\n";
495 print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_engine_s01.apt\"\n";
496 print SHARED_OBJ "portalLayoutFilename = \"\"\n";
497 print SHARED_OBJ "clientDataFile = \"\"\n";
498 print SHARED_OBJ "gameObjectType = GOT_ship_component_engine\n";
499 close SHARED_OBJ;
501 my $serverfilename = "$dsrc_server_prefix\\engine\\$key.tpf";
502 my $sharedfilename = "$dsrc_shared_prefix\\engine\\shared_$key.tpf";
504 system( "templatecompiler -compile $serverfilename" );
505 system( "templatecompiler -compile $sharedfilename" );
507 $serverfilename =~ s/\\/\//g;
508 $sharedfilename =~ s/\\/\//g;
510 system( "p4 add //depot" . $serverfilename );
511 system( "p4 add //depot" . $sharedfilename );
513 my $serverfilename = "$data_server_prefix\\engine\\$key.iff";
514 my $sharedfilename = "$data_shared_prefix\\engine\\shared_$key.iff";
516 $serverfilename =~ s/\\/\//g;
517 $sharedfilename =~ s/\\/\//g;
519 system( "p4 add //depot" . $serverfilename );
520 system( "p4 add //depot" . $sharedfilename );
522 open COMPONENTS, "<$ship_components";
524 @file = <COMPONENTS>;
526 close COMPONENTS;
528 my $found = 0;
530 foreach my $y (@file)
533 my @fields = split (/\t/, $y);
534 if ( $fields[1] eq "object/tangible/ship/components/engine/$key.iff")
536 $found = 1;
543 if ($found == 0)
545 open COMPONENTS, ">>$ship_components";
547 print COMPONENTS "$key\tobject/tangible/ship/components/engine/$key.iff\tobject/tangible/ship/components/engine/shared_$key.iff\tengine\teng_0\n";
549 close COMPONENTS;
561 sub makeReactorTemplates
563 foreach $key (keys %reactor)
565 print "\nStarting process for key $key";
566 my @fields = split /\t/, $reactor{$key};
568 $cert = $fields[1];
569 if ( $cert == 10 )
571 $cert = "ten";
574 open SERVER_OBJ, ">$dsrc_server_prefix\\reactor\\$key.tpf";
575 print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
576 print SERVER_OBJ "\@class tangible_object_template 1\n";
577 print SERVER_OBJ "\@class object_template 5\n";
578 print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/reactor\/shared_$key.iff\"\n";
579 print SERVER_OBJ "moveFlags = [ MF_player ]\n";
580 close SERVER_OBJ;
582 open SHARED_OBJ, ">$dsrc_shared_prefix\\reactor\\shared_$key.tpf";
583 print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
584 print SHARED_OBJ "\@class tangible_object_template 8\n";
585 print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
586 print SHARED_OBJ "\@class object_template 7\n";
587 print SHARED_OBJ "clearFloraRadius = 0\n";
588 print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
589 print SHARED_OBJ "detailedDescription = \"space/space_item\" \"generic_reactor_d\"\n";
590 print SHARED_OBJ "containerType = CT_none\n";
591 print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_reactor_s01.apt\"\n";
592 print SHARED_OBJ "portalLayoutFilename = \"\"\n";
593 print SHARED_OBJ "clientDataFile = \"\"\n";
594 print SHARED_OBJ "gameObjectType = GOT_ship_component_reactor\n";
595 close SHARED_OBJ;
597 my $serverfilename = "$dsrc_server_prefix\\reactor\\$key.tpf";
598 my $sharedfilename = "$dsrc_shared_prefix\\reactor\\shared_$key.tpf";
600 system( "templatecompiler -compile $serverfilename" );
601 system( "templatecompiler -compile $sharedfilename" );
603 $serverfilename =~ s/\\/\//g;
604 $sharedfilename =~ s/\\/\//g;
606 system( "p4 add //depot" . $serverfilename );
607 system( "p4 add //depot" . $sharedfilename );
609 my $serverfilename = "$data_server_prefix\\reactor\\$key.iff";
610 my $sharedfilename = "$data_shared_prefix\\reactor\\shared_$key.iff";
612 $serverfilename =~ s/\\/\//g;
613 $sharedfilename =~ s/\\/\//g;
615 system( "p4 add //depot" . $serverfilename );
616 system( "p4 add //depot" . $sharedfilename );
618 open COMPONENTS, "<$ship_components";
620 @file = <COMPONENTS>;
622 close COMPONENTS;
624 my $found = 0;
626 foreach my $y (@file)
629 my @fields = split (/\t/, $y);
630 if ( $fields[1] eq "object/tangible/ship/components/reactor/$key.iff")
632 $found = 1;
639 if ($found == 0)
641 open COMPONENTS, ">>$ship_components";
643 print COMPONENTS "$key\tobject/tangible/ship/components/reactor/$key.iff\tobject/tangible/ship/components/reactor/shared_$key.iff\treactor\trct_0\n";
645 close COMPONENTS;
657 sub makeShieldTemplates
659 foreach $key (keys %shield)
661 print "\nStarting process for key $key";
662 my @fields = split /\t/, $shield{$key};
664 $cert = $fields[1];
665 if ( $cert == 10 )
667 $cert = "ten";
670 open SERVER_OBJ, ">$dsrc_server_prefix\\shield_generator\\$key.tpf";
671 print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
672 print SERVER_OBJ "\@class tangible_object_template 1\n";
673 print SERVER_OBJ "\@class object_template 5\n";
674 print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/shield_generator\/shared_$key.iff\"\n";
675 print SERVER_OBJ "moveFlags = [ MF_player ]\n";
676 close SERVER_OBJ;
678 open SHARED_OBJ, ">$dsrc_shared_prefix\\shield_generator\\shared_$key.tpf";
679 print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
680 print SHARED_OBJ "\@class tangible_object_template 8\n";
681 print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
682 print SHARED_OBJ "\@class object_template 7\n";
683 print SHARED_OBJ "clearFloraRadius = 0\n";
684 print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
685 print SHARED_OBJ "detailedDescription = \"space/space_item\" \"generic_shield_d\"\n";
686 print SHARED_OBJ "containerType = CT_none\n";
687 print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_shield_s01.apt\"\n";
688 print SHARED_OBJ "portalLayoutFilename = \"\"\n";
689 print SHARED_OBJ "clientDataFile = \"\"\n";
690 print SHARED_OBJ "gameObjectType = GOT_ship_component_shield\n";
691 close SHARED_OBJ;
693 my $serverfilename = "$dsrc_server_prefix\\shield_generator\\$key.tpf";
694 my $sharedfilename = "$dsrc_shared_prefix\\shield_generator\\shared_$key.tpf";
696 system( "templatecompiler -compile $serverfilename" );
697 system( "templatecompiler -compile $sharedfilename" );
699 $serverfilename =~ s/\\/\//g;
700 $sharedfilename =~ s/\\/\//g;
702 system( "p4 add //depot" . $serverfilename );
703 system( "p4 add //depot" . $sharedfilename );
705 my $serverfilename = "$data_server_prefix\\shield_generator\\$key.iff";
706 my $sharedfilename = "$data_shared_prefix\\shield_generator\\shared_$key.iff";
708 $serverfilename =~ s/\\/\//g;
709 $sharedfilename =~ s/\\/\//g;
711 system( "p4 add //depot" . $serverfilename );
712 system( "p4 add //depot" . $sharedfilename );
714 open COMPONENTS, "<$ship_components";
716 @file = <COMPONENTS>;
718 close COMPONENTS;
720 my $found = 0;
722 foreach my $y (@file)
725 my @fields = split (/\t/, $y);
726 if ( $fields[1] eq "object/tangible/ship/components/shield_generator/$key.iff")
728 $found = 1;
735 if ($found == 0)
737 open COMPONENTS, ">>$ship_components";
739 print COMPONENTS "$key\tobject/tangible/ship/components/shield_generator/$key.iff\tobject/tangible/ship/components/shield_generator/shared_$key.iff\tshield\tshd_0\n";
741 close COMPONENTS;
753 sub makeWeaponTemplates
755 foreach $key (keys %weapon)
757 print "\nStarting process for key $key";
758 my @fields = split /\t/, $weapon{$key};
760 $cert = $fields[1];
761 if ( $cert == 10 )
763 $cert = "ten";
766 open SERVER_OBJ, ">$dsrc_server_prefix\\weapon\\$key.tpf";
767 print SERVER_OBJ "\@base object\/tangible\/ship\/components\/base\/ship_component_loot_base.iff\n";
768 print SERVER_OBJ "\@class tangible_object_template 1\n";
769 print SERVER_OBJ "\@class object_template 5\n";
770 print SERVER_OBJ "sharedTemplate = \"object\/tangible\/ship\/components\/weapon\/shared_$key.iff\"\n";
771 print SERVER_OBJ "moveFlags = [ MF_player ]\n";
772 close SERVER_OBJ;
774 open SHARED_OBJ, ">$dsrc_shared_prefix\\weapon\\shared_$key.tpf";
775 print SHARED_OBJ "\@base object\/tangible\/ship\/components\/base\/shared_ship_component_loot_base.iff\n";
776 print SHARED_OBJ "\@class tangible_object_template 8\n";
777 print SHARED_OBJ "certificationsRequired = [\"cert_ordnance_level$cert\"]\n";
778 print SHARED_OBJ "\@class object_template 7\n";
779 print SHARED_OBJ "clearFloraRadius = 0\n";
780 print SHARED_OBJ "objectName = \"space/space_item\" \"".$key."_n\"\n";
781 print SHARED_OBJ "detailedDescription = \"space/space_item\" \"generic_weapon_d\"\n";
782 print SHARED_OBJ "containerType = CT_none\n";
783 print SHARED_OBJ "appearanceFilename = \"appearance\/ship_component_weapon_s01.apt\"\n";
784 print SHARED_OBJ "portalLayoutFilename = \"\"\n";
785 print SHARED_OBJ "clientDataFile = \"\"\n";
786 print SHARED_OBJ "gameObjectType = GOT_ship_component_weapon\n";
787 close SHARED_OBJ;
789 my $serverfilename = "$dsrc_server_prefix\\weapon\\$key.tpf";
790 my $sharedfilename = "$dsrc_shared_prefix\\weapon\\shared_$key.tpf";
792 system( "templatecompiler -compile $serverfilename" );
793 system( "templatecompiler -compile $sharedfilename" );
795 $serverfilename =~ s/\\/\//g;
796 $sharedfilename =~ s/\\/\//g;
798 system( "p4 add //depot" . $serverfilename );
799 system( "p4 add //depot" . $sharedfilename );
801 my $serverfilename = "$data_server_prefix\\weapon\\$key.iff";
802 my $sharedfilename = "$data_shared_prefix\\weapon\\shared_$key.iff";
804 $serverfilename =~ s/\\/\//g;
805 $sharedfilename =~ s/\\/\//g;
807 system( "p4 add //depot" . $serverfilename );
808 system( "p4 add //depot" . $sharedfilename );
810 open COMPONENTS, "<$ship_components";
812 @file = <COMPONENTS>;
814 close COMPONENTS;
816 my $found = 0;
818 foreach my $y (@file)
821 my @fields = split (/\t/, $y);
822 if ( $fields[1] eq "object/tangible/ship/components/weapon/$key.iff")
824 $found = 1;
831 if ($found == 0)
833 open COMPONENTS, ">>$ship_components";
835 print COMPONENTS "$key\tobject/tangible/ship/components/weapon/$key.iff\tobject/tangible/ship/components/weapon/shared_$key.iff\tweapon\twpn_0\n";
837 close COMPONENTS;