def itemfunc(): utils.drawline('EQUIPMENT') itemlists = {'1': [], '2': [], '3': [], '4': []} for equip in userinf.userequipments: id = equip['equipmentid'] num = equip['countnumber'] compactequip = { 'equipmentid': id, 'countnumber': num, 'equipmentname': plists.get_plist('equipment')[id]['equipmentname'] } itemlists[plists.get_plist('equipment')[id]['type']].append( compactequip) print 'Weapons:' printitem(itemlists['1']) print 'Armors:' printitem(itemlists['2']) print 'Items:' printitem(itemlists['3']) print 'Materials:' printitem(itemlists['4']) sel = itemmenu() if (sel == 2): return {0: senditem, 1: sellitem}[sel]()
def dosenditem(cardid, itemid, count): url = userinf.dataip + db.gift_url param = {'cardid': cardid, 'equipmentid': itemid, 'count': count} data = {'session': userinf.session} req = requests.post(url, params=param, data=data) # print req.text status, returnjson = utils.testjson(req.text) #TODO: analyze results(char) #utils.printjson(returnjson) print plists.get_plist( 'card')[cardid]['cardname'], u'获得', plists.get_plist( 'equipment')[itemid]['equipmentname'], '*', count
def senditem(): utils.drawline('SEND') itemid = raw_input("Input item id: ") cardid = raw_input("Input char id: ") if (not itemid in plists.get_plist('equipment') or not cardid in plists.get_plist('card')): print 'Input error.' return count_str = raw_input("Count: ") if not count_str.isdigit(): print 'Input error.' return count = int(count_str) dosenditem(cardid, itemid, count)
def battlefunc(): utils.drawline('BATTLE') bootyns = {} avail_maps = [] for m in userinf.mapstatus: bootyns[m['mapid']] = m['bootyn'] maps = plists.get_plist('map') for m in maps: if m in bootyns: print m + '\t' + maps[m]['groupname'] + ' - ' + maps[m]['mapname'] + ': ' + bootyns[m] avail_maps.append(m) elif maps[m]['needmapid'] == '' or maps[m]['needmapid'] in bootyns: print m + '\t' + maps[m]['groupname'] + ' - ' + maps[m]['mapname'] + ': ?' avail_maps.append(m) mapname = raw_input('Input map id: ') if mapname not in maps: print 'Input error.' return elif mapname not in avail_maps: print 'Map not available.' return sel, sel_group = selectgroup() if sel_group == None: return gotomap(mapname, sel, sel_group)
def banquetfunc(): utils.drawline('BANQUET') print userinf.banquetstatus if userinf.banquetstatus['state'] == '2': banquet_type = userinf.banquetstatus['type'] print '筹备中:', plists.get_plist('banquet')[banquet_type]['name'] print '剩余:', userinf.banquetstatus['readyendsecond'] + 's' print 'TODO: 快速筹备' #TODO
def sellitem(): utils.drawline('SELL') itemid = raw_input("Input item id: ") if not itemid in plists.get_plist('equipment'): print 'Input error.' return count_str = raw_input("Count: ") if not count_str.isdigit(): print 'Input error.' return count = int(count_str) dosellitem(itemid, count)
def questfunc(): utils.drawline('QUEST') sel = 0 updatequests() while sel != 2: operations = {} questlist = {} for quest in userquests: id = quest['questsid'] questdetail = plists.get_plist('quests')[id] questlist[id] = quest if int(quest['acceptflag']) == 0: print '[未接受]\t', operations[id] = doacceptquest elif quest['complete'] == 'false': print '[进行中]\t', operations[id] = docancelquest else: print '[已完成]\t', operations[id] = dosubmitquest print id + '\t' + questdetail['cyclename'] + questdetail[ 'name'] + ': ' + questdetail['true_content'] # print json.dumps(quest, ensure_ascii=False) sel = questmenu() if (sel != 2): print '============================================' if (sel == 0): updatequests() elif (sel == 1): questid = raw_input('Input questid: ') if questid not in plists.get_plist('quests'): print 'Invalid input' elif questid not in operations: print 'Quest not in list' else: operations[questid](questid, questlist[questid]) general.updatedata()
def carddetail(cardlist): utils.drawline('CARDDETAIL') cardid = raw_input("Input card id:") if not cardid in plists.get_plist('card'): print 'Input error.' return if not cardid in cardlist: print 'You do not possess this card.' return card = cardlist[cardid] print cardid + '\t' + card['cardname'] + ', LV' + card[ 'level'] + ', ' + card['exp'] + '/' + card['upexp'] print 'Loyalty: ' + card['loyalty'] + ', Points: ' + card['feat'] print 'Skinid: ' + card['skinid'] + ', ' + plists.get_plist('skin')[ card['skinid']]['skinname'] + ', HasSkins: ' + card['haveskinids'] print 'HP: ' + card['hp'] + ', Def: ' + card['def'] + ', A.rate: ' + card[ 'avoid'] + ', Luck: ' + card['lucky'] print 'AtkMel: ' + card['atk_mel'] + ', AtkRang: ' + card[ 'atk_rang'] + ', H.rate: ' + card['hitrate'] + ', Crit: ' + card['crit'] print 'Block: ' + card['block'] + ', Speed: ' + card['speed'] if card['equipment_id_wq'] == '': print 'Weapon: None,', else: print 'Weapon: ' + card['equipment_id_wq'] + ' ' + plists.get_plist( 'equipment')[card['equipment_id_wq']]['equipmentname'] + ',', if card['equipment_id_fj'] == '': print 'Armor: None' else: print 'Armor: ' + card['equipment_id_fj'] + ' ' + plists.get_plist( 'equipment')[card['equipment_id_fj']]['equipmentname'] spell_atk = plists.get_plist('spell')[card['spell_card_id_atk']] spell_def = plists.get_plist('spell')[card['spell_card_id_def']] spell_aid = plists.get_plist('spell')[card['spell_card_id_aid']] print 'Spell Atk: ' + card['spell_card_id_atk'] + ' ' + spell_atk[ 'name'] + spell_atk['spell_point'] + ', NeedLevel: ' + spell_atk[ 'need_level'] + ', ' + spell_atk['spell_rate'] + '%' print spell_atk['content'] print 'Spell Def: ' + card['spell_card_id_def'] + ' ' + spell_def[ 'name'] + spell_def['spell_point'] + ', NeedLevel: ' + spell_def[ 'need_level'] + ', ' + spell_def['spell_rate'] + '%' print spell_def['content'] print 'Spell Aid: ' + card['spell_card_id_aid'] + ' ' + spell_aid[ 'name'] + spell_aid['spell_point'] + ', NeedLevel: ' + spell_aid[ 'need_level'] + ', ' + spell_aid['spell_rate'] + '%' print spell_aid['content'] #TODO print 'TODO: 加点,切换装备,咕了'
def printgroup(group): print 'Group #' + group['groupid'] + ':' for card in group['useractors']: position = card['mappointx'] + card['mappointy'] print db.positionlist[position] + ': ' + card['cardid'], plists.get_plist('card')[card['cardid']]['cardname'] + ', tag = ' + card['tag']