コード例 #1
0
def admin_Overdraft_limit():
    '''
    修改用户银行卡的透支额度
    :return:None
    '''
    dict = {}
    print('所有用户额度信息如下:\n')
    list = os.listdir(DIR)
    num = 0
    for i in list:
        if i == '__init__.py' or i == '__init__.pyc':
            continue
        else:
            re_dict = common.log_info_read(i.strip().split('_')[0])
            num += 1
            print('{0} 登录名称:{1}  透支额度为:{2}  \n'.format(
                num, re_dict['name_login'], re_dict['Overdraft_limit']))
            dict[str(num)] = re_dict['name_login']
    while TAG:
        choose = raw_input('输入索引选择你想修改额度的账户(n = 返回上级菜单):')
        if choose == 'n':
            return
        elif choose in dict:
            Quota = raw_input('你想把额度改成多少?:')
            re_dict = common.log_info_read(dict[choose])
            re_dict['Overdraft_limit'] = Quota
            common.log_info_write(dict[choose], re_dict)
            print('用户{0}的额度修改成功!'.format(dict[choose]))
        else:
            print('您输入的信息有误!')
コード例 #2
0
def User_Transfer_Money(log=None):
    '''
    用户时时转账模块
    :return:
    '''
    while TAG:
        dictt = common.log_info_read(LOGINING[0])
        tm = time.localtime()
        tm_text = str(tm.tm_year) + '-' + str(tm.tm_mon) + '-' + str(
            tm.tm_mday) + ' ' + str(tm.tm_hour) + ':' + str(tm.tm_min)
        text = '''
                   时时转账功能界面           {0}
                    1,时时转账
                    2,返回菜单
                                '''.format(log)
        print(text)
        while TAG:
            decide = raw_input('请问你想做点什么?')
            if decide == '1':
                name = raw_input('请输入你想转账的人的用户名:')
                if os.path.exists(DIR + name + '_log') == False:
                    print('没有这个用户存在!请重新输入!')
                    break
                elif common.log_info_specific_read(name, 'account') == 'empty':
                    print('对方没有关联银行卡!')
                    break
                else:
                    card = raw_input('请输入你想要转账的对方的银行卡号:')
                    account = common.log_info_specific_read(name, 'account')
                    if card == account:
                        print('银行卡号验证成功!')
                        money = raw_input('请输入你想要转账的金额:')
                        re = common.pwd_money_check(LOGINING[0])
                        if re == False:
                            print('密码校验错误!')
                            break
                        elif int(dictt['cash']) < int(money):
                            print('您没有足够的现金转账!')
                            break
                        elif money.isdigit():
                            dict = common.log_info_read(name)
                            dict['cash'] = str(int(dict['cash']) + int(money))
                            common.log_info_write(name, dict)
                            text = '{0}:银行卡为{1}的用户 向您转账{2}元,电子现金账户余额为{3},总透支额度为{4}'\
                                .format(tm_text,dictt['account'],money,dict['cash'],dict['Actual_overdraft'])
                            common.log_info_billing_write(name, text)
                            dictt['cash'] = str(
                                int(dictt['cash']) - int(money))
                            common.log_info_write(LOGINING[0], dictt)
                            text = '{0}:您进行了“转账”操作,转账金额为{1},对方银行卡号为{2},电子现金余额为{3},总透支额度为{4}'\
                                .format(tm_text,money,dict['account'],dictt['cash'],dictt['Actual_overdraft'])
                            common.log_info_billing_write(LOGINING[0], text)
                            print('转账成功!')
                    else:
                        print('您的银行卡号输入错误!')
                        break
            elif decide == '2':
                return
            else:
                print('您的输入有误!')
