Poodletooth-iLand/toontown/dna/DNAParser.py

58 lines
1.5 KiB
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
from direct.stdpy import threading
2015-03-14 18:23:50 -05:00
from libpandadna import *
2015-03-03 16:10:12 -06:00
class DNABulkLoader:
def __init__(self, storage, files):
self.dnaStorage = storage
self.dnaFiles = files
def loadDNAFiles(self):
for file in self.dnaFiles:
print 'Reading DNA file...', file
loadDNABulk(self.dnaStorage, file)
del self.dnaStorage
del self.dnaFiles
def loadDNABulk(dnaStorage, file):
2015-03-14 18:23:50 -05:00
dnaLoader = DNALoader()
fileu = '../resources/' + file
2015-03-15 15:11:46 -05:00
fileo = 'resources/' + file
try:
dnaLoader.loadDNAFile(dnaStorage, fileu)
except:
dnaLoader.loadDNAFile(dnaStorage, fileo)
2015-03-03 16:10:12 -06:00
def loadDNAFile(dnaStorage, file):
print 'Reading DNA file...', file
2015-03-14 18:23:50 -05:00
dnaLoader = DNALoader()
fileu = '../resources/' + file
2015-03-15 15:11:46 -05:00
fileo = 'resources/' + file
try:
node = dnaLoader.loadDNAFile(dnaStorage, fileu)
except:
2015-03-15 15:36:32 -05:00
node = dnaLoader.loadDNAFile(dnaStorage, fileo)
2015-03-03 16:10:12 -06:00
if node.node().getNumChildren() > 0:
return node.node()
def loadDNAFileAI(dnaStorage, file):
2015-03-14 18:23:50 -05:00
dnaLoader = DNALoader()
fileu = '../resources/' + file
2015-03-15 15:11:46 -05:00
fileo = 'resources/' + file
try:
data = dnaLoader.loadDNAFileAI(dnaStorage, fileu)
except:
data = dnaLoader.loadDNAFileAI(dnaStorage, fileo)
2015-03-03 16:10:12 -06:00
return data
2015-03-14 18:23:50 -05:00
def setupDoor(a, b, c, d, e, f):
try:
e = int(str(e).split('_')[0])
except:
print 'setupDoor: error parsing', e
e = 9999
DNADoor.setupDoor(a, b, c, d, e, f)