def UamOnServerInitComplete(): #print "UamModGameFixes.UamOnServerInitComplete: "+`command` agename = _UamUtils.GetAgeName() if agename == "Neighborhood" or agename == "NeighborhoodMOUL": # or agename=="KirelMOUL" or agename=="Neighborhood02": #Thanksgiving/Halloween: if _UamUtils.IsDayInRange( 10, 25, 11, 1 ): #oct 25 to nov 1. Halloween is Oct 31, and Thanksgiving day in the US is Nov 25. (October's 2nd monday is in Canada, so somewhere from Oct 8 to Oct 14.) print "enable halloween stuff" uam.SetAgeSdl("nb01ThanksgivingVis", 1) else: print "disable halloween stuff" uam.SetAgeSdl("nb01ThanksgivingVis", 0) #New Years': if _UamUtils.IsDayInRange(12, 30, 1, 2): #dec 30 to jan 2. print "enable new years stuff" uam.SetAgeSdl("nb01HappyNewYearVis", 1) else: print "disable new years stuff" uam.SetAgeSdl("nb01HappyNewYearVis", 0) elif agename == "BaronCityOffice": #Christmas: #if _UamUtils.IsDayInRange(11,30,1,1): #nov 30 to jan 1. if _UamUtils.IsDayInRange( 12, 7, 1, 8 ): #Changed to start after Dutch Sinterklaas festivities and continue to Epiphany and the Ukrainian Christmas day. print "enable Christmas stuff" uam.SetAgeSdl("bcoChristmasVis", 1) else: print "disable Christmas stuff" uam.SetAgeSdl("bcoChristmasVis", 0)
def FindFile(self): #Tries: # ageresources/Agename--JournalName--lang1.txt # ageresources/Agename--JournalName.txt # ageresources/Agename--JournalName--lang2.txt # ageresources/Agename--JournalName--lang3.txt filebase = "ageresources/" + _UamUtils.GetAgeName( ) + "--" + self.journalname lang = _UamUtils.GetLanguage() filename = filebase + "--" + lang + ".txt" if os.path.isfile(filename): return filename filename = filebase + ".txt" if os.path.isfile(filename): return filename if lang == "en": lang2 = "de" lang3 = "fr" elif lang == "de": lang2 = "en" lang3 = "fr" elif lang == "fr": lang2 = "en" lang3 = "de" filename = filebase + "--" + lang2 + ".txt" if os.path.isfile(filename): return filename filename = filebase + "--" + lang3 + ".txt" if os.path.isfile(filename): return filename return None
def UamOnKiCommand(command): #print "UamModHelp.UamOnKiCommand: "+`command` agename = _UamUtils.GetAgeName() if agename == "BahroCave02" or agename == "BahroCave" or agename == "LiveBahroCaves": if command == "/nexus" or command == "/hood" or command.startswith( "/link "): uam.PrintKiMessage("You can't link out of a Bahro Cave this way.") return True #intercept further handling
def UamOnKiCommand(command): print "UamModDebug.UamOnKiCommand: " + ` command ` args = command.split() #splits on whitespace if command == "/uamtest 1": uam.DisplayLinkingBook("Aerie", "LinkInPointDefault") return True if command == "/uamtest 2": uam.EnableReltoPage("DustCushions") return True if command == "/uamtest 3": def _TimerTest(): uam.PrintKiMessage("The timer works!") uam.SetTimer(_TimerTest, 1.0) return True if command == "/uamtest 4": val = uam.GetAgeSdl("psnlLibraryDoorClosed") uam.PrintKiMessage("psnlLibraryDoorClosed set to: " + ` val `) return True if command == "/uamtest 5": uam.SetAgeSdl("psnlLibraryDoorClosed", 1) val = uam.GetAgeSdl("psnlLibraryDoorClosed", 0) uam.PrintKiMessage("psnlLibraryDoorClosed set to: " + ` val `) return True if command == "/uamtest 6": if _UamUtils._IsRestorationAge( "Aerie" ) and not _UamUtils._IsRestorationAge("ThisIsNotAnAgename"): uam.PrintKiMessage("Test6 successful!") return True if command == "/uamtest 7": if _UamUtils.GetCorrectFilename("aerie") == "Aerie": uam.PrintKiMessage("Test7 successful!") return True if command == "/uamtest 8": uam.LinkToAge("Aerie", "LinkInPointDefault") return True if command == "/listmodules": import sys #uam.PrintKiMessage(`sys.modules.keys()`) print "modules: " + ` sys.modules.keys() ` return True if args[0] == "/show2": print "show:" + args[1] agename = _UamUtils.GetAgeName() av = Plasma.PtFindSceneobject(args[1], agename) av.draw.enable() av.physics.suppress(0) return True if args[0] == "/hide2": success = _UamUtils.HideObject(args[1]) if not success: uam.PrintKiMessage("Unable to find object: " + args[1]) return True
def UamOnKiCommand(command): #print "_UamModCheats.UamOnKiCommand: "+`command` if (command == "/opencleftdoor"): print "_UamModCheats: Opening Cleft Door" #Calling this twice is fine. And we can call it only from the Cleft. if _UamUtils.GetAgeName() != "Cleft": uam.PrintKiMessage("You can only do this in the Cleft.") return True sdl = Plasma.PtGetAgeSDL() varname = "clftBahroDoorClosed" index = 0 value = 0 #i.e. we want it opened sdl.setFlags(varname, 1, 1) sdl.sendToClients(varname) sdl.setIndex(varname, index, value) return True if (command == "/getki"): print "_UamModCheats: getting ki" #Calling this twice should be okay, since kNormalKI is the highest level, so we won't be downgrading it ever. #We can call this from any Age. #Add the normal ki: Plasma.PtSendKIMessageInt(PlasmaKITypes.kUpgradeKILevel, PlasmaKITypes.kNormalKI) #Set the chronicle directly, because the Offline-KI blocks this for some bizarre reason. uam._SetPlayerChronicle(PlasmaKITypes.kChronicleKILevel, str(PlasmaKITypes.kNormalKI), PlasmaKITypes.kChronicleKILevelType) return True if (command == "/getmarkers"): #Register the new link. From IUpdateNexusLink from grtzKIMarkerMachine.py #This can be called multiple times okay, because the chron is never set higher and adding the spawnpoint more than once doesn't create duplicate copies. And it can be called from any Age. #But you need to restart Uru for some unknown reason, before you can use F8 to create a mission. print "_UamModCheats: getting markers" success = GetMarkersAddGZLink() if success: #Set the chronicle saying that we've got uam._SetPlayerChronicle("KIMarkerLevel", "3") uam.PrintKiMessage( "You should now be able to do marker missions! (Though you may need to restart Uru first.)" ) else: uam.PrintKiMessage( "You need to visit the Great Zero at least once first.") return True
def OnInit(self): print "UamVarJournal.OnInit" self.varname = str(_vartolisten.value) #self.text_en = str(_text_en.value) #self.text_de = str(_text_de.value) #self.text_fr = str(_text_fr.value) self.journalname = str(_journalname.value) self.showopen = int(_showopen.value) #print "booktype: "+`_booktype` #print "booktype: "+`dir(_booktype)` self.booktype = str( getattr(_booktype, "value", "Old Book") ) #Stupid Plasma bug. We want _booktype.value, or "OldBook" if .value isn't defined. #self.booktype = str(_booktype.value) _UamVars.RegisterVar(self.varname) _UamVars.ListenToVar(self.varname, self) if self.FindFile() == None: _UamVars.Error("Unable to find journal: " + "ageresources/" + _UamUtils.GetAgeName() + "--" + self.journalname + ".txt")
def LoadReltoPages(): print "_UamModReltopages.UamOnNewAgeLoaded" import _UamUtils import uam import Plasma if _UamUtils.GetAgeName() == "Personal": #Read any updated pages ReadPageInfo() #Do tasks given from other Ages if _UamUtils.AmInMyRelto(): tasksstr = uam._GetPlayerChronicle("UamTasks") tasks = _UamUtils._StringToList(tasksstr) numtasks = len(tasks) for task in tasks: print "task to do: " + task if task.startswith("EnableReltoPage="): page = task[len("EnableReltoPage="):] #enable the page pages = _UamUtils._StringToDict( uam.GetAgeChronicle("UamReltoPages")) pages[ page] = "on" #whether it was unset or on or off or unattained, it is on now! uam.SetAgeChronicle("UamReltoPages", _UamUtils._DictToString(pages)) #remove from task list tasks.remove(task) if numtasks != len(tasks): #removed some, so save uam._SetPlayerChronicle("UamTasks", _UamUtils._ListToString(tasks)) #Load pages PagesToLoad = {} #set() #Sets don't exist in Python 2.2 :P ObjectsToHide = {} #set() #Sets don't exist in Python 2.2 :P print "Loading Uam pages..." chronstr = uam.GetAgeChronicle( "UamReltoPages") #on, off, or unattained pages = _UamUtils._StringToDict(chronstr) print "UamReltoPages: " + chronstr for pagename in pages: status = pages[pagename] if status == "on": #PagesToLoad.add(pagename) PagesToLoad[pagename] = None #we're using this dict as a set for hideitem in ReltoPages[pagename]["hide"]: #ObjectsToHide.add(hideitem) ObjectsToHide[ hideitem] = None #we're using this dict as a set #Turn into sorted lists PagesToLoad = PagesToLoad.keys() ObjectsToHide = ObjectsToHide.keys() PagesToLoad.sort() ObjectsToHide.sort() #Hide the objects for hideitem in ObjectsToHide: print "Hiding obj: " + hideitem _UamUtils.HideObject(hideitem) #Load the pages for pagename in PagesToLoad: try: print "Loading page: " + pagename Plasma.PtPageInNode( "UamPage-" + pagename ) #doesn't throw an exception if page not present; simply doesn't load. except: import traceback traceback.print_exc()
def UamOnKiCommand(command): print "UamModReset.UamOnKiCommand: " + ` command ` if command == "/reset": #resets the current age, with the help of the server's /!resetage command import _UamUtils import uam import Plasma curage = _UamUtils.GetAgeName() prefix = _UamUtils.GetSequencePrefix(curage) print "curage=" + ` curage ` + " prefix=" + ` prefix ` #detect if this is an Age we can reset #if not _UamUtils.IsThisRestorationAge(): if prefix < 100: uam.PrintKiMessage( "This Age cannot be reset. You can only reset fan Ages.") return True #detect if there are any other players if _UamUtils.GetNumOfOtherPlayers() > 0: uam.PrintKiMessage( "There are other players in the Age. You must be alone to reset the Age." ) return True ageVault = Plasma.ptAgeVault() #reset Age devices devfolder = ageVault.getAgeDevicesFolder( ) #Should be a ptVaultFolderNode print "devfolder: " + ` devfolder ` devfolder.removeAllNodes() #reset Age chronicles chronfolder = ageVault.getChronicleFolder( ) #Should be a ptVaultFolderNode print "chronfolder: " + ` chronfolder ` chronfolder.removeAllNodes() #reset Player chronicles for this Agename from D'Lanor's system playerVault = Plasma.ptVault() entry = playerVault.findChronicleEntry("UserAges") if type(entry) == type(None): print "No UserAges chronicle folder." else: chronRefList = entry.getChildNodeRefList() for subChron in chronRefList: theChild = subChron.getChild() theChild = theChild.upcastToChronicleNode() if theChild.chronicleGetName() == curage: #found it so delete it print "Found Player chronicle node, so deleting it for Age: " + curage entry.removeNode(theChild) break #reset Age SDL node (but the SDL is still stored in the .sav file/server) #sdlnode = ageVault.getAgeSDL() #Should be a ptSDLStateDataRecord. We can get the ptVaultSDLNode through the AgeInfoNode if we want that instead. #print "sdlnode: "+`sdlnode` #sdlnode.setStateDataRecord(None) #sdlnode.save() #print "sdlnode vars: "+`sdlnode.getVarList()` #returns e.g. ["isPowerOn","SdlVar2"] #sdlval = sdlnode.findVar("isPowerOn") #print "sdlnode var: "+`sdlval` #returns ptSimpleStateVariable, but maybe sometimes a ptSDLStateDataRecord? #vars = sdlnode.getVarList() #for var in vars: # statevar = sdlnode.findVar(var) # if isinstance(statevar,ptSimpleStateVariable): # default = statevar.getDefault() # print "default: "+`default` # else: # print "Error: statevar was actually: "+`statevar` ageinfo = ageVault.getAgeInfo() #Should be a ptVaultAgeInfoNode print "ageinfo: " + ` ageinfo ` sdlnode = ageinfo.getAgeSDL() #Should be a ptVaultSDLNode print "sdlnode: " + ` sdlnode ` #sdlnode.setStateDataRecord(None) #sdlnode.save() ageinfo.removeNode(sdlnode) guid = ageVault.getAgeGuid() print "guid: " + ` guid ` print "offline reset done!" #get the server to reset the SDL and physics if _UamUtils.GetGame() == "pots": #delete the .sav file hexname = _UamUtils.GetPlayerNameInHex() path = "sav/" + hexname + "/current/" + Plasma.PtGetAgeName( ) + "_" + guid + ".sav" print path global delpath delpath = path #uam.PrintKiMessage("You should quit immediatly, then delete this file and restart Uru: "+path) #import os #os.remove("test.txt") #os.remove(path) #relink #Plasma.ptNetLinkingMgr().linkToPlayersAge(Plasma.PtGetLocalClientID()) uam.PrintKiMessage( "Linking you to the nexus to finish resetting the Age...") uam._ki.ISendRTChat("/nexus") elif _UamUtils.GetGame() == "alcugs": print "sending reset command to server..." uam._ki.ISendRTChat("/!resetage") #The /!resetage command should relink us return True