#!/usr/bin/perl # ***************************DO NOT REMOVE THIS NOTICE****************************** # ASpace Class Creator # Description: This program accepts values entered into a webform and generates # generates MUSHcode to create a parent for ASpace space objects of that particular # class. Intended for use with PennMUSH 1.7.4 and above with ASpace 1.0.0 and above. # # Copyright (C) 2002 Michael Wilmington (kyieren@cyberspace.org) # GNU General Public License: http://www.gnu.org/copyleft/gpl.html # Visit the Unofficial ASpace Support Page! http://aspace.whizy.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ***************************DO NOT REMOVE THIS NOTICE******************************* use CGI ':standard'; no warnings; $q = new CGI; # Put the information from the webform into a series of variables, adding 0 to numeric values to guard against them being left blank # Print results on a webpage, then log in as Space on your game and /quote in the rest of the page print "content-type: text/html\n\n"; print "\n"; print "ASpace Class Creator v1.0 - Class Created!\n"; print "\n"; # Name of the class my $cname = $q->param('cname'); # Don't allow the script to be processed if the class isn't given a name if ($cname eq "") { print "You must specify the name of the class!
"; print ""; exit 0; } # Space object type my $ctype = 0 + $q->param('ctype'); # Superstructure = hull strength my $superstructure = 0 + $q->param('superstructure'); # Repair capacity my $repcap = 0 + $q->param('repcap'); # Move cost, factor in turning and acceleration my $movecost = 0 + $q->param('movecost'); # Displacement, how much room the object takes up my $displacement = 0 + $q->param('displacement'); # Cargo capacity, how much cargo and ships the object can carry my $cargocap = 0 + $q->param('cargocap'); # Does the object have landing pads? my $pads = 0 + $q->param('pads'); # Does the object have docking ports? my $ports = 0 + $q->param('ports'); # Can the object land? my $land = 0 + $q->param('land'); # Can the object dock? my $dock = 0 + $q->param('dock'); # Does it have a M/A (main) Reactor? my $ma = 0 + $q->param('ma'); # How much the M/A Reactor puts out my $mapower = 0 + $q->param('mapower'); # Does the object have a fusion (auxiliary) reactor? my $fus = 0 + $q->param('fus'); # How much the fusion reactor puts out my $fuspower = 0 + $q->param('fuspower'); # Does the object have batteries (reserves)? my $batt = 0 + $q->param('batt'); # How much the batteries put out my $battpower = 0 + $q->param('battpower'); # Does the object have warp (faster-than-light) capability? my $warp = 0 + $q->param('warp'); # Cruising warp speed...maximum warp without overloading the reactors my $cruisewarp = 0 + $q->param('cruisewarp'); # Maximum attainable warp speed my $maxwarp = 0 + $q->param('maxwarp'); # Does the object have an impulse (sublight) drive? my $impulse = 0 + $q->param('impulse'); # Crusing impulse speed, max. impulse without overload my $cruiseimpulse = 0 + $q->param('cruiseimpulse'); # Maximum attainable impulse speed my $maximpulse = 0 + $q->param('maximpulse'); # Does the object have long-range sensors? my $lrs = 0 + $q->param('lrs'); # Does the object have short-range sensors? my $srs = 0 + $q->param('srs'); # Does the object have electronic warfare systems (ECM and ECCM)? my $ew = 0 + $q->param('ew'); # Does the object have shields? my $shields = 0 + $q->param('shields'); # The object's shield ratio, see AttySpace Tutorial for details my $ratio1 = 0 + $q->param('ratio1'); my $ratio2 = 0 + $q->param('ratio2'); # Maximum energy the shields can absorb my $tolerance = 0 + $q->param('tolerance'); # Does the object have beam weapons (phasers)? my $beams = 0 + $q->param('beams'); # How many beams does the object have? my $numbeams = 0 + $q->param('numbeams'); # Store info about beam weapons into arrays and process as needed # Names of each of the beam weapons my @bnames = (0 + $q->param('bname1'), 0 + $q->param('bname2'), 0 + $q->param('bname3'),0 + $q->param('bname4'),0 + $q->param('bname5'),0 + $q->param('bname6'),0 + $q->param('bname7'),0 + $q->param('bname8'),0 + $q->param('bname9'),0 + $q->param('bname10'),0 + $q->param('bname11'),0 + $q->param('bname12'),0 + $q->param('bname13'),0 + $q->param('bname14'),0 + $q->param('bname15'),0 + $q->param('bname16'),0 + $q->param('bname17'),0 + $q->param('bname18'),0 + $q->param('bname19'),0 + $q->param('bname20')); # Power cost of each beam weapon my @bcosts = (0 + $q->param('bcost1'), 0 + $q->param('bcost2'),0 + $q->param('bcost3'),0 + $q->param('bcost4'),0 + $q->param('bcost5'),0 + $q->param('bcost6'),0 + $q->param('bcost7'),0 + $q->param('bcost8'),0 + $q->param('bcost9'),0 + $q->param('bcost10'),0 + $q->param('bcost11'),0 + $q->param('bcost12'),0 + $q->param('bcost13'),0 + $q->param('bcost14'),0 + $q->param('bcost15'),0 + $q->param('bcost16'),0 + $q->param('bcost17'),0 + $q->param('bcost18'),0 + $q->param('bcost19'),0 + $q->param('bcost20')); # Bonus damage each beam weapon does to its opponent my @bbonuses = (0 + $q->param('bbonus1'), 0 + $q->param('bbonus2'),0 + $q->param('bbonus3'),0 + $q->param('bbonus4'),0 + $q->param('bbonus5'),0 + $q->param('bbonus6'),0 + $q->param('bbonus7'),0 + $q->param('bbonus8'),0 + $q->param('bbonus9'),0 + $q->param('bbonus10'),0 + $q->param('bbonus11'),0 + $q->param('bbonus12'),0 + $q->param('bbonus13'),0 + $q->param('bbonus14'),0 + $q->param('bbonus15'),0 + $q->param('bbonus16'),0 + $q->param('bbonus17'),0 + $q->param('bbonus18'),0 + $q->param('bbonus19'),0 + $q->param('bbonus20')); # Range of the beam weapons my @branges = (0 + $q->param('brange1'), 0 + $q->param('brange2'),0 + $q->param('brange3'),0 + $q->param('brange4'),0 + $q->param('brange5'),0 + $q->param('brange6'),0 + $q->param('brange7'),0 + $q->param('brange8'),0 + $q->param('brange9'),0 + $q->param('brange10'),0 + $q->param('brange11'),0 + $q->param('brange12'),0 + $q->param('brange13'),0 + $q->param('brange14'),0 + $q->param('brange15'),0 + $q->param('brange16'),0 + $q->param('brange17'),0 + $q->param('brange18'),0 + $q->param('brange19'),0 + $q->param('brange20')); # Arcs (facings) of each beam weapon my @barcs = (0 + $q->param('barcs1'),0 + $q->param('barcs2'),0 + $q->param('barcs3'),0 + $q->param('barcs4'),0 + $q->param('barcs5'),0 + $q->param('barcs6'),0 + $q->param('barcs7'),0 + $q->param('barcs8'),0 + $q->param('barcs9'),0 + $q->param('barcs10'),0 + $q->param('barcs11'),0 + $q->param('barcs12'),0 + $q->param('barcs13'),0 + $q->param('barcs14'),0 + $q->param('barcs15'),0 + $q->param('barcs16'),0 + $q->param('barcs17'),0 + $q->param('barcs18'),0 + $q->param('barcs19'),0 + $q->param('barcs20')); # Does the object have missile weapons (torpedoes)? my $missiles = 0 + $q->param('missiles'); # How many missile weapons does the object have? my $nummissiles = 0 + $q->param('nummissiles'); # Names of each missile weapon my @mnames = (0 + $q->param('mname1'), 0 + $q->param('mname2'), 0 + $q->param('mname3'),0 + $q->param('mname4'),0 + $q->param('mname5'),0 + $q->param('mname6'),0 + $q->param('mname7'),0 + $q->param('mname8'),0 + $q->param('mname9'),0 + $q->param('mname10'),0 + $q->param('mname11'),0 + $q->param('mname12'),0 + $q->param('mname13'),0 + $q->param('mname14'),0 + $q->param('mname15'),0 + $q->param('mname16'),0 + $q->param('mname17'),0 + $q->param('mname18'),0 + $q->param('mname19'),0 + $q->param('mname20')); # Power cost of each missile weapon my @mcosts = (0 + $q->param('mcost1'), 0 + $q->param('mcost2'),0 + $q->param('mcost3'),0 + $q->param('mcost4'),0 + $q->param('mcost5'),0 + $q->param('mcost6'),0 + $q->param('mcost7'),0 + $q->param('mcost8'),0 + $q->param('mcost9'),0 + $q->param('mcost10'),0 + $q->param('mcost11'),0 + $q->param('mcost12'),0 + $q->param('mcost13'),0 + $q->param('mcost14'),0 + $q->param('mcost15'),0 + $q->param('mcost16'),0 + $q->param('mcost17'),0 + $q->param('mcost18'),0 + $q->param('mcost19'),0 + $q->param('mcost20')); # Size of torpedo warheads, can cause more damage to opponent my @mwarheads = (0 + $q->param('mwarhead1'), 0 + $q->param('mwarhead2'),0 + $q->param('mwarhead3'),0 + $q->param('mwarhead4'),0 + $q->param('mwarhead5'),0 + $q->param('mwarhead6'),0 + $q->param('mwarhead7'),0 + $q->param('mwarhead8'),0 + $q->param('mwarhead9'),0 + $q->param('mwarhead10'),0 + $q->param('mwarhead11'),0 + $q->param('mwarhead12'),0 + $q->param('mwarhead13'),0 + $q->param('mwarhead14'),0 + $q->param('mwarhead15'),0 + $q->param('mwarhead16'),0 + $q->param('mwarhead17'),0 + $q->param('mwarhead18'),0 + $q->param('mwarhead19'),0 + $q->param('mwarhead20')); # Range of missile weapons my @mranges = (0 + $q->param('mrange1'), 0 + $q->param('mrange2'),0 + $q->param('mrange3'),0 + $q->param('mrange4'),0 + $q->param('mrange5'),0 + $q->param('mrange6'),0 + $q->param('mrange7'),0 + $q->param('mrange8'),0 + $q->param('mrange9'),0 + $q->param('mrange10'),0 + $q->param('mrange11'),0 + $q->param('mrange12'),0 + $q->param('mrange13'),0 + $q->param('mrange14'),0 + $q->param('mrange15'),0 + $q->param('mrange16'),0 + $q->param('mrange17'),0 + $q->param('mrange18'),0 + $q->param('mrange19'),0 + $q->param('mrange20')); # Arcs (facings) of each beam weapon my @marcs = (0 + $q->param('marcs1'),0 + $q->param('marcs2'),0 + $q->param('marcs3'),0 + $q->param('marcs4'),0 + $q->param('marcs5'),0 + $q->param('marcs6'),0 + $q->param('marcs7'),0 + $q->param('marcs8'),0 + $q->param('marcs9'),0 + $q->param('marcs10'),0 + $q->param('marcs11'),0 + $q->param('marcs12'),0 + $q->param('marcs13'),0 + $q->param('marcs14'),0 + $q->param('marcs15'),0 + $q->param('marcs16'),0 + $q->param('marcs17'),0 + $q->param('marcs18'),0 + $q->param('marcs19'),0 + $q->param('marcs20')); # Does the object have a transporter? my $trans = 0 + $q->param('trans'); # How much power it takes to operate the transporter my $transpower = 0 + $q->param('transpower'); # Does the object have a tractor beam? my $tractor = 0 + $q->param('tractor'); # How much power it takes to operate the tractor beam my $tractorpower = 0 + $q->param('tractorpower'); # Does the object have a cloaking device? my $cloak = 0 + $q->param('cloak'); # How much power it takes to operate the cloaking device my $cloakpower = 0 + $q->param('cloakpower'); # Accuracy of the ship's targeting system my $firingtech = 0 + $q->param('firingtech'); # How much fuel can be carried my $fueltech = 0 + $q->param('fueltech'); # Object's natural stealthiness my $stealthtech = 0 + $q->param('stealthtech'); # Effectiveness of cloaking device my $cloaktech = 0 + $q->param('cloaktech'); # Effectiveness of sensor arrays my $sensortech = 0 + $q->param('sensortech'); # Strength of unshielded hull my $armortech = 0 + $q->param('armortech'); # How much M/A Reactor can be overloaded (1.20 = 120%) my $matech = 0 + $q->param('matech'); # How much Fusion Reactor can be overloaded (1.20 = 120%) my $fustech = 0 + $q->param('fustech'); # Print simple confirmation message when /quoting print "think ASpace Class Creator v1.0: Initializing...
"; # Create the space object print "\@create $cname
"; # Set the attributes on the object print "&SPACE $cname=1
"; print "&ALLOCATE $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&BEAM $cname=0 0 1 $beams $numbeams
"; print "&BEAM_ACTIVE $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&BEAM_NAME $cname=@bnames
"; print "&BEAM_DAMAGE $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&BEAM_BONUS $cname=@bbonuses
"; print "&BEAM_COST $cname=@bcosts
"; print "&BEAM_RANGE $cname=@branges
"; print "&BEAM_ARCS $cname=@barcs
"; print "&BEAM_LOCK $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&BEAM_LOAD $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&MISSILE $cname=0 0 1 $missiles $nummissiles
"; print "&MISSILE_ACTIVE $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&MISSILE_NAME $cname=@mnames
"; print "&MISSILE_DAMAGE $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&MISSILE_WARHEAD $cname=@mwarheads
"; print "&MISSILE_COST $cname=@mcosts
"; print "&MISSILE_RANGE $cname=@mranges
"; print "&MISSILE_ARCS $cname=@marcs
"; print "&MISSILE_LOCK $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&MISSILE_LOAD $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&ENGINE $cname=0 1 $maxwarp $warp 1 $maximpulse $impulse $cruisewarp $cruiseimpulse
"; print "&STRUCTURE $cname=$ctype $displacement $cargocap 0 $superstructure $superstructure $pads $ports $land $dock $repcap $repcap
"; print "&POWER $cname=0 0 0 0
"; print "&SENSOR $cname=0 1 0 $lrs 1 1 1 0 $srs 1 1 1 0 $ew 1 1 1
"; print "&SHIELD $cname=$ratio1 $ratio2 1 $shields 0 0 0 0 1 1 1 1
"; print "&TECHNOLOGY $cname=$firingtech $fueltech $stealthtech $cloaktech $sensortech $fusiontech $matech $armortech
"; print "&MOVEMENT $cname=0 1 0 0 $movecost 1000 0 0 1
"; print "&CLOAK $cname=0 $cloakpower 1 $cloak 0 1
"; print "&TRANS $cname=0 1 $trans 0 1 0 0
"; print "&TRACT $cname=$tracpower 1 $trac 0 1 0
"; print "&COORDS $cname=0 0 0 0 0 0 0 0 0
"; print "&COURSE $cname=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
"; print "&MAIN $cname=0 0 1 $mapower $ma
"; print "&AUX $cname=0 0 1 $fuspower $fus
"; print "&BATT $cname=0 0 1 $battpower $batt
"; print "&FUEL $cname=0 0 0
"; print "&STATUS $cname=0 0 0 0 0 0 0 0 0 0
"; # Another confirmation message, to let the user know we're done print "think ASpace Class Creator v1.0: '$cname' class created!"; # Close the tags, we're done creating the page print "\n";