Beispiel #1
0
 def OnNotify(self, state, id, events):
     global theBook
     boolLinkerIsMe = false
     if PtWasLocallyNotified(self.key):
         boolLinkerIsMe = true
     print ('philBookshelf.OnNotify(): state = %d, id = %d, me = %s' % (state, id, boolLinkerIsMe))
     if (id == actBookshelfExit.id):
         self.IDisengageShelf(boolLinkerIsMe)
         return
     if (id == SeekBehavior.id):
         for event in events:
             avatar = PtFindAvatar(events)
             if ((event[0] == kMultiStageEvent) and ((event[1] == 0) and (LocalAvatar == avatar))):
                 SeekBehavior.gotoStage(avatar, -1)
                 print 'philBookshelf.OnNotify():\tengaging bookshelf'
                 avatar.draw.disable()
                 virtCam = ptCamera()
                 virtCam.save(ShelfCamera.sceneobject.getKey())
                 PtAtTimeCallback(self.key, 0.10000000000000001, 1)
     if ((id == actBookshelf.id) and state):
         respMoveShelf.run(self.key, state='raise', fastforward=1)
         avatar = PtFindAvatar(events)
         if (LocalAvatar == avatar):
             PtSendKIMessage(kDisableKIandBB, 0)
             cam = ptCamera()
             cam.undoFirstPerson()
             cam.disableFirstPersonOverride()
             PtRecenterCamera()
             SeekBehavior.run(avatar)
             PtDisableMovementKeys()
     elif ((id == actBook.id) and state):
         actBook.disable()
         respPresentBook.run(self.key)
     elif ((id == respPresentBook.id) and boolLinkerIsMe):
         bookcode = '<font size=10><img src="xDRCBookRubberStamp2*1#0.hsm" pos=125,120 blend=alpha><pb><img src="xLinkPanelKirel*1#0.hsm" align=center link=0 blend=alpha>'
         theBook = ptBook(bookcode, self.key)
         theBook.setGUI('BkBook')
         theBook.setSize(1.0, 1.0)
         theBook.show(1)
     elif (id == respShelveBook.id):
         actBook.enable()
     else:
         for event in events:
             if (event[0] == PtEventType.kBook):
                 PtDebugPrint(('philBookshelf: BookNotify  event=%d, id=%d' % (event[1], event[2])))
                 if (event[1] == PtBookEventTypes.kNotifyImageLink):
                     if (event[2] >= 0):
                         PtDebugPrint(('philBookshelf:Book: hit linking panel %s' % event[2]))
                         theBook.hide()
                         self.IDisengageShelf(boolLinkerIsMe)
                         # BEGIN linking rule fix
                         #respLinkOut.run(self.key) # Cyan uses the wrong linking rule here
                         import xLinkMgr
                         xLinkMgr.LinkToAge('Neighborhood02', 'LinkInPointDefault')
                         # END linking rule fix
                 elif (event[1] == PtBookEventTypes.kNotifyHide):
                     PtDebugPrint('philBookshelf:Book: NotifyHide')
                     respShelveBook.run(self.key)
Beispiel #2
0
 def OnNotify(self, state, id, events):
     if (id == RespBlah.id):
         ageSDL = PtGetAgeSDL()
         ageSDL[SDLBlah.value] = (0, )
         vault = ptVault()
         entry = vault.findChronicleEntry('Blah')
         entry.chronicleSetValue(('%d' % 3))
         entry.save()
         print 'do link back to Kveer'
         import xLinkMgr
         xLinkMgr.LinkToAge('Kveer', 'LinkInPointDefault')
