コード例 #1
0
ファイル: worldsave.py プロジェクト: thooge/Wolfpack
def onWorldSave():
    if ENABLEDFANCYSTATUS:
        # Creating Dialog
        dialog = cGump(nomove=1, nodispose=1, x=150, y=150)

        dialog.setType(
            0x98FA2C10
        )  # NEVER change this Type or Gump will not be closed in the end of save

        dialog.addResizeGump(0, 0, 9200, 291, 90)
        dialog.addCheckerTrans(0, 0, 291, 90)
        dialog.addText(47, 19, tr("WORLDSAVE IN PROGRESS"), 2122)
        dialog.addText(47, 37,
                       tr("Saving %i items.") % (wolfpack.itemcount()), 2100)
        dialog.addText(47, 55,
                       tr("Saving %i characters.") % (wolfpack.charcount()),
                       2100)
        dialog.addTilePic(3, 25, 4167)

        # Sending to players

        worldsocket = wolfpack.sockets.first()
        while worldsocket:
            dialog.send(worldsocket)
            worldsocket = wolfpack.sockets.next()
コード例 #2
0
def handleStatus(socket, packet):
    statusPacket = 1
    for i in range(0, packet.size):
        if packet.getbyte(i) != statusRequest[i]:
            statusPacket = 0
            break

    if statusPacket:
        status = 'olfpack, Clients=%i, Items=%i, Chars=%i, Version="%s"' % (
            wolfpack.sockets.count(), wolfpack.itemcount(),
            wolfpack.charcount(), wolfpack.serverversion())

        packet = wolfpack.packet(87, len(status) + 2)
        packet.setascii(1, status)
        packet.send(socket)
        socket.log(LOG_MESSAGE, "Sent status information.\n")

    return statusPacket
コード例 #3
0
def onWorldSave():
	if ENABLEDFANCYSTATUS:
		# Creating Dialog
		dialog = cGump( nomove=1, nodispose=1, x=150, y=150 )

		dialog.setType( 0x98FA2C10 ) # NEVER change this Type or Gump will not be closed in the end of save

		dialog.addResizeGump( 0, 0, 9200, 291, 90 )
		dialog.addCheckerTrans( 0, 0, 291, 90 )
		dialog.addText( 47, 19, tr( "WORLDSAVE IN PROGRESS" ), 2122 )
		dialog.addText( 47, 37, tr( "Saving %i items." )%( wolfpack.itemcount() ), 2100 )
		dialog.addText( 47, 55, tr( "Saving %i characters." )%( wolfpack.charcount() ), 2100 )
		dialog.addTilePic( 3, 25, 4167 )

		# Sending to players

		worldsocket = wolfpack.sockets.first()
		while worldsocket:
			dialog.send( worldsocket )
			worldsocket = wolfpack.sockets.next()
コード例 #4
0
def handleStatus(socket, packet):
    statusPacket = 1
    for i in range(0, packet.size):
        if packet.getbyte(i) != statusRequest[i]:
            statusPacket = 0
            break

    if statusPacket:
        status = 'olfpack, Clients=%i, Items=%i, Chars=%i, Version="%s"' % (wolfpack.sockets.count(), wolfpack.itemcount(), wolfpack.charcount(), wolfpack.serverversion())

        packet = wolfpack.packet(87, len(status) + 2)
        packet.setascii(1, status)
        packet.send(socket)
        socket.log(LOG_MESSAGE, "Sent status information.\n")

    return statusPacket
