Beispiel #1
0
Datei: cc.py Projekt: arcsela/cc
def printCard(type,playerStatus = None):
  if playerStatus is None:
    playerStatus = getPlayerStatus()
  for item in playerStatus['body'][5]['data']:
    if type == -1:
      print '[%s] ' % item['idx'] + 'No.%05d %s ' % (int(item['id']), gacha.i2n(item['id'],item['type']))
    elif type == 0 and item['type'] == 0:
      print '[%s] ' % item['idx'] + '%s' % cardInfo(item['idx'],playerStatus)
    elif type == 1 and item['type'] == 1:
      print '[%s] ' % item['idx'] + 'No.%05d %s ' % (int(item['id']), gacha.i2n(item['id'],item['type']))
    elif type > 1 and item['type'] > 1:
      print '[%s] ' % item['idx'] + 'No.%05d %s ' % (int(item['id']), gacha.i2n(item['id'],item['type']))
Beispiel #2
0
Datei: cc.py Projekt: arcsela/cc
def autoSellCard():
  resPlayerStatus = getPlayerStatus()
  for item in resPlayerStatus['body'][5]['data']:
    if( gacha.i2as(item['id'],item['type']) ):
      print '\033[1;31m[%s]' % item['idx'] + ' %s \033[m' % gacha.i2n(item['id'],item['type'])
      print 'sell after 2 seconds...'
      time.sleep(2)
      sellCard(item['idx'], resPlayerStatus)
    else:
      print '\033[1;30m[%s]' % item['idx'] + ' %s \033[m' % gacha.i2n(item['id'],item['type'])

    '''
Beispiel #3
0
def autoSellCard():
    resPlayerStatus = getPlayerStatus()
    for item in resPlayerStatus['body'][5]['data']:
        if (gacha.i2as(item['id'], item['type'])):
            print '\033[1;31m[%s]' % item['idx'] + ' %s \033[m' % gacha.i2n(
                item['id'], item['type'])
            print 'sell after 2 seconds...'
            time.sleep(2)
            sellCard(item['idx'], resPlayerStatus)
        else:
            print '\033[1;30m[%s]' % item['idx'] + ' %s \033[m' % gacha.i2n(
                item['id'], item['type'])
        '''
Beispiel #4
0
Datei: cc.py Projekt: arcsela/cc
def autoSellBox():
  presentIdList = apiRequest('/present/list?')['body'][0]['data']
  for present in presentIdList:
    if( gacha.i2as(present['data']['id'],present['data']['type']) ):
      print '\033[1;31m[%s]' % present['idx'] + ' %s \033[m' % gacha.i2n(present['data']['id'],present['data']['type'],present['data']['val'])
      print 'sell after 2 seconds...'
      time.sleep(2)
      queryString = {}
      queryString.update({'p' : present['idx']})
      response = apiRequest('/present/recv', queryString)
      sellCard(response['body'][0]['data'][0]['idx'])
    else:
      print '\033[1;30m[%s]' % present['idx'] + ' %s \033[m' % gacha.i2n(present['data']['id'],present['data']['type'],present['data']['val'])
    '''
Beispiel #5
0
def printCard(type, playerStatus=None):
    if playerStatus is None:
        playerStatus = getPlayerStatus()
    for item in playerStatus['body'][5]['data']:
        if type == -1:
            print '[%s] ' % item['idx'] + 'No.%05d %s ' % (int(
                item['id']), gacha.i2n(item['id'], item['type']))
        elif type == 0 and item['type'] == 0:
            print '[%s] ' % item['idx'] + '%s' % cardInfo(
                item['idx'], playerStatus)
        elif type == 1 and item['type'] == 1:
            print '[%s] ' % item['idx'] + 'No.%05d %s ' % (int(
                item['id']), gacha.i2n(item['id'], item['type']))
        elif type > 1 and item['type'] > 1:
            print '[%s] ' % item['idx'] + 'No.%05d %s ' % (int(
                item['id']), gacha.i2n(item['id'], item['type']))
Beispiel #6
0
Datei: cc.py Projekt: arcsela/cc
def printPresentList(presentList = None):
  if presentList is None:
    presentList = getPresentList()
  presentIdList = presentList['body'][0]['data']
  for present in presentIdList:
    #print '[%s]' % present['idx'] + ' %s - %s x %s' % (present['data']['type'], gacha.i2n(int(present['data']['id'])), present['data']['val'])
    print '[%s]' % present['idx'] + ' %s ' % gacha.i2n(present['data']['id'],present['data']['type'],present['data']['val'])
Beispiel #7
0
def autoSellBox():
    presentIdList = apiRequest('/present/list?')['body'][0]['data']
    for present in presentIdList:
        if (gacha.i2as(present['data']['id'], present['data']['type'])):
            print '\033[1;31m[%s]' % present['idx'] + ' %s \033[m' % gacha.i2n(
                present['data']['id'], present['data']['type'],
                present['data']['val'])
            print 'sell after 2 seconds...'
            time.sleep(2)
            queryString = {}
            queryString.update({'p': present['idx']})
            response = apiRequest('/present/recv', queryString)
            sellCard(response['body'][0]['data'][0]['idx'])
        else:
            print '\033[1;30m[%s]' % present['idx'] + ' %s \033[m' % gacha.i2n(
                present['data']['id'], present['data']['type'],
                present['data']['val'])
        '''
