Beispiel #1
0
 def _adminLogin():
     tries = 10
     while tries > 0:
         s = IClient(options.server, None, msgHandler, None, "IClient/osc")
         login = "******"
         try:
             s.connect(login)
             tries = 0
         except IClientException:
             time.sleep(1)
             tries -= 1
     password = open(os.path.join(options.configDir, "token"), "r").read()
     if options.local:
         gameName = ige.Const.SINGLE_GAME
     else:
         gameName = "Alpha"
     s.login(gameName, login, password)
     return s
	elif string.upper(inp) == "R":
		processTurns()
	elif string.upper(inp) == "T":
		s.processTurn()
	elif string.upper(inp) == "C":
		console = InteractiveConsole(locals())
		console.interact()
	elif string.upper(inp) == "CLEANUPFLEETS":
		console = cleanupBadFleets()

	return objId

config = Config("var/config.ini")

#s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/osc')
s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')

if len(sys.argv) != 2:
	print "Usage: osclient LOGIN"
	sys.exit(1)

login = sys.argv[1]

if login == "admin":
	try:
		password = open(os.path.join("var", "token"), "r").read()
	except IOError:
		password = getpass("Password: ")

s.connect(login)
s.login(config.server.name, login, password)
Beispiel #3
0
#!/usr/bin/env python2.2

# tweak PYTHONPATH
import sys
sys.path.insert(0, 'lib')

from igeclient.IClient import IClient
import time

def msgHandler(id, data):
	if id >= 0:
		print 'Message', id, data

#s = IClient('ige.qgir.cz:9080', None, msgHandler, 'IClient/osc')
#s = IClient('212.11.104.99:9080', None, msgHandler, None, 'IClient/osc')
s = IClient('127.0.0.1:9080', None, msgHandler, None, 'IClient/osc')

login = "******"
password = "******"

s.connect(login)
s.login('Alpha', login, password)

s.processTurn()

s.logout()

# parse command line arguments
parser = OptionParser(usage="usage: %prog [options]")
parser.add_option(
    "",
    "--configdir",
    dest="configDir",
    metavar="DIRECTORY",
    default=os.path.join(os.path.expanduser("~"), ".outerspace"),
    help="Override default configuration directory",
)
options, args = parser.parse_args()

#s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/osc')
s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')

# get admin login from <configDir>/token
password = open(os.path.join(options.configDir, "token"), "r").read()
s.connect()
s.login('Alpha', 'admin', password)
s.selectAdmin()

try:
    objID = 0
    while True:
        showMenu(objID)
        objID = processMenu(raw_input(), objID, s)
except EOFError:
    pass
Beispiel #5
0
from igeclient.IClient import IClient
import pprint, traceback

def msgHandler(id, data):
	if id >= 0:
		print 'Message', id, data

def getPlayer(name):
    u = s.getInfo(1)
    for playerID in u.players:
        pl = s.getInfo(playerID)
        if pl.name == name:
            return pl
    return None

s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/osc')
#s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')

s.connect('admin')
s.login('Alpha', 'admin', '**PASS**')

u = s.getInfo(1)

log = open("log.txt", "wt")

for playerID in u.players:
	pl = s.getInfo(playerID)
	for specID in pl.shipDesigns:
		spec = pl.shipDesigns[specID]
		if spec.hullID not in pl.techs:
			if spec.hullID == 2401:
        processTurns()
    elif string.upper(inp) == "T":
        s.processTurn()
    elif string.upper(inp) == "C":
        console = InteractiveConsole(locals())
        console.interact()
    elif string.upper(inp) == "CLEANUPFLEETS":
        console = cleanupBadFleets()

    return objId


config = Config("var/config.ini")

#s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/osc')
s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')

if len(sys.argv) != 2:
    print "Usage: osclient LOGIN"
    sys.exit(1)

login = sys.argv[1]

if login == "admin":
    try:
        password = open(os.path.join("var", "token"), "r").read()
    except IOError:
        password = getpass("Password: ")

s.connect(login)
s.login(config.server.name, login, password)
Beispiel #7
0
from igeclient.IClient import IClient
import pprint, traceback

def msgHandler(id, data):
	if id >= 0:
		print 'Message', id, data

def getPlayer(name):
    u = s.getInfo(1)
    for playerID in u.players:
        pl = s.getInfo(playerID)
        if pl.name == name:
            return pl
    return None

s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/osc')
#s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')

s.connect('admin')
s.login('Alpha', 'admin', '**PASS**')

u = s.getInfo(1)

for playerID in u.players:
	pl = s.getInfo(playerID)
	if len(pl.planets) == 1:
		print "Skipping", playerID, pl.name
		continue
	print "Processing", playerID, pl.name
	pl.stratRes[1000] = 2
	s.set(playerID, 'stratRes', pl.stratRes)
Beispiel #8
0
import sys
sys.path.insert(0, '../server/lib')

from igeclient.IClient import IClient
import string
from getpass import getpass

def msgHandler(id, data):
	if id >= 0:
		print 'Message', id, data

if len(sys.argv) != 4:
	print "Usage: %s objID forum filename"
	sys.exit(1)

s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/sendMsg')
#s = IClient('localhost:9080', None, msgHandler, 'IClient/0.3.0')

password = getpass("Password: "******"cp1250").split("\n")