コード例 #3
0
def admin_add_bankcard():
    '''
    给没有关联银行卡的用户关联银行卡号
    :return:None
    '''
    dict = {}
    print('尚未建立银行卡关联信息的账户如下:\n')
    list = os.listdir(DIR)
    num = 0
    for i in list:
        if i == '__init__.py' or i == '__init__.pyc':
            continue
        else:
            re_dict = common.log_info_read(i.strip().split('_')[0])
            if re_dict['account'] == 'empty':
                num += 1
                print('{0} 登录名称:{1}  \n'.format(num, re_dict['name_login']))
                dict[str(num)] = re_dict['name_login']
    while TAG:
        choose = raw_input('输入索引选择你想添加银行卡的用户(n = 返回上级菜单):')
        if choose == 'n':
            return
        elif choose in dict:
            account = common.account_input()
            re_dict = common.log_info_read(dict[choose])
            re_dict['account'] = account
            common.log_info_write(dict[choose], re_dict)
            print('用户{0}的银行卡关联成功'.format(dict[choose]))
        else:
            print('您输入的信息有误!')
コード例 #4
0
def user_Login():
    num = 0
    List = []
    dict = common.log_info_read(DIR + 'config_conf')
    if dict == False:
        print("请让管理员先创建怪物及锁妖塔模型后再来!")
        return
    if len(dict['players']) == 0:
        print("请注册角色以后再来!")
        return
    while TAG:
        text = """
                你一共创建了{0}个角色如下:
        """.format(str(len(dict['players'])))
        print(text)
        for P in dict['players']:
            print(
                "{0},姓名:{1},年龄:{2},国籍:{3},特长:{4},体力:{5},武力:{6},智力:{7},魅力:{8},游戏模式:{9}"
                .format(str(num + 1), P.Name, P.Age, P.Nationality,
                        P.Specialty, P.Strength, P.Force, P.IQ, P.Charm,
                        P.GameMode))
            num += 1
            List.append(str(num))
        choose = raw_input("请输入索引选择登陆角色(单选):")
        if choose in List:
            LOGIN.insert(0, dict['players'][int(choose) - 1])
            print("{0}角色登陆成功!".format(LOGIN[0].Name))
            return
        else:
            print("您的选择有误,请重新选择!")
            num = 0
コード例 #5
0
ファイル: Story_start.py プロジェクト: yinsendemogui/Alex
def Lock_demon_tower_Top(user):
    dict = common.log_info_read(DIR + 'config_conf')
    for pobj in dict['players']:
        if pobj.Name == user.Name:
            P = pobj
    time.sleep(2)
    title = """
                                * * * * * * * * * * * * * * * * * * * * * * *第五章:锁妖塔顶* * * * * * * * * * * * * * * * * * * * * * *
                """
    print(title)
    time.sleep(5)
    text = """
                            克服磨难,吾父终至,锁妖塔顶。与前相比,此地奇静。
                            地方不大,有水缸一口,两人高有余。好奇之下,
                            侧身观之,怎料竟有活人居于缸内,遂上前,救出。
                            原来此人就是灵儿。询问下,方知,那日毕,其心已死,
                            趁高富帅不备,遂逃出,寻短见,幸被隐门上士所救,居
                            此疗伤,恰逢我父闯塔,喜得相逢。至此,我父恍然,直呼,
                            此宝胜万宝也(主角瞬间满怒体力翻倍)
                """
    for i in text.decode('utf-8'):
        if i != ' ':
            time.sleep(0.5)
            print i.encode('utf-8'),
        else:
            print i.encode('utf-8'),
    P.Strength = P.Strength * 2
    common.log_info_write(DIR + 'config_conf', dict)
    Wu_Duo(user)
コード例 #6
0
def create_Tower_model():
    """
    创建锁妖塔模型
    :return: None
    """

    dict = common.log_info_read(DIR + 'config_conf')
    if dict == False:
        print("请先创建怪物模型后再来!")
        return
    name = raw_input("请输入锁妖塔的名称:")
    difficulty = raw_input("请输入本层的难度(倍增小怪攻击力):")
    T = lock_demon_tower_Model(name, difficulty, dict['monsters'])
    while TAG:
        text = """
                    课程的信息如下:
                     塔名:  {0}
                     难度:  {1}
            """.format(name, difficulty)
        print(text)
        decide = raw_input("是否确认(y/n):")
        if decide == 'y':
            dict['towers'].append(T)
            common.log_info_write(DIR + 'config_conf', dict)
            return
        elif decide == 'n':
            return
        else:
            print("您的输入有误!")