Beispiel #8
0
def printPresentList(presentList=None):
    if presentList is None:
        presentList = getPresentList()
    presentIdList = presentList['body'][0]['data']
    for present in presentIdList:
        #print '[%s]' % present['idx'] + ' %s - %s x %s' % (present['data']['type'], gacha.i2n(int(present['data']['id'])), present['data']['val'])
        print '[%s]' % present['idx'] + ' %s ' % gacha.i2n(
            present['data']['id'], present['data']['type'],
            present['data']['val'])
Beispiel #9
0
def printCharacterInfo(characterInfo):
    return 'Lv: %2s/%2s, ' % (
        characterInfo['lv'], characterInfo['maxlv']) + 'EXP: %5s/%5s, ' % (
            characterInfo['disp_exp'], characterInfo['next_exp']
        ) + 'HP:%5s, ATK:%5s, ' % (
            characterInfo['hp'], characterInfo['atk']) + 'WP:%2s/%2s/%2s, ' % (
                characterInfo['weaponAttack'], characterInfo['weaponCritical'],
                characterInfo['weaponGuard']
            ) + 'No.%05d ' % int(characterInfo['id']) + '%s' % gacha.i2n(
                characterInfo['id'],
                characterInfo['type']) + '+%s' % characterInfo['limit_break']
Beispiel #10
0
Datei: cc.py Projekt: arcsela/cc
def printBattleResult(in_battleResult):
  #print in_battleResult
  if in_battleResult['res'] == 0:
    if in_battleResult.has_key('earns'):
      print 'EXP: %s / GOLD: %s (bonus %s)' % (in_battleResult['earns']['exp'], in_battleResult['earns']['gold'], in_battleResult['earns']['bonus_gold'])
      for item in in_battleResult['earns']['treasure']:
        print 'Treasure:  %s' %  gacha.i2n(item['id'], item['type'], item['val'])
    if in_battleResult.has_key('quest_reward'):
      print 'QUEST COMPLETED REWARD!!!'
      print in_battleResult['quest_reward']
  return in_battleResult
Beispiel #11
0
def printBattleResult(in_battleResult):
    #print in_battleResult
    if in_battleResult['res'] == 0:
        if in_battleResult.has_key('earns'):
            print 'EXP: %s / GOLD: %s (bonus %s)' % (
                in_battleResult['earns']['exp'],
                in_battleResult['earns']['gold'],
                in_battleResult['earns']['bonus_gold'])
            for item in in_battleResult['earns']['treasure']:
                print 'Treasure:  %s' % gacha.i2n(item['id'], item['type'],
                                                  item['val'])
        if in_battleResult.has_key('quest_reward'):
            print 'QUEST COMPLETED REWARD!!!'
            print in_battleResult['quest_reward']
    return in_battleResult