message = {
	"sender": "Admin",
Beispiel #9
0
        console.interact()
    elif string.upper(inp) == "CLEANUPFLEETS":
        console = cleanupBadFleets()

    return objId

# parse command line arguments
parser = OptionParser(usage = "usage: %prog [options]")
parser.add_option("",  "--configdir", dest = "configDir",
    metavar = "DIRECTORY", default = os.path.join(os.path.expanduser("~"), ".outerspace"),
    help = "Override default configuration directory",
)
options, args = parser.parse_args()

#s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/osc')
s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')


# get admin login from <configDir>/token
password = open(os.path.join(options.configDir, "token"), "r").read()
s.connect()
s.login('Alpha', 'admin', password)
s.selectAdmin()

try:
    objID = 0
    while True:
        showMenu(objID)
        objID = processMenu(raw_input(), objID, s)
except EOFError:
       pass
Beispiel #10
0
    help = "Backup server databases into BASEFILENAME-<database name>.osbackup")
parser.add_option("",  "--configdir", dest = "configDir",
    metavar = "DIRECTORY", default = os.path.join(os.path.expanduser("~"), ".outerspace"),
    help = "Override default configuration directory",)
parser.add_option("",  "--configfile", dest = "configFilename",
    metavar = "DIRECTORY", default = "admin_user.ini",
    help = "Override default configuration file (applicable only for chronicler)",)
parser.add_option("", "--game", dest = "game",
    metavar = "GAME", default = "Alpha",
    help = "Name of the game")


options, args = parser.parse_args()

#s = IClient('ospace.net:9080', None, msgHandler, 'IClient/osc')
s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')

with open(os.path.join(options.configDir, "token"), "r") as pw_file:
    password = pw_file.read()
    s.connect()
    s.login('Alpha', 'admin', password)

s.selectAdmin()

if options.backup:
    s.backup(options.backup)
elif options.cleanup:
    log.debug('OSCLIENT', 'Cleaning up sessions')
    s.cleanupSessions()
elif options.turns > 0:
    s.processTurns(options.turns)
Beispiel #11
0
    dest="configFilename",
    metavar="DIRECTORY",
    default="admin_user.ini",
    help="Override default configuration file (applicable only for chronicler)",
)
parser.add_option("",
                  "--game",
                  dest="game",
                  metavar="GAME",
                  default="Alpha",
                  help="Name of the game")

options, args = parser.parse_args()

#s = IClient('ospace.net:9080', None, msgHandler, 'IClient/osc')
s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')

with open(os.path.join(options.configDir, "token"), "r") as pw_file:
    password = pw_file.read()
    s.connect()
    s.login('Alpha', 'admin', password)

s.selectAdmin()

if options.backup:
    s.backup(options.backup)
elif options.cleanup:
    log.debug('OSCLIENT', 'Cleaning up sessions')
    s.cleanupSessions()
elif options.turns > 0:
    s.processTurns(options.turns)
Beispiel #12
0
        console.interact()
    elif string.upper(inp) == "CLEANUPFLEETS":
        console = cleanupBadFleets()

    return objId

# parse command line arguments
parser = OptionParser(usage = "usage: %prog [options] login")
parser.add_option("",  "--configdir", dest = "configDir",
    metavar = "DIRECTORY", default = os.path.join(os.path.expanduser("~"), ".outerspace"),
    help = "Override default configuration directory",
)
options, args = parser.parse_args()

#s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/osc')
s = IClient('localhost:9080', None, msgHandler, None, 'IClient/osc')

if len(args) != 1:
    print "Usage: osclient_tui.py [options] LOGIN"
    sys.exit(1)

login = args[0]

if login == "admin":
    # get admin login from <configDir>/token
    password = open(os.path.join(options.configDir, "token"), "r").read()
else:
    password = getpass("Password: ")

s.connect(login)
s.login('Alpha', login, password)
Beispiel #13
0
from igeclient.IClient import IClient
import pprint, traceback

def msgHandler(id, data):
	if id >= 0:
		print 'Message', id, data

def getPlayer(name):
    u = s.getInfo(1)
    for playerID in u.players:
        pl = s.getInfo(playerID)
        if pl.name == name:
            return pl
    return None

s = IClient('ospace.net:9080', None, msgHandler, None, 'IClient/osc')

s.connect('admin')
s.login('Alpha', 'admin', '**PASS**')

galaxyID = s.createGalaxy(1)
#galaxyID = 10000

#s.loadFromXML(galaxyID, 'galaxy-Argo42P.xml', 'Circle42P', 100, 100, 'Argo')
s.loadFromXML(galaxyID, 'galaxy-Beidos42P.xml', 'Circle42P', 300, 100, 'Beidos')
#s.loadFromXML(galaxyID, 'galaxy-Ceelia42P.xml', 'Circle42P', 500, 100, 'Ceelia')
#s.loadFromXML(galaxyID, 'galaxy-Daela42P.xml', 'Circle42P', 700, 100, 'Daela')
#s.loadFromXML(galaxyID, 'galaxy-Everen42P.xml', 'Circle42P', 100, 300, 'Everen')
#s.loadFromXML(galaxyID, 'galaxy-Ferun42P.xml', 'Circle42P', 300, 300, 'Ferun')
#s.loadFromXML(galaxyID, 'galaxy-Garis42P.xml', 'Circle42P', 500, 300, 'Garis')
#s.loadFromXML(galaxyID, 'galaxy-Hiron42P.xml', 'Circle42P', 700, 300, 'Hiron')