Exemplo n.º 1
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))
Exemplo n.º 2
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)
Exemplo n.º 3
0
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
Exemplo n.º 4
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."
Exemplo n.º 5
0
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)    
Exemplo n.º 6
0
def InstaPellets(args):
    import Plasma
    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 = int(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,)
Exemplo n.º 7
0
def GetAgeSdl(varname, index=0):
    #index could default to 0
    sdl = Plasma.PtGetAgeSDL()
    return sdl[varname][index]
Exemplo n.º 8
0
def SetAgeSdl(varname, value, index=0):
    #index could default to 0
    sdl = Plasma.PtGetAgeSDL()
    sdl.setFlags(varname, 1, 1)
    sdl.sendToClients(varname)
    sdl.setIndex(varname, index, value)
Exemplo n.º 9
0
def GetAgeSdl(varname, index=0):
    sdl = Plasma.PtGetAgeSDL()
    return sdl[varname][index]