Beispiel #12
0
def cardInfo(idx, playerStatus=None):
    if playerStatus is None:
        playerStatus = getPlayerStatus()
    for item in playerStatus['body'][5]['data']:
        if item['idx'] == int(idx):
            if item['type'] == 0:
                return 'Lv: %2s/%2s, ' % (
                    item['lv'], item['maxlv']) + 'EXP: %5s/%5s, ' % (
                        item['disp_exp'], item['next_exp']
                    ) + 'HP:%5s, ATK:%5s, ' % (
                        item['hp'], item['atk']) + 'WP:%2s/%2s/%2s, ' % (
                            item['weaponAttack'], item['weaponCritical'],
                            item['weaponGuard']) + 'No.%05d ' % int(
                                item['id']) + '%s' % gacha.i2n(
                                    item['id'],
                                    item['type']) + '+%s' % item['limit_break']

            else:
                return item
Beispiel #13
0
def main():
    sys.path.append(os.getcwd())
    if sys.argv[1] == 'login':
        if os.path.exists('login_http.py'):
            import login_http
            login2(login_http.header, login_http.body)
        elif len(sys.argv) >= 4:
            login(sys.argv[2], sys.argv[3])
        else:
            print 'login <id> <pw>'
    elif sys.argv[1] == 'session':
        newSession = sys.argv[2]
        setSession(newSession)
    elif sys.argv[1] == 'bot':
        bot_mode()
    elif sys.argv[1] == 'questList':
        if len(sys.argv) == 3:
            printMissionList(sys.argv[2])
        else:
            printMissionList()
    elif sys.argv[1] == 'questSubList':
        if len(sys.argv) == 3:
            printMissionList(sys.argv[2], 2)
        else:
            printMissionList(None, 2)
    elif sys.argv[1] == 'quest':
        questId = sys.argv[2]
        quest(questId)
    elif sys.argv[1] == 'questSub':
        playerStatus = getPlayerStatus()
        if len(sys.argv) == 3:
            questId = sys.argv[2]
            questInfo = parseQuestSub(playerStatus, questId)
            __battleQuest__(questInfo)
        else:
            questInfo = parseQuestSub(playerStatus)
            __battleQuest__(questInfo)
    elif sys.argv[1] == 'questMain':
        questMain()
    elif sys.argv[1] == 'questWin':
        questId = sys.argv[2]
        resBattleResult = questWin(questId)
        printBattleResult(resBattleResult)
    elif sys.argv[1] == 'questInfo':
        questId = sys.argv[2]
        printMissionStatus(questId)
    elif sys.argv[1] == 'playerInfo':
        printPlayerStatus()
    elif sys.argv[1] == 'friend':
        try:
            subCommand = sys.argv[2]
            if subCommand == 'request':
                uid = sys.argv[3]
                friendRequest(uid)
            elif subCommand == 'accept':
                uid = sys.argv[3]
                friendAccept(uid)
            elif subCommand == 'pending':
                friendList = getFriendPendingList()
                printFriendList(friendList)
            elif subCommand == 'list':
                friendList = getFriendList()
                printFriendList(friendList)
            else:
                raise
        except:
            printPlayerInfo()
            print('command for friend:')
            print('  list          : list current friends')
            print('  request <uid> : request <uid> for friend')
            print('  pending       : list who is asking to be your friend')
            print('  accept  <uid> : accept <uid> to be your friend')

    elif sys.argv[1] == 'boss':
        try:
            subCommand = sys.argv[2]
            if subCommand == 'list':
                res = bossList()
                printBossList(res)
            elif subCommand == 'fight':
                bossId = sys.argv[3]
                res = bossList()
                res = bossInfo(res, bossId)
                bossFight(res)
            else:
                raise
        except:
            print('command for boss:')
            print('  list')
            print('  fight <bossid> : fight with boss')

    elif sys.argv[1] == 'genPass':
        password = sys.argv[2]
        setAccountPassword(password)
        print 'account: %s' % setAccountPassword(password)

    elif sys.argv[1] == 'recv':
        if sys.argv[2] == 'all':
            presentList = getPresentList()
            presentIdList = presentList['body'][0]['data']
            for present in presentIdList:
                queryString = {}
                queryString.update({'p': present['idx']})
                response = apiRequest('/present/recv', queryString)
                if response['res'] == 0:
                    item = response['body'][0]['data']
                    #print '[%s] ' % item[0]['idx'] + 'No.%05d ' % int(item[0]['id']) + '%s' % cardInfo(item[0]['idx'])
                    print '[%s] ' % item[0]['idx'] + 'No.%05d %s ' % (
                        int(item[0]['id']),
                        gacha.i2n(item[0]['id'], item[0]['type']))
                else:
                    break
        elif sys.argv[2] == 'rf':
            presentList = getPresentList()
            presentIdList = presentList['body'][0]['data']
            for present in presentIdList:
                #print present
                if gacha.i2type(present['data']['id']) == 3:
                    queryString = {}
                    queryString.update({'p': present['idx']})
                    response = apiRequest('/present/recv', queryString)
                    if response['res'] == 0:
                        item = response['body'][0]['data']
                        #print '[%s] ' % item[0]['idx'] + 'No.%05d ' % int(item[0]['id']) + '%s' % cardInfo(item[0]['idx'])
                        print '[%s] ' % item[0]['idx'] + 'No.%05d %s ' % (
                            int(item[0]['id']),
                            gacha.i2n(item[0]['id'], item[0]['type']))
                    else:
                        break
        else:
            y = len(sys.argv) - 2
            for x in range(0, y, 1):
                idx = sys.argv[x + 2]
                queryString = {}
                queryString.update({'p': idx})
                response = apiRequest('/present/recv', queryString)
                if response['res'] == 0:
                    item = response['body'][0]['data']
                    print '[%s] ' % item[0]['idx'] + 'No.%05d ' % int(
                        item[0]['id']) + '%s' % cardInfo(item[0]['idx'])

    elif sys.argv[1] == 'autosell':
        try:
            subCommand = sys.argv[2]
            if subCommand == 'box':
                autoSellBox()
            elif subCommand == 'card':
                autoSellCard()
            else:
                raise
        except:
            print('command for autosell: card, box')

    elif sys.argv[1] == 'sell':
        y = len(sys.argv) - 2
        for x in range(0, y, 1):
            idx = sys.argv[x + 2]
            resPlayerStatus = getPlayerStatus()
            sellCard(idx, resPlayerStatus)

    elif sys.argv[1] == 'acdraw':
        num = sys.argv[2]
        for x in range(int(num), 0, -10):
            queryString = {}
            queryString.update({'t': 0})
            if x > 10:
                queryString.update({'c': 10})
            else:
                queryString.update({'c': x})
            #print queryString
            response = apiRequest('/gacha', queryString)
            if response['res'] == 0:
                print response
                break

    elif sys.argv[1] == 'card':
        try:
            subCommand = sys.argv[2]
            if subCommand == 'rf':
                printCard(2)
            elif subCommand == 'wp':
                printCard(1)
            elif subCommand == 'ch':
                printCard(0)
            elif subCommand == 'all':
                printCard(-1)
            else:
                raise
        except:
            print('command for card: ch, rf, wp, all')

    elif sys.argv[1] == 'box':
        printPresentList()

    elif sys.argv[1] == 'recovery_ap':
        queryString = {}
        queryString.update({'type': 1})
        response = apiRequest('/user/recover_ap', queryString)

    elif sys.argv[1] == 'evdraw':
        resPlayerStatus = getPlayerStatus()
        eventPoint = 0
        for item in resPlayerStatus['body'][7]['data']:
            if item['item_id'] == 12:
                eventPoint = item['cnt']
                break
        print 'event point: %s' % (eventPoint)
        drawTotal = eventPoint / 200
        while drawTotal > 0:
            time.sleep(5)
            drawCnt = 10 if drawTotal >= 10 else drawTotal
            drawTotal -= drawCnt
            if drawCnt > 0:
                queryString = {}
                queryString.update({'t': 3})
                queryString.update({'c': drawCnt})
                response = apiRequest('/gacha', queryString)
                for card in response['present_card_list']:
                    print 'card id: %s' % (gacha.i2n(int(card['cid'])))

    elif sys.argv[1] == 'compose':
        if len(sys.argv) - 2 < 1:
            print('command for compose:')
            print(' <compose_idx>')
            print(' <compose_idx> <consume_idx> <consume_idx> ...')
            return
        string = None
        consume = 0
        resPlayerStatus = getPlayerStatus()
        oldGold = 0
        for item in resPlayerStatus['body'][7]['data']:
            if item['item_id'] == 10:
                oldGold = item['cnt']
        item = None
        item = idxSearchCard(sys.argv[2], resPlayerStatus)
        if item is not None:
            if item['type'] == 0:
                string = sys.argv[2]
            else:
                print '%s is not character card, compose cancel.' % sys.argv[2]
                return
        else:
            print '%s is not exist, compose cancel.' % sys.argv[2]
            return

        if len(sys.argv) - 3 > 0:
            for x in range(0, len(sys.argv) - 3, 1):
                item = None
                item = idxSearchCard(sys.argv[x + 3], resPlayerStatus)
                if item is not None:
                    if item['type'] == 1 or item['type'] == 2:
                        print '%s is weapon_ev/weapon_rf, compose cancel.' % sys.argv[
                            x + 3]
                        return
                    elif item.get('locked', False) == True:
                        print '%s is locked, compose cancel.' % sys.argv[x + 3]
                        return
                    else:
                        cs = gacha.i2star(item['id'])
                        if item['type'] == 0 and cs > 2:
                            if cs == 99:
                                print '%s is unknown character card, compose cancel.' % (
                                    sys.argv[x + 3], cs)
                            else:
                                print '%s is %sS character card, compose cancel.' % (
                                    sys.argv[x + 3], cs)
                            return
                        else:
                            string += '&mt=' + sys.argv[x + 3]
                            if consume < 10:
                                consume = consume + 1
                            else:
                                break
                else:
                    print '%s is not exist, compose cancel.' % sys.argv[x + 3]
                    return

        else:
            for item in resPlayerStatus['body'][5]['data']:
                if item.get('locked', False) != True and gacha.i2star(
                        item['id']) < 3 and (item['type'] == 0
                                             or item['type'] == 3):
                    string += '&mt=' + str(item['idx'])
                    print gacha.i2n(item['id'], item['type'])
                    if consume < 10:
                        consume = consume + 1
                    else:
                        break

        if consume == 0:
            print 'no consume card, compose cancel.'
            return
        queryString = {}
        queryString.update({'ba': string})
        response = apiRequest('/card/compose', queryString)
        bonus = 0
        if response.get('success', False) == True:
            bonus = response['add_exp']
        print 'EXP: %s (bonus %s) / GOLD: %s ' % (
            response['add_exp'] + bonus, bonus, response['money'] - oldGold)
        print 'Lv: %2s/%2s, ' % (
            response['base_card']['lv'],
            response['base_card']['maxlv']) + 'EXP: %5s/%5s, ' % (
                response['base_card']['disp_exp'] + bonus,
                response['base_card']['next_exp']) + 'HP:%5s, ATK:%5s, ' % (
                    response['base_card']['hp'], response['base_card']['atk']
                ) + 'WP:%2s/%2s/%2s, ' % (
                    response['base_card']['weaponAttack'],
                    response['base_card']['weaponCritical'],
                    response['base_card']['weaponGuard']) + 'No.%05d ' % int(
                        response['base_card']['id']) + '%s' % gacha.i2n(
                            response['base_card']['id'],
                            response['base_card']['type']
                        ) + '+%s' % response['base_card']['limit_break']

    else:
        print 'command error - %s' % sys.argv[1]