コード例 #7
0
ファイル: users_business.py プロジェクト: yinsendemogui/Alex
def login_Check():
    dict = common.log_info_read(DIR + 'config_conf')
    if dict == False:
        print("请让管理员先创建老师及课程模型后再来!")
        return
    name = raw_input("请输入你的姓名:")
    age = raw_input("请输入你的年龄:")
    account = raw_input("请输入你的登录账号:")
    password = raw_input("请输入你的登陆密码:")
    text = """
            你的注册信息如下:
              姓名:{0}
              年龄:{1}
              登陆账号:{2}
              登陆密码:{3}
    """.format(name, age, account, password)
    while TAG:
        print(text)
        decide = raw_input("是否确认(y/n):")
        if decide == 'y':
            S = student_Model(name, age, account, password, [])
            dict['students'].append(S)
            common.log_info_write(DIR + 'config_conf', dict)
            LOGIN.insert(0, S)
            print('信息注册成功')
            user_Main(name)
        elif decide == 'n':
            return
        else:
            print('你的输入有误!')
コード例 #8
0
def create_monsters_model():
    """
    创建小怪模型
    :return: None
    """
    while TAG:
        name = raw_input("请输入怪物的姓名:")
        hurt = raw_input("请输入怪物的破坏力:")
        text = """
            怪物信息如下:
             姓名:  {0}
             破坏力:{1}
        """.format(name, hurt)
        print(text)
        decide = raw_input("是否确认(y/n):")
        if decide == 'y':
            M = small_monster_Model(name, hurt)
            dict = common.log_info_read(DIR + 'config_conf')
            if dict != False:
                dict['monsters'].append(M)
                common.log_info_write(DIR + 'config_conf', dict)
                print("怪物信息保存成功!")
                return
            else:
                dict = {'monsters': [M], 'towers': [], 'players': []}
                common.log_info_write(DIR + 'config_conf', dict)
                print("怪物信息保存成功!")
                return
        elif decide == 'n':
            break
        else:
            print("您的输入有误!")
コード例 #9
0
def admin_Freeze_bankcard():
    '''
    冻结or解冻用户的银行卡号
    :return:None
    '''
    dict = {}
    print('所有已关联银行卡的用户的银行卡状态信息如下:\n')
    list = os.listdir(DIR)
    num = 0
    for i in list:
        if i == '__init__.py' or i == '__init__.pyc':
            continue
        else:
            re_dict = common.log_info_read(i.strip().split('_')[0])
            if re_dict['account'] != 'empty':
                num += 1
                if re_dict['status'] == '0':
                    lab = '活跃'
                else:
                    lab = '冻结'
                print('{0} 登录名称:{1}  账户状态:{2} \n'.format(
                    num, re_dict['name_login'], lab))
                dict[str(num)] = re_dict['name_login']
    while TAG:
        choose = raw_input('输入索引选择用户来改变他的银行卡状态(活跃-->冻结-->活跃)(n = 返回上级菜单):')
        if choose == 'n':
            return
        elif choose in dict:
            re_dict = common.log_info_read(dict[choose])
            if re_dict['status'] == '0':
                labb = '冻结'
                labbb = '1'
            else:
                labb = '活跃'
                labbb = '0'
            decide = raw_input('你确定要将用户{0}的银行卡的状态改成{1}吗?(y/n):'.format(
                dict[choose], labb))
            if decide == 'n':
                return
            re_dict['status'] = labbb
            common.log_info_write(dict[choose], re_dict)
            print('用户{0}的银行卡的状态信息已经改变!'.format(dict[choose]))
        else:
            print('您输入的信息有误!')
