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()
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)
def PtVerifyGZMarker(): import Plasma import PlasmaTypes (GZPlaying, MarkerGottenColor, MarkerToGetColor, MarkerGottenNumber, MarkerToGetNumber) = PtDetermineGZ() if GZPlaying: vault = Plasma.ptVault() entry = vault.findChronicleEntry(kChronicleGZMarkersAquired) if (type(entry) != type(None)): markers = entry.chronicleGetValue() totalGotten = markers.count(kGZMarkerCaptured) KIMarkerLevel = PtDetermineKIMarkerLevel() if (KIMarkerLevel > kKIMarkerFirstLevel): 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 PtUpdateGZGamesChonicles(GZPlaying, MarkerGottenColor, MarkerToGetColor, MarkerGottenNumber, MarkerToGetNumber) Plasma.PtSendKIMessage(kGZUpdated, 0) return (GZPlaying, MarkerGottenColor, MarkerToGetColor, MarkerGottenNumber, MarkerToGetNumber)
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!"
def GZGiveMeFullAccess(args): import Plasma import PlasmaKITypes Plasma.PtSendKIMessageInt(PlasmaKITypes.kUpgradeKIMarkerLevel,PlasmaKITypes.kKIMarkerNormalLevel) #Make sure to update the markers too, as we don't want them to display!!! import grtzKIMarkerMachine grtzKIMarkerMachine.UpdateGZMarkers(PlasmaKITypes.kGZMarkerUploaded) #reset KI's marker display resetString = "0 off:off 0:0" vault = Plasma.ptVault() entry = vault.findChronicleEntry(PlasmaKITypes.kChronicleGZGames) if type(entry) != type(None): entry.chronicleSetValue(resetString) # Finally, update the KI display Plasma.PtSendKIMessage(PlasmaKITypes.kGZUpdated,0)
def KIPhasedAllOn(args): import Plasma import PlasmaKITypes Plasma.PtSendKIMessage(PlasmaKITypes.kKIPhasedAllOn,0)