def LinkOut(self):
        polesInPsnl = 0
        updateAgeList = []

        psnlSDL = xPsnlVaultSDL()
        
        for age in ["Teledahn", "Garrison", "Garden", "Kadish"]:
            agevar = age + "PoleState"
            sdlval = psnlSDL[agevar][0]
            if sdlval == 4 and age != self.ageFrom:
                polesInPsnl += 1
                updateAgeList.append( (agevar, (5,)) )
            elif sdlval == 3 and age == self.ageFrom:
                if int(self.GetAgeVariable(self.ageFrom, "YeeshaSpeech")) == 0:
                    self.SetAgeVariable(self.ageFrom, "YeeshaSpeech", self.UseYeeshaSpeech)

        if polesInPsnl == 3 and psnlSDL[self.ageFrom + "PoleState"][0] == 3:
            psnlSDL.BatchSet(updateAgeList)
            #for age in updateAgeList:
            #    self.SetState(age, 5)

        #PtSendKIMessage(kEnableYeeshaBook,0)

        if self.IsStarfield:
            respLinkOut.run(self.key, state = "starfield")
        else:
            respLinkOut.run(self.key, state = "cavern")
Exemple #2
0
 def IDoCityLinksChron(self,agePanel):
     CityLinks = []
     vault = ptVault()
     entryCityLinks = vault.findChronicleEntry("CityBookLinks")
     if type(entryCityLinks) != type(None):
         valCityLinks = entryCityLinks.chronicleGetValue()
         print "valCityLinks = ",valCityLinks
         CityLinks = valCityLinks.split(",")
         print "CityLinks = ",CityLinks
         if agePanel not in CityLinks:
             NewLinks = valCityLinks + "," + agePanel
             entryCityLinks.chronicleSetValue(NewLinks)
             entryCityLinks.save()
             print "xLinkingBookGUIPopup.IDoCityLinksChron():  setting citylinks chron entry to include: ",agePanel
             valCityLinks = entryCityLinks.chronicleGetValue()
             CityLinks = valCityLinks.split(",")
             print "xLinkingBookGUIPopup.IDoCityLinksChron():  citylinks now = ",CityLinks
         else:
             print "xLinkingBookGUIPopup.IDoCityLinksChron():  do nothing, citylinks chron already contains: ",agePanel
     else:
         vault.addChronicleEntry("CityBookLinks",0,agePanel)
         print "xLinkingBookGUIPopup.IDoCityLinksChron():  creating citylinks chron entry and adding: ",agePanel
     
     psnlSDL = xPsnlVaultSDL()
     GotBook = psnlSDL["psnlGotCityBook"][0]
     if not GotBook:
         psnlSDL["psnlGotCityBook"] = (1,)
         print "xLinkingBookGUIPopup.IDoCityLinksChron():  setting SDL for city book to 1"
def FilterAgeName(ageName):
    # Many age instance names without a possessive component have a spurious
    # apostrophe at the end of the name. Let's correct that before we do anything
    if ageName.endswith("'"):
        ageName = ageName[:-1]

    # Replace file names with display names - only once, from the right.
    # This fixes a bug in which avatars' names containing words like Garden
    # incorrectly get replaced.
    for Age, replacement in kAges.Replace.iteritems():
        # Only replace if the replacement is not already in there...
        # Otherwise we wend up with junk like "Eder Eder Gira"
        if ageName.find(replacement) == -1:
            ageNameList = ageName.rsplit(Age, 1)
            ageName = replacement.join(ageNameList)

    # Find the appropriate display name.
    if ageName == "???" or ageName == "BahroCave":
        sdl = xPsnlVaultSDL()
        if sdl["TeledahnPoleState"][0] > 5 or sdl["KadishPoleState"][0] > 5 or sdl["GardenPoleState"][0] > 5 or sdl["GarrisonPoleState"][0] > 5:
            ageName = "D'ni-Rudenna"
        else:
            ageName = "Unknown"
    elif ageName in kAges.Hide:
        ageName = "Unknown"
    else:
        for Age in kAges.Display:
            if Age.lower() == ageName.lower():
                ageName = kAges.Display[Age]
                break

    ageName = ageName.replace("(null)", "").strip()
    return ageName
    def OnServerInitComplete(self):
        psnlSDL = xPsnlVaultSDL()
        print psnlSDL["psnlBahroWedge11"][0]

        if psnlSDL["psnlBahroWedge11"][0]:
            print "bhroBahroMink.OnServerInitComplete: You have the Minkata wedge, no need to display it."
            respRing.run(self.key, fastforward=1)
    def ValidityCheck(self):
        print "psnlBahroPoles.ValidityCheck()"
        self.UpdateToState2()
        freq = self.GetStateFrequencyList()

        # handle if someone left while poles going up or while last pole is going down
        if (freq[5] == 3 and freq[4] == 1) or (freq[5] > 0 and (freq[6] > 0 or freq[7] > 0 or freq[8] > 0 or freq[9] > 0)):
            if self.Poles["Teledahn"]["State"] < 6:
                self.SetCurrentState("Teledahn", 6)
                PtDebugPrint("DEBUG:psnlBahroPoles.ValidityCheck:  fixed bad teledahn state")
                
            if self.Poles["Garrison"]["State"] < 6:
                self.SetCurrentState("Garrison", 6)
                PtDebugPrint("DEBUG:psnlBahroPoles.ValidityCheck:  fixed bad garrison state")

            if self.Poles["Garden"]["State"] < 6:
                self.SetCurrentState("Garden", 6)
                PtDebugPrint("DEBUG:psnlBahroPoles.ValidityCheck:  fixed bad garden state")
                
            if self.Poles["Kadish"]["State"] < 6:
                self.SetCurrentState("Kadish", 6)
                PtDebugPrint("DEBUG:psnlBahroPoles.ValidityCheck:  fixed bad kadish state")
        elif freq[4] == 4 or freq[5] == 4:
            sdl = xPsnlVaultSDL(1)
            sdl.BatchSet( [("TeledahnPoleState", (6,)), ("KadishPoleState", (6,)), ("GarrisonPoleState", (6,)), ("GardenPoleState", (6,))] )
 def Initialize(self):
     global AgeStartedIn
     global boolCalStar
     if (AgeStartedIn == PtGetAgeName()):
         if (not (len(PtGetPlayerList()))):
             import time
             dnitime = PtGetDniTime()
             monthNum = int(time.strftime('%m', time.gmtime(dnitime)))
             sparkNum = int(sdlCalStar.value[-2:])
             sdlName = sdlVars[sparkNum]
             sdl = PtGetAgeSDL()
             sdl.setFlags(sdlName, 1, 1)
             sdl.sendToClients(sdlName)
             if (monthNum == sparkNum):
                 sdl.setIndex(sdlName, 0, 1)
                 PtDebugPrint(('xCalendarStar: Current month is %d, sparkly is %d - enabling' % (monthNum, sparkNum)))
             else:
                 sdl.setIndex(sdlName, 0, 0)
                 PtDebugPrint(('xCalendarStar: Current month is %d, sparkly is %d - disabling' % (monthNum, sparkNum)))
         psnlSDL = xPsnlVaultSDL()
         try:
             boolCalStar = psnlSDL[sdlCalStar.value][0]
         except:
             PtDebugPrint('ERROR: xCalendarStar.Initialize():\tERROR reading age SDL')
         PtDebugPrint(('DEBUG: xCalendarStar.Initialize():\t%s = %d' % (sdlCalStar.value, boolCalStar)))
    def OnNotify(self,state,id,events):
        PtDebugPrint("xCalendarStar.OnNotify(): state = %d, id = %d" % (state,id))
        global boolCalStar

        if not state or id != rgnCalStar.id:
            return
        #if not PtWasLocallyNotified(self.key):
        if PtFindAvatar(events) != PtGetLocalAvatar():
            PtDebugPrint("DEBUG: xCalendarStar.OnNotify():\t received notify from non-local player, ignoring...")
            return
        else:
            PtDebugPrint("DEBUG: xCalendarStar.OnNotify():\t local player requesting %s change via %s" % (sdlCalStar.value,rgnCalStar.value[0].getName()) )

        if not self.GotPage():
            print "xCalendarStar.OnNotify(): do NOT have YeeshaPage20 (the Calendar Pinnacle) yet"
            return            
        else:
            print "xCalendarStar.OnNotify():  have YeeshaPage20 (the Calendar Pinnacle)"

            if AgeStartedIn == PtGetAgeName():
                psnlSDL = xPsnlVaultSDL()
            if not boolCalStar:
                print "xCalendarStar.OnNotify(): getting star's stone: ",sdlCalStar.value
                psnlSDL[sdlCalStar.value] = (1,)
                respCalStar.run(self.key)
                boolCalStar = 1
                PtSendKIMessageInt(kStartBookAlert,0)
            else:
                print "xCalendarStar.OnNotify(): already have the stone: ",sdlCalStar.value
    def OnBackdoorMsg(self, target, param):
        if target == "kill":
            respKillSpeeches.run(self.key, state=param)
            self.currentYS = "b"

        elif target == "wedgetoggle":
            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()
            if ageName == "Personal":
                psnlSDL = xPsnlVaultSDL(1)
            else:
                psnlSDL = xPsnlVaultSDL(0)

            if param == "Garrison":
                sdlName = "psnlBahroWedge01"
            elif (param == "Garden") or (param == "Gira"):
                param = "Garden"
                sdlName = "psnlBahroWedge02"
            elif param == "Kadish":
                sdlName = "psnlBahroWedge03"
            elif param == "Teledahn":
                sdlName = "psnlBahroWedge04"
            else:
                print "bhroBahroYeeshaCave.OnBackdoorMsg():  ERROR.  Incorrect age specified, no wedge will be set"
                return

            sdlVal = psnlSDL[sdlName][0]
            if sdlVal:
                print "bhroBahroYeeshaCave.OnBackdoorMsg():  previous age was %s, turning wedge SDL of %s to OFF" % (
                    param,
                    sdlName,
                )
                psnlSDL[sdlName] = (0,)
            else:
                print "bhroBahroYeeshaCave.OnBackdoorMsg():  previous age was %s, turning wedge SDL of %s to ON" % (
                    param,
                    sdlName,
                )
                psnlSDL[sdlName] = (1,)
    def IsJCProgressComplete(self):
        sdl = xPsnlVaultSDL(1)
        val = sdl["CleftVisited"][0]

        if val:
            return 1
        else:
            return 0
    def OnNotify(self,state,id,events):
        #print "bhroBahroMink.OnNotify: state=%s id=%d events=" % (state, id), events

        if id == clickable.id and not state:
            print "bhroBahroMink.OnNotify: clicked Minkata Spiral"
            respRing.run(self.key, avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge11"][0]
            if not sdlVal:
                print "bhroBahroMink.OnNotify:  Turning wedge SDL of psnlBahroWedge11 to On"
                psnlSDL["psnlBahroWedge11"] = (1,)
    def OnNotify(self,state,id,events):
        #print "bhroBahroPOTS.OnNotify: state=%s id=%d events=" % (state, id), events

        if id == clkErcana.id and state:
            print "bhroBahroPOTS.OnNotify: clicked Ercana symbol"
            respErcanaRing.run(self.key, avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge12"][0]
            if not sdlVal:
                print "bhroBahroPOTS.OnNotify:  Turning wedge SDL of psnlBahroWedge12 to On"
                psnlSDL["psnlBahroWedge12"] = (1,)

        elif id == clkAhnonay.id and state:
            print "bhroBahroPOTS.OnNotify: clicked Ahnonay symbol"
            respAhnonayRing.run(self.key, avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge13"][0]
            if not sdlVal:
                print "bhroBahroPOTS.OnNotify:  Turning wedge SDL of psnlBahroWedge13 to On"
                psnlSDL["psnlBahroWedge13"] = (1,)
    def OnNotify(self,state,id,events):
        #print "bhroBahroBlueSpiral.OnNotify: state=%s id=%d events=" % (state, id), events

        if id == clkBSTsogal.id and not state:
            print "bhroBahroBlueSpiral.OnNotify: clicked Tsogal Spiral"
            respRings.run(self.key, state="Tsogal", avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge06"][0]
            if not sdlVal:
                print "bhroBahroBlueSpiral.OnNotify:  Tturning wedge SDL of psnlBahroWedge06 to On"
                psnlSDL["psnlBahroWedge06"] = (1,)

        elif id == clkBSDelin.id and not state:
            print "bhroBahroBlueSpiral.OnNotify: clicked Delin Spiral"
            respRings.run(self.key, state="Delin", avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge05"][0]
            if not sdlVal:
                print "bhroBahroBlueSpiral.OnNotify:  Tturning wedge SDL of psnlBahroWedge05 to On"
                psnlSDL["psnlBahroWedge05"] = (1,)
    def OnServerInitComplete(self):
        global boolCalStar

        if not boolFirstUpdate.value:
            if AgeStartedIn == PtGetAgeName():
                psnlSDL = xPsnlVaultSDL()
                try:
                    boolCalStar = psnlSDL[sdlCalStar.value][0]
                except:
                    PtDebugPrint("ERROR: xCalendarStar.OnServerInitComplete():\tERROR reading age SDL")
                    pass
                PtDebugPrint("DEBUG: xCalendarStar.OnServerInitComplete():\t%s = %d" % (sdlCalStar.value,boolCalStar) )
 def OnSDLNotify(self,VARname,SDLname,playerID,tag):        
     if VARname != stringVarName.value:
         return
     ageSDL = xPsnlVaultSDL(1)
     #PtDebugPrint("Received SDLNotify on %s" % self.sceneobject.getName())
     try:
         if not (ageSDL[stringVarName.value][0] ^ boolShowOnTrue.value):
             self.EnableObject()
         else:
             self.DisableObject()
     except:
         PtDebugPrint("ERROR: psnlVaultSDLBoolShowHide.OnServerInitComplete():\tERROR reading age SDL on %s" % self.sceneobject.getName())
         pass
 def GotPage(self):
     vault = ptVault()
     if type(vault) != type(None): #is the Vault online?
         psnlSDL = xPsnlVaultSDL()
         psnlSDL = vault.getPsnlAgeSDL()
         if psnlSDL:
             ypageSDL = psnlSDL.findVar("YeeshaPage20")
             if ypageSDL:
                 size, state = divmod(ypageSDL.getInt(), 10)
                 print "YeeshaPage20 = ",state
                 if state:
                     return 1
         return 0
    def OnNotify(self,state,id,events):
        #print "bhroBahroPod.OnNotify: state=%s id=%d events=" % (state, id), events

        if id == clkNegilahn.id and not state:
            print "bhroBahroPod.OnNotify: clicked Negilahn Spiral"
            respNegilahnRing.run(self.key, avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge07"][0]
            if not sdlVal:
                print "bhroBahroPod.OnNotify:  Turning wedge SDL of psnlBahroWedge07 to On"
                psnlSDL["psnlBahroWedge07"] = (1,)

        elif id == clkDereno.id and not state:
            print "bhroBahroPod.OnNotify: clicked Dereno Spiral"
            respDerenoRing.run(self.key, avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge08"][0]
            if not sdlVal:
                print "bhroBahroPod.OnNotify:  Turning wedge SDL of psnlBahroWedge08 to On"
                psnlSDL["psnlBahroWedge08"] = (1,)

        elif id == clkPayiferen.id and not state:
            print "bhroBahroPod.OnNotify: clicked Payiferen Spiral"
            respPayiferenRing.run(self.key, avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge09"][0]
            if not sdlVal:
                print "bhroBahroPod.OnNotify:  Turning wedge SDL of psnlBahroWedge09 to On"
                psnlSDL["psnlBahroWedge09"] = (1,)

        elif id == clkTetsonot.id and not state:
            print "bhroBahroPod.OnNotify: clicked Tetsonot Spiral"
            respTetsonotRing.run(self.key, avatar=PtFindAvatar(events))
            psnlSDL = xPsnlVaultSDL()
            sdlVal = psnlSDL["psnlBahroWedge10"][0]
            if not sdlVal:
                print "bhroBahroPod.OnNotify:  Turning wedge SDL of psnlBahroWedge10 to On"
                psnlSDL["psnlBahroWedge10"] = (1,)
 def OnServerInitComplete(self):
     if not boolFirstUpdate.value:
         try:
             ageSDL = xPsnlVaultSDL(1)
             if type(stringVarName.value) == type("") and stringVarName.value != "":
                 if not (ageSDL[stringVarName.value][0] ^ boolShowOnTrue.value):
                     self.EnableObject()
                 else:
                     self.DisableObject()
             else:
                 PtDebugPrint("ERROR: psnlVaultSDLBoolShowHide.OnServerInitComplete():\tERROR: missing SDL var name on %s" % self.sceneobject.getName())
                 self.runDefault()
         except:
             self.runDefault()
    def OnServerInitComplete(self):
        # if the age is not the one that I'm from then run the responder to make it back off
        ageFrom = PtGetPrevAgeName()
        print "bhroBahroBlueSpiral.OnServerInitComplete: Came from %s, running opposite responder state" % (ageFrom)
        if ageFrom == "EderTsogal":
            respWedges.run(self.key, state="Delin", fastforward=1)

        elif ageFrom == "EderDelin":
            respWedges.run(self.key, state="Tsogal", fastforward=1)

        psnlSDL = xPsnlVaultSDL()
        if psnlSDL["psnlBahroWedge05"][0]:
            respRings.run(self.key, state="Delin", fastforward=1)
        if psnlSDL["psnlBahroWedge06"][0]:
            respRings.run(self.key, state="Tsogal", fastforward=1)
 def OnNotify(self, state, id, events):
     if id == rgnCalStar.id and state:
         if PtFindAvatar(events) != PtGetLocalAvatar():
             return
         psnl = xPsnlVaultSDL()
         if not psnl[sdlCalStar.value][0]:
             if not self._have_calendar_page:
                 PtDebugPrint("xCalendarStar.OnNotify():\tYou don't have YP20, fool!", level=kWarningLevel)
                 return
             respCalStar.run(self.key)
             psnl[sdlCalStar.value] = (True,)
             PtSendKIMessageInt(kStartBookAlert, 0)
             PtDebugPrint("xCalendarStar.OnNotify():\tCongrats, you got a sparklie!", level=kWarningLevel)
             return
         else:
             PtDebugPrint("xCalendarStar.OnNotify():\tYou already have this sparklie!", level=kWarningLevel)
 def IFinishInit(self):
     try:
         ageSDL = xPsnlVaultSDL(1)
         if type(stringVarName.value) == type("") and stringVarName.value != "":
             if ageSDL[stringVarName.value][0]:
                 PtDebugPrint("DEBUG: psnlVaultSDLBoolRespond.IFinishInit():\tRunning true responder on %s, fastforward=%d" % (self.sceneobject.getName(), boolFFOnInit.value))
                 respBoolTrue.run(self.key,fastforward=boolFFOnInit.value)
             else:
                 PtDebugPrint("DEBUG: psnlVaultSDLBoolRespond.IFinishInit():\tRunning false responder on %s, fastforward=%d" % (self.sceneobject.getName(), boolFFOnInit.value))
                 respBoolFalse.run(self.key,fastforward=boolFFOnInit.value)
         else:
             PtDebugPrint("ERROR: psnlVaultSDLBoolRespond.IFinishInit():\tERROR: missing SDL var name")
             self.runDefault()
             pass
     except:
         self.runDefault()
    def OnServerInitComplete(self):
        sdl = xPsnlVaultSDL()

        if sdl["TeledahnPoleState"][0] > 5 or sdl["KadishPoleState"][0] > 5 or sdl["GardenPoleState"][0] > 5 or sdl["GarrisonPoleState"][0] > 5:
            # we want to draw the cavern
            if boolCavernObj.value:
                #self.EnableObject()
                pass
            else:
                self.DisableObject()
        else:
            # we want to draw the starfield
            if boolCavernObj.value:
                self.DisableObject()
            else:
                #self.EnableObject()
                pass
    def UpdatePoleStates(self):
        print "psnlBahroPoles.UpdatePoleStates()"
        try:
            #ageSDL = PtGetAgeSDL()
            ageSDL = xPsnlVaultSDL(1)

            if type(ageSDL) != type(None):
                sdllist = ageSDL.BatchGet( ["TeledahnPoleState", "GardenPoleState", "GarrisonPoleState", "KadishPoleState"] )
                self.Poles["Teledahn"]["State"] = sdllist["TeledahnPoleState"]
                self.Poles["Garden"]["State"] = sdllist["GardenPoleState"]
                self.Poles["Garrison"]["State"] = sdllist["GarrisonPoleState"]
                self.Poles["Kadish"]["State"] = sdllist["KadishPoleState"]
            else:
                PtDebugPrint("ERROR: psnlBahroPoles.UpdatePoleStates():\tProblem trying to access age SDL")
                pass
            
        except:
            PtDebugPrint("ERROR: psnlBahroPoles.UpdatePoleStates():\tException occurred trying to access age SDL")
    def OnFirstUpdate(self):
        global AgeStartedIn
        global boolCalStar

        AgeStartedIn = PtGetAgeName()
        if not (type(sdlCalStar.value) == type("") and sdlCalStar.value != ""):
            PtDebugPrint("ERROR: xCalendarStar.OnFirstUpdate():\tERROR: missing SDL var name")
            pass

        if boolFirstUpdate.value:
            if AgeStartedIn == PtGetAgeName():
                psnlSDL = xPsnlVaultSDL()
                try:
                    boolCalStar = psnlSDL[sdlCalStar.value][0]
                except:
                    PtDebugPrint("ERROR: xCalendarStar.OnFirstUpdate():\tERROR reading age SDL")
                    pass
                PtDebugPrint("DEBUG: xCalendarStar.OnFirstUpdate():\t%s = %d" % (sdlCalStar.value,boolCalStar) )
    def OnServerInitComplete(self):
        # if the age is not the one that I'm from then run the responder to make it back off
        ageFrom = PtGetPrevAgeName()
        print "bhroBahroPOTS.OnServerInitComplete: Came from %s, running opposite responder state" % (ageFrom)
        if ageFrom == "Ercana":
            respWedges.run(self.key, state="Ahnonay", fastforward=1)
        elif ageFrom == "Ahnonay":
            respWedges.run(self.key, state="Ercana", fastforward=1)

        psnlSDL = xPsnlVaultSDL()
        print psnlSDL["psnlBahroWedge12"][0]
        print psnlSDL["psnlBahroWedge13"][0]

        if psnlSDL["psnlBahroWedge12"][0]:
            print "bhroBahroPOTS.OnServerInitComplete: You have the Ercana wedge, no need to display it."
            respErcanaRing.run(self.key, fastforward=1)
        if psnlSDL["psnlBahroWedge13"][0]:
            print "bhroBahroPOTS.OnServerInitComplete: You have the Ahnonay wedge, no need to display it."
            respAhnonayRing.run(self.key, fastforward=1)
    def DoWedge(self):
        psnlSDL = xPsnlVaultSDL()

        if self.ageFrom == "Garrison":
            sdlName = "psnlBahroWedge01"
        elif self.ageFrom == "Garden":
            sdlName = "psnlBahroWedge02"
        elif self.ageFrom == "Kadish":
            sdlName = "psnlBahroWedge03"
        elif self.ageFrom == "Teledahn":
            sdlName = "psnlBahroWedge04"
        else:
            print "bhroBahroYeeshaCave.DoWedge():  ERROR.  Didn't recognize previous age name, no wedge will be set"
            return

        sdlVal = psnlSDL[sdlName][0]
        if not sdlVal:
            print "bhroBahroYeeshaCave.DoWedge():  previous age was %s, turning wedge SDL of %s to On" % (self.ageFrom,sdlName)
            psnlSDL[sdlName] = (1,)
    def OnServerInitComplete(self):
        # if the age is not the one that I'm from then run the responder to make it back off
        ageFrom = PtGetPrevAgeName()
        print "bhroBahroPod.OnServerInitComplete: Came from %s, running opposite responder state" % (ageFrom)
        if ageFrom == "Negilahn":
            respWedges.run(self.key, state="Dereno", fastforward=1)
            respWedges.run(self.key, state="Payiferen", fastforward=1)
            respWedges.run(self.key, state="Tetsonot", fastforward=1)

        elif ageFrom == "Dereno":
            respWedges.run(self.key, state="Negilahn", fastforward=1)
            respWedges.run(self.key, state="Payiferen", fastforward=1)
            respWedges.run(self.key, state="Tetsonot", fastforward=1)

        elif ageFrom == "Payiferen":
            respWedges.run(self.key, state="Negilahn", fastforward=1)
            respWedges.run(self.key, state="Dereno", fastforward=1)
            respWedges.run(self.key, state="Tetsonot", fastforward=1)

        elif ageFrom == "Tetsonot":
            respWedges.run(self.key, state="Negilahn", fastforward=1)
            respWedges.run(self.key, state="Dereno", fastforward=1)
            respWedges.run(self.key, state="Payiferen", fastforward=1)

        psnlSDL = xPsnlVaultSDL()
        print psnlSDL["psnlBahroWedge07"][0]
        print psnlSDL["psnlBahroWedge08"][0]
        print psnlSDL["psnlBahroWedge09"][0]
        print psnlSDL["psnlBahroWedge10"][0]

        if psnlSDL["psnlBahroWedge07"][0]:
            print "bhroBahroPod.OnServerInitComplete: You have the Negilahn wedge, no need to display it."
            respNegilahnRing.run(self.key, fastforward=1)
        if psnlSDL["psnlBahroWedge08"][0]:
            print "bhroBahroPod.OnServerInitComplete: You have the Dereno wedge, no need to display it."
            respDerenoRing.run(self.key, fastforward=1)
        if psnlSDL["psnlBahroWedge09"][0]:
            print "bhroBahroPod.OnServerInitComplete: You have the Payiferen wedge, no need to display it."
            respPayiferenRing.run(self.key, fastforward=1)
        if psnlSDL["psnlBahroWedge10"][0]:
            print "bhroBahroPod.OnServerInitComplete: You have the Tetsonot wedge, no need to display it."
            respTetsonotRing.run(self.key, fastforward=1)
def GetAgeName(ageInfo=None):
    ageLink = ptNetLinkingMgr().getCurrAgeLink()
    if not ageLink:
        return "?UNKNOWN?"
    ageInfo = ageLink.getAgeInfo()
    if not ageInfo:
        return "?UNKNOWN?"

    if ageInfo.getAgeFilename() == "BahroCave":
        sdl = xPsnlVaultSDL()
        if sdl["TeledahnPoleState"][0] > 5 or sdl["KadishPoleState"][0] > 5 or sdl["GardenPoleState"][0] > 5 or sdl["GarrisonPoleState"][0] > 5:
            return "D'ni-Rudenna"

    if ageInfo.getAgeFilename() in kAges.Hide:
        return "Unknown"

    if ageInfo.getAgeFilename() in kAges.Display:
        return kAges.Display[ageInfo.getAgeFilename()]

    localizeName = ageInfo.getDisplayName()
    return FilterAgeName(xLocTools.LocalizeAgeName(localizeName))
Exemple #28
0
def tct():
    # recherche de l'entree de chronique "TomahnaLoad" dans ma voute
    vault = ptVault()
    entry = vault.findChronicleEntry("TomahnaLoad")
    # si elle n'existe pas, la creer. ce doit etre un ptVaultNode of type kNodeTypeChronicle
    # et on la met a "yes"
    if entry is None:
        sdl = xPsnlVaultSDL()
        sdl["CleftVisited"] = (1,)
        vault.addChronicleEntry("TomahnaLoad",1,"yes")
        PtDebugPrint("Chronicle entry TomahnaLoad not present, adding entry and setting to yes")
    else:
        entryTomahnaValue = entry.chronicleGetValue()
        if entryTomahnaValue == "yes":
            entry.chronicleSetValue("no")
            entry.save()
            PtDebugPrint("Chronicle entry TomahnaLoad already added, setting to no")
        else:
            entry.chronicleSetValue("yes")
            entry.save()
            PtDebugPrint("Chronicle entry TomahnaLoad already added, setting to yes")
Exemple #29
0
    def OnServerInitComplete(self):
        avatar = 0
        try:
            avatar = PtGetLocalAvatar()
        except:
            print"failed to get local avatar"
            return
        
        self.bugCount = self.IGetBugCount()
        print"psnl Bugs: ", self.bugCount

        thisAge = PtGetAgeName()
        #print "psnlBugs.OnServerInitComplete(): thisAge = ",thisAge

        if (self.bugCount != 0):
            PtSetParticleDissentPoint(0,0,10000,avatar.getKey())
            PtKillParticles(10.0,1,avatar.getKey())
            PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false)
            print "kill all bugs in age: ",thisAge
            self.ISaveBugCount(0)
        
        if thisAge != "Personal":
            return

        psdl = xPsnlVaultSDL(1)
        rainState = psdl["YeeshaPage8"][0]

        # check for all the cases where it would be raining, and if its not then turn on bugs
        sdl = PtGetAgeSDL()
        bugState = sdl["psnlBugsVis"]
        if rainState == 1 or (rainState == 4 and len(PtGetPlayerList()) == 0) or (rainState == 3 and len(PtGetPlayerList()) > 0):
            print "turning off bugs"
            if bugState != 0:
                sdl["psnlBugsVis"] = (0,)
        else:
            if self.bugCount > 0:
                print "turning on bugs"
                if bugState != 1:
                    sdl["psnlBugsVis"] = (1,)
Exemple #30
0
    def OnFirstUpdate(self):
        if not stringVarName.value:
            PtDebugPrint(
                "ERROR: psnlVaultSDLBoolShowHide.OnFirstUpdate():\tERROR: missing SDL var name on %s"
                % self.sceneobject.getName())
            pass

        if boolFirstUpdate.value:
            try:
                ageSDL = xPsnlVaultSDL(1)
                if stringVarName.value:
                    if not (ageSDL[stringVarName.value][0]
                            ^ boolShowOnTrue.value):
                        self.EnableObject()
                    else:
                        self.DisableObject()
                else:
                    PtDebugPrint(
                        "ERROR: psnlVaultSDLBoolShowHide.OnServerInitComplete():\tERROR: missing SDL var name on %s"
                        % self.sceneobject.getName())
                    self.runDefault()
            except:
                self.runDefault()
Exemple #31
0
    def OnFirstUpdate(self):
        global AgeStartedIn
        global boolCalStar

        AgeStartedIn = PtGetAgeName()
        if not sdlCalStar.value:
            PtDebugPrint(
                "ERROR: xCalendarStar.OnFirstUpdate():\tERROR: missing SDL var name"
            )
            pass

        if boolFirstUpdate.value:
            if AgeStartedIn == PtGetAgeName():
                psnlSDL = xPsnlVaultSDL()
                try:
                    boolCalStar = psnlSDL[sdlCalStar.value][0]
                except:
                    PtDebugPrint(
                        "ERROR: xCalendarStar.OnFirstUpdate():\tERROR reading age SDL"
                    )
                    pass
                PtDebugPrint("DEBUG: xCalendarStar.OnFirstUpdate():\t%s = %d" %
                             (sdlCalStar.value, boolCalStar))
    def OnSDLNotify(self, VARname, SDLname, playerID, tag):

        # is it a var we care about?
        if VARname != stringVarName.value:
            return
        ageSDL = xPsnlVaultSDL(1)
        PtDebugPrint(
            "DEBUG: psnlVaultSDLBoolRespond.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d"
            % (VARname, SDLname, tag, ageSDL[stringVarName.value][0]))

        # is state change from player or vault manager?
        if playerID:  # non-zero means it's a player
            objAvatar = ptSceneobject(PtGetAvatarKeyFromClientID(playerID),
                                      self.key)
            fastforward = 0
        else:  # invalid player aka Vault Manager
            objAvatar = None
            fastforward = boolVltMgrFastForward.value  # we need to skip any one-shots
        PtDebugPrint(
            "DEBUG: psnlVaultSDLBoolRespond.OnSDLNotify():\tnotification from playerID: %d"
            % (playerID))

        # run the appropriate responder!
        if ageSDL[stringVarName.value][0]:
            PtDebugPrint(
                "DEBUG: psnlVaultSDLBoolRespond.OnSDLNotify:\tRunning true responder on %s, fastforward=%d"
                % (self.sceneobject.getName(), fastforward))
            respBoolTrue.run(self.key,
                             avatar=objAvatar,
                             fastforward=fastforward)
        else:
            PtDebugPrint(
                "DEBUG: psnlVaultSDLBoolRespond.OnSDLNotify:\tRunning false responder on %s, fastforward=%d"
                % (self.sceneobject.getName(), fastforward))
            respBoolFalse.run(self.key,
                              avatar=objAvatar,
                              fastforward=fastforward)
    def PoleHandle(self, age):
        print "psnlBahroPoles.PoleHandle()"
        if age == "Gira":
            age = "Garden"
            
        if self.PoleCurrentState[age] == "Open":
            self.Poles[age]["HandGlow"].run(self.key, state="DropSheath", fastforward = 0)
            return
        elif self.PoleCurrentState[age] == "Reset":
            self.PoleCurrentState[age] = ""
            if self.PoleFinalState[age] == "Reset":
                self.PoleFinalState[age] = ""
            elif self.PoleFinalState[age] == "Open":
                self.PoleFinalState[age] == ""
                self.OpenSheath(age, 0)
            return
        
        self.UpdatePoleStates()

        if self.Poles[age]["State"] == 4:
            freq = self.GetStateFrequencyList()
            if freq[5] > 0 or freq[4] == 4:
                #self.SetCurrentState(age, 5)

                if not self.State5Running:
                    self.State5Running = 1
                    self.RunState("Teledahn", 5, 0)
                    self.RunState("Garrison", 5, 0)
                    self.RunState("Garden", 5, 0)
                    self.RunState("Kadish", 5, 0)

                    sdl = xPsnlVaultSDL(1)
                    sdl.BatchSet( [("TeledahnPoleState", (6,)), ("KadishPoleState", (6,)), ("GarrisonPoleState", (6,)), ("GardenPoleState", (6,))])
            
        elif self.Poles[age]["State"] == 5:
            self.State5Running = 0
Exemple #34
0
def GetAgeName(ageInfo=None):
    if not ageInfo:
        ageLink = ptNetLinkingMgr().getCurrAgeLink()
        if not ageLink:
            return "?UNKNOWN?"
        ageInfo = ageLink.getAgeInfo()
        if not ageInfo:
            return "?UNKNOWN?"

    if ageInfo.getAgeFilename() == "BahroCave":
        sdl = xPsnlVaultSDL()
        if sdl["TeledahnPoleState"][0] > 5 or sdl["KadishPoleState"][
                0] > 5 or sdl["GardenPoleState"][0] > 5 or sdl[
                    "GarrisonPoleState"][0] > 5:
            return "D'ni-Rudenna"

    if ageInfo.getAgeFilename() in kAges.Hide:
        return "Unknown"

    if ageInfo.getAgeFilename() in kAges.Display:
        return kAges.Display[ageInfo.getAgeFilename()]

    localizeName = ageInfo.getDisplayName()
    return FilterAgeName(xLocTools.LocalizeAgeName(localizeName))
Exemple #35
0
    def PoleHandle(self, age):
        PtDebugPrint("psnlBahroPoles.PoleHandle()")
        if age == "Gira":
            age = "Garden"
            
        if self.PoleCurrentState[age] == "Open":
            self.Poles[age]["HandGlow"].run(self.key, state="DropSheath", fastforward = 0)
            return
        elif self.PoleCurrentState[age] == "Reset":
            self.PoleCurrentState[age] = ""
            if self.PoleFinalState[age] == "Reset":
                self.PoleFinalState[age] = ""
            elif self.PoleFinalState[age] == "Open":
                self.PoleFinalState[age] == ""
                self.OpenSheath(age, 0)
            return
        
        self.UpdatePoleStates()

        if self.Poles[age]["State"] == 4:
            freq = self.GetStateFrequencyList()
            if freq[5] > 0 or freq[4] == 4:
                #self.SetCurrentState(age, 5)

                if not self.State5Running:
                    self.State5Running = 1
                    self.RunState("Teledahn", 5, 0)
                    self.RunState("Garrison", 5, 0)
                    self.RunState("Garden", 5, 0)
                    self.RunState("Kadish", 5, 0)

                    sdl = xPsnlVaultSDL(1)
                    sdl.BatchSet( [("TeledahnPoleState", (6,)), ("KadishPoleState", (6,)), ("GarrisonPoleState", (6,)), ("GardenPoleState", (6,))])
            
        elif self.Poles[age]["State"] == 5:
            self.State5Running = 0
Exemple #36
0
    def OnNotify(self, state, id, events):
        global LocalAvatar
        global OfferedBookMode
        global BookOfferer
        global CurrentPage
        global gLinkingBook
        global ClosedBookToShare
        global NoReenableBook
        print 'id = ',
        print id
        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)
                            respNum = self.GetCurrentSphere()
                            print 'respNum:',
                            print respNum
                            sdl = xPsnlVaultSDL()
                            resetSDL = sdl['AhnySphereDelete'][0]
                            if resetSDL:
                                vault = ptVault()
                                iown = vault.getAgesIOwnFolder()
                                for i in iown.getChildNodeRefList():
                                    i = i.getChild()
                                    link = i.upcastToAgeLinkNode()
                                    info = link.getAgeInfo()
                                    if info:
                                        name = info.getAgeFilename()
                                        if (name == 'Ahnonay'):
                                            print 'attempting to reset sdl for',
                                            print name
                                            asdl = info.getAgeSDL()
                                            sdr = asdl.getStateDataRecord()
                                            sdr.setFromDefaults(1)
                                            asdl.setStateDataRecord(sdr)
                                            asdl.save()
                                        elif ((name == 'AhnySphere01') or ((name == 'AhnySphere02') or ((name == 'AhnySphere03') or (name == 'AhnySphere04')))):
                                            link.setVolatile(1)
                                            link.save()
                                sdl['AhnySphereDelete'] = (0,)
                                respNum = 1
                            if ((respNum == 1) or (respNum == 0)):
                                respLinkSphere01.run(self.key, avatar=PtGetLocalAvatar())
                            elif (respNum == 2):
                                respLinkSphere02.run(self.key, avatar=PtGetLocalAvatar())
                            elif (respNum == 3):
                                respLinkSphere03.run(self.key, avatar=PtGetLocalAvatar())
                            elif (respNum == 4):
# Ahnonay Sphere 4 work-around BEGIN
                                PtSendKIMessage(kKISitOnNextLinkOut, 0)
# Ahnonay Sphere 4 work-around END
                                respLinkSphere04.run(self.key, avatar=PtGetLocalAvatar())
                            else:
                                print 'Whoa - invalid current sphere!'
                                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)
Exemple #37
0
 def HasMusicBoxYeeshaPage(self):
     sdl = xPsnlVaultSDL()
     curVal = sdl['YeeshaPage9'][0]
     return (curVal > 0)
    def OnNotify(self, state, id, events):
        # in no other cases do we want to take action on state = 0 events
        if not state:
            return

        if not PtWasLocallyNotified(self.key):
            PtDebugPrint(
                "DEBUG: xTakableClothing.OnNotify(): Message didn't come from our player, ignoring"
            )
            return

        if id == actClickable.id:
            avatar = PtGetLocalAvatar()
            currentgender = avatar.avatar.getAvatarClothingGroup()
            if currentgender == kFemaleClothingGroup:
                clothingNames = allFClothing
                base = baseFClothing
            else:
                clothingNames = allMClothing
                base = baseMClothing
            if not self.IItemInCloset():
                color1 = self.IGetTint(1)
                color2 = self.IGetTint(2)
                if boolHasHairColor.value:
                    PtDebugPrint(
                        "DEBUG: xTakableClothing.OnNotify():  Using existing hair color since this is a hair item"
                    )
                    color1 = hairColor
                if not boolStayVisible.value:
                    ageSDL = PtGetAgeSDL()
                    ageSDL[stringVarName.value] = (
                        not (boolShowOnTrue.value), )
                self.IRemoveWornSet(self.IConflictsWithSet(base))
                if base.find('Torso_GuildBlue') != -1 or base.find(
                        'Torso_GuildGreen') != -1 or base.find(
                            'Torso_GuildRed') != -1 or base.find(
                                'Torso_GuildYellow') != -1 or base.find(
                                    'Torso_GuildWhite') != -1:
                    self.IRemoveOtherGuildShirt()
                    psnlSDL = xPsnlVaultSDL()
                    psnlSDL["guildAlliance"] = (guildSDLValues[base], )
                    print "xTakableClothing: Guild set to:", guildSDLValues[
                        base]
                avatar.avatar.addWardrobeClothingItem(base,
                                                      ptColor().white(),
                                                      ptColor().white())
                acclist = avatar.avatar.getClosetClothingList(
                    kAccessoryClothingItem)
                accnamelist = []
                for accessory in acclist:
                    if accessory[0][4:14] == "AccGlasses" or accessory[0][
                            1:] == "Reward_Goggles":
                        accnamelist.append(accessory[0])
                worn = avatar.avatar.getAvatarClothingList()
                wornnamelist = []
                for wornitem in worn:
                    wornnamelist.append(wornitem[0])
                for name in clothingNames:
                    self.IRemoveWornSet(self.IConflictsWithSet(name))
                    if name in accnamelist:
                        for aitem in accnamelist:
                            if aitem in wornnamelist and aitem != name:
                                avatar.avatar.removeClothingItem(aitem)
                    PtDebugPrint(
                        "DEBUG: xTakableClothing.OnNotify():  Wearing " + name)
                    avatar.avatar.netForce(1)
                    avatar.avatar.wearClothingItem(name, 0)
                    avatar.avatar.tintClothingItem(name, color1, 0)
                    avatar.avatar.tintClothingItemLayer(name, color2, 2, 1)
                    matchingItem = avatar.avatar.getMatchingClothingItem(name)
                    if type(matchingItem) == type([]):
                        avatar.avatar.wearClothingItem(matchingItem[0], 0)
                        avatar.avatar.tintClothingItem(matchingItem[0], color1,
                                                       0)

                        #START-->Hard Hat color fix
                        if (matchingItem[0]
                                == 'MReward_HardHat') or (matchingItem[0]
                                                          == 'FRewardHardHat'):
                            avatar.avatar.tintClothingItem(
                                matchingItem[0],
                                ptColor().orange(), 2, 1)
                        else:
                            avatar.avatar.tintClothingItemLayer(
                                matchingItem[0], color2, 2, 1)
                        #END-->Hard Hat color fix
                    avatar.avatar.saveClothing()
            else:
                PtDebugPrint(
                    "DEBUG: xTakableClothing.OnNotify():  You already have " +
                    base + " so I'm not going to give it to you again")
Exemple #39
0
    def SetCurrentState(self, age, state):
        PtDebugPrint("psnlBahroPoles.SetCurrentState()")
        #ageSDL = PtGetAgeSDL()
        ageSDL = xPsnlVaultSDL(1)

        ageSDL[age + "PoleState"] = (state, )
Exemple #40
0
 def OnServerInitComplete(self):
     psnlSDL = xPsnlVaultSDL()
     print psnlSDL['psnlBahroWedge11'][0]
     if psnlSDL['psnlBahroWedge11'][0]:
         print 'bhroBahroMink.OnServerInitComplete: You have the Minkata wedge, no need to display it.'
         respRing.run(self.key, fastforward=1)
    def OnServerInitComplete(self):
        "PlayerBook - determine what Yeesha pages are found"
        global TotalPossibleYeeshaPages
        global HideCleftPole
        FoundYPs = []
        CurrentPage = 0

        AgeVault = ptAgeVault()
        if type(AgeVault) != type(None):  #is the Vault online?

            self.ageSDL = AgeVault.getAgeSDL()
            if self.ageSDL:
                try:
                    SDLVar = self.ageSDL.findVar("YeeshaPage" +
                                                 str(PageNumber.value))
                    CurrentValue = SDLVar.getInt()
                    #PtDebugPrint("psnlYeeshaPageChanges.OnServerInitComplete:\tYeeshaPage%d = %d" % (PageNumber.value, SDLVar.getInt()))
                except:
                    PtDebugPrint(
                        "psnlYeeshaPageChanges:\tERROR reading age SDLVar. Assuming CurrentValue = 0"
                    )
                    CurrentValue = 0

                if PageNumber.value == 10:
                    MAX_SIZE = 10
                    size, state = divmod(CurrentValue, 10)

                    if len(PtGetPlayerList()) == 0 and state != 0:
                        growSizes = self.TimeToGrow()
                        PtDebugPrint("Growsizes: %d" % growSizes)
                        if growSizes and size < MAX_SIZE:
                            size = size + growSizes
                            if size > MAX_SIZE:
                                size = MAX_SIZE
                            sizechanged = 1
                        elif size > MAX_SIZE:
                            size = MAX_SIZE
                            sizechanged = 1
                        else:
                            sizechanged = 0

                        newstate = self.UpdateState(state, size, SDLVar,
                                                    AgeVault, sizechanged)
                    else:
                        newstate = state

                    PtDebugPrint("CurrentValue: %d, size: %d, state %d" %
                                 (CurrentValue, size, state))
                    self.EnableDisable((size * 10) + newstate)

                else:
                    if PageNumber.value == 25:
                        if self.enabledStateList == [0, 2, 4]:
                            try:
                                ageSDL = xPsnlVaultSDL(1)

                                if type(ageSDL) != type(None):
                                    sdllist = ageSDL.BatchGet([
                                        "TeledahnPoleState", "GardenPoleState",
                                        "GarrisonPoleState", "KadishPoleState"
                                    ])
                                    pole1 = sdllist["TeledahnPoleState"]
                                    pole2 = sdllist["GardenPoleState"]
                                    pole3 = sdllist["GarrisonPoleState"]
                                    pole4 = sdllist["KadishPoleState"]
                                    if (pole1 in [7, 8]) and (pole2 in [
                                            7, 8
                                    ]) and (pole3 in [7, 8]) and (pole4
                                                                  in [7, 8]):
                                        val = ageSDL["CleftVisited"][0]
                                        if not val:
                                            HideCleftPole = 1
                                            print "psnlYeeshaPageChanges.OnServerInitComplete():\t Fissure is open, so setting HideCleftPole = ", HideCleftPole
                                else:
                                    PtDebugPrint(
                                        "ERROR: psnlYeeshaPageChanges.OnServerInitComplete():\tProblem trying to access age SDLs for Bahro poles"
                                    )
                                    pass

                            except:
                                PtDebugPrint(
                                    "ERROR: psnlYeeshaPageChanges.OnServerInitComplete():\tException occurred trying to access age SDL"
                                )

                    if len(PtGetPlayerList()) == 0:
                        newstate = self.UpdateState(CurrentValue, 0, SDLVar,
                                                    AgeVault, 0)
                    else:
                        newstate = CurrentValue

                    self.EnableDisable(newstate)

                #There is only one object in Yeesha Page 5 with a value of 0, so I'm temporarily nestling my print statement here...
                if PageNumber.value == 5 and stringShowStates.value == "0":
                    print "psnlYeeshaPageChanges: You've found the following Yeesha Pages:"
                    for thispage in range(1, TotalPossibleYeeshaPages + 1):
                        FoundValue = self.ageSDL.findVar("YeeshaPage" +
                                                         str(thispage))
                        PtDebugPrint(
                            "\t The previous value of the SDL variable %s is %s"
                            % ("YeeshaPage" + str(thispage),
                               FoundValue.getInt()))
                        if type(FoundValue) != type(
                                None) and FoundValue.getInt() != 0:
                            PtDebugPrint(
                                "psnlYeeshaPageChanges: You have found Yeesha Page # %s."
                                % (thispage))

            else:
                PtDebugPrint(
                    "psnlYeeshaPageChanges: Error trying to access the Chronicle self.ageSDL. self.ageSDL = %s"
                    % (self.ageSDL))
        else:
            PtDebugPrint(
                "psnlYeeshaPageChanges: Error trying to access the Vault. Can't access YeeshaPageChanges chronicle."
            )
    def SetState(self, age, state):
        if type(state) == type(0):
            #PtDebugPrint("Setting %s state to %d" % (age, state))
            psnlSDL = xPsnlVaultSDL()

            psnlSDL[age + "PoleState"] = (state, )
Exemple #43
0
 def SetCurrentState(self, age, state):
     ageSDL = xPsnlVaultSDL()
     ageSDL[(age + 'PoleState')] = (state,)
Exemple #44
0
 def SetState(self, age, state):
     if (type(state) == type(0)):
         psnlSDL = xPsnlVaultSDL()
         psnlSDL[(age + 'PoleState')] = (state,)
Exemple #45
0
    def OnServerInitComplete(self):
        self.ageFrom = PtGetPrevAgeName()
        if self.ageFrom == "":
            self.ageFrom = "Garrison"
            
        PtDebugPrint("DEBUG: bhroBahroYeeshaCave.OnServerInitComplete():\tCame from: %s" % self.ageFrom)

        # check if a cleft yeesha imager solution has already been created, otherwise create it
        if not self.CheckForSolution():
            PtDebugPrint("No solution found, attempting to create")
            self.CreateSolution()

        self.UpdatePoleStates()
        self.UpdateToState2()

        autostart = 0

        # check and see if the yeesha speech variable has been set yet
        self.UseYeeshaSpeech = self.GetAgeVariable(self.ageFrom, "YeeshaSpeech")
        if self.UseYeeshaSpeech != None:
            PtDebugPrint("bhroBahroYeeshaCave.OnServerInitComplete(): useYeeshaSpeech = ",self.UseYeeshaSpeech)
            if int(self.UseYeeshaSpeech) == 0:
                serieslen = self.GetNumYSSet()
                #self.SetAgeVariable(self.ageFrom, "YeeshaSpeech", serieslen + 1)
                self.UseYeeshaSpeech = serieslen + 1
                if self.GetAutoStartLevel() < self.UseYeeshaSpeech:
                    autostart = 1
                    self.IncrementAutoStartLevel()
                PtDebugPrint("GetAutoStartLevel = ",self.GetAutoStartLevel())
        else:
            PtDebugPrint("bhroBahroYeeshaCave.OnServerInitComplete(): useYeeshaSpeech = None")

        UseYS = self.UseYeeshaSpeech
        PtDebugPrint("bhroBahroYeeshaCave.OnServerInitComplete(): useYeeshaSpeech = ",UseYS)
        PtDebugPrint("bhroBahroYeeshaCave.OnServerInitComplete(): autostart = ",autostart)

        journeyComplete = 0
        #vault = ptVault()
        #jcNode = vault.findChronicleEntry("JourneyClothProgress")
        #if jcNode.chronicleGetValue() == "Z":

        sdl = xPsnlVaultSDL()
        if sdl["CleftVisited"][0]:
            journeyComplete = 1

        # process stuff for each age
        starCavernRun = 0
        agelist = ["Teledahn", "Garrison", "Garden", "Kadish"]
        for age in agelist:
            currentState = self.ageDict[age]['State']
            PtDebugPrint("Current state: %d" % currentState)
            
            # if the age is not the one that I'm from then run the responder to make it back off
            if age != self.ageFrom and currentState < 8:
                self.ageDict[age]['WedgeAnim'].run(self.key, fastforward=1)

            if not starCavernRun and currentState > 5:
                respStarCavern.run(self.key, state = "CavernVis", fastforward = 1)
                starCavernRun = 1
                self.IsStarfield = 0

            # check the current state to see if the pole is here or not
            if currentState in (4, 5, 6, 9):
                self.DisablePole(age, 1)

            # check the current state to see if the journey symbol should show up or not
            if currentState == 4 or (currentState > 6 and not journeyComplete):
                self.ageDict[age]['JCDisable'].run(self.key,fastforward=1)

            # display the appropriate solution symbol
            val = self.GetAgeVariable(age, "SolutionSymbol")
            self.ageDict[age]['SolutionSymbols'].run(self.key, state=val, fastforward=1)

        if not starCavernRun:
            respStarCavern.run(self.key, state = "StarVis", fastforward = 1)

        if autostart:
            PtAtTimeCallback(self.key, 3, 1)
Exemple #46
0
 def UpdatePoleStates(self):
     psnlSDL = xPsnlVaultSDL()
     sdllist = psnlSDL.BatchGet(['TeledahnPoleState', 'GardenPoleState', 'GarrisonPoleState', 'KadishPoleState'])
     for var in ['Teledahn', 'Garrison', 'Garden', 'Kadish']:
         self.ageDict[var]['State'] = sdllist[(var + 'PoleState')]
Exemple #47
0
    def UpdatePoleStates(self):
        psnlSDL = xPsnlVaultSDL()

        sdllist = psnlSDL.BatchGet( ["TeledahnPoleState", "GardenPoleState", "GarrisonPoleState", "KadishPoleState"] )
        for var in ["Teledahn", "Garrison", "Garden", "Kadish"]:
            self.ageDict[var]['State'] =  sdllist[var + "PoleState"]
Exemple #48
0
    def SetState(self, age, state):
        if isinstance(state, int):
            #PtDebugPrint("Setting %s state to %d" % (age, state))
            psnlSDL = xPsnlVaultSDL()

            psnlSDL[age + "PoleState"] = (state,)
Exemple #49
0
 def SetCurrentState(self, age, state):
     ageSDL = xPsnlVaultSDL()
     ageSDL[age + "PoleState"] = (state, )
 def _get_have_calendar_page(self):
     psnl = xPsnlVaultSDL()  # we want our YP20 status
     return bool(psnl["YeeshaPage20"][0])
Exemple #51
0
    def OnServerInitComplete(self):
        global boolCleftTotem
        #global GotCleftBook
        global boolCleftSolved
        global HidingPoles


        PtDebugPrint("DEBUG: psnlBahroPoles.OnServerInitComplete():\tEverything ok so far")

        ageVault = ptAgeVault()
        if ageVault is not None: #is the Vault online?
            ageSDL = ageVault.getAgeSDL()
            if ageSDL:
                try:
                    SDLVar = ageSDL.findVar("YeeshaPage25")
                    CurrentValue = SDLVar.getInt()
                except:
                    PtDebugPrint("psnlBahroPoles.RunState():\tERROR reading age SDLVar for YeeshaPage25. Assuming CurrentValue = 0")
                    CurrentValue = 0
                if CurrentValue in [0, 2, 4]:
                    PtDebugPrint("psnlBahroPoles.RunState():\tPoles are active but YeeshaPage25 is off, so we're gonna hide 'em")
                    HidingPoles = 1
        
        ageSDL = PtGetAgeSDL()

        if sdlCleftTotem.value != "":
            ageSDL.setFlags(sdlCleftTotem.value,1,1)
            ageSDL.sendToClients(sdlCleftTotem.value)
            ageSDL.setNotify(self.key,sdlCleftTotem.value,0.0)

        try:
            boolCleftTotem = ageSDL[sdlCleftTotem.value][0]
        except:
            PtDebugPrint("ERROR: psnlBahroPoles.OnServerInitComplete():\tERROR reading SDL name for Cleft totem")
            boolCleftTotem = 0        

        ageSDL.setFlags("psnlCleftSolved",1,1)
        ageSDL.sendToClients("psnlCleftSolved")
        ageSDL.setNotify(self.key,"psnlCleftSolved",0.0)

        try:
            boolCleftSolved = ageSDL["psnlCleftSolved"][0]
            PtDebugPrint("psnlBahroPoles.OnServerInitComplete(): boolCleftSolved = ",boolCleftSolved)
        except:
            PtDebugPrint("ERROR: psnlBahroPoles.OnServerInitComplete():\tNo SDL for boolCleftSolved, using 0")

        if not boolCleftSolved:
            vault = ptVault()
            if ptVault().amOwnerOfCurrentAge():
                entry = vault.findChronicleEntry("CleftSolved")
                if entry is not None:
                    if entry.chronicleGetValue() == "yes":
                        boolCleftSolved = 1
                        ageSDL["psnlCleftSolved"] = (1,)
        
        if boolCleftTotem:
            if boolCleftSolved:
                ageSDL[sdlCleftTotem.value] = (0,)
                PtDebugPrint("psnlBahroPoles.OnServerInitComplete(): Cleft totem was open but Cleft is solved, setting SDL to closed")
            else:
                PtDebugPrint("psnlBahroPoles.OnServerInitComplete(): Cleft not solved yet, will open the Cleft totem")
                respChangeCleftTotem.run(self.key,state="open",fastforward=1)
        else:
            respChangeCleftTotem.run(self.key,state="close",fastforward=1)
        
        if strTeledahnEnabled.value != "":
            ageSDL.setNotify(self.key, strTeledahnEnabled.value, 0.0)
        if strGarrisonEnabled.value != "":
            ageSDL.setNotify(self.key, strGarrisonEnabled.value, 0.0)
        if strGardenEnabled.value != "":
            ageSDL.setNotify(self.key, strGardenEnabled.value, 0.0)
        if strKadishEnabled.value != "":
            ageSDL.setNotify(self.key, strKadishEnabled.value, 0.0)

        for age in ["Teledahn", "Garrison", "Garden", "Kadish"]:
            self.Poles[age]['Smoker'].value.particle.setParticlesPerSecond(0)
            
            sdlVar = age + "PoleState"
            ageSDL.setFlags(sdlVar,1,1)
            ageSDL.sendToClients(sdlVar)
            ageSDL.setNotify(self.key, sdlVar, 0.0)

        # in case we've come here because of linking through the fissure
        cam = ptCamera()
        #cam.undoFirstPerson()
        cam.enableFirstPersonOverride()

        avatar = PtGetLocalAvatar()
        avatar.physics.suppress(False)

        
        self.UpdatePoleStates()
        self.ValidityCheck()

        # check if a cleft yeesha imager solution has already been created, otherwise create it
        if not self.CheckBahroCaveSolution():
            PtDebugPrint("no BahroCave solution found, attempting to create")
            self.CreateBahroCaveSolution()
        else:
            PtDebugPrint("found BahroCave solution: ",self.GetBahroCaveSolution())
        
        interestingVarList = [("TeledahnPoleState", BahroPoles.Teledahn), ("KadishPoleState", BahroPoles.Kadish), ("GardenPoleState", BahroPoles.Garden), ("GarrisonPoleState", BahroPoles.Garrison)]
        #ageSDL = PtGetAgeSDL()
        ageSDL = xPsnlVaultSDL(1)

        self.screamStarted = 0
        state9 = 0
        
        for VARname in interestingVarList:
            try:
                sdlVal = ageSDL[VARname[0]][0]
            except:
                PtDebugPrint("ERROR: psnlBahroPoles.OnServerInitComplete:\tproblem getting sdl, assuming state 0")
                self.sdlBroken = 1
                sdlVal = 0
                
            ageName = VARname[0][0:VARname[0].find("PoleState")]
            
            if sdlVal in [3, 5, 7, 8]:
                if sdlVal == 5:
                    self.RunState(ageName, 4, 1)
                    
                elif sdlVal == 7 or sdlVal == 8:
                    self.RunState(ageName, sdlVal, 1)
                    if not self.FissureInited:
                        self.ShowFissure(1)
                        self.FissureInited = 1
                    if sdlVal == 7:
                        PtAtTimeCallback(self.key, 2, (VARname[1]*10) + sdlVal)
                        self.SetCurrentState(ageName, 8)
                else:
                    PtAtTimeCallback(self.key, 3, (VARname[1]*10) + sdlVal)
                    self.SetCurrentState(ageName, 4)
            else:
                self.RunState(ageName, sdlVal, 1)

            # start smoke if in appropriate state
            if sdlVal in [3,4,5,6,9]:
                PtDebugPrint("DEBUG:psnlBahroPoles.OnServerInitComplete:\tStarting smoke, pole = %s" % ageName)
                #self.Poles[ageName]['Smoker'].value.particle.setParticlesPerSecond(6)
                PtAtTimeCallback(self.key, 0.1, self.PoleIDMap[ageName] * -1)

            if sdlVal == 9:
                state9 += 1
                if state9 == 4:
                    PtDebugPrint("scream started on init")
                    respBahroScream.run(self.key, state = "start")
                    self.screamStarted = 1

        self.FissureInited = 0
        ageSDL = PtGetAgeSDL()

        if strTeledahnEnabled.value != "":
            if ageSDL[strTeledahnEnabled.value][0] == 1:
                self.Poles["Teledahn"]["Enabled"] = 1
            else:
                self.Poles["Teledahn"]["Enabled"] = 0

        if strGarrisonEnabled.value != "":
            if ageSDL[strGarrisonEnabled.value][0] == 1:
                self.Poles["Garrison"]["Enabled"] = 1
            else:
                self.Poles["Garrison"]["Enabled"] = 0

        if strGardenEnabled.value != "":
            if ageSDL[strGardenEnabled.value][0] == 1:
                self.Poles["Garden"]["Enabled"] = 1
            else:
                self.Poles["Garden"]["Enabled"] = 0

        if strKadishEnabled.value != "":
            if ageSDL[strKadishEnabled.value][0] == 1:
                self.Poles["Kadish"]["Enabled"] = 1
            else:
                self.Poles["Kadish"]["Enabled"] = 0

        for age in ("Teledahn", "Garrison", "Gira", "Kadish"):
            isvolatile = self.IsVolatile(age)
            if isvolatile or self.BookLost(age):
                if isvolatile:
                    self.VolatileBookList.append(age)
                self.OpenSheath(age)

        self.initComplete = 1
        self.UpdatePoleStates()

        # register pellet cave
        vault = ptVault()
        ageStruct = ptAgeInfoStruct()
        ageStruct.setAgeFilename("PelletBahroCave")
        ageLinkNode = vault.getOwnedAgeLink(ageStruct)
        if not ageLinkNode:
            info = ptAgeInfoStruct()
            info.setAgeFilename("PelletBahroCave")
            info.setAgeInstanceName("Pellet Cave")

            playerName = PtGetClientName()
            ageGuid = PtGuidGenerate()
            userDefName = ""
            desc = ""

            if playerName[-1] == "s" or playerName[-1] == "S":
                userDefName = "%s'" % playerName
                desc = "%s' %s" % (playerName, info.getAgeInstanceName())
            else:
                userDefName = "%s's" % playerName
                desc = "%s's %s" % (playerName, info.getAgeInstanceName())

            info.setAgeInstanceGuid(ageGuid)
            info.setAgeUserDefinedName(userDefName)
            info.setAgeDescription(desc)

            link = ptAgeLinkStruct()
            link.setAgeInfo(info)

            ptVault().registerOwnedAge(link)
            PtDebugPrint("Registered pellet bahro cave")
        
        self.CheckPelletCaveSolution()