コード例 #5
0
ファイル: serverinfo.py プロジェクト: thooge/Wolfpack
def serverinfo(socket, command, arguments):
    global initialized
    if not initialized:
        initializeValues()

    char = socket.player
    version = wolfpack.serverversion()
    uptime = wolfpack.time.currenttime() / 1000
    upseconds = uptime
    upminutes = (uptime / 60)
    upseconds -= (upminutes * 60)
    if upseconds <= 9:
        upseconds = '0%s' % (upseconds)
    uphours = (upminutes / 60)
    upminutes -= (uphours * 60)
    if upminutes <= 9:
        upminutes = '0%s' % (upminutes)
    if uphours <= 9:
        uphours = '0%s' % (uphours)
    timestring = '%s:%s:%s' % (uphours, upminutes, upseconds)

    onlinecount = wolfpack.sockets.count()
    accountcount = 0
    admincount = 0
    gmcount = 0
    seercount = 0
    counselorcount = 0
    playercount = 0
    acclist = wolfpack.accounts.list
    for i in acclist():
        record = wolfpack.accounts.find(i)
        accountcount += 1
        if record.acl == 'admin':
            admincount += 1
        if record.acl == 'gm':
            gmcount += 1
        if record.acl == 'seer':
            seercount += 1
        if record.acl == 'counselor':
            counselorcount += 1
        if record.acl == 'player':
            playercount += 1

    gump = cGump(x=30, y=30)
    gump.addBackground(id=0x2436, width=280, height=400)
    # Basic Info
    text = '<basefont color="#FFFF00"><center><h3>%s Shard Status</h3></center><br />' % (
        shardname)
    text += '<basefont color="#FEFEFE">'
    text += '  Version: %s<br />' % (version)
    text += '  Uptime: %s<br />' % (timestring)
    # Account Info
    text += '<basefont color="#FFFF00"><center><h3>Account Information</h3></center><br />'
    text += '<basefont color="#FEFEFE">'
    text += '  Online Accounts:  <basefont color="#00FFFF">%i <basefont color="#FEFEFE">/ <basefont color="#00FFFF">%i<br />' % (
        onlinecount, accountcount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Admins:     <basefont color="#00FF00">%i<br />' % (
        admincount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Seers:      <basefont color="#00FF00">%i<br />' % (
        seercount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Counselors: <basefont color="#00FF00">%i<br />' % (
        counselorcount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Players:    <basefont color="#00FF00">%i<br />' % (
        playercount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Characters: <basefont color="#00FF00">%i<br />' % (
        wolfpack.charcount())
    text += '<basefont color="#FEFEFE">'
    text += '  Total Items:      <basefont color="#00FF00">%i<br />' % (
        wolfpack.itemcount())
    # Hardware Info
    text += '<basefont color="#FFFF00"><center><h3>Server Information</h3></center><br />'
    text += '<basefont color="#FEFEFE">'
    text += ' OS: %s<br />' % (operatingsystem)
    text += ' Processor: %s<br />' % (processor)
    text += ' Memory: %s<br />' % (memory)

    gump.addHtmlGump(x=20, y=20, width=240, height=360, html=text)
    gump.send(char)
    return
コード例 #6
0
def WritePage(status='Online'):
    global processthread
    console.log(LOG_MESSAGE, "Generating Shard Status Page.\n")
    # Default/Static Information
    if status != 'Online' and status != 'Offline':
        status = "Unknown"

    #Prepare Information
    uptime = wolfpack.time.currenttime() / 1000

    # Build an uptime:
    upseconds = 0
    upminutes = 0
    uphours = 0
    updays = 0
    upseconds = uptime
    upminutes = uptime / 60
    upseconds -= upminutes * 60
    if upseconds <= 9:
        upseconds = '0%s' % upseconds
    uphours = upminutes / 60
    upminutes -= uphours * 60
    if upminutes <= 9:
        upminutes = '0%s' % upminutes
    if uphours <= 9:
        uphours = '0%s' % uphours

    #Make a time string
    timestring = '%s:%s:%s' % (uphours, upminutes, upseconds)

    # Account Counting
    accountcount = 0
    admincount = 0
    gmcount = 0
    seercount = 0
    counselorcount = 0
    playercount = 0
    players = ""
    # ACC List
    for i in accounts.list():
        record = accounts.find(i)
        if record.acl == 'admin':
            admincount += 1
        elif record.acl == 'gm':
            gmcount += 1
        elif record.acl == 'seer':
            seercount += 1
        elif record.acl == 'counselor':
            counselorcount += 1
        elif record.acl == 'player':
            playercount += 1

    #Write the page
    file = open(output_file, 'w')
    outputtext = "<div class='box' style='min-width:480px;width:90%;'>\n"
    outputtext += "<table class='contentinfo' style='width:100%;' cellpadding='0' cellspacing='0'>\n"
    outputtext += "<caption>Rayonnant Server Status [ <?=$phase?> ]</caption>\n"
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span style='font-weight:bold;'>Server&#160;Address:</span>&#160;</td>"
    outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % (
        address)
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span style='font-weight:bold;'>Server&#160;Status:</span>&#160;</td>"
    if status == 'Online':
        outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % (
            status)
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span style='font-weight:bold;'>Server&#160;Uptime:</span>&#160;</td>"
        outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % (
            timestring)
    elif status == 'Offline':
        outputtext += "<td>&#160;<span class='server_bad'>%s</span></td></tr>\n" % (
            status)
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span style='font-weight:bold;'>Previous&#160;Uptime:</span>&#160;</td>"
        outputtext += "<td>&#160;<span class='server_bad'>%s</span></td></tr>\n" % (
            timestring)
    else:
        outputtext += "<td>&#160;<span class='server_neutral'>%s</span></td></tr>\n" % (
            status)
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span style='font-weight:bold;'>Server&#160;Uptime:</span>&#160;</td>"
        outputtext += "<td>&#160;<span class='server_neutral'>%s</span></td></tr>\n" % (
            timestring)
    outputtext += "<tr><td style='width:90px;'>"
    outputtext += "<span style='font-weight:bold;'>Server&#160;Version:</span>&#160;</td>"
    outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % (
        wolfpack.serverversion())
    if status == 'Online':
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span style='font-weight:bold;'>Accounts:</span>&#160;</td><td></td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;/&#160;<span class='server_good'>%s</span></td>" % (
            wolfpack.sockets.count(), wolfpack.accounts.count())
        outputtext += "<td style='text-indent:1em;'>&#160;Online&#160;/&#160;Total Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            admincount)
        outputtext += "<td style='text-indent:1em;'>&#160;Admin&#160;Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            gmcount)
        outputtext += "<td style='text-indent:1em;'>&#160;GM&#160;Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            seercount)
        outputtext += "<td style='text-indent:1em;'>&#160;Seer&#160;Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            counselorcount)
        outputtext += "<td style='text-indent:1em;'>&#160;Counselor&#160;Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            playercount)
        outputtext += "<td style='text-indent:1em;'>&#160;Player&#160;Accounts</td></tr>\n"
    # Statistics Item/Char Totals
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span style='font-weight:bold;'>Statistics:</span>&#160;</td><td></td></tr>\n"
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
        wolfpack.playercount())
    outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;Players</td></tr>\n"
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
        wolfpack.itemcount())
    outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;Items</td></tr>\n"
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
        wolfpack.npccount())
    outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;NPCs</td></tr>\n"
    outputtext += "</table>\n"
    outputtext += "</div>\n"
    file.write(outputtext)
    file.close()
    wolfpack.addtimer(1000, autostatuswrapper)
    processthread.mutex.acquire()
    processthread.processed = True
    processthread.mutex.release()
    return True