コード例 #10
0
ファイル: users_business.py プロジェクト: yinsendemogui/Alex
def class_Begins():
    num = 0
    List = []
    dict = common.log_info_read(DIR + 'config_conf')
    if LOGIN == []:
        print('请登陆后再来!')
        return
    if dict == False:
        print("请让管理员先创建老师及课程模型后再来!")
        return
    for S in dict['students']:
        if S.Name == LOGIN[0].Name and S.Lobj == []:
            print("您还没有选课,请选课后再来!")
            return
    while TAG:

        for obj in dict['students']:
            if obj.Name == LOGIN[0].Name:
                print("您有{0}门待修业课程,如下:".format(str(len(obj.Lobj))))
                for lesson in obj.Lobj:
                    if obj.schedule[lesson] >= 100:
                        finished = '已达成'
                    elif obj.num[lesson] >= 9:
                        finished = '修业失败'
                    else:
                        finished = obj.schedule[lesson]
                    print('{0},课程名:{1},课时费:{2},授课老师:{3},修业达成率:{4},已修业次数:{5}'.
                          format(str(num + 1), lesson.Lname, lesson.Lcost,
                                 lesson.Tobj.Name, finished, obj.num[lesson]))
                    num += 1
                    List.append(str(num))
        choose = raw_input("请输入你的选择(单选)(输入n返回上一级菜单):")
        if choose in List:
            # if LOGIN[0].schedule[LOGIN[0].Lobj[int(choose)]] < 100:
            for obj in dict['students']:
                if obj.Name == LOGIN[0].Name:
                    for i in range(9):
                        # print (obj.Lobj[int(choose)-1])
                        if obj.schedule[obj.Lobj[
                                int(choose) - 1]] < 100 and obj.num[obj.Lobj[
                                    int(choose) - 1]] < 9:
                            obj.Classbegins(obj.Lobj[int(choose) - 1].Lname)
                            num = 0
                        else:
                            print('您选择的课程已经修业完成,请重新选择!')
                            common.log_info_write(DIR + 'config_conf', dict)
                            num = 0
                            break
                    common.log_info_write(DIR + 'config_conf', dict)
        elif choose == 'n':
            return
        else:
            print("您的输入有误!")
            num = 0
コード例 #11
0
def Select_Billing(log=None):
    '''
    用户账单查询模块
    :return:
    '''

    dictt = {}
    while TAG:
        num = 0
        dict = common.log_info_read(LOGINING[0])
        tm = time.localtime()
        tm_text = str(tm.tm_year) + '-' + str(tm.tm_mon) + '-' + str(
            tm.tm_mday) + ' ' + str(tm.tm_hour) + ':' + str(tm.tm_min)

        text = '''
                      账单功能如下:           {0}
                    1,账单查询
                    2,未出账单流水记录查询
                    3,返回菜单
                                  '''.format(log)
        print(text)
        while TAG:
            choose = raw_input('请输入索引进行选择:')
            if choose == '1':
                num = 0
                if len(dict['Debt_record'].keys()) != 0:
                    for i in dict['Debt_record'].keys():
                        num += 1
                        dictt[str(num)] = i
                        print('{0},{1}账单'.format(str(num), i))
                    while TAG:
                        choose = raw_input('请输入你的选择:')
                        if choose in dictt:
                            print(dict['Debt_record'][dictt[choose]])
                            print('{0}月账单流水信息如下:'.format(dictt[choose]))
                            for i in dict['Has_been_out_billing'][
                                    dictt[choose]]:
                                print(i)
                            break
                        else:
                            print('你的输入有误!')
                else:
                    print('目前您没有任何账单生成!')
                    break
            elif choose == '2':
                print('未出账单流水记录如下:')
                for line in dict['Not_out_billing']:
                    print(line)
                break
            elif choose == '3':
                return
            else:
                print('您的输入有误!')
コード例 #12
0
def model_Config():
    """
    查看已经创建的模型
    :return: None
    """
    num = 0
    Num = 0
    dict = common.log_info_read(DIR + 'config_conf')
    if dict == False:
        print ("请先创建老师模型后再来!")
        return
    print ("已经创建的老师模型,如下:".format(str(len(dict['teachers']))))
    for P in dict['teachers']:
        print ("{0}:姓名:{1},年龄:{2},性别:{3}".format(str(num + 1), P.Name, P.Age, P.Sex))
        num += 1
    print ("已经创建的课程模型,如下:".format(str(len(dict['teachers']))))
    for P in dict['lessons']:
        print ("{0}:课程名:{1},课时费:{2},授课老师:{3}".format(str(Num + 1), P.Lname, P.Lcost, P.Tobj.Name))
        Num += 1
