Beispiel #1
0
def topg_v2():
    """ top 100 gangs """
    rank = 1
    print('<span class="darkgrey">[</span><a class="menutext" href="/">VOID</a><span class="darkgrey">]</span><span class="lightgrey">:</span> G<br/>\n<pre>\n')
    sqlstr = 'SELECT count(*) FROM gangs'
    tmp = cfg.sql_cmd(sqlstr, 1)
    if tmp[0] > 0:
        print('<span class="darkyellow">Top Gangs of the Realm</span>')
        print('<span class="lightgrey">-=-==-=-=-=-=-=-=-=-=-</span>\n')
        print('<span class="darkred">Rank</span> <span class="darkgreen">Gangname</span>            <span class="darkmagenta">Leader</span>      <span class="darkyellow">Members</span> <span class="darkgreen">Created</span>      <span class="darkyellow">Exp</span>            <span class="darkgrey">xp/hr</span>')
        print('<span class="darkgrey">=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</span>')
        sqlstr = 'SELECT gang, leader, members, exp, expold, creation FROM gangs ORDER BY exp DESC'
        tmp = cfg.sql_cmd(sqlstr, 2)
        for row in tmp:
            if row[3] == row[4]:
                exphr = '<span style="color:#434343">     &#42;</span>'
            else:
                xphr = (row[3] - row[4]) * 12
                kph = xphr / 1000
                if round(kph, 0) > 10:
                    xphr = '%d' % kph
                else:
                    xphr = round(kph, 1)
                exphr = '<span class="darkgrey">%6s</span><span style="color:#434343">k</span>' % str(xphr)
#            print('%3s. %-19s %-11s %-7s %-12s %s' % (rank, name, leader, members, creation, exp))
            print('<span class="line"><span class="darkred">%3d.</span> <span class="darkgreen">%-19s</span> <span class="darkmagenta">%-11s</span> <span class="darkyellow">%-7d</span> <span class="darkgreen">%-12s</span> <span class="darkyellow">%-13d</span> %s</span>' % (rank, row[0][:19], row[1], row[2], row[5], row[3], exphr))
            rank = rank + 1
    else:
        print('<span class="darkmagenta">There are no gangs currently established!</span>')
    print('</pre><br/>\n<span class="darkgrey">[</span><a class="menutext" href="/">VOID</a><span class="darkgrey">]</span><span class="lightgrey">:</span> <span id="cursor">&#x2588;</span>')
    return 0
Beispiel #2
0
def top_v2():
    """ top 100 adventurers """
    rank = 1
    print('<span class="darkgrey">[</span><a class="menutext" href="/">VOID</a><span class="darkgrey">]</span><span class="lightgrey">:</span> T<br/>\n<pre>\n')
    sqlstr = 'SELECT count(*) FROM users'
    tmp = cfg.sql_cmd(sqlstr, 1)
    if tmp[0] > 0:
        print('<span class="darkyellow">Top Heroes of the Realm</span>')
        print('<span class="lightgrey">-=-=-=-=-=-=-=-=-=-=-=-</span>\n')
        print('<span class="darkred">Rank</span> <span class="darkgreen">Name</span>                  <span class="darkmagenta">Class</span>      <span class="darkyellow">Gang/Guild</span>          <span class="darkgreen">Experience</span>     <span class="darkgrey">k/hr</span>')
        print('<span class="darkgrey">=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</span>')
        sqlstr = 'SELECT user, class, gang, exp, expold FROM users ORDER BY exp DESC'
        tmp = cfg.sql_cmd(sqlstr, 2)
        for row in tmp:
            if row[3] == row[4]:
                exphr = '<span style="color:#434343">   &#42;</span>'
            else:
                xphr = (row[3] - row[4]) * 12
                kph = xphr / 1000
                if round(kph, 0) > 10:
                    xphr = '%d' % kph
                else:
                    xphr = round(kph, 1)
                exphr = '<span class="darkgrey">%4s</span>' % str(xphr)
            print('<span class="line"><span class="darkred">%3d.</span> <span class="darkgreen">%-21s</span> <span class="darkmagenta">%-10s</span> <span class="darkyellow">%-19s</span> <span class="darkgreen">%-14d</span> %s</span>' % (rank, row[0][:21], row[1], row[2], row[3], exphr))
            rank = rank + 1
    else:
        print('<span class="darkmagenta">Realm recently reset.</span>')
    print('</pre><br/>\n<span class="darkgrey">[</span><a class="menutext" href="/">VOID</a><span class="darkgrey">]</span><span class="lightgrey">:</span> <span id="cursor">&#x2588;</span>')
    return 0
Beispiel #3
0
def gos_v2():
    """ gossip log """
    print("<span class='darkgrey'>[</span><a class='menutext' href='/'>VOID</a><span class='darkgrey'>]</span><span class='lightgrey'>:</span> S<br/><br/>")
    sqlstr = "SELECT * FROM (SELECT * FROM gossip ORDER BY timestamp DESC LIMIT 20) AS ttbl ORDER BY ID ASC"
    tmp = cfg.sql_cmd(sqlstr, 2)
    if not tmp == None:
        for row in tmp:
            if row[1] == "***":
                print("<div id='wrap'><br/><span class='darkred'>*** %s</span><br/></div>\n" % (cgi.escape(row[2])))
            else:
                dt = cfg.tstruct(str(row[3]))
                tzone = ""
                #print("dt.hour: '" + str(dt.hour) + "'")
                if dt.hour > 12:
                    if dt.hour > 12 and dt.hour < 22:
                        timestamp = "0"+str(dt.hour-12)+":"
                    else:
                        timestamp = str(dt.hour-12)+":"
                    tzone = "p"
                else:
                    if dt.hour == 0:
                        timestamp = "0"+str(dt.hour)+':'
                    else:
                        timestamp = str(dt.hour)+':'
                    tzone = "a"
                if len(str(dt.minute)) < 2:
                    timestamp += "0"+str(dt.minute)
                else:
                    timestamp += str(dt.minute)
                timestamp += tzone
    #            timestamp = strftime('%I:%M', timestamp)
                print("<div id='wrap'><span class='darkgrey'>%s</span> <span class='lightgrey'>%s gossips:</span> <span class='darkmagenta'>%s</span></div>\n" % (timestamp, row[1], cgi.escape(row[2])))
    print("<br/>\n<span class='darkgrey'>[</span><a class='menutext' href='/'>VOID</a><span class='darkgrey'>]</span><span class='lightgrey'>:</span> <span id='cursor'>&#x2588;</span>")
    return 0
Beispiel #4
0
def who_v2():
    """ who's online """
    color = None
    exphr = None
    xphr = None
    kph = 0.0
    print("<span class='darkgrey'>[</span><a class='menutext' href='/'>VOID</a><span class='darkgrey'>]</span><span class='lightgrey'>:</span> W<br/>\n<pre>\n")
    sqlstr = "SELECT count(*) FROM online"
    tmp = cfg.sql_cmd(sqlstr, 1)
    if tmp[0] > 0:
        print("<span class='lightyellow'>         Current Adventurers</span>")
        print("<span class='darkgrey'>         ===================</span>")
        sqlstr = "SELECT user, busy FROM online"
        tmp = cfg.sql_cmd(sqlstr, 2)
        for row in tmp:
            sqlstr = "SELECT alignment, title, exp, expold, gang FROM users WHERE user LIKE '"+row[0]+"%'"
            tmp = cfg.sql_cmd(sqlstr, 1)
            if tmp[0] == "Criminal": color = "darkyellow"
            elif tmp[0] == "Villain": color = "lightyellow"
            elif tmp[0] == "Outlaw": color = "darkred"
            elif tmp[0] == "FIEND": color = "lightred"
            else: color = "white"
            if tmp[2] == tmp[3]:
                exphr = "<span class='idle'>idle</span>"
            else:
                xphr = (tmp[2] - tmp[3]) * 12
                kph = xphr / 1000
                if round(kph, 0) > 10:
                    xphr = "%d" % kph
                else:
                    xphr = round(kph, 1)
                exphr = "<span class='xphr'>%sk/hr</span>" % str(xphr)
            if tmp[4] == "":
                print("<span class='line'>%s<span class='%s'>%8s</span> <span class='darkgreen'>%-20s %s</span>  <span class='darkmagenta'>%s</span></span>" % (exphr, color, tmp[0], row[0][:20], row[1], tmp[1]))
            else:
                print("<span class='line'>%s<span class='%s'>%8s</span> <span class='darkgreen'>%-20s %s</span>  <span class='darkmagenta'>%s</span>  <span class='darkgreen'>of</span> <span class='darkyellow'>%s</span></span>" % (exphr, color, tmp[0], row[0][:20], row[1], tmp[1], tmp[4]))

    else:
        print("<span class='darkmagenta'>There are no users in the game at the moment.</span>")
    print("</pre><br/>\n<span class='darkgrey'>[</span><a class='menutext' href='/'>VOID</a><span class='darkgrey'>]</span><span class='lightgrey'>:</span> <span id='cursor'>&#x2588;</span>")
    return 0
Beispiel #5
0
def footer(warning):
    """ default html footer """
    sqlstr = "SELECT count(*) FROM online"
    players_online = cfg.sql_cmd(sqlstr, 1)
    print("\t\t<div id='online'><span class='lightblue'>Online: %d</span></div>" % players_online[0])
    print("\t</div>")
    if warning:
        print("\t<div id='msg'>Press <span class='darkcyan'>?</span> for help.</div>")
    else:
        print("\t<div id='msg'>Press <span class='darkcyan'>X</span> to exit to the Main Menu.</div>")
    print("""\t<div id='help'><img alt='Help!' src='/img/help.png' /></div>
\n</div>\n</body>\n
</html>\n""")
    return 0