def LoadReltoPages():
    if haveUamPlugin: return
    #Read any updated pages
    ReadPageInfo()

    #Do tasks given from other Ages: The player collected a Relto page, enable it
    if AmInMyRelto():
        tasksstr = uam._GetPlayerChronicle("UamTasks")
        tasks = _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 = _StringToDict(uam.GetAgeChronicle("UamReltoPages"))
                pages[
                    page] = "on"  #whether it was unset or on or off or unattained, it is on now!
                uam.SetAgeChronicle("UamReltoPages", _DictToString(pages))
                #remove from task list
                tasks.remove(task)
        if numtasks != len(tasks):
            #removed some, so save
            uam._SetPlayerChronicle("UamTasks", _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 "xCustomReltoPages: Loading Uam pages..."
    chronstr = uam.GetAgeChronicle("UamReltoPages")  #on, off, or unattained
    pages = _StringToDict(chronstr)
    #print "UamReltoPages: "+chronstr
    for pagename in pages:
        status = pages[pagename]
        if not pagename in ReltoPages:
            print "xCustomReltoPages: You collected a Relto page which is not installed: %s" % pagename
        elif status == "on":
            PagesToLoad[pagename] = None  #we're using this dict as a set
            for hideitem in ReltoPages[pagename]["hide"]:
                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
        HideObject(hideitem)
    #Load the pages
    for pagename in PagesToLoad:
        #print "Loading page: "+pagename
        Plasma.PtPageInNode(
            "UamPage-" + pagename
        )  #doesn't throw an exception if page not present; simply doesn't load.
Exemple #2
0
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()
Exemple #3
0
def LoadPage(pagename):
    #This will load the pagename, even if it is not part of the current Age.
    print "_UamUtils.LoadPage: " + pagename
    Plasma.PtPageInNode(pagename)