コード例 #13
0
ファイル: users_business.py プロジェクト: yinsendemogui/Alex
def select_Lesson():
    num = 0
    List = []
    dict = common.log_info_read(DIR + 'config_conf')
    if LOGIN == []:
        print('请登陆后再来!')
        return
    if dict == False:
        print("请让管理员先创建老师及课程模型后再来!")
        return
    print("目前的可选课程有{0}门,如下:".format(str(len(dict['lessons']))))
    for lesson in dict['lessons']:
        print('{0},课程名:{1},课时费:{2},授课老师:{3}'.format(str(num + 1), lesson.Lname,
                                                    lesson.Lcost,
                                                    lesson.Tobj.Name))
        num += 1
        List.append(str(num))
    while TAG:
        choose = raw_input("请输入索引选择课程(可以多选但不能重复):")
        if choose.isdigit():
            if len(choose) == len(set(choose)):
                if set(choose) & set(List) == set(choose):
                    for S in dict['students']:
                        if S.Name == LOGIN[0].Name:
                            for i in list(choose):
                                if dict['lessons'][int(i) - 1] in S.Lobj:
                                    print("您已经添加过{0}课程了".format(
                                        dict['lessons'][int(i) - 1].Lname))
                                else:
                                    S.Lobj.append(dict['lessons'][int(i) - 1])
                                    S.schedule[dict['lessons'][int(i) - 1]] = 0
                                    S.num[dict['lessons'][int(i) - 1]] = 0
                            common.log_info_write(DIR + 'config_conf', dict)
                            print('选课成功!')
                            return
                        else:
                            pass
                else:
                    print("您的选择超范围,请重新选择!")
            else:
                print("您的选择里有重复内容,请重新输入!")
        else:
            print('您的输入必须是纯数字,请重新输入!')
コード例 #14
0
def create_Lesson_model():
    """
    创建课程模型
    :return: None
    """
    num = 0
    list = []
    dict = common.log_info_read(DIR + 'config_conf')
    if dict == False:
        print ("请先创建老师模型后再来!")
        return
    name = raw_input("请输入课程名称:")
    cost = raw_input("请输入课时费:")
    while TAG:
        print ("目前有{0}个老师可供选择,如下:".format(str(len(dict['teachers']))))
        for P in dict['teachers']:
            print ("{0}:姓名:{1},年龄:{2},性别:{3}".format(str(num+1),P.Name,P.Age,P.Sex))
            num += 1
            list.append(str(num))
        choose = raw_input("请输入索引选择授课老师:")
        if choose in list:
            tobj = dict['teachers'][int(choose)-1]
            L = lesson_Model(name,cost,tobj)
            while TAG:
                text = """
                        课程的信息如下:
                         课程名:{0}
                         课时费:{1}
                        授课老师:{2}
                """.format(name, cost, L.Tobj.Name)
                print (text)
                decide = raw_input("是否确认(y/n):")
                if decide == 'y':
                    dict['lessons'].append(L)
                    common.log_info_write(DIR + 'config_conf', dict)
                    return
                elif decide == 'n':
                    return
                else:
                    print ("您的输入有误!")
        else:
            print ("您的输入有误!")
            num = 0
コード例 #15
0
def model_Config():
    """
    查看已经创建的模型
    :return: None
    """
    num = 0
    Num = 0
    dict = common.log_info_read(DIR + 'config_conf')
    if dict == False:
        print("请先创建怪物模型后再来!")
        return
    print("已经创建的怪物模型,如下:".format(str(len(dict['monsters']))))
    for M in dict['monsters']:
        print("{0}:怪物名:{1},破坏力:{2},掉宝:{3}".format(str(num + 1), M.Name, M.Hurt,
                                                  M.Drop))
        num += 1
    print("已经创建的塔模型,如下:".format(str(len(dict['towers']))))
    for P in dict['towers']:
        print("{0}:塔名:{1},难度:{2},怪物列表:{3}".format(str(Num + 1), P.Lname,
                                                  P.Difficulty, P.Mlist_obj))
        Num += 1
