コード例 #1
0
def GetAgeJourneyCloths(args):
    import Plasma

    ageChronNode = None
    ageName = Plasma.PtGetAgeName()
    if ageName == "Gira" or ageName == "Garden":
        ageName = "Eder"
    elif ageName == "Teledahn" or ageName == "Garrison" or ageName == "Kadish" or ageName == "Cleft":
        pass
    else:
        return

    vault = Plasma.ptVault()
    chron = vault.findChronicleEntry("JourneyClothProgress")
    ageChronRefList = chron.getChildNodeRefList()
    
    for ageChron in ageChronRefList:
        ageChild = ageChron.getChild()

        ageChild = ageChild.upcastToChronicleNode()

        if ageChild.chronicleGetName() == ageName:
            ageChronNode = ageChild
            break

    if type(ageChronNode) == type(None):
        newNode = Plasma.ptVaultChronicleNode(0)
        newNode.chronicleSetName(ageName)
        newNode.chronicleSetValue("abcdefg")
        chron.addNode(newNode)
    else:
        ageChronNode.chronicleSetValue("abcdefg")
        ageChronNode.save()
コード例 #2
0
def InstaPellets(args):
    import Plasma
    import string
    ageName = Plasma.PtGetAgeName()
    if ageName == "Ercana":
        sdl = Plasma.PtGetAgeSDL()
        if args == "":
            print "xCheat.InstantPellets: ERROR.  Must specify a recipe value as argument."
        else:
            PelletsPresent = sdl["ercaPelletMachine"][0]
            if PelletsPresent:
                print "xCheat.InstantPellets: ERROR.  Must flush current pellets before using this cheat."
            else:
                iarg = string.atoi(args)
                if iarg == 0:
                    iarg = 1
                recipeSDL = (iarg + 300)
                if recipeSDL < 1:
                    recipeSDL = 1
                print "xCheat.InstantPellets: 5 pellets now created with Recipe of %d." % (iarg)
                sdl["ercaPellet1"] = (recipeSDL,)
                sdl["ercaPellet2"] = (recipeSDL,)
                sdl["ercaPellet3"] = (recipeSDL,)
                sdl["ercaPellet4"] = (recipeSDL,)
                sdl["ercaPellet5"] = (recipeSDL,)
コード例 #3
0
def ResetBahro(args):
    import Plasma
    #import PlasmaTypes
    ageName = Plasma.PtGetAgeName()
    if ageName == "Cleft":
        sdl = Plasma.PtGetAgeSDL()
        sdl["clftSceneBahroUnseen"] = (1,)
コード例 #4
0
ファイル: xCheat.py プロジェクト: cwalther/moul-scripts
def SetSDL(varNameAndVal):
    import Plasma
    ageSDL = Plasma.PtGetAgeSDL()
    varNameAndValList = varNameAndVal.split("_")
    varName = varNameAndValList[0]
    newval = int(varNameAndValList[1])
    oldval = ageSDL[varName][0]
    if newval == oldval:
        print "xCheat.SetSDL(): won't change, %s is already = %d" % (varName,
                                                                     newval)
        return
    ageName = Plasma.PtGetAgeName()
    if ageName == "Personal":
        vault = Plasma.ptVault()
        psnlSDL = vault.getPsnlAgeSDL()
        FoundValue = psnlSDL.findVar(varName)
        FoundValue.setInt(newval)
        vault.updatePsnlAgeSDL(psnlSDL)
    else:
        ageSDL.setFlags(varName, 1, 1)
        ageSDL.sendToClients(varName)
        #ageSDL.setNotify(self.key,varName,0.0)
        ageSDL[varName] = (newval, )

    print "xCheat.SetSDL(): changing %s to %d" % (varName, newval)
コード例 #5
0
def GetSDL(varName):
    """
    GetSDL is used to get the value of an Age SDL variable by name.
    Expects one argument:
     (string) VariableName
    """
    import Plasma

    if not varName:
        print("xCheat.GetSDL(): GetSDL takes one argument: SDL variable name is required.\n Use 'all' to list all variables for the current Age.")
        return

    ageName = Plasma.PtGetAgeName()
    try:
        ageSDL = Plasma.PtGetAgeSDL()
    except:
        print(("xCheat.GetSDL(): Unable to retrieve SDL for '{}'.".format(ageName)))
        return

    varList = []
    if varName == "all":
        if ageName == "Personal":
            varRecord = Plasma.ptVault().getPsnlAgeSDL()
            if varRecord:
                varList = varRecord.getVarList()
        else:
            vault = Plasma.ptAgeVault()
            if vault:
                varRecord = vault.getAgeSDL()
                if varRecord:
                    varList = varRecord.getVarList()

        if not varList:
            print("xCheat.GetSDL(): Couldn't retrieve SDL list.")
            return

        maxlen = len(max(varList, key=len))
        for var in varList:
            try:
                if len(ageSDL[var]) == 0:
                    val = ""
                else:
                    val = ageSDL[var][0]
                print(("xCheat.GetSDL(): {:>{width}}  =  {}".format(var, val, width=maxlen)))
            except:
                print(("xCheat.GetSDL(): Error retrieving value for '{}'.".format(var)))
    else:
        try:
            if len(ageSDL[varName]) == 0:
                print(("xCheat.GetSDL():  SDL variable '{}' is not set.".format(varName)))
            else:
                print(("xCheat.GetSDL(): {}  =  {}".format(varName, ageSDL[varName][0])))
        except:
            print(("xCheat.GetSDL(): SDL variable '{}' not found.".format(varName)))
            return
コード例 #6
0
def HideObject(objectname):
    #Hides and disables a sceneobject
    #print "hide:"+objectname
    agename = Plasma.PtGetAgeName()
    try:
        av = Plasma.PtFindSceneobject(objectname, agename)
    except:
        print "_UamUtils.HideObject unable to find object: " + objectname
        return False
    av.draw.disable()
    av.physics.suppress(1)
    return True
コード例 #7
0
def SetSDL(varNameAndVal):
    """
    SetSDL is used to set an Age SDL variable by name. It expects two arguments:
    (string) VariableName, (int) NewValue
    """
    import Plasma

    if not varNameAndVal:
        print("xCheat.SetSDL(): SetSDL takes two arguments: SDL variable name and new value are required.")
        return

    varNameAndValList = varNameAndVal.split("_")
    if (len(varNameAndValList) < 2) or varNameAndValList[1] == "":
        print("xCheat.SetSDL(): No new value specified.")
        return
    varName = varNameAndValList[0]
    try:
        newval = int(varNameAndValList[1])
    except ValueError:
        print(("xCheat.SetSDL(): Can't use '{}'. Only numerical SDL values are supported.".format(varNameAndValList[1])))
        return

    ageName = Plasma.PtGetAgeName()
    try:
        ageSDL = Plasma.PtGetAgeSDL()
    except:
        print(("xCheat.SetSDL(): Unable to retrieve SDL for '{}'.".format(ageName)))
        return

    try:
        oldval = ageSDL[varName][0]
    except KeyError:
        print(("xCheat.SetSDL(): SDL variable '{}' not found.".format(varName)))
        return

    if newval == oldval:
        print(("xCheat.SetSDL(): Not changing value, '{}' is already {}.".format(varName, newval)))
        return

    if ageName == "Personal":
        vault = Plasma.ptVault()
        psnlSDL = vault.getPsnlAgeSDL()
        FoundValue = psnlSDL.findVar(varName)
        FoundValue.setInt(newval)
        vault.updatePsnlAgeSDL(psnlSDL)
    else:
        ageSDL.setFlags(varName, 1, 1)
        ageSDL.sendToClients(varName)
        ageSDL[varName] = (newval,)

    print(("xCheat.SetSDL(): Setting '{}' to {} (was {}).".format(varName, newval, oldval)))
コード例 #8
0
def GetSDL(varName):
    import Plasma
    ageName = Plasma.PtGetAgeName()
    ageSDL = Plasma.PtGetAgeSDL()
    varList = []
    if varName == "all":
        vault = Plasma.ptVault()
#        myAges = vault.getAgesIOwnFolder()
#        myAges = myAges.getChildNodeRefList()
#        for ageInfo in myAges:
#            link = ageInfo.getChild()
#            link = link.upcastToAgeLinkNode()
#            info = link.getAgeInfo()
#            if not info:
#                continue
#            tmpAgeName = info.getAgeFilename()
#            if ageName == tmpAgeName:

        if ageName == "Personal":
            varRecord = vault.getPsnlAgeSDL()
            varList = varRecord.getVarList()
        else:
            #link = ageInfo.getChild()
            #if link.getType() == PlasmaVaultConstants.PtVaultNodeTypes.kSDLNode:
            #thisSDL = link.upcastToSDLNode()
            #thisSDL = info.getAgeSDL()
            #varRecord = ageSDL.getStateDataRecord()
            #varList = ageSDL.getVarList()
            pass

        if varList == []:
            print "xCheat.GetSDL(): couldn't retrieve SDL list"
            return
        for var in varList:
            try:
                val = ageSDL[var][0]
                print "xCheat.GetSDL():\t%s\t\t=  %d" % (var,val)
            except:
                pass
    else:
        try:
            val = ageSDL[varName][0]
            print "xCheat.GetSDL(): %s = %d" % (varName,val)
        except:
            print "xCheat.GetSDL(): %s not found!" % (varName)
コード例 #9
0
def CheckRecipe(args):
    import Plasma
    ageName = Plasma.PtGetAgeName()
    if ageName == "Ercana":
        sdl = Plasma.PtGetAgeSDL()
        Pellet1 = sdl["ercaPellet1"][0]
        Pellet2 = sdl["ercaPellet2"][0]
        Pellet3 = sdl["ercaPellet3"][0]
        Pellet4 = sdl["ercaPellet4"][0]
        Pellet5 = sdl["ercaPellet5"][0]
        pelletList = [Pellet1,Pellet2,Pellet3,Pellet4,Pellet5]
        testVal = 0
        for recipeSDL in pelletList:
            if recipeSDL > 0:
                testVal = 1
                break
        if testVal:
            recipe = (recipeSDL - 300)
            print "xCheat.CheckRecipe: Recipe of current pellet(s) = %d." % (recipe)
        else:
            print "xCheat.CheckRecipe: No pellets currently exist, therefore no recipe."
コード例 #10
0
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
コード例 #11
0
def IsThisRestorationAge():
    #import Plasma
    return _IsRestorationAge(Plasma.PtGetAgeName())
コード例 #12
0
def GetAgeName():
    return Plasma.PtGetAgeName()