Moderator: diafero
if (event[0] == kPickedEvent):
objBookPicked = event[3]
bookName = objBookPicked.getName()
print 'psnlBookshelf.OnNotify():\tplayer picked book named ',
print bookName
try:
index = objLibrary.value.index(objBookPicked)
except:
print 'psnlBookshelf.OnNotify():\tERROR -- couldn\'t find ',
print objBookPicked,
print ' in objLibrary'
return
agename = self.IGetAgeFromBook()
### skipping code for special links...
link = self.IGetLinkFromBook() # <-- might be crashing here
if (type(link) == type(None)):
return
if ((link in xCustomReltoShelf.availableBooks) or link.getLocked()):
objLockPicked = objLocks.value[index]
lockName = objLockPicked.getName()
for (rkey, rvalue) in respOpenLock.byObject.items():
parent = rvalue.getParentKey()
if parent:
if (lockName == parent.getName()):
respOpenLock.run(self.key, objectName=rkey)
break
boolPresentAfterLockOpen = true
break
else:
bookName = objBookPicked.getName()
for (rkey, rvalue) in respPresentBook.byObject.items():
parent = rvalue.getParentKey()
if parent:
if (bookName == parent.getName()):
respPresentBook.run(self.key, objectName=rkey)
break
def IGetLinkFromBook(self, spTitle = None):
global SpawnPointName
ageName = self.IGetAgeFromBook()
print 'returns link element associated with global objBookPicked or None ',
print ageName
### skipping special links...
if (type(ageName) == type(None)):
print 'psnlBookshelf.IGetLinkFromBook():\tERROR -- conversion from book to link element failed'
return None
ageVault = ptAgeVault()
PAL = ageVault.getAgesIOwnFolder()
contents = PAL.getChildNodeRefList()
for content in contents:
link = content.getChild()
link = link.upcastToAgeLinkNode()
info = link.getAgeInfo()
if (info and (info.getAgeFilename() == ageName)):
print 'psnlBookshelf.IGetLinkFromBook():\tfound link',
print info.getAgeFilename()
return link
if (ageName in xCustomReltoShelf.availableBooks):
return ageName
print 'psnlBookshelf.IGetLinkFromBook():\tERROR -- couldn\'t find link to',
print ageName
return None
ageVault = ptAgeVault()
PAL = ageVault.getAgesIOwnFolder()
contents = PAL.getChildNodeRefList()
Users browsing this forum: No registered users and 0 guests