コード例 #16
0
def User_Pay_back_Money():
    '''
     用户定期还款设置模块
     :return:
     '''
    dict = common.log_info_read(LOGINING[0])
    print('您目前的自动还款设置为每月的{0}日还款').format(dict['Repayment_date'])
    while TAG:
        decide = raw_input('你想重新设置自动还款日吗?(y/n):')
        if decide == 'y':
            day = raw_input('请输入您想设置的日期(1----10):')
            if day.isdigit() and int(day) <= 10:
                dict['Repayment_date'] = day
                common.log_info_write(LOGINING[0], dict)
                print('自动还款日期修改成功!')
                return
            else:
                print('您的输入有误!')
        elif decide == 'n':
            return
        else:
            print('您的输入有误!')
コード例 #17
0
def Login_check(user, pwd):
    '''
    用户登录验证功能模块:
    :param user: 用户名
    :param pwd: 登录密码
    :return: 1:用户名不存在
             2:用户名密码不匹配
             3:用户名存在于锁定列表中
             True:登录信息正确
    '''
    if user == 'admin' and pwd == '123123':
        LOGINING.insert(0, 'admin')
        admin_business.admin_manage('admin')
    re = common.log_info_read(user)
    if user in ERROR:
        return '3'
    elif os.path.exists(DIR + user + '_log') == False:
        return '1'
    elif re['pwd_login'] != common.MD5(pwd):
        return '2'
    else:
        return True
コード例 #18
0
def create_Teachers_model():
    """
    创建老师模型
    :return: None
    """
    while TAG:
        name = raw_input("请输入老师的姓名:")
        age = raw_input("请输入老师的年龄:")
        sex = raw_input("请输入老师的性别:")
        while TAG:
            text = """
                老师信息如下:
                 姓名:{0}
                 年龄:{1}
                 性别:{2}
            """.format(name,age,sex)
            print (text)
            decide = raw_input("是否确认(y/n):")
            if decide == 'y':
                P = teacher_Model(name,age,sex)
                dict = common.log_info_read(DIR+'config_conf')
                if dict != False:
                    dict['teachers'].append(P)
                    common.log_info_write(DIR + 'config_conf', dict)
                    print ("老师信息保存成功!")
                    return
                else:
                    dict = {
                        'teachers':[P],
                        'lessons':[],
                        'students':[]
                    }
                    common.log_info_write(DIR+'config_conf',dict)
                    print ("老师信息保存成功!")
                    return
            elif decide == 'n':
                break
            else:
                print ("您的输入有误!")
コード例 #19
0
ファイル: users_business.py プロジェクト: yinsendemogui/Alex
def user_Login():
    dict = common.log_info_read(DIR + 'config_conf')
    if dict == False:
        print("请让管理员先创建老师及课程模型后再来!")
        return
    while TAG:
        account = raw_input("请输入你的登录名:")
        if account == 'admin':
            password = raw_input("请输入你的登陆密码:")
            if password == '123123':
                admin_business.admin_Main('admin')
        for S in dict['students']:
            if S.Account == account:
                while TAG:
                    password = raw_input("请输入你的登陆密码:")
                    if S.Password == password:
                        print('登陆成功')
                        LOGIN.insert(0, S)
                        user_Main(S.Name)
                    else:
                        print("您输入的密码有误!")
        else:
            print("您输入的账号有误,请重新输入!")
コード例 #20
0
def User_information():
    '''
    个人信息查询模块
    :return:
    '''
    while TAG:
        dict = common.log_info_read(LOGINING[0])
        if dict['status'] == '0':
            lab = '正常'
        else:
            lab = '冻结'
        if dict['account'] == 'empty':
            labb = '未绑定'
        else:
            labb = dict['account']
        text = '''
                         您的个人注册信息如下:

                            登录名:{0}
                            银行卡号:{1}
                            注册时间:{2}
                            账单日(每月):{3}
                            还款日(每月):{4}
                            银行卡状态:{5}
                            电子现金余额:{6}
                            银行卡已透支额度:{7}
                            银行卡透支额度上限:{8}
                            '''.format(dict['name_login'], labb,
                                       dict['tm_text'], dict['billing_day'],
                                       dict['Repayment_date'], lab,
                                       dict['cash'], dict['Actual_overdraft'],
                                       dict['Overdraft_limit'])
        print(text)
        print('''
                           您可以进行如下操作:
                            1,修改登录密码
                            2,绑定银行卡
                            3,修改银行卡密码
                            4,返回菜单
              ''')
        while TAG:
            decide = raw_input('你想做点什么?')
            if decide == '1':
                pwd_login = common.pwd_login_input()
                if pwd_login == None:
                    return
                else:
                    dict['pwd_login'] = pwd_login
                    common.log_info_write(LOGINING[0], dict)
                    print('登录密码修改成功')
                    break
            elif decide == '2':
                if dict['account'] != 'empty':
                    print('您已经绑定过银行卡了!不能再次绑定!')
                    break
                else:
                    account = common.account_input()
                    if account == None:
                        return
                    else:
                        dict['account'] = account
                        common.log_info_write(LOGINING[0], dict)
                        print('银行卡绑定成功!')
                        break
            elif decide == '3':
                if dict['account'] == 'empty':
                    print('您尚未绑定银行卡,请绑定后再来!')
                    break
                else:
                    pwd_money = common.pwd_money_input()
                    if pwd_money == None:
                        return
                    else:
                        dict['pwd_money'] = pwd_money
                        common.log_info_write(LOGINING[0], dict)
                        print('银行卡密码修改成功!')
                        break
            elif decide == '4':
                return
            else:
                print('您的输入有误!')
コード例 #21
0
#!usr/bin/env python
# -*- coding:utf-8 -*-
# auther:Mr.chen
# 描述:教师模型类

import random, time, os, sys

sys.path.append('..')
from lib import common

DIR = os.path.dirname(__file__)
DIR = DIR.replace('src', 'db/')
DICT = common.log_info_read(DIR + 'config_conf')


class small_monster_Model:
    '''
    小怪物模型类
    '''
    def __init__(self, name, hurt):
        self.Name = name  # 怪物名
        self.Hurt = hurt  # 破坏力
        self.Drop = ['大还丹', '小还丹']  # 掉宝

    def __str__(self):
        return self.Name
コード例 #22
0
ファイル: Story_start.py プロジェクト: yinsendemogui/Alex
def Lock_demon_tower(user):
    List = []
    dict = common.log_info_read(DIR + 'config_conf')
    for pobj in dict['players']:
        if pobj.Name == user.Name:
            P = pobj

    time.sleep(2)
    title = """
                            * * * * * * * * * * * * * * * * * * * * * * *第四章:勇闯锁妖塔* * * * * * * * * * * * * * * * * * * * * * *
            """
    print(title)
    time.sleep(5)
    text = """
                        反复思量,我父还是决定暂缓报仇,遵从隐士的看法,
                        独自一人来到锁妖塔前,看者前方雄伟的高达{0}
                        层的锁妖塔,暗下决心,要尽快完成闯塔拿到宝物.
                        于是,我父来到了塔下的驿站里...
            """.format(str(len(user.Tlist_obj)))
    for i in text.decode('utf-8'):
        if i != ' ':
            time.sleep(0.5)
            print i.encode('utf-8'),
        else:
            print i.encode('utf-8'),
    while TAG:
        test = """
                  请问现在你想去哪?
                    1,闯塔
                    2,打开背包(吃药)          你还有{0}体力
                    3,不闯了,直接去报仇
        """.format(str(P.Strength))
        print(test)
        choose = raw_input("请输入索引进行选择:")
        num = 0
        bum = 0
        if choose == '1':
            for tobj in dict['towers']:
                if P.schedule[tobj] == 100:
                    schedule = '已达成'
                    bum += 1
                else:
                    schedule = P.schedule[tobj]
                print("{0},{1},难度系数:{2},进度率:{3}%,创塔次数:{4}次".format(
                    str(num + 1), tobj.Lname, tobj.Difficulty, str(schedule),
                    str(P.num[tobj])))
                if bum == len(P.Tlist_obj):
                    print("{0},锁妖塔顶层,难度系统:0".format(str(num + 2)))
                num += 1
                List.append(str(num))
            decide = raw_input("请输入索引进行选择:")
            if decide == str(len(P.Tlist_obj) + 1) and bum == len(P.Tlist_obj):
                Lock_demon_tower_Top(user)
            if decide in List:
                if P.schedule[dict['towers'][int(decide) - 1]] < 100:
                    for i in range(10):
                        re = P.Begins(dict['towers'][int(decide) - 1])
                        if re == False:
                            common.log_info_write(DIR + 'config_conf', dict)
                            break
                    else:
                        common.log_info_write(DIR + 'config_conf', dict)
                else:
                    print("本层已经闯过了!")
            else:
                print("你的输入有误!")

        elif choose == '2':
            while TAG:
                text = """
                        背囊物品如下:          你还有{0}体力
                        1,大还丹:{1}个
                        2,小还丹  {2}个
                """.format(str(P.Strength), str(P.Item['大还丹']),
                           str(P.Item['大还丹']))
                print(text)
                choose = raw_input("请输入索引进行选择:")
                if choose == '1':
                    if P.Item['大还丹'] > 0:
                        P.Item['大还丹'] -= 1
                        P.Strength += 500
                        common.log_info_write(DIR + 'config_conf', dict)
                        break
                    else:
                        print("大还丹个数为0")
                        break
                elif choose == '2':
                    if P.Item['小还丹'] > 0:
                        P.Item['小还丹'] -= 1
                        P.Strength += 200
                        common.log_info_write(DIR + 'config_conf', dict)
                        break
                    else:
                        print("小还丹个数为0")
                        break
                else:
                    print("你的输入有误!请重新输入!")

        elif choose == '3':
            Fail_ending_one()
        else:
            print("你的输入有误!")
コード例 #23
0
def login_Check():
    dict = common.log_info_read(DIR + 'config_conf')

    name = raw_input("请输入你的姓名:")
    age = raw_input("请输入你的年龄:")
    nationality = raw_input("请输入你的国籍:")

    text = """
                  游戏可选特长如下:
                1,无双(初始武力+10,武力越高,敌人的伤害越低)
                2,奇才 (初始智力+10,智力越高遇敌率越低)
                3,妖异 (初始魅力+10,魅力越高,敌人暴击率越低)
                4,守财 (初始体力+300,体力越高越耐打)
    """
    while TAG:
        print(text)
        specialty = raw_input("请输入索引选择你的特长(单选):")
        Dic = {'1': '无双', '2': '奇才', '3': '妖异', '4': '守财'}
        if specialty in Dic.keys():
            specialty = Dic[specialty]
            break
        else:
            print("你的输入有误,请重新输入!")
    while TAG:
        decide = raw_input("是否开启作弊模式?(y/n)")
        if decide == 'y':
            gamemode = '作弊模式'
            break
        elif decide == 'n':
            gamemode = '正常模式'
            break
        else:
            print("你的输入有误!")
    text = """
            你的注册信息如下:
              姓名:{0}
              年龄:{1}
              国籍:{2}
              特长:{3}
              模式:{4}
    """.format(name, age, nationality, specialty, gamemode)
    while TAG:
        print(text)
        decide = raw_input("是否确认(y/n):")
        if decide == 'y':
            P = players_Model(name, age, nationality, specialty, gamemode,
                              dict['towers'])
            # Dict = {'无双': 'Force', '奇才': 'IQ', '妖异': 'Charm'}
            if specialty == '无双':
                P.Force += 10
            elif specialty == '奇才':
                P.IQ += 10
            elif specialty == '妖异':
                P.Charm += 10
            else:
                P.Strength += 300
            if gamemode == '作弊模式':
                P.Force = 100
                P.IQ = 100
                P.Charm = 100
                P.Strength = 100000

            dict['players'].append(P)
            common.log_info_write(DIR + 'config_conf', dict)
            print('信息注册成功')
            return
        elif decide == 'n':
            return
        else:
            print('你的输入有误!')