Example #1
0
def main():
    d = Data()

    cids = [79652, 125463, 145742, 63829, 169578]
    d.init()

    sg = SG()
    print
    print

    def check(i):
        v = []

        sg.change_city(i)
        info = sg.get_people_info()
        v.append(info[1])
        v.append(info[4])
        v.append(info[3])
        info = sg.get_fin_info()
        name = tostr(info[1])
        v.append(-info[4])
        v.append(-info[5])
        v.append(-info[-3])
        d.set_value(v)
        return name, d.get_tax()

    for c in cids:
        ret = check(c)
        print ret[0], ret[1][1], ret[1][0]
Example #2
0
def getmapinfo(s = None):
	sg = SG()
	fn = "lasttime"
	print "start get map info "
	if not os.path.exists(fn): 
		open(fn,"wb").write("0")
	lasttime = float(open(fn).read())
	if time.time() - lasttime > 600:
		m = MapInfo()
		print m.findall( sg )
	
		open(fn,"wb").write(str(time.time()))
	print "end get map info."
Example #3
0
#! coding: utf-8

from libsg import SG, tostr, math


sg = SG()

r = sg.lookup_xy(0,0)


all = []
def showinfo( r ):
	for e in r['tents']:
		u = filter( lambda x:x[0] == e[2], r['users'] )[0]
		if tostr( u[3] ).find("пллЛ") != -1:
			v = sg.calc_xy( e[3] )
			
			print  tostr( u[1] ), tostr( u[3] ), tostr( e[1] ), math.sqrt(v[0]**2+v[1]**2),v, (238-v[1], v[0]-580)
			all.append( (tostr( u[1] ), tostr( u[3] ), tostr( e[1] ), math.sqrt(v[0]**2+v[1]**2),v, (238-v[1], v[0]-580)) )


o = 60

for x in range( -o, o, 9 ):
	for y in range( -o, o, 9 ):
		showinfo( sg.lookup_xy(x,y) )


all.sort( key = lambda x:x[3] )

print "*" *240
Example #4
0
from libsg import SG, tostr

cs = [116399, 125463, 145742, 57747, 63829, 164347, 121356]

sg = SG()
"""
[[2058022, 1, 0, '', 1462, '\xe5\x80\xad\xe5\x9b\xbd\xe9\x83\xa8\xe9\x98\x9f', 294, -553, [[470166, '\xe5\xae\x8b\xe5\xb8\xad\xe9\xa6\xa5']], 8000, 0, 2000, 0,1299, 0], [2060196, 12, 0, '', 0, '\xe7\xbb\xbf\xe6\xb4\xb2', 214, -587, [[460058, '\xe5\x8f\xb8\xe9\xa9\xac\xe8\x97\xa9']], 0, 0, 0, 0, 2707, 0]]

"""


def test():
    info = sg.get_battle_info(cs[0])
    for bt in info['battle']:
        print bt

    info = sg.get_mili_info(cs[0])
    for gt in info['goto']:
        print gt
        print tostr(gt[5]), gt[-2], sg.stand_mid(gt[6], gt[7]), sg.tomyxy(
            gt[6], gt[7])

    for gt in info['come']:
        pass


test()
#print sg.get_current_wars( cs[0] )
Example #5
0
from libsg import SG, tostr

sg = SG()

infos = sg.get_city_list()['infos']
cities = dict([(x[1], x[2]) for x in infos if x[1] > 0])

for k in cities:
    print tostr(cities[k]), k
    sg.change_city(k)
    ks = sg.get_wu_infos()
    for k in ks:
        print "\t", tostr(k[1]), k[0], k[5]
Example #6
0
from libsg import SG, tostr

sg = SG()

infos =  sg.get_city_list()['infos'] 
cities = dict( [ (x[1],x[2]) for x in infos if x[1]>0  ] )

for k in cities:
	print tostr( cities[k] ), k
	sg.change_city(k)
	ks = sg.get_wu_infos()
	for k in ks:print "\t", tostr( k[1] ), k[0], k[5]
Example #7
0
        print_exc()
        call_func_error_no += 1
        if call_func_error_no == 100:
            threads.deferToThread(sendemail, "连接出错..")
        if call_func_error_no == 150:
            threads.deferToThread(sendemail, "连接出错..")
        if call_func_error_no == 150: reactor.stop()
        reactor.callLater(10, call_func, func, cid, *args, **awk)
        return
    reactor.callLater(r, call_func, func, cid, *args, **awk)


def show_money():
    m = sg.get_money_number()
    print time.asctime(), sg.cname, ", 铜钱:", m
    return 15


call_update_all = functools.partial(call_update_building2, [3])  #8, 6,7
#call_update_all =  functools.partial( call_update_building2, [1,4,11] ) #8, 6,7
# 3 为房屋k

sg = SG(179973)

cid = 180312

call_func(call_update_all, 180312)
call_func(show_money, 180312)
reactor.run()