コード例 #7
0
def serverinfo( socket, command, arguments ):
	global initialized
	if not initialized:
		initializeValues()
			
	
	char = socket.player
	version = wolfpack.serverversion()
	uptime = wolfpack.time.currenttime() / 1000
	upseconds = uptime
	upminutes = ( uptime / 60 )
	upseconds -= ( upminutes * 60 )
	if upseconds <= 9:
		upseconds = '0%s' % ( upseconds )
	uphours = ( upminutes / 60 )
	upminutes -= ( uphours * 60 )
	if upminutes <= 9:
		upminutes = '0%s' % ( upminutes )
	if uphours <= 9:
		uphours = '0%s' % ( uphours )
	timestring = '%s:%s:%s' % ( uphours, upminutes, upseconds )

	onlinecount = wolfpack.sockets.count()
	accountcount = 0
	admincount = 0
	gmcount = 0
	seercount = 0
	counselorcount = 0
	playercount = 0
	acclist = wolfpack.accounts.list
	for i in acclist():
		record = wolfpack.accounts.find( i )
		accountcount += 1
		if record.acl == 'admin':
			admincount += 1
		if record.acl == 'gm':
			gmcount += 1
		if record.acl == 'seer':
			seercount += 1
		if record.acl == 'counselor':
			counselorcount += 1
		if record.acl == 'player':
			playercount += 1

	gump = cGump( x=30, y=30)
	gump.addBackground( id=0x2436, width=280, height=400 )
	# Basic Info
	text = '<basefont color="#FFFF00"><center><h3>%s Shard Status</h3></center><br />' % ( shardname )
	text += '<basefont color="#FEFEFE">'
	text += '  Version: %s<br />' % ( version )
	text += '  Uptime: %s<br />' % ( timestring )
	# Account Info
	text += '<basefont color="#FFFF00"><center><h3>Account Information</h3></center><br />'
	text += '<basefont color="#FEFEFE">'
	text += '  Online Accounts:  <basefont color="#00FFFF">%i <basefont color="#FEFEFE">/ <basefont color="#00FFFF">%i<br />' % ( onlinecount, accountcount )
	text += '<basefont color="#FEFEFE">'
	text += '  Total Admins:     <basefont color="#00FF00">%i<br />' % ( admincount )
	text += '<basefont color="#FEFEFE">'
	text += '  Total Seers:      <basefont color="#00FF00">%i<br />' % ( seercount )
	text += '<basefont color="#FEFEFE">'
	text += '  Total Counselors: <basefont color="#00FF00">%i<br />' % ( counselorcount )
	text += '<basefont color="#FEFEFE">'
	text += '  Total Players:    <basefont color="#00FF00">%i<br />' % ( playercount )
	text += '<basefont color="#FEFEFE">'
	text += '  Total Characters: <basefont color="#00FF00">%i<br />' % ( wolfpack.charcount() )
	text += '<basefont color="#FEFEFE">'
	text += '  Total Items:      <basefont color="#00FF00">%i<br />' % ( wolfpack.itemcount() )
	# Hardware Info
	text += '<basefont color="#FFFF00"><center><h3>Server Information</h3></center><br />'
	text += '<basefont color="#FEFEFE">'
	text += ' OS: %s<br />' % ( operatingsystem )
	text += ' Processor: %s<br />' % ( processor )
	text += ' Memory: %s<br />' % ( memory )

	gump.addHtmlGump( x=20, y=20, width=240, height=360, html=text )
	gump.send( char )
	return
コード例 #8
0
def WritePage( status='Online' ):
	global processthread
	console.log(LOG_MESSAGE, "Generating Shard Status Page.\n")
	# Default/Static Information
	if status != 'Online' and status != 'Offline':
		status = "Unknown"

	#Prepare Information
	uptime = wolfpack.time.currenttime() / 1000

	# Build an uptime:
	upseconds = 0
	upminutes = 0
	uphours = 0
	updays = 0
	upseconds = uptime
	upminutes = uptime / 60
	upseconds -= upminutes * 60
	if upseconds <= 9:
		upseconds = '0%s' % upseconds
	uphours = upminutes / 60
	upminutes -= uphours * 60
	if upminutes <= 9:
		upminutes = '0%s' % upminutes
	if uphours <= 9:
		uphours = '0%s' % uphours

	#Make a time string
	timestring = '%s:%s:%s' % ( uphours, upminutes, upseconds )

	# Account Counting
	accountcount = 0
	admincount = 0
	gmcount = 0
	seercount = 0
	counselorcount = 0
	playercount = 0
	players = ""
	# ACC List
	for i in accounts.list():
		record = accounts.find( i )
		if record.acl == 'admin':
			admincount += 1
		elif record.acl == 'gm':
			gmcount += 1
		elif record.acl == 'seer':
			seercount += 1
		elif record.acl == 'counselor':
			counselorcount += 1
		elif record.acl == 'player':
			playercount += 1

	#Write the page
	file = open( output_file, 'w' )
	outputtext = "<div class='box' style='min-width:480px;width:90%;'>\n"
	outputtext += "<table class='contentinfo' style='width:100%;' cellpadding='0' cellspacing='0'>\n"
	outputtext += "<caption>Rayonnant Server Status [ <?=$phase?> ]</caption>\n"
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span style='font-weight:bold;'>Server&#160;Address:</span>&#160;</td>"
	outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % ( address )
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span style='font-weight:bold;'>Server&#160;Status:</span>&#160;</td>"
	if status == 'Online':
		outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % ( status )
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span style='font-weight:bold;'>Server&#160;Uptime:</span>&#160;</td>"
		outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % ( timestring )
	elif status == 'Offline':
		outputtext += "<td>&#160;<span class='server_bad'>%s</span></td></tr>\n" % ( status )
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span style='font-weight:bold;'>Previous&#160;Uptime:</span>&#160;</td>"
		outputtext += "<td>&#160;<span class='server_bad'>%s</span></td></tr>\n" % ( timestring )
	else:
		outputtext += "<td>&#160;<span class='server_neutral'>%s</span></td></tr>\n" % ( status )
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span style='font-weight:bold;'>Server&#160;Uptime:</span>&#160;</td>"
		outputtext += "<td>&#160;<span class='server_neutral'>%s</span></td></tr>\n" % ( timestring )
	outputtext += "<tr><td style='width:90px;'>"
	outputtext += "<span style='font-weight:bold;'>Server&#160;Version:</span>&#160;</td>"
	outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % ( wolfpack.serverversion() )
	if status == 'Online':
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span style='font-weight:bold;'>Accounts:</span>&#160;</td><td></td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;/&#160;<span class='server_good'>%s</span></td>" % ( wolfpack.sockets.count(), wolfpack.accounts.count() )
		outputtext += "<td style='text-indent:1em;'>&#160;Online&#160;/&#160;Total Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( admincount )
		outputtext += "<td style='text-indent:1em;'>&#160;Admin&#160;Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( gmcount )
		outputtext += "<td style='text-indent:1em;'>&#160;GM&#160;Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( seercount )
		outputtext += "<td style='text-indent:1em;'>&#160;Seer&#160;Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( counselorcount )
		outputtext += "<td style='text-indent:1em;'>&#160;Counselor&#160;Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( playercount )
		outputtext += "<td style='text-indent:1em;'>&#160;Player&#160;Accounts</td></tr>\n"
	# Statistics Item/Char Totals
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span style='font-weight:bold;'>Statistics:</span>&#160;</td><td></td></tr>\n"
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( wolfpack.playercount() )
	outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;Players</td></tr>\n"
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( wolfpack.itemcount() )
	outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;Items</td></tr>\n"
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( wolfpack.npccount() )
	outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;NPCs</td></tr>\n"
	outputtext += "</table>\n"
	outputtext += "</div>\n"
	file.write( outputtext )
	file.close()
	wolfpack.addtimer( 1000, autostatuswrapper )
	processthread.mutex.acquire()
	processthread.processed = True
	processthread.mutex.release()
	return True