'commandturret', 'commandturretmkiii' => 'commandturret', 'commandturretmkiv' => 'commandturret', 'commandturretii' => 'commandturret', 'commandturretiii' => 'commandturret', 'commandturretiv' => 'commandturret', 'vtolclusterbombsbay' => 'vtolclusterbombbay', 'cannon' => 'lightcannon', 'minirocket' => 'minirocketpod', 'mrlemplacement' => 'minirocketbattery', 'archangelmissileemplacement' => 'archangelmissilebattery', 'angelmissileemplacement' => 'angelmissilebattery', 'seraphmissilearray' => 'angelmissile', 'seraphmissilebattery' => 'angelmissilebattery', 'transport' => 'cyborgtransport', 'transportbody' => 'cyborgtransport', 'hypervelocitycannonemplacement' => 'hpvcannonemplacement', 'hypervelocitycannonhardpoint' => 'hpvcannonhardpoint', 'cyborgchaingun1ground' => 'heavygunner', 'cyborgpropulsion' => 'heavygunner', 'empmortar' => 'empmortarpit', 'massdriver' => 'massdriverfortress', 'plasmacannonemplacement' => 'heavylaseremplacement', 'empcannontower' => 'empmissilehardpoint', 'hardcretecornerwall' => 'hardcretewall', 'engineering' => 'truck', ); $imgroot = ''; if (is_dir('../icon/')) $imgroot = '../'; function geticon($id, $type=false) { global $icons, $imgroot, $wz_research; if ((!$type || $type == 'w') && file_exists($imgroot.'icon/w/'.$id.'.gif')) return $imgroot.'icon/w/'.$id.'.gif'; if ((!$type || $type == 'c') && file_exists($imgroot.'icon/c/'.$id.'.gif')) return $imgroot.'icon/c/'.$id.'.gif'; if ((!$type || $type == 'bp') && file_exists($imgroot.'icon/bp/'.$id.'.gif')) return $imgroot.'icon/bp/'.$id.'.gif'; if ((!$type || $type == 'd') && file_exists($imgroot.'icon/d/'.$id.'.gif')) return $imgroot.'icon/d/'.$id.'.gif'; if ((!$type || $type == 'b') && file_exists($imgroot.'icon/b/'.$id.'.gif')) return $imgroot.'icon/b/'.$id.'.gif'; if ($type) { if ($icon = geticon($id)) return $icon; if ($type == 'r' && $wz_research[$id]['results'][0][1]) return geticon($wz_research[$id]['results'][0][1]); } if (isset($icons[$id])) return geticon($icons[$id]); if (substr($id,0,4) == 'vtol') return geticon(substr($id,4)); if (substr($id,-1) == '2') return geticon(substr($id,0,-1)); return false; } function iconimg($id, $type=false, $prefix='../') { if ($icon = geticon($id, $type)) return ' '; return ''; } $isadmin = false; $isauth = false; if (substr($_COOKIE['name'],-strlen($adminpass)-1)===':'.$adminpass) { $isadmin = $isauth = true; $_COOKIE['name'] = substr($_COOKIE['name'],0,-strlen($adminpass)-1); } else if ($_REQUEST['captcha'] === $adminpass) $isadmin = $isauth = true; else if (substr($_COOKIE['name'],-3) == ':mg') { $isauth = true; $_COOKIE['name'] = substr($_COOKIE['name'],0,-3); } else if ($_COOKIE['name']) $_POST['forget'] = true; @include_once 'cache/research.inc.php'; @include_once 'cache/weapons.inc.php'; @include_once 'cache/weapontable.inc.php'; @include_once 'cache/wsubclasses.inc.php'; @include_once 'cache/functions.inc.php'; @include_once 'cache/structures.inc.php'; @include_once 'cache/bodies.inc.php'; @include_once 'cache/propulsions.inc.php'; @include_once 'cache/templates.inc.php'; @include_once 'persist.lib.php'; @include_once 'guide.inc.php'; $idr = array_keys($_GET); $id = ''; if (!$_GET[$idr[0]]) { $id = $idr[0]; } else if ($_GET['w'] && $_GET['b'] && $_GET['p']) { $id = true; } if (!$id && $run) { header("HTTP/1.0 404 Not Found"); include('404.php'); die(); } else if ($id && $id !== true && ( substr($_SERVER['REQUEST_URI'],0,3)=='/b/' && !$wz_structures[$id] || substr($_SERVER['REQUEST_URI'],0,3)=='/d/' && !$wz_structures[$id] || substr($_SERVER['REQUEST_URI'],0,3)=='/w/' && !$wz_weapons[$id] || substr($_SERVER['REQUEST_URI'],0,3)=='/c/' && !$wz_cyborgs[$id] && !$wz_templates[$id] || substr($_SERVER['REQUEST_URI'],0,4)=='/bp/' && !$wz_bodies[$id] && !$wz_propulsions[$id] || substr($_SERVER['REQUEST_URI'],0,3)=='/r/' && !$wz_research[$id] )) { header("HTTP/1.0 404 Not Found"); include('404.php'); die(); } $ar = array(); $dt = array('weaponacc' => 'accuracy', 'weapondam' => 'damage', 'weaponsdam' => 'splash damage', 'weaponfdam' => 'burn damage', 'weaponrof' => 'rate of fire'); $upgrades = array('powerupgrade' => 'power production', 'researchupgrade' => 'research speed', 'repairupgrade' => 'repair facility speed', 'rearmupgrade' => 'VTOL rearming pad speed', 'vehicleconstupgrade' => 'construction speed', 'factoryupgrade' => 'factory production speed', 'cyborgfactoryupgrade' => 'cyborg factory production speed', 'vtolfactoryupgrade' => 'VTOL factory production speed', 'vehiclesensorupgrade' => 'vehicle sensor range', 'vehicleecmupgrade' => 'vehicle ECM range', 'vehicleengine' => 'vehicle engine output', 'vehiclearmor' => 'vehicle kinetic armor', 'vehiclehp' => 'vehicle HP', 'vehiclethermal' => 'vehicle thermal armor', 'cyborgengine' => 'cyborg engine output', 'cyborghp' => 'cyborg HP', 'cyborgarmor' => 'cyborg kinetic armor', 'cyborgthermal' => 'cyborg thermal armor', 'wallarmor' => 'hardcrete kinetic/thermal armor', 'wallhp' => 'hardcrete HP', 'structurearmor' => 'base structure kinetic/thermal armor', 'structurehp' => 'base structure HP', 'structureresist' => 'base structure Nexus link resistance'); $directions = array('direct' => '', 'indirect' => 'indirect ', 'indirecthoming' => 'indirect-homing ', 'homingdirect' => 'homing ', 'erraticdirect' => 'erratic '); $classes = array('kinetic' => 'kinetic', 'heat' => 'thermal'); $types = array('antiaircraft' => 'anti-air', 'antipersonnel' => 'anti-personnel', 'antitank' => 'anti-tank', 'artilleryround' => 'artillery', 'bunkerbuster' => 'anti-structure', 'flamer' => 'fire', 'allrounder' => 'all-rounder'); $subclasses = array('machinegun' => 'machinegun', 'cannon' => 'cannon', 'flame' => 'flamer', 'mortars' => 'mortar', 'howitzers' => 'howitzer', 'rocket' => 'mini-rocket', 'missile' => 'missile', 'slowrocket' => 'rocket', 'gauss' => 'rail gun', 'energy' => 'laser', 'electronic' => 'electronic weapon', 'command' => 'commander', 'emp' => 'EMP cannon', 'aagun' => 'AA-gun', 'bomb' => 'bomb', 'lassat' => 'laser satellite'); $props = array('legged' => 'Cyborg', 'wheeled' => 'Wheels', 'halftracked' => 'Half-Tracks', 'tracked' => 'Tracks', 'lift' => 'VTOL', 'hover' => 'Hover', 'soft' => 'Soft structures', 'medium' => 'Medium structures', 'hard' => 'Hard structures', 'bunker' => 'Bunkers'); $sensors = array('standard' => 'Sensor', 'indirectcb' => 'Counter-Battery', 'vtolintercept' => 'VTOL Sensor', 'vtolcb' => 'VTOL Counter-Battery', 'super' => 'Sensor, VTOL, CB, VTOL CB', 'radardetector' => 'Sensor Detector', 'uplink' => 'Reveal entire map'); $strengths = array('soft' => 'Soft', 'medium' => 'Medium', 'hard' => 'Hard', 'bunker' => 'Bunker'); $rebalance = false; if ($wz_weapons['heavycannon']['type'] == 'antiaircraft') { $rebalance = true; $types['antiaircraft'] = 'all-rounder'; } function simplify($name,$array=array()) { $name = strtr($name, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"); $in = ($name[0]=='*'); $name = preg_replace('/[^a-z0-9]+/','',$name); $i = 1; if ($name) $id = 'internal-'.$name; //if (strpos($wzid,'R-') === 0) $name = 'r-'.$name; //else if (strpos($wzid,'Cyborg-Wpn-') !== false || strpos($wzid,'Cyb-') || //strpos($wzid,'Cyborg') !== false) $name = 'c-'.$name; $id = $name; while (in_array($id,$array)) $id = $name.(++$i); return $id; } function tourl($id) { if (!$id) return ''; return $id; } /* * GENERATOR FUNCTIONS */ function upg($val, $upg=0) { return round($val*(100+$upg)/100,1); } function iupg($val, $upg=0) { return intval($val*(100+$upg)/100); } function mktemplate($weapon,$body,$prop) { global $wz_weapons, $wz_bodies, $wz_propulsions; if (is_string($weapon)) $weapon = $wz_weapons[$weapon]; if (is_string($body)) $body = $wz_bodies[$body]; if (is_string($prop)) $prop = $wz_propulsions[$prop]; return array( 'tid' => '', 'name' => $weapon['name'].' '.$body['name'].' '.$prop['name'], 'turrets' => array( $weapon['wid'] ), 'body' => $body['bid'], 'propulsion' => $prop['pid'], 'brain' => '', 'construct' => '', 'ecm' => '', 'repair' => NULL, 'sensor' => NULL, 'prereq' => '', 'hp' => iupg($body['hp'],$prop['hp']), 'armor' => $body['armor'], 'thermal' => $body['thermal'], 'engine' => $body['engine'], 'maxspeed' => $prop['maxspeed'], 'weight' => $weapon['weight']+iupg($body['weight'],$prop['weight']), 'bp' => $weapon['bp']+iupg($body['bp'],$prop['bp']), 'price' => $weapon['price']+$body['price']+$prop['price'], 'aionly' => FALSE ); } function weapontype($weapon, $upg=0) { global $directions, $classes, $types, $subclasses; $res = ''; if ($weapon['splash']) $res = 'Splash: '.iupg($weapon['splashdamage'],$upg).($weapon['splashacc']==100?'':' - '.$weapon['splashacc'].'%').' - radius '.round($weapon['splash']/128,1).' | '; if ($weapon['burn']) $res .= 'Burn: '.iupg($weapon['burndamage'],$upg).' - '.($weapon['burntime']/10).' sec - radius '.round($weapon['burn']/128,1).' | '; return $res.$directions[$weapon['direction']].$classes[$weapon['class']].' '.$types[$weapon['type']].' '.$subclasses[$weapon['subclass']]; } function weapondam($weapon, $upg=0) { if ($weapon['subclass']=='emp' && $weapon['damage']==0) { return "EMP".($weapon['splash']?'s':'').($weapon['burn']?'f':'').""; } return "".iupg($weapon['damage'],$upg)."".($weapon['splash']?'s':'').($weapon['burn']?'f':'').($weapon['subclass']=='emp'?'+EMPs':'').""; } function weaponrof($weapon, $upg=0) { if ($weapon['numattackruns']) return "".$weapon['nrounds']."×".$weapon['numattackruns'].""; return "".round($weapon['rof']*100/(100-$upg),1).""; } function templatehp($template, $upg=0) { global $wz_bodies, $wz_propulsions; return ''.iupg($template['hp'],$upg).""; } function structurehp($structure, $upg=0) { global $wz_weapons; if (!$structure['turrets']) return ''.$structure['hp']; return ''.iupg($structure['hp'],$upg).""; } function bodyarmor($body, $upg1=0, $upg2=0) { //if ($body['body']) $body = $GLOBALS['wz_bodies'][$body['body']]; return ''.iupg($body['armor'],$upg1).'/'.iupg($body['thermal'],$upg2).''; } function structurearmor($struct, $upg=0) { //if ($body['body']) $body = $GLOBALS['wz_bodies'][$body['body']]; return ''.iupg($struct['armor'],$upg).'/'.iupg($struct['armor'],$upg).''; } function templatespeed($template, $upg=0) { global $wz_propulsions, $wz_proptypes, $wz_bodies; $prop = $wz_propulsions[$template['propulsion']]; if (!$template['weight']) return 0; return intval(min( $prop['maxspeed'], $wz_proptypes[$prop['prop']]['speed']*iupg($wz_bodies[$template['body']]['engine'],$upg)/$template['weight'] )); } function weaponupgrades($weapon, $root='') { global $wz_wsubclasses, $wz_research, $wz_functions; if (is_string($weapon)) $weapon = $GLOBALS['wz_weapons'][$weapon]; $tout = ''; if ($weapon['turret'] == 'weapon' && $wz_wsubclasses[$weapon['subclass']]['upgrades']) { foreach ($wz_wsubclasses[$weapon['subclass']]['upgrades'] as $upgrade) { if ($wz_functions[$wz_research[$upgrade]['result'][0][1]]['funcs'][0]['type'] == 'weapondam') $tout .= '
No damage upgrades available.
\n"; $tout = ''; foreach ($wz_wsubclasses[$weapon['subclass']]['upgrades'] as $upgrade) if ($wz_functions[$wz_research[$upgrade]['result'][0][1]]['funcs'][0]['type'] == 'weaponrof') $tout .= 'No ROF upgrades available.
\n"; $tout = ''; foreach ($wz_wsubclasses[$weapon['subclass']]['upgrades'] as $upgrade) if ($wz_functions[$wz_research[$upgrade]['result'][0][1]]['funcs'][0]['type'] == 'weaponacc') $tout .= 'No accuracy upgrades available.
\n"; } else if ($weapon['turret'] == 'construct') { $out .= "No upgrades available.
\n"; return $out; } function bodyupgrades($cyborg=true, $root='') { global $wz_upgrades, $wz_research, $wz_functions; $out = ''.iconimg($weapon['tid']?$weapon['tid']:$weapon['wid'],'w').' $'.$weapon['price'].' Turret ID: '.aval(array_keys($wz_wids,$weapon['wid']),0).'
'; if ($weapon['turret'] == 'weapon') $out .= '['.weapontype($weapon)."]
\n"; $out .= 'Base | Upgraded | |
---|---|---|
Damage: | '.weapondam($weapon).' | '.weapondam($weapon,$wz_wsubclasses[$weapon['subclass']]['maxdam']).' |
ROF: | '.weaponrof($weapon).' | '.weaponrof($weapon,$wz_wsubclasses[$weapon['subclass']]['maxrof']).' |
DPS: | '.$weapon['dps'].' | '.round($weapon['dps']*100/(100-$wz_wsubclasses[$weapon['subclass']]['maxrof'])*($wz_wsubclasses[$weapon['subclass']]['maxdam']+100)/100*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).' |
Accuracy: (close-long) | '.$weapon['sacc'].'-'.$weapon['lacc'].'% | '.round($weapon['sacc']*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).'-'.round($weapon['lacc']*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).'% |
Range: (close-long) | '."".round($weapon['srange']/128,1)."- ".round($weapon['lrange']/128,1)." | |
Attack runs: | '.$weapon['numattackruns'].' | |
DPR: | '.($weapon['damage']*$weapon['lacc']/100*$weapon['nrounds']*$weapon['numattackruns']).' | '.round($weapon['damage']*$weapon['lacc']/100*$weapon['nrounds']*$weapon['numattackruns']*($wz_wsubclasses[$weapon['subclass']]['maxdam']+100)/100*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).' |
Sensor: | '.$sensors[$weapon['sensor']].' | |
Range: | '.round($weapon['lrange']/128,1).' | '.round($weapon['lrange']*($wz_wsubclasses['sensor']['maxrange']+100)/100/128,1).' |
Build points: | '.$weapon['build'].' | '.round($weapon['build']*($wz_wsubclasses[$weapon['subclass']]['maxbuild']+100)/100,1).' |
Base | Upgraded | |
HP: | '.$weapon['hp']." | |
Weight: | '.$weapon['weight']." |
Prerequisites: {$wz_research[$weapon['prereq']]['name']}
"; return $out; } function templatedesc($template, $root='', $cyborg=true) { global $wz_wsubclasses, $wz_research, $wz_wids, $wz_tids, $sensors, $wz_upgrades, $wz_templates, $wz_bodies; if (is_string($template)) $template = $GLOBALS['wz_templates'][$template]; $weapon = $GLOBALS['wz_weapons'][$template['turrets'][0]]; if (iconimg($template['tid'],'c')) { $icon = iconimg($template['tid'],'c'); } else { $icon = iconimg($template['turrets'][0],'w').iconimg($template['body'],'bp').iconimg($template['propulsion'],'bp'); } $out = ''.$icon.' $'.$template['price'].' Template ID: '.aval(array_keys($wz_tids,$template['tid']),0).'
'; if ($weapon['turret'] == 'weapon') $out .= '['.weapontype($weapon)."]
\n"; $out .= 'Base | Upgraded | |
---|---|---|
Damage: | '.weapondam($weapon).' | '.weapondam($weapon,$wz_wsubclasses[$weapon['subclass']]['maxdam']).' |
ROF: | '.weaponrof($weapon).' | '.weaponrof($weapon,$wz_wsubclasses[$weapon['subclass']]['maxrof']).' |
DPS: | '.$weapon['dps'].' | '.round($weapon['dps']*100/(100-$wz_wsubclasses[$weapon['subclass']]['maxrof'])*($wz_wsubclasses[$weapon['subclass']]['maxdam']+100)/100*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).' |
Accuracy: (close-long) | '.$weapon['sacc'].'-'.$weapon['lacc'].'% | '.round($weapon['sacc']*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).'-'.round($weapon['lacc']*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).'% |
Range: (close-long) | '."".round($weapon['srange']/128,1)."- ".round($weapon['lrange']/128,1)." | |
Attack runs: | '.$weapon['numattackruns'].' | |
DPR: | '.($weapon['damage']*$weapon['lacc']/100*$weapon['nrounds']*$weapon['numattackruns']).' | '.round($weapon['damage']*$weapon['lacc']/100*$weapon['nrounds']*$weapon['numattackruns']*($wz_wsubclasses[$weapon['subclass']]['maxdam']+100)/100*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).' |
Sensor: | '.$sensors[$weapon['sensor']].' | |
Range: | '.round($weapon['lrange']/128,1).' | '.round($weapon['lrange']*($wz_wsubclasses['sensor']['maxrange']+100)/100/128,1).' |
Build points: | '.$weapon['build'].' | '.round($weapon['build']*($wz_wsubclasses[$weapon['subclass']]['maxbuild']+100)/100,1).' |
Base | Upgraded | |
HP: | '.templatehp($template).' | '.templatehp($template,$cyborg?$wz_upgrades['cyborghp']['max']:$wz_upgrades['vehiclehp']['max'])." |
Armor: | '.bodyarmor($wz_bodies[$template['body']]).' | '.bodyarmor($wz_bodies[$template['body']],$cyborg?$wz_upgrades['cyborgarmor']['max']:$wz_upgrades['vehiclearmor']['max'],$cyborg?$wz_upgrades['cyborgthermal']['max']:$wz_upgrades['vehiclethermal']['max'])." |
Speed: | '.templatespeed($template).' | '.templatespeed($template,$wz_upgrades['vehicleengine']['max'])." |
Weight: | '.$template['weight']." |
Prerequisites: {$wz_research[$template['prereq']]['name']}
"; return $out; } function structuredesc($struct, $root='', $base=false) { global $wz_wsubclasses, $wz_research, $wz_wids, $wz_sids, $sensors, $wz_upgrades; if (is_string($struct)) $struct = $GLOBALS['wz_structures'][$struct]; $weapon = array(); if ($struct['turrets']) { $weapon = $GLOBALS['wz_weapons'][$struct['turrets'][0]]; } $out = ''.iconimg($struct['sid'],'c').' $'.$struct['price'].' Structure ID: '.aval(array_keys($wz_sids,$struct['sid']),0).'
'; if ($weapon && $weapon['turret'] == 'weapon') $out .= '['.weapontype($weapon)."]
\n"; $out .= 'Base | Upgraded | |
---|---|---|
Damage: | '.weapondam($weapon).' | '.weapondam($weapon,$wz_wsubclasses[$weapon['subclass']]['maxdam']).' |
ROF: | '.weaponrof($weapon).' | '.weaponrof($weapon,$wz_wsubclasses[$weapon['subclass']]['maxrof']).' |
DPS: | '.$weapon['dps'].' | '.round($weapon['dps']*100/(100-$wz_wsubclasses[$weapon['subclass']]['maxrof'])*($wz_wsubclasses[$weapon['subclass']]['maxdam']+100)/100*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).' |
Accuracy: (close-long) | '.$weapon['sacc'].'-'.$weapon['lacc'].'% | '.round($weapon['sacc']*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).'-'.round($weapon['lacc']*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).'% |
Range: (close-long) | '."".round($weapon['srange']/128,1)."- ".round($weapon['lrange']/128,1)." | |
Attack runs: | '.$weapon['numattackruns'].' | |
DPR: | '.($weapon['damage']*$weapon['lacc']/100*$weapon['nrounds']*$weapon['numattackruns']).' | '.round($weapon['damage']*$weapon['lacc']/100*$weapon['nrounds']*$weapon['numattackruns']*($wz_wsubclasses[$weapon['subclass']]['maxdam']+100)/100*($wz_wsubclasses[$weapon['subclass']]['maxacc']+100)/100,1).' |
Base | Upgraded | |
Sensor: | '.$sensors[$weapon['sensor']].' | |
Range: | '.round($weapon['lrange']/128,1).' | '.round($weapon['lrange']*($wz_wsubclasses['sensor']['maxrange']+100)/100/128,1).' |
Base | Upgraded | |
Build points: | '.$weapon['build'].' | '.round($weapon['build']*($wz_wsubclasses[$weapon['subclass']]['maxbuild']+100)/100,1).' |
Base | Upgraded | |
HP: | '.structurehp($struct).' | '.structurehp($struct,$base?$wz_upgrades['structurehp']['max']:$wz_upgrades['wallhp']['max'])." |
Armor: | '.structurearmor($struct).' | '.structurearmor($struct,$base?$wz_upgrades['structurearmor']['max']:$wz_upgrades['wallarmor']['max'])." |
Strength: | '.($GLOBALS['strengths'][$struct['strength']])." | |
Size: | '.$struct['w'].'×'.$struct['h']." | |
Height: | '.$struct['z']." |
Prerequisites: {$wz_research[$struct['prereq']]['name']}
"; if ($base) $out .= guide('b/'.$struct['sid']); return $out; } function bodydesc($body, $root='', $cyborg=false) { global $wz_research, $wz_upgrades, $wz_bids; if (is_string($body)) $body = $GLOBALS['wz_bodies'][$body]; $out = ''.iconimg($body['bid'],'bp').' $'.$body['price'].' Body ID: '.aval(array_keys($wz_bids,$body['bid']),0).'
'; $out .= 'Base | Upgraded | |
---|---|---|
HP: | '.$body['hp'].' | '.iupg($body['hp'],$cyborg?$wz_upgrades['cyborghp']['max']:$wz_upgrades['vehiclehp']['max'])." |
Armor: | '.bodyarmor($body).' | '.bodyarmor($body,$cyborg?$wz_upgrades['cyborgarmor']['max']:$wz_upgrades['vehiclearmor']['max'],$cyborg?$wz_upgrades['cyborgthermal']['max']:$wz_upgrades['vehiclethermal']['max'])." |
Engine: | '.$body['engine'].' | '.iupg($body['engine'],$wz_upgrades['vehicleengine']['max'])." |
Weight: | '.$body['weight']." |
Prerequisites: {$wz_research[$body['prereq']]['name']}
"; return $out; } function showprereqs($id, &$ar, $root='', $last=false) { global $wz_research, $wz_structures; if (in_array($id,$ar)) return "'.$wz_research[$id]['name'].' is not required for any research.
'; else foreach ($wz_research[$id]['allows'] as $allow) { if ($allow == $id) continue; $prereqs = $wz_research[$allow]['prereqs']; $fprereqs = array($wz_research[$id]['name']); foreach ($prereqs as $prereq) if ($prereq != $id) $fprereqs[] = (substr($prereq,0,5)=='../s/'?''.$wz_structures[substr($prereq,5)]['name'].' built':''.$wz_research[$prereq]['name'].''); $out .= ''.iconimg($id,'r').'$'.min(intval($wz_research[$id]['price']/32),450).' '.aval(array_keys($wz_rids,$id),0).'
'; $out .= ''.($wz_research[$id]['major']?'[Major research]':'[Minor research]').'
'; if ($wz_research[$id]['desc']) $out .= ''.implode(''; if (count($wz_research[$id]['result'])) { $out .= "
',$wz_research[$id]['desc']).'
Automatic – This does not need to be researched; it has already been researched in every game.
'; if (substr($wz_research[$wz_research[$id]['prereqs'][0]]['name'],0,4) === 'CAM1') $out .= 'Base – This does not have any prerequisites, and can be researched at the beginning of any game.
'; return $out; } /* * COMMENTARY FUNCTIONS */ $forgotten = false; $falsecookie = false; if (!$_POST['forget'] && $_POST['remember'] && ($_COOKIE['name'] != trim($_POST['name']) && ($isauth || simplify($_POST['captcha'])=='mg' || simplify($_POST['captcha'])=='machinegun'))) { setcookie('name', trim($_POST['name']).($isadmin?':'.$adminpass:':mg'), time()+365*24*60*60,'/'); $_COOKIE['name'] = trim($_POST['name']); $falsecookie = true; } else if ($_POST['forget'] && $_COOKIE['name']) { setcookie('name', '', time()-60*60,'/'); $forgotten = true; $_COOKIE['name'] = ''; $_POST['name'] = ''; $_REQUEST['name'] = ''; $isauth = $isadmin = false; } function onreldate($time) { if (!$time) return 'never'; $suf = 'ago'; $rtime = ($ctime=time()) - $time; if (!$rtime) return 'just now'; if ($rtime < 0) { $suf = 'from now'; $rtime = -$rtime; } if ($rtime < 60) return $rtime.' second'.($rtime==1?'':'s').' '.$suf; $rtime = intval($rtime/60); if ($rtime < 60) return $rtime.' minute'.($rtime==1?'':'s').' '.$suf; if ($rtime < 120) return 'an hour and '.($rtime-60).' minute'.($rtime==61?'':'s').' '.$suf; //$rtime = intval($rtime/60); //echo '[rtime '.$rtime.']'; if (intval($time/86400)==intval($ctime/86400)) // same day return intval($rtime/60).($rtime%60>=30?' and a half':'').' hour'.($rtime<90?'':'s').' '.$suf; if (($daysago=intval($ctime/86400)-intval($time/86400))==1) return 'yesterday'; if ($daysago==-1) return 'tomorrow'; if ($daysago<=3) return $daysago.' days ago'; $ctimea=getdate($ctime);$timea=getdate($time); if ($ctimea['year']==$timea['year']) return 'on '.date('M j',$time); return 'on '.date('M j, Y',$time); } function comments($id, $root='') { global $_PERSIST, $isauth, $isadmin, $falsecookie, $forgotten; $posted = false; if ($id[1] == '/') $comments = &$_PERSIST[$id[0]]['subdirs'][substr($id,2)]; else $comments = &$_PERSIST[$id]; echo 'Error: Name is invalid.
'; if (!$isauth && simplify($_REQUEST['captcha'])!='machinegun' && simplify($_REQUEST['captcha'])!='mg') echo 'Error: Wrong answer.
'; else { if ($isadmin) { $comments[] = array( 'name' => stripslashes($_POST['name']), 'msg' => stripslashes($_POST['msg']), 'time' => time(), 'admin' => true ); } else { $comments[] = array( 'name' => stripslashes($_POST['name']), 'msg' => stripslashes($_POST['msg']), 'time' => time() ); } if (persist_update()) $posted = true; else echo 'Error: Internal server error. Please try again later.
'; } } else if ($_POST['remember'] && !$isauth && simplify($_REQUEST['captcha'])!='machinegun' && simplify($_REQUEST['captcha'])!='mg') { echo 'Error: Wrong answer.
'; } if ($comments) { foreach ($comments as $i => $comment) { if (count($comments)>10 && $i == 0) echo ''; } } else echo ''.($comment['htmlcomment']?$comment['msg']:nl2br(htmlspecialchars($comment['msg']))).'
No comments yet.
'; echo 'Success!
'; echo ''; ?> Your name has been forgotten.'; if ($_COOKIE['name']) echo ''; } function guide($id, $gen = false, $editbtn = true) { global $guide, $isadmin; $root = '../'; if ($id[1] == '/') $msg = &$guide[$id[0]]['subdirs'][substr($id,2)]; else { $msg = &$guide[$id]; $root = ''; } $out = ''; if (isset($msg)) $out = $msg['text']; else if ($gen && $gen !== 'php') { $msg['gen'] = $gen; persist_update('guide'); } if ($editbtn) { if ($gen === 'php') $out = 'Edit\'; ?>'.($id=='index'||$id=='panel'?'':'').$out; else if ($id == 'index' && $isadmin) $out = ''.$out; else if ($msg['gen']) $out = ''.$out; else if ($_COOKIE['name'] && $isadmin) $out = ''.$out; } return $out; } function getguide($id) { echo '<'.'?php echo guide(\''.$id.'\'); ?'.'>'; } function leftnav($id) { global $guide; if ($id[1] == '/') $msg = &$guide[$id[0]]['subdirs'][substr($id,2)]; else $msg = &$guide[$id]; if ($msg['cachedsb']) return $msg['cachedsb']; else { $msg['cachedsb'] = genleftnav($msg['text']); persist_update('guide'); } return $msg['cachedsb']; } function genleftnav($text) { preg_match_all('/