Пример #1
0
import gw2lib
import os
import time
import sys




MILv2 = gw2lib.getMILv2()

apiKey = sys.argv[1]
chars = gw2lib.getAllCharacterData(apiKey)

totalBoxes = 0
for char in chars:
    if char['name'] == 'Elle Orange':
        for bag in char['bags']:
            if bag is not None:
                for item in bag['inventory']:
                    if item is not None:
                        itemName = MILv2[str(item['id'])]['name']
                        if itemName != 'Crude Salvage Kit':
                            totalBoxes += item['count']

print totalBoxes
Пример #2
0
import gw2lib
import time


'''
buildRSref just builds the reference files of runes and sigils, to be used with getRSprices in order to find
cheap alternatives to buying a rune or sigil on trade
the files it makes are lists of every item each rune/sigil is found in (including the rune/sigil itself)
'''

startTime = time.time()

# here I just wanted to time how long it takes to load the master item list; not necessary, obvs
mifStart = time.time()
# get the master item list v2
masterItemList = gw2lib.getMILv2()
mifEnd = time.time()
print 'mif make time:', mifEnd-mifStart, 'seconds'

# this returns a list of all superior runes and sigils
runeSigilObjs = gw2lib.getRuneSigilObjs(masterItemList)

# write all the names to a file; this is mainly just a sanity check
with open(gw2lib.searchFolderName+'allRuneSigilNames.txt', 'w') as namesFile:
    for x in runeSigilObjs:
        namesFile.write(x['name'] + '\n')

# save the objects to a file
with open(gw2lib.searchFolderName+'runesAndSigils.json', 'w') as allRSobjs:
    json.dump(runeSigilObjs, allRSobjs)