本文整理汇总了Python中Plasma类的典型用法代码示例。如果您正苦于以下问题:Python Plasma类的具体用法?Python Plasma怎么用?Python Plasma使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Plasma类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GenerateCleftSolution
def GenerateCleftSolution(args):
import Plasma
import xRandom
solutionlist = [3,2,5,0]
cleftSolList = [3,2,5,0]
while _AreListsEquiv(solutionlist, cleftSolList):
solutionlist = []
while len(solutionlist) < 4:
newint = xRandom.randint(0,6)
if not newint in solutionlist:
solutionlist.append(newint)
vault = Plasma.ptVault()
entry = vault.findChronicleEntry("BahroCave")
entry.removeAllNodes()
if entry != None:
agelist = ["Teledahn", "Garrison", "Garden", "Kadish"]
for v in range(len(agelist)):
newnode = Plasma.ptVaultChronicleNode(0)
newnode.chronicleSetName(agelist[v])
ageVal = str(solutionlist[v])
newnode.chronicleSetValue("1," + ageVal + "," + str(v + 1))
#newnode.chronicleSetValue("1," + str(solutionlist[v]) + "," + str(v + 1))
entry.addNode(newnode)
print "%s solution is %s" % (agelist[v], ageVal)
示例2: GetChildInfo
def GetChildInfo(args):
import Plasma
vault = Plasma.ptVault()
hoodGUID = vault.getLinkToMyNeighborhood().getAgeInfo().getAgeInstanceGuid()
print "hoodGUID: ",hoodGUID
parentname = None
agevault = Plasma.ptAgeVault()
ageinfo = agevault.getAgeInfo()
#agerules = agevault.getLinkingRules()
parent = ageinfo.getParentAgeLink()
if parent == None:
agename = ageinfo.getAgeFilename()
print "not a child age. age = ",agename
#print "with linking rules: ",agerules
return
parentinfo = parent.getAgeInfo()
parentname = parentinfo.getAgeFilename()
parentGUID = parentinfo.getAgeInstanceGuid()
print "parentGUID: ",parentGUID
if parentname == "Neighborhood":
if hoodGUID == parentGUID:
print "child of hood: yes"
else:
print "child of hood: different"
else:
print "child of hood: no"
示例3: GetAgeJourneyCloths
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()
示例4: GetSDL
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
示例5: GetMarkersAddGZLink
def GetMarkersAddGZLink():
agelinks = Plasma.ptVault().getAgesIOwnFolder().getChildNodeRefList()
for agelink in agelinks:
aln = agelink.getChild().upcastToAgeLinkNode()
age = aln.getAgeInfo().getAgeFilename()
if age=="GreatZero":
spawnpoint = Plasma.ptSpawnPointInfo("Great Zero","BigRoomLinkInPoint")
aln.addSpawnPoint(spawnpoint)
aln.save()
return True
return False
示例6: ImportMarkers
def ImportMarkers(args):
"args = 'filename folder'"
import Plasma
import PlasmaVaultConstants
arglist = args.split()
if len(arglist) < 2:
print 'ERROR - not enough arguments - ImportMarkers "filename foldername")'
return
filename = arglist[0]
try:
dfile = open(filename+'.py','r')
except IOError:
print "ERROR - file %d could not be found" % (filename+'.py')
return
dfile.close()
argresidual = args[len(filename)+1:]
#== find the folder where the markerfolders might be
# search thru the age journal folders
vault = Plasma.ptVault()
jfolder = None
master_agefolder = vault.getAgeJournalsFolder()
if type(master_agefolder) != type(None):
agefolderRefs = master_agefolder.getChildNodeRefList()
for agefolderRef in agefolderRefs:
agefolder = agefolderRef.getChild()
agefolder = agefolder.upcastToFolderNode()
if type(agefolder) != type(None):
# might be a foldername with spaces! so see if it starts with the name
if argresidual.startswith(agefolder.folderGetName()):
jfolder = agefolder
argresidual = argresidual[len(agefolder.folderGetName())+1:]
if jfolder:
exec("import %s" % (filename))
exec("mgs = %s.mgs" % (filename))
for mg in mgs:
# need to try to find the game to stick these in
jfolderRefs = jfolder.getChildNodeRefList()
for jref in jfolderRefs:
jnode = jref.getChild()
jnode = jnode.upcastToMarkerListNode()
# is it a marker folder list?
if type(jnode) != type(None):
# is it named the right one?
if jnode.folderGetName() == mg[1]:
# yes, add the markers to this game
for marker in mg[0][4]:
nMarker = Plasma.ptVaultMarkerNode(PlasmaVaultConstants.PtVaultNodePermissionFlags.kDefaultPermissions)
nMarker.markerSetText(marker[0])
pos = Plasma.ptPoint3(marker[1],marker[2],marker[3])
nMarker.markerSetPosition(pos)
nMarker.markerSetAge(marker[4])
nMarker.markerSetGPS(marker[5],marker[6],marker[7])
jnode.addNode(nMarker)
示例7: RemoveMarkerTag
def RemoveMarkerTag(args):
import Plasma
import PlasmaKITypes
newlevel = "0"
vault = Plasma.ptVault()
# is there a chronicle for the GZ games?
entry = vault.findChronicleEntry(PlasmaKITypes.kChronicleKIMarkerLevel)
if type(entry) != type(None):
entry.chronicleSetValue(newlevel)
entry.save()
# is there a chronicle for the GZ games?
entry = vault.findChronicleEntry(PlasmaKITypes.kChronicleGZGames)
if type(entry) != type(None):
entry.chronicleSetValue("0")
entry.save()
# is there a chronicle for the GZ games?
entry = vault.findChronicleEntry(PlasmaKITypes.kChronicleGZMarkersAquired)
if type(entry) != type(None):
entry.chronicleSetValue("")
entry.save()
Plasma.PtSendKIMessage(PlasmaKITypes.kGZUpdated,0)
# get rid of the CGZ marker games
MGs = [ 'MG01','MG02','MG03','MG04','MG05','MG06','MG07','MG08','MG09','MG10','MG11','MG12','MG13','MG14']
for mg in MGs:
entry = vault.findChronicleEntry(mg)
if type(entry) != type(None):
entry.chronicleSetValue("")
entry.save()
entry = vault.findChronicleEntry("CGZPlaying")
if type(entry) != type(None):
entry.chronicleSetValue("")
entry.save()
示例8: ShowHiddenFolder
def ShowHiddenFolder(args):
import Plasma
# search thru the age journal folders
vault = Plasma.ptVault()
jfolder = None
master_agefolder = vault.getAgeJournalsFolder()
if type(master_agefolder) != type(None):
agefolderRefs = master_agefolder.getChildNodeRefList()
for agefolderRef in agefolderRefs:
agefolder = agefolderRef.getChild()
agefolder = agefolder.upcastToFolderNode()
if type(agefolder) != type(None):
# look for the Hidden folder
if "Hidden" == agefolder.folderGetName():
jfolder = agefolder
break
if jfolder:
# need to try to find the game
print "Hidden folder contents:"
folderRefs = jfolder.getChildNodeRefList()
for jref in folderRefs:
jnode = jref.getChild()
jnode = jnode.upcastToMarkerListNode()
# is it a marker folder list?
if type(jnode) != type(None):
# is it named the right one?
print "markerFolder - ",jnode.folderGetName()
else:
print "There is no Hidden folder"
示例9: PtUpdateGZGamesChonicles
def PtUpdateGZGamesChonicles(GZPlaying,MarkerGottenColor,MarkerToGetColor,MarkerGottenNumber,MarkerToGetNumber):
"Update the GZ chronicle variable"
import Plasma
import PlasmaTypes
vault = Plasma.ptVault()
# is there a chronicle for the GZ games?
entry = vault.findChronicleEntry(kChronicleGZGames)
try:
upstring = "%d %s:%s %d:%d" % (GZPlaying,MarkerGottenColor,MarkerToGetColor,MarkerGottenNumber,MarkerToGetNumber)
if type(entry) != type(None):
entry.chronicleSetValue(upstring)
entry.save()
else:
# if there is none, then just add another entry
vault.addChronicleEntry(kChronicleGZGames,kChronicleGZGamesType,upstring)
except TypeError:
if type(GZPlaying) != type(0):
PlasmaTypes.PtDebugPrint("PtUpdateGZGamesChronicle: GZPlaying wrong type (should be integer)",level=PlasmaTypes.kErrorLevel )
pass
if type(MarkerToGetColor) != type(""):
PlasmaTypes.PtDebugPrint("PtUpdateGZGamesChronicle: GZPlaying wrong type (should be string)",level=PlasmaTypes.kErrorLevel )
pass
if type(MarkerGottenColor) != type(""):
PlasmaTypes.PtDebugPrint("PtUpdateGZGamesChronicle: GZPlaying wrong type (should be string)",level=PlasmaTypes.kErrorLevel )
pass
if type(MarkerToGetNumber) != type(0):
PlasmaTypes.PtDebugPrint("PtUpdateGZGamesChronicle: GZPlaying wrong type (should be integer)",level=PlasmaTypes.kErrorLevel )
pass
if type(MarkerGottenNumber) != type(0):
PlasmaTypes.PtDebugPrint("PtUpdateGZGamesChronicle: GZPlaying wrong type (should be integer)",level=PlasmaTypes.kErrorLevel )
pass
pass
示例10: PtVerifyGZMarker
def PtVerifyGZMarker():
import Plasma
import PlasmaTypes
# get current GZ Game state
(GZPlaying,MarkerGottenColor,MarkerToGetColor,MarkerGottenNumber,MarkerToGetNumber) = PtDetermineGZ()
# make sure there is room for the capture marker
if GZPlaying:
# set the marker status to 'gotten'
# ...in the GZ marker chronicle
vault = Plasma.ptVault()
# is there a chronicle for the GZ games?
entry = vault.findChronicleEntry(kChronicleGZMarkersAquired)
if type(entry) != type(None):
markers = entry.chronicleGetValue()
# get what was really gotten
totalGotten = markers.count(kGZMarkerCaptured)
KIMarkerLevel = PtDetermineKIMarkerLevel()
if KIMarkerLevel > kKIMarkerFirstLevel:
# if this is the second wave of markers (or beyond)
totalGotten -= 5
if totalGotten < 0:
totalGotten = 0
if totalGotten > MarkerToGetNumber:
totalGotten = MarkerToGetNumber
if totalGotten != MarkerGottenNumber:
PlasmaTypes.PtDebugPrint("PtVerifyGZMarker: Error! Gotten different than real. They say=%d We say=%d"%(MarkerGottenNumber,totalGotten),level=PlasmaTypes.kErrorLevel )
MarkerGottenNumber = totalGotten
# save update to chronicle
PtUpdateGZGamesChonicles(GZPlaying,MarkerGottenColor,MarkerToGetColor,MarkerGottenNumber,MarkerToGetNumber)
Plasma.PtSendKIMessage(kGZUpdated,0)
return (GZPlaying,MarkerGottenColor,MarkerToGetColor,MarkerGottenNumber,MarkerToGetNumber)
示例11: GetLakeScore
def GetLakeScore(self):
import Plasma
lakeScoreList = Plasma.ptScoreMgr().getGlobalScores("LakeScore")
if lakeScoreList:
print "the global LakeScore = ",lakeScoreList[0].getValue()
else:
print "no LakeScore found!"
示例12: PtGetCGZGameState
def PtGetCGZGameState(whichGame):
"Get the CGZ Game level"
# assume that they have none...
import Plasma
import PlasmaTypes
if whichGame >= kCGZFirstGame and whichGame <= kCGZFinalGame:
vault = Plasma.ptVault()
entry = vault.findChronicleEntry(kChronicleCalGZMarkersAquired)
if type(entry) != type(None):
allStates = entry.chronicleGetValue()
PlasmaTypes.PtDebugPrint("PlasmaKITypes:PtGetCGZGameLevel current chronicle is %s"%(allStates),level=PlasmaTypes.kDebugDumpLevel)
state = kCGZMarkerInactive # assume inactive
try:
state = allStates[whichGame]
except LookupError:
PlasmaTypes.PtDebugPrint("PlasmaKITypes:PtGetCGZGameLevel - CGZ marker game not there? chron=%s"%(allStates),level=PlasmaTypes.kErrorLevel)
pass
return state
else:
PlasmaTypes.PtDebugPrint("PlasmaKITypes:PtGetCGZGameLevel no chronicle yet",level=PlasmaTypes.kDebugDumpLevel)
else:
PlasmaTypes.PtDebugPrint("PlasmaKITypes:PtGetCGZGameLevel - invalid CGZ game of %d"%(whichGame),level=PlasmaTypes.kErrorLevel)
pass
# if couldn't be determine... just assume lowest form
return kCGZMarkerInactive
示例13: _IGetYeeshaPageDefs
def _IGetYeeshaPageDefs(self, old_method = BlackBarBodyKIHandler.xKI.IGetYeeshaPageDefs):
print "_UamModReltopages._IGetYeeshaPageDefs"
result = old_method(self)
#Can only change this while in your Relto
import Plasma
vault = Plasma.ptVault()
if not vault.inMyPersonalAge():
result += "<pb><pb><font size=20><p align=center>You can only change the fan-made pages while on your Relto."
return result
#Get the current status of the pages
import uam
chronstr = uam.GetAgeChronicle("UamReltoPages") #on, off, or unattained
pages = _UamUtils._StringToDict(chronstr)
for page in ReltoPages:
pagedict = ReltoPages[page]
pagenum = int(pagedict["pagenum"])
lang = _UamUtils.GetLanguage()
print "language: "+`lang`
linktext = pagedict["text--"+lang]
linknum = pagenum + 200 #just to get it out of Cyan's hair
turnedon = 1 #1 or 0
status = pages.get(page,pagedict["default"]) #Get the status or use the default for this page.
print "status: "+status
if status=="on":
turnedon = 1
else:
turnedon = 0 #either off or unattained
if status=="on" or status=="off":
result += '<pb><font size=20><p align=center>'+linktext+'<pb><img src="xYeeshaPageAlphaSketchFiremarbles*1#0.hsm" align=center check=00ff18,00800c,'+str(turnedon)+' link='+str(linknum)+'>'
return result
示例14: PtGetMarkerGameChronicle
def PtGetMarkerGameChronicle():
import Plasma
vault = Plasma.ptVault()
chron = vault.findChronicleEntry("MarkerBrain")
if chron is None:
vault.addChronicleEntry("MarkerBrain", 0, "")
return vault.findChronicleEntry("MarkerBrain")
return chron
示例15: GZGetMarkers
def GZGetMarkers(args):
import Plasma
import PlasmaKITypes
import string
try:
markersToGet = string.atoi(args)
except ValueError:
markersToGet = 0
if markersToGet:
vault = Plasma.ptVault()
# is there a chronicle for the GZ games?
entry = vault.findChronicleEntry(PlasmaKITypes.kChronicleGZGames)
if type(entry) != type(None):
gameString = entry.chronicleGetValue()
gargs = gameString.split()
if len(gargs) == 3:
try:
markerGame = string.atoi(gargs[0])
colors = gargs[1].split(':')
markerGottenColor = colors[0]
markerToGetColor = colors[1]
outof = gargs[2].split(':')
markerGottenNumber = string.atoi(outof[0])
markerToGetNumber = string.atoi(outof[1])
newgotten = markerGottenNumber + markersToGet
if newgotten > markerToGetNumber:
newgotten = markerToGetNumber
print "Updating markers gotten to %d from %d" % (newgotten,markerToGetNumber)
upstring = "%d %s:%s %d:%d" % (markerGame,markerGottenColor,markerToGetColor,newgotten,markerToGetNumber)
entry.chronicleSetValue(upstring)
entry.save()
# just pick some marker to have gotten
# is there a chronicle for the GZ games?
entry = vault.findChronicleEntry(PlasmaKITypes.kChronicleGZMarkersAquired)
if type(entry) != type(None):
markers = entry.chronicleGetValue()
for mnum in range(markersToGet):
markerIdx = markers.index(PlasmaKITypes.kGZMarkerAvailable)
if markerIdx >= 0 and markerIdx < len(markers):
# Set the marker to "captured"
if len(markers)-(markerIdx+1) != 0:
markers = markers[:markerIdx] + PlasmaKITypes.kGZMarkerCaptured + markers[-(len(markers)-(markerIdx+1)):]
else:
markers = markers[:markerIdx] + PlasmaKITypes.kGZMarkerCaptured
print "Update marker #%d - out string is '%s'" % (markerIdx+1,markers)
entry.chronicleSetValue(markers)
entry.save()
# update the
Plasma.PtSendKIMessage(PlasmaKITypes.kGZUpdated,0)
return
except ValueError:
print "xKI:GZ - error trying to read GZGames Chronicle '%s'" % (gameString)
else:
print "xKI:GZ - error GZGames string formation error (len=%d)" % (len(gargs))
else:
# if there is none, then error
print "Error - there is no GZMarker game going!"