Beispiel #14
0
Datei: cc.py Projekt: arcsela/cc
def main():
  sys.path.append(os.getcwd())
  if sys.argv[1] == 'login':
    if os.path.exists('login_http.py'):
      import login_http
      login2(login_http.header, login_http.body)
    elif len(sys.argv) >= 4:
      login(sys.argv[2], sys.argv[3])
    else:
      print 'login <id> <pw>'
  elif sys.argv[1] == 'session':
    newSession = sys.argv[2]
    setSession(newSession)
  elif sys.argv[1] == 'bot':
    bot_mode()
  elif sys.argv[1] == 'questList':
    if len(sys.argv) == 3:
      printMissionList(sys.argv[2])
    else:
      printMissionList()
  elif sys.argv[1] == 'questSubList':
    if len(sys.argv) == 3:
      printMissionList(sys.argv[2],2)
    else:
      printMissionList(None,2)
  elif sys.argv[1] == 'quest':
    questId = sys.argv[2]
    quest(questId)
  elif sys.argv[1] == 'questSub':
    playerStatus = getPlayerStatus()
    if len(sys.argv) == 3:
      questId = sys.argv[2]
      questInfo = parseQuestSub(playerStatus,questId)
      __battleQuest__(questInfo)
    else:
      questInfo = parseQuestSub(playerStatus)
      __battleQuest__(questInfo)
  elif sys.argv[1] == 'questMain':
    questMain()
  elif sys.argv[1] == 'questWin':
    questId = sys.argv[2]
    resBattleResult = questWin(questId)
    printBattleResult(resBattleResult)
  elif sys.argv[1] == 'questInfo':
    questId = sys.argv[2]
    printMissionStatus(questId)
  elif sys.argv[1] == 'playerInfo':
    printPlayerStatus()
  elif sys.argv[1] == 'friend':
    try:
      subCommand = sys.argv[2]
      if subCommand == 'request':
        uid = sys.argv[3]
        friendRequest(uid)
      elif subCommand == 'accept':
        uid = sys.argv[3]
        friendAccept(uid)
      elif subCommand == 'pending':
        friendList = getFriendPendingList()
        printFriendList(friendList)
      elif subCommand == 'list':
        friendList = getFriendList()
        printFriendList(friendList)
      else:
        raise
    except:
      printPlayerInfo()
      print('command for friend:')
      print('  list          : list current friends')
      print('  request <uid> : request <uid> for friend')
      print('  pending       : list who is asking to be your friend')
      print('  accept  <uid> : accept <uid> to be your friend')
      
  elif sys.argv[1] == 'boss':
    try:
      subCommand = sys.argv[2]
      if subCommand == 'list':
        res = bossList()
        printBossList(res)
      elif subCommand == 'fight':
        bossId = sys.argv[3]
        res = bossList()
        res = bossInfo(res, bossId)
        bossFight(res)
      else:
        raise
    except:
      print('command for boss:')
      print('  list')
      print('  fight <bossid> : fight with boss')
      
  elif sys.argv[1] == 'genPass':
    password = sys.argv[2]
    setAccountPassword(password)
    print 'account: %s' % setAccountPassword(password)
    
  elif sys.argv[1] == 'recv':
    if sys.argv[2] == 'all':
      presentList = getPresentList()
      presentIdList = presentList['body'][0]['data']
      for present in presentIdList:
        queryString = {}
        queryString.update({'p' : present['idx']})
        response = apiRequest('/present/recv', queryString)
        if response['res'] == 0:
          item = response['body'][0]['data']
          #print '[%s] ' % item[0]['idx'] + 'No.%05d ' % int(item[0]['id']) + '%s' % cardInfo(item[0]['idx'])
          print '[%s] ' % item[0]['idx'] + 'No.%05d %s ' % (int(item[0]['id']), gacha.i2n(item[0]['id'],item[0]['type']))
        else:
          break
    elif sys.argv[2] == 'rf':
      presentList = getPresentList()
      presentIdList = presentList['body'][0]['data']
      for present in presentIdList:
        #print present
        if gacha.i2type(present['data']['id']) == 3:
          queryString = {}
          queryString.update({'p' : present['idx']})
          response = apiRequest('/present/recv', queryString)
          if response['res'] == 0:
            item = response['body'][0]['data']
            #print '[%s] ' % item[0]['idx'] + 'No.%05d ' % int(item[0]['id']) + '%s' % cardInfo(item[0]['idx'])
            print '[%s] ' % item[0]['idx'] + 'No.%05d %s ' % (int(item[0]['id']), gacha.i2n(item[0]['id'],item[0]['type']))
          else:
            break
    else:
      y = len(sys.argv) - 2
      for x in range(0, y, 1):
        idx = sys.argv[x+2]
        queryString = {}
        queryString.update({'p' : idx})
        response = apiRequest('/present/recv', queryString)
        if response['res'] == 0:
          item = response['body'][0]['data']
          print '[%s] ' % item[0]['idx'] + 'No.%05d ' % int(item[0]['id']) + '%s' % cardInfo(item[0]['idx']) 

  elif sys.argv[1] == 'autosell':
    try:
      subCommand = sys.argv[2]
      if subCommand == 'box':
        autoSellBox()
      elif subCommand == 'card':
        autoSellCard()
      else:
        raise
    except:
      print('command for autosell: card, box')

  elif sys.argv[1] == 'sell':
    y = len(sys.argv) - 2
    for x in range(0, y, 1):
      idx = sys.argv[x+2]
      resPlayerStatus = getPlayerStatus()
      sellCard(idx,resPlayerStatus)

  elif sys.argv[1] == 'acdraw':
    num = sys.argv[2]
    for x in range(int(num), 0, -10):
      queryString = {}
      queryString.update({'t' : 0})
      if x > 10:
        queryString.update({'c' : 10})
      else:
        queryString.update({'c' : x})
      #print queryString
      response = apiRequest('/gacha', queryString)
      if response['res'] == 0:
        print response
        break
 
  elif sys.argv[1] == 'card':
    try:
      subCommand = sys.argv[2]
      if subCommand == 'rf':
        printCard(2)
      elif subCommand == 'wp':
        printCard(1)
      elif subCommand == 'ch':
        printCard(0)
      elif subCommand == 'all':
        printCard(-1)
      else:
        raise
    except:
      print('command for card: ch, rf, wp, all')

  elif sys.argv[1] == 'box':
    printPresentList()
    
  elif sys.argv[1] == 'recovery_ap':
    queryString = {}
    queryString.update({'type' : 1})
    response = apiRequest('/user/recover_ap', queryString)

  elif sys.argv[1] == 'evdraw':
    resPlayerStatus = getPlayerStatus()
    eventPoint = 0
    for item in resPlayerStatus['body'][7]['data']:
      if item['item_id'] == 12:
        eventPoint = item['cnt']
        break
    print 'event point: %s' % (eventPoint)
    drawTotal = eventPoint / 200
    while drawTotal > 0:
      time.sleep(5)
      drawCnt = 10 if drawTotal >= 10 else drawTotal
      drawTotal -= drawCnt
      if drawCnt > 0:
        queryString = {}
        queryString.update({'t':3})
        queryString.update({'c':drawCnt})
        response = apiRequest('/gacha', queryString)
        for card in response['present_card_list']:
          print 'card id: %s' % (gacha.i2n(int(card['cid'])))

  elif sys.argv[1] == 'compose':
    if len(sys.argv)-2 < 1:
      print('command for compose:')
      print(' <compose_idx>')
      print(' <compose_idx> <consume_idx> <consume_idx> ...')
      return
    string = None
    consume = 0 
    resPlayerStatus = getPlayerStatus()
    oldGold = 0
    for item in resPlayerStatus['body'][7]['data']:
      if item['item_id'] == 10:
        oldGold = item['cnt']
    item = None
    item = idxSearchCard(sys.argv[2],resPlayerStatus)
    if item is not None:
      if item['type'] == 0:
        string = sys.argv[2]
      else:
        print '%s is not character card, compose cancel.' % sys.argv[2]
        return
    else:
      print '%s is not exist, compose cancel.' % sys.argv[2]
      return
    
    if len(sys.argv)-3 > 0:
      for x in range(0, len(sys.argv)-3, 1): 
        item = None
        item = idxSearchCard(sys.argv[x+3],resPlayerStatus)
        if item is not None:
          if item['type'] == 1 or item['type'] == 2:
            print '%s is weapon_ev/weapon_rf, compose cancel.' % sys.argv[x+3] 
            return
          elif item.get('locked', False) == True:
            print '%s is locked, compose cancel.' % sys.argv[x+3] 
            return
          else:
            cs = gacha.i2star(item['id'])
            if item['type'] == 0 and cs > 2:
              if cs == 99:
                print '%s is unknown character card, compose cancel.' % (sys.argv[x+3] ,cs)
              else:
                print '%s is %sS character card, compose cancel.' % (sys.argv[x+3] ,cs)
              return
            else:  
              string += '&mt=' + sys.argv[x+3]
              if consume < 10:
                consume = consume + 1
              else:
                break
        else:
          print '%s is not exist, compose cancel.' % sys.argv[x+3] 
          return

    else:
      for item in resPlayerStatus['body'][5]['data']:
        if item.get('locked', False) != True and gacha.i2star(item['id']) < 3 and ( item['type'] == 0 or item['type'] == 3 ):
          string += '&mt=' + str(item['idx'])
          print gacha.i2n(item['id'],item['type'])
          if consume < 10:
            consume = consume + 1
          else:
            break
    
    if consume == 0:
      print 'no consume card, compose cancel.'
      return      
    queryString = {}
    queryString.update({'ba' : string})
    response = apiRequest('/card/compose', queryString)
    bonus = 0
    if response.get('success', False) == True:
      bonus = response['add_exp']
    print 'EXP: %s (bonus %s) / GOLD: %s ' % (response['add_exp']+bonus,bonus,response['money']-oldGold)
    print 'Lv: %2s/%2s, ' % (response['base_card']['lv'],response['base_card']['maxlv']) + 'EXP: %5s/%5s, ' % (response['base_card']['disp_exp']+bonus, response['base_card']['next_exp']) + 'HP:%5s, ATK:%5s, ' % (response['base_card']['hp'], response['base_card']['atk']) + 'WP:%2s/%2s/%2s, ' % (response['base_card']['weaponAttack'], response['base_card']['weaponCritical'], response['base_card']['weaponGuard']) + 'No.%05d ' % int(response['base_card']['id']) + '%s' % gacha.i2n(response['base_card']['id'],response['base_card']['type']) + '+%s' % response['base_card']['limit_break']

  else:
    print 'command error - %s' % sys.argv[1]
Beispiel #15
0
Datei: cc.py Projekt: arcsela/cc
def printCharacterInfo(characterInfo):
  return 'Lv: %2s/%2s, ' % (characterInfo['lv'],characterInfo['maxlv']) + 'EXP: %5s/%5s, ' % (characterInfo['disp_exp'], characterInfo['next_exp']) + 'HP:%5s, ATK:%5s, ' % (characterInfo['hp'], characterInfo['atk']) + 'WP:%2s/%2s/%2s, ' % (characterInfo['weaponAttack'], characterInfo['weaponCritical'], characterInfo['weaponGuard']) + 'No.%05d ' % int(characterInfo['id']) + '%s' % gacha.i2n(characterInfo['id'],characterInfo['type']) + '+%s' % characterInfo['limit_break']
Beispiel #16
0
Datei: cc.py Projekt: arcsela/cc
def cardInfo(idx, playerStatus = None):
  if playerStatus is None:
    playerStatus = getPlayerStatus()
  for item in playerStatus['body'][5]['data']:
    if item['idx'] == int(idx):
      if item['type'] == 0:
        return 'Lv: %2s/%2s, ' % (item['lv'],item['maxlv']) + 'EXP: %5s/%5s, ' % (item['disp_exp'], item['next_exp']) + 'HP:%5s, ATK:%5s, ' % (item['hp'], item['atk']) + 'WP:%2s/%2s/%2s, ' % (item['weaponAttack'], item['weaponCritical'], item['weaponGuard']) + 'No.%05d ' % int(item['id']) + '%s' % gacha.i2n(item['id'],item['type']) + '+%s' % item['limit_break']
        
      else:
        return item