Beispiel #3
0
    def ILink(self):
        if destinationAge.value == "fakelink":
            print "Linking book: We're linking to the same Age. Using fakelink."
            if destinationObject:
                PtFakeLinkAvatarToObject(PtGetLocalAvatar().getKey(),
                                         destinationObject.getKey())
                PtFadeOut(1.5, 1)
                PtAtTimeCallback(self.key, 1.5, 1)
            else:
                PtSendKIMessage(
                    kKIOKDialogNoQuit,
                    "This Age does not have any object named %s." %
                    spawnPoint.value)

        else:
            print "Linking book: time to link !"
            # The link manager will display a message in case the age is not available :P
            if spawnPoint.value:
                xLinkMgr.LinkToAge(destinationAge.value, spawnPoint.value)
            else:
                xLinkMgr.LinkToAge(destinationAge.value)
 def OnNotify(self, state, id, events):
     if ((not (state)) or (id != actTrigger.id)):
         return
     if (not (PtWasLocallyNotified(self.key))):
         return
     actName = actTrigger.value[0].getSceneObject().getName()
     ageNames = {
         'clkPW_PortalDoor': 'PortalWell',
     }
     if actName in ageNames:
         xLinkMgr.LinkToAge(ageNames[actName], 'LinkInPointDefault')
     else:
         print 'Error: Unknown portal ' + actName
Beispiel #5
0
 def OnNotify(self, state, id, events):
     if ((not (state)) or (id != actTrigger.id)):
         return
     if (not (PtWasLocallyNotified(self.key))):
         return
     actName = actTrigger.value[0].getSceneObject().getName()
     ageNames = {
         'cClkCourtyardPortalBattle': 'Courtyard',
         'cClkForestPortalStep1': 'ForestMQ',
         'cClk-PortalWellStep1': 'PortalWell',
         'Clickable-PortalWellBattle': 'PortalWell',
     }
     if actName in ageNames:
         xLinkMgr.LinkToAge(ageNames[actName], 'LinkInPointDefault')
     else:
         print 'Error: Unknown portal ' + actName
Beispiel #6
0
 def OnNotify(self, state, id, events):
     global MyBlah
     if (id == RespBlah.id):
         if (MyBlah == 1):
             vault = ptVault()
             entry = vault.findChronicleEntry('Blah')
             entry.chronicleSetValue(('%d' % 2))
             entry.save()
             print 'do link to X2 finale version of ferry terminal'
             import xLinkMgr
             xLinkMgr.LinkToAge('DniCityX2Finale', 'LinkInPointBlah')
             return
         elif (MyBlah == 3):
             print 'end blah stuff'
             self.IFadeOutFromScreen()
             vault = ptVault()
             entry = vault.findChronicleEntry('Blah')
             entry.chronicleSetValue(('%d' % 4))
             entry.save()
         MyBlah = 0
     if (id == RespEndingScreen.id):
         pass
Beispiel #7
0
def dustlink(agename, spawnpoint):
    xLinkMgr.LinkToAge(agename, spawnpoint)
Beispiel #8
0
 def OnNotify(self, state, id, events):
     global inBookZone
     global respLightList
     global LocalAvatar
     global OfferedBookMode
     global BookOfferer
     global byteQuabs
     global occupiedZones
     global PlatesDone
     global CurrentPage
     global gLinkingBook
     global ClosedBookToShare
     global NoReenableBook
     ageSDL = PtGetAgeSDL()
     if (id == bookZone.id):
         for event in events:
             if (event[0] != 1):
                 return
             if (event[1] == 1):
                 inBookZone = (inBookZone + 1)
                 print 'yes, now in book zone'
                 if (respLightList != []):
                     RespClockLights.run(self.key,
                                         state='on',
                                         objectName=respLightList[0])
             else:
                 inBookZone = (inBookZone - 1)
                 print 'no longer in book zone'
                 if (respLightList != []):
                     RespClockLights.run(self.key,
                                         state='off',
                                         objectName=respLightList[0])
         return
     if (id == actClickableBook.id):
         if (PtWasLocallyNotified(self.key) and state):
             actClickableBook.disable()
             PtToggleAvatarClickability(false)
             if (type(SeekBehavior.value) != type(None)):
                 PtDebugPrint('ahnyLinkBookGUIPopup: Smart seek used',
                              level=kDebugDumpLevel)
                 LocalAvatar = PtFindAvatar(events)
                 SeekBehavior.run(LocalAvatar)
                 return
             self.IShowBookNoTreasure()
             OfferedBookMode = false
             BookOfferer = None
         return
     elif (id == SeekBehavior.id):
         if PtWasLocallyNotified(self.key):
             for event in events:
                 if ((event[0] == kMultiStageEvent)
                         and (event[2] == kEnterStage)):
                     SeekBehavior.gotoStage(LocalAvatar, -1)
                     PtDebugPrint(
                         'ahnyLinkBookGUIPopup: attempting to draw link panel gui',
                         level=kDebugDumpLevel)
                     self.IShowBookNoTreasure()
                     OfferedBookMode = false
                     BookOfferer = None
     else:
         for event in events:
             if (event[0] == kCollisionEvent):
                 if ((id != zones.id)
                         and ((id != bookZone.id) and (id != deadZone.id))):
                     return
                 if (id == deadZone.id):
                     avatar = PtGetLocalAvatar()
                     if (event[2] != avatar):
                         eventName = event[2].getName()
                         if (eventName == 'Quab'):
                             quabNum = (byteQuabs - 1)
                             if quabNum < 0: quabNum = 0
                             print 'quabNum now =',
                             print quabNum
                             ageSDL[SDLQuabs.value] = (quabNum, )
                     return
                 region = event[3]
                 regName = region.getName()
                 i = 0
                 for zone in zoneObjects.value:
                     zoneName = zone.getName()
                     if (zoneName == regName):
                         if (event[1] == 1):
                             occupiedZones[i] = 1
                             print 'occupied: ',
                             print zoneName
                             if (respLightList != []):
                                 RespClockLights.run(
                                     self.key,
                                     state='on',
                                     objectName=respLightList[i])
                         else:
                             occupiedZones[i] = 0
                             print 'NOT occupied: ',
                             print zoneName
                             if (respLightList != []):
                                 RespClockLights.run(
                                     self.key,
                                     state='off',
                                     objectName=respLightList[i])
                     i += 1
             elif (event[0] == PtEventType.kBook):
                 PtDebugPrint(
                     ('ahnyLinkBookGUIPopup: BookNotify  event=%d, id=%d' %
                      (event[1], event[2])),
                     level=kDebugDumpLevel)
                 if (event[1] == PtBookEventTypes.kNotifyImageLink):
                     if ((event[2] >= xLinkingBookDefs.kFirstLinkPanelID)
                             or (event[2] == xLinkingBookDefs.kBookMarkID)):
                         PtDebugPrint((
                             'ahnyLinkBookGUIPopup:Book: hit linking panel %s'
                             % event[2]),
                                      level=kDebugDumpLevel)
                         self.HideBook(1)
                         if (PlatesDone == 0):
                             # Ahnonay linking rule work-around BEGIN
                             import xLinkMgr
                             xLinkMgr.LinkToAge("Ahnonay",
                                                "LinkInPointDefault")
                             #respLinkResponder.run(self.key, avatar=PtGetLocalAvatar())
                             # Ahnonay linking rule work-around END
                             return
                         vault = ptVault()
                         myAges = vault.getAgesIOwnFolder()
                         myAges = myAges.getChildNodeRefList()
                         for ageInfo in myAges:
                             link = ageInfo.getChild()
                             link = link.upcastToAgeLinkNode()
                             info = link.getAgeInfo()
                             if (not (info)):
                                 continue
                             ageName = info.getAgeFilename()
                             spawnPoints = link.getSpawnPoints()
                             if (ageName == 'Ahnonay'):
                                 ahnySDL = info.getAgeSDL()
                                 ahnyRecord = ahnySDL.getStateDataRecord()
                                 currentSphere = ahnyRecord.findVar(
                                     'ahnyCurrentSphere')
                                 if (sphere.value == '1'):
                                     currentSphere.setInt(2, 0)
                                 elif (sphere.value == '2'):
                                     currentSphere.setInt(3, 0)
                                 elif (sphere.value == '3'):
                                     currentSphere.setInt(1, 0)
                                 elif (sphere.value == '4'):
                                     currentSphere.setInt(1, 0)
                                 else:
                                     print 'missing sphere identifier string!'
                                 ahnySDL.setStateDataRecord(ahnyRecord)
                                 ahnySDL.save()
                                 print 'advanced from sphere ',
                                 print sphere.value
                                 # Ahnonay linking rule work-around BEGIN
                                 import xLinkMgr
                                 xLinkMgr.LinkToAge("Ahnonay",
                                                    "LinkInPointDefault")
                                 #respLinkResponder.run(self.key, avatar=PtGetLocalAvatar())
                                 # Ahnonay linking rule work-around END
                                 return
                 elif (event[1] == PtBookEventTypes.kNotifyShow):
                     PtDebugPrint('ahnyLinkBookGUIPopup:Book: NotifyShow',
                                  level=kDebugDumpLevel)
                     PtSendKIMessage(kEnableKIandBB, 0)
                     if (CurrentPage > 1):
                         PtDebugPrint((
                             'ahnyLinkBookGUIPopup: going to page %d (ptBook page %d)'
                             % (CurrentPage, ((CurrentPage - 1) * 2))),
                                      level=kDebugDumpLevel)
                         gLinkingBook.goToPage(((CurrentPage - 1) * 2))
                 elif (event[1] == PtBookEventTypes.kNotifyHide):
                     PtDebugPrint('ahnyLinkBookGUIPopup:Book: NotifyHide',
                                  level=kDebugDumpLevel)
                     if (not (ClosedBookToShare)):
                         PtToggleAvatarClickability(true)
                         if (OfferedBookMode and BookOfferer):
                             avID = PtGetClientIDFromAvatarKey(
                                 BookOfferer.getKey())
                             PtNotifyOffererLinkRejected(avID)
                             PtDebugPrint(
                                 'ahnyLinkBookGUIPopup: rejected link, notifying offerer as such',
                                 level=kDebugDumpLevel)
                             OfferedBookMode = false
                             BookOfferer = None
                     if (not (NoReenableBook)):
                         actClickableBook.enable()
                     ClosedBookToShare = 0
                 elif (event[1] == PtBookEventTypes.kNotifyCheckUnchecked):
                     PtDebugPrint(
                         'ahnyLinkBookGUIPopup:Book: NotifyCheckUncheck',
                         level=kDebugDumpLevel)
Beispiel #9
0
 def OnNotify(self, state, id, events):
     global LocalAvatar
     global OfferedBookMode
     global BookOfferer
     global CurrentPage
     global gLinkingBook
     global ClosedBookToShare
     global NoReenableBook
     if (id == actClickableBook.id):
         if (PtWasLocallyNotified(self.key) and state):
             actClickableBook.disable()
             PtToggleAvatarClickability(false)
             if (type(SeekBehavior.value) != type(None)):
                 PtDebugPrint('ahnyLinkBookGUIPopup: Smart seek used',
                              level=kDebugDumpLevel)
                 LocalAvatar = PtFindAvatar(events)
                 SeekBehavior.run(LocalAvatar)
                 return
             self.IShowBookNoTreasure()
             OfferedBookMode = false
             BookOfferer = None
         return
     elif (id == SeekBehavior.id):
         if PtWasLocallyNotified(self.key):
             for event in events:
                 if ((event[0] == kMultiStageEvent)
                         and (event[2] == kEnterStage)):
                     SeekBehavior.gotoStage(LocalAvatar, -1)
                     PtDebugPrint(
                         'ahnyLinkBookGUIPopup: attempting to draw link panel gui',
                         level=kDebugDumpLevel)
                     self.IShowBookNoTreasure()
                     OfferedBookMode = false
                     BookOfferer = None
     else:
         for event in events:
             if (event[0] == PtEventType.kBook):
                 PtDebugPrint(
                     ('ahnyLinkBookGUIPopup: BookNotify  event=%d, id=%d' %
                      (event[1], event[2])),
                     level=kDebugDumpLevel)
                 if (event[1] == PtBookEventTypes.kNotifyImageLink):
                     if ((event[2] >= xLinkingBookDefs.kFirstLinkPanelID)
                             or (event[2] == xLinkingBookDefs.kBookMarkID)):
                         PtDebugPrint((
                             'ahnyLinkBookGUIPopup:Book: hit linking panel %s'
                             % event[2]),
                                      level=kDebugDumpLevel)
                         self.HideBook(1)
                         vault = ptVault()
                         myAges = vault.getAgesIOwnFolder()
                         myAges = myAges.getChildNodeRefList()
                         for ageInfo in myAges:
                             link = ageInfo.getChild()
                             link = link.upcastToAgeLinkNode()
                             info = link.getAgeInfo()
                             if (not (info)):
                                 continue
                             ageName = info.getAgeFilename()
                             spawnPoints = link.getSpawnPoints()
                             if (ageName == 'Ahnonay'):
                                 ahnySDL = info.getAgeSDL()
                                 ahnyRecord = ahnySDL.getStateDataRecord()
                                 currentSphere = ahnyRecord.findVar(
                                     'ahnyCurrentSphere')
                                 if (sphere.value == '1'):
                                     currentSphere.setInt(2, 0)
                                 elif (sphere.value == '2'):
                                     currentSphere.setInt(3, 0)
                                 elif (sphere.value == '3'):
                                     currentSphere.setInt(4, 0)
                                 elif (sphere.value == '4'):
                                     currentSphere.setInt(1, 0)
                                 else:
                                     print 'missing sphere identifier string!'
                                 ahnySDL.setStateDataRecord(ahnyRecord)
                                 ahnySDL.save()
                                 print 'advanced from sphere ',
                                 print sphere.value
                                 # Ahnonay linking rule work-around BEGIN
                                 import xLinkMgr
                                 xLinkMgr.LinkToAge("Ahnonay",
                                                    "LinkInPointDefault")
                                 #respLinkResponder.run(self.key, avatar=PtGetLocalAvatar())
                                 # Ahnonay linking rule work-around END
                                 return
                 elif (event[1] == PtBookEventTypes.kNotifyShow):
                     PtDebugPrint('ahnyLinkBookGUIPopup:Book: NotifyShow',
                                  level=kDebugDumpLevel)
                     PtSendKIMessage(kEnableKIandBB, 0)
                     if (CurrentPage > 1):
                         PtDebugPrint((
                             'ahnyLinkBookGUIPopup: going to page %d (ptBook page %d)'
                             % (CurrentPage, ((CurrentPage - 1) * 2))),
                                      level=kDebugDumpLevel)
                         gLinkingBook.goToPage(((CurrentPage - 1) * 2))
                 elif (event[1] == PtBookEventTypes.kNotifyHide):
                     PtDebugPrint('ahnyLinkBookGUIPopup:Book: NotifyHide',
                                  level=kDebugDumpLevel)
                     if (not (ClosedBookToShare)):
                         PtToggleAvatarClickability(true)
                         if (OfferedBookMode and BookOfferer):
                             avID = PtGetClientIDFromAvatarKey(
                                 BookOfferer.getKey())
                             PtNotifyOffererLinkRejected(avID)
                             PtDebugPrint(
                                 'ahnyLinkBookGUIPopup: rejected link, notifying offerer as such',
                                 level=kDebugDumpLevel)
                             OfferedBookMode = false
                             BookOfferer = None
                     if (not (NoReenableBook)):
                         actClickableBook.enable()
                     ClosedBookToShare = 0
                 elif (event[1] == PtBookEventTypes.kNotifyCheckUnchecked):
                     PtDebugPrint(
                         'ahnyLinkBookGUIPopup:Book: NotifyCheckUncheck',
                         level=kDebugDumpLevel)
Beispiel #10
0
def LinkToAge(agename, spawnpoint):
    #Use the OfflineKI for Pots/Alcugs:
    import xLinkMgr
    xLinkMgr.LinkToAge(agename,spawnpoint)
Beispiel #11
0
 def linkToAge(self, ageName, spawnPoint):
     xLinkMgr.LinkToAge(ageName, spawnPoint)
Beispiel #12
0
 def clicked(self):
     xLinkMgr.LinkToAge(self.age, self.spawnpoint)
Beispiel #13
0
 def IlinkToAge(self, bookPage, ageName, spawnPoint, spTitle, linkRule):
     import xLinkMgr
     xLinkMgr.LinkToAge(ageName, spawnPoint)
     print(
         'Linking to age %s, spawnpoint %s with title %s, using linkingrule %d'
         % (ageName, spawnPoint, spTitle, linkRule))
Beispiel #14
0
 def OnNotify(self, state, id, events):
     global baton
     ageSDL = PtGetAgeSDL()
     if PtWasLocallyNotified(self.key) and ((id >= 1) and (id <= 9)):
         print '##'
         for event in events:
             if (event[0] == 7):
                 break
             if (event[1] == 1):
                 print 'rstrShellPath: Entered Zone:',
                 print id
                 if (id == 1):
                     baton = 1
                 elif (id == (baton + 1)):
                     baton = (baton + 1)
                     if (baton == 9):
                         # Ahnonay, Myst and Kveer linking rule work-around BEGIN
                         import xLinkMgr
                         xLinkMgr.LinkToAge("Myst", "LinkInPointDefault")
                         #respLink.run(self.key, events=events)
                         # Ahnonay, Myst and Kveer linking rule work-around END
                         print 'rstrShellPath: Puzzle solved.'
                 elif (baton != 0):
                     baton = 0
                     print 'Baton dropped. \n'
             elif (event[1] == 0):
                 print 'rstrShellPath: Exited Zone:',
                 print id
                 if ((baton != 0) and (baton != (id + 1))):
                     print 'rstrShellPath: Dropped the baton.'
                     baton = 0
         if (baton > 0):
             print 'Baton value is now:',
             print baton
     elif (id == actResetBtn.id):
         respResetBtn.run(self.key, events=events)
     elif (id == respResetBtn.id):
         print 'rstrShellPath: The reset button in the Tree was just touched by the avatar.'
         if (ageSDL['boolTreeDayLights'][0] == 1):
             print '\tSince it was previously on, turning OFF Tree Day Cycle.'
             ageSDL.setTagString('boolTreeDayLights', 'ResetButtonInTree')
             ageSDL['boolTreeDayLights'] = (0, )
         if (ageSDL['boolBridgeExtended'][0] == 1):
             print '\tToggling the bridge to the Retracted position.'
             ageSDL.setTagString('boolBridgeExtended', 'ResetButtonInTree')
             ageSDL['boolBridgeExtended'] = (0, )
         else:
             print '\tToggling the bridge to the Extended position.'
             ageSDL.setTagString('boolBridgeExtended', 'ResetButtonInTree')
             ageSDL['boolBridgeExtended'] = (1, )
         if (ageSDL['boolSwitchAUp'][0] == 1):
             print '\tToggling SwitchA to the DOWN position.'
             ageSDL.setTagString('boolSwitchAUp', 'ResetButtonInTree')
             ageSDL['boolSwitchAUp'] = (0, )
         else:
             print '\tToggling SwitchA to the UP position.'
             ageSDL.setTagString('boolSwitchAUp', 'ResetButtonInTree')
             ageSDL['boolSwitchAUp'] = (1, )
         if (ageSDL['boolLadderRevealed'][0] == 1):
             print '\tToggling the ladder to the Concealed position.'
             ageSDL.setTagString('boolLadderRevealed', 'ResetButtonInTree')
             ageSDL['boolLadderRevealed'] = (0, )
         else:
             print '\tToggling the ladder to the Revealed position.'
             ageSDL.setTagString('boolLadderRevealed', 'ResetButtonInTree')
             ageSDL['boolLadderRevealed'] = (1, )