Template:PatchDiff/December 6, 2012 Patch (Beta)/team fortress 2 beta content.gcf/tf beta/cfg/unencrypted/print instance config.py

From Team Fortress Wiki
Jump to: navigation, search
N/A1#!/usr/bin/env python
N/A2 
N/A3import os
N/A4import sys
N/A5import getopt
N/A6 
N/A7iInstanceNum = -1
N/A8sHostName =
N/A9 
N/A10opts, args = getopt.getopt( sys.argv[1:], , [ "num=", "host=" ] )
N/A11for o, a in opts:
N/A12 if o in ('--num'):
N/A13 iInstanceNum = int(a)
N/A14 elif o in ('--host'):
N/A15 sHostName = a
N/A16 else:
N/A17 assert 'Unhandled option ' + o
N/A18 
N/A19if iInstanceNum < 0:
N/A20 raise 'Missing or invalid --num'
N/A21if len(sHostName) <= 0:
N/A22 raise 'Missing or invalid --host'
N/A23 
N/A24#cfgStat = os.stat('tf/cfg')
N/A25#if not cfgStat:
N/A26# raise "Cannot stat 'tf/cfg'. This script must be called from the game directory."
N/A27 
N/A28## We don't ever want to use a global server.cfg
N/A29#try:
N/A30# os.stat( 'tf/cfg/server.cfg' )
N/A31# print 'Removing tf/cfg/server.cfg'
N/A32# os.remove( 'tf/cfg/server.cfg' )
N/A33#except OSError:
N/A34# pass
N/A35 
N/A36tf_mm_trusted = 0
N/A37mp_timelimit = 45
N/A38maxplayers = 24
N/A39tf_mm_servermode = 1
N/A40sStartServerCmd = 'randommap'
N/A41sv_minrate = 10000
N/A42tf_mm_strict = 0
N/A43sv_vote_issue_nextlevel_allowed = 1
N/A44sv_vote_issue_changelevel_allowed = 0
N/A45sv_vote_issue_changelevel_allowed_mvm = 0
N/A46mp_mapcycle_empty_timeout_seconds = 600
N/A47sv_tags = "valve"
N/A48bMVM = False
N/A49 
N/A50#
N/A51# Set proportions of server types here.
N/A52#
N/A53# At the time of this writing, we have
N/A54# two classes of server hardware: 24-instance and 36-instance
N/A55#
N/A56modes = [
N/A57# 'pvpmix'
N/A58# 'eventmix'
N/A59# 'event247'
N/A60 'payload',
N/A61 'payloadrace',
N/A62 'ctf_sd',
N/A63 'koth',
N/A64 'attackdefense',
N/A65 'cp',
N/A66 'bootcamp',
N/A67 'bootcamp',
N/A68 'mannup',
N/A69 'mannup',
N/A70 'mannup',
N/A71 'mannup'
N/A72]
N/A73 
N/A74mode = modes[ ( iInstanceNum - 1 ) % len(modes) ]
N/A75 
N/A76if mode == 'pvpmix':
N/A77 print 'hostname "Valve PvP Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A78 print 'mapcyclefile mapcycle_pvp.txt'
N/A79elif mode == 'eventmix':
N/A80 print 'hostname "Valve Halloween Mix Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A81 print 'mapcyclefile mapcycle_halloween.txt'
N/A82 sv_tags += ',eventmix'
N/A83elif mode == 'event247':
N/A84 print 'hostname "Valve Ghost Fort 24/7 Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A85 print 'mapcyclefile mapcycle_lakeside_event_247.txt'
N/A86 sv_vote_issue_nextlevel_allowed = 0
N/A87 mp_mapcycle_empty_timeout_seconds = 0
N/A88 sv_tags += ',event247'
N/A89elif mode == 'payload':
N/A90 print 'hostname "Valve Payload Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A91 print 'mapcyclefile mapcycle_quickplay_payload.txt'
N/A92elif mode == 'payloadrace':
N/A93 print 'hostname "Valve Payload Race Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A94 print 'mapcyclefile mapcycle_quickplay_payloadrace.txt'
N/A95elif mode == 'ctf_sd':
N/A96 print 'hostname "Valve CTF / SD Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A97 print 'mapcyclefile mapcycle_quickplay_ctf_sd.txt'
N/A98elif mode == 'koth':
N/A99 print 'hostname "Valve KOTH Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A100 print 'mapcyclefile mapcycle_quickplay_koth.txt'
N/A101elif mode == 'attackdefense':
N/A102 print 'hostname "Valve Attack / Defense Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A103 print 'mapcyclefile mapcycle_quickplay_attackdefense.txt'
N/A104elif mode == 'cp':
N/A105 print 'hostname "Valve Control Points Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A106 print 'mapcyclefile mapcycle_quickplay_cp.txt'
N/A107elif mode == 'bootcamp':
N/A108 print 'hostname "Valve MvM Boot Camp Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A109 mp_timelimit = 0
N/A110 maxplayers = 32
N/A111 tf_mm_servermode = 2
N/A112 tf_mm_strict = 1
N/A113 sv_vote_issue_nextlevel_allowed = 0
N/A114 mp_mapcycle_empty_timeout_seconds = 0
N/A115 sv_vote_issue_changelevel_allowed_mvm = 1
N/A116 sv_minrate = 30000
N/A117 sStartServerCmd = 'map mvm_mannworks'
N/A118elif mode == 'mannup':
N/A119 print 'hostname "Valve MvM Mann Up Server (%s #%d)"' % ( sHostName, iInstanceNum )
N/A120 mp_timelimit = 0
N/A121 maxplayers = 32
N/A122 tf_mm_servermode = 2
N/A123 tf_mm_strict = 1
N/A124 tf_mm_trusted = 1
N/A125 mp_mapcycle_empty_timeout_seconds = 0
N/A126 sv_vote_issue_nextlevel_allowed = 0
N/A127 sv_minrate = 30000
N/A128 sStartServerCmd = 'map mvm_mannworks'
N/A129else:
N/A130 raise "Don't recognize mode " + mode
N/A131 
N/A132#print
N/A133#print 'clientport %d' % ( iInstanceNum-1+26005 )
N/A134#print 'hostport %d' % ( iInstanceNum-1+27015 )
N/A135#print 'tv_port %d' % ( iInstanceNum-1+28020 )
N/A136#print
N/A137#print 'sv_logsdir logs/%03d' % iInstanceNum
N/A138#print 'sv_logecho 0'
N/A139#print 'con_logfile logs/%03d/console.log' % iInstanceNum
N/A140#print 'log on'
N/A141#print
N/A142#print 'replay_enable 1'
N/A143#print 'replay_block_dump_interval 15'
N/A144#print 'replay_fileserver_protocol http'
N/A145#print 'replay_fileserver_port 80'
N/A146#print 'replay_fileserver_offload_enable 0'
N/A147#print 'replay_local_fileserver_path "/var/www/replays/%03d/"' % iInstanceNum
N/A148#print 'replay_fileserver_path "/%03d/"' % iInstanceNum
N/A149print
N/A150print 'maxplayers %d' % maxplayers
N/A151print 'sv_minrate %d' % sv_minrate
N/A152print
N/A153print 'mp_idledealmethod 2'
N/A154print 'mp_idlemaxtime 5'
N/A155print 'tf_mvm_disconnect_on_victory 1'
N/A156print
N/A157print 'tf_mm_servermode %d' % tf_mm_servermode
N/A158print 'tf_mm_strict %d' % tf_mm_strict
N/A159print 'tf_mm_trusted %d' % tf_mm_trusted
N/A160print
N/A161print 'mp_maxrounds 0'
N/A162print 'mp_winlimit 0'
N/A163print 'mp_timelimit %d' % mp_timelimit
N/A164print
N/A165print 'sv_vote_issue_kick_allowed 1'
N/A166print 'sv_vote_kick_ban_duration 60'
N/A167print 'sv_vote_issue_kick_allowed_mvm 1'
N/A168print
N/A169print 'sv_vote_issue_nextlevel_allowed %d' % sv_vote_issue_nextlevel_allowed
N/A170print 'sv_vote_issue_changelevel_allowed %d' % sv_vote_issue_changelevel_allowed
N/A171print 'sv_vote_issue_changelevel_allowed_mvm %d' % sv_vote_issue_changelevel_allowed_mvm
N/A172print 'mp_mapcycle_empty_timeout_seconds %d' % mp_mapcycle_empty_timeout_seconds
N/A173print
N/A174print 'sv_tags "%s"' % sv_tags
N/A175 
N/A176# Always print whatever command starts the server last
N/A177print
N/A178print sStartServerCmd
N/A179