From db8ac4c0aa5467269c071010624df19c9878921d Mon Sep 17 00:00:00 2001 From: Branan Purvine-Riley Date: Mon, 28 Mar 2011 14:10:31 -0700 Subject: [PATCH 001/287] Initial import --- LICENSE.txt | 622 ++ Python/Ahnonay.py | 228 + Python/AhnonayCathedral.py | 75 + Python/AhnyVogondolaRide.py | 113 + Python/BahroCave.py | 49 + Python/BaronCityOffice.py | 71 + Python/Cleft.py | 263 + Python/Dereno.py | 45 + Python/Descent.py | 77 + Python/EderDelin.py | 46 + Python/EderTsogal.py | 46 + Python/Ercana.py | 46 + Python/ErcanaCitySilo.py | 355 + Python/Garden.py | 71 + Python/GardenBugs.py | 345 + Python/Garrison.py | 115 + Python/Gira.py | 70 + Python/GiraBugs.py | 258 + Python/GiraCave1.py | 71 + Python/GiraDoor.py | 88 + Python/GiraSteam.py | 720 ++ Python/GreatTreePub.py | 42 + Python/GreatZero.py | 41 + Python/Jalak.py | 46 + Python/Kadish.py | 71 + Python/Kveer.py | 54 + Python/LiveBahroCaves.py | 81 + Python/Minkata.py | 48 + Python/Myst.py | 50 + Python/Negilahn.py | 45 + Python/Neighborhood.py | 67 + Python/Neighborhood02.py | 120 + Python/Nexus.py | 51 + Python/Payiferen.py | 45 + Python/PelletBahroCave.py | 309 + Python/Personal.py | 206 + Python/PhilRelto.py | 56 + Python/SpyRoom.py | 62 + Python/Teledahn.py | 71 + Python/Tetsonot.py | 45 + Python/ahnyIslandHut.py | 209 + Python/ahnyKadishDoor.py | 271 + Python/ahnyKadishHut.py | 166 + Python/ahnyLinkBookGUIPopup.py | 391 + Python/ahnyMaintRoom.py | 194 + Python/ahnyPressurePlates.py | 371 + Python/ahnyQuabs.py | 468 + Python/ahnySaveCloth.py | 262 + Python/ahnyTrees.py | 110 + Python/ahnyVogondolaRideV2.py | 799 ++ Python/airstream.py | 54 + Python/bhroBahroBlueSpiral.py | 106 + Python/bhroBahroMink.py | 85 + Python/bhroBahroPOTS.py | 104 + Python/bhroBahroPod.py | 156 + Python/bhroBahroYeeshaCave.py | 837 ++ Python/bhroStarfieldOrCavern.py | 73 + Python/city.py | 208 + Python/clftEndingCredits.py | 236 + Python/clftGetPersonalBook.py | 241 + Python/clftImager.py | 930 ++ Python/clftIntroMusic.py | 106 + Python/clftNpcZandi.py | 546 ++ Python/clftRS.py | 135 + Python/clftTreeLadder.py | 78 + Python/clftWindmill.py | 237 + Python/clftYeeshaPage08.py | 225 + Python/clftYeeshaPageImager.py | 212 + Python/dsntKILightMachine.py | 241 + Python/dsntWatsonGUIPopup.py | 221 + Python/ercaBakePellets.py | 587 ++ Python/ercaBakeryElev.py | 290 + Python/ercaCallCar.py | 157 + Python/ercaControlRoom.py | 562 ++ Python/ercaHrvstr.py | 740 ++ Python/ercaLadderHatch.py | 226 + Python/ercaOvenScope.py | 662 ++ Python/ercaPelletRoom.py | 767 ++ Python/ercaSDLIntShowHide.py | 128 + Python/giraAgeSDLBoolRespondLightpost.py | 110 + Python/grsn1stFloorClimb.py | 145 + Python/grsnDownElevator.py | 299 + Python/grsnElevRespTrigger.py | 46 + Python/grsnEmgrPhase0.py | 101 + Python/grsnGearRide.py | 359 + Python/grsnGetKI.py | 72 + Python/grsnMainWallPython.py | 253 + Python/grsnNexusBookMachine.py | 122 + Python/grsnPageMaster.py | 116 + Python/grsnPowerOn.py | 731 ++ Python/grsnPrisonRandomSDLItems.py | 165 + Python/grsnTrnCtrBridgeSafety.py | 72 + Python/grsnTrnCtrDoorEnter.py | 144 + Python/grsnTrnCtrDoorExit.py | 144 + Python/grsnTrnCtrDoors.py | 288 + Python/grsnWallImagerDisplayN.py | 130 + Python/grsnWallImagerDisplayS.py | 126 + Python/grsnWallPython.py | 1233 +++ Python/grsnWellJump.py | 63 + Python/grtzAccessDoors.py | 278 + Python/grtzGZMaster.py | 142 + Python/grtzKIMarkerMachine.py | 534 + Python/grtzMarkerGames.py | 485 + Python/grtzMarkerScopeGUI.py | 505 + Python/grtzMarkerScopes.py | 203 + Python/islmEmgrPhase0.py | 153 + Python/islmGZBeamBrain.py | 120 + Python/islmMemorialImager.py | 362 + Python/islmPassable.py | 56 + Python/islmPodMap.py | 140 + Python/islmRandomBahroScream.py | 83 + Python/islmRegisterNexusLink.py | 106 + Python/jlakField.py | 839 ++ Python/kdshGlowInTheDark.py | 535 + Python/kdshPillarRoom.py | 645 ++ Python/kdshShadowPath.py | 327 + Python/kdshTreeRings.py | 386 + Python/kdshTreeRingsSolution.py | 380 + Python/kdshVault.py | 389 + Python/kemoEmgrPhase0.py | 101 + Python/kemoJourneyClothGate.py | 257 + Python/kemoStormWaterModifier.py | 130 + Python/krelPodium.py | 118 + Python/minkCage.py | 146 + Python/minkDayClicks.py | 123 + Python/minkDayNight.py | 143 + Python/minkSymbols.py | 196 + Python/mymod.py | 178 + Python/mystFireplace.py | 417 + Python/nb01DRCImager.py | 200 + Python/nb01Easel.py | 104 + Python/nb01EmgrPhase0.py | 270 + Python/nb01RPSGame.py | 765 ++ Python/nb01RegisterNexusLink.py | 156 + Python/nb01UpdateHoodInfoImager.py | 262 + Python/nglnFogTweener.py | 330 + Python/nglnTreeMonkey.py | 271 + Python/nglnUrwinBrain.py | 382 + Python/nxusBookMachine.py | 2728 ++++++ Python/payiBahroSymbol.py | 84 + Python/payiUrwinBrain.py | 484 + Python/philBookshelf.py | 184 + Python/plasma/Plasma.py | 9803 +++++++++++++++++++ Python/plasma/PlasmaConstants.py | 256 + Python/plasma/PlasmaControlKeys.py | 108 + Python/plasma/PlasmaGame.py | 2615 +++++ Python/plasma/PlasmaGameConstants.py | 159 + Python/plasma/PlasmaKITypes.py | 469 + Python/plasma/PlasmaNetConstants.py | 34 + Python/plasma/PlasmaTypes.py | 820 ++ Python/plasma/PlasmaVaultConstants.py | 98 + Python/plasma/glue.py | 208 + Python/plasma/pch.py | 286 + Python/plasma/ptWordFilter.py | 140 + Python/psnlBahroPoles.py | 1258 +++ Python/psnlBookshelf.py | 1956 ++++ Python/psnlBugs.py | 117 + Python/psnlCalendarStones.py | 210 + Python/psnlMyCloset.py | 197 + Python/psnlVaultSDLBoolRespond.py | 125 + Python/psnlVaultSDLBoolShowHide.py | 126 + Python/psnlYeeshaPageChanges.py | 270 + Python/stupStartUp.py | 100 + Python/system/Bastion.py | 177 + Python/system/ConfigParser.py | 616 ++ Python/system/HTMLParser.py | 382 + Python/system/StringIO.py | 251 + Python/system/UserDict.py | 164 + Python/system/__future__.py | 104 + Python/system/ascii.py | 35 + Python/system/atexit.py | 50 + Python/system/bdb.py | 564 ++ Python/system/bisect.py | 78 + Python/system/calendar.py | 246 + Python/system/cmd.py | 396 + Python/system/codecs.py | 712 ++ Python/system/colorsys.py | 123 + Python/system/commands.py | 84 + Python/system/compileall.py | 155 + Python/system/copy.py | 430 + Python/system/copy_reg.py | 189 + Python/system/decompyle.py | 1500 +++ Python/system/difflib.py | 1317 +++ Python/system/dircache.py | 44 + Python/system/dis.py | 227 + Python/system/dospath.py | 341 + Python/system/encoding_utf_8.py | 30 + Python/system/encodings.py | 132 + Python/system/filecmp.py | 306 + Python/system/fileinput.py | 359 + Python/system/fnmatch.py | 107 + Python/system/fpformat.py | 142 + Python/system/getopt.py | 211 + Python/system/gettext.py | 493 + Python/system/glob.py | 56 + Python/system/ihooks.py | 514 + Python/system/imghdr.py | 154 + Python/system/imputil.py | 719 ++ Python/system/inspect.py | 799 ++ Python/system/keyword.py | 97 + Python/system/knee.py | 126 + Python/system/linecache.py | 100 + Python/system/locale.py | 778 ++ Python/system/markupbase.py | 383 + Python/system/mutex.py | 50 + Python/system/netrc.py | 111 + Python/system/ntpath.py | 493 + Python/system/opcode.py | 188 + Python/system/os.py | 659 ++ Python/system/pdb.py | 957 ++ Python/system/pickle.py | 1403 +++ Python/system/popen2.py | 202 + Python/system/posixpath.py | 414 + Python/system/pre.py | 656 ++ Python/system/profile.py | 555 ++ Python/system/pstats.py | 646 ++ Python/system/py_compile.py | 164 + Python/system/pyclbr.py | 344 + Python/system/random.py | 843 ++ Python/system/re.py | 6 + Python/system/regex_syntax.py | 53 + Python/system/repr.py | 117 + Python/system/shlex.py | 292 + Python/system/shutil.py | 171 + Python/system/site.py | 376 + Python/system/spark.py | 566 ++ Python/system/sre.py | 311 + Python/system/sre_compile.py | 487 + Python/system/sre_constants.py | 261 + Python/system/sre_parse.py | 739 ++ Python/system/stat.py | 86 + Python/system/statcache.py | 77 + Python/system/string.py | 382 + Python/system/symbol.py | 97 + Python/system/tabnanny.py | 326 + Python/system/token.py | 140 + Python/system/tokenize.py | 295 + Python/system/traceback.py | 301 + Python/system/types.py | 90 + Python/system/verify.py | 182 + Python/system/warnings.py | 259 + Python/system/weakref.py | 302 + Python/system/webbrowser.py | 369 + Python/system/whrandom.py | 140 + Python/tldn3FloorElevator.py | 282 + Python/tldnAquarium.py | 294 + Python/tldnBucketBrain.py | 1427 +++ Python/tldnEmgrPhase0.py | 123 + Python/tldnHatchLadderBottom.py | 167 + Python/tldnHatchLadderTop.py | 216 + Python/tldnLagoonBridge.py | 156 + Python/tldnPTPumpCount.py | 175 + Python/tldnPwrTwrPeriscope.py | 567 ++ Python/tldnShooterTrap.py | 62 + Python/tldnShroomieBrain.py | 244 + Python/tldnShroomieGate.py | 86 + Python/tldnSlavePrisonDoors.py | 304 + Python/tldnSlavePrisonPanels.py | 134 + Python/tldnVaporScope.py | 411 + Python/tldnWRCCBrain.py | 464 + Python/x2wayLever.py | 97 + Python/xACAEnglish.py | 156 + Python/xACAFrench.py | 156 + Python/xACAGerman.py | 156 + Python/xACAItalian.py | 155 + Python/xACAItems.py | 130 + Python/xACASpanish.py | 155 + Python/xAgeSDLBoolAndRespond.py | 130 + Python/xAgeSDLBoolAndSet.py | 89 + Python/xAgeSDLBoolCondResp.py | 91 + Python/xAgeSDLBoolRespond.py | 126 + Python/xAgeSDLBoolSet.py | 83 + Python/xAgeSDLBoolShowHide.py | 130 + Python/xAgeSDLBoolToggle.py | 112 + Python/xAgeSDLBoolToggleDependent.py | 113 + Python/xAgeSDLIntActEnabler.py | 102 + Python/xAgeSDLIntChange.py | 140 + Python/xAgeSDLIntRespList.py | 121 + Python/xAgeSDLIntShowHide.py | 138 + Python/xAgeSDLIntStartStopResp.py | 103 + Python/xAgeSDLIntStateListResp.py | 191 + Python/xAgeSDLVarSet.py | 128 + Python/xAvatarCustomization.py | 2420 +++++ Python/xBlueSpiral.py | 393 + Python/xBookGUIs.py | 43 + Python/xBugsGoAway.py | 81 + Python/xButtonLeverSwitch.py | 66 + Python/xButtonLeverSwitchPowered.py | 96 + Python/xCalendarStar.py | 162 + Python/xCensor.py | 67 + Python/xCensorEnglish.py | 371 + Python/xCensorFilters.py | 557 ++ Python/xChatChannelRegion.py | 195 + Python/xCheat.py | 842 ++ Python/xChronicleCounter.py | 82 + Python/xClassStructureJournalEnglish.py | 47 + Python/xClassStructureJournalFrench.py | 47 + Python/xClassStructureJournalGerman.py | 47 + Python/xClassStructureJournalItalian.py | 47 + Python/xClassStructureJournalSpanish.py | 47 + Python/xClearAge.py | 56 + Python/xConcentration.py | 214 + Python/xDialogClothingBB.py | 301 + Python/xDialogStartUp.py | 734 ++ Python/xDialogToggle.py | 139 + Python/xDisableFirstPersonCam.py | 70 + Python/xDisableOnGameMode.py | 68 + Python/xDummyJournalEnglish.py | 28 + Python/xDynTextDefs.py | 44 + Python/xDynTextDefsEnglish.py | 171 + Python/xDynTextDefsFrench.py | 174 + Python/xDynTextDefsGerman.py | 177 + Python/xDynTextDefsItalian.py | 176 + Python/xDynTextDefsSpanish.py | 176 + Python/xDynTextObj.py | 87 + Python/xDynaTextBoy.py | 76 + Python/xEnglish.py | 95 + Python/xEnum.py | 96 + Python/xEventTrigger.py | 84 + Python/xExitSubworld.py | 71 + Python/xFogDistTweener.py | 254 + Python/xFogSet.py | 104 + Python/xFrench.py | 144 + Python/xGZHelpJournalEnglish.py | 90 + Python/xGZHelpJournalFrench.py | 91 + Python/xGZHelpJournalGerman.py | 91 + Python/xGZMarker.py | 148 + Python/xGahreesenInfoJournalEnglish.py | 162 + Python/xGahreesenInfoJournalFrench.py | 167 + Python/xGahreesenInfoJournalGerman.py | 168 + Python/xGahreesenInfoJournalItalian.py | 162 + Python/xGahreesenInfoJournalSpanish.py | 164 + Python/xGerman.py | 144 + Python/xGrsnWallHelpJournalEnglish.py | 71 + Python/xGrsnWallHelpJournalFrench.py | 71 + Python/xGrsnWallHelpJournalGerman.py | 71 + Python/xHighLevelStarTrekDoor.py | 324 + Python/xIniAudio.py | 322 + Python/xIniDisplay.py | 130 + Python/xIniHelper.py | 189 + Python/xIniInput.py | 89 + Python/xIniNumSounds.py | 73 + Python/xInvite.py | 161 + Python/xItalian.py | 96 + Python/xJournalBookDefs.py | 99 + Python/xJournalBookDefsEnglish.py | 83 + Python/xJournalBookDefsFrench.py | 81 + Python/xJournalBookDefsGerman.py | 81 + Python/xJournalBookDefsItalian.py | 69 + Python/xJournalBookDefsSpanish.py | 69 + Python/xJournalBookGUIPopup.py | 193 + Python/xJourneyClothGate.py | 324 + Python/xJourneyCloths.py | 240 + Python/xJourneyClothsGen2.py | 377 + Python/xKI.py | 10762 +++++++++++++++++++++ Python/xKIEnglish.py | 373 + Python/xKIExtChatCommands.py | 124 + Python/xKIFrench.py | 375 + Python/xKIGerman.py | 375 + Python/xKIItalian.py | 376 + Python/xKIJournalEnglish.py | 77 + Python/xKIJournalFrench.py | 77 + Python/xKIJournalGerman.py | 74 + Python/xKIJournalItalian.py | 77 + Python/xKIJournalSpanish.py | 77 + Python/xKINexusFAQJournalEnglish.py | 188 + Python/xKISpanish.py | 376 + Python/xKingAileshJournalEnglish.py | 41 + Python/xKingAileshJournalFrench.py | 41 + Python/xKingAileshJournalGerman.py | 40 + Python/xKingAileshJournalItalian.py | 42 + Python/xKingAileshJournalSpanish.py | 41 + Python/xKingAsemlefJournalEnglish.py | 58 + Python/xKingAsemlefJournalFrench.py | 58 + Python/xKingAsemlefJournalGerman.py | 58 + Python/xKingAsemlefJournalItalian.py | 57 + Python/xKingAsemlefJournalSpanish.py | 58 + Python/xKingDemathJournalEnglish.py | 66 + Python/xKingDemathJournalFrench.py | 66 + Python/xKingDemathJournalGerman.py | 66 + Python/xKingDemathJournalItalian.py | 66 + Python/xKingDemathJournalSpanish.py | 66 + Python/xKingKerathJournalEnglish.py | 56 + Python/xKingKerathJournalFrench.py | 56 + Python/xKingKerathJournalGerman.py | 56 + Python/xKingKerathJournalItalian.py | 56 + Python/xKingKerathJournalSpanish.py | 56 + Python/xKingMararonJournalEnglish.py | 41 + Python/xKingMararonJournalFrench.py | 39 + Python/xKingMararonJournalGerman.py | 39 + Python/xKingMeemenJournalEnglish.py | 72 + Python/xKingMeemenJournalFrench.py | 72 + Python/xKingMeemenJournalGerman.py | 72 + Python/xKingMeemenJournalItalian.py | 72 + Python/xKingMeemenJournalSpanish.py | 72 + Python/xKingNaygenJournalEnglish.py | 52 + Python/xKingNaygenJournalFrench.py | 52 + Python/xKingNaygenJournalGerman.py | 52 + Python/xKingNaygenJournalItalian.py | 52 + Python/xKingNaygenJournalSpanish.py | 52 + Python/xKingRinerefJournalEnglish.py | 78 + Python/xKingRinerefJournalFrench.py | 78 + Python/xKingRinerefJournalGerman.py | 78 + Python/xKingRinerefJournalItalian.py | 80 + Python/xKingRinerefJournalSpanish.py | 79 + Python/xKingShomatJournalEnglish.py | 49 + Python/xKingShomatJournalFrench.py | 47 + Python/xKingShomatJournalGerman.py | 49 + Python/xKingShomatJournalItalian.py | 49 + Python/xKingShomatJournalSpanish.py | 49 + Python/xKingYableshanJournalEnglish.py | 61 + Python/xKingYableshanJournalFrench.py | 55 + Python/xKingYableshanJournalGerman.py | 61 + Python/xLinkingBookDefs.py | 338 + Python/xLinkingBookGUIPopup.py | 1157 +++ Python/xLocTools.py | 142 + Python/xLocalization.py | 217 + Python/xMarkerGameKIDisplay.py | 377 + Python/xMarkerGameManager.py | 553 ++ Python/xMarkerGameUtils.py | 238 + Python/xMarriageJournalEnglish.py | 78 + Python/xMarriageJournalFrench.py | 78 + Python/xMarriageJournalGerman.py | 76 + Python/xMarriageJournalItalian.py | 78 + Python/xMarriageJournalSpanish.py | 79 + Python/xMaturityJournalEnglish.py | 45 + Python/xMaturityJournalFrench.py | 45 + Python/xMaturityJournalGerman.py | 45 + Python/xMaturityJournalItalian.py | 46 + Python/xMaturityJournalSpanish.py | 45 + Python/xMusicBox.py | 205 + Python/xMusicBoxAddSong.py | 104 + Python/xNegilahnJournalEnglish.py | 72 + Python/xNegilahnJournalFrench.py | 72 + Python/xNegilahnJournalGerman.py | 72 + Python/xNexusEnglish.py | 48 + Python/xNexusFrench.py | 48 + Python/xNexusGerman.py | 48 + Python/xNexusItalian.py | 48 + Python/xNexusSpanish.py | 48 + Python/xOpeningSequence.py | 427 + Python/xOptionsEnglish.py | 134 + Python/xOptionsFrench.py | 133 + Python/xOptionsGerman.py | 133 + Python/xOptionsItalian.py | 133 + Python/xOptionsMenu.py | 2204 +++++ Python/xOptionsSpanish.py | 134 + Python/xPassiveIndicatorLight.py | 83 + Python/xPodBahroSymbol.py | 127 + Python/xPodBattery.py | 455 + Python/xPoetry1JournalEnglish.py | 200 + Python/xPotsSymbol.py | 142 + Python/xPoweredLightSwitch.py | 109 + Python/xPoweredStarTrekDoor.py | 130 + Python/xPregnancyJournalEnglish.py | 42 + Python/xPregnancyJournalFrench.py | 42 + Python/xPregnancyJournalGerman.py | 42 + Python/xPregnancyJournalItalian.py | 42 + Python/xPregnancyJournalSpanish.py | 42 + Python/xPsnlVaultSDL.py | 181 + Python/xRPSEnglish.py | 34 + Python/xRPSFrench.py | 34 + Python/xRPSGerman.py | 34 + Python/xRPSItalian.py | 34 + Python/xRPSSpanish.py | 34 + Python/xRandom.py | 152 + Python/xRandomBoolChange.py | 161 + Python/xRunResponder.py | 59 + Python/xSaveCloth.py | 204 + Python/xSaveScreenCapture.py | 50 + Python/xSharperJournalEnglish.py | 337 + Python/xSharperJournalFrench.py | 329 + Python/xSharperJournalGerman.py | 329 + Python/xSharperJournalItalian.py | 291 + Python/xSharperJournalSpanish.py | 284 + Python/xShomatStoryJournalEnglish.py | 92 + Python/xShomatStoryJournalFrench.py | 92 + Python/xShomatStoryJournalGerman.py | 92 + Python/xShomatStoryJournalItalian.py | 92 + Python/xShomatStoryJournalSpanish.py | 92 + Python/xSimpleImager.py | 503 + Python/xSitAugment.py | 133 + Python/xSndLogTracks.py | 115 + Python/xSpanish.py | 96 + Python/xStandardDoor.py | 356 + Python/xStarTrekDoor.py | 103 + Python/xStateToggler.py | 109 + Python/xTakableClothing.py | 472 + Python/xTelescope.py | 210 + Python/xTrackActivatorUsage.py | 76 + Python/xTriggerNamedResponder.py | 61 + Python/xUruCreditsJournalEnglish.py | 175 + Python/xUruCreditsJournalFrench.py | 353 + Python/xUruCreditsJournalGerman.py | 353 + Python/xUruCreditsJournalItalian.py | 350 + Python/xUruCreditsJournalSpanish.py | 351 + Python/xVisitorPayDialog.py | 111 + Python/xVisitorUtils.py | 49 + Python/xYeeshaJournalEnglish.py | 85 + Python/xYeeshaJournalFrench.py | 92 + Python/xYeeshaJournalGerman.py | 92 + Python/xYeeshaJournalItalian.py | 82 + Python/xYeeshaJournalSpanish.py | 88 + Python/xYeeshaPages.py | 292 + SDL/BaronCityOffice.sdl | 74 + SDL/Cleft.sdl | 198 + SDL/Dereno.sdl | 54 + SDL/Descent.sdl | 89 + SDL/EderDelin.sdl | 134 + SDL/EderTsogal.sdl | 97 + SDL/Ercana.sdl | 772 ++ SDL/ErcanaCitySilo.sdl | 46 + SDL/Garden.sdl | 46 + SDL/Garrison.sdl | 898 ++ SDL/Gira.sdl | 189 + SDL/GreatTreePub.sdl | 69 + SDL/GreatZero.sdl | 124 + SDL/Jalak.sdl | 141 + SDL/Kadish.sdl | 837 ++ SDL/Kveer.sdl | 45 + SDL/Minkata.sdl | 142 + SDL/Myst.sdl | 86 + SDL/Negilahn.sdl | 273 + SDL/Neighborhood.sdl | 1824 ++++ SDL/Neighborhood02.sdl | 280 + SDL/Nexus.sdl | 105 + SDL/Payiferen.sdl | 101 + SDL/PelletBahroCave.sdl | 63 + SDL/Personal.sdl | 2372 +++++ SDL/PhilRelto.sdl | 50 + SDL/RestorationGuild.sdl | 60 + SDL/SpyRoom.sdl | 55 + SDL/Teledahn.sdl | 938 ++ SDL/Tetsonot.sdl | 54 + SDL/ahnonay.sdl | 343 + SDL/ahnonaycathedral.sdl | 38 + SDL/animation.sdl | 97 + SDL/avatar.sdl | 175 + SDL/ayoheek.sdl | 52 + SDL/city.sdl | 3968 ++++++++ SDL/cloneMessage.sdl | 48 + SDL/clothing.sdl | 71 + SDL/grsnTrnCtrDoors.sdl | 36 + SDL/morph.sdl | 53 + SDL/particle.sdl | 42 + SDL/physical.sdl | 48 + SDL/responder.sdl | 49 + SDL/sound.sdl | 54 + SDL/tldnPwrTwrPeriscope.sdl | 39 + SDL/tldnVaporScope.sdl | 36 + SDL/tldnWRCCBrain.sdl | 34 + SDL/x2wayLever.sdl | 34 + SDL/xButtonLeverSwitchPowered.sdl | 34 + SDL/xChatChannel.sdl | 35 + SDL/xConcentration.sdl | 33 + SDL/xHighLevelStarTrekDoor.sdl | 30 + SDL/xPassiveIndicatorLight.sdl | 34 + SDL/xPoweredLightSwitch.sdl | 35 + SDL/xPoweredStarTrekDoor.sdl | 34 + SDL/xStateToggler.sdl | 30 + SDL/xTelescope.sdl | 34 + SDL/xregion.sdl | 40 + dat/Ahnonay.age | 37 + dat/Ahnonay.fni | 4 + dat/AhnonayCathedral.age | 7 + dat/AhnonayCathedral.fni | 4 + dat/AvatarCloset.age | 7 + dat/AvatarCustomization.age | 6 + dat/AvatarCustomization.fni | 11 + dat/BahroCave.age | 8 + dat/BahroCave.fni | 8 + dat/BaronCityOffice.age | 12 + dat/BaronCityOffice.fni | 3 + dat/Cleft.age | 92 + dat/Cleft.fni | 10 + dat/CustomAvatars.age | 21 + dat/Dereno.age | 8 + dat/Dereno.fni | 6 + dat/Descent.age | 22 + dat/Descent.fni | 7 + dat/EderDelin.age | 7 + dat/EderDelin.fni | 5 + dat/EderTsogal.age | 7 + dat/EderTsogal.fni | 5 + dat/Ercana.age | 39 + dat/Ercana.fni | 5 + dat/ErcanaCitySilo.age | 8 + dat/ErcanaCitySilo.fni | 5 + dat/GUI.age | 74 + dat/Garden.age | 11 + dat/Garden.fni | 5 + dat/Garrison.age | 90 + dat/Garrison.fni | 7 + dat/GarrisonNexus.age | 7 + dat/Gira.age | 25 + dat/Gira.fni | 9 + dat/GlobalAnimations.age | 376 + dat/GlobalAvatars.age | 9 + dat/GlobalClothing.age | 14 + dat/GlobalMarkers.age | 7 + dat/GreatTreePub.age | 8 + dat/GreatTreePub.fni | 4 + dat/GreatZero.age | 11 + dat/GreatZero.fni | 8 + dat/GuildPub-Cartographers.age | 7 + dat/GuildPub-Cartographers.fni | 4 + dat/GuildPub-Greeters.age | 7 + dat/GuildPub-Greeters.fni | 4 + dat/GuildPub-Maintainers.age | 7 + dat/GuildPub-Maintainers.fni | 4 + dat/GuildPub-Messengers.age | 7 + dat/GuildPub-Messengers.fni | 4 + dat/GuildPub-Writers.age | 7 + dat/GuildPub-Writers.fni | 4 + dat/Jalak.age | 8 + dat/Jalak.fni | 5 + dat/Kadish.age | 38 + dat/Kadish.fni | 6 + dat/Kveer.age | 7 + dat/Kveer.fni | 4 + dat/LiveBahroCaves.age | 11 + dat/LiveBahroCaves.fni | 8 + dat/Minkata.age | 13 + dat/Minkata.fni | 4 + dat/Myst.age | 15 + dat/Negilahn.age | 8 + dat/Negilahn.fni | 6 + dat/Neighborhood.age | 28 + dat/Neighborhood.fni | 7 + dat/Neighborhood02.age | 15 + dat/Neighborhood02.fni | 7 + dat/Nexus.age | 8 + dat/Nexus.fni | 4 + dat/Payiferen.age | 7 + dat/Payiferen.fni | 4 + dat/PelletBahroCave.age | 7 + dat/PelletBahroCave.fni | 8 + dat/Personal.age | 11 + dat/Personal.fni | 4 + dat/PhilRelto.fni | 4 + dat/StartUp.age | 7 + dat/Teledahn.age | 71 + dat/Teledahn.fni | 7 + dat/Tetsonot.age | 7 + dat/Tetsonot.fni | 7 + dat/city.age | 59 + dat/city.fni | 8 + dat/philRelto.age | 7 + dat/spyroom.age | 6 + dat/spyroom.fni | 19 + 650 files changed, 156058 insertions(+) create mode 100644 LICENSE.txt create mode 100644 Python/Ahnonay.py create mode 100644 Python/AhnonayCathedral.py create mode 100644 Python/AhnyVogondolaRide.py create mode 100644 Python/BahroCave.py create mode 100644 Python/BaronCityOffice.py create mode 100644 Python/Cleft.py create mode 100644 Python/Dereno.py create mode 100644 Python/Descent.py create mode 100644 Python/EderDelin.py create mode 100644 Python/EderTsogal.py create mode 100644 Python/Ercana.py create mode 100644 Python/ErcanaCitySilo.py create mode 100644 Python/Garden.py create mode 100644 Python/GardenBugs.py create mode 100644 Python/Garrison.py create mode 100644 Python/Gira.py create mode 100644 Python/GiraBugs.py create mode 100644 Python/GiraCave1.py create mode 100644 Python/GiraDoor.py create mode 100644 Python/GiraSteam.py create mode 100644 Python/GreatTreePub.py create mode 100644 Python/GreatZero.py create mode 100644 Python/Jalak.py create mode 100644 Python/Kadish.py create mode 100644 Python/Kveer.py create mode 100644 Python/LiveBahroCaves.py create mode 100644 Python/Minkata.py create mode 100644 Python/Myst.py create mode 100644 Python/Negilahn.py create mode 100644 Python/Neighborhood.py create mode 100644 Python/Neighborhood02.py create mode 100644 Python/Nexus.py create mode 100644 Python/Payiferen.py create mode 100644 Python/PelletBahroCave.py create mode 100644 Python/Personal.py create mode 100644 Python/PhilRelto.py create mode 100644 Python/SpyRoom.py create mode 100644 Python/Teledahn.py create mode 100644 Python/Tetsonot.py create mode 100644 Python/ahnyIslandHut.py create mode 100644 Python/ahnyKadishDoor.py create mode 100644 Python/ahnyKadishHut.py create mode 100644 Python/ahnyLinkBookGUIPopup.py create mode 100644 Python/ahnyMaintRoom.py create mode 100644 Python/ahnyPressurePlates.py create mode 100644 Python/ahnyQuabs.py create mode 100644 Python/ahnySaveCloth.py create mode 100644 Python/ahnyTrees.py create mode 100644 Python/ahnyVogondolaRideV2.py create mode 100644 Python/airstream.py create mode 100644 Python/bhroBahroBlueSpiral.py create mode 100644 Python/bhroBahroMink.py create mode 100644 Python/bhroBahroPOTS.py create mode 100644 Python/bhroBahroPod.py create mode 100644 Python/bhroBahroYeeshaCave.py create mode 100644 Python/bhroStarfieldOrCavern.py create mode 100644 Python/city.py create mode 100644 Python/clftEndingCredits.py create mode 100644 Python/clftGetPersonalBook.py create mode 100644 Python/clftImager.py create mode 100644 Python/clftIntroMusic.py create mode 100644 Python/clftNpcZandi.py create mode 100644 Python/clftRS.py create mode 100644 Python/clftTreeLadder.py create mode 100644 Python/clftWindmill.py create mode 100644 Python/clftYeeshaPage08.py create mode 100644 Python/clftYeeshaPageImager.py create mode 100644 Python/dsntKILightMachine.py create mode 100644 Python/dsntWatsonGUIPopup.py create mode 100644 Python/ercaBakePellets.py create mode 100644 Python/ercaBakeryElev.py create mode 100644 Python/ercaCallCar.py create mode 100644 Python/ercaControlRoom.py create mode 100644 Python/ercaHrvstr.py create mode 100644 Python/ercaLadderHatch.py create mode 100644 Python/ercaOvenScope.py create mode 100644 Python/ercaPelletRoom.py create mode 100644 Python/ercaSDLIntShowHide.py create mode 100644 Python/giraAgeSDLBoolRespondLightpost.py create mode 100644 Python/grsn1stFloorClimb.py create mode 100644 Python/grsnDownElevator.py create mode 100644 Python/grsnElevRespTrigger.py create mode 100644 Python/grsnEmgrPhase0.py create mode 100644 Python/grsnGearRide.py create mode 100644 Python/grsnGetKI.py create mode 100644 Python/grsnMainWallPython.py create mode 100644 Python/grsnNexusBookMachine.py create mode 100644 Python/grsnPageMaster.py create mode 100644 Python/grsnPowerOn.py create mode 100644 Python/grsnPrisonRandomSDLItems.py create mode 100644 Python/grsnTrnCtrBridgeSafety.py create mode 100644 Python/grsnTrnCtrDoorEnter.py create mode 100644 Python/grsnTrnCtrDoorExit.py create mode 100644 Python/grsnTrnCtrDoors.py create mode 100644 Python/grsnWallImagerDisplayN.py create mode 100644 Python/grsnWallImagerDisplayS.py create mode 100644 Python/grsnWallPython.py create mode 100644 Python/grsnWellJump.py create mode 100644 Python/grtzAccessDoors.py create mode 100644 Python/grtzGZMaster.py create mode 100644 Python/grtzKIMarkerMachine.py create mode 100644 Python/grtzMarkerGames.py create mode 100644 Python/grtzMarkerScopeGUI.py create mode 100644 Python/grtzMarkerScopes.py create mode 100644 Python/islmEmgrPhase0.py create mode 100644 Python/islmGZBeamBrain.py create mode 100644 Python/islmMemorialImager.py create mode 100644 Python/islmPassable.py create mode 100644 Python/islmPodMap.py create mode 100644 Python/islmRandomBahroScream.py create mode 100644 Python/islmRegisterNexusLink.py create mode 100644 Python/jlakField.py create mode 100644 Python/kdshGlowInTheDark.py create mode 100644 Python/kdshPillarRoom.py create mode 100644 Python/kdshShadowPath.py create mode 100644 Python/kdshTreeRings.py create mode 100644 Python/kdshTreeRingsSolution.py create mode 100644 Python/kdshVault.py create mode 100644 Python/kemoEmgrPhase0.py create mode 100644 Python/kemoJourneyClothGate.py create mode 100644 Python/kemoStormWaterModifier.py create mode 100644 Python/krelPodium.py create mode 100644 Python/minkCage.py create mode 100644 Python/minkDayClicks.py create mode 100644 Python/minkDayNight.py create mode 100644 Python/minkSymbols.py create mode 100644 Python/mymod.py create mode 100644 Python/mystFireplace.py create mode 100644 Python/nb01DRCImager.py create mode 100644 Python/nb01Easel.py create mode 100644 Python/nb01EmgrPhase0.py create mode 100644 Python/nb01RPSGame.py create mode 100644 Python/nb01RegisterNexusLink.py create mode 100644 Python/nb01UpdateHoodInfoImager.py create mode 100644 Python/nglnFogTweener.py create mode 100644 Python/nglnTreeMonkey.py create mode 100644 Python/nglnUrwinBrain.py create mode 100644 Python/nxusBookMachine.py create mode 100644 Python/payiBahroSymbol.py create mode 100644 Python/payiUrwinBrain.py create mode 100644 Python/philBookshelf.py create mode 100644 Python/plasma/Plasma.py create mode 100644 Python/plasma/PlasmaConstants.py create mode 100644 Python/plasma/PlasmaControlKeys.py create mode 100644 Python/plasma/PlasmaGame.py create mode 100644 Python/plasma/PlasmaGameConstants.py create mode 100644 Python/plasma/PlasmaKITypes.py create mode 100644 Python/plasma/PlasmaNetConstants.py create mode 100644 Python/plasma/PlasmaTypes.py create mode 100644 Python/plasma/PlasmaVaultConstants.py create mode 100644 Python/plasma/glue.py create mode 100644 Python/plasma/pch.py create mode 100644 Python/plasma/ptWordFilter.py create mode 100644 Python/psnlBahroPoles.py create mode 100644 Python/psnlBookshelf.py create mode 100644 Python/psnlBugs.py create mode 100644 Python/psnlCalendarStones.py create mode 100644 Python/psnlMyCloset.py create mode 100644 Python/psnlVaultSDLBoolRespond.py create mode 100644 Python/psnlVaultSDLBoolShowHide.py create mode 100644 Python/psnlYeeshaPageChanges.py create mode 100644 Python/stupStartUp.py create mode 100644 Python/system/Bastion.py create mode 100644 Python/system/ConfigParser.py create mode 100644 Python/system/HTMLParser.py create mode 100644 Python/system/StringIO.py create mode 100644 Python/system/UserDict.py create mode 100644 Python/system/__future__.py create mode 100644 Python/system/ascii.py create mode 100644 Python/system/atexit.py create mode 100644 Python/system/bdb.py create mode 100644 Python/system/bisect.py create mode 100644 Python/system/calendar.py create mode 100644 Python/system/cmd.py create mode 100644 Python/system/codecs.py create mode 100644 Python/system/colorsys.py create mode 100644 Python/system/commands.py create mode 100644 Python/system/compileall.py create mode 100644 Python/system/copy.py create mode 100644 Python/system/copy_reg.py create mode 100644 Python/system/decompyle.py create mode 100644 Python/system/difflib.py create mode 100644 Python/system/dircache.py create mode 100644 Python/system/dis.py create mode 100644 Python/system/dospath.py create mode 100644 Python/system/encoding_utf_8.py create mode 100644 Python/system/encodings.py create mode 100644 Python/system/filecmp.py create mode 100644 Python/system/fileinput.py create mode 100644 Python/system/fnmatch.py create mode 100644 Python/system/fpformat.py create mode 100644 Python/system/getopt.py create mode 100644 Python/system/gettext.py create mode 100644 Python/system/glob.py create mode 100644 Python/system/ihooks.py create mode 100644 Python/system/imghdr.py create mode 100644 Python/system/imputil.py create mode 100644 Python/system/inspect.py create mode 100644 Python/system/keyword.py create mode 100644 Python/system/knee.py create mode 100644 Python/system/linecache.py create mode 100644 Python/system/locale.py create mode 100644 Python/system/markupbase.py create mode 100644 Python/system/mutex.py create mode 100644 Python/system/netrc.py create mode 100644 Python/system/ntpath.py create mode 100644 Python/system/opcode.py create mode 100644 Python/system/os.py create mode 100644 Python/system/pdb.py create mode 100644 Python/system/pickle.py create mode 100644 Python/system/popen2.py create mode 100644 Python/system/posixpath.py create mode 100644 Python/system/pre.py create mode 100644 Python/system/profile.py create mode 100644 Python/system/pstats.py create mode 100644 Python/system/py_compile.py create mode 100644 Python/system/pyclbr.py create mode 100644 Python/system/random.py create mode 100644 Python/system/re.py create mode 100644 Python/system/regex_syntax.py create mode 100644 Python/system/repr.py create mode 100644 Python/system/shlex.py create mode 100644 Python/system/shutil.py create mode 100644 Python/system/site.py create mode 100644 Python/system/spark.py create mode 100644 Python/system/sre.py create mode 100644 Python/system/sre_compile.py create mode 100644 Python/system/sre_constants.py create mode 100644 Python/system/sre_parse.py create mode 100644 Python/system/stat.py create mode 100644 Python/system/statcache.py create mode 100644 Python/system/string.py create mode 100644 Python/system/symbol.py create mode 100644 Python/system/tabnanny.py create mode 100644 Python/system/token.py create mode 100644 Python/system/tokenize.py create mode 100644 Python/system/traceback.py create mode 100644 Python/system/types.py create mode 100644 Python/system/verify.py create mode 100644 Python/system/warnings.py create mode 100644 Python/system/weakref.py create mode 100644 Python/system/webbrowser.py create mode 100644 Python/system/whrandom.py create mode 100644 Python/tldn3FloorElevator.py create mode 100644 Python/tldnAquarium.py create mode 100644 Python/tldnBucketBrain.py create mode 100644 Python/tldnEmgrPhase0.py create mode 100644 Python/tldnHatchLadderBottom.py create mode 100644 Python/tldnHatchLadderTop.py create mode 100644 Python/tldnLagoonBridge.py create mode 100644 Python/tldnPTPumpCount.py create mode 100644 Python/tldnPwrTwrPeriscope.py create mode 100644 Python/tldnShooterTrap.py create mode 100644 Python/tldnShroomieBrain.py create mode 100644 Python/tldnShroomieGate.py create mode 100644 Python/tldnSlavePrisonDoors.py create mode 100644 Python/tldnSlavePrisonPanels.py create mode 100644 Python/tldnVaporScope.py create mode 100644 Python/tldnWRCCBrain.py create mode 100644 Python/x2wayLever.py create mode 100644 Python/xACAEnglish.py create mode 100644 Python/xACAFrench.py create mode 100644 Python/xACAGerman.py create mode 100644 Python/xACAItalian.py create mode 100644 Python/xACAItems.py create mode 100644 Python/xACASpanish.py create mode 100644 Python/xAgeSDLBoolAndRespond.py create mode 100644 Python/xAgeSDLBoolAndSet.py create mode 100644 Python/xAgeSDLBoolCondResp.py create mode 100644 Python/xAgeSDLBoolRespond.py create mode 100644 Python/xAgeSDLBoolSet.py create mode 100644 Python/xAgeSDLBoolShowHide.py create mode 100644 Python/xAgeSDLBoolToggle.py create mode 100644 Python/xAgeSDLBoolToggleDependent.py create mode 100644 Python/xAgeSDLIntActEnabler.py create mode 100644 Python/xAgeSDLIntChange.py create mode 100644 Python/xAgeSDLIntRespList.py create mode 100644 Python/xAgeSDLIntShowHide.py create mode 100644 Python/xAgeSDLIntStartStopResp.py create mode 100644 Python/xAgeSDLIntStateListResp.py create mode 100644 Python/xAgeSDLVarSet.py create mode 100644 Python/xAvatarCustomization.py create mode 100644 Python/xBlueSpiral.py create mode 100644 Python/xBookGUIs.py create mode 100644 Python/xBugsGoAway.py create mode 100644 Python/xButtonLeverSwitch.py create mode 100644 Python/xButtonLeverSwitchPowered.py create mode 100644 Python/xCalendarStar.py create mode 100644 Python/xCensor.py create mode 100644 Python/xCensorEnglish.py create mode 100644 Python/xCensorFilters.py create mode 100644 Python/xChatChannelRegion.py create mode 100644 Python/xCheat.py create mode 100644 Python/xChronicleCounter.py create mode 100644 Python/xClassStructureJournalEnglish.py create mode 100644 Python/xClassStructureJournalFrench.py create mode 100644 Python/xClassStructureJournalGerman.py create mode 100644 Python/xClassStructureJournalItalian.py create mode 100644 Python/xClassStructureJournalSpanish.py create mode 100644 Python/xClearAge.py create mode 100644 Python/xConcentration.py create mode 100644 Python/xDialogClothingBB.py create mode 100644 Python/xDialogStartUp.py create mode 100644 Python/xDialogToggle.py create mode 100644 Python/xDisableFirstPersonCam.py create mode 100644 Python/xDisableOnGameMode.py create mode 100644 Python/xDummyJournalEnglish.py create mode 100644 Python/xDynTextDefs.py create mode 100644 Python/xDynTextDefsEnglish.py create mode 100644 Python/xDynTextDefsFrench.py create mode 100644 Python/xDynTextDefsGerman.py create mode 100644 Python/xDynTextDefsItalian.py create mode 100644 Python/xDynTextDefsSpanish.py create mode 100644 Python/xDynTextObj.py create mode 100644 Python/xDynaTextBoy.py create mode 100644 Python/xEnglish.py create mode 100644 Python/xEnum.py create mode 100644 Python/xEventTrigger.py create mode 100644 Python/xExitSubworld.py create mode 100644 Python/xFogDistTweener.py create mode 100644 Python/xFogSet.py create mode 100644 Python/xFrench.py create mode 100644 Python/xGZHelpJournalEnglish.py create mode 100644 Python/xGZHelpJournalFrench.py create mode 100644 Python/xGZHelpJournalGerman.py create mode 100644 Python/xGZMarker.py create mode 100644 Python/xGahreesenInfoJournalEnglish.py create mode 100644 Python/xGahreesenInfoJournalFrench.py create mode 100644 Python/xGahreesenInfoJournalGerman.py create mode 100644 Python/xGahreesenInfoJournalItalian.py create mode 100644 Python/xGahreesenInfoJournalSpanish.py create mode 100644 Python/xGerman.py create mode 100644 Python/xGrsnWallHelpJournalEnglish.py create mode 100644 Python/xGrsnWallHelpJournalFrench.py create mode 100644 Python/xGrsnWallHelpJournalGerman.py create mode 100644 Python/xHighLevelStarTrekDoor.py create mode 100644 Python/xIniAudio.py create mode 100644 Python/xIniDisplay.py create mode 100644 Python/xIniHelper.py create mode 100644 Python/xIniInput.py create mode 100644 Python/xIniNumSounds.py create mode 100644 Python/xInvite.py create mode 100644 Python/xItalian.py create mode 100644 Python/xJournalBookDefs.py create mode 100644 Python/xJournalBookDefsEnglish.py create mode 100644 Python/xJournalBookDefsFrench.py create mode 100644 Python/xJournalBookDefsGerman.py create mode 100644 Python/xJournalBookDefsItalian.py create mode 100644 Python/xJournalBookDefsSpanish.py create mode 100644 Python/xJournalBookGUIPopup.py create mode 100644 Python/xJourneyClothGate.py create mode 100644 Python/xJourneyCloths.py create mode 100644 Python/xJourneyClothsGen2.py create mode 100644 Python/xKI.py create mode 100644 Python/xKIEnglish.py create mode 100644 Python/xKIExtChatCommands.py create mode 100644 Python/xKIFrench.py create mode 100644 Python/xKIGerman.py create mode 100644 Python/xKIItalian.py create mode 100644 Python/xKIJournalEnglish.py create mode 100644 Python/xKIJournalFrench.py create mode 100644 Python/xKIJournalGerman.py create mode 100644 Python/xKIJournalItalian.py create mode 100644 Python/xKIJournalSpanish.py create mode 100644 Python/xKINexusFAQJournalEnglish.py create mode 100644 Python/xKISpanish.py create mode 100644 Python/xKingAileshJournalEnglish.py create mode 100644 Python/xKingAileshJournalFrench.py create mode 100644 Python/xKingAileshJournalGerman.py create mode 100644 Python/xKingAileshJournalItalian.py create mode 100644 Python/xKingAileshJournalSpanish.py create mode 100644 Python/xKingAsemlefJournalEnglish.py create mode 100644 Python/xKingAsemlefJournalFrench.py create mode 100644 Python/xKingAsemlefJournalGerman.py create mode 100644 Python/xKingAsemlefJournalItalian.py create mode 100644 Python/xKingAsemlefJournalSpanish.py create mode 100644 Python/xKingDemathJournalEnglish.py create mode 100644 Python/xKingDemathJournalFrench.py create mode 100644 Python/xKingDemathJournalGerman.py create mode 100644 Python/xKingDemathJournalItalian.py create mode 100644 Python/xKingDemathJournalSpanish.py create mode 100644 Python/xKingKerathJournalEnglish.py create mode 100644 Python/xKingKerathJournalFrench.py create mode 100644 Python/xKingKerathJournalGerman.py create mode 100644 Python/xKingKerathJournalItalian.py create mode 100644 Python/xKingKerathJournalSpanish.py create mode 100644 Python/xKingMararonJournalEnglish.py create mode 100644 Python/xKingMararonJournalFrench.py create mode 100644 Python/xKingMararonJournalGerman.py create mode 100644 Python/xKingMeemenJournalEnglish.py create mode 100644 Python/xKingMeemenJournalFrench.py create mode 100644 Python/xKingMeemenJournalGerman.py create mode 100644 Python/xKingMeemenJournalItalian.py create mode 100644 Python/xKingMeemenJournalSpanish.py create mode 100644 Python/xKingNaygenJournalEnglish.py create mode 100644 Python/xKingNaygenJournalFrench.py create mode 100644 Python/xKingNaygenJournalGerman.py create mode 100644 Python/xKingNaygenJournalItalian.py create mode 100644 Python/xKingNaygenJournalSpanish.py create mode 100644 Python/xKingRinerefJournalEnglish.py create mode 100644 Python/xKingRinerefJournalFrench.py create mode 100644 Python/xKingRinerefJournalGerman.py create mode 100644 Python/xKingRinerefJournalItalian.py create mode 100644 Python/xKingRinerefJournalSpanish.py create mode 100644 Python/xKingShomatJournalEnglish.py create mode 100644 Python/xKingShomatJournalFrench.py create mode 100644 Python/xKingShomatJournalGerman.py create mode 100644 Python/xKingShomatJournalItalian.py create mode 100644 Python/xKingShomatJournalSpanish.py create mode 100644 Python/xKingYableshanJournalEnglish.py create mode 100644 Python/xKingYableshanJournalFrench.py create mode 100644 Python/xKingYableshanJournalGerman.py create mode 100644 Python/xLinkingBookDefs.py create mode 100644 Python/xLinkingBookGUIPopup.py create mode 100644 Python/xLocTools.py create mode 100644 Python/xLocalization.py create mode 100644 Python/xMarkerGameKIDisplay.py create mode 100644 Python/xMarkerGameManager.py create mode 100644 Python/xMarkerGameUtils.py create mode 100644 Python/xMarriageJournalEnglish.py create mode 100644 Python/xMarriageJournalFrench.py create mode 100644 Python/xMarriageJournalGerman.py create mode 100644 Python/xMarriageJournalItalian.py create mode 100644 Python/xMarriageJournalSpanish.py create mode 100644 Python/xMaturityJournalEnglish.py create mode 100644 Python/xMaturityJournalFrench.py create mode 100644 Python/xMaturityJournalGerman.py create mode 100644 Python/xMaturityJournalItalian.py create mode 100644 Python/xMaturityJournalSpanish.py create mode 100644 Python/xMusicBox.py create mode 100644 Python/xMusicBoxAddSong.py create mode 100644 Python/xNegilahnJournalEnglish.py create mode 100644 Python/xNegilahnJournalFrench.py create mode 100644 Python/xNegilahnJournalGerman.py create mode 100644 Python/xNexusEnglish.py create mode 100644 Python/xNexusFrench.py create mode 100644 Python/xNexusGerman.py create mode 100644 Python/xNexusItalian.py create mode 100644 Python/xNexusSpanish.py create mode 100644 Python/xOpeningSequence.py create mode 100644 Python/xOptionsEnglish.py create mode 100644 Python/xOptionsFrench.py create mode 100644 Python/xOptionsGerman.py create mode 100644 Python/xOptionsItalian.py create mode 100644 Python/xOptionsMenu.py create mode 100644 Python/xOptionsSpanish.py create mode 100644 Python/xPassiveIndicatorLight.py create mode 100644 Python/xPodBahroSymbol.py create mode 100644 Python/xPodBattery.py create mode 100644 Python/xPoetry1JournalEnglish.py create mode 100644 Python/xPotsSymbol.py create mode 100644 Python/xPoweredLightSwitch.py create mode 100644 Python/xPoweredStarTrekDoor.py create mode 100644 Python/xPregnancyJournalEnglish.py create mode 100644 Python/xPregnancyJournalFrench.py create mode 100644 Python/xPregnancyJournalGerman.py create mode 100644 Python/xPregnancyJournalItalian.py create mode 100644 Python/xPregnancyJournalSpanish.py create mode 100644 Python/xPsnlVaultSDL.py create mode 100644 Python/xRPSEnglish.py create mode 100644 Python/xRPSFrench.py create mode 100644 Python/xRPSGerman.py create mode 100644 Python/xRPSItalian.py create mode 100644 Python/xRPSSpanish.py create mode 100644 Python/xRandom.py create mode 100644 Python/xRandomBoolChange.py create mode 100644 Python/xRunResponder.py create mode 100644 Python/xSaveCloth.py create mode 100644 Python/xSaveScreenCapture.py create mode 100644 Python/xSharperJournalEnglish.py create mode 100644 Python/xSharperJournalFrench.py create mode 100644 Python/xSharperJournalGerman.py create mode 100644 Python/xSharperJournalItalian.py create mode 100644 Python/xSharperJournalSpanish.py create mode 100644 Python/xShomatStoryJournalEnglish.py create mode 100644 Python/xShomatStoryJournalFrench.py create mode 100644 Python/xShomatStoryJournalGerman.py create mode 100644 Python/xShomatStoryJournalItalian.py create mode 100644 Python/xShomatStoryJournalSpanish.py create mode 100644 Python/xSimpleImager.py create mode 100644 Python/xSitAugment.py create mode 100644 Python/xSndLogTracks.py create mode 100644 Python/xSpanish.py create mode 100644 Python/xStandardDoor.py create mode 100644 Python/xStarTrekDoor.py create mode 100644 Python/xStateToggler.py create mode 100644 Python/xTakableClothing.py create mode 100644 Python/xTelescope.py create mode 100644 Python/xTrackActivatorUsage.py create mode 100644 Python/xTriggerNamedResponder.py create mode 100644 Python/xUruCreditsJournalEnglish.py create mode 100644 Python/xUruCreditsJournalFrench.py create mode 100644 Python/xUruCreditsJournalGerman.py create mode 100644 Python/xUruCreditsJournalItalian.py create mode 100644 Python/xUruCreditsJournalSpanish.py create mode 100644 Python/xVisitorPayDialog.py create mode 100644 Python/xVisitorUtils.py create mode 100644 Python/xYeeshaJournalEnglish.py create mode 100644 Python/xYeeshaJournalFrench.py create mode 100644 Python/xYeeshaJournalGerman.py create mode 100644 Python/xYeeshaJournalItalian.py create mode 100644 Python/xYeeshaJournalSpanish.py create mode 100644 Python/xYeeshaPages.py create mode 100644 SDL/BaronCityOffice.sdl create mode 100644 SDL/Cleft.sdl create mode 100644 SDL/Dereno.sdl create mode 100644 SDL/Descent.sdl create mode 100644 SDL/EderDelin.sdl create mode 100644 SDL/EderTsogal.sdl create mode 100644 SDL/Ercana.sdl create mode 100644 SDL/ErcanaCitySilo.sdl create mode 100644 SDL/Garden.sdl create mode 100644 SDL/Garrison.sdl create mode 100644 SDL/Gira.sdl create mode 100644 SDL/GreatTreePub.sdl create mode 100644 SDL/GreatZero.sdl create mode 100644 SDL/Jalak.sdl create mode 100644 SDL/Kadish.sdl create mode 100644 SDL/Kveer.sdl create mode 100644 SDL/Minkata.sdl create mode 100644 SDL/Myst.sdl create mode 100644 SDL/Negilahn.sdl create mode 100644 SDL/Neighborhood.sdl create mode 100644 SDL/Neighborhood02.sdl create mode 100644 SDL/Nexus.sdl create mode 100644 SDL/Payiferen.sdl create mode 100644 SDL/PelletBahroCave.sdl create mode 100644 SDL/Personal.sdl create mode 100644 SDL/PhilRelto.sdl create mode 100644 SDL/RestorationGuild.sdl create mode 100644 SDL/SpyRoom.sdl create mode 100644 SDL/Teledahn.sdl create mode 100644 SDL/Tetsonot.sdl create mode 100644 SDL/ahnonay.sdl create mode 100644 SDL/ahnonaycathedral.sdl create mode 100644 SDL/animation.sdl create mode 100644 SDL/avatar.sdl create mode 100644 SDL/ayoheek.sdl create mode 100644 SDL/city.sdl create mode 100644 SDL/cloneMessage.sdl create mode 100644 SDL/clothing.sdl create mode 100644 SDL/grsnTrnCtrDoors.sdl create mode 100644 SDL/morph.sdl create mode 100644 SDL/particle.sdl create mode 100644 SDL/physical.sdl create mode 100644 SDL/responder.sdl create mode 100644 SDL/sound.sdl create mode 100644 SDL/tldnPwrTwrPeriscope.sdl create mode 100644 SDL/tldnVaporScope.sdl create mode 100644 SDL/tldnWRCCBrain.sdl create mode 100644 SDL/x2wayLever.sdl create mode 100644 SDL/xButtonLeverSwitchPowered.sdl create mode 100644 SDL/xChatChannel.sdl create mode 100644 SDL/xConcentration.sdl create mode 100644 SDL/xHighLevelStarTrekDoor.sdl create mode 100644 SDL/xPassiveIndicatorLight.sdl create mode 100644 SDL/xPoweredLightSwitch.sdl create mode 100644 SDL/xPoweredStarTrekDoor.sdl create mode 100644 SDL/xStateToggler.sdl create mode 100644 SDL/xTelescope.sdl create mode 100644 SDL/xregion.sdl create mode 100644 dat/Ahnonay.age create mode 100644 dat/Ahnonay.fni create mode 100644 dat/AhnonayCathedral.age create mode 100644 dat/AhnonayCathedral.fni create mode 100644 dat/AvatarCloset.age create mode 100644 dat/AvatarCustomization.age create mode 100644 dat/AvatarCustomization.fni create mode 100644 dat/BahroCave.age create mode 100644 dat/BahroCave.fni create mode 100644 dat/BaronCityOffice.age create mode 100644 dat/BaronCityOffice.fni create mode 100644 dat/Cleft.age create mode 100644 dat/Cleft.fni create mode 100644 dat/CustomAvatars.age create mode 100644 dat/Dereno.age create mode 100644 dat/Dereno.fni create mode 100644 dat/Descent.age create mode 100644 dat/Descent.fni create mode 100644 dat/EderDelin.age create mode 100644 dat/EderDelin.fni create mode 100644 dat/EderTsogal.age create mode 100644 dat/EderTsogal.fni create mode 100644 dat/Ercana.age create mode 100644 dat/Ercana.fni create mode 100644 dat/ErcanaCitySilo.age create mode 100644 dat/ErcanaCitySilo.fni create mode 100644 dat/GUI.age create mode 100644 dat/Garden.age create mode 100644 dat/Garden.fni create mode 100644 dat/Garrison.age create mode 100644 dat/Garrison.fni create mode 100644 dat/GarrisonNexus.age create mode 100644 dat/Gira.age create mode 100644 dat/Gira.fni create mode 100644 dat/GlobalAnimations.age create mode 100644 dat/GlobalAvatars.age create mode 100644 dat/GlobalClothing.age create mode 100644 dat/GlobalMarkers.age create mode 100644 dat/GreatTreePub.age create mode 100644 dat/GreatTreePub.fni create mode 100644 dat/GreatZero.age create mode 100644 dat/GreatZero.fni create mode 100644 dat/GuildPub-Cartographers.age create mode 100644 dat/GuildPub-Cartographers.fni create mode 100644 dat/GuildPub-Greeters.age create mode 100644 dat/GuildPub-Greeters.fni create mode 100644 dat/GuildPub-Maintainers.age create mode 100644 dat/GuildPub-Maintainers.fni create mode 100644 dat/GuildPub-Messengers.age create mode 100644 dat/GuildPub-Messengers.fni create mode 100644 dat/GuildPub-Writers.age create mode 100644 dat/GuildPub-Writers.fni create mode 100644 dat/Jalak.age create mode 100644 dat/Jalak.fni create mode 100644 dat/Kadish.age create mode 100644 dat/Kadish.fni create mode 100644 dat/Kveer.age create mode 100644 dat/Kveer.fni create mode 100644 dat/LiveBahroCaves.age create mode 100644 dat/LiveBahroCaves.fni create mode 100644 dat/Minkata.age create mode 100644 dat/Minkata.fni create mode 100644 dat/Myst.age create mode 100644 dat/Negilahn.age create mode 100644 dat/Negilahn.fni create mode 100644 dat/Neighborhood.age create mode 100644 dat/Neighborhood.fni create mode 100644 dat/Neighborhood02.age create mode 100644 dat/Neighborhood02.fni create mode 100644 dat/Nexus.age create mode 100644 dat/Nexus.fni create mode 100644 dat/Payiferen.age create mode 100644 dat/Payiferen.fni create mode 100644 dat/PelletBahroCave.age create mode 100644 dat/PelletBahroCave.fni create mode 100644 dat/Personal.age create mode 100644 dat/Personal.fni create mode 100644 dat/PhilRelto.fni create mode 100644 dat/StartUp.age create mode 100644 dat/Teledahn.age create mode 100644 dat/Teledahn.fni create mode 100644 dat/Tetsonot.age create mode 100644 dat/Tetsonot.fni create mode 100644 dat/city.age create mode 100644 dat/city.fni create mode 100644 dat/philRelto.age create mode 100644 dat/spyroom.age create mode 100644 dat/spyroom.fni diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000000..92bc3d8dc1 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,622 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + diff --git a/Python/Ahnonay.py b/Python/Ahnonay.py new file mode 100644 index 0000000000..e6ab65dedc --- /dev/null +++ b/Python/Ahnonay.py @@ -0,0 +1,228 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Ahnonay.py +Age: Ahnonay +Date: June 2003 +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaNetConstants import * +from xPsnlVaultSDL import * + +spherePages = ["Ahnonay_District_ahnySphere01", + "Ahnonay_District_ahnySphere02", + "Ahnonay_District_ahnySphere03", + "Ahnonay_District_ahnySphere04", + "Ahnonay_ahnySphere01", + "Ahnonay_ahnySphere02", + "Ahnonay_ahnySphere03", + "Ahnonay_ahnySphere04"] + +class Ahnonay(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5399 + self.version = 1 + + def OnFirstUpdate(self): + pass + + def OnServerInitComplete(self): + agevault = ptAgeVault() + ageinfo = agevault.getAgeInfo() + guid = ageinfo.getAgeInstanceGuid() + linkid = None + locked = None + volatile = None + spawn = None + owner = None + myID = str(PtGetClientIDFromAvatarKey(PtGetLocalAvatar().getKey())) + + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("Personal") + + vault = ptVault() + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLink": + linkid = chron + print "Ahnonay.OnServerInitComplete(): Link Chron already exists: %s" % (linkid.getValue()) + elif chron and chron.getName() == "AhnonayLocked": + locked = chron + print "Ahnonay.OnServerInitComplete(): Locked Chron already exists: %s" % (locked.getValue()) + elif chron and chron.getName() == "AhnonayVolatile": + volatile = chron + print "Ahnonay.OnServerInitComplete(): Volatile Chron already exists: %s" % (volatile.getValue()) + elif chron and chron.getName() == "AhnonaySpawnPoints": + spawn = chron + print "Ahnonay.OnServerInitComplete(): Spawn Chron already exists: %s" % (spawn.getValue()) + elif chron and chron.getName() == "AhnonayOwner": + owner = chron + break + + if owner == None: + print "I am not the age owner, and I don't have my own Ahnonay" + elif owner.getValue() == myID: + if linkid == None: + print "Ahnonay.OnServerInitComplete(): Link Chron not found, creating" + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("AhnonayLink") + newNode.chronicleSetValue(guid) + ageDataFolder.addNode(newNode) + + if locked == None: + print "Ahnonay.OnServerInitComplete(): Locked Chron not found, creating" + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("AhnonayLocked") + newNode.chronicleSetValue("1") + ageDataFolder.addNode(newNode) + + if volatile == None: + print "Ahnonay.OnServerInitComplete(): Volatile Chron not found, creating" + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("AhnonayVolatile") + newNode.chronicleSetValue("0") + ageDataFolder.addNode(newNode) + + if spawn == None: + print "Ahnonay.OnServerInitComplete(): Spawn Chron not found, creating" + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("AhnonaySpawnPoints") + newNode.chronicleSetValue("Default,LinkInPointDefault") + ageDataFolder.addNode(newNode) + + if volatile and linkid: + if volatile.getValue() == "1" and guid != linkid.getValue(): + print "Ahnonay.OnServerInitComplete(): In a new instance of Ahnonay so setting new vars" + linkid.setValue(guid) + locked.setValue("1") + volatile.setValue("0") + spawn.setValue("Default,LinkInPointDefault") + else: + print "I am not the age owner, but I do have my own Ahnonay" + + + ageSDL = PtGetAgeSDL() + sphere = ageSDL["ahnyCurrentSphere"][0] + + if sphere > 4: + sphere = 1 + ageSDL["ahnyCurrentSphere"] = (1,) + + linkmgr = ptNetLinkingMgr() + link = linkmgr.getCurrAgeLink() + spawnPoint = link.getSpawnPoint() + + spTitle = spawnPoint.getTitle() + spName = spawnPoint.getName() + + if spTitle == "SCSavePoint": + if spName == "SaveClothPoint7" or spName == "SaveClothPoint8": + print "linking to hub or hut" + newSphere = 4 + else: + offset = str(ageSDL["ahnyCurrentOffset"][0]) + print "Ahnonay.OnPageLoad(): Sphere0%s loaded with offset:%s" % (sphere, offset) + newSphere = (int(sphere) - int(offset)) % 4 + if newSphere == 0: + newSphere = 4 + else: + newSphere = sphere + + if newSphere == 1: + PtPageInNode("Sphere01BuildingInterior") + PtPageInNode("MaintRoom01") + PtPageInNode("ahnySphere01") + elif newSphere == 2: + PtPageInNode("MaintRoom02") + PtPageInNode("ahnySphere02") + elif newSphere == 3: + PtPageInNode("MaintRoom03") + PtPageInNode("ahnySphere03") + elif newSphere == 4: + PtPageInNode("Vortex") + PtPageInNode("Hub") + PtPageInNode("MaintRoom04") + PtPageInNode("EngineerHut") + PtPageInNode("ahnySphere04") + + ########################### + def OnPageLoad(self,what,who): + global spherePages + print "Ahnonay.OnPageLoad(): what=%s who=%s" % (what, who) + + if what == kLoaded: + if who in spherePages: + ageSDL = PtGetAgeSDL() + sphere = str(ageSDL["ahnyCurrentSphere"][0]) + offset = str(ageSDL["ahnyCurrentOffset"][0]) + print "Ahnonay.OnPageLoad(): Sphere0%s loaded with offset:%s" % (sphere, offset) + + linkmgr = ptNetLinkingMgr() + link = linkmgr.getCurrAgeLink() + spawnPoint = link.getSpawnPoint() + + spTitle = spawnPoint.getTitle() + spName = spawnPoint.getName() + + if spTitle == "SCSavePoint": + if spName == "SaveClothPoint7" or spName == "SaveClothPoint8": + print "linking to hub or hut" + newSphere = 4 + else: + newSphere = (int(sphere) - int(offset)) % 4 + if newSphere == 0: + newSphere = 4 + spawnPoint = spName + str(newSphere) + PtGetLocalAvatar().physics.warpObj(PtFindSceneobject(spawnPoint, "Ahnonay").getKey()) + else: + defaultLink = "LinkInPointSphere0%s" % (sphere) + PtGetLocalAvatar().physics.warpObj(PtFindSceneobject(defaultLink, "Ahnonay").getKey()) + + ########################### + def OnNotify(self,state,id,events): + pass + + ########################### + def OnBackdoorMsg(self, target, param): + ageSDL = PtGetAgeSDL() + if target == "sphere": + if self.sceneobject.isLocallyOwned(): + ageSDL["ahnyCurrentSphere"] = (int(param),) diff --git a/Python/AhnonayCathedral.py b/Python/AhnonayCathedral.py new file mode 100644 index 0000000000..255a5fc4ff --- /dev/null +++ b/Python/AhnonayCathedral.py @@ -0,0 +1,75 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: AhnonayCathedral.py +Age: AhnonayCathedral +Date: June 2003 +""" + +from Plasma import * +from PlasmaTypes import * + +class AhnonayCathedral(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5398 + self.version = 1 + + def OnFirstUpdate(self): + pass + + def OnServerInitComplete(self): + owner = None + vault = ptVault() + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("Personal") + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayOwner": + owner = chron + break + if owner == None and vault.amOwnerOfCurrentAge(): + print "I own this Cathedral, but I haven't set myself as Ahnonay owner yet." + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("AhnonayOwner") + newNode.chronicleSetValue(str(PtGetClientIDFromAvatarKey(PtGetLocalAvatar().getKey()))) + ageDataFolder.addNode(newNode) + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/AhnyVogondolaRide.py b/Python/AhnyVogondolaRide.py new file mode 100644 index 0000000000..e87f7ccf14 --- /dev/null +++ b/Python/AhnyVogondolaRide.py @@ -0,0 +1,113 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Ahnonay.py +Age: Ahnonay +Date: June 2003 +""" + +from Plasma import * +from PlasmaTypes import * + +click = ptAttribActivator(1,"chair clickable") +climb = ptAttribBehavior(2,"climb behavior") +lower = ptAttribNamedResponder(3,"chair lower responder") +ride = ptAttribResponder(4,"ride") +dummy = ptAttribSceneobject(5,"dummy") +subworld = ptAttribSceneobject(6,"subworld") +eject1 = ptAttribActivator(7,"eject at hub") +eject2 = ptAttribActivator(8,"eject at hut") +ejectResp1 = ptAttribResponder(9,"eject responder hub") +ejectResp2 = ptAttribResponder(10,"eject responder hut") +ejectPt1 = ptAttribSceneobject(11,"eject point hub") +ejectPt2 = ptAttribSceneobject(12,"eject point hut") +hutChairClickable = ptAttribActivator(13,"clickable for the hut") +beginHutRide = ptAttribResponder(14,"hut side ride responder") + +class AhnyVogondolaRide(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 4395 + self.version = 1 + + def OnFirstUpdate(self): + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + + if (id == click.id and state): + avatar = PtFindAvatar(events) + climb.run(avatar) + print"clicked on chair" + return + + if (id == hutChairClickable.id and state): + theAvatar = PtFindAvatar(events) + theAvatar.physics.warpObj(dummy.value.getKey()) + PtAttachObject(theAvatar.getKey(),dummy.value.getKey()) + theAvatar.avatar.enterSubWorld(subworld.value) + print"pinned avatar" + beginHutRide.run(self.key,avatar=theAvatar) + + if (id == climb.id): + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + lower.run(self.key,avatar=PtGetLocalAvatar()) + print"finished smart-seek" + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + theAvatar=PtGetLocalAvatar() + theAvatar.physics.warpObj(dummy.value.getKey()) + PtAttachObject(theAvatar.getKey(),dummy.value.getKey()) + theAvatar.avatar.enterSubWorld(subworld.value) + print"pinned avatar" + ride.run(self.key,avatar=theAvatar) + + if (id == eject1.id and state): + ejectResp1.run(self.key,avatar=PtGetLocalAvatar()) + + if (id == eject2.id and state): + ejectResp2.run(self.key,avatar=PtGetLocalAvatar()) + + if (id == ejectResp1.id and state): + theAvatar=PtGetLocalAvatar() + PtDetachObject(theAvatar.getKey(),dummy.value.getKey()) + theAvatar.avatar.exitSubWorld() + theAvatar.physics.warpObj(ejectPt1.value.getKey()) + print"ejecting at the hub" + + if (id == ejectResp2.id and state): + theAvatar=PtGetLocalAvatar() + PtDetachObject(theAvatar.getKey(),dummy.value.getKey()) + theAvatar.avatar.exitSubWorld() + theAvatar.physics.warpObj(ejectPt2.value.getKey()) + print"ejecting at the hut" + + + \ No newline at end of file diff --git a/Python/BahroCave.py b/Python/BahroCave.py new file mode 100644 index 0000000000..6ea3124553 --- /dev/null +++ b/Python/BahroCave.py @@ -0,0 +1,49 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: BahroCave.py +Age: BahroCave +Date: June 2003 +""" + +from Plasma import * +from PlasmaTypes import * + +class BahroCave(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5314 + self.version = 1 + + def OnFirstUpdate(self): + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass diff --git a/Python/BaronCityOffice.py b/Python/BaronCityOffice.py new file mode 100644 index 0000000000..da60c266b0 --- /dev/null +++ b/Python/BaronCityOffice.py @@ -0,0 +1,71 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: BaronCityOffice.py +Age: Baron City Office +Date: February 2003 +Event Manager hooks for BaronCityOffice +""" + +from Plasma import * +from PlasmaTypes import * + +class BaronCityOffice(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5208 + self.version = 1 + + def OnFirstUpdate(self): + #~ # record our visit in player's chronicle + #~ kModuleName = "Garden" + #~ kChronicleVarName = "LinksIntoGarden" + #~ kChronicleVarType = 0 + #~ vault = ptVault() + #~ if type(vault) != type(None): + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if type(entry) == type(None): + #~ # not found... add current level chronicle + #~ vault.addChronicleEntry(kChronicleVarName,kChronicleVarType,"%d" %(1)) + #~ PtDebugPrint("%s:\tentered new chronicle counter %s" % (kModuleName,kChronicleVarName)) + #~ else: + #~ import string + #~ count = string.atoi(entry.chronicleGetValue()) + #~ count = count + 1 + #~ entry.chronicleSetValue("%d" % (count)) + #~ entry.save() + #~ PtDebugPrint("%s:\tyour current count for %s is %s" % (kModuleName,kChronicleVarName,entry.chronicleGetValue())) + #~ else: + #~ PtDebugPrint("%s:\tERROR trying to access vault -- can't update %s variable in chronicle." % (kModuleName,kChronicleVarName)) + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/Cleft.py b/Python/Cleft.py new file mode 100644 index 0000000000..8e7693f443 --- /dev/null +++ b/Python/Cleft.py @@ -0,0 +1,263 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Cleft.py +Age: Cleft +Date: February 2003 +Event Manager hooks for Cleft +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * +from PlasmaKITypes import * + + +#rgnSnsrFissureDrop = ptAttribActivator(1, "rgn snsr: fissure drop spawn") +respFissureDropStart = ptAttribResponder(1,"resp: fissure drop start") +respFissureDropMain = ptAttribResponder(2,"resp: fissure drop main") + +loadTomahna = 0 +loadZandi = 0 +loadBook = 0 +fissureDrop = 0 + +#kIntroPlayedChronicle = "IntroPlayed" + + +class Cleft(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5209 + self.version = 22 + + #var used to load in Cleft/Tomahna specific stuff based on chronicle vals + global loadTomahna + global loadZandi + global loadBook + + loadTomahna = 0 + loadZandi = 0 + loadBook = 0 + + #checks chronicle entries, if don't exist or is set to no, + #then decides if Tomahna or Zandi should be paged in + + vault = ptVault() + entryCleft = vault.findChronicleEntry("CleftSolved") + if type(entryCleft) != type(None): + entryCleftValue = entryCleft.chronicleGetValue() + if entryCleftValue != "yes": + loadZandi = 1 + loadBook = 1 + elif type(entryCleft) == type(None): + loadZandi = 1 + loadBook = 1 + + vault = ptVault() + entryTomahna = vault.findChronicleEntry("TomahnaLoad") + if type(entryTomahna) != type(None): + entryTomahnaValue = entryTomahna.chronicleGetValue() + if entryTomahnaValue == "yes": + loadTomahna = 1 + if loadZandi: + loadZandi = 0 + if loadBook: + loadBook = 0 + + pages = [] + + # Add the age specific pages + if loadTomahna: + pages += ["Cleft","tmnaDesert","MaleShortIdle","FemaleShortIdle","YeeshaFinalEncounter","FemaleTurnRight180","MaleTurnRight180","clftSndLogTracks","clftAtrusGoggles"] + else: + pages += ["Desert","Cleft","FemaleCleftDropIn","MaleCleftDropIn","clftJCsDesert","clftJCsChasm"] + if loadZandi: + pages += ["clftZandiVis","ZandiCrossLegs","ZandiDirections","ZandiDirections01","ZandiDirections02","ZandiDirections03"] + pages += ["ZandiIdle","ZandiRubNose","ZandiScratchHead","ZandiTurnPage","ZandiAllFace","ZandiOpen01Face"] + pages += ["ZandiOpen02Face","ZandiRand01Face","ZandiRand02Face","ZandiRand03Face","ZandiRand04Face","ZandiRand05Face"] + pages += ["ZandiRes01aFace","ZandiRes01bFace","ZandiRes02aFace","ZandiRes02bFace","ZandiRes03aFace","ZandiRes03bFace"] + pages += ["ZandiJC01aFace","ZandiJC01bFace","ZandiJC02aFace","ZandiJC02bFace","ZandiJC03aFace","ZandiJC03bFace"] + pages += ["ZandiJC04aFace","ZandiJC04bFace","ZandiJC05aFace","ZandiJC05bFace","ZandiJC06aFace","ZandiJC06bFace"] + pages += ["ZandiJC07aFace","ZandiJC07bFace"] + else: + print "Zandi seems to have stepped away from the Airstream. Hmmm..." + if loadBook: + pages += ["clftYeeshaBookVis","FemaleGetPersonalBook","MaleGetPersonalBook"] + else: + print "Zandi seems to have stepped away from the Airstream. Hmmm..." + + # Put in all the common pages + pages += ["BookRoom","clftAtrusNote"] + pages += ["FemaleClimbOffTreeLadder","FemaleGetOnTreeLadder","FemaleWindmillLockedCCW","FemaleWindmillLockedCW","FemaleWindmillStart"] + pages += ["MaleClimbOffTreeLadder","MaleGetOnTreeLadder","MaleWindmillLockedCCW","MaleWindmillLockedCW","MaleWindmillStart"] + pages += ["YeeshaVisionBlocked","YeeshaFinalVision"] + + PtPageInNode(pages) + + if loadTomahna: + #now that Tomahna pages have loaded, reset its chronicle value back to no, + #so subsequent linking will default to regular Cleft instead of Tomahna, + #unless a Tomahna link is used, of course... + entryTomahna.chronicleSetValue("no") + entryTomahna.save() + + pass + + + def OnFirstUpdate(self): + pass + #~ # test for first time to play the intro movie + #~ vault = ptVault() + #~ entry = vault.findChronicleEntry(kIntroPlayedChronicle) + #~ if type(entry) != type(None): + #~ # already played intro sometime in the past... just let 'em play + #~ PtSendKIMessage(kEnableKIandBB,0) + #~ else: + #~ # make sure the KI and blackbar is still diabled + #~ PtSendKIMessage(kDisableKIandBB,0) + #~ # It's the first time... start the intro movie, just by loading the movie dialog + #~ PtLoadDialog("IntroMovieGUI") + + + def OnServerInitComplete(self): + global loadTomahna + global fissureDrop + + ageSDL = PtGetAgeSDL() + + # sets Tomahna SDL based on what is being loaded (thanks to chronicle val) + # also settings previously contained in .fni files + if loadTomahna: + SDLVarName = "clftTomahnaActive" + ageSDL[SDLVarName] = (1,) + PtDebugPrint("Cleft.OnServerInitComplete: loadTomahna is 1, setting clftTomahnaActive SDL to 1") + #PtFogSetDefLinear(start, end, density) + PtFogSetDefLinear(0,0,0) + PtSetClearColor(.4,.4,.5) + + SDLVarSceneBahro = "clftSceneBahroUnseen" + boolSceneBahro = ageSDL[SDLVarSceneBahro][0] + if boolSceneBahro: + PtDebugPrint("Cleft.OnServerInitComplete: SDL says bahro hasn't played yet, paging in SceneBahro stuff...") + PtPageInNode("clftSceneBahro") + else: + PtDebugPrint("Cleft.OnServerInitComplete: SDL says SceneBahro already played, will NOT page in") + + ageSDL.setNotify(self.key,SDLVarSceneBahro,0.0) + + SDLVarSceneYeesha = "clftSceneYeeshaUnseen" + boolSceneYeesha = ageSDL[SDLVarSceneYeesha][0] + if boolSceneYeesha: + #PtDebugPrint("Cleft.OnServerInitComplete: SDL says Yeesha hasn't played yet, paging in SceneYeesha stuff...") + #PtPageInNode("clftSceneYeesha") + SDLVarOfficeDoor = "clftOfficeDoorClosed" + boolOfficeDoor = ageSDL[SDLVarOfficeDoor][0] + if boolOfficeDoor: + PtDebugPrint("Cleft.OnServerInitComplete: SDL says Yeesha will play and office door is shut, will open it") + ageSDL[SDLVarOfficeDoor] = (0,) + else: + PtDebugPrint("Cleft.OnServerInitComplete: SDL says SceneYeesha already played, will NOT page in") + + else: + SDLVarName = "clftTomahnaActive" + ageSDL[SDLVarName] = (0,) + PtDebugPrint("Cleft.OnServerInitComplete: loadTomahna is 0, setting clftTomahnaActive SDL set to 0") + PtFogSetDefLinear(0,0,0) + PtSetClearColor(0,0,0) + + linkmgr = ptNetLinkingMgr() + link = linkmgr.getCurrAgeLink() + spawnPoint = link.getSpawnPoint() + + spTitle = spawnPoint.getTitle() + spName = spawnPoint.getName() + + if spName == "LinkInPointFissureDrop": + fissureDrop = 1 + #avatar.physics.suppress(false) + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + print"failed to get local avatar" + return + avatar.avatar.registerForBehaviorNotify(self.key) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + PtDisableMovementKeys() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + respFissureDropStart.run(self.key,avatar=PtGetLocalAvatar()) + + + def Load(self): + + ageSDL = PtGetAgeSDL() + + # If both Kitchen and Office Doors are closed when linking into the age, this will open the Kitchen door. + # It prevents Player from being locked out of Kitchen/Office if both doors were left shut when Player was last there... + + SDLVarKitchenDoor = "clftKitchenDoorClosed" + SDLVarOfficeDoor = "clftOfficeDoorClosed" + + boolKitchenDoor = ageSDL[SDLVarKitchenDoor][0] + boolOfficeDoor = ageSDL[SDLVarOfficeDoor][0] + + if boolKitchenDoor and boolOfficeDoor: + PtDebugPrint("Cleft.OnLoad: both Kitchen and Office doors are closed... setting Kitchen door SDL to open") + ageSDL[SDLVarKitchenDoor] = (0,) + else: + PtDebugPrint("Cleft.OnLoad: either Kitchen and/or Office door is already open... leaving Kitchen door alone") + + pass + + + def OnNotify(self,state,id,events): + global fissureDrop + + if (id == respFissureDropMain.id): + print "FISSUREDROP.OnNotify: respFissureDropMain.id callback" + if fissureDrop: + cam = ptCamera() + cam.enableFirstPersonOverride() + fissureDrop = 0 + avatar = PtGetLocalAvatar() + avatar.avatar.unRegisterForBehaviorNotify(self.key) + PtEnableMovementKeys() + PtSendKIMessage(kEnableEntireYeeshaBook,0) + + + def OnBehaviorNotify(self,type,id,state): + global fissureDrop + + #PtDebugPrint("Cleft.OnBehaviorNotify(): %d" % (type)) + if type == PtBehaviorTypes.kBehaviorTypeLinkIn and not state: + print "FISSUREDROP.OnBehaviorNotify: fissureDrop = %d" % (fissureDrop) + if fissureDrop: + PtDebugPrint("Cleft.OnBehaviorNotify(): will run respFissureDropMain now.") + respFissureDropMain.run(self.key,avatar=PtGetLocalAvatar()) diff --git a/Python/Dereno.py b/Python/Dereno.py new file mode 100644 index 0000000000..32cf074ec8 --- /dev/null +++ b/Python/Dereno.py @@ -0,0 +1,45 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Dereno.py +Age: Dereno +Date: October 2003 +AgeSDL hooks for Dereno +""" + +from Plasma import * +from PlasmaTypes import * + +class Dereno(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5254 + self.version = 1 + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/Descent.py b/Python/Descent.py new file mode 100644 index 0000000000..e916aa3f16 --- /dev/null +++ b/Python/Descent.py @@ -0,0 +1,77 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Descent.py +Age: Descent +Date: January 2004 +Event Manager hooks for Descent +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaVaultConstants import * + +class Descent(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5325 + self.version = 1 + + def OnServerInitComplete(self): + self.ICityBookLink() + + def OnVaultNotify(self,type,tupdata): + # was an owned age just added? + if type == PtVaultNotifyTypes.kRegisteredOwnedAge: + link = tupdata[0] + name = link.getAgeInfo().getAgeFilename() + if name == "Descent": + cityBookSP = ptSpawnPointInfo("dsntShaftFall","LinkInPointShaftFall") + link.addSpawnPoint(cityBookSP) + link.save() + PtDebugPrint("Descent - setting the spawnpoint for the city book - OnVaultNotify",level=kDebugDumpLevel) + else: + PtDebugPrint("Descent - registering age '%s' (why is this not Descent?)"%(name)) + else: + PtDebugPrint("Descent:OnVaultNotify - not what we want - type=%d"%(type),level=kDebugDumpLevel) + + def ICityBookLink(self): + vault = ptVault() + folder = vault.getAgesIOwnFolder() + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + name = link.getAgeInfo().getAgeFilename() + if name == "Descent": + cityBookSP = ptSpawnPointInfo("dsntShaftFall","LinkInPointShaftFall") + link.addSpawnPoint(cityBookSP) + link.save() + PtDebugPrint("Descent:OnServerInitComplete - setting the spawnpoint for the city book",level=kDebugDumpLevel) + return + PtDebugPrint("Descent:OnServerInitComplete - error - Descent is not there... hopefully OnVaultNotify catches it") + return diff --git a/Python/EderDelin.py b/Python/EderDelin.py new file mode 100644 index 0000000000..5b2d1a5ca9 --- /dev/null +++ b/Python/EderDelin.py @@ -0,0 +1,46 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: EderDelin.py +Age: EderDelin +Date: September 2006 +AgeSDL hook for EderDelin +""" + +from Plasma import * +from PlasmaTypes import * + + +class EderDelin(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5355 + self.version = 1 + + + def OnNotify(self,state,id,events): + pass diff --git a/Python/EderTsogal.py b/Python/EderTsogal.py new file mode 100644 index 0000000000..5c3a7f3769 --- /dev/null +++ b/Python/EderTsogal.py @@ -0,0 +1,46 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: EderTsogal.py +Age: EderTsogal +Date: September 2006 +AgeSDL hook for EderTsogal +""" + +from Plasma import * +from PlasmaTypes import * + + +class EderTsogal(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5360 + self.version = 1 + + + def OnNotify(self,state,id,events): + pass diff --git a/Python/Ercana.py b/Python/Ercana.py new file mode 100644 index 0000000000..c3c7d9b83c --- /dev/null +++ b/Python/Ercana.py @@ -0,0 +1,46 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Ercana.py +Age: Ercana +Date: October 2003 +AgeSDL hooks for Ercana +""" + +from Plasma import * +from PlasmaTypes import * + + +class Ercana(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 7021 + self.version = 1 + + + def OnNotify(self,state,id,events): + pass diff --git a/Python/ErcanaCitySilo.py b/Python/ErcanaCitySilo.py new file mode 100644 index 0000000000..36e83d547c --- /dev/null +++ b/Python/ErcanaCitySilo.py @@ -0,0 +1,355 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ErcanaCitySilo.py +Age: Ercana City Silo +Date: February 2003 +Event Manager hooks for ErcanaCitySilo +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * +from PlasmaKITypes import * +from xPsnlVaultSDL import * +import string +import time +import xRandom + + +# --------- +# max wiring +# --------- + +SDLGotPellet = ptAttribString(1,"SDL: got pellet") +RespDropPellet = ptAttribResponder(2,"resp: got pellet",netForce=1) +RespFadeInPellet = ptAttribResponder(3,"resp: fade-in pellet",netForce=1) +RespScanMeter = ptAttribResponder(4,"resp: scan pellet meter",['Level1','Level2','Level3','Level4','Level5','Level6','Level7','Level8','Level9','Level10','NoLevel'],netForce=1) +RespPlayDud = ptAttribResponder(5,"resp: pellet dud",netForce=1) +RespPlayBubbles = ptAttribResponder(6,"resp: pellet bubbles",['Hi','Med','Low'],netForce=1) +RespPlaySteam = ptAttribResponder(7,"resp: pellet steam",['Hi','Med','Low'],netForce=1) +RespPlayOrangeGlow = ptAttribResponder(8,"resp: pellet orange glow",['Hi','Med','Low'],netForce=1) +RespPlayBoom = ptAttribResponder(9,"resp: pellet explosion",['Hi','Med','Low'],netForce=1) +RespPlayWhiteGlow = ptAttribResponder(10,"resp: pellet white glow",netForce=1) + + +# --------- +# globals +# --------- + +gotPellet = 0 +pellet = 0 +LocalAvatar = None + + +class ErcanaCitySilo(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 208 + self.version = 7 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global gotPellet + global pellet + global LocalAvatar + + LocalAvatar = PtGetLocalAvatar() + + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLGotPellet.value,1,1) + ageSDL.sendToClients(SDLGotPellet.value) + + vault = ptVault() + entry = vault.findChronicleEntry("GotPellet") + if type(entry) != type(None): + entryValue = entry.chronicleGetValue() + gotPellet = string.atoi(entryValue) + if gotPellet != 0: + entry.chronicleSetValue("%d" % (0)) + entry.save() + avatar = PtGetLocalAvatar() + avatar.avatar.registerForBehaviorNotify(self.key) + else: + return + else: + return + + try: + ageSDL = PtGetAgeSDL() + except: + print "ErcanaCitySilo.OnServerInitComplete():\tERROR---Cannot find the ErcanaCitySilo Age SDL" + ageSDL[SDLGotPellet.value] = (0,) + + ageSDL.setNotify(self.key,SDLGotPellet.value,0.0) + + pelletSDL = ageSDL[SDLGotPellet.value][0] + if pelletSDL != gotPellet: + ageSDL[SDLGotPellet.value] = (gotPellet,) + + pellet = (gotPellet - 300) + PtDebugPrint("ErcanaCitySilo:OnServerInitComplete: PELLET RECIPE = %d" % (pellet)) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + #global gotPellet + pass + + + def OnBehaviorNotify(self,type,id,state): + PtDebugPrint("ErcanaCitySilo.OnBehaviorNotify(): %d" % (type)) + + if type == PtBehaviorTypes.kBehaviorTypeLinkIn and state: + if gotPellet != 0: + RespFadeInPellet.run(self.key) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + elif type == PtBehaviorTypes.kBehaviorTypeLinkIn and not state: + if gotPellet != 0: + print "ErcanaCitySilo.OnBehaviorNotify: Will now call IDoMeter." + self.IDoMeter() + else: + print"Says pellet is 0. Shouldn't be possible, I'm in OnBehaviorNotify." + avatar = PtGetLocalAvatar() + avatar.avatar.unRegisterForBehaviorNotify(self.key) + + + def IDoMeter(self): + levelMeter = self.IEvalPellet() + print "ErcanaCitySilo.IDoMeter(): pellet is level: ",levelMeter + if levelMeter == 1.0: + RespScanMeter.run(self.key,state="Level1") + PtAtTimeCallback(self.key,6.3,2) + elif levelMeter == 2.0: + RespScanMeter.run(self.key,state="Level2") + PtAtTimeCallback(self.key,6.7,2) + elif levelMeter == 3.1 or levelMeter == 3.2: + RespScanMeter.run(self.key,state="Level3") + PtAtTimeCallback(self.key,7,2) + elif levelMeter == 4.0: + RespScanMeter.run(self.key,state="Level4") + PtAtTimeCallback(self.key,7.3,2) + elif levelMeter == 5.0: + RespScanMeter.run(self.key,state="Level5") + PtAtTimeCallback(self.key,7.7,2) + elif levelMeter == 6.0: + RespScanMeter.run(self.key,state="Level6") + PtAtTimeCallback(self.key,8,2) + elif levelMeter == 7.0: + RespScanMeter.run(self.key,state="Level7") + PtAtTimeCallback(self.key,8.3,2) + elif levelMeter == 8.0: + RespScanMeter.run(self.key,state="Level8") + PtAtTimeCallback(self.key,8.7,2) + elif levelMeter == 9.0: + RespScanMeter.run(self.key,state="Level9") + PtAtTimeCallback(self.key,9,2) + elif levelMeter == 10.0: + RespScanMeter.run(self.key,state="Level10") + PtAtTimeCallback(self.key,9.3,2) + + + def IDropPellet(self): + RespDropPellet.run(self.key) + + + def IDoScores(self): + if pellet < 0: + pelletKIpoints = 0 + lakePoints = (pellet/5) + if lakePoints < -70: + lakePoints = -70 + elif pellet > 200: + pelletKIpoints = (pellet - ((pellet-200) * 4)) + lakePoints = (pellet - ((pellet-200) * 4)) + if pelletKIpoints < 0: + pelletKIpoints = 0 + if lakePoints < -200: + lakePoints = -200 + else: + pelletKIpoints = pellet + lakePoints = pellet + pelletKIpoints = int(round(pelletKIpoints * ((xRandom.randint(1,25) / 100.0) + 4.75))) + lakePoints = int(round(lakePoints)) + print "ErcanaCitySilo.IDoScores(): this pellet drop is worth %d KI points!" % (pelletKIpoints) + print "ErcanaCitySilo.IDoScores(): and %d lake points!" % (lakePoints) + scoreList = ptScoreMgr().getPlayerScores("PelletDrop") + oldScore = 0 + if scoreList: + print "old pellet score = ",scoreList[0].getValue() + oldScore = scoreList[0].getValue() + pelletScoreNew = scoreList[0].addPoints(pelletKIpoints) + #scoreListNew = ptScoreMgr().getPlayerScores("PelletDrop") + if pelletScoreNew == None: + print "hmm, updated score says it's none, we've got a problem" + else: + pelletScoreNew = ptScoreMgr().createPlayerScore("PelletDrop", PtGameScoreTypes.kAccumulative, pelletKIpoints) + # THE PRINT WAS CAUSING A LOT OF TRACEBACKS. IS IT TOO SOON AFTER NEW SCORE CREATION? + #scoreListNew = ptScoreMgr().getPlayerScores("PelletDrop") + #print "created score record 'PelletDrop', initial pellet score = ",scoreListNew[0].getValue() + if pelletScoreNew == None: + print "hmm, initial score says it's none, we've got a problem" + totalScoreList = ptScoreMgr().getPlayerScores("PelletTotal") + if totalScoreList: + print "old total pellet score = ",totalScoreList[0].getValue() + pelletTotalScoreNew = totalScoreList[0].addPoints(pelletKIpoints) + if pelletTotalScoreNew == None: + print "hmm, updated total score says it's none, we've got a problem" + else: + pelletTotalScoreNew = ptScoreMgr().createPlayerScore("PelletTotal", PtGameScoreTypes.kAccumulative, (pelletKIpoints + oldScore)) + if pelletTotalScoreNew == None: + print "hmm, initial total score says it's none, we've got a problem" + lakeScoreList = ptScoreMgr().getGlobalScores("LakeScore") + if lakeScoreList: + oldLakeScore = lakeScoreList[0].getValue() + print "old LakeScore = ",oldLakeScore + lakeScoreNew = lakeScoreList[0].addPoints(lakePoints) + if lakeScoreNew == None: + print "updated lake score says None, we've got a problem" + else: + print "new LakeScore should = ",oldLakeScore+lakePoints + else: + print "Couldn't find the global LakeScore, creating now..." + lakeScoreNew = ptScoreMgr().createGlobalScore("LakeScore", PtGameScoreTypes.kAccumAllowNegative, lakePoints) + if lakeScoreNew == None: + print "initial score says it's none, we've got a problem" + else: + print "initial LakeScore should = ",lakePoints + + PtSendKIMessage(kUpdatePelletScore,0) + + + def OnNotify(self,state,id,events): + if (id == RespScanMeter.id and gotPellet): + print "ErcanaCitySilo.OnNotify: Received callback from RespScanMeter, will now call IDropPellet." + self.IDropPellet() + + elif (id == RespDropPellet.id and gotPellet): + levelFX = self.IEvalPellet() + self.IPlayPellet(levelFX) + PtAtTimeCallback(self.key,5,1) + + + def OnTimer(self,id): + if id == 1: + cam = ptCamera() + cam.enableFirstPersonOverride() + elif id == 2: + self.IDoScores() + + + def IEvalPellet(self): + if pellet <= 0: + if pellet <= -250: + level = 1.0 + elif pellet > -250 and pellet <= -150: + level = 2.0 + elif pellet > -150 and pellet <= -50: + level = 3.1 + elif pellet > -50 and pellet <= 0: + level = 3.2 + elif pellet > 0 and pellet <= 270: + if pellet > 0 and pellet <= 74: + level = 4.0 + elif pellet > 74 and pellet <= 149: + level = 5.0 + elif pellet > 149 and pellet <= 209: + level = 6.0 + elif pellet > 209 and pellet <= 270: + level = 7.0 + elif pellet > 270: + if pellet > 270 and pellet <= 295: + level = 8.0 + elif pellet > 295 and pellet <= 320: + level = 9.0 + elif pellet > 320: + level = 10.0 + + return level + + + def IPlayPellet(self,level): + if level > 0.0: + print "ErcanaCitySilo.IPlayPellet(): and the pellet anim is..." + if level == 1.0: + print "steam & bubbles - HIGH" + RespPlaySteam.run(self.key,state="Hi") + RespPlayBubbles.run(self.key,state="Hi") + elif level == 2.0: + print "steam & bubbles - MEDIUM" + RespPlaySteam.run(self.key,state="Med") + RespPlayBubbles.run(self.key,state="Med") + elif level == 3.1: + print "steam & bubbles - LOW" + RespPlaySteam.run(self.key,state="Low") + RespPlayBubbles.run(self.key,state="Low") + elif level == 3.2: + print "dud" + RespPlayDud.run(self.key) + elif level == 4.0: + print "orange glow - LOW" + RespPlayOrangeGlow.run(self.key,state="Low") + elif level == 5.0: + print "orange glow - MEDIUM" + RespPlayOrangeGlow.run(self.key,state="Med") + elif level == 6.0: + print "orange glow - HIGH" + RespPlayOrangeGlow.run(self.key,state="Hi") + elif level == 7.0: + print "white glow" + RespPlayWhiteGlow.run(self.key) + elif level == 8.0: + print "explosion - LOW" + RespPlayBoom.run(self.key,state="Low") + elif level == 9.0: + print "explosion - MEDIUM" + RespPlayBoom.run(self.key,state="Med") + elif level == 10.0: + print "explosion - HIGH" + RespPlayBoom.run(self.key,state="Hi") + else: + print "ErcanaCitySilo.IPlayPellet(): ERROR. Level must be greater than 0" + + + def OnBackdoorMsg(self,target,param): + if target == "pelletfx": + param = float(param) + #print "param = ",param + if param > 0.0 and param <= 10.0: + if param == 3.0: + print "can't use 3.0, must be either 3.1 or 3.2" + return + else: + self.IPlayPellet(param) + else: + print "must be between 0.0 and 10.0" + diff --git a/Python/Garden.py b/Python/Garden.py new file mode 100644 index 0000000000..5359bb1194 --- /dev/null +++ b/Python/Garden.py @@ -0,0 +1,71 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Garden.py +Age: Garden +Date: October 2002 +event manager hooks for the Garden +""" + +from Plasma import * +from PlasmaTypes import * + +class Garden(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5023 + self.version = 1 + + def OnFirstUpdate(self): + #~ # record our visit in player's chronicle + #~ kModuleName = "Garden" + #~ kChronicleVarName = "LinksIntoGarden" + #~ kChronicleVarType = 0 + #~ vault = ptVault() + #~ if type(vault) != type(None): + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if type(entry) == type(None): + #~ # not found... add current level chronicle + #~ vault.addChronicleEntry(kChronicleVarName,kChronicleVarType,"%d" %(1)) + #~ PtDebugPrint("%s:\tentered new chronicle counter %s" % (kModuleName,kChronicleVarName)) + #~ else: + #~ import string + #~ count = string.atoi(entry.chronicleGetValue()) + #~ count = count + 1 + #~ entry.chronicleSetValue("%d" % (count)) + #~ entry.save() + #~ PtDebugPrint("%s:\tyour current count for %s is %s" % (kModuleName,kChronicleVarName,entry.chronicleGetValue())) + #~ else: + #~ PtDebugPrint("%s:\tERROR trying to access vault -- can't update %s variable in chronicle." % (kModuleName,kChronicleVarName)) + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/GardenBugs.py b/Python/GardenBugs.py new file mode 100644 index 0000000000..3056465655 --- /dev/null +++ b/Python/GardenBugs.py @@ -0,0 +1,345 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: GardenBugs.py +Age: Garden +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * + +bugRgn = ptAttribActivator(1,"region bug transfer") +bugEmitter = ptAttribSceneobject(2,"bug emitter obj") +rainStart = ptAttribActivator(3,"rain start anim event") +rainEnd = ptAttribActivator(4,"rain stop anim event") +raining = ptAttribString(5,"raining SDL var") +tunnel1 = ptAttribActivator(6,"tunnel 1") +tunnel2 = ptAttribActivator(7,"tunnel 2") +tunnel3 = ptAttribActivator(8,"tunnel 3") +bharoCave = ptAttribActivator(9,"bharo cave") +gazebo1 = ptAttribActivator(10,"gazebo 1") +gazebo2 = ptAttribActivator(11,"gazebo 2") + + +#globals +currentBehavior = PtBehaviorTypes.kBehaviorTypeIdle +kAddBugs = 1 +kCheckForBugs = 99 +kRainStarting = 999 +numJumps = 0 +localInTunnel = 0 +running = false +chronicleEntryName = "BugsOnAvatar" +bugLightObjectName = "RTOmni-BugLightTest" + +class GardenBugs(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 5360223 + self.version = 2 + self.bugCount = 0 + + def ISaveBugCount(self, count): + vault = ptVault() + if type(vault) != type(None): + entry = vault.findChronicleEntry(chronicleEntryName) + if type(entry) == type(None): + # not found... add chronicle + vault.addChronicleEntry(chronicleEntryName,0,str(count)) + else: + entry.chronicleSetValue(str(count)) + entry.save() + + def IGetBugCount(self): + vault = ptVault() + if type(vault) != type(None): + entry = vault.findChronicleEntry(chronicleEntryName) + if type(entry) != type(None): + return int(entry.chronicleGetValue()) + return 0 # no vault or no chronicle var + + def OnServerInitComplete(self): + self.ageSDL = PtGetAgeSDL() + self.ageSDL[raining.value]=(0,) + + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + print "GardenBugs.OnFirstUpdate():\tfailed to get local avatar" + return + + avatar.avatar.registerForBehaviorNotify(self.key) + + self.bugCount = self.IGetBugCount() + print "GardenBugs.OnFirstUpdate():\tStarting with %d bugs" % self.bugCount + + # first, kill all bugs on the avatar that might have been brought over + PtKillParticles(0,1,avatar.getKey()) + + if (self.bugCount > 0): + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, true) + print"GardenBugs.OnFirstUpdate():\tTurning lights on at start" + else: + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + print"GardenBugs.OnFirstUpdate():\tTurning lights off at start" + + # this will add the bugs back that we have + PtAtTimeCallback(self.key,0.1,kAddBugs) + + def Load(self): + pass + + def OnTimer(self,id): + global currentBehavior + global localInTunnel + global running + + avatar = PtGetLocalAvatar() + self.bugCount = PtGetNumParticles(avatar.getKey()) + if (self.bugCount < 0): + self.bugCount = 0 # PtGetNumParticles had an error, probably don't have any + + if (id == kAddBugs): + # this is here because SDL might be fighting with us for the number of bugs on the avatar and we want + # to make sure we have the final say. Also, it takes a frame to kill all the bugs like we requested in + # OnServerInitComplete() + + # now add the number of bugs we're supposed to have + particlesToTransfer = self.IGetBugCount() - self.bugCount + + if (particlesToTransfer < 0): + # kill some particles + particlesToKill = -particlesToTransfer + percentToKill = float(particlesToKill) / float(self.bugCount) + print "GardenBugs.OnTimer() - Particles to kill: " + str(particlesToKill) + " (" + str(percentToKill * 100) + "%)" + PtKillParticles(0,percentToKill,avatar.getKey()) + elif (particlesToTransfer != 0): + # add some particles + print "GardenBugs.OnTimer() - Particles to add: " + str(particlesToTransfer) + PtTransferParticlesToObject(bugEmitter.value.getKey(),avatar.getKey(),particlesToTransfer) + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + return + + if (id == kRainStarting): + self.ageSDL = PtGetAgeSDL() + self.ageSDL[raining.value] = (1,) + PtSetParticleOffset(0,0,100,bugEmitter.value.getKey()) + print "GardenBugs.OnTimer():\tIt's rain, bug cloud gone" + if (localInTunnel or self.bugCount == 0): + print "GardenBugs.OnTimer():\tIn tunnel, bugs safe for now or no local bugs" + return + PtSetParticleDissentPoint(0,0,100,avatar.getKey()) + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.bugCount = 0 + self.ISaveBugCount(self.bugCount) + return + + + if (self.bugCount > 0): + if (id == kCheckForBugs): + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, true) + PtSetParticleOffset(0,0,4.5, avatar.getKey()) + + if (id == PtBehaviorTypes.kBehaviorTypeRun): + if (running or (PtLocalAvatarRunKeyDown() and PtLocalAvatarIsMoving())): + print "GardenBugs.OnTimer():\tRunning, kill more bugs" + PtKillParticles(3.0,0.1,avatar.getKey()) + PtAtTimeCallback(self.key, 0.4, PtBehaviorTypes.kBehaviorTypeRun) + self.bugCount = self.bugCount * 0.1 + self.ISaveBugCount(self.bugCount) + + elif (self.bugCount == 0): + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + PtSetParticleOffset(0,0,4.5, avatar.getKey()) + self.bugCount = 0 + self.ISaveBugCount(self.bugCount) + + def OnNotify(self,state,id,events): + global numJumps + global localInTunnel + global running + + triggerer = PtFindAvatar(events) + avatar = PtGetLocalAvatar() + if (avatar != triggerer): + print "GardenBugs.OnNotify():\tWrong avatar, notifies run locally" + return + + self.bugCount = PtGetNumParticles(avatar.getKey()) + + if (id == bugRgn.id): + print "GardenBugs.OnNotify():\tEntered bug cloud region" + + if (self.bugCount > 19): + return + self.ageSDL = PtGetAgeSDL() + rain = self.ageSDL[raining.value][0] + if (rain): + print "gardenBugs.OnNotify()-->\tnope, it's raining" + return + if running: + print "gardenBugs.OnNotify()-->\tcan't add bugs as we're still running" + return + if PtLocalAvatarRunKeyDown() and PtLocalAvatarIsMoving(): + print "gardenBugs.OnNotify()-->\tcan't add bugs as we're still running (but our running flag is false?)" + return + + print "gardenBugs.OnNotify()-->\ttansferring Bugs!" + avatar = PtFindAvatar(events) + PtTransferParticlesToObject(bugEmitter.value.getKey(),avatar.getKey(),10) + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + print"gardenBugs.OnNotify()-->\tset bugs at 10" + PtAtTimeCallback(self.key,0.1,kCheckForBugs) + numJumps = 0 + self.bugCount = self.bugCount + 10 + self.ISaveBugCount(self.bugCount) + + if (id == rainStart.id): + print "gardenBugs.OnNotify()-->\tstart rain timer" + PtAtTimeCallback(self.key, 30.0, kRainStarting) + return + + if (id == rainEnd.id): + print "gardenBugs.OnNotify()-->\train stopping" + self.ageSDL = PtGetAgeSDL() + self.ageSDL[raining.value] = (0,) + PtSetParticleOffset(0,0,4,bugEmitter.value.getKey()) + + if (id == bharoCave.id and self.bugCount > 0): + PtSetParticleDissentPoint(0,0,100,avatar.getKey()) + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + print"gardenBugs.OnNotify()-->\tbharo cave too scary for bugs!" + self.bugCount = 0 + self.ISaveBugCount(self.bugCount) + import xSndLogTracks + xSndLogTracks.LogTrack("277","421") + return + + if (id == tunnel1.id) or (id == tunnel2.id) or (id == tunnel3.id) or (id == gazebo1.id) or (id == gazebo2.id): + for event in events: + if event[0]==1 and event[1]==1: + localInTunnel = true + print "gardenBugs.OnNotify()-->\tlocal in tunnel" + return + elif event[0]==1 and event[1]==0: + localInTunnel = false + print "gardenBugs.OnNotify()-->\tlocal exit tunnel" + self.ageSDL = PtGetAgeSDL() + rain = self.ageSDL[raining.value][0] + if (rain): + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.bugCount = 0 + self.ISaveBugCount(self.bugCount) + return + + def BeginAgeUnLoad(self, avObj): + local = 0 + try: + local = PtGetLocalAvatar() + except: + print"gardenBugs.BeginAgeUnLoad()-->\tfailed to get local avatar" + return + if (local == avObj): + print "gardenBugs.BeginAgeUnLoad()-->\tavatar page out" + + # update with the number currently on the avatar and save it to the chronicle + self.bugCount = PtGetNumParticles(local.getKey()) + print "gardenBugs.BeginAgeUnLoad()-->\tparticles at age unload ",self.bugCount + self.ISaveBugCount(self.bugCount) + + # help ensure all bugs are dead + PtKillParticles(0,1,local.getKey()) + + local.avatar.unRegisterForBehaviorNotify(self.key) + self.ageSDL = PtGetAgeSDL() + self.ageSDL[raining.value] = (0,) + + def OnBehaviorNotify(self,behavior,id,state): + global currentBehavior + global numJumps + global running + + if (state == false): + currentBehavior = PtBehaviorTypes.kBehaviorTypeIdle + if (behavior == PtBehaviorTypes.kBehaviorTypeRun): + running = false + if PtLocalAvatarRunKeyDown() and PtLocalAvatarIsMoving(): + print "gardenBugs.OnBehaviorNotify()-->\tWARN: Running behavior turned off, but avatar still reports run and movement keys are held down" + return + else: + currentBehavior = behavior + if (behavior == PtBehaviorTypes.kBehaviorTypeRun): + running = true + + + avatar = PtGetLocalAvatar() + self.bugCount = PtGetNumParticles(avatar.getKey()) + + if (self.bugCount > 0): + if (behavior == PtBehaviorTypes.kBehaviorTypeStandingJump or behavior == PtBehaviorTypes.kBehaviorTypeWalkingJump): + if (numJumps == 0): + numJumps = 1 + if (self.bugCount == 1): + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.bugCount = 0 + else: + PtKillParticles(3.0,0.5,avatar.getKey()) + self.bugCount = self.bugCount / 2 + self.ISaveBugCount(self.bugCount) + else: + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.bugCount = 0 + self.ISaveBugCount(self.bugCount) + return + + if (behavior == PtBehaviorTypes.kBehaviorTypeRunningImpact or behavior == PtBehaviorTypes.kBehaviorTypeRunningJump): + print "gardenBugs.BehaviorNotify()-->\tkill all bugs" + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.bugCount = 0 + self.ISaveBugCount(self.bugCount) + return + + if (running or (PtLocalAvatarRunKeyDown() and PtLocalAvatarIsMoving())): + #kill some of them and set a timer + print "gardenBugs.BehaviorNotify()-->\tstarted running, kill some bugs" + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + PtKillParticles(3.0,0.1,avatar.getKey()) + PtAtTimeCallback(self.key, 0.4, PtBehaviorTypes.kBehaviorTypeRun) + self.bugCount = self.bugCount * 0.1 + self.ISaveBugCount(self.bugCount) + return + + diff --git a/Python/Garrison.py b/Python/Garrison.py new file mode 100644 index 0000000000..cc30f62047 --- /dev/null +++ b/Python/Garrison.py @@ -0,0 +1,115 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Garrison.py +Age: Garrison +Date: October 2002 +event manager hooks for the Garrison +""" + +from Plasma import * +from PlasmaTypes import * + + +IsPublic = 0 +boolWellBlocker = 0 + + +class Garrison(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5024 + self.version = 2 + + + def OnFirstUpdate(self): + global IsPublic + + thisComponent = self.key.getName() + if thisComponent != "VeryVerySpecialPythonFileMod": + print "Garrison.OnFirstUpdate(): this isn't the right script instance, ignoring rest of script" + return + + parentname = None + + try: + agevault = ptAgeVault() + ageinfo = agevault.getAgeInfo() + parent = ageinfo.getParentAgeLink() + parentinfo = parent.getAgeInfo() + parentname = parentinfo.getAgeFilename() + except: + pass + + if parentname == "Neighborhood": + IsPublic = 1 + print "Garrison.OnFirstUpdate(): this Garrison is the public instance, as its parent = ",parentname + else: + print "Garrison.OnFirstUpdate(): this Garrison is the regular aka Yeesha version, as its parent = ",parentname + + + + def OnServerInitComplete(self): + thisComponent = self.key.getName() + if thisComponent != "VeryVerySpecialPythonFileMod": + print "Garrison.OnFirstUpdate(): this isn't the right script instance, ignoring rest of script" + return + + global boolWellBlocker + + ageSDL = PtGetAgeSDL() + ageSDL.setFlags("grsnWellFirstFloorBlocker",1,1) + ageSDL.sendToClients("grsnWellFirstFloorBlocker") + ageSDL.setNotify(self.key,"grsnWellFirstFloorBlocker",0.0) + + boolWellBlocker = ageSDL["grsnWellFirstFloorBlocker"][0] + if IsPublic and not boolWellBlocker: + ageSDL["grsnWellFirstFloorBlocker"] = (1,) + elif not IsPublic and boolWellBlocker: + ageSDL["grsnWellFirstFloorBlocker"] = (0,) + + + def Load(self): + pass + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolWellBlocker + +# if VARname == "grsnWellFirstFloorBlocker": +# ageSDL = PtGetAgeSDL() +# boolWellBlocker = ageSDL["grsnWellFirstFloorBlocker"][0] +# if IsPublic and not boolWellBlocker: +# ageSDL["grsnWellFirstFloorBlocker"] = (1,) +# elif not IsPublic and boolWellBlocker: +# ageSDL["grsnWellFirstFloorBlocker"] = (0,) + + + def OnNotify(self,state,id,events): + pass + + diff --git a/Python/Gira.py b/Python/Gira.py new file mode 100644 index 0000000000..a77cd341b5 --- /dev/null +++ b/Python/Gira.py @@ -0,0 +1,70 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Gira.py +Age: Gira +Date: May 2003 +""" + +from Plasma import * +from PlasmaTypes import * + +class Gira(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5311 + self.version = 1 + + def OnFirstUpdate(self): + #~ # record our visit in player's chronicle + #~ kModuleName = "Garden" + #~ kChronicleVarName = "LinksIntoGarden" + #~ kChronicleVarType = 0 + #~ vault = ptVault() + #~ if type(vault) != type(None): + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if type(entry) == type(None): + #~ # not found... add current level chronicle + #~ vault.addChronicleEntry(kChronicleVarName,kChronicleVarType,"%d" %(1)) + #~ PtDebugPrint("%s:\tentered new chronicle counter %s" % (kModuleName,kChronicleVarName)) + #~ else: + #~ import string + #~ count = string.atoi(entry.chronicleGetValue()) + #~ count = count + 1 + #~ entry.chronicleSetValue("%d" % (count)) + #~ entry.save() + #~ PtDebugPrint("%s:\tyour current count for %s is %s" % (kModuleName,kChronicleVarName,entry.chronicleGetValue())) + #~ else: + #~ PtDebugPrint("%s:\tERROR trying to access vault -- can't update %s variable in chronicle." % (kModuleName,kChronicleVarName)) + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/GiraBugs.py b/Python/GiraBugs.py new file mode 100644 index 0000000000..c10f11bf71 --- /dev/null +++ b/Python/GiraBugs.py @@ -0,0 +1,258 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: GiraBugs.py +Age: Gira +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * + +water01 = ptAttribActivator(1,"water 01") +water02 = ptAttribActivator(2,"water 02") +water03 = ptAttribActivator(3,"water 03") +fumerol01 = ptAttribActivator(4,"fumerol 01") +fumerol02 = ptAttribActivator(5,"fumerol 02") +fumerol03 = ptAttribActivator(6,"fumerol 03") +fumerol04 = ptAttribActivator(7,"fumerol 04") +fumerol05 = ptAttribActivator(8,"fumerol 05") +fumerol06 = ptAttribActivator(9,"fumerol 06") +fumerol07 = ptAttribActivator(10,"fumerol 07") +fumerol08 = ptAttribActivator(11,"fumerol 08") +fumerol09 = ptAttribActivator(12,"fumerol 09") +fumerol10 = ptAttribActivator(13,"fumerol 10") +fumerol11 = ptAttribActivator(14,"fumerol 11") +fumerol12 = ptAttribActivator(15,"fumerol 12") +fumerol13 = ptAttribActivator(16,"fumerol 13") +fumerol14 = ptAttribActivator(17,"fumerol 14") +fumerol15 = ptAttribActivator(18,"fumerol 15") +particleSystem = ptAttribSceneobject(19,"Bug particle system") +#bugBox = ptAttribActivator(20,"gira Bug Transfer") +#bugPickup = ptAttribActivator(21,"gira bug pickup") + +#globals +kAddBugs = 1 +currentBehavior = PtBehaviorTypes.kBehaviorTypeIdle +numJumps = 0 +running = false +chronicleEntryName = "BugsOnAvatar" +bugLightObjectName = "RTOmni-BugLightTest" + +class GiraBugs(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 53627 + self.version = 2 + self.bugCount = 0 + + def ISaveBugCount(self, count): + vault = ptVault() + if type(vault) != type(None): + entry = vault.findChronicleEntry(chronicleEntryName) + if type(entry) == type(None): + # not found... add chronicle + vault.addChronicleEntry(chronicleEntryName,0,str(count)) + else: + entry.chronicleSetValue(str(count)) + entry.save() + + def IGetBugCount(self): + vault = ptVault() + if type(vault) != type(None): + entry = vault.findChronicleEntry(chronicleEntryName) + if type(entry) != type(None): + return int(entry.chronicleGetValue()) + return 0 # no vault or no chronicle var + + def OnServerInitComplete(self): + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + print "GiraBugs.OnFirstUpdate():\tfailed to get local avatar" + return + avatar.avatar.registerForBehaviorNotify(self.key) + + self.bugCount = self.IGetBugCount() + print "GiraBugs.OnFirstUpdate():\tStarting with %d bugs" % self.bugCount + + # first, kill all bugs on the avatar that might have been brought over + PtKillParticles(0,1,avatar.getKey()) + + if (self.bugCount > 0): + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, true) + print "GiraBugs.OnFirstUpdate():\tlights on at start" + else: + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + print "GiraBugs.OnFirstUpdate():\tlights off at start" + + # this will add the bugs back that we have + PtAtTimeCallback(self.key,0.1,kAddBugs) + + def BeginAgeUnLoad(self, avObj): + try: + local = PtGetLocalAvatar() + except: + print "ERROR: GiraBugs.BeginAgeUnload()-->\tFailed to get local avatar!" + return + if (local == avObj): + print "GiraBugs.BeginAgeUnload():\tavatar page out" + local.avatar.unRegisterForBehaviorNotify(self.key) + + # update with the number currently on the avatar and save it to the chronicle + self.bugCount = PtGetNumParticles(local.getKey()) + print "GiraBugs.BeginAgeUnload():\tparticles at age unload ",self.bugCount + self.ISaveBugCount(self.bugCount) + + # help ensure all bugs are dead + PtKillParticles(0,1,local.getKey()) + + def OnTimer(self,id): + global currentBehavior + global running + + avatar = PtGetLocalAvatar() + self.bugCount = PtGetNumParticles(avatar.getKey()) # update with the number currently on the avatar + if (self.bugCount < 0): + self.bugCount = 0 # PtGetNumParticles had an error, probably don't have any + + if (id == kAddBugs): + # this is here because SDL might be fighting with us for the number of bugs on the avatar and we want + # to make sure we have the final say. Also, it takes a frame to kill all the bugs like we requested in + # OnServerInitComplete() + + # now add the number of bugs we're supposed to have + particlesToTransfer = self.IGetBugCount() - self.bugCount + + if (particlesToTransfer < 0): + # kill some particles + particlesToKill = -particlesToTransfer + percentToKill = float(particlesToKill) / float(self.bugCount) + print "GiraBugs.OnTimer() - Particles to kill: " + str(particlesToKill) + " (" + str(percentToKill * 100) + "%)" + PtKillParticles(0,percentToKill,avatar.getKey()) + elif (particlesToTransfer != 0): + # add some particles + print "GiraBugs.OnTimer() - Particles to add: " + str(particlesToTransfer) + PtTransferParticlesToObject(particleSystem.value.getKey(),avatar.getKey(),particlesToTransfer) + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + return + + if (self.bugCount > 0): + if (running and id==PtBehaviorTypes.kBehaviorTypeRun): + PtKillParticles(3.0,0.1,avatar.getKey()) + PtAtTimeCallback(self.key, 0.4, PtBehaviorTypes.kBehaviorTypeRun) + + elif (self.bugCount == 0): + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + + def OnNotify(self,state,id,events): + local = PtGetLocalAvatar() + avatar = PtFindAvatar(events) + + # make sure this is the local avatar + if (avatar != local): + return + + # so, how many bugs does this avatar have? + self.bugCount = PtGetNumParticles(avatar.getKey()) + + if (id == water01.id or id == water02.id or id == water03.id or \ + id == fumerol01.id or id == fumerol02.id or id == fumerol03.id or \ + id == fumerol04.id or id == fumerol05.id or id == fumerol06.id or \ + id == fumerol07.id or id == fumerol08.id or id == fumerol09.id or \ + id == fumerol10.id or id == fumerol11.id or id == fumerol12.id or \ + id == fumerol13.id or id == fumerol14.id or id == fumerol15.id): + print "GiraBugs.OnNotify():\tsplashdown! ",id + if (self.bugCount): + self.bugCount = 0 + print "GiraBugs.OnNotify():\tkill all bugs" + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.ISaveBugCount(self.bugCount) + return + + + def OnBehaviorNotify(self,behavior,id,state): + global currentBehavior + global numJumps + global running + + if (state == false): + currentBehavior = PtBehaviorTypes.kBehaviorTypeIdle + if (behavior == PtBehaviorTypes.kBehaviorTypeRun): + running = false + return + else: + currentBehavior = behavior + if (behavior == PtBehaviorTypes.kBehaviorTypeRun): + running = true + + + avatar = PtGetLocalAvatar() + self.bugCount = PtGetNumParticles(avatar.getKey()) + + if (self.bugCount > 0): + if (behavior == PtBehaviorTypes.kBehaviorTypeStandingJump or behavior == PtBehaviorTypes.kBehaviorTypeWalkingJump): + if (numJumps == 0): + numJumps = 1 + if (self.bugCount == 1): + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.bugCount = 0 + else: + PtKillParticles(3.0,0.5,avatar.getKey()) + self.bugCount = self.bugCount / 2; + self.ISaveBugCount(self.bugCount) + + else: + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.bugCount = 0 + self.ISaveBugCount(self.bugCount) + return + + if ( behavior == PtBehaviorTypes.kBehaviorTypeRunningJump): + print "GiraBugs.OnBehaviorNotify():\tkill all bugs" + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + PtKillParticles(3.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + self.bugCount = 0 + self.ISaveBugCount(self.bugCount) + return + + if (behavior == PtBehaviorTypes.kBehaviorTypeRun): + #kill some of them and set a timer + print "GiraBugs.OnBehaviorNotify():\tstarted running, kill some bugs" + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + PtKillParticles(3.0,0.1,avatar.getKey()) + PtAtTimeCallback(self.key, 0.25, PtBehaviorTypes.kBehaviorTypeRun) + self.bugCount = self.bugCount * 0.1 + self.ISaveBugCount(self.bugCount) + return + + diff --git a/Python/GiraCave1.py b/Python/GiraCave1.py new file mode 100644 index 0000000000..31fc8a9604 --- /dev/null +++ b/Python/GiraCave1.py @@ -0,0 +1,71 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Garden.py +Age: Garden +Date: October 2002 +event manager hooks for the Garden +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * + + +caveSolved = ptAttribActivator(2,"cave solved") +sdlSolved = ptAttribString(4,"our sdl var") + +#globals + +class GiraCave1(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5360224 + self.version = 1 + + def OnServerInitComplete(self): + if type(sdlSolved.value) == type("") and sdlSolved.value != "": + self.ageSDL = PtGetAgeSDL() + self.ageSDL.setFlags(sdlSolved.value,1,1) + self.ageSDL.sendToClients(sdlSolved.value) + else: + PtDebugPrint("GiraCave.OnFirstUpdate():\tERROR: missing SDL var in max file") + + + def OnNotify(self,state,id,events): + + if (id == caveSolved.id): + if (state): # we entered the region, check for bugs + avatar = PtFindAvatar(events) + bugs = PtGetNumParticles(avatar.getKey()) + if (bugs > 0): + self.ageSDL[sdlSolved.value] = (1,) + return + + + + diff --git a/Python/GiraDoor.py b/Python/GiraDoor.py new file mode 100644 index 0000000000..661087b6f4 --- /dev/null +++ b/Python/GiraDoor.py @@ -0,0 +1,88 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Garden.py +Age: Garden +Date: October 2002 +event manager hooks for the Garden +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * + +#globals + +doorOpenInitResp = ptAttribResponder(1,"open on init") +doorResp = ptAttribResponder(2,"normal responder",['Open','Close']) +doorAct = ptAttribActivator(3, "door activator") + +class GiraDoor(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 53637 + self.version = 2 + + + def OnServerInitComplete(self): + self.ageSDL = PtGetAgeSDL() + + self.ageSDL.setFlags("giraDoorOpen",1,1) + self.ageSDL.sendToClients("giraDoorOpen") + + # register for notification of locked SDL var changes + self.ageSDL.setNotify(self.key,"giraDoorOpen",0.0) + + # get initial SDL state + doorClosed = true + try: + doorOpen = self.ageSDL["giraDoorOpen"][0] + except: + doorOpen = true + + if (doorOpen): + print"gira door open" + doorOpenInitResp.run(self.key,avatar = PtGetLocalAvatar()) + else: + print"gira door closed" + + #def OnSDLNotify(self,VARname,SDLname,playerID,tag): + def OnNotify(self, state, id, events): + self.ageSDL = PtGetAgeSDL() + if id == doorAct.id and state: + doorOpen = self.ageSDL["giraDoorOpen"][0] + if (doorOpen): + self.ageSDL["giraDoorOpen"] = (0,) + doorAct.disable() + doorResp.run(self.key,state = 'Close',avatar = PtFindAvatar(events)) + else: + self.ageSDL["giraDoorOpen"] = (1,) + doorAct.disable() + doorResp.run(self.key,state = 'Open',avatar = PtFindAvatar(events)) + elif id == doorResp.id: + doorAct.enable() + diff --git a/Python/GiraSteam.py b/Python/GiraSteam.py new file mode 100644 index 0000000000..59feaa657e --- /dev/null +++ b/Python/GiraSteam.py @@ -0,0 +1,720 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Garden.py +Age: Garden +Date: October 2002 +event manager hooks for the Garden +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * + +fumerol1Resp = ptAttribResponder(1, "fumerol 1 responder",['Opening','Closing','Rumble1','Rumble2','Rumble3','Rumble4','BlastOpen', 'MuffledBlastOnly']) +fumerol2Resp = ptAttribResponder(2, "fumerol 2 responder",['Opening','Closing','Rumble1','Rumble2','Rumble3','Rumble4','BlastOpen', 'MuffledBlastOnly']) +fumerol3Resp = ptAttribResponder(3, "fumerol 3 responder",['Opening','Closing','Rumble1','Rumble2','Rumble3','Rumble4','BlastOpen', 'MuffledBlastOnly']) +fumerol4Resp = ptAttribResponder(4, "fumerol 4 responder",['Opening','Closing','Rumble1','Rumble2','Rumble3','Rumble4','BlastOpen', 'MuffledBlastOnly']) +fumerol5Resp = ptAttribResponder(5, "fumerol 5 responder",['Opening','Closing','Rumble1','Rumble2','Rumble3','Rumble4','BlastOpen', 'MuffledBlastOnly']) +fumerol6Resp = ptAttribResponder(6, "fumerol 6 responder",['Opening','Closing','Rumble1','Rumble2','Rumble3','Rumble4','BlastOpen', 'MuffledBlastOnly']) +fumerol1Det = ptAttribActivator(7, "detector fumerol 1") +fumerol2Det = ptAttribActivator(8, "detector fumerol 2") +fumerol3Det = ptAttribActivator(9, "detector fumerol 3") +fumerol4Det = ptAttribActivator(10, "detector fumerol 4") +fumerol5Det = ptAttribActivator(11, "detector fumerol 5") +fumerol6Det = ptAttribActivator(12, "detector fumerol 6") +fumerol1BlastResp = ptAttribResponder(13,"fumerol 1 Blast responder",['Smoke','Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol2BlastResp = ptAttribResponder(14,"fumerol 2 Blast responder",['Smoke','Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol3BlastResp = ptAttribResponder(15,"fumerol 3 Blast responder",['Smoke','Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol4BlastResp = ptAttribResponder(16,"fumerol 4 Blast responder",['Smoke','Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol5BlastResp = ptAttribResponder(17,"fumerol 5 Blast responder",['Smoke','Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol6BlastResp = ptAttribResponder(18,"fumerol 6 Blast responder",['Smoke','Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +rockPuzBlast = ptAttribResponder(19,"fumerol 1 blast special",netForce=1) +clothPuzBlast = ptAttribResponder(20,"fumerol 6 blast special",netForce=1) +clothJumpBeh = ptAttribBehavior(22,"cloth jump behavior",netForce=1) +rockJumpBeh = ptAttribBehavior(23,"rock jump behavior",netForce=1) +fumerol1Act = ptAttribActivator(24, "Activator fumerol 1") +fumerol2Act = ptAttribActivator(25, "Activator fumerol 2") +fumerol3Act = ptAttribActivator(26, "Activator fumerol 3") +fumerol4Act = ptAttribActivator(27, "Activator fumerol 4") +fumerol5Act = ptAttribActivator(28, "Activator fumerol 5") +fumerol6Act = ptAttribActivator(29, "Activator fumerol 6") +fumerol01JumpResp = ptAttribResponder(30,"fumerol 1 avatar resp",['Level1','Level2','Level3','Level4','Level5','Level6'],netForce=1) +fumerol02JumpResp = ptAttribResponder(31,"fumerol 2 avatar resp",['Level1','Level2','Level3','Level4','Level5','Level6'],netForce=1) +fumerol03JumpResp = ptAttribResponder(32,"fumerol 3 avatar resp",['Level1','Level2','Level3','Level4','Level5','Level6'],netForce=1) +fumerol04JumpResp = ptAttribResponder(33,"fumerol 4 avatar resp",['Level1','Level2','Level3','Level4','Level5','Level6'],netForce=1) +fumerol05JumpResp = ptAttribResponder(34,"fumerol 5 avatar resp",['Level1','Level2','Level3','Level4','Level5','Level6'],netForce=1) +fumerol06JumpResp = ptAttribResponder(35,"fumerol 6 avatar resp",['Level1','Level2','Level3','Level4','Level5','Level6'],netForce=1) + +fumerol01SteamTrig01 = ptAttribActivator(36,"fumerol 1 trigger 1") +fumerol01SteamTrig02 = ptAttribActivator(37,"fumerol 1 trigger 2") +fumerol01SteamTrig03 = ptAttribActivator(38,"fumerol 1 trigger 3") +fumerol01SteamTrig04 = ptAttribActivator(39,"fumerol 1 trigger 4") +fumerol01SteamTrig05 = ptAttribActivator(40,"fumerol 1 trigger 5") +fumerol01SteamTrig06 = ptAttribActivator(41,"fumerol 1 trigger 6") + +fumerol02SteamTrig01 = ptAttribActivator(42,"fumerol 2 trigger 1") +fumerol02SteamTrig02 = ptAttribActivator(43,"fumerol 2 trigger 2") +fumerol02SteamTrig03 = ptAttribActivator(44,"fumerol 2 trigger 3") +fumerol02SteamTrig04 = ptAttribActivator(45,"fumerol 2 trigger 4") +fumerol02SteamTrig05 = ptAttribActivator(46,"fumerol 2 trigger 5") +fumerol02SteamTrig06 = ptAttribActivator(47,"fumerol 2 trigger 6") + +fumerol03SteamTrig01 = ptAttribActivator(48,"fumerol 3 trigger 1") +fumerol03SteamTrig02 = ptAttribActivator(49,"fumerol 3 trigger 2") +fumerol03SteamTrig03 = ptAttribActivator(50,"fumerol 3 trigger 3") +fumerol03SteamTrig04 = ptAttribActivator(51,"fumerol 3 trigger 4") +fumerol03SteamTrig05 = ptAttribActivator(52,"fumerol 3 trigger 5") +fumerol03SteamTrig06 = ptAttribActivator(53,"fumerol 3 trigger 6") + +fumerol04SteamTrig01 = ptAttribActivator(54,"fumerol 4 trigger 1") +fumerol04SteamTrig02 = ptAttribActivator(55,"fumerol 4 trigger 2") +fumerol04SteamTrig03 = ptAttribActivator(56,"fumerol 4 trigger 3") +fumerol04SteamTrig04 = ptAttribActivator(57,"fumerol 4 trigger 4") +fumerol04SteamTrig05 = ptAttribActivator(58,"fumerol 4 trigger 5") +fumerol04SteamTrig06 = ptAttribActivator(59,"fumerol 4 trigger 6") + +fumerol05SteamTrig01 = ptAttribActivator(60,"fumerol 5 trigger 1") +fumerol05SteamTrig02 = ptAttribActivator(61,"fumerol 5 trigger 2") +fumerol05SteamTrig03 = ptAttribActivator(62,"fumerol 5 trigger 3") +fumerol05SteamTrig04 = ptAttribActivator(63,"fumerol 5 trigger 4") +fumerol05SteamTrig05 = ptAttribActivator(64,"fumerol 5 trigger 5") +fumerol05SteamTrig06 = ptAttribActivator(65,"fumerol 5 trigger 6") + +fumerol06SteamTrig01 = ptAttribActivator(66,"fumerol 6 trigger 1") +fumerol06SteamTrig02 = ptAttribActivator(67,"fumerol 6 trigger 2") +fumerol06SteamTrig03 = ptAttribActivator(68,"fumerol 6 trigger 3") +fumerol06SteamTrig04 = ptAttribActivator(69,"fumerol 6 trigger 4") +fumerol06SteamTrig05 = ptAttribActivator(70,"fumerol 6 trigger 5") +fumerol06SteamTrig06 = ptAttribActivator(71,"fumerol 6 trigger 6") + +fumerolSteamEmit01 = ptAttribResponder(72,"fumerol 1 steam emitter",['On','Off']) +fumerolSteamEmit02 = ptAttribResponder(73,"fumerol 2 steam emitter",['On','Off']) +fumerolSteamEmit03 = ptAttribResponder(74,"fumerol 3 steam emitter",['On','Off']) +fumerolSteamEmit04 = ptAttribResponder(75,"fumerol 4 steam emitter",['On','Off']) +fumerolSteamEmit05 = ptAttribResponder(76,"fumerol 5 steam emitter",['On','Off']) +fumerolSteamEmit06 = ptAttribResponder(77,"fumerol 6 steam emitter",['On','Off']) + +fumerolJCClickable = ptAttribActivator(78,"fumerol JC clickable") + +fumerol01SteamSfx = ptAttribResponder(79,"fumerol 1 sfx responder",['Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol02SteamSfx = ptAttribResponder(80,"fumerol 2 sfx responder",['Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol03SteamSfx = ptAttribResponder(81,"fumerol 3 sfx responder",['Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol04SteamSfx = ptAttribResponder(82,"fumerol 4 sfx responder",['Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol05SteamSfx = ptAttribResponder(83,"fumerol 5 sfx responder",['Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) +fumerol06SteamSfx = ptAttribResponder(84,"fumerol 6 sfx responder",['Blast1','Blast2','Blast3','Blast4','Blast5','Blast6']) + +fumerol01topAct = ptAttribActivator(85, "fumerol 1 on top rgn") +fumerol02topAct = ptAttribActivator(86, "fumerol 2 on top rgn") +fumerol03topAct = ptAttribActivator(87, "fumerol 3 on top rgn") +fumerol04topAct = ptAttribActivator(88, "fumerol 4 on top rgn") +fumerol05topAct = ptAttribActivator(89, "fumerol 5 on top rgn") +fumerol06topAct = ptAttribActivator(90, "fumerol 6 on top rgn") + + +inFumerol1 = 0 +inFumerol2 = 0 +inFumerol3 = 0 +inFumerol4 = 0 +inFumerol5 = 0 +inFumerol6 = 0 +kJumpConst = 5000 + +onFumerol1 = 0 +onFumerol2 = 0 +onFumerol3 = 0 +onFumerol4 = 0 +onFumerol5 = 0 +onFumerol6 = 0 + +class GiraSteam(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 53628 + self.version = 3 + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + avatar = PtGetLocalAvatar() + + for x in range(6): + var = "giraSteamvent0" + str(x + 1) + "Open" + print "GiraSteam.OnServerInitComplete():\tsetting up for SDL var: ",var + ageSDL.setFlags(var, 1, 1) + ageSDL.sendToClients(var) + + open = ageSDL["giraSteamvent01Open"][0] + print "GiraSteam.OnServerInitComplete():\tfumerol 1 open = ",open + if (open): + fumerol1Resp.run(self.key,state='Opening',avatar=avatar,fastforward=true) + self.SetSteam(fumerol1BlastResp, avatar) + else: + fumerol1Resp.run(self.key,state='Closing',avatar=avatar,fastforward=true) + self.SetRumble(fumerol1Resp, avatar) + + open = ageSDL["giraSteamvent02Open"][0] + print "GiraSteam.OnServerInitComplete():\tfumerol 2 open = ",open + if (open): + fumerol2Resp.run(self.key,state='Opening',avatar=avatar,fastforward=true) + self.SetSteam(fumerol2BlastResp, avatar) + else: + fumerol2Resp.run(self.key,state='Closing',avatar=avatar,fastforward=true) + self.SetRumble(fumerol2Resp, avatar) + + open = ageSDL["giraSteamvent03Open"][0] + print "GiraSteam.OnServerInitComplete():\tfumerol 3 open = ",open + if (open): + fumerol3Resp.run(self.key,state='Opening',avatar=avatar,fastforward=true) + self.SetSteam(fumerol3BlastResp, avatar) + else: + fumerol3Resp.run(self.key,state='Closing',avatar=avatar,fastforward=true) + self.SetRumble(fumerol3Resp, avatar) + + open = ageSDL["giraSteamvent04Open"][0] + print "GiraSteam.OnServerInitComplete():\tfumerol 4 open = ",open + if (open): + fumerol4Resp.run(self.key,state='Opening',avatar=avatar,fastforward=true) + self.SetSteam(fumerol4BlastResp, avatar) + else: + fumerol4Resp.run(self.key,state='Closing',avatar=avatar,fastforward=true) + self.SetRumble(fumerol4Resp, avatar) + + open = ageSDL["giraSteamvent05Open"][0] + print "GiraSteam.OnServerInitComplete():\tfumerol 5 open = ",open + if (open): + fumerol5Resp.run(self.key,state='Opening',avatar=avatar,fastforward=true) + self.SetSteam(fumerol5BlastResp, avatar) + else: + fumerol5Resp.run(self.key,state='Closing',avatar=avatar,fastforward=true) + self.SetRumble(fumerol5Resp, avatar) + + open = ageSDL["giraSteamvent06Open"][0] + print "GiraSteam.OnServerInitComplete():\tfumerol 6 open = ",open + if (open): + fumerol6Resp.run(self.key,state='Opening',avatar=avatar,fastforward=true) + self.SetSteam(fumerol6BlastResp, avatar) + else: + fumerol6Resp.run(self.key,state='Closing',avatar=avatar,fastforward=true) + self.SetRumble(fumerol6Resp, avatar) + + + def SetRumble(self,resp, theavatar): + numClosed = self.GetNumClosed() + print "GiraSteam.SetRumble():\tnumClosed = ",numClosed + print "GiraSteam.SetRumble():\tresponder = ",resp.id + if (numClosed == 1): + resp.run(self.key,state='MuffledBlastOnly',avatar=theavatar) + elif (numClosed == 2): + ##print"running rumble 1" + resp.run(self.key,state='Rumble1',avatar=theavatar) + elif(numClosed == 3): + ##print"running rumble 2" + resp.run(self.key,state='Rumble2',avatar=theavatar) + elif(numClosed == 4): + ##print"running rumble 3" + resp.run(self.key,state='Rumble3',avatar=theavatar) + elif(numClosed == 5): + ##print"running rumble 4" + resp.run(self.key,state='Rumble4',avatar=theavatar) + if (resp.id == fumerol1Resp.id): + fumerol1BlastResp.run(self.key,state='Smoke',avatar=theavatar) + fumerolSteamEmit01.run(self.key,state='On',avatar=theavatar) + if (resp.id == fumerol2Resp.id): + fumerol2BlastResp.run(self.key,state='Smoke',avatar=theavatar) + fumerolSteamEmit02.run(self.key,state='On',avatar=theavatar) + if (resp.id == fumerol3Resp.id): + fumerol3BlastResp.run(self.key,state='Smoke',avatar=theavatar) + fumerolSteamEmit03.run(self.key,state='On',avatar=theavatar) + if (resp.id == fumerol4Resp.id): + fumerol4BlastResp.run(self.key,state='Smoke',avatar=theavatar) + fumerolSteamEmit04.run(self.key,state='On',avatar=theavatar) + if (resp.id == fumerol5Resp.id): + fumerol5BlastResp.run(self.key,state='Smoke',avatar=theavatar) + fumerolSteamEmit05.run(self.key,state='On',avatar=theavatar) + if (resp.id == fumerol6Resp.id): + fumerol6BlastResp.run(self.key,state='Smoke',avatar=theavatar) + fumerolSteamEmit06.run(self.key,state='On',avatar=theavatar) + return + + def SetSteam(self,resp, theavatar): + numClosed = self.GetNumClosed() + print "GiraSteam.SetSteam():\tnumClosed = ",numClosed + print "GiraSteam.SetSteam():\tresponder = ",resp.id + + if (numClosed == 0): + ##print"running steam blast 2" + resp.run(self.key,state='Blast1',avatar=theavatar) + elif (numClosed == 1): + ##print"running steam blast 3" + resp.run(self.key,state='Blast2',avatar=theavatar) + elif (numClosed == 2): + ##print"running steam blast 4" + resp.run(self.key,state='Blast3',avatar=theavatar) + elif (numClosed == 3): + ##print"running steam blast 5" + resp.run(self.key,state='Blast4',avatar=theavatar) + elif (numClosed == 4): + ##print"running steam blast 6" + resp.run(self.key,state='Blast5',avatar=theavatar) + elif (numClosed == 5): + ##print"running steam blast 6" + resp.run(self.key,state='Blast6',avatar=theavatar) + + if (resp.id == fumerol1Resp.id): + fumerolSteamEmit01.run(self.key,state='Off',avatar=theavatar) + if (resp.id == fumerol2Resp.id): + fumerolSteamEmit02.run(self.key,state='Off',avatar=theavatar) + if (resp.id == fumerol3Resp.id): + fumerolSteamEmit03.run(self.key,state='Off',avatar=theavatar) + if (resp.id == fumerol4Resp.id): + fumerolSteamEmit04.run(self.key,state='Off',avatar=theavatar) + if (resp.id == fumerol5Resp.id): + fumerolSteamEmit05.run(self.key,state='Off',avatar=theavatar) + if (resp.id == fumerol6Resp.id): + fumerolSteamEmit06.run(self.key,state='Off',avatar=theavatar) + + + def JumpAvatar(self,resp, theavatar): + numClosed=self.GetNumClosed() + print "GiraSteam.JumpAvatar():\tnumClosed = ",numClosed + print "GiraSteam.JumpAvatar():\tresponder = ",resp.id + if (numClosed == 0): + ##print"blast level 2" + resp.run(self.key,state='Level1',avatar=theavatar) + if (numClosed == 1): + ##print"blast level 3" + resp.run(self.key,state='Level2',avatar=theavatar) + if (numClosed == 2): + ##print"blast level 4" + resp.run(self.key,state='Level3',avatar=theavatar) + if (numClosed == 3): + ##print"blast level 5" + resp.run(self.key,state='Level4',avatar=theavatar) + if (numClosed == 4): + ##print"blast level 6" + resp.run(self.key,state='Level5',avatar=theavatar) + if (numClosed == 5): + ##print"blast level 6" + resp.run(self.key,state='Level6',avatar=theavatar) + + def PlayBlastSfx(self,resp, theavatar): + numClosed = self.GetNumClosed() + if (numClosed == 0): + #print"blast sfx 1" + resp.run(self.key,state='Blast1',avatar=theavatar) + if (numClosed == 1): + #print"blast sfx 2" + resp.run(self.key,state='Blast2',avatar=theavatar) + if (numClosed == 2): + #print"blast sfx 3" + resp.run(self.key,state='Blast3',avatar=theavatar) + if (numClosed == 3): + #print"blast sfx 4" + resp.run(self.key,state='Blast4',avatar=theavatar) + if (numClosed == 4): + #print"blast sfx 5" + resp.run(self.key,state='Blast5',avatar=theavatar) + if (numClosed == 5): + #print"blast sfx 6" + resp.run(self.key,state='Blast6',avatar=theavatar) + + + def BeginAgeUnLoad(self, avObj): + pass + + def OnTimer(self,id): + print "GiraSteam.OnTimer():\tid = ",id + global onFumerol1 + global onFumerol2 + global onFumerol3 + global onFumerol4 + global onFumerol5 + global onFumerol6 + + if (id == 0): + #trigger failsafe here + ##print"opening all valves" + ageSDL = PtGetAgeSDL() + open = ageSDL["giraSteamvent01Open"][0] + if (not open): + fumerol1Resp.run(self.key,state='BlastOpen',avatar=PtGetLocalAvatar()) + ageSDL["giraSteamvent01Open"] = (1,) + fumerol1BlastResp.run(self.key,state='Blast2',avatar=PtGetLocalAvatar()) + open = ageSDL["giraSteamvent02Open"][0] + if (not open): + fumerol2Resp.run(self.key,state='BlastOpen',avatar=PtGetLocalAvatar()) + ageSDL["giraSteamvent02Open"] = (1,) + fumerol2BlastResp.run(self.key,state='Blast2',avatar=PtGetLocalAvatar()) + open = ageSDL["giraSteamvent03Open"][0] + if (not open): + fumerol3Resp.run(self.key,state='BlastOpen',avatar=PtGetLocalAvatar()) + ageSDL["giraSteamvent03Open"] = (1,) + fumerol3BlastResp.run(self.key,state='Blast2',avatar=PtGetLocalAvatar()) + open = ageSDL["giraSteamvent04Open"][0] + if (not open): + fumerol4Resp.run(self.key,state='BlastOpen',avatar=PtGetLocalAvatar()) + ageSDL["giraSteamvent04Open"] = (1,) + fumerol4BlastResp.run(self.key,state='Blast2',avatar=PtGetLocalAvatar()) + open = ageSDL["giraSteamvent05Open"][0] + if (not open): + fumerol5Resp.run(self.key,state='BlastOpen',avatar=PtGetLocalAvatar()) + ageSDL["giraSteamvent05Open"] = (1,) + fumerol5BlastResp.run(self.key,state='Blast2',avatar=PtGetLocalAvatar()) + open = ageSDL["giraSteamvent06Open"][0] + if (not open): + fumerol6Resp.run(self.key,state='BlastOpen',avatar=PtGetLocalAvatar()) + ageSDL["giraSteamvent06Open"] = (1,) + fumerol6BlastResp.run(self.key,state='Blast2',avatar=PtGetLocalAvatar()) + + if onFumerol1: + fumerol01JumpResp.run(self.key, state = 'Level4', avatar = PtGetLocalAvatar()) + onFumerol1 = 0 + elif onFumerol2: + fumerol02JumpResp.run(self.key, state = 'Level4', avatar = PtGetLocalAvatar()) + onFumerol2 = 0 + elif onFumerol3: + fumerol03JumpResp.run(self.key, state = 'Level4', avatar = PtGetLocalAvatar()) + onFumerol3 = 0 + elif onFumerol4: + fumerol04JumpResp.run(self.key, state = 'Level4', avatar = PtGetLocalAvatar()) + onFumerol4 = 0 + elif onFumerol5: + fumerol05JumpResp.run(self.key, state = 'Level4', avatar = PtGetLocalAvatar()) + onFumerol5 = 0 + elif onFumerol6: + fumerol06JumpResp.run(self.key, state = 'Level4', avatar = PtGetLocalAvatar()) + onFumerol6 = 0 + + fumerol1Act.enable() + fumerol2Act.enable() + fumerol3Act.enable() + fumerol4Act.enable() + fumerol5Act.enable() + fumerol6Act.enable() + + elif id == 99: + PtSetGlobalClickability(1) + + def GetNumClosed(self): + + ageSDL = PtGetAgeSDL() + numClosed = 0 + if (ageSDL["giraSteamvent01Open"] == (0,)): + numClosed = numClosed + 1 + if (ageSDL["giraSteamvent02Open"] == (0,)): + numClosed = numClosed + 1 + if (ageSDL["giraSteamvent03Open"] == (0,)): + numClosed = numClosed + 1 + if (ageSDL["giraSteamvent04Open"] == (0,)): + numClosed = numClosed + 1 + if (ageSDL["giraSteamvent05Open"] == (0,)): + numClosed = numClosed + 1 + if (ageSDL["giraSteamvent06Open"] == (0,)): + numClosed = numClosed + 1 + if (numClosed == 6): + fumerol1Act.disable() + fumerol2Act.disable() + fumerol3Act.disable() + fumerol4Act.disable() + fumerol5Act.disable() + fumerol6Act.disable() + + #print"num closed ",numClosed + return numClosed + + def OnNotify(self,state,id,events): + #print "GiraSteam.OnNotify():\tstate = %d, id = %s" % (state,id) + global inFumerol1 + global inFumerol2 + global inFumerol3 + global inFumerol4 + global inFumerol5 + global inFumerol6 + global kJumpConst + + global onFumerol1 + global onFumerol2 + global onFumerol3 + global onFumerol4 + global onFumerol5 + global onFumerol6 + + avatar = PtFindAvatar(events) + local = PtGetLocalAvatar() + numClosed = self.GetNumClosed() + ageSDL = PtGetAgeSDL() + ##print"id ",id + + entry = false + if avatar == local: + for event in events: + if (event[0] == kCollisionEvent and event[1] == true): + # entered a region + entry = true + + wasLocalNotify = PtWasLocallyNotified(self.key) + if id == fumerol01topAct.id and wasLocalNotify: + onFumerol1 = entry + return + elif id == fumerol02topAct.id and wasLocalNotify: + onFumerol2 = entry + return + elif id == fumerol03topAct.id and wasLocalNotify: + onFumerol3 = entry + return + elif id == fumerol04topAct.id and wasLocalNotify: + onFumerol4 = entry + return + elif id == fumerol05topAct.id and wasLocalNotify: + onFumerol5 = entry + return + elif id == fumerol06topAct.id and wasLocalNotify: + onFumerol6 = entry + return + + if (id == fumerol1Resp.id or id == fumerol2Resp.id or \ + id == fumerol3Resp.id or id == fumerol4Resp.id or \ + id == fumerol5Resp.id or id == fumerol6Resp.id): + ##print"responder callback" + if (numClosed == 6): + ##print"running release mechanism" + PtAtTimeCallback(self.key,1,0) + else: + #set rumble / steam for all fumerols + if (ageSDL["giraSteamvent01Open"][0]): + self.SetSteam(fumerol1BlastResp, avatar) + else: + self.SetRumble(fumerol1Resp, avatar) + if (ageSDL["giraSteamvent02Open"][0]): + self.SetSteam(fumerol2BlastResp, avatar) + else: + self.SetRumble(fumerol2Resp, avatar) + if (ageSDL["giraSteamvent03Open"][0]): + self.SetSteam(fumerol3BlastResp, avatar) + else: + self.SetRumble(fumerol3Resp, avatar) + if (ageSDL["giraSteamvent04Open"][0]): + self.SetSteam(fumerol4BlastResp, avatar) + else: + self.SetRumble(fumerol4Resp, avatar) + if (ageSDL["giraSteamvent05Open"][0]): + self.SetSteam(fumerol5BlastResp, avatar) + else: + self.SetRumble(fumerol5Resp, avatar) + if (ageSDL["giraSteamvent06Open"][0]): + self.SetSteam(fumerol6BlastResp, avatar) + else: + self.SetRumble(fumerol6Resp, avatar) + + if (id == fumerol1Act.id and state): + fumerol1Act.disable() + open = ageSDL["giraSteamvent01Open"][0] + if (open): + ageSDL["giraSteamvent01Open"] = (0,) + fumerol1Resp.run(self.key,state='Closing',avatar=avatar) + fumerol1BlastResp.run(self.key,state='Smoke',avatar=avatar) + inFumerol1 = false + + else: + ageSDL["giraSteamvent01Open"] = (1,) + fumerol1Resp.run(self.key,state='Opening',avatar=avatar) + + elif (id == fumerol2Act.id and state): + fumerol2Act.disable() + open = ageSDL["giraSteamvent02Open"][0] + if (open): + ageSDL["giraSteamvent02Open"] = (0,) + fumerol2Resp.run(self.key,state='Closing',avatar=avatar) + fumerol2BlastResp.run(self.key,state='Smoke',avatar=avatar) + inFumerol2 = false + + else: + ageSDL["giraSteamvent02Open"] = (1,) + fumerol2Resp.run(self.key,state='Opening',avatar=avatar) + + elif (id == fumerol3Act.id and state): + fumerol3Act.disable() + open = ageSDL["giraSteamvent03Open"][0] + if (open): + ageSDL["giraSteamvent03Open"] = (0,) + fumerol3Resp.run(self.key,state='Closing',avatar=avatar) + fumerol3BlastResp.run(self.key,state='Smoke',avatar=avatar) + inFumerol3 = false + + else: + ageSDL["giraSteamvent03Open"] = (1,) + fumerol3Resp.run(self.key,state='Opening',avatar=avatar) + + elif (id == fumerol4Act.id and state): + fumerol4Act.disable() + open = ageSDL["giraSteamvent04Open"][0] + if (open): + ageSDL["giraSteamvent04Open"] = (0,) + fumerol4Resp.run(self.key,state='Closing',avatar=avatar) + fumerol4BlastResp.run(self.key,state='Smoke',avatar=avatar) + inFumerol4 = false + + else: + ageSDL["giraSteamvent04Open"] = (1,) + fumerol4Resp.run(self.key,state='Opening',avatar=avatar) + + elif (id == fumerol5Act.id and state): + fumerol5Act.disable() + open = ageSDL["giraSteamvent05Open"][0] + print "GiraSteam.OnNotify():\tNotify from fumerol05Act; open = %d" % (open) + if (open): + ageSDL["giraSteamvent05Open"] = (0,) + fumerol5Resp.run(self.key,state='Closing',avatar=avatar) + fumerol5BlastResp.run(self.key,state='Smoke',avatar=avatar) + inFumerol5 = false + + else: + ageSDL["giraSteamvent05Open"] = (1,) + fumerol5Resp.run(self.key,state='Opening',avatar=avatar) + + elif (id == fumerol6Act.id and state): + fumerol6Act.disable() + open = ageSDL["giraSteamvent06Open"][0] + print "GiraSteam.OnNotify():\tNotify from fumerol06Act; open = %d" % (open) + if (open): + ageSDL["giraSteamvent06Open"] = (0,) + fumerol6Resp.run(self.key,state='Closing',avatar=avatar) + fumerol6BlastResp.run(self.key,state='Smoke',avatar=avatar) + inFumerol6 = false + + else: + ageSDL["giraSteamvent06Open"] = (1,) + fumerol6Resp.run(self.key,state='Opening',avatar=avatar) + + elif (id == fumerol1Det.id): + #print "1 entry ",entry + inFumerol1 = entry + + elif (id == fumerol2Det.id): + #print "2 entry ",entry + inFumerol2 = entry + + elif (id == fumerol3Det.id): + #print "3 entry ",entry + inFumerol3 = entry + + elif (id == fumerol4Det.id): + #print "4 entry ",entry + inFumerol4 = entry + + elif (id == fumerol5Det.id): + print "5 entry ",entry + inFumerol5 = entry + + elif (id == fumerol6Det.id): + print "6 entry ",entry + inFumerol6 = entry + + elif (id == rockJumpBeh.id): + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + #rockPuzBlast.run(self.key,avatar=avatar) + pass + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + fumerol1Det.enable() + + elif (id == clothJumpBeh.id): + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + #clothPuzBlast.run(self.key,avatar=avatar) + pass + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + #fumerolJCClickable.enable() + PtAtTimeCallback(self.key, 1, 99) + fumerol6Det.enable() + #print"enabled jc" + + elif ((id == fumerol01SteamTrig01.id or id == fumerol01SteamTrig02.id or\ + id == fumerol01SteamTrig03.id or id == fumerol01SteamTrig04.id or\ + id == fumerol01SteamTrig05.id or id == fumerol01SteamTrig06.id) and state): + self.PlayBlastSfx(fumerol01SteamSfx, avatar) + if (inFumerol1): + #inFumerol1 = false + if (numClosed < 5): + self.JumpAvatar(fumerol01JumpResp, avatar) + elif (numClosed == 5): + inFumerol1 = false + fumerol1Det.disable() + rockJumpBeh.run(avatar) + + elif ((id == fumerol02SteamTrig01.id or id == fumerol02SteamTrig02.id or\ + id == fumerol02SteamTrig03.id or id == fumerol02SteamTrig04.id or\ + id == fumerol02SteamTrig05.id or id == fumerol02SteamTrig06.id) and state): + self.PlayBlastSfx(fumerol02SteamSfx, avatar) + if (inFumerol2): + #inFumerol2 = false + self.JumpAvatar(fumerol02JumpResp, avatar) + + elif ((id == fumerol03SteamTrig01.id or id == fumerol03SteamTrig02.id or\ + id == fumerol03SteamTrig03.id or id == fumerol03SteamTrig04.id or\ + id == fumerol03SteamTrig05.id or id == fumerol03SteamTrig06.id) and state): + self.PlayBlastSfx(fumerol03SteamSfx, avatar) + if (inFumerol3): + #inFumerol3 = false + self.JumpAvatar(fumerol03JumpResp, avatar) + + elif ((id == fumerol04SteamTrig01.id or id == fumerol04SteamTrig02.id or\ + id == fumerol04SteamTrig03.id or id == fumerol04SteamTrig04.id or\ + id == fumerol04SteamTrig05.id or id == fumerol04SteamTrig06.id) and state): + self.PlayBlastSfx(fumerol04SteamSfx, avatar) + if (inFumerol4): + #inFumerol4 = false + self.JumpAvatar(fumerol04JumpResp, avatar) + + elif ((id == fumerol05SteamTrig01.id or id == fumerol05SteamTrig02.id or\ + id == fumerol05SteamTrig03.id or id == fumerol05SteamTrig04.id or\ + id == fumerol05SteamTrig05.id or id == fumerol05SteamTrig06.id) and state): + self.PlayBlastSfx(fumerol05SteamSfx, avatar) + if id == fumerol05SteamTrig01.id: + print "notify from fumerol05SteamTrig01; inFumerol5 = ",inFumerol5 + if (inFumerol5): + #inFumerol5 = false + self.JumpAvatar(fumerol05JumpResp, avatar) + + elif ((id == fumerol06SteamTrig01.id or id == fumerol06SteamTrig02.id or\ + id == fumerol06SteamTrig03.id or id == fumerol06SteamTrig04.id or\ + id == fumerol06SteamTrig05.id or id == fumerol06SteamTrig06.id) and state): + self.PlayBlastSfx(fumerol06SteamSfx, avatar) + if id == fumerol06SteamTrig01.id: + print "notify from fumerol06SteamTrig01; inFumerol6 = ",inFumerol6 + if (inFumerol6): + #inFumerol6=false + if (numClosed < 5): + self.JumpAvatar(fumerol06JumpResp, avatar) + elif (numClosed == 5): + inFumerol6 = false + PtSetGlobalClickability(0) + fumerol6Det.disable() + clothJumpBeh.run(avatar) + + + diff --git a/Python/GreatTreePub.py b/Python/GreatTreePub.py new file mode 100644 index 0000000000..47aa7a6107 --- /dev/null +++ b/Python/GreatTreePub.py @@ -0,0 +1,42 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: GreatTreePub.py +Age: GreatTreePub +Date: March 2007 +AgeSDLHook for GreatTreePub +""" + +from Plasma import * +from PlasmaTypes import * + + +class GreatTreePub(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5323 + self.version = 1 diff --git a/Python/GreatZero.py b/Python/GreatZero.py new file mode 100644 index 0000000000..9adec83e2e --- /dev/null +++ b/Python/GreatZero.py @@ -0,0 +1,41 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: GreatZero.py +Age: Great Zero in D'ni +Date: February 2003 +Event Manager hooks for GreatZero +""" + +from Plasma import * +from PlasmaTypes import * + +class GreatZero(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 209 + self.version = 1 diff --git a/Python/Jalak.py b/Python/Jalak.py new file mode 100644 index 0000000000..12bec445b5 --- /dev/null +++ b/Python/Jalak.py @@ -0,0 +1,46 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Jalak.py +Age: Jalak +Date: April 2007 +AgeSDL hook for Jalak +""" + +from Plasma import * +from PlasmaTypes import * + + +class Jalak(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 6000 + self.version = 1 + + + def OnNotify(self,state,id,events): + pass diff --git a/Python/Kadish.py b/Python/Kadish.py new file mode 100644 index 0000000000..324376e3a4 --- /dev/null +++ b/Python/Kadish.py @@ -0,0 +1,71 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Kadish.py +Age: Kadish Tolesa +Date: February 2003 +Event Manager hooks for Kadish Tolesa +""" + +from Plasma import * +from PlasmaTypes import * + +class Kadish(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5207 + self.version = 1 + + def OnFirstUpdate(self): + #~ # record our visit in player's chronicle + #~ kModuleName = "Garden" + #~ kChronicleVarName = "LinksIntoGarden" + #~ kChronicleVarType = 0 + #~ vault = ptVault() + #~ if type(vault) != type(None): + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if type(entry) == type(None): + #~ # not found... add current level chronicle + #~ vault.addChronicleEntry(kChronicleVarName,kChronicleVarType,"%d" %(1)) + #~ PtDebugPrint("%s:\tentered new chronicle counter %s" % (kModuleName,kChronicleVarName)) + #~ else: + #~ import string + #~ count = string.atoi(entry.chronicleGetValue()) + #~ count = count + 1 + #~ entry.chronicleSetValue("%d" % (count)) + #~ entry.save() + #~ PtDebugPrint("%s:\tyour current count for %s is %s" % (kModuleName,kChronicleVarName,entry.chronicleGetValue())) + #~ else: + #~ PtDebugPrint("%s:\tERROR trying to access vault -- can't update %s variable in chronicle." % (kModuleName,kChronicleVarName)) + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/Kveer.py b/Python/Kveer.py new file mode 100644 index 0000000000..6c349e1fda --- /dev/null +++ b/Python/Kveer.py @@ -0,0 +1,54 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Kveer.py +Age: Kveer +Date: September 2007 +""" + +from Plasma import * +from PlasmaTypes import * + + +class Kveer(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 5400 + self.version = 1 + + + def OnFirstUpdate(self): + pass + + + def Load(self): + pass + + + def OnNotify(self,state,id,events): + pass + + diff --git a/Python/LiveBahroCaves.py b/Python/LiveBahroCaves.py new file mode 100644 index 0000000000..b0734fc63d --- /dev/null +++ b/Python/LiveBahroCaves.py @@ -0,0 +1,81 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: LiveBahroCaves.py +Age: LiveBahroCaves +Date: May 2007 +""" + +from Plasma import * +from PlasmaTypes import * + +## constants +BlueSpiral = ["EderDelin","EderTsogal"] +Pods = ["Negilahn","Dereno","Payiferen","Tetsonot"] +Live5 = ["Minkata"] +Live6 = ["Ercana","Ahnonay"] + + +class LiveBahroCaves(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 8810 + self.version = 1 + + ageFrom = PtGetPrevAgeName() + + pages = [] + + print "LiveBahroCaves.__init__(): came from: %s" % (ageFrom) + if ageFrom in BlueSpiral: + pages += ["BlueSpiralCave"] + elif ageFrom in Pods: + pages += ["PODcave"] + elif ageFrom in Live5: + pages += ["MINKcave"] + elif ageFrom in Live6: + pages += ["POTScave"] + else: + print "LiveBahroCaves.__init__(): age not recognized, will page in BlueSpiralCave as default" + pages += ["BlueSpiralCave"] + + print "LiveBahroCaves.__init__(): paging in: %s" % (pages) + PtPageInNode(pages) + + +# def OnFirstUpdate(self): +# pass +# +# def OnServerInitComplete(self): +# pass +# +# def Load(self): +# pass +# +# def OnNotify(self,state,id,events): +# pass + + diff --git a/Python/Minkata.py b/Python/Minkata.py new file mode 100644 index 0000000000..64da5a87ff --- /dev/null +++ b/Python/Minkata.py @@ -0,0 +1,48 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Minkata.py +Age: Minkata +Date: April 2007 +Author: Derek Odell +""" + +from Plasma import * +from PlasmaTypes import * + +# define the attributes that will be entered in max + +# define globals + +#==================================== + +class Minkata(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 5257 + version = 1 + self.version = version diff --git a/Python/Myst.py b/Python/Myst.py new file mode 100644 index 0000000000..44ec3c2e3d --- /dev/null +++ b/Python/Myst.py @@ -0,0 +1,50 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Myst.py +Age: Myst +Date: March 2004 +""" + +from Plasma import * +from PlasmaTypes import * + +class Myst(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5336 + self.version = 1 + + def OnFirstUpdate(self): + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/Negilahn.py b/Python/Negilahn.py new file mode 100644 index 0000000000..b92f2c504d --- /dev/null +++ b/Python/Negilahn.py @@ -0,0 +1,45 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Negilahn.py +Age: Negilahn +Date: October 2003 +AgeSDL hooks for Negilahn +""" + +from Plasma import * +from PlasmaTypes import * + +class Negilahn(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5239 + self.version = 1 + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/Neighborhood.py b/Python/Neighborhood.py new file mode 100644 index 0000000000..8e86bd79f6 --- /dev/null +++ b/Python/Neighborhood.py @@ -0,0 +1,67 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Neighborhood.py +Age: Neighborhood +Date: August 2002 +event manager hooks for the Neighborhood +""" + +from Plasma import * +from PlasmaTypes import * + +class Neighborhood(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5014 + self.version = 1 + + def OnFirstUpdate(self): + #~ # record our visit in player's chronicle + #~ kModuleName = "Neighborhood" + #~ kChronicleVarName = "LinksIntoNeighborhood" + #~ kChronicleVarType = 0 + #~ vault = ptVault() + #~ if type(vault) != type(None): + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if type(entry) == type(None): + #~ # not found... add current level chronicle + #~ vault.addChronicleEntry(kChronicleVarName,kChronicleVarType,"%d" %(1)) + #~ PtDebugPrint("%s:\tentered new chronicle counter %s" % (kModuleName,kChronicleVarName)) + #~ else: + #~ import string + #~ count = string.atoi(entry.chronicleGetValue()) + #~ count = count + 1 + #~ entry.chronicleSetValue("%d" % (count)) + #~ entry.save() + #~ PtDebugPrint("%s:\tyour current count for %s is %s" % (kModuleName,kChronicleVarName,entry.chronicleGetValue())) + #~ else: + #~ PtDebugPrint("%s:\tERROR trying to access vault -- can't update %s variable in chronicle." % (kModuleName,kChronicleVarName)) + pass + + def OnNotify(self,state,id,events): + pass diff --git a/Python/Neighborhood02.py b/Python/Neighborhood02.py new file mode 100644 index 0000000000..c044609a6c --- /dev/null +++ b/Python/Neighborhood02.py @@ -0,0 +1,120 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Neighborhood02.py +Age: Neighborhood02 +Date: January 2004 +event manager hooks for Neighborhood02, aka Kirel +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import time + +class Neighborhood02(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5700 + self.version = 1 + + def OnFirstUpdate(self): + pass + def OnNotify(self,state,id,events): + pass + + def OnServerInitComplete(self): + self.UpdateRecentVisitors() + + def UpdateRecentVisitors(self): + try: + AmCCR = ptCCRMgr().getLevel() + except: + AmCCR = 0 + if not AmCCR: + # add player to recent players list + deviceNode = None + deviceInbox = None + playerlist = None + + # find the device + avault = ptAgeVault() + adevicesfolder = avault.getAgeDevicesFolder() + adevices = adevicesfolder.getChildNodeRefList() + for device in adevices: + device = device.getChild() + devicetn = device.upcastToTextNoteNode() + if devicetn and devicetn.getTitle() == "D'ni Imager Right": + deviceNode = devicetn + break + + # if we have the device then find the inbox + if deviceNode: + inboxes = deviceNode.getChildNodeRefList() + for inbox in inboxes: + inbox = inbox.getChild() + inboxfolder = inbox.upcastToFolderNode() + if inboxfolder: + deviceInbox = inboxfolder + break + + # if we have the inbox then look for the heek score note + if deviceInbox: + items = deviceInbox.getChildNodeRefList() + for item in items: + item = item.getChild() + itemtn = item.upcastToTextNoteNode() + if itemtn: + if itemtn.getTitle() == "Visitors, Visiteurs, Besucher": + playerlist = itemtn + break + elif itemtn.getTitle() == "Most Recent Visitors": + itemtn.setTitle("Visitors, Visiteurs, Besucher") + playerlist = itemtn + break + + # if we have the text note then update it, otherwise create it + if playerlist: + currenttime = time.gmtime(PtGetDniTime()) + currenttimestr = time.strftime("%m/%d/%Y %I:%M %p", currenttime) + playername = PtGetLocalPlayer().getPlayerName() + thetext = playerlist.getText() + if (thetext.count("\n") + 1) > 15: + thetext = thetext[:thetext.rfind("\n")] + thetext = currenttimestr + (" " * (30 - len(currenttimestr))) + playername + "\n" + thetext + playerlist.setText(thetext) + playerlist.save() + else: + currenttime = time.gmtime(PtGetDniTime()) + currenttimestr = time.strftime("%m/%d/%Y %I:%M %p", currenttime) + playername = PtGetLocalPlayer().getPlayerName() + thetext = currenttimestr + (" " * (30 - len(currenttimestr))) + playername + + playerlist = ptVaultTextNoteNode(0) + playerlist.setTitle("Visitors, Visiteurs, Besucher") + playerlist.setText(thetext) + deviceInbox.addNode(playerlist) \ No newline at end of file diff --git a/Python/Nexus.py b/Python/Nexus.py new file mode 100644 index 0000000000..333ebb3864 --- /dev/null +++ b/Python/Nexus.py @@ -0,0 +1,51 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Nexus.py +Age: Nexus +Date: January 2003 +vault manager hook for the nexus +""" + +from Plasma import * +from PlasmaTypes import * + +class Nexus(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5036 + self.version = 1 + + def OnFirstUpdate(self): + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/Payiferen.py b/Python/Payiferen.py new file mode 100644 index 0000000000..e92477ed4a --- /dev/null +++ b/Python/Payiferen.py @@ -0,0 +1,45 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Payiferen.py +Age: Payiferen +Date: October 2003 +AgeSDL hooks for Payiferen +""" + +from Plasma import * +from PlasmaTypes import * + +class Payiferen(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5255 + self.version = 1 + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/PelletBahroCave.py b/Python/PelletBahroCave.py new file mode 100644 index 0000000000..71fbecf677 --- /dev/null +++ b/Python/PelletBahroCave.py @@ -0,0 +1,309 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: PelletBahroCave.py #----->Formerly BahroCave02.py +Age: PelletBahroCave #----->Formerly BahroCave02 +Date: March 2004 +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * +from PlasmaKITypes import * +from xPsnlVaultSDL import * +import string +import time + + +# --------- +# max wiring +# --------- + +symbolStates = ['State 1','State 2','State 3','State 4','State 5','State 6','State 7'] + +SDLGotPellet = ptAttribString(1,"SDL: got pellet") +RespDropPellet = ptAttribResponder(2,"resp: got pellet",['upper','lower'],netForce=1) +RespFadeInPellet = ptAttribResponder(3,"resp: fade-in pellet",netForce=1) +RespPlayDud = ptAttribResponder(4,"resp: pellet dud",netForce=1) +RespPlayBubbles = ptAttribResponder(5,"resp: pellet bubbles",['Hi','Med','Low'],netForce=1) +RespPlaySteam = ptAttribResponder(6,"resp: pellet steam",['Hi','Med','Low'],netForce=1) +RespPlayOrangeGlow = ptAttribResponder(7,"resp: pellet orange glow",['Hi','Med','Low'],netForce=1) +RespPlayBoom = ptAttribResponder(8,"resp: pellet explosion",['Hi','Med','Low'],netForce=1) +RespPlayWhiteGlow = ptAttribResponder(9,"resp: pellet white glow",netForce=1) +RespSymbolOnN = ptAttribResponder(10,"resp: N symbol on",statelist=symbolStates,netForce=1) +RespSymbolOffN = ptAttribResponder(11,"resp: N symbol off",statelist=symbolStates,netForce=1) +RespSymbolOnE = ptAttribResponder(12,"resp: E symbol on",statelist=symbolStates,netForce=1) +RespSymbolOffE = ptAttribResponder(13,"resp: E symbol off",statelist=symbolStates,netForce=1) +RespSymbolOnS = ptAttribResponder(14,"resp: S symbol on",statelist=symbolStates,netForce=1) +RespSymbolOffS = ptAttribResponder(15,"resp: S symbol off",statelist=symbolStates,netForce=1) +RespSymbolOnW = ptAttribResponder(16,"resp: W symbol on",statelist=symbolStates,netForce=1) +RespSymbolOffW = ptAttribResponder(17,"resp: W symbol off",statelist=symbolStates,netForce=1) + +respListSymbolsOn = [RespSymbolOnN,RespSymbolOnE,RespSymbolOnS,RespSymbolOnW] +respListSymbolsOff = [RespSymbolOffN,RespSymbolOffE,RespSymbolOffS,RespSymbolOffW] + + +# globals +gotPellet = 0 +lowerCave = 0 +sdlSolutions = [] +chronSolutions = [] +SymbolsOnSecs = 0.0 + +#contants +sdlSolutionNames = ["plltImagerSolutionN","plltImagerSolutionE","plltImagerSolutionS","plltImagerSolutionW"] + + +class PelletBahroCave(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 8000 + self.version = 7 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global gotPellet + global lowerCave + global sdlSolutions + global chronSolutions + + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLGotPellet.value,1,1) + ageSDL.sendToClients(SDLGotPellet.value) + + for sdl in sdlSolutionNames: + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(sdl,1,1) + ageSDL.sendToClients(sdl) + ageSDL.setNotify(self.key,sdl,0.0) + val = ageSDL[sdl][0] + sdlSolutions.append(val) + chronString = self.GetPelletCaveSolution() + #print "found pellet cave solution: ",chronString + try: + chronString = chronString.split(",") + for sol in chronString: + chronSolutions.append(string.atoi(sol)) + print "found pellet cave solution: ",chronSolutions + print "current sdl values for solution = ",sdlSolutions + if self.sceneobject.isLocallyOwned(): + self.ShowSymbols() + except: + print "ERROR! Couldn't get the solution information, symbols won't appear" + + linkmgr = ptNetLinkingMgr() + link = linkmgr.getCurrAgeLink() + spawnPoint = link.getSpawnPoint() + + spTitle = spawnPoint.getTitle() + spName = spawnPoint.getName() + + if spName == "LinkInPointLower": + lowerCave = 1 + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + print"failed to get local avatar" + return + avatar.avatar.registerForBehaviorNotify(self.key) + else: + lowerCave = 0 + vault = ptVault() + entry = vault.findChronicleEntry("GotPellet") + if type(entry) != type(None): + entryValue = entry.chronicleGetValue() + gotPellet = string.atoi(entryValue) + if gotPellet != 0: + entry.chronicleSetValue("%d" % (0)) + entry.save() + avatar = PtGetLocalAvatar() + avatar.avatar.registerForBehaviorNotify(self.key) + else: + return + else: + return + + try: + ageSDL = PtGetAgeSDL() + except: + print "PelletBahroCave.OnServerInitComplete():\tERROR---Cannot find the PelletBahroCave Age SDL" + ageSDL[SDLGotPellet.value] = (0,) + + ageSDL.setNotify(self.key,SDLGotPellet.value,0.0) + + pelletSDL = ageSDL[SDLGotPellet.value][0] + if pelletSDL != gotPellet: + ageSDL[SDLGotPellet.value] = (gotPellet,) + + PtDebugPrint("PelletBahroCave:OnServerInitComplete: SDL for pellet is now %d" % (gotPellet)) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global sdlSolutions + + if VARname in sdlSolutionNames: + id = sdlSolutionNames.index(VARname) + ageSDL = PtGetAgeSDL() + sdlSolutions[id] = ageSDL[sdlSolutionNames[id]][0] + print "PelletBahroCave.OnSDLNotify(): ",sdlSolutionNames[id]," now = ",sdlSolutions[id] + + + def OnBehaviorNotify(self,type,id,state): + global gotPellet + global lowerCave + + PtDebugPrint("PelletBahroCave.OnBehaviorNotify(): %d" % (type)) + if type == PtBehaviorTypes.kBehaviorTypeLinkIn and state: + if not lowerCave: + if gotPellet != 0: + RespFadeInPellet.run(self.key) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + if type == PtBehaviorTypes.kBehaviorTypeLinkIn and not state: + if lowerCave: + pass + #self.IPruneDrops() + avatar = PtGetLocalAvatar() + avatar.avatar.unRegisterForBehaviorNotify(self.key) + + + def OnNotify(self,state,id,events): + global gotPellet + global SymbolsOnSecs + + if (id == RespFadeInPellet.id and gotPellet): + self.IDropUpper(gotPellet) + + if (id == RespDropPellet.id and gotPellet): + print "PelletBahroCave.OnNotify: RespDropPellet callback, will now play FX" + pellet = (gotPellet - 300) + if pellet <= 0: + if pellet <= -250: + RespPlaySteam.run(self.key,state="Hi") + RespPlayBubbles.run(self.key,state="Hi") + elif pellet > -250 and pellet <= -150: + RespPlaySteam.run(self.key,state="Med") + RespPlayBubbles.run(self.key,state="Med") + elif pellet > -150 and pellet <= -50: + RespPlaySteam.run(self.key,state="Low") + RespPlayBubbles.run(self.key,state="Low") + elif pellet > -50 and pellet <= 0: + RespPlayDud.run(self.key) + elif pellet > 0 and pellet <= 270: + if pellet > 0 and pellet <= 74: + RespPlayOrangeGlow.run(self.key,state="Low") + SymbolsOnSecs = 3.0 + PtAtTimeCallback(self.key,1.5,2) + elif pellet > 74 and pellet <= 149: + RespPlayOrangeGlow.run(self.key,state="Med") + SymbolsOnSecs = 6.0 + PtAtTimeCallback(self.key,1.2,2) + elif pellet > 149 and pellet <= 209: + RespPlayOrangeGlow.run(self.key,state="Hi") + SymbolsOnSecs = 9.0 + PtAtTimeCallback(self.key,0.9,2) + elif pellet > 209 and pellet <= 270: + RespPlayWhiteGlow.run(self.key) + SymbolsOnSecs = 18.0 + PtAtTimeCallback(self.key,0.5,2) + elif pellet > 270: + if pellet > 270 and pellet <= 295: + RespPlayBoom.run(self.key,state="Low") + elif pellet > 295 and pellet <= 320: + RespPlayBoom.run(self.key,state="Med") + elif pellet > 320: + RespPlayBoom.run(self.key,state="Hi") + PtAtTimeCallback(self.key,0.5,1) + + + def OnTimer(self,id): + global SymbolsOnSecs + if id == 1: + cam = ptCamera() + cam.enableFirstPersonOverride() + elif id == 2: + self.PlaySymbols(1) + PtAtTimeCallback(self.key,SymbolsOnSecs,3) + SymbolsOnSecs = 0 + elif id == 3: + self.PlaySymbols(0) + + + def IDropUpper(self,recipe): + print "in IDropUpper." + RespDropPellet.run(self.key,state="upper") + + + def GetPelletCaveSolution(self): + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + print "Found age data folder" + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "PelletCaveSolution": + solution = chron.getValue() + return solution + else: + return 0 + + + def ShowSymbols(self): + global sdlSolutions + ageSDL = PtGetAgeSDL() + n = 0 + for sdl in sdlSolutions: + if sdlSolutions[n] != chronSolutions[n]: + newVal = chronSolutions[n] + ageSDL[sdlSolutionNames[n]] = (newVal,) + sdlSolutions[n] = newVal + n += 1 + print "SDL solutions list now = ",sdlSolutions + + + def PlaySymbols(self,state): + n = 0 + while n < len(sdlSolutions): + symstate = symbolStates[sdlSolutions[n]] + if state: + respListSymbolsOn[n].run(self.key,state=symstate) + else: + respListSymbolsOff[n].run(self.key,state=symstate) + n += 1 + diff --git a/Python/Personal.py b/Python/Personal.py new file mode 100644 index 0000000000..26bec13f4a --- /dev/null +++ b/Python/Personal.py @@ -0,0 +1,206 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Personal.py +Age: Personal +Date: Octoboer 2002 +event manager hooks for the personal age +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import string + + +kEmptyGuid = '0000000000000000' +kIntroPlayedChronicle = "IntroPlayed" + + +class Personal(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5022 + self.version = 5 + PtDebugPrint("Personal: __init__ version %d.%d" % (self.version,1),level=kWarningLevel) + + + def gotPublicAgeList(self,ages): + # got a list of cities, now we save our var! + # we're going to pick the one with the highest guid (nexus picks the lowest guid) + highestGuid = 0 + for age in ages: + guid = age[0].getAgeInstanceGuid() + if guid > highestGuid: + highestGuid = guid + + PtDebugPrint("Personal.gotPublicAgeList(): Using city GUID "+str(highestGuid)) + vault = ptVault() + l = ptAgeInfoStruct() + l.setAgeFilename('city') + myCity = vault.getOwnedAgeLink(l) + if myCity: + cityInfo = myCity.getAgeInfo() + if cityInfo: + cityInfo.setAgeInstanceGuid(highestGuid) + cityInfo.save() + + + def OnFirstUpdate(self): + # test for first time to play the intro movie + vault = ptVault() + entry = vault.findChronicleEntry(kIntroPlayedChronicle) + if type(entry) != type(None): + # already played intro sometime in the past... just let 'em play + # enable twice because if we came from the ACA (closet->ACA->personal) it was disabled twice + PtSendKIMessage(kEnableKIandBB,0) + PtSendKIMessage(kEnableKIandBB,0) + # enable yeesha book in case we came from the bahro cave + PtSendKIMessage(kEnableYeeshaBook,0) + else: + # make sure the KI and blackbar is still diabled + PtSendKIMessage(kDisableKIandBB,0) + # It's the first time... start the intro movie, just by loading the movie dialog + PtLoadDialog("IntroMovieGUI") + + # turn off sound log tracks + import xSndLogTracks + xSndLogTracks.UnsetLogMode() + + vault = ptVault() + l = ptAgeInfoStruct() + l.setAgeFilename('city') + myCity = vault.getOwnedAgeLink(l) + if myCity: + cityInfo = myCity.getAgeInfo() + if cityInfo: + if cityInfo.getAgeInstanceGuid()==kEmptyGuid: + # we don't have it yet, so make it! (the callback will make it for us) + PtGetPublicAgeList('city',self) + else: + PtDebugPrint("hmm. city link has no age info node") + else: + PtDebugPrint("hmm. player has no city link") + + #~ # record our visit in player's chronicle + #~ kModuleName = "Personal" + #~ kChronicleVarName = "LinksIntoPersonalAge" + #~ kChronicleVarType = 0 + #~ vault = ptVault() + #~ if type(vault) != type(None): + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if type(entry) == type(None): + #~ # not found... add current level chronicle + #~ vault.addChronicleEntry(kChronicleVarName,kChronicleVarType,"%d" %(1)) + #~ PtDebugPrint("%s:\tentered new chronicle counter %s" % (kModuleName,kChronicleVarName)) + #~ else: + #~ import string + #~ count = string.atoi(entry.chronicleGetValue()) + #~ count = count + 1 + #~ entry.chronicleSetValue("%d" % (count)) + #~ entry.save() + #~ PtDebugPrint("%s:\tyour current count for %s is %s" % (kModuleName,kChronicleVarName,entry.chronicleGetValue())) + #~ else: + #~ PtDebugPrint("%s:\tERROR trying to access vault -- can't update %s variable in chronicle." % (kModuleName,kChronicleVarName)) + pass + + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + PtDebugPrint("Personal.OnServerInitComplete(): Grabbing first week clothing item boolean") + try: + firstWeekClothing = ageSDL["FirstWeekClothing"][0] + except: + PtDebugPrint("Unable to get the first week clothing item bool, not going to add it just to be safe") + firstWeekClothing = 0 + + avatar = PtGetLocalAvatar() + currentgender = avatar.avatar.getAvatarClothingGroup() + if firstWeekClothing: + if currentgender == kFemaleClothingGroup: + clothingName = "FReward_Beta" + else: + clothingName = "MReward_Beta" + clothingList = avatar.avatar.getWardrobeClothingList() + if clothingName not in clothingList: + PtDebugPrint("Adding "+clothingName+" clothing item to your closet! Aren't you lucky?") + avatar.avatar.addWardrobeClothingItem(clothingName,ptColor().white(),ptColor().white()) + else: + PtDebugPrint("You already have " + clothingName + " so I'm not going to add it again.") + else: + PtDebugPrint("I guess you're too late, you don't get the first week clothing item") + + PtDebugPrint("Personal.OnServerInitComplete(): Checking to see if we need to add reward clothing to your closet") + try: + rewardList = ageSDL["RewardClothing"][0] + except: + PtDebugPrint("Unable to grab the reward clothing list from SDL, not going to add anything") + rewardList = "" + PtDebugPrint("Personal.OnServerInitComplete(): Checking to see if we need to add global reward clothing to your closet") + try: + globalRewardList = ageSDL["GlobalRewardClothing"][0] + except: + PtDebugPrint("Unable to grab the global reward clothing list from SDL, not going to add anything") + globalRewardList = "" + + nameSuffixList = [] + if rewardList != "": + nameSuffixList += rewardList.split(";") # get all the suffixes + if globalRewardList != "": + nameSuffixList += globalRewardList.split(";") # add the global items + for suffix in nameSuffixList: + suffix = suffix.strip() # get rid of all the whitespace + if currentgender == kFemaleClothingGroup: + genderPrefix = "FReward_" + else: + genderPrefix = "MReward_" + clothingName = genderPrefix + suffix + clothingList = avatar.avatar.getWardrobeClothingList() + if clothingName not in clothingList: + PtDebugPrint("Adding "+clothingName+" to your closet") + avatar.avatar.addWardrobeClothingItem(clothingName,ptColor().white(),ptColor().white()) + else: + PtDebugPrint("You already have " + clothingName + " so I'm not going to add it again.") + if rewardList != "": + ageSDL["RewardClothing"] = ("",) + else: + PtDebugPrint("Reward clothing list empty, not adding any clothing") + + # make sure the player has at least a microKI + # This also ensures that the player gets a Yeesha Book + PtSendKIMessageInt(kUpgradeKILevel,kMicroKI) + + + def Load(self): + pass + + + def OnNotify(self,state,id,events): + pass + + + diff --git a/Python/PhilRelto.py b/Python/PhilRelto.py new file mode 100644 index 0000000000..f3810751a4 --- /dev/null +++ b/Python/PhilRelto.py @@ -0,0 +1,56 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: PhilRelto.py +Age: PhilRelto +Date: January 2003 +event manager hooks for phil's personal age +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import whrandom + +class PhilRelto(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5328 + self.version = 1 + PtDebugPrint("PhilRelto: __init__ version %d.%d" % (self.version,1),level=kWarningLevel) + + def OnServerInitComplete(self): + pass + + def OnFirstUpdate(self): + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass diff --git a/Python/SpyRoom.py b/Python/SpyRoom.py new file mode 100644 index 0000000000..ce9a08b013 --- /dev/null +++ b/Python/SpyRoom.py @@ -0,0 +1,62 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: SpyRoom.py +Age: spyroom +Date: January 2004 +""" + +from Plasma import * +from PlasmaTypes import * +import time + +class SpyRoom(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5331 + self.version = 1 + + def OnFirstUpdate(self): + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass + + def OnServerInitComplete(self): + vault = ptVault() + + # i know this isn't bevin but this is just in case they haven't gone to bevin yet + entry = vault.findChronicleEntry("sjBevinVisted") + if not entry: + print "spyroom: did not find the chron var" + vault.addChronicleEntry("sjBevinVisted", 0, str(int( time.time() )) ) + else: + print "spyroom: found the chron var" + diff --git a/Python/Teledahn.py b/Python/Teledahn.py new file mode 100644 index 0000000000..43a092b4bc --- /dev/null +++ b/Python/Teledahn.py @@ -0,0 +1,71 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Teledahn.py +Age: Teledahn +Date: October 2002 +event manager hooks for the Teledahn +""" + +from Plasma import * +from PlasmaTypes import * + +class Teledahn(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5025 + self.version = 1 + + def OnFirstUpdate(self): + #~ # record our visit in player's chronicle + #~ kModuleName = "Teledahn" + #~ kChronicleVarName = "LinksIntoTeledahn" + #~ kChronicleVarType = 0 + #~ vault = ptVault() + #~ if type(vault) != type(None): + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if type(entry) == type(None): + #~ # not found... add current level chronicle + #~ vault.addChronicleEntry(kChronicleVarName,kChronicleVarType,"%d" %(1)) + #~ PtDebugPrint("%s:\tentered new chronicle counter %s" % (kModuleName,kChronicleVarName)) + #~ else: + #~ import string + #~ count = string.atoi(entry.chronicleGetValue()) + #~ count = count + 1 + #~ entry.chronicleSetValue("%d" % (count)) + #~ entry.save() + #~ PtDebugPrint("%s:\tyour current count for %s is %s" % (kModuleName,kChronicleVarName,entry.chronicleGetValue())) + #~ else: + #~ PtDebugPrint("%s:\tERROR trying to access vault -- can't update %s variable in chronicle." % (kModuleName,kChronicleVarName)) + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/Tetsonot.py b/Python/Tetsonot.py new file mode 100644 index 0000000000..85628b777b --- /dev/null +++ b/Python/Tetsonot.py @@ -0,0 +1,45 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Tetsonot.py +Age: Tetsonot +Date: October 2003 +AgeSDL hooks for Tetsonot +""" + +from Plasma import * +from PlasmaTypes import * + +class Tetsonot(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5256 + self.version = 1 + + def OnNotify(self,state,id,events): + pass + \ No newline at end of file diff --git a/Python/ahnyIslandHut.py b/Python/ahnyIslandHut.py new file mode 100644 index 0000000000..44ce5b94ba --- /dev/null +++ b/Python/ahnyIslandHut.py @@ -0,0 +1,209 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyIslandHut.py +Age: Ahnonay +Date: June 2003 +""" + +from Plasma import * +from PlasmaTypes import * +from xPsnlVaultSDL import * +import time + + +#------------ +#max wiring +#------------ + +ActRotateSwitch = ptAttribActivator(1,"clk: rotate spheres") +RespRotateSwitch = ptAttribResponder(2,"resp: rotate spheres switch") +SDLWaterCurrent = ptAttribString(3,"SDL: water current") +ActWaterCurrent = ptAttribActivator(4,"clk: water current") +RespCurrentValve = ptAttribResponder(5,"resp: water current valve",['on','off']) +WaterCurrent1 = ptAttribSwimCurrent(6,"water current 1") +WaterCurrent2 = ptAttribSwimCurrent(7,"water current 2") +WaterCurrent3 = ptAttribSwimCurrent(8,"water current 3") +WaterCurrent4 = ptAttribSwimCurrent(9,"water current 4") +RespCurrentChange = ptAttribResponder(10,"resp: change the water current",['on','off']) +RespRotateSpheres = ptAttribResponder(11,"resp: rotate the spheres") +SDLHutDoor = ptAttribString(12,"SDL: hut door") +ActHutDoor = ptAttribActivator(13,"clk: hut door switch") +RespHutDoorBeh = ptAttribResponder(14,"resp: hut door switch",['open','close']) +RespHutDoor = ptAttribResponder(15,"resp: hut door",['open','close']) + + +#--------- +# globals +#--------- + +boolCurrent = 0 +boolHutDoor = 0 +actingAvatar = None +actingAvatarDoor = None + + +class ahnyIslandHut(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5580 + self.version = 1 + + + def OnFirstUpdate(self): + global boolCurrent + global boolHutDoor + + try: + ageSDL = PtGetAgeSDL() + except: + print "ahnySphere1MaintBtn.OnServerInitComplete():\tERROR---Cannot find the Ahnonay Age SDL" + ageSDL[SDLWaterCurrent.value] = (0,) + ageSDL[SDLHutDoor.value] = (0,) + + ageSDL.setFlags(SDLWaterCurrent.value,1,1) + ageSDL.setFlags(SDLHutDoor.value,1,1) + + ageSDL.sendToClients(SDLWaterCurrent.value) + ageSDL.sendToClients(SDLHutDoor.value) + + ageSDL.setNotify(self.key,SDLWaterCurrent.value,0.0) + ageSDL.setNotify(self.key,SDLHutDoor.value,0.0) + + boolCurrent = ageSDL[SDLWaterCurrent.value][0] + boolHutDoor = ageSDL[SDLHutDoor.value][0] + + if boolCurrent: + RespCurrentChange.run(self.key,state='on',fastforward=1) + print "OnInit, will now enable current" + WaterCurrent1.current.enable() + WaterCurrent2.current.enable() + WaterCurrent3.current.enable() + WaterCurrent4.current.enable() + else: + RespCurrentChange.run(self.key,state='off',fastforward=1) + print "OnInit, will now disable current" + WaterCurrent1.current.disable() + WaterCurrent2.current.disable() + WaterCurrent3.current.disable() + WaterCurrent4.current.disable() + + if boolHutDoor: + RespHutDoor.run(self.key,state='open',fastforward=1) + else: + RespHutDoor.run(self.key,state='close',fastforward=1) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolCurrent + global boolHutDoor + ageSDL = PtGetAgeSDL() + + if VARname == SDLWaterCurrent.value: + boolCurrent = ageSDL[SDLWaterCurrent.value][0] + if boolCurrent: + RespCurrentChange.run(self.key,state='on') + else: + RespCurrentChange.run(self.key,state='off') + + elif VARname == SDLHutDoor.value: + boolHutDoor = ageSDL[SDLHutDoor.value][0] + if boolHutDoor: + RespHutDoor.run(self.key,state='open') + else: + RespHutDoor.run(self.key,state='close') + + + def OnNotify(self,state,id,events): + global boolCurrent + global boolHutDoor + global actingAvatar + global actingAvatarDoor + ageSDL = PtGetAgeSDL() + + #~ print"anhySphere1MaintBtn::OnNotify id ",id," state ",state + #~ if (state == 0): + #~ return + + #if id == ActRotateSwitch.id and state: + # RespRotateSwitch.run(self.key,avatar=PtGetLocalAvatar()) + + #elif id == RespRotateSwitch.id: + # RespRotateSpheres.run(self.key) + + #elif id == RespRotateSpheres.id: + # if boolHutDoor: + # ageSDL[SDLHutDoor.value] = (0,) + + # currentSphere = ageSDL["ahnyCurrentSphere"][0] + # if currentSphere == 3: + # ageSDL["ahnyCurrentSphere"] = (1,) + # else: + # ageSDL["ahnyCurrentSphere"] = ((currentSphere + 1),) + + + if id == ActWaterCurrent.id and state: + actingAvatar = PtFindAvatar(events) + if boolCurrent: + RespCurrentValve.run(self.key,state='off',avatar=PtFindAvatar(events)) + else: + RespCurrentValve.run(self.key,state='on',avatar=PtFindAvatar(events)) + + elif id == RespCurrentValve.id and actingAvatar == PtGetLocalAvatar(): + if boolCurrent: + ageSDL[SDLWaterCurrent.value] = (0,) + else: + ageSDL[SDLWaterCurrent.value] = (1,) + + elif id == RespCurrentChange.id: + if boolCurrent: + print "will now enable current" + WaterCurrent1.current.enable() + WaterCurrent2.current.enable() + WaterCurrent3.current.enable() + WaterCurrent4.current.enable() + else: + print "will now disable current" + WaterCurrent1.current.disable() + WaterCurrent2.current.disable() + WaterCurrent3.current.disable() + WaterCurrent4.current.disable() + + elif id == ActHutDoor.id and state: + actingAvatarDoor = PtFindAvatar(events) + if boolHutDoor: + RespHutDoorBeh.run(self.key,state='close',avatar=PtFindAvatar(events)) + else: + RespHutDoorBeh.run(self.key,state='open',avatar=PtFindAvatar(events)) + + elif id == RespHutDoorBeh.id and actingAvatarDoor == PtGetLocalAvatar(): + if boolHutDoor: + ageSDL[SDLHutDoor.value] = (0,) + else: + ageSDL[SDLHutDoor.value] = (1,) + + diff --git a/Python/ahnyKadishDoor.py b/Python/ahnyKadishDoor.py new file mode 100644 index 0000000000..1e0c5e1fd7 --- /dev/null +++ b/Python/ahnyKadishDoor.py @@ -0,0 +1,271 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyKadishDoor.py +Age: Ahnonay Sphere 4 +Date: April 2004 +Author: Chris Doyle +wiring for Kadish's engineer hut door +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import string +import copy +import time +import PlasmaControlKeys + + +# --------- +# max wiring +# --------- + +SDLDoor = ptAttribString(1,"SDL: door") +ActConsole = ptAttribActivator(2,"clk: console") +RespConsole = ptAttribResponder(3,"resp: console",['enter','exit']) +MltStgSeek = ptAttribBehavior(4, "Smart seek before puzzle") +ActButtons = ptAttribActivatorList(5,"clk: list of 8 buttons") +RespButtons = ptAttribResponderList(6,"resp: list of 8 buttons",byObject=1) +RespDoor = ptAttribResponder(7,"resp: door ops",['close','open']) +ObjButtons = ptAttribSceneobjectList(8,"objects: list of 8 buttons") + + +# --------- +# globals +# --------- + +boolDoor = 0 +btnNum = 0 +btnList = [] +respList = [] +objList = [] +solutionNum = 8 +solutionList = [3,2,1,4,8,5,6,7] +currentList = [0,0,0,0,0,0,0,0] +actingAvatar = None + +class ahnyKadishDoor(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5600 + self.version = 3 + + + def OnFirstUpdate(self): + global btnList + global respList + global objList + + for button in ActButtons.value: + tempName = button.getName() + btnList.append(tempName) + print "btnList = ",btnList + for resp in RespButtons.value: + tempResp = resp.getName() + respList.append(tempResp) + print "respList = ",respList + for obj in ObjButtons.value: + tempObj = obj.getName() + objList.append(tempObj) + print "objList = ",objList + + PtAtTimeCallback(self.key, 0, 1) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolDoor + + ageSDL = PtGetAgeSDL() + if VARname == SDLDoor.value: + boolDoor = ageSDL[SDLDoor.value][0] + if boolDoor: + print "open too" + RespDoor.run(self.key,state="open") + else: + RespDoor.run(self.key,state="close") + + + def OnNotify(self,state,id,events): + global boolDoor + global btnNum + global actingAvatar + + if id == ActConsole.id and state: + actingAvatar = PtFindAvatar(events) + if actingAvatar == PtGetLocalAvatar(): + print"switch to console close up" + ActConsole.disableActivator() + PtEnableControlKeyEvents(self.key) + MltStgSeek.run(actingAvatar) + + if id == MltStgSeek.id and actingAvatar == PtGetLocalAvatar(): + for event in events: + if event[0] == kMultiStageEvent and event[2] == kEnterStage: # Smart seek completed. Exit multistage, and show GUI. + MltStgSeek.gotoStage(actingAvatar, -1) + PtDebugPrint("ahnyKadishDoor.onNotify: enter puzzle view mode now that seek is done") + actingAvatar.draw.disable() + #PtFadeLocalAvatar(1) + # Disable First Person Camera + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + RespConsole.run(self.key,state='enter') + PtAtTimeCallback(self.key,0.5,2) + #PtSendKIMessage(kDisableEntireYeeshaBook,0) + #PtDisableForwardMovement() + + if id == ActButtons.id and state: + i = 0 + for btn in ActButtons.value: + print "ahnyKadishDoor.OnNotify: disabling 8 button clickables" + ActButtons.value[i].disable() + i += 1 + for event in events: + if event[0] == kPickedEvent: + xEvent = event[3] + btnName = xEvent.getName() + i = 0 + for obj in objList: + if obj == btnName: + btnNum = i + break + else: + i += 1 + + print "btnNum =",btnNum+1 + RespButtons.run(self.key,objectName=respList[btnNum]) + + if id == RespButtons.id and actingAvatar == PtGetLocalAvatar(): + self.ICheckButtons() + + + def ICheckButtons(self): + print "ahnyKadishDoor.ICheckButtons" + global currentList + + ageSDL = PtGetAgeSDL() + + checkNum = (btnNum + 1) + currentList.append(checkNum) + while len(currentList) > len(solutionList): + del currentList[0] + + print "solution list: " + str(solutionList) + print "current list: " + str(currentList) + + if self.AreListsEquiv(solutionList, currentList): + print "Open!" + self.IExitConsole() + ageSDL[SDLDoor.value] = (1,) + #RespDoor.run(self.key,state="open") + else: + if boolDoor: + self.IExitConsole() + ageSDL[SDLDoor.value] = (0,) + #RespDoor.run(self.key,state="close") + else: + i = 0 + for btn in ActButtons.value: + #print "ahnyKadishDoor.ICheckButtons: reenabling 8 button clickables" + ActButtons.value[i].enable() + i += 1 + + + def AreListsEquiv(self, list1, list2): + if list1[0] in list2: + # rearrange list + list2Copy = copy.copy(list2) + while list2Copy[0] != list1[0]: + list2Copy.append(list2Copy.pop(0)) + + # check if all values match up now + for i in range(solutionNum): + if list2Copy[i] != list1[i]: + return false + + return true + + return false + + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode: + self.IExitConsole() + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + self.IExitConsole() + + + def IExitConsole(self): + print "disengage and exit the console" + i = 0 + for btn in ActButtons.value: + #print "ahnyKadishDoor.IExitConsole: disabling 8 button clickables" + ActButtons.value[i].disable() + i += 1 + #PtFadeLocalAvatar(0) + #reeneable first person + cam = ptCamera() + cam.enableFirstPersonOverride() + PtDisableControlKeyEvents(self.key) + #PtEnableForwardMovement() + RespConsole.run(self.key,state='exit') + avatar = PtGetLocalAvatar() + avatar.draw.enable() + #PtSendKIMessage(kEnableEntireYeeshaBook,0) + PtAtTimeCallback(self.key,0.5,3) + + + def OnTimer(self,id): + if id == 1: + global boolDoor + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLDoor.value,1,1) + ageSDL.sendToClients(SDLDoor.value) + ageSDL.setNotify(self.key,SDLDoor.value,0.0) + try: + ageSDL = PtGetAgeSDL() + except: + print "ahnyKadishDoor.OnServerInitComplete():\tERROR---Cannot find AhnySphere04 age SDL" + ageSDL[SDLDoor.value] = (0,) + boolDoor = ageSDL[SDLDoor.value][0] + if boolDoor: + RespDoor.run(self.key,state="open",fastforward=1) + else: + RespDoor.run(self.key,state="close",fastforward=1) + + elif id == 2: + i = 0 + for btn in ActButtons.value: + print "ahnyKadishDoor.onTimer: reenabling 8 button clickables" + ActButtons.value[i].enable() + i += 1 + + elif id == 3: + print "ahnyKadishDoor.onTimer: reenabling the console's clickable" + ActConsole.enableActivator() + + diff --git a/Python/ahnyKadishHut.py b/Python/ahnyKadishHut.py new file mode 100644 index 0000000000..60af33f416 --- /dev/null +++ b/Python/ahnyKadishHut.py @@ -0,0 +1,166 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyKadishHut.py +Age: Ahnonay Sphere 4 +Date: April 2004 +Author: Chris Doyle +wiring for items inside Kadish's hut +""" + +from Plasma import * +from PlasmaTypes import * +import string +#import time + + +# --------- +# max wiring +# --------- + +SDLWindows = ptAttribString(1,"SDL: windows") +ActWindows = ptAttribActivator(2,"clk: windows") +RespWindowsBeh = ptAttribResponder(3,"resp: windows oneshot") +RespWindows = ptAttribResponder(4,"resp: windows use",['close','open']) +#SDLDniTimer = ptAttribString(5,"SDL: D'ni timer") +#ActDniTimer = ptAttribActivator(6,"clk: D'ni timer") +#RespDniTimer = ptAttribResponder(7,"resp: D'ni timer",['off','on']) +#MatAnimDniTimer = ptAttribMaterialAnimation(8,"mat anim: D'ni timer") + + +# --------- +# globals +# --------- + +boolWindows = 0 +#StartTime = 0 +#EndTime = 0 + +#kTimeWarp = 870 + + +class ahnyKadishHut(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5610 + self.version = 4 + + def OnFirstUpdate(self): + global boolWindows + + try: + ageSDL = PtGetAgeSDL() + except: + print "ahnyKadishHut.OnServerInitComplete():\tERROR---Cannot find AhnySphere04 age SDL" + ageSDL[SDLWindows.value] = (0,) + #ageSDL[SDLDniTimer.value] = (0,) + + ageSDL.setFlags(SDLWindows.value,1,1) + ageSDL.sendToClients(SDLWindows.value) + ageSDL.setNotify(self.key,SDLWindows.value,0.0) + + boolWindows = ageSDL[SDLWindows.value][0] + + if boolWindows: + print "ahnyKadishHut.OnServerInitComplete(): Windows are open" + RespWindows.run(self.key,state="open",fastforward=1) + else: + print "ahnyKadishHut.OnServerInitComplete(): Windows are closed" + RespWindows.run(self.key,state="close",fastforward=1) + + #ageSDL.setFlags(SDLDniTimer.value,1,1) + #ageSDL.sendToClients(SDLDniTimer.value) + #ageSDL.setNotify(self.key,SDLDniTimer.value,0.0) + #EndTime = ageSDL[SDLDniTimer.value][0] + #InitTime = PtGetDniTime() + #if InitTime < EndTime: + # print "ahnyKadishHut.OnServerInitComplete(): Timer is on" + # RespDniTimer.run(self.key,state="on") + # dniSecsLeft = (EndTime - InitTime) + # dniSecsElapsed = (kTimeWarp - dniSecsLeft) + # #realSecsElapsed = (dniSecsElapsed * 1.3928573888441378) + # print "dniSecsElapsed = ",dniSecsElapsed + # MatAnimDniTimer.animation.skipToTime(dniSecsElapsed) + # MatAnimDniTimer.animation.resume() + # PtAtTimeCallback(self.key,1,2) + #else: + # print "ahnyKadishHut.OnServerInitComplete(): Timer is off" + # RespDniTimer.run(self.key,state="off") + #if id == 2: + # CurTime = PtGetDniTime() + # if CurTime >= EndTime: + # RespDniTimer.run(self.key,state="off") + # else: + # #RespDniTimer.run(self.key,state="on") + # PtAtTimeCallback(self.key,1,2) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolWindows + + if VARname == SDLWindows.value: + ageSDL = PtGetAgeSDL() + boolWindows = ageSDL[SDLWindows.value][0] + if boolWindows: + print "ahnyKadishHut.OnSDLNotify(): Windows will now open" + RespWindows.run(self.key,state="open") + else: + print "ahnyKadishHut.OnSDLNotify(): Windows will now close" + RespWindows.run(self.key,state="close") + + #if VARname == SDLDniTimer.value: + # EndTime = ageSDL[SDLDniTimer.value][0] + # if EndTime: + # print "ahnyKadishHut.OnSDLNotify(): Timer is now on" + # RespDniTimer.run(self.key,state="on") + # MatAnimDniTimer.animation.skipToTime(0) + # MatAnimDniTimer.animation.play() + # PtAtTimeCallback(self.key,1,2) + # else: + # print "ahnyKadishHut.OnSDLNotify(): Timer is now off" + # RespDniTimer.run(self.key,state="off") + # MatAnimDniTimer.animation.stop() + + + def OnNotify(self,state,id,events): + global boolWindows + + if id == ActWindows.id and state: + RespWindowsBeh.run(self.key,avatar=PtFindAvatar(events)) + + elif id == RespWindowsBeh.id: + ageSDL = PtGetAgeSDL() + if boolWindows: + ageSDL[SDLWindows.value] = (0,) + else: + ageSDL[SDLWindows.value] = (1,) + + #if (id == ActDniTimer.id and state): + # StartTime = PtGetDniTime() + # newtime = (StartTime + kTimeWarp) + # ageSDL[SDLDniTimer.value] = (newtime,) + + diff --git a/Python/ahnyLinkBookGUIPopup.py b/Python/ahnyLinkBookGUIPopup.py new file mode 100644 index 0000000000..9e292672da --- /dev/null +++ b/Python/ahnyLinkBookGUIPopup.py @@ -0,0 +1,391 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyLinkBookGUIPopup +Age: global +Date: November, 2002 +Author: Doug McBride +Shows the linking book GUI with the appropriate linking panel. + +# March 2003 +This script now also provides the GUI for books taken off of the Personal Age Bookshelf. There are a few +differences between books on pedestals vs. books on the psnlBookshelf: +- The "Share Book" decal on the book itself is never available on a book from the psnlBookshelf +- Turned corners, indicating more pages in the book, are only available in books in the psnlBookshelf + +# April 29, 2003 +Major change over to using ptBook instead of LinkBooksGUI dialog +First phase - keep hi level structure, only replace the bring up of books +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import string +import xLinkingBookDefs +from xPsnlVaultSDL import * +import time + + +# define the attributes that will be entered in max +actClickableBook = ptAttribActivator(1,"Actvtr: Clickable small book") +SeekBehavior = ptAttribBehavior(2, "Smart seek before GUI (optional)") +respLinkResponder = ptAttribResponder(3,"Rspndr: Link out") +TargetAge = ptAttribString(4, 'Name of Linking Panel', 'Teledahn') + +actBookshelf = ptAttribActivator(5, "Bookshelf (Only used in PsnlAge)") #Leave blank unless it's a Personal Age Bookshelf +shareRegion = ptAttribActivator(6, "region in which the sharer must remain") +shareBookSeek = ptAttribBehavior(7,"smart seek & use book for share acceptance") # different, because the offerer's client links the offeree in this case + +IsDRCStamped = ptAttribBoolean(10,"DRC Stamp",default=1) + +respLinkSphere01 = ptAttribResponder(11,"sphere 01 resp") +respLinkSphere02 = ptAttribResponder(12,"sphere 02 resp") +respLinkSphere03 = ptAttribResponder(13,"sphere 03 resp") +respLinkSphere04 = ptAttribResponder(14,"sphere 04 resp") + +# globals +LocalAvatar = None +OfferedBookMode = false +BookOfferer = None +stringAgeRequested = None +PageID_List = [] +SpawnPointName_Dict = {} +SpawnPointTitle_Dict = {} + +OffereeWalking = false +ClosedBookToShare = 0 + +BookNumber = 0 # which book it is on the shelf. The Neighborhood book currently is 0. The Teledahn Book is currently 2. +CurrentPage = 1 # The last page the book was opened to. Read from an SDL. + +# the global ptBook object.... there can only be one book displayed at one time, so only one global needed (hopefully) +gLinkingBook = None +NoReenableBook = 0 + +kGrsnTeamBook = 99 + +class ahnyLinkBookGUIPopup(ptModifier): + "The Linking Book GUI Popup python code" + def __init__(self): + ptModifier.__init__(self) + self.id = 5343 + version = 27 + minor = 4 + self.version = version + PtDebugPrint("__init__ahnyLinkBookGUIPopup v%d.%d" % (version,minor)) + + def OnServerInitComplete(self): + # only in the personal age should actBookshelf be anything, so this should only happen in the personal age + if actBookshelf: + ageSDL = PtGetAgeSDL() + ageSDL.setFlags("CurrentPage", 1,1) + ageSDL.sendToClients("CurrentPage") + + def __del__(self): + "destructor - get rid of any dialogs that we might have loaded" + pass + + def OnNotify(self,state,id,events): + global LocalAvatar + global OfferedBookMode + global BookOfferer + global OffereeWalking + global stringAgeRequested + global CurrentPage + global BookNumber + global SpawnPointName_Dict + global SpawnPointTitle_Dict + global gLinkingBook + global ClosedBookToShare + global NoReenableBook + + # if it's the share region, we only care if the offerer is LEAVING the region, + # since he had to be inside it to trigger the clickable for the book anyway. + # is it a clickable book on a pedestal? + if id == actClickableBook.id and PtFindAvatar(events) == PtGetLocalAvatar(): + actClickableBook.disable() + PtToggleAvatarClickability(false) + LocalAvatar = PtFindAvatar(events) + SeekBehavior.run(LocalAvatar) + #self.IShowBookNoTreasure() + OfferedBookMode = false + BookOfferer = None + + # is it the seek behavior because we clicked on a book ourself? + elif id == SeekBehavior.id and PtFindAvatar(events) == PtGetLocalAvatar(): + print events + for event in events: + if event[0] == kMultiStageEvent and event[2] == kEnterStage: # Smart seek completed. Exit multistage, and show GUI. + SeekBehavior.gotoStage(LocalAvatar, -1) + print "ahnyLinkBookGUIPopup: attempting to draw link panel gui" + self.IShowBookNoTreasure() + OfferedBookMode = false + BookOfferer = None + + else: + for event in events: + # is it from the OpenBook? (we only have one book to worry about) + if event[0] == PtEventType.kBook: + print "ahnyLinkBookGUIPopup: BookNotify event=%d, id=%d" % (event[1],event[2]) + if event[1] == PtBookEventTypes.kNotifyImageLink: + if event[2] >= xLinkingBookDefs.kFirstLinkPanelID or event[2] == xLinkingBookDefs.kBookMarkID: + print "ahnyLinkBookGUIPopup:Book: hit linking panel %s" % (event[2]) + self.HideBook(1) + respLinkSphere01.run(self.key,avatar=PtGetLocalAvatar(),netPropagate=0) + + #assume this is a normal pedestal book, (i.e. not the psnlBookshelf) Run the responder indicated in Max + + #respNum = self.GetCurrentSphere() + + #print "respNum:", respNum + + ''' + # check if we need to reset sdl + sdl = xPsnlVaultSDL() + resetSDL = sdl["AhnySphereDelete"][0] + if resetSDL: + vault = ptVault() + iown = vault.getAgesIOwnFolder() + for i in iown.getChildNodeRefList(): + i = i.getChild() + link = i.upcastToAgeLinkNode() + info = link.getAgeInfo() + if info: + name = info.getAgeFilename() + if name == "Ahnonay": # or name == "AhnySphere01" or name == "AhnySphere02" or name == "AhnySphere03" or name == "AhnySphere04": + # its not working if we reset all of the sdl here + # so we'll just create some chronicle vars and reset the sdl in the age + print "attempting to reset sdl for", name + asdl = info.getAgeSDL() + sdr = asdl.getStateDataRecord() + sdr.setFromDefaults(1) + asdl.setStateDataRecord(sdr) + asdl.save() + elif name == "AhnySphere01" or name == "AhnySphere02" or name == "AhnySphere03" or name == "AhnySphere04": + link.setVolatile(1) +## entry = vault.findChronicleEntry("Reset" + name) +## if entry: +## entry.chronicleSetValue("1") +## entry.save() +## else: +## vault.addChronicleEntry("Reset" + name, 0, "1") + link.save() + + sdl["AhnySphereDelete"] = (0,) + respNum = 1 + + if (respNum == 1 or respNum == 0): + respLinkSphere01.run(self.key,avatar=PtGetLocalAvatar()) + elif (respNum == 2): + respLinkSphere02.run(self.key,avatar=PtGetLocalAvatar()) + elif (respNum == 3): + respLinkSphere03.run(self.key,avatar=PtGetLocalAvatar()) + elif (respNum == 4): + respLinkSphere04.run(self.key,avatar=PtGetLocalAvatar()) + else: + print"Whoa - invalid current sphere!" + return + ''' + + elif event[1] == PtBookEventTypes.kNotifyShow: + PtDebugPrint("ahnyLinkBookGUIPopup:Book: NotifyShow",level=kDebugDumpLevel) + # re-allow KI and BB + PtSendKIMessage(kEnableKIandBB,0) + # should we be on a different page? + if CurrentPage > 1: + PtDebugPrint("ahnyLinkBookGUIPopup: going to page %d (ptBook page %d)" % (CurrentPage,(CurrentPage-1)*2),level=kDebugDumpLevel) + gLinkingBook.goToPage((CurrentPage-1)*2) + + elif event[1] == PtBookEventTypes.kNotifyHide: + PtDebugPrint("ahnyLinkBookGUIPopup:Book: NotifyHide",level=kDebugDumpLevel) + if not ClosedBookToShare: + PtToggleAvatarClickability(true) + if (OfferedBookMode and BookOfferer): + avID = PtGetClientIDFromAvatarKey(BookOfferer.getKey()) + PtNotifyOffererLinkRejected(avID) + PtDebugPrint("ahnyLinkBookGUIPopup: rejected link, notifying offerer as such",level=kDebugDumpLevel) + OfferedBookMode = false + BookOfferer = None + + if not NoReenableBook: + actClickableBook.enable() + + ClosedBookToShare = 0 + + elif event[1] == PtBookEventTypes.kNotifyCheckUnchecked: + PtDebugPrint("ahnyLinkBookGUIPopup:Book: NotifyCheckUncheck",level=kDebugDumpLevel) + pass + + def IShowBookNoTreasure(self): + global gLinkingBook + global SpawnPointName_Dict + global SpawnPointTitle_Dict + global kGrsnTeamBook + + try: + params = xLinkingBookDefs.xAgeLinkingBooks["Ahnonay"] + + if len(params) == 6: + sharable,width,height,stampdef,bookdef,gui = params + elif len(params) == 5: + sharable,width,height,stampdef,bookdef = params + gui = "BkBook" + else: + return + + print bookdef + PtSendKIMessage(kDisableKIandBB,0) + gLinkingBook = ptBook(bookdef,self.key) + gLinkingBook.setSize( width, height ) + gLinkingBook.setGUI(gui) + gLinkingBook.show(1) + + except LookupError: + print "ahnyLinkBookGUIPopup: could not find age Ahnonay's linking panel" + + ''' + showOpen = 0 + #If this is a normal pedestal book, the panel is defined in the Max GUI. If this is the personal Age Bookshelf, the panel is passed in a note from psnlBookshelf. Determine the source here. + if len(actBookshelf.value) == 0: + agePanel = TargetAge.value + showOpen = 1 # start pedestal books open + else: + agePanel = stringAgeRequested + showOpen = 0 # start bookself books closed + # did we find an agePanel to link with? + if agePanel: + try: + params = xLinkingBookDefs.xAgeLinkingBooks[agePanel] + if len(params) == 6: + sharable,width,height,stampdef,bookdef,gui = params + elif len(params) == 5: + sharable,width,height,stampdef,bookdef = params + gui = "BkBook" + else: + return + if not IsDRCStamped.value: + stampdef = xLinkingBookDefs.NoDRCStamp + if sharable: + PtDebugPrint("ahnyLinkBookGUIPopup: %s's book definition can't be shared" % (agePanel),level=kErrorLevel) + else: + bookdef = bookdef % ('', stampdef) + SpawnPointName_Dict[0] = "LinkInPointDefault" + SpawnPointTitle_Dict[0] = agePanel + PtSendKIMessage(kDisableKIandBB,0) + gLinkingBook = ptBook(bookdef,self.key) + gLinkingBook.setSize( width, height ) + # make sure there is a cover to show + if not showOpen: + if not self.IsThereACover(bookdef): + showOpen = 1 + gLinkingBook.setGUI(gui) + gLinkingBook.show(showOpen) + except LookupError: + PtDebugPrint("ahnyLinkBookGUIPopup: could not find age %s's linking panel" % (agePanel),level=kErrorLevel) + else: + PtDebugPrint("ahnyLinkBookGUIPopup: no age link panel" % (agePanel),level=kErrorLevel) + ''' + + def IsThereACover(self,bookHtml): + # search the bookhtml string looking for a cover + idx = bookHtml.find(' 0: + return 1 + return 0 + + def HideBook(self, islinking = 0): + global gLinkingBook + global NoReenableBook + + if islinking: + NoReenableBook = 1 + else: + NoReenableBook = 0 + + PtToggleAvatarClickability(true) # enable me as clickable + if gLinkingBook: + gLinkingBook.hide() + + + # + # + # + # + # + # + # utility functions: + + def IGetAgeFilename(self): + try: + name = xLinkingBookDefs.xLinkDestinations[TargetAge.value][0] + except: + PtDebugPrint("IGetAgeFilename(): " + TargetAge.value + " is missing from the xLinkDestinations table, attempting to use it as the value") + name = TargetAge.value + return name + + def IGetAgeInstanceName(self): + try: + name = xLinkingBookDefs.xLinkDestinations[TargetAge.value][0] + except: + PtDebugPrint("IGetAgeInstanceName(): " + TargetAge.value + " is missing from the xLinkDestinations table, attempting to use it as the value") + name = TargetAge.value + return name + + def IGetAgeSpawnPoint(self): + try: + name = xLinkingBookDefs.xLinkDestinations[TargetAge.value][1] + except: + PtDebugPrint("IGetAgeSpawnPoint(): " + TargetAge.value + " is missing from the xLinkDestinations table, attempting to use an empty string as the value") + name = "" + return name + + def OnTimer(self,id): + global gLinkingBook + global kGrsnTeamBook + if id == kGrsnTeamBook: + print "\nahnyLinkBookGUIPopup.OnTimer:Got timer callback. Removing popup for a grsn team book." + gLinkingBook.hide() + + def GetCurrentSphere(self): + vault = ptVault() + myAges = vault.getAgesIOwnFolder() + myAges = myAges.getChildNodeRefList() + for ageInfo in myAges: + link = ageInfo.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + + if ageName == "Ahnonay": + ahnySDL = info.getAgeSDL() + ahnyRecord = ahnySDL.getStateDataRecord() + currentSphere = ahnyRecord.findVar("ahnyCurrentSphere") + curSphere = currentSphere.getInt(0) + return curSphere + diff --git a/Python/ahnyMaintRoom.py b/Python/ahnyMaintRoom.py new file mode 100644 index 0000000000..d7bea44874 --- /dev/null +++ b/Python/ahnyMaintRoom.py @@ -0,0 +1,194 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyMaintRoom.py +Age: Ahnonay Spheres 1-4 +Date: April 2004 +""" + +from Plasma import * +from PlasmaTypes import * +from xPsnlVaultSDL import * +import time + +#------------ +#max wiring +#------------ + +SphereNum = ptAttribInt(1,"sphere #") +ActAdvanceSwitch = ptAttribActivator(2,"clk: advance spheres switch") +RespAdvanceBeh = ptAttribResponder(3,"resp: advance spheres beh") +RespAdvanceUse = ptAttribResponder(4,"resp: advance spheres use",['down0','up','down1','down2','down3']) +RespHubDoor = ptAttribResponder(5,"resp: hub door (sphere 4 only!)",['close','open']) + + +#--------- +# globals +#--------- + +boolHubDoor = 0 +actingAvatar = None +diffsphere = 0 + + +class ahnyMaintRoom(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5581 + self.version = 2 + + + def OnFirstUpdate(self): + global boolHubDoor + + try: + ageSDL = PtGetAgeSDL() + except: + print "ahnyMaintRoom.OnTimer():\tERROR---Cannot find the Ahnonay Age SDL" + + ageSDL.setFlags("ahnyHubDoor",1,1) + ageSDL.sendToClients("ahnyHubDoor") + ageSDL.setNotify(self.key,"ahnyHubDoor",0.0) + + ageSDL.setFlags("ahnyImagerSphere",1,1) + ageSDL.sendToClients("ahnyImagerSphere") + ageSDL.setNotify(self.key,"ahnyImagerSphere",0.0) + + ageSDL.setFlags("ahnyCurrentSphere",1,1) + ageSDL.sendToClients("ahnyCurrentSphere") + ageSDL.setNotify(self.key,"ahnyCurrentSphere",0.0) + + boolHubDoor = ageSDL["ahnyHubDoor"][0] + sphere = ageSDL["ahnyCurrentSphere"][0] + ageSDL["ahnyImagerSphere"] = (sphere,) + + if SphereNum.value == 4: + if sphere == 4: + if not boolHubDoor: + boolHubDoor = 1 + ageSDL["ahnyHubDoor"] = (1,) + RespHubDoor.run(self.key,state="open",fastforward=1) + else: + if boolHubDoor: + boolHubDoor = 0 + ageSDL["ahnyHubDoor"] = (0,) + RespHubDoor.run(self.key,state="close",fastforward=1) + RespAdvanceUse.run(self.key,state="down0",fastforward=1) + else: + if SphereNum.value != 1 and SphereNum.value != 2 and SphereNum.value != 3: + print "ahnyMaintRoom.OnServerInitComplete():\tERROR---Invalid sphere# set in component. Disabling clickable." + ActAdvanceSwitch.disableActivator() + + self.SphereDifference() + + + def OnTimer(self,id): + if id == 1: + PtAtTimeCallback(self.key,0,2) + if actingAvatar == PtGetLocalAvatar(): + ageSDL = PtGetAgeSDL() + ageSDL["ahnyCurrentSphere"] = (SphereNum.value,) + print "advanced from sphere %d with maintainence button" % (ageSDL["ahnyCurrentSphere"][0]) + print "sphere %d will now be the active sphere" % (SphereNum.value) + if SphereNum.value == 4: + ageSDL["ahnyImagerSphere"] = (SphereNum.value,) + boolHubDoor = ageSDL["ahnyHubDoor"][0] + if boolHubDoor and ageSDL["ahnyCurrentSphere"][0] != 4: + print "ahnyMaintRoom.OnSDLNotify(): Door is open and we're not going to Sphere 4, so close it." + ageSDL["ahnyHubDoor"] = (0,) + elif not boolHubDoor and ageSDL["ahnyCurrentSphere"][0] == 4: + print "ahnyMaintRoom.OnSDLNotify(): Door is not open and we're going to Sphere 4, so open it." + + elif id == 2: + ActAdvanceSwitch.enableActivator() + if SphereNum.value == 4: + ageSDL = PtGetAgeSDL() + ageSDL["ahnyHubDoor"] = (1,) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolHubDoor + + if SphereNum.value == 4: + ageSDL = PtGetAgeSDL() + if VARname == "ahnyHubDoor": + boolHubDoor = ageSDL["ahnyHubDoor"][0] + if boolHubDoor: + RespHubDoor.run(self.key,state="open") + else: + RespHubDoor.run(self.key,state="close") + elif VARname == "ahnyCurrentSphere": + boolHubDoor = ageSDL["ahnyHubDoor"][0] + if boolHubDoor and ageSDL["ahnyCurrentSphere"][0] != 4: + print "ahnyMaintRoom.OnSDLNotify(): Door is open and we're not going to Sphere 4, so close it." + ageSDL["ahnyHubDoor"] = (0,) + elif not boolHubDoor and ageSDL["ahnyCurrentSphere"][0] == 4: + print "ahnyMaintRoom.OnSDLNotify(): Door is not open and we're going to Sphere 4, so open it." + PtAtTimeCallback(self.key,7,2) + + if VARname == "ahnyCurrentSphere": + self.SphereDifference() + + + def OnNotify(self,state,id,events): + global actingAvatar + global diffsphere + + if id == ActAdvanceSwitch.id and state: + actingAvatar = PtFindAvatar(events) + RespAdvanceBeh.run(self.key,avatar=PtFindAvatar(events)) + + elif id == RespAdvanceBeh.id: + RespAdvanceUse.run(self.key,state="up") + + elif id == RespAdvanceUse.id: + ageSDL = PtGetAgeSDL() + + if diffsphere == 0: + RespAdvanceUse.run(self.key,state="down0") + self.SphereDifference() + else: + if diffsphere == 1: + RespAdvanceUse.run(self.key,state="down1") + PtAtTimeCallback(self.key,7,1) + elif diffsphere == 2: + RespAdvanceUse.run(self.key,state="down2") + PtAtTimeCallback(self.key,14,1) + elif diffsphere == 3: + RespAdvanceUse.run(self.key,state="down3") + PtAtTimeCallback(self.key,21,1) + else: + print "ahnyMaintRoom.py: ERROR. Sphere advancement# not possible??" + + def SphereDifference(self): + global diffsphere + + ageSDL = PtGetAgeSDL() + activeSphere = ageSDL["ahnyCurrentSphere"][0] + currentSphere = SphereNum.value + diffsphere = (activeSphere - currentSphere) % 4 + print "ahnyMaintRoom.SphereDifference(): Setting sphere difference for Maint Room switch to %d" % (diffsphere) + \ No newline at end of file diff --git a/Python/ahnyPressurePlates.py b/Python/ahnyPressurePlates.py new file mode 100644 index 0000000000..2c500ad448 --- /dev/null +++ b/Python/ahnyPressurePlates.py @@ -0,0 +1,371 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyPressurePlates +Age: Ahnonay +Date: April, 2007 +Author: Derek Odell +Ahnonay Quab control +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import xLinkingBookDefs +import xRandom + + +# define the attributes that will be entered in max +zones = ptAttribActivator(1, "act: Zone Detectors") +respClockLights = ptAttribResponderList(2, "resp: Clock Lights", statelist=["on","off"], byObject=1) +zoneObjects = ptAttribSceneobjectList(3, "obj: Zones") +SDLOccupied = ptAttribString(4, "str: SDL Occupied Zones") +SDLTrees = ptAttribString(5, "str: SDL Trees (optional)") +bookClickable = ptAttribActivator(6, "act: Book Clickable") +SeekBehavior = ptAttribBehavior(7, "beh: Smart Seek To Book") +Sphere = ptAttribDropDownList(8, "Which Sphere?", ("Sphere01", "Sphere02", "Sphere03", "Sphere04")) +respLinkResponder = ptAttribResponder(9, "resp: Link To Cathedral") +respSphereRotate = ptAttribResponder(10, "resp: Sphere Rotation SFX") + +# globals +respLightList = [] +objZoneList = [] +LocalAvatar = None +gLinkingBook = None +treeToZoneKey = [1,3,4,5,8,9,10,12,13,15,16,18,21,22,24] + +#==================================== +class ahnyPressurePlates(ptModifier): + ########################### + def __init__(self): + ptModifier.__init__(self) + self.id = 5947 + version = 1 + self.version = version + print "__init__ahnyPressurePlates v%d " % (version) + + ########################### + def OnFirstUpdate(self): + global respLightList + global objZoneList + global treeToZoneKey + + try: + ageSDL = PtGetAgeSDL() + ageSDL[SDLOccupied.value][0] + except: + print "ahnyPressurePlates.OnFirstUpdate(): ERROR --- Cannot find the Ahnonay Age SDL" + ageSDL[SDLOccupied.value] = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) + + ageSDL.setFlags("ahnyCurrentSphere",1,1) + ageSDL.sendToClients("ahnyCurrentSphere") + ageSDL.setNotify(self.key,"ahnyCurrentSphere",0.0) + + ageSDL.setFlags(SDLOccupied.value,1,1) + ageSDL.sendToClients(SDLOccupied.value) + ageSDL.setNotify(self.key,SDLOccupied.value,0.0) + + if not len(PtGetPlayerList()): + ageSDL[SDLOccupied.value] = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) + + + for light in respClockLights.value: + thisLight = light.getName() + respLightList.append(thisLight) + + for zone in zoneObjects.value: + thisZone = zone.getName() + objZoneList.append(thisZone) + + if respLightList != []: + idx = 0 + for occupants in ageSDL[SDLOccupied.value]: + if occupants: + respClockLights.run(self.key, state='on', objectName=respLightList[idx]) + idx += 1 + if Sphere.value == "Sphere02": + try: + ageSDL[SDLTrees.value][0] + except: + print "ahnyPressurePlates.OnFirstUpdate(): ERROR --- Cannot find the Ahnonay Age SDL" + ageSDL[SDLTrees.value] = (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1) + + ageSDL.setFlags(SDLTrees.value,1,1) + ageSDL.sendToClients(SDLTrees.value) + ageSDL.setNotify(self.key,SDLTrees.value,0.0) + + occupiedZones = list(ageSDL[SDLOccupied.value]) + occupiedTrees = list(ageSDL[SDLTrees.value]) + for index in treeToZoneKey: + if occupiedZones[index] == 0 and occupiedTrees[treeToZoneKey.index(index)] == 1: + respClockLights.run(self.key, state='on', objectName=respLightList[index], netForce=1 ) + ageSDL[SDLOccupied.value] = tuple(occupiedZones) + + + ########################### + def OnServerInitComplete(self): + pass + + ########################### + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname == "ahnyCurrentSphere" and respSphereRotate.value != []: + print "ahnyPressurePlates.OnSDLNotify(): playing audio SFX" + respSphereRotate.run(self.key) + + ########################### + def OnNotify(self,state,id,events): + global respLightList + global objZoneList + global LocalAvatar + + #print "ahnyPressurePlates.OnNotify: state=%s id=%d events=" % (state, id), events + + if id == zones.id: + for event in events: + if (event[0] == kCollisionEvent) and self.sceneobject.isLocallyOwned(): + ageSDL = PtGetAgeSDL() + region = event[3] + regName = region.getName() + for zone in zoneObjects.value: + zoneName = zone.getName() + if zoneName == regName: + ageSDL = PtGetAgeSDL() + index = objZoneList.index(zoneName) + occupiedZones = list(ageSDL[SDLOccupied.value]) + #print "Zone: %s Index: %d Occupied: %s" % (zoneName,index,str(occupiedZones)) + if event[1] == 1: #We are entering + if occupiedZones[index] != 255: #avoid overflow + occupiedZones[index]= occupiedZones[index] + 1 + if respLightList != [] and occupiedZones[index]==1: # if we are now equal to one run the responder + respClockLights.run(self.key, state='on', objectName=respLightList[index], netForce=1 ) + print "%s - enter %s" % (str(occupiedZones), str(index)) + else: #this should be exiting + if occupiedZones[index] != 0: #only subtract if we are not zero don't want to overflow + occupiedZones[index] = occupiedZones[index] -1 + if Sphere.value == "Sphere02" and index in treeToZoneKey: + if ((not ageSDL[SDLTrees.value][treeToZoneKey.index(index)]) and( occupiedZones[index] == 0)): + if respLightList != []: + respClockLights.run(self.key, state='off', objectName=respLightList[index], netForce=1) + else: + + if (respLightList != []) and (occupiedZones[index] == 0):# + respClockLights.run(self.key, state='off', objectName=respLightList[index] , netForce=1) + print "%s - exit %s" % (str(occupiedZones), str(index)) + ageSDL[SDLOccupied.value] = tuple(occupiedZones) + #print "Occupied: %s" % (str(occupiedZones)) + + # is it a clickable book on a pedestal? + elif id == bookClickable.id and PtFindAvatar(events) == PtGetLocalAvatar() and state: + PtToggleAvatarClickability(false) + bookClickable.disable() + LocalAvatar = PtFindAvatar(events) + SeekBehavior.run(LocalAvatar) + + # is it the seek behavior because we clicked on a book ourself? + elif id == SeekBehavior.id and PtFindAvatar(events) == PtGetLocalAvatar(): + for event in events: + if event[0] == kMultiStageEvent and event[2] == kEnterStage: # Smart seek completed. Exit multistage, and show GUI. + SeekBehavior.gotoStage(LocalAvatar, -1) + self.IShowBook() + + else: + for event in events: + # is it from the OpenBook? (we only have one book to worry about) + if event[0] == PtEventType.kBook: + print "ahnyPressurePlates: BookNotify event=%d, id=%d" % (event[1],event[2]) + if event[1] == PtBookEventTypes.kNotifyImageLink: + if event[2] >= xLinkingBookDefs.kFirstLinkPanelID or event[2] == xLinkingBookDefs.kBookMarkID: + print "ahnyPressurePlates:Book: hit linking panel %s" % (event[2]) + self.HideBook(1) + + ageSDL = PtGetAgeSDL() + print ageSDL[SDLOccupied.value] + if self.RegionsEmpty(): + print "Sphere rotating" + ageSDL = PtGetAgeSDL() + currentSphere = ageSDL["ahnyCurrentSphere"][0] + if currentSphere == 3 or currentSphere == 4: + ageSDL["ahnyCurrentSphere"] = (1,) + else: + ageSDL["ahnyCurrentSphere"] = ((currentSphere + 1),) + else: + print "Sphere staying put" + + respLinkResponder.run(self.key, avatar=PtGetLocalAvatar(),netPropagate=0) + + ''' + vault = ptVault() + myAges = vault.getAgesIOwnFolder() + myAges = myAges.getChildNodeRefList() + for ageInfo in myAges: + link = ageInfo.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + spawnPoints = link.getSpawnPoints() + + if ageName == "Ahnonay": + ahnySDL = info.getAgeSDL() + ahnyRecord = ahnySDL.getStateDataRecord() + currentSphere = ahnyRecord.findVar("ahnyCurrentSphere") + if (sphere.value == "1"): + currentSphere.setInt(2,0) + elif (sphere.value == "2"): + currentSphere.setInt(3,0) + elif (sphere.value == "3"): + currentSphere.setInt(1,0) + elif (sphere.value == "4"): + currentSphere.setInt(1,0) + else: + print"missing sphere identifier string!" + ahnySDL.setStateDataRecord(ahnyRecord) + ahnySDL.save() + print"advanced from sphere ",sphere.value + return + ''' + + elif event[1] == PtBookEventTypes.kNotifyShow: + print "ahnyLinkBookGUIPopup:Book: NotifyShow" + PtSendKIMessage(kEnableKIandBB,0) + + elif event[1] == PtBookEventTypes.kNotifyHide: + print "ahnyLinkBookGUIPopup:Book: NotifyHide" + PtToggleAvatarClickability(true) + bookClickable.enable() + + ########################### + def RegionsEmpty(self): + ageSDL = PtGetAgeSDL() + occupantList = list(ageSDL[SDLOccupied.value]) + + if Sphere.value == "Sphere01": + quabs = ageSDL["ahnyQuabs"][0] + if quabs: + print "ahnyPressurePlates: not all quabs kicked off" + return false + elif Sphere.value == "Sphere02": + treeList = list(ageSDL[SDLTrees.value]) + for tree in treeList: + if tree: + print "ahnyPressurePlates: not all trees knocked over" + return false + + for zone in occupantList[1:]: + if zone: + print "ahnyPressurePlates: some zones still occupied" + return false + + if occupantList[0] == 1: + return true + + print "ahnyPressurePlates: book zone still occupied" + return false + + ########################### + def IShowBook(self): + global gLinkingBook + + try: + params = xLinkingBookDefs.xAgeLinkingBooks["AhnonayCathedral"] + + if len(params) == 6: + sharable,width,height,stampdef,bookdef,gui = params + elif len(params) == 5: + sharable,width,height,stampdef,bookdef = params + gui = "BkBook" + else: + return + + PtSendKIMessage(kDisableKIandBB,0) + bookdef = bookdef.replace("%s", "") + gLinkingBook = ptBook(bookdef,self.key) + gLinkingBook.setSize( width, height ) + gLinkingBook.setGUI(gui) + gLinkingBook.show(1) + + except LookupError: + print "ahnyLinkBookGUIPopup: could not find age AhnonayCathedral's linking panel" + + ########################### + def HideBook(self, islinking = 0): + global gLinkingBook + + PtToggleAvatarClickability(true) # enable me as clickable + if gLinkingBook: + gLinkingBook.hide() + + + + + + + + + + + + + + + + + +""" + + # utility functions: + + + ########################### + def IGetAgeFilename(self): + try: + name = xLinkingBookDefs.xLinkDestinations[TargetAge.value][0] + except: + PtDebugPrint("IGetAgeFilename(): " + TargetAge.value + " is missing from the xLinkDestinations table, attempting to use it as the value") + name = TargetAge.value + return name + + ########################### + def IGetAgeInstanceName(self): + try: + name = xLinkingBookDefs.xLinkDestinations[TargetAge.value][0] + except: + PtDebugPrint("IGetAgeInstanceName(): " + TargetAge.value + " is missing from the xLinkDestinations table, attempting to use it as the value") + name = TargetAge.value + return name + + + ########################### + def IGetAgeSpawnPoint(self): + try: + name = xLinkingBookDefs.xLinkDestinations[TargetAge.value][1] + except: + PtDebugPrint("IGetAgeSpawnPoint(): " + TargetAge.value + " is missing from the xLinkDestinations table, attempting to use an empty string as the value") + name = "" + return name + +""" diff --git a/Python/ahnyQuabs.py b/Python/ahnyQuabs.py new file mode 100644 index 0000000000..b34a697e5c --- /dev/null +++ b/Python/ahnyQuabs.py @@ -0,0 +1,468 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyQuabs +Age: Ahnonay +Date: April, 2007 +Author: Derek Odell +Ahnonay Quab control +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from PlasmaGame import * +from PlasmaGameConstants import * +import xRandom + + +# define the attributes that will be entered in max +deadZone = ptAttribActivator(1, "detector for dead zone") +quabObjects = ptAttribSceneobjectList(2, "quab spawners") +SDLQuabs = ptAttribString(3, "SDL: quabs") + +# globals +byteQuabs = 0 +quabList = [] +quabKeyList = [] + +quabBrainList = [] +quabVarList = {} + +cheater = 0 + +#==================================== +class ahnyQuabs(ptModifier): + ########################### + def __init__(self): + ptModifier.__init__(self) + self.id = 5946 + version = 1 + self.version = version + print "__init__ahnyQuabs v%d " % (version) + self.brainsRemaining = 0 + self.brainsReady = 0 + self.gameReady = 0 + self.sdlReady = 0 + self.isAIOwner = 0 + self.quabIsRunning = [] + self.gameId = 0 + self.joinedToGame = 0 + + ########################### + def __del__(self): + print "ahnyQuabs.del(): will unload %d quabs" % (len(quabKeyList)) + i = 1 + for quabKey in quabKeyList: + PtUnLoadAvatarModel(quabKey) + print "ahnyQuabs.del(): unloading quab #%d" % (i) + i += 1 + + ########################### + def OnFirstUpdate(self): + global quabList + + for quab in quabObjects.value: + quabList.append(quab) + + # join the age's common var sync "game" + self.clientId = PtGetLocalClientID() + PtJoinCommonVarSyncGame(self.key) + + ########################### + #def OnServerInitComplete(self): + global byteQuabs + + try: + ageSDL = PtGetAgeSDL() + ageSDL[SDLQuabs.value][0] + except: + print "ahnyQuabs.OnServerInitComplete(): ERROR --- Cannot find the Ahnonay Age SDL" + print SDLQuabs.value + ageSDL[SDLQuabs.value] = (20,) + + ageSDL.setFlags(SDLQuabs.value,1,1) + ageSDL.sendToClients(SDLQuabs.value) + ageSDL.setNotify(self.key,SDLQuabs.value,0.0) + + byteQuabs = ageSDL[SDLQuabs.value][0] + + if byteQuabs < 20 and not len(PtGetPlayerList()): + updatedTime = ageSDL["ahnyQuabsLastUpdate"][0] + currentTime = PtGetDniTime() + amount = (currentTime - updatedTime) / 28800 + print "ahnyQuabs.OnServerInitComplete(): Last Update: %d Current Time: %d means %d quabs returning" % (updatedTime, currentTime, amount) + if (byteQuabs + amount) > 20: + byteQuabs = 20 + else: + byteQuabs += amount + ageSDL[SDLQuabs.value] = (byteQuabs,) + elif byteQuabs > 20: + print "ahnyQuabs.OnServerInitComplete(): I think I have %d quabs for some reason, so I'll reset to 20" % (byteQuabs) + ageSDL[SDLQuabs.value] = (20,) + byteQuabs = 20 + ageSDL["ahnyQuabsLastUpdate"] = (PtGetDniTime(),) + + self.sdlReady = 1 + + #PtFindSceneobject("Box01", "Ahnonay").physics.suppress(true) + #PtFindSceneobject("Box01", "Ahnonay").physics.disableCollision() + + ########################### + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global byteQuabs + + if VARname == SDLQuabs.value: + ageSDL = PtGetAgeSDL() + byteQuabs = ageSDL[SDLQuabs.value][0] + + ########################### + def OnNotify(self,state,id,events): + global byteQuabs + + #print "ahnyQuabs.OnNotify: state=%s id=%d events=" % (state, id), events + + if id == deadZone.id: + if PtFindAvatar(events) != PtGetLocalAvatar(): + quabNum = byteQuabs - 1 + if quabNum < 0: + quabNum = 0 + print "ahnyQuabs.OnNotify: quabNum now = %d" % (quabNum) + ageSDL = PtGetAgeSDL() + ageSDL[SDLQuabs.value] = (quabNum,) + ageSDL["ahnyQuabsLastUpdate"] = (PtGetDniTime(),) + + ########################### + def ISpawnQuabsIfNeeded(self): + if self.isAIOwner and self.sdlReady and self.gameReady and (byteQuabs > 0): + print "ahnyQuabs.ISpawnQuabsIfNeeded(): Calling ISpawnQuabs to spawn %d quabs" % (byteQuabs) + self.ISpawnQuabs() + elif not self.isAIOwner and self.sdlReady and self.gameReady and (byteQuabs > 0): + quabs = PtGetAIAvatarsByModelName("Quab") # tuple as [(brain object, "user string")] + self.brainsRemaining = byteQuabs + for quab in quabs: + brainNum = int(quab[1][5:]) + brainName = str(quab[1][:4]) + if brainName == "Quab": + print "ahnyQuabs.ISpawnQuabsIfNeeded(): Quab brain #%d was created. Initializing brain." % (brainNum) + if len(quabBrainList) <= brainNum: + # probably spawned remotely + while len(quabBrainList) <= brainNum: + quabBrainList.append(None) + + quabBrainList[brainNum] = quab[0] + quab[0].addReceiver(self.key) + + quab[0].setLocallyControlled(self.isAIOwner) + + idleBehavior = quab[0].idleBehaviorName() + quab[0].addBehavior("Idle02", idleBehavior) + quab[0].addBehavior("Idle03", idleBehavior) + + runBehavior = quab[0].runBehaviorName() + quab[0].addBehavior("Run02", runBehavior, randomStartPos = 0) + quab[0].addBehavior("Run03", runBehavior, randomStartPos = 0) + + self.brainsRemaining = self.brainsRemaining - 1 + if self.brainsRemaining == 0: + self.brainsReady = 1 + + #if self.brainsReady and self.gameReady: + # self.IInitInitialAIStates() + + ########################### + def ISpawnQuabs(self): + global quabList + global quabKeyList + global quabBrainList + + xRandom.shuffle(quabList) + game = self.IGetVarSyncGameCli() + if game == None: + print "ahnyQuabs.ISpawnQuabs(): DANGER!!! No VarSyncGame!" + print "ahnyQuabs.ISpawnQuabs(): out of %d possible spawn points, will spawn %d quabs" % (len(quabList),byteQuabs) + i = 1 + self.brainsRemaining = byteQuabs + while i <= byteQuabs : + quab = quabList[i-1] + quabKey = quab.getKey() + quabKey = PtLoadAvatarModel("Quab", quabKey, "Quab "+str(i - 1)) + quabKeyList.append(quabKey) + quabBrainList.append(None) + + varName = "QuabRun" + str(i) + game.createNumericVar(varName, 0) + + print "ahnyQuabs.ISpawnQuabs(): spawned quab #%d" % (i) + i += 1 + + ########################### + def IInitInitialAIStates(self): + global quabBrainList + + i = 0 + while i < len(quabBrainList): + print "ahnyQuabs.IInitInitialAIStates(): Setting initial state for brain #%d" % (i) + brain = quabBrainList[i] + if brain == None: + i += 1 + continue + try: + if self.quabIsRunning[i]: + brain.goToGoal(ptPoint3(0,0,0), 1) + else: + brain.startBehavior(brain.idleBehaviorName()) + except: + self.quabIsRunning.append(0) + brain.startBehavior(brain.idleBehaviorName()) + i += 1 + + ########################### + def OnUpdate(self, seconds, delta): + global quabBrainList + global quabVarList + global quabKeyList + global cheater + + if cheater: + return + + ## Check as many conditions as we can so we don't overload processing + if (not self.brainsReady) or (not self.gameReady): + return # not ready to run AI yet + if not self.isAIOwner: + return # we aren't the ones running the brain, abort + game = self.IGetVarSyncGameCli() + if game == None: + return # no game connection established + + for brain in quabBrainList: + if brain == None: + continue + + isRunning = brain.runningBehavior(brain.runBehaviorName()) + isIdling = brain.runningBehavior(brain.idleBehaviorName()) + + ## Every three seconds, update goal if we're running + if PtGetDniTime() % 3 != 0 and isRunning: + continue + + ## Can we hear anyone? + playersWeHear = brain.playersICanHear() + total = ptVector3(0,0,0) + varName = quabVarList[quabBrainList.index(brain)+1] + if len(playersWeHear) != 0: + for avatar in playersWeHear: + ## Get the normalized vector to each player we hear + vector = brain.vectorToPlayer(avatar) + vector.normalize() + total = total.add(vector) + + ## Scale it up so it's not a foot away + escVector = ptVector3(total.getX(),total.getY(),total.getZ()) + escVector = escVector.scale(40) + + index = quabBrainList.index(brain) + loc = quabKeyList[index].getSceneObject().position() + + ## Find the final position + target = ptPoint3((escVector.getX() + loc.getX()), (escVector.getY() + loc.getY()) , (escVector.getZ() + loc.getZ())) + + ## Visual representation of goal + #PtFindSceneobject("Box01", "Ahnonay").physics.warp(target) + + ## Variable Outputs + #print "Total Vector: %f / %f / %f" % (total.getX(), total.getY(), total.getZ()) + #print "Escape Vector: %f / %f / %f" % (escVector.getX(), escVector.getY(), escVector.getZ()) + #print "Loc: %f / %f / %f" % (loc.getX(), loc.getY(), loc.getZ()) + #print "Target: %f / %f / %f" % (target.getX(), target.getY(), target.getZ()) + #print "Player: %f / %f / %f" % (PtGetLocalAvatar().position().getX(), PtGetLocalAvatar().position().getY(), PtGetLocalAvatar().position().getZ()) + + ## Avoid avatars + brain.goToGoal(target, 0) + + ## Set 'running' var if we need to + if isIdling: + game.setNumericVar(varName, 1) + + else: + if isRunning: + ## Stop running + brain.startBehavior(brain.idleBehaviorName()) + game.setNumericVar(varName, 0) + + ########################### + def OnAIMsg(self, brain, msgType, userStr, args): + global quabBrainList + global quabVarList + + if msgType == PtAIMsgType.kBrainCreated: + brainNum = int(userStr[5:]) + brainName = str(userStr[:4]) + if brainName == "Quab": + print "ahnyQuabs.OnAIMsg(): Quab brain #%d was created. Initializing brain." % (brainNum) + if len(quabBrainList) <= brainNum: + # probably spawned remotely + while len(quabBrainList) <= brainNum: + quabBrainList.append(None) + + quabBrainList[brainNum] = brain + brain.addReceiver(self.key) + + brain.setLocallyControlled(self.isAIOwner) + + idleBehavior = brain.idleBehaviorName() + brain.addBehavior("Idle02", idleBehavior) + brain.addBehavior("Idle03", idleBehavior) + + runBehavior = brain.runBehaviorName() + brain.addBehavior("Run02", runBehavior, randomStartPos = 0) + brain.addBehavior("Run03", runBehavior, randomStartPos = 0) + + self.brainsRemaining = self.brainsRemaining - 1 + if self.brainsRemaining == 0: + self.brainsReady = 1 + + if self.brainsReady and self.gameReady: + self.IInitInitialAIStates() + + # defaults for the rest should be fine + elif msgType == PtAIMsgType.kArrivedAtGoal: + print "ahnyQuabs.Brain arrived at goal, but we don't really care" + + ########################### + def OnGameCliMsg(self,msg): + global quabBrainList + global quabVarList + + if msg.getType() == PtGameCliMsgTypes.kGameCliPlayerJoinedMsg: + joinMsg = msg.upcastToFinalGameCliMsg() + if joinMsg.playerID() == self.clientId: + self.gameId = msg.getGameCli().gameID() + self.joinedToGame = 1 + print "ahnyQuabs.OnGameCliMsg(): Got join reply from the var sync game, we are now an observer for game id %d" % (self.gameId) + + elif msg.getType() == PtGameCliMsgTypes.kGameCliOwnerChangeMsg: + ownerChangeMsg = msg.upcastToFinalGameCliMsg() + print "ahnyQuabs.OnGameCliMsg(): Got owner change msg, ownerID = %d, clientId = %d" % (ownerChangeMsg.ownerID(), self.clientId) + if ownerChangeMsg.ownerID() == self.clientId: + print "ahnyQuabs.OnGameCliMsg(): We are now the game owner" + self.isAIOwner = 1 + else: + self.isAIOwner = 0 + # go through all our brains and tell them whether we are or are not the authoritative client + for brain in quabBrainList: + if brain == None: + continue + brain.setLocallyControlled(self.isAIOwner) + + elif msg.getType() == PtGameCliMsgTypes.kGameCliVarSyncMsg: + varSyncMsg = msg.upcastToGameMsg() + msgType = varSyncMsg.getVarSyncMsgType() + finalMsg = varSyncMsg.upcastToFinalVarSyncMsg() + if msgType == PtVarSyncMsgTypes.kVarSyncAllVarsSent: + self.gameReady = 1 + self.ISpawnQuabsIfNeeded() + elif msgType == PtVarSyncMsgTypes.kVarSyncNumericVarCreated: + name = finalMsg.name() + id = finalMsg.id() + idx = name[7:] + quabVarList[long(idx)] = id + elif msgType == PtVarSyncMsgTypes.kVarSyncNumericVarChanged: + id = finalMsg.id() + value = finalMsg.value() + if id in quabVarList.keys(): + index = quabVarList[id] + if len(self.quabIsRunning) <= index: + # probably spawned remotely + while len(self.quabIsRunning) <= index: + self.quabIsRunning.append(0) + self.quabIsRunning[index] = value + if self.isAIOwner: + #print "ahnyQuabs.OnGameCliMsg(): Var %s updated but we are AI controller, so we updated it, not adjusting brain." % (name) + return # we already have told the brain + + if index >= len(quabBrainList): + #print "ahnyQuabs.OnGameCliMsg(): Var %s updated, but we don't have a brain for that one (possibly too early)." % (name) + return # it'll get transferred over when the brains DO get here + + #print "ahnyQuabs.OnGameCliMsg(): Var %s updated, making sure brain matches." % (name) + brain = quabBrainList[index-1] + if (brain == None): + return + isRunning = brain.runningBehavior(brain.runBehaviorName()) + isIdling = brain.runningBehavior(brain.idleBehaviorName()) + if value: + if isIdling: + # run away! + brain.goToGoal(ptPoint3(0,0,0), 1) # avoiding avatars + else: + if isRunning: + # stop running + brain.startBehavior(brain.idleBehaviorName()) + + ########################### + def IGetVarSyncGameCli(self): + if not self.joinedToGame: + print "ahnyQuabs.IGetVarSyncGameCli: Requesting game client before we have become an observer... returning None" + return None + + gameCli = PtGetGameCli(self.gameId) + if (type(gameCli) != type(None)) and (PtIsVarSyncGame(gameCli.gameTypeID())): + return gameCli.upcastToVarSyncGame() + return None + + ########################### + def OnBackdoorMsg(self, target, param): + global quabBrainList + global quabVarList + global quabKeyList + global cheater + + if target == "quabs": + if param == "runaway": + ## Check as many conditions as we can so we don't overload processing + if (not self.brainsReady) or (not self.gameReady): + return # not ready to run AI yet + if not self.isAIOwner: + return # we aren't the ones running the brain, abort + game = self.IGetVarSyncGameCli() + if game == None: + return # no game connection established + + cheater = 1 + + for brain in quabBrainList: + if brain == None: + continue + + brain.goToGoal(ptPoint3(0,-1000,700), 0) + + elif param == "reset": + cheater = 0 + + + diff --git a/Python/ahnySaveCloth.py b/Python/ahnySaveCloth.py new file mode 100644 index 0000000000..4d9def2b00 --- /dev/null +++ b/Python/ahnySaveCloth.py @@ -0,0 +1,262 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnySaveCloth +Age: Most post-prime ages +Date: January 2004 +Author: Adam Van Ornum +Sets a save point +""" + +from Plasma import * +from PlasmaTypes import * + +# define the attributes that will be entered in max +Activator = ptAttribActivator(1,"Activator: Cloth Clickable") +OneShotResp = ptAttribResponder(2, "Resp: One Shot") +clothID = ptAttribString(3,"save cloth ID") + +avatar = None +link = None +whereAmI = 0 +gotSC = 0 +sdlSC = "" + +class ahnySaveCloth(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5424 + self.version = 1 + print "DEBUG: ahnySaveCloth.__init__: v.", self.version + + def OnFirstUpdate(self): + global sdlSC + global gotSC + global link + global whereAmI + + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("Personal") + + vault = ptVault() + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLink": + link = chron.getValue() + + agevault = ptAgeVault() + ageinfo = agevault.getAgeInfo() + guid = ageinfo.getAgeInstanceGuid() + + if guid == link: + ageSDL = PtGetAgeSDL() + sphere = ageSDL["ahnyCurrentSphere"][0] + + linkmgr = ptNetLinkingMgr() + curLink = linkmgr.getCurrAgeLink() + spawnPoint = curLink.getSpawnPoint() + + spTitle = spawnPoint.getTitle() + spName = spawnPoint.getName() + + if spTitle == "SCSavePoint": + if spName == "SaveClothPoint7" or spName == "SaveClothPoint8": + print "linking to hub or hut" + whereAmI = 4 + else: + offset = str(ageSDL["ahnyCurrentOffset"][0]) + print "Ahnonay.OnPageLoad(): Sphere0%s loaded with offset:%s" % (sphere, offset) + whereAmI = (int(sphere) - int(offset)) % 4 + if whereAmI == 0: + whereAmI = 4 + else: + whereAmI = sphere + print "ahnySaveCloth.OnServerInitComplete(): I am age owner in %d" % (whereAmI) + + # SaveCloth SDL stuff, for use with POTS symbols + sdlSC = "ahnyGotSaveCloth" + clothID.value + try: + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(sdlSC,1,1) + ageSDL.sendToClients(sdlSC) + ageSDL.setNotify(self.key,sdlSC,0.0) + gotSC = ageSDL[sdlSC][0] + print "ahnySaveCloth.OnServerInitComplete():\t found sdl: ",sdlSC,", which = ",gotSC + except: + print "ERROR. Couldn't find sdl: ",sdlSC,", defaulting to 0" + + ageSDL.setFlags("ahnyCurrentSphere",1,1) + ageSDL.sendToClients("ahnyCurrentSphere") + ageSDL.setNotify(self.key,"ahnyCurrentSphere",0.0) + + ageSDL.setFlags("ahnyCurrentOffset",1,1) + ageSDL.sendToClients("ahnyCurrentOffset") + ageSDL.setNotify(self.key,"ahnyCurrentOffset",0.0) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global gotSC + global sdlSC + + if VARname != sdlSC: + return + ageSDL = PtGetAgeSDL() + PtDebugPrint("xSaveCloth.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d" % (VARname,SDLname,tag,ageSDL[sdlSC][0])) + gotSC = ageSDL[sdlSC][0] + + def OnNotify(self,state,id,events): + global avatar + global whereAmI + global link + + print "DEBUG: ahnySaveCloth::onNotify, id ",id + + if not state: + return + + if id == Activator.id: + #Activator.disable() + avatar = PtFindAvatar(events) + OneShotResp.run(self.key, avatar=PtFindAvatar(events)) # run the oneshot + + elif id == OneShotResp.id and avatar == PtGetLocalAvatar(): + agevault = ptAgeVault() + ageinfo = agevault.getAgeInfo() + guid = ageinfo.getAgeInstanceGuid() + + if guid == link: + print "I'm the age owner, setting spawnpoint" + #Activator.enable() + + ageSDL = PtGetAgeSDL() + sphere = ageSDL["ahnyCurrentSphere"][0] + offset = (sphere - whereAmI) % 4 + print "ahnySaveCloth.OnNotify: Offset = %d" % (offset) + ageSDL["ahnyCurrentOffset"] = (offset,) + + agevault = ptAgeVault() + ageinfo = agevault.getAgeInfo() + spawn = None + + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("Personal") + + vault = ptVault() + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonaySpawnPoints": + spawn = chron.getValue().split(";") + newSpawn = "%s;SCSavePoint,SaveClothPoint%s" % (spawn[0],clothID.value) + print newSpawn + chron.setValue(newSpawn) + if not gotSC: + ageSDL = PtGetAgeSDL() + ageSDL[sdlSC] = (1,) + return + + print "ahnySaveCloth.OnNotify(): ERROR: couldn't find chron node" + + + else: + print "I'm not the age owner, so I don't do anything." + + + + + + + + + ''' + vault = ptVault() + myAges = vault.getAgesIOwnFolder() + myAges = myAges.getChildNodeRefList() + for ageInfo in myAges: + link = ageInfo.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + spawnPoints = link.getSpawnPoints() + + if ageName == "Ahnonay": + ahnySDL = info.getAgeSDL() + ahnyRecord = ahnySDL.getStateDataRecord() + currentCloth = ahnyRecord.findVar("ahnyCurrentSaveCloth") + currentSphere = ahnyRecord.findVar("ahnyCurrentSphere") + if (clothID.value): + clothNumber = int(clothID.value) + activeSphere = currentSphere.getInt(0) + + agevault = ptAgeVault() + currentage = int(agevault.getAgeInfo().getAgeFilename()[-1]) + print "currently in sphere:", currentage + + currentpos = (currentage - activeSphere) % 4 + + if clothNumber > 6 and clothNumber < 25: + clothOffset = clothNumber % 6 + if clothOffset == 0: + clothOffset = 6 + else: + clothOffset = clothNumber + + currentCloth.setInt(clothOffset,0) + currentCloth.setInt(currentpos,1) + print"current save cloth updated to number", clothOffset, " from cloth value of", clothNumber + print"current save position updated to:", currentpos + else: + print"missing sphere identifier string!" + ahnySDL.setStateDataRecord(ahnyRecord) + ahnySDL.save() + return + ''' + + else: + PtDebugPrint("ERROR: ahnySaveCloth.OnNotify: Error trying to access the Vault.") + diff --git a/Python/ahnyTrees.py b/Python/ahnyTrees.py new file mode 100644 index 0000000000..d2a93b94d6 --- /dev/null +++ b/Python/ahnyTrees.py @@ -0,0 +1,110 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyTrees +Age: Ahnonay +Date: April, 2007 +Author: Derek Odell +Ahnonay Quab control +""" + +from Plasma import * +from PlasmaTypes import * + + +# define the attributes that will be entered in max +rgnTrees = ptAttribActivator(1, "act: Tree Detector") +respTreeAnims = ptAttribResponderList(2, "resp: Tree Anims", byObject=1) +objTrees = ptAttribSceneobjectList(3, "obj: Tree Meshs") +SDLTrees = ptAttribString(4, "str: SDL Trees (optional)") + +# globals +respTreeAnimsList = [] +objTreeList = [] + +#==================================== +class ahnyTrees(ptModifier): + ########################### + def __init__(self): + ptModifier.__init__(self) + self.id = 5948 + version = 1 + self.version = version + print "__init__ahnyTrees v%d " % (version) + + ########################### + def OnFirstUpdate(self): + global respTreeAnimsList + global objTreeList + + try: + ageSDL = PtGetAgeSDL() + ageSDL[SDLTrees.value][0] + except: + print "ahnyTrees.OnServerInitComplete(): ERROR --- Cannot find the Ahnonay Age SDL" + ageSDL[SDLTrees.value] = (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1) + + ageSDL.setFlags(SDLTrees.value,1,1) + ageSDL.sendToClients(SDLTrees.value) + ageSDL.setNotify(self.key,SDLTrees.value,0.0) + + for responder in respTreeAnims.value: + thisResp = responder.getName() + respTreeAnimsList.append(thisResp) + + for object in objTrees.value: + thisObj = object.getName() + objTreeList.append(thisObj) + + ageSDL = PtGetAgeSDL() + idx = 0 + for visible in ageSDL[SDLTrees.value]: + if not visible: + respTreeAnims.run(self.key, objectName=respTreeAnimsList[idx], fastforward=1) + idx += 1 + + ########################### + def OnNotify(self,state,id,events): + global respTreeAnimsList + global objTreeList + print "ahnyTrees.OnNotify: state=%s id=%d events=" % (state, id), events + + if id == rgnTrees.id: + for event in events: + if event[0] == kCollisionEvent and self.sceneobject.isLocallyOwned() : + region = event[3] + regName = region.getName() + for object in objTreeList: + if object == regName: + ageSDL = PtGetAgeSDL() + treeSDL = list(ageSDL[SDLTrees.value]) + index = objTreeList.index(object) + if treeSDL[index]: + respTreeAnims.run(self.key, objectName=respTreeAnimsList[index], netForce = 1) + treeSDL[index] = 0 + ageSDL[SDLTrees.value] = tuple(treeSDL) + print "ahnyTrees.OnNotify: Tree knocked down" + diff --git a/Python/ahnyVogondolaRideV2.py b/Python/ahnyVogondolaRideV2.py new file mode 100644 index 0000000000..fcb17393f7 --- /dev/null +++ b/Python/ahnyVogondolaRideV2.py @@ -0,0 +1,799 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ahnyVogondolaRideV2 +Age: Ahnonay Sphere 04 +Date: April 2004 +Author: Adam Van Ornum (based on original work by Chris Purvis) +""" + +from Plasma import * +from PlasmaTypes import * + +GroupSelector = ptAttribDropDownList(1, "Group Selector", ("Hub", "Eng Hut", "Vogondola", "Vogondola Throttle", "Vogondola Reverse", "Call buttons") ) + +actHubChairClick = ptAttribActivator(2, "Hub chair clickable") +behHubChairClimb = ptAttribBehavior(3, "Hub chair climb beh") +respHubChairLower = ptAttribNamedResponder(4, "Hub chair lower resp", ["lower", "raise"], netForce=1) + +actVogEjectFront = ptAttribActivator(5, "Vog eject front click") +actVogEjectRear = ptAttribActivator(6, "Vog eject rear click") + +actVogThrottleF = ptAttribActivator(7, "Vog throttle forward click") +actVogThrottleB = ptAttribActivator(8, "Vog throttle back click") +actVogThrottleRevF = ptAttribActivator(9, "Vog throttle rev forward click") +actVogThrottleRevB = ptAttribActivator(10, "Vog throttle rev back click") + +actVogDirection = ptAttribActivator(11, "Vog direction click") +actVogDirectionRev = ptAttribActivator(12, "Vog direction rev click") + +respVogChairLower = ptAttribResponder(13, "Vog chair lower resp") +respVogRotate = ptAttribResponder(14, "Vog rotate resp", ["back", "front"]) +respVogThrottle = ptAttribResponder(15, "Vog throttle resp", ["start", "stop"]) +respVogThrottleRev = ptAttribResponder(16, "Vog throttle rev resp", ["start", "stop"]) +respVogEjectHub = ptAttribResponder(17, "Vog eject hub resp", ["norotate", "rotate", "oneshot"], netForce=1) +respVogEjectEngHut = ptAttribResponder(18, "Vog eject eng hut resp", ["norotate", "rotate", "oneshot"], netForce=1) + +soVogDummy = ptAttribSceneobject(19, "Vog avatar dummy") +soVogSubworld = ptAttribSceneobject(20, "Vog subworld") + +actEngHutChairClick = ptAttribActivator(21, "Eng Hut chair clickable") +behEngHutChairClimb = ptAttribBehavior(22, "Eng Hut chair climb beh") +respEngHutChairLower = ptAttribNamedResponder(23, "Eng Hut chair lower resp", ["lower", "raise"], netForce=1) + +actTubeEndFromHub = ptAttribActivator(24, "Tube end from hub act") +actTubeEndFromEngHut = ptAttribActivator(25, "Tube end from eng hut act") +actSailEndToEngHut = ptAttribActivator(26, "Sail end to eng hut act") +actSailEndToHub = ptAttribActivator(27, "Sail end to hub act") +actHubRideEnd = ptAttribActivator(28, "Hub ride end act") +actEngHutRideEnd = ptAttribActivator(29, "Eng hut ride end act") + +respVogRideStart = ptAttribResponder(30, "Vog ride start resp") +respVogRideStop = ptAttribResponder(31, "Vog ride stop resp") +respVogRideStartRev = ptAttribResponder(32, "Vog ride start rev resp") +respVogRideStopRev = ptAttribResponder(33, "Vog ride stop rev resp") + +##actCallbuttonHub = ptAttribNamedActivator(34, "Hub vog call button") +##actCallbuttonEngHut = ptAttribNamedActivator(35, "Eng hut vog call button") +##respHubCallbutton = ptAttribNamedResponder(36, "Hub call button resp") +##respEngHutCallbutton = ptAttribNamedResponder(37, "Eng hut call button resp") + +respVogRideReset = ptAttribResponder(38, "Vog ride reset resp", ["hub", "eng hut"]) + +soEjectPointHub = ptAttribSceneobject(39, "eject point hub") +soEjectPointEngHut = ptAttribSceneobject(40, "eject point eng hut") + +actCallbuttonHub = ptAttribNamedActivator(41, "Hub vog call button") +actCallbuttonEngHut = ptAttribNamedActivator(42, "Eng hut vog call button") +respHubCallbutton = ptAttribNamedResponder(43, "Hub call button resp") +respEngHutCallbutton = ptAttribNamedResponder(44, "Eng hut call button resp") + +respSounds = ptAttribResponder(45, "Sound responder", ["hubtubeout", "hubtubein", "sailtohub", "sailtohut", "huttubeout", "huttubein", "stop"]) + +actStopVogSoundForward = ptAttribActivator(46, "Vog snd stop forward act") +actStopVogSoundBackward = ptAttribActivator(47, "Vog snd stop backward act") + +actHubChairClick.setVisInfo(1, ["Hub"]) +behHubChairClimb.setVisInfo(1, ["Hub"]) +respHubChairLower.setVisInfo(1, ["Hub"]) +actVogEjectFront.setVisInfo(1, ["Vogondola"]) +actVogEjectRear.setVisInfo(1, ["Vogondola"]) + +actVogThrottleF.setVisInfo(1, ["Vogondola Throttle"]) +actVogThrottleB.setVisInfo(1, ["Vogondola Throttle"]) +actVogThrottleRevF.setVisInfo(1, ["Vogondola Throttle"]) +actVogThrottleRevB.setVisInfo(1, ["Vogondola Throttle"]) +respVogThrottle.setVisInfo(1, ["Vogondola Throttle"]) +respVogThrottleRev.setVisInfo(1, ["Vogondola Throttle"]) + +actVogDirection.setVisInfo(1, ["Vogondola Reverse"]) +actVogDirectionRev.setVisInfo(1, ["Vogondola Reverse"]) +respVogRotate.setVisInfo(1, ["Vogondola Reverse"]) + +respVogChairLower.setVisInfo(1, ["Vogondola"]) +respVogEjectHub.setVisInfo(1, ["Vogondola"]) +respVogEjectEngHut.setVisInfo(1, ["Vogondola"]) +soVogDummy.setVisInfo(1, ["Vogondola"]) +soVogSubworld.setVisInfo(1, ["Vogondola"]) + +actEngHutChairClick.setVisInfo(1, ["Eng Hut"]) +behEngHutChairClimb.setVisInfo(1, ["Eng Hut"]) +respEngHutChairLower.setVisInfo(1, ["Eng Hut"]) + +actTubeEndFromHub.setVisInfo(1, ["Vogondola"]) +actTubeEndFromEngHut.setVisInfo(1, ["Vogondola"]) +actSailEndToEngHut.setVisInfo(1, ["Vogondola"]) +actSailEndToHub.setVisInfo(1, ["Vogondola"]) +actHubRideEnd.setVisInfo(1, ["Vogondola"]) +actEngHutRideEnd.setVisInfo(1, ["Vogondola"]) + +respVogRideStart.setVisInfo(1, ["Vogondola"]) +respVogRideStop.setVisInfo(1, ["Vogondola"]) +respVogRideStartRev.setVisInfo(1, ["Vogondola"]) +respVogRideStopRev.setVisInfo(1, ["Vogondola"]) + +actCallbuttonHub.setVisInfo(1, ["Call buttons"]) +actCallbuttonEngHut.setVisInfo(1, ["Call buttons"]) +respHubCallbutton.setVisInfo(1, ["Call buttons"]) +respEngHutCallbutton.setVisInfo(1, ["Call buttons"]) + +respVogRideReset.setVisInfo(1, ["Vogondola"]) + +soEjectPointHub.setVisInfo(1, ["Vogondola"]) +soEjectPointEngHut.setVisInfo(1, ["Vogondola"]) +respSounds.setVisInfo(1, ["Vogondola"]) + +actStopVogSoundForward.setVisInfo(1, ["Vogondola"]) +actStopVogSoundBackward.setVisInfo(1, ["Vogondola"]) + +def DisableVogControls( enabledControlList ): + disableControlList = [actVogEjectFront, actVogEjectRear, actVogThrottleF, actVogThrottleB, actVogThrottleRevF, actVogThrottleRevB, actVogDirection, actVogDirectionRev] + + if type(enabledControlList) == type( [] ): + for control in enabledControlList: + disableControlList.remove(control) + control.enable() + + for control in disableControlList: + control.disable() + +def VogondolaIsOccupied( occupant ): + if occupant: + print "ahnyVogondolaRideV2.VogondolaIsOccupied(): Someone got in the Vog, disabling all access points" + + actHubChairClick.disable() + actEngHutChairClick.disable() + actCallbuttonHub.disable() + actCallbuttonEngHut.disable() + else: + print "ahnyVogondolaRideV2.VogondolaIsOccupied(): Someone got out of the Vog, enabling all access points" + + sdl = PtGetAgeSDL() + vogLoc = sdl["ahnyVogLocation"][0] + if vogLoc == 0: + print "SDL set to 0, Hub Chair enabled" + actHubChairClick.enable() + elif vogLoc == 2: + print "SDL set to 2, Hut Chair enabled" + actEngHutChairClick.enable() + +# brains - these determine what happens at the various stages +class InHubBrain: + def __init__(self, parent): + self.parent = parent + self.name = "In Hub Brain" + + print "initing", self.name + + PtDisableMovementKeys() + + enabledControlList = [actVogEjectFront, actVogEjectRear, actVogThrottleB] + + if self.parent.direction == 1: + enabledControlList.append(actVogDirection) + elif self.parent.direction == -1: + enabledControlList.append(actVogDirectionRev) + + DisableVogControls( enabledControlList ) + + def OnNotify(self, state, id, events): + if id == actHubChairClick.id and state: + print "Hub Brain says Hub Chair clicked, disable Hub Chair" + actHubChairClick.disable() + + avatar = PtFindAvatar(events) + behHubChairClimb.run(avatar) + + elif id == behHubChairClimb.id: + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + respHubChairLower.run(self.parent.key, events = events, state = "lower") + print self.name + ": finished smart-seek" + + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + theAvatar = PtGetLocalAvatar() + theAvatar.physics.warpObj(soVogDummy.value.getKey()) + PtAttachObject(theAvatar.getKey(), soVogDummy.value.getKey()) + theAvatar.avatar.enterSubWorld(soVogSubworld.value) + print self.name + ": pinned avatar" + respVogChairLower.run(self.parent.key, events = events) + + elif id == actVogDirection.id and state: + actVogDirection.disable() + actVogThrottleB.disable() + self.parent.direction = -1 + respVogRotate.run(self.parent.key, state = "back") + actVogDirectionRev.enable() + + elif id == actVogDirectionRev.id and state: + actVogDirectionRev.disable() + self.parent.direction = 1 + respVogRotate.run(self.parent.key, state = "front") + actVogThrottleB.enable() + actVogDirection.enable() + + elif id == actVogEjectFront.id and state: + DisableVogControls( None ) + respVogEjectHub.run(self.parent.key, state = "norotate") + + sdl = PtGetAgeSDL() + print "SETTING SDL TO 0" + sdl["ahnyVogLocation"] = (0,) + + elif id == actVogEjectRear.id and state: + DisableVogControls( None ) + respVogEjectHub.run(self.parent.key, state = "rotate") + + sdl = PtGetAgeSDL() + print "SETTING SDL TO 0" + sdl["ahnyVogLocation"] = (0,) + + elif id == actVogThrottleB.id and state: + DisableVogControls( None ) + respVogRideStart.run(self.parent.key) + + elif id == respVogRideStart.id: + print "running respSounds: state - hubtubeout loc - hub brain respvogridestart" + respSounds.run(self.parent.key, state = "hubtubeout") + + elif id == actTubeEndFromHub.id: + #respVogThrottle.run(self.parent.key, state = "stop") + respVogRideStop.run(self.parent.key) + + self.parent.currentBrain = HubSailTubeTransitionBrain(self.parent) + self.parent.direction = 1 + + elif id == respVogEjectHub.id: + theAvatar=PtGetLocalAvatar() + respHubChairLower.run(self.parent.key, avatar = theAvatar, state = "raise") + PtDetachObject(theAvatar.getKey(), soVogDummy.value.getKey()) + theAvatar.avatar.exitSubWorld() + theAvatar.physics.warpObj(soEjectPointHub.value.getKey()) + respVogEjectHub.run(self.parent.key, avatar = theAvatar, state = "oneshot") + + self.parent.currentBrain = None + PtEnableMovementKeys() + print "ejecting finished in vog at hub...setting current brain to none" + +class HubSailTubeTransitionBrain: + def __init__(self, parent): + self.parent = parent + self.name = "Hub Sail Tube Transition Brain" + + print "initing", self.name + + + enabledControlList = [actVogThrottleB, actVogThrottleRevB] + + if self.parent.direction == 1: + enabledControlList.append(actVogDirection) + elif self.parent.direction == -1: + enabledControlList.append(actVogDirectionRev) + + DisableVogControls( enabledControlList ) + + def OnNotify(self, state, id, events): + if id == actVogDirection.id and state: + actVogDirection.disable() + actVogThrottleB.disable() + self.parent.direction = -1 + respVogRotate.run(self.parent.key, state = "back") + actVogThrottleRevB.enable() + actVogDirectionRev.enable() + + elif id == actVogDirectionRev.id and state: + actVogDirectionRev.disable() + actVogThrottleRevB.disable() + self.parent.direction = 1 + respVogRotate.run(self.parent.key, state = "front") + actVogThrottleB.enable() + actVogDirection.enable() + + elif id == actVogThrottleB.id and state: + #DisableVogControls() + respVogRideStart.run(self.parent.key) + #respSounds.run(self.parent.key, state = "sailtohut") + + self.parent.currentBrain = SailingBrain(self.parent) + self.parent.direction = 1 + + elif id == actVogThrottleRevB.id and state: + DisableVogControls( None ) + respVogRideStartRev.run(self.parent.key) + + elif id == respVogRideStartRev.id: + print "running respSounds: state - hubtubein loc - hubtransistion respvogridestartrev" + respSounds.run(self.parent.key, state = "hubtubein") + + #elif (id == respVogRideStop.id or id == respVogRideStopRev.id) and self.parent.direction == -1: + # respSounds.run(self.parent.key, state = "stop") + + elif id == actHubRideEnd.id: + #DisableVogControls() + respVogThrottle.run(self.parent.key, state = "stop") + + self.parent.currentBrain = InHubBrain(self.parent) + +class SailingBrain: + def __init__(self, parent): + self.parent = parent + self.name = "Sailing Brain" + + print "initing", self.name + + enabledControlList = None + + if self.parent.direction == 1: + enabledControlList = [actVogThrottleF] + elif self.parent.direction == -1: + enabledControlList = [actVogThrottleRevF] + + DisableVogControls( enabledControlList ) + + def OnNotify(self, state, id, events): + if (id == actVogThrottleF.id or id == actVogThrottleRevF.id) and state: + respVogRideStop.run(self.parent.key) + + enabledControlList = None + + if self.parent.direction == 1: + enabledControlList = [actVogThrottleB, actVogDirection] + elif self.parent.direction == -1: + enabledControlList = [actVogThrottleRevB, actVogDirectionRev] + + DisableVogControls( enabledControlList ) + + elif id == respVogRideStop.id or id == respVogRideStopRev.id: + print "vog ride stop notify" + respSounds.run(self.parent.key, state = "stop") + + elif id == actVogDirection.id and state: + actVogDirection.disable() + actVogThrottleB.disable() + self.parent.direction = -1 + respVogRotate.run(self.parent.key, state = "back") + actVogThrottleRevB.enable() + actVogDirectionRev.enable() + + elif id == actVogDirectionRev.id and state: + actVogDirectionRev.disable() + actVogThrottleRevB.disable() + self.parent.direction = 1 + respVogRotate.run(self.parent.key, state = "front") + actVogThrottleB.enable() + actVogDirection.enable() + + elif id == actVogThrottleB.id and state: + DisableVogControls( [actVogThrottleF] ) + respVogRideStart.run(self.parent.key) + #respSounds.run(self.parent.key, state = "sailtohut") + + elif id == actVogThrottleRevB.id and state: + DisableVogControls( [actVogThrottleRevF] ) + respVogRideStartRev.run(self.parent.key) + #respSounds.run(self.parent.key, state = "sailtohub") + + elif id == respVogRideStart.id: + print "running respSounds: state - sailtohut loc - sail brain vogridestart" + respSounds.run(self.parent.key, state = "sailtohut") + + elif id == respVogRideStartRev.id: + print "running respSounds: state - sailtohub loc - sail brain vogridestartrev" + respSounds.run(self.parent.key, state = "sailtohub") + + elif id == actSailEndToEngHut.id and self.parent.direction == 1: + #DisableVogControls() + respVogRideStop.run(self.parent.key) + #respSounds.run(self.parent.key, state = "stop") + + self.parent.currentBrain = EngHutSailTubeTransitionBrain(self.parent) + + elif id == actSailEndToHub.id and self.parent.direction == -1: + #DisableVogControls() + respVogRideStop.run(self.parent.key) + #respSounds.run(self.parent.key, state = "stop") + + self.parent.currentBrain = HubSailTubeTransitionBrain(self.parent) + +class EngHutSailTubeTransitionBrain: + def __init__(self, parent): + self.parent = parent + self.name = "Eng Hut Sail Tube Transition Brain" + + print "initing", self.name + + enabledControlList = [actVogThrottleB, actVogThrottleRevB] + + if self.parent.direction == 1: + enabledControlList.append(actVogDirection) + elif self.parent.direction == -1: + enabledControlList.append(actVogDirectionRev) + + DisableVogControls( enabledControlList ) + + def OnNotify(self, state, id, events): + if id == actVogDirection.id and state: + actVogDirection.disable() + actVogThrottleB.disable() + self.parent.direction = -1 + respVogRotate.run(self.parent.key, state = "back") + actVogThrottleRevB.enable() + actVogDirectionRev.enable() + + elif id == actVogDirectionRev.id and state: + actVogDirectionRev.disable() + actVogThrottleRevB.disable() + self.parent.direction = 1 + respVogRotate.run(self.parent.key, state = "front") + actVogThrottleB.enable() + actVogDirection.enable() + + elif id == actVogThrottleRevB.id and state: + #DisableVogControls() + respVogRideStartRev.run(self.parent.key) + #respSounds.run(self.parent.key, state = "sailtohub") + + self.parent.currentBrain = SailingBrain(self.parent) + self.parent.direction = -1 + + #elif (id == respVogRideStop.id or id == respVogRideStopRev.id) and self.parent.direction == 1: + # respSounds.run(self.parent.key, state = "stop") + + elif id == actVogThrottleB.id and state: + DisableVogControls( None ) + respVogRideStart.run(self.parent.key) + + elif id == respVogRideStart.id: + print "running respSounds: state - huttubein loc - hut transition vogridestart" + respSounds.run(self.parent.key, state = "huttubein") + + elif id == actEngHutRideEnd.id: + #DisableVogControls() + respVogThrottle.run(self.parent.key, state = "stop") + + self.parent.currentBrain = InEngHutBrain(self.parent) + +class InEngHutBrain: + def __init__(self, parent): + self.parent = parent + self.name = "In Eng Hut Brain" + + print "initing", self.name + + PtDisableMovementKeys() + + enabledControlList = [actVogEjectFront, actVogEjectRear, actVogThrottleRevB] + + if self.parent.direction == 1: + enabledControlList.append(actVogDirection) + elif self.parent.direction == -1: + enabledControlList.append(actVogDirectionRev) + + DisableVogControls( enabledControlList ) + + def OnNotify(self, state, id, events): + if id == actEngHutChairClick.id and state: + print "Hut Brain says Hut Chair clicked, disable Hut Chair" + actEngHutChairClick.disable() + + avatar = PtFindAvatar(events) + behEngHutChairClimb.run(avatar) + + elif id == behEngHutChairClimb.id: + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + respEngHutChairLower.run(self.parent.key, events = events, state = "lower") + print self.name + ": finished smart-seek" + + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + theAvatar = PtGetLocalAvatar() + theAvatar.physics.warpObj(soVogDummy.value.getKey()) + PtAttachObject(theAvatar.getKey(), soVogDummy.value.getKey()) + theAvatar.avatar.enterSubWorld(soVogSubworld.value) + print self.name + ": pinned avatar" + respVogChairLower.run(self.parent.key, events = events) + + elif id == actVogDirection.id and state: + actVogDirection.disable() + self.parent.direction = -1 + respVogRotate.run(self.parent.key, state = "back") + actVogThrottleRevB.enable() + actVogDirectionRev.enable() + + elif id == actVogDirectionRev.id and state: + actVogDirectionRev.disable() + actVogThrottleRevB.disable() + self.parent.direction = 1 + respVogRotate.run(self.parent.key, state = "front") + actVogDirection.enable() + + elif id == actVogEjectFront.id and state: + DisableVogControls( None ) + respVogEjectEngHut.run(self.parent.key, state = "norotate") + theAvatar = PtGetLocalAvatar() + #theAvatar.draw.disable() + + sdl = PtGetAgeSDL() + print "SETTING SDL TO 2" + sdl["ahnyVogLocation"] = (2,) + + elif id == actVogEjectRear.id and state: + DisableVogControls( None ) + respVogEjectEngHut.run(self.parent.key, state = "rotate") + + sdl = PtGetAgeSDL() + print "SETTING SDL TO 2" + sdl["ahnyVogLocation"] = (2,) + + elif id == actVogThrottleRevB.id and state: + DisableVogControls( None ) + respVogRideStartRev.run(self.parent.key) + #respSounds.run(self.parent.key, state = "huttubeout") + + elif id == respVogRideStartRev.id: + print "running respSounds: huttubeout - stop loc - hut brain vogridestartrev" + respSounds.run(self.parent.key, state = "huttubeout") + + elif id == actTubeEndFromEngHut.id: + respVogRideStop.run(self.parent.key) + + self.parent.currentBrain = EngHutSailTubeTransitionBrain(self.parent) + self.parent.direction = -1 + + elif id == respVogEjectEngHut.id: + theAvatar=PtGetLocalAvatar() + respEngHutChairLower.run(self.parent.key, avatar = theAvatar, state = "raise") + PtDetachObject(theAvatar.getKey(), soVogDummy.value.getKey()) + theAvatar.avatar.exitSubWorld() + theAvatar.physics.warpObj(soEjectPointEngHut.value.getKey()) + respVogEjectEngHut.run(self.parent.key, avatar = theAvatar, state = "oneshot") + + self.parent.currentBrain = None + PtEnableMovementKeys() + #theAvatar.draw.enable() + print "ejecting finished in vog at eng hut...setting current brain to none" + + +# main class +class ahnyVogondolaRideV2(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5338 + self.version = 2 + self.currentBrain = None + self.direction = 1 + self.throttle = 0 + self.occupant = None + print "Init: ahnyVogondolaRideV2" + + def OnFirstUpdate(self): + try: + ageSDL = PtGetAgeSDL() + except: + print "uh oh... no SDL! Prepare to have lots of bugs." + + ageSDL = PtGetAgeSDL() + ageSDL.setFlags("ahnyVogLocation",1,1) + ageSDL.sendToClients("ahnyVogLocation") + ageSDL.setNotify(self.key,"ahnyVogLocation",0.0) + + ageSDL.setFlags("ahnyVogOccupant",1,1) + ageSDL.sendToClients("ahnyVogOccupant") + ageSDL.setNotify(self.key,"ahnyVogOccupant",0.0) + + print "First Update, all buttons disabled" + actCallbuttonHub.disable() + actCallbuttonEngHut.disable() + actHubChairClick.disable() + actEngHutChairClick.disable() + + if ageSDL["ahnyVogOccupant"][0]: + print "%d is in the Vogondola" % (ageSDL["ahnyVogOccupant"][0]) + self.occupant = ageSDL["ahnyVogOccupant"][0] + else: + print "Vogondola is empty" + PtAtTimeCallback(self.key, 0, 1) + + def OnTimer(self, id): + if id == 1: + sdl = PtGetAgeSDL() + vogLoc = sdl["ahnyVogLocation"][0] + + # vogLoc: 0 = hub, 1 = in between, 2 = eng hut + if vogLoc == 0: + print "Timer says SDL set to 0, Hut call and Hub chair enabled" + actCallbuttonEngHut.enable() + actHubChairClick.enable() + + elif vogLoc == 1: + print "Timer says SDL set to 1, Hut call and Hub call enabled" + actCallbuttonEngHut.enable() + actCallbuttonHub.enable() + + respHubChairLower.run(self.key, state = "lower", fastforward = 1) + + elif vogLoc == 2: + print "Timer says SDL set to 2, Hut chair and Hub call enabled" + actCallbuttonHub.enable() + actEngHutChairClick.enable() + + respEngHutChairLower.run(self.key, state = "raise", fastforward = 1) + respHubChairLower.run(self.key, state = "lower", fastforward = 1) + respVogRideStart.run(self.key, fastforward = 1) + respVogThrottle.run(self.key, state = "stop", fastforward = 1) + + elif id == 2: + print "timer id 2 returned...run responder" + respHubChairLower.run(self.key, state = "raise") + + elif id == 3: + print "timer id 3 returned...run responder" + respEngHutChairLower.run(self.key, state = "raise") + + + def AvatarPage(self, avObj, pageIn, lastOut): + if not pageIn and self.occupant: + avID = PtGetClientIDFromAvatarKey(avObj.getKey()) + if avID == PtGetClientIDFromAvatarKey(self.occupant.getKey()): + print "Vogondola rider left, enabling call buttons." + actCallbuttonHub.enable() + actCallbuttonEngHut.enable() + sdl = PtGetAgeSDL() + sdl["ahnyVogOccupant"] = (0,) + self.occupant = None + + def OnNotify(self,state,id,events): + print "-------------------------------------------------" + print " notify: id= %d state= %d" % (id,state) + if PtFindAvatar(events): + print " notify: Trigger= %s Self= %s" % (str(PtGetClientIDFromAvatarKey(PtFindAvatar(events).getKey())),str(PtGetClientIDFromAvatarKey(PtGetLocalAvatar().getKey()))) + print " notify: events= %s" % (str(events)) + print " " + + if id == actHubChairClick.id and state: + sdl = PtGetAgeSDL() + print "SETTING SDL TO 1" + sdl["ahnyVogLocation"] = (1,) + sdl["ahnyVogOccupant"] = (PtFindAvatar(events).getKey(),) + self.occupant = PtFindAvatar(events) + VogondolaIsOccupied(1) + + if PtFindAvatar(events) == PtGetLocalAvatar(): + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + respVogRideReset.run(self.key, state = "hub", fastforward = 1) + self.direction = 1 + self.currentBrain = InHubBrain(self) + self.currentBrain.OnNotify(state, id, events) + + elif id == actEngHutChairClick.id and state: + sdl = PtGetAgeSDL() + print "SETTING SDL TO 1" + sdl["ahnyVogLocation"] = (1,) + sdl["ahnyVogOccupant"] = (PtFindAvatar(events).getKey(),) + self.occupant = PtFindAvatar(events) + VogondolaIsOccupied(1) + + if PtFindAvatar(events) == PtGetLocalAvatar(): + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + respVogRideReset.run(self.key, state = "eng hut", fastforward = 1) + self.direction = 1 + self.currentBrain = InEngHutBrain(self) + self.currentBrain.OnNotify(state, id, events) + + elif id == actCallbuttonHub.id and state: + print "call button hub clicked" + VogondolaIsOccupied(1) + respHubCallbutton.run(self.key, events = events) + sdl = PtGetAgeSDL() + if sdl["ahnyVogLocation"][0] == 2: + respEngHutChairLower.run(self.key, state = "lower") + + print "SETTING SDL TO 0" + sdl["ahnyVogLocation"] = (0,) + + elif id == respHubCallbutton.id: + print "call button hub returned" + PtAtTimeCallback(self.key, 5, 2) + + elif id == actCallbuttonEngHut.id and state: + print "call button hut clicked" + VogondolaIsOccupied(1) + respEngHutCallbutton.run(self.key, events = events) + sdl = PtGetAgeSDL() + if sdl["ahnyVogLocation"][0] == 0: + respHubChairLower.run(self.key, state = "lower") + + print "SETTING SDL TO 2" + sdl["ahnyVogLocation"] = (2,) + + elif id == respEngHutCallbutton.id: + print "call button hut returned" + PtAtTimeCallback(self.key, 5, 3) + + elif id == respHubChairLower.id and self.currentBrain == None: + if self.occupant == PtGetLocalAvatar(): + print "Hub Chair came up, Hub chair enabled" + actHubChairClick.enable() + + cam = ptCamera() + cam.enableFirstPersonOverride() + else: + VogondolaIsOccupied(0) + + sdl = PtGetAgeSDL() + sdl["ahnyVogOccupant"] = (0,) + self.occupant = None + print "Hub Chair came up, Hut call enabled" + actCallbuttonEngHut.enable() + + elif id == respEngHutChairLower.id and self.currentBrain == None: + if self.occupant == PtGetLocalAvatar(): + print "Hut Chair came up, Hut chair enabled" + actEngHutChairClick.enable() + + cam = ptCamera() + cam.enableFirstPersonOverride() + else: + VogondolaIsOccupied(0) + + sdl = PtGetAgeSDL() + sdl["ahnyVogOccupant"] = (0,) + self.occupant = None + print "Hut Chair came up, Hub call enabled" + actCallbuttonHub.enable() + + elif (id == actStopVogSoundForward.id or id == actStopVogSoundBackward.id) and state: + #DisableVogControls() + actStopVogSoundForward.disable() + actStopVogSoundBackward.disable() + print "running respSounds: state - stop loc - anim event det", id, state + respSounds.run(self.key, state = "stop") + + else: + if self.currentBrain != None: + print "passing event on to sub-brain" + self.currentBrain.OnNotify(state, id, events) + + def OnBackdoorMsg(self, target, param): + if target == "vog": + if param == "currentbrain": + if self.currentBrain == None: + print "Vog Current Brain: None" + else: + print "Vog Current Brain:", self.currentBrain.name + + elif param == "beh": + avatar = PtGetLocalAvatar() + #behEngHutChairClimb.run(avatar) + #behEngHutChairClimb.gotoStage(avatar, 1) + \ No newline at end of file diff --git a/Python/airstream.py b/Python/airstream.py new file mode 100644 index 0000000000..e69130af90 --- /dev/null +++ b/Python/airstream.py @@ -0,0 +1,54 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ + + +from Plasma import * +from PlasmaTypes import * +import PlasmaControlKeys + +activateAirstream = ptAttribActivator(1,"airstream activator") +airstreamNode = ptAttribSceneobject(2,"airstream attach node") + +class airstream(ptResponder): + + def __init__(self): + # run parent class init + ptResponder.__init__(self) + self.id = 50439 + self.version = 1 + + print "__init__airstream v." + + + def OnNotify(self,state,id,events): + + if id==activateAirstream.id: + avatar = PtFindAvatar(events) + avatar.draw.disable() +# avatar.physics.warpObj(airstreamNode.value.getKey()) +# PtAttachObject(avatar.getKey(), airstreamNode.value.getKey()) + avatar.physics.enable(0) + diff --git a/Python/bhroBahroBlueSpiral.py b/Python/bhroBahroBlueSpiral.py new file mode 100644 index 0000000000..9b33682abf --- /dev/null +++ b/Python/bhroBahroBlueSpiral.py @@ -0,0 +1,106 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: bhroBahroBlueSpiral +Age: Global +Date: November 2006 +Author: Derek Odell +Blue Spiral Bahro Cave +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from xPsnlVaultSDL import * + +# define the attributes that will be entered in max +clkBSTsogal = ptAttribActivator(1, "clk: Tsogal Blue Spiral") +clkBSDelin = ptAttribActivator(2, "clk: Delin Blue Spiral") + +respWedges = ptAttribResponder(3, "resp: Ground Wedges", ['Delin', 'Tsogal']) +respRings = ptAttribResponder(4, "resp: Floating Rings", ['Delin', 'Tsogal']) + +# define global variables + +#==================================== +class bhroBahroBlueSpiral(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 8813 + self.version = 1 + print "bhroBahroBlueSpiral: init version = %d" % self.version + + ########################### + def __del__(self): + pass + + ########################### + def OnFirstUpdate(self): + global gAgeStartedIn + + gAgeStartedIn = PtGetAgeName() + PtSendKIMessage(kDisableYeeshaBook,0) + + ########################### + def OnServerInitComplete(self): + # if the age is not the one that I'm from then run the responder to make it back off + ageFrom = PtGetPrevAgeName() + print "bhroBahroBlueSpiral.OnServerInitComplete: Came from %s, running opposite responder state" % (ageFrom) + if ageFrom == "EderTsogal": + respWedges.run(self.key, state="Delin", fastforward=1) + + elif ageFrom == "EderDelin": + respWedges.run(self.key, state="Tsogal", fastforward=1) + + psnlSDL = xPsnlVaultSDL() + if psnlSDL["psnlBahroWedge05"][0]: + respRings.run(self.key, state="Delin", fastforward=1) + if psnlSDL["psnlBahroWedge06"][0]: + respRings.run(self.key, state="Tsogal", fastforward=1) + + ########################### + def OnNotify(self,state,id,events): + #print "bhroBahroBlueSpiral.OnNotify: state=%s id=%d events=" % (state, id), events + + if id == clkBSTsogal.id and not state: + print "bhroBahroBlueSpiral.OnNotify: clicked Tsogal Spiral" + respRings.run(self.key, state="Tsogal", avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge06"][0] + if not sdlVal: + print "bhroBahroBlueSpiral.OnNotify: Tturning wedge SDL of psnlBahroWedge06 to On" + psnlSDL["psnlBahroWedge06"] = (1,) + + elif id == clkBSDelin.id and not state: + print "bhroBahroBlueSpiral.OnNotify: clicked Delin Spiral" + respRings.run(self.key, state="Delin", avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge05"][0] + if not sdlVal: + print "bhroBahroBlueSpiral.OnNotify: Tturning wedge SDL of psnlBahroWedge05 to On" + psnlSDL["psnlBahroWedge05"] = (1,) + diff --git a/Python/bhroBahroMink.py b/Python/bhroBahroMink.py new file mode 100644 index 0000000000..5ee3444b0a --- /dev/null +++ b/Python/bhroBahroMink.py @@ -0,0 +1,85 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: bhroBahroMink +Age: Live Bahro Cave +Date: January 2007 +Author: Derek Odell +Minkata Bahro Cave +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from xPsnlVaultSDL import * + +# define the attributes that will be entered in max +clickable = ptAttribActivator(1, "clickable") +respRing = ptAttribResponder(2, "resp: Ring") + +# define global variables + +#==================================== +class bhroBahroMink(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 8815 + self.version = 1 + print "bhroBahroMink: init version = %d" % self.version + + ########################### + def __del__(self): + pass + + ########################### + def OnFirstUpdate(self): + global gAgeStartedIn + + gAgeStartedIn = PtGetAgeName() + PtSendKIMessage(kDisableYeeshaBook,0) + + ########################### + def OnServerInitComplete(self): + psnlSDL = xPsnlVaultSDL() + print psnlSDL["psnlBahroWedge11"][0] + + if psnlSDL["psnlBahroWedge11"][0]: + print "bhroBahroMink.OnServerInitComplete: You have the Minkata wedge, no need to display it." + respRing.run(self.key, fastforward=1) + + ########################### + def OnNotify(self,state,id,events): + #print "bhroBahroMink.OnNotify: state=%s id=%d events=" % (state, id), events + + if id == clickable.id and not state: + print "bhroBahroMink.OnNotify: clicked Minkata Spiral" + respRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge11"][0] + if not sdlVal: + print "bhroBahroMink.OnNotify: Turning wedge SDL of psnlBahroWedge11 to On" + psnlSDL["psnlBahroWedge11"] = (1,) diff --git a/Python/bhroBahroPOTS.py b/Python/bhroBahroPOTS.py new file mode 100644 index 0000000000..b788dc0931 --- /dev/null +++ b/Python/bhroBahroPOTS.py @@ -0,0 +1,104 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: bhroBahroPOTS +Age: LiveBahroCaves +Date: May 2007 +Author: Chris Doyle, shameless plagarized off of Derek Odell's bhroBahroPod.py script +POTS Bahro Cave +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from xPsnlVaultSDL import * + + +clkErcana = ptAttribActivator(1, "clk: Ercana symbol") +clkAhnonay = ptAttribActivator(2, "clk: Ahnonay symbol") +respWedges = ptAttribResponder(3, "resp: Ground Wedges", ['Ercana','Ahnonay']) +respErcanaRing = ptAttribResponder(4, "resp: Ercana Floating Ring") +respAhnonayRing = ptAttribResponder(5, "resp: Ahnonay Floating Ring") + + +class bhroBahroPOTS(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 8816 + self.version = 1 + print "bhroBahroPOTS: init version = %d" % self.version + + + def OnFirstUpdate(self): + global gAgeStartedIn + + gAgeStartedIn = PtGetAgeName() + PtSendKIMessage(kDisableYeeshaBook,0) + + + def OnServerInitComplete(self): + # if the age is not the one that I'm from then run the responder to make it back off + ageFrom = PtGetPrevAgeName() + print "bhroBahroPOTS.OnServerInitComplete: Came from %s, running opposite responder state" % (ageFrom) + if ageFrom == "Ercana": + respWedges.run(self.key, state="Ahnonay", fastforward=1) + elif ageFrom == "Ahnonay": + respWedges.run(self.key, state="Ercana", fastforward=1) + + psnlSDL = xPsnlVaultSDL() + print psnlSDL["psnlBahroWedge12"][0] + print psnlSDL["psnlBahroWedge13"][0] + + if psnlSDL["psnlBahroWedge12"][0]: + print "bhroBahroPOTS.OnServerInitComplete: You have the Ercana wedge, no need to display it." + respErcanaRing.run(self.key, fastforward=1) + if psnlSDL["psnlBahroWedge13"][0]: + print "bhroBahroPOTS.OnServerInitComplete: You have the Ahnonay wedge, no need to display it." + respAhnonayRing.run(self.key, fastforward=1) + + + def OnNotify(self,state,id,events): + #print "bhroBahroPOTS.OnNotify: state=%s id=%d events=" % (state, id), events + + if id == clkErcana.id and state: + print "bhroBahroPOTS.OnNotify: clicked Ercana symbol" + respErcanaRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge12"][0] + if not sdlVal: + print "bhroBahroPOTS.OnNotify: Turning wedge SDL of psnlBahroWedge12 to On" + psnlSDL["psnlBahroWedge12"] = (1,) + + elif id == clkAhnonay.id and state: + print "bhroBahroPOTS.OnNotify: clicked Ahnonay symbol" + respAhnonayRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge13"][0] + if not sdlVal: + print "bhroBahroPOTS.OnNotify: Turning wedge SDL of psnlBahroWedge13 to On" + psnlSDL["psnlBahroWedge13"] = (1,) + + diff --git a/Python/bhroBahroPod.py b/Python/bhroBahroPod.py new file mode 100644 index 0000000000..75142290a3 --- /dev/null +++ b/Python/bhroBahroPod.py @@ -0,0 +1,156 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: bhroBahroPod +Age: Bahro Cave +Date: January 2007 +Author: Derek Odell +Pod Bahro Cave +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from xPsnlVaultSDL import * + +# define the attributes that will be entered in max +clkNegilahn = ptAttribActivator(1, "clk: Negilahn Spiral") +clkDereno = ptAttribActivator(2, "clk: Dereno Spiral") +clkPayiferen = ptAttribActivator(3, "clk: Payiferen Spiral") +clkTetsonot = ptAttribActivator(4, "clk: Tetsonot Spiral") + +respWedges = ptAttribResponder(5, "resp: Ground Wedges", ['Negilahn', 'Dereno', 'Payiferen', 'Tetsonot']) +respNegilahnRing = ptAttribResponder(6, "resp: Negilahn Floating Ring") +respDerenoRing = ptAttribResponder(7, "resp: Dereno Floating Ring") +respPayiferenRing = ptAttribResponder(8, "resp: Payiferen Floating Ring") +respTetsonotRing = ptAttribResponder(9, "resp: Tetsonot Floating Ring") + +# define global variables + +#==================================== +class bhroBahroPod(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 8814 + self.version = 1 + print "bhroBahroPod: init version = %d" % self.version + + ########################### + def __del__(self): + pass + + ########################### + def OnFirstUpdate(self): + global gAgeStartedIn + + gAgeStartedIn = PtGetAgeName() + PtSendKIMessage(kDisableYeeshaBook,0) + + ########################### + def OnServerInitComplete(self): + # if the age is not the one that I'm from then run the responder to make it back off + ageFrom = PtGetPrevAgeName() + print "bhroBahroPod.OnServerInitComplete: Came from %s, running opposite responder state" % (ageFrom) + if ageFrom == "Negilahn": + respWedges.run(self.key, state="Dereno", fastforward=1) + respWedges.run(self.key, state="Payiferen", fastforward=1) + respWedges.run(self.key, state="Tetsonot", fastforward=1) + + elif ageFrom == "Dereno": + respWedges.run(self.key, state="Negilahn", fastforward=1) + respWedges.run(self.key, state="Payiferen", fastforward=1) + respWedges.run(self.key, state="Tetsonot", fastforward=1) + + elif ageFrom == "Payiferen": + respWedges.run(self.key, state="Negilahn", fastforward=1) + respWedges.run(self.key, state="Dereno", fastforward=1) + respWedges.run(self.key, state="Tetsonot", fastforward=1) + + elif ageFrom == "Tetsonot": + respWedges.run(self.key, state="Negilahn", fastforward=1) + respWedges.run(self.key, state="Dereno", fastforward=1) + respWedges.run(self.key, state="Payiferen", fastforward=1) + + psnlSDL = xPsnlVaultSDL() + print psnlSDL["psnlBahroWedge07"][0] + print psnlSDL["psnlBahroWedge08"][0] + print psnlSDL["psnlBahroWedge09"][0] + print psnlSDL["psnlBahroWedge10"][0] + + if psnlSDL["psnlBahroWedge07"][0]: + print "bhroBahroPod.OnServerInitComplete: You have the Negilahn wedge, no need to display it." + respNegilahnRing.run(self.key, fastforward=1) + if psnlSDL["psnlBahroWedge08"][0]: + print "bhroBahroPod.OnServerInitComplete: You have the Dereno wedge, no need to display it." + respDerenoRing.run(self.key, fastforward=1) + if psnlSDL["psnlBahroWedge09"][0]: + print "bhroBahroPod.OnServerInitComplete: You have the Payiferen wedge, no need to display it." + respPayiferenRing.run(self.key, fastforward=1) + if psnlSDL["psnlBahroWedge10"][0]: + print "bhroBahroPod.OnServerInitComplete: You have the Tetsonot wedge, no need to display it." + respTetsonotRing.run(self.key, fastforward=1) + + ########################### + def OnNotify(self,state,id,events): + #print "bhroBahroPod.OnNotify: state=%s id=%d events=" % (state, id), events + + if id == clkNegilahn.id and not state: + print "bhroBahroPod.OnNotify: clicked Negilahn Spiral" + respNegilahnRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge07"][0] + if not sdlVal: + print "bhroBahroPod.OnNotify: Turning wedge SDL of psnlBahroWedge07 to On" + psnlSDL["psnlBahroWedge07"] = (1,) + + elif id == clkDereno.id and not state: + print "bhroBahroPod.OnNotify: clicked Dereno Spiral" + respDerenoRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge08"][0] + if not sdlVal: + print "bhroBahroPod.OnNotify: Turning wedge SDL of psnlBahroWedge08 to On" + psnlSDL["psnlBahroWedge08"] = (1,) + + elif id == clkPayiferen.id and not state: + print "bhroBahroPod.OnNotify: clicked Payiferen Spiral" + respPayiferenRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge09"][0] + if not sdlVal: + print "bhroBahroPod.OnNotify: Turning wedge SDL of psnlBahroWedge09 to On" + psnlSDL["psnlBahroWedge09"] = (1,) + + elif id == clkTetsonot.id and not state: + print "bhroBahroPod.OnNotify: clicked Tetsonot Spiral" + respTetsonotRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge10"][0] + if not sdlVal: + print "bhroBahroPod.OnNotify: Turning wedge SDL of psnlBahroWedge10 to On" + psnlSDL["psnlBahroWedge10"] = (1,) + diff --git a/Python/bhroBahroYeeshaCave.py b/Python/bhroBahroYeeshaCave.py new file mode 100644 index 0000000000..d2c8fb517a --- /dev/null +++ b/Python/bhroBahroYeeshaCave.py @@ -0,0 +1,837 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: bhroBahroYeeshaCave.py +Age: BahroCave +Date: June 2003 +Author: Adam Van Ornum +Controls the bahro cave side of the bahro pole stuff +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import xEnum +import xRandom +from xPsnlVaultSDL import * +import copy + +# Max attributes +respTeledahnWedge = ptAttribResponder(1, "Tldn wedge resp") +respGarrisonWedge = ptAttribResponder(2, "Grsn wedge resp") +respGardenWedge = ptAttribResponder(3, "Grdn wedge resp") +respKadishWedge = ptAttribResponder(4, "Kdsh wedge resp") + +soTeledahnPoleCollider = ptAttribSceneobject(5, "Tldn pole collider") +soGarrisonPoleCollider = ptAttribSceneobject(6, "Grsn pole collider") +soGardenPoleCollider = ptAttribSceneobject(7, "Grdn pole collider") +soKadishPoleCollider = ptAttribSceneobject(8, "Kdsh pole collider") + +respTeledahnPoleRemove = ptAttribResponder(9, "Tldn remove pole resp", ["Remove", "PutBack", "Reject"]) +respGarrisonPoleRemove = ptAttribResponder(10, "Grsn remove pole resp", ["Remove", "PutBack", "Reject"]) +respGardenPoleRemove = ptAttribResponder(11, "Grdn remove pole resp", ["Remove", "PutBack", "Reject"]) +respKadishPoleRemove = ptAttribResponder(12, "Kdsh remove pole resp", ["Remove", "PutBack", "Reject"]) + +respTeledahnJCDisable = ptAttribResponder(13, "Tldn JC disable resp") +respGarrisonJCDisable = ptAttribResponder(14, "Grsn JC disable resp") +respGardenJCDisable = ptAttribResponder(15, "Grdn JC disable resp") +respKadishJCDisable = ptAttribResponder(16, "Kdsh JC disable resp") + +clickTeledahnJC = ptAttribActivator(17, "Tldn JC clickable") +clickGarrisonJC = ptAttribActivator(18, "Grsn JC clickable") +clickGardenJC = ptAttribActivator(19, "Grdn JC clickable") +clickKadishJC = ptAttribActivator(20, "Kdsh JC clickable") + +respTeledahnSolutionSymbols = ptAttribResponder(21, "Tldn solution symbols", ["0", "1", "2", "3", "4", "5", "6"]) +respGarrisonSolutionSymbols = ptAttribResponder(22, "Grsn solution symbols", ["0", "1", "2", "3", "4", "5", "6"]) +respGardenSolutionSymbols = ptAttribResponder(23, "Grdn solution symbols", ["0", "1", "2", "3", "4", "5", "6"]) +respKadishSolutionSymbols = ptAttribResponder(24, "Kdsh solution symbols", ["0", "1", "2", "3", "4", "5", "6"]) + +clickTeledahnYS = ptAttribActivator(25, "Tldn YS clickable") +clickGarrisonYS = ptAttribActivator(26, "Grsn YS clickable") +clickGardenYS = ptAttribActivator(27, "Grdn YS clickable") +clickKadishYS = ptAttribActivator(28, "Kdsh YS clickable") + +respTeledahnYS = ptAttribResponder(29, "Tldn yeesha speech") +respGarrisonYS = ptAttribResponder(30, "Grsn yeesha speech") +respGardenYS = ptAttribResponder(31, "Grdn yeesha speech") +respKadishYS = ptAttribResponder(32, "Kdsh yeesha speech") + +respTeledahnJCOneShot = ptAttribResponder(33, "Tldn JC one shot resp") +respGarrisonJCOneShot = ptAttribResponder(34, "Grsn JC one shot resp") +respGardenJCOneShot = ptAttribResponder(35, "Grdn JC one shot resp") +respKadishJCOneShot = ptAttribResponder(36, "Kdsh JC one shot resp") + +respTeledahnYSOneShot = ptAttribResponder(37, "Tldn YS one shot resp", ["trigger", "glowstart", "glowend"]) +respGarrisonYSOneShot = ptAttribResponder(38, "Grsn YS one shot resp", ["trigger", "glowstart", "glowend"]) +respGardenYSOneShot = ptAttribResponder(39, "Grdn YS one shot resp", ["trigger", "glowstart", "glowend"]) +respKadishYSOneShot = ptAttribResponder(40, "Kdsh YS one shot resp", ["trigger", "glowstart", "glowend"]) + +respSequentialYS = ptAttribResponder(41, "Sequential yeesha speeches", ["1a", "1b", "2a", "2b", "3a", "3b", "4a", "4b"]) + +rgnLinkOut = ptAttribActivator(42, "Link out region") +respLinkOut = ptAttribResponder(43, "Link out responder", ["starfield", "cavern"]) + +respStarCavern = ptAttribResponder(44, "Starfield/cavern vis", ["StarVis", "CavernVis"]) + +respKillSpeeches = ptAttribResponder(45, "Kill yeesha speeches", ["a", "age", "b"]) + +respBahroScream = ptAttribResponder(46, "Bahro scream") + +rgnCaveJump = ptAttribActivator(47, "Cave jump region") + +#globals +kWriteTimestamps = 8 + +# Bahro pole SDL variable states +# 0: Initial state, no pole, hydrant up, sheath up, clicking hand changes to state 1 +# Anim sheath down +# 1: No pole, hydrant up, sheath down, clicking hand causes full glow +# 2: After book has been used, No pole, hydrant up, sheath up, clicking hand causes progress glow +# 3: Animate the hydrant down and proceed to state 4 +# 4: All cloths have been found and pole was sent to psnl age, pole is there, hydrant down, clicking hand does nothing +# 5: Anim all hydrants up and proceed to state 6 +# 6: All poles in psnl age, pole is there, hydrant up, clicking hand plays full glow +# 7: Anim fissure stuff +# 8: Pole returned, no pole, hydrant up, clicking hand plays full glow +# 9: Selfish person unreturned pole, no pole, hydrant up, clicking hand plays full glow + + +class bhroBahroYeeshaCave(ptModifier): + "Bahro pole state control script" + def __init__(self): + ptModifier.__init__(self) + self.id = 5315 + self.version = 6 + PtDebugPrint("__init__bhroBahroYeeshaCave v. %d" % (self.version)) + self.ageFrom = "" + self.AgePlaying = "" + self.SpeechRespReset = 1 + self.IsStarfield = 1 + + + def OnFirstUpdate(self): + PtDebugPrint("DEBUG: bhroBahroYeeshaCave.OnFirstUpdate():\tEverything ok so far") + xRandom.seed() + xRandom.setmaxseries(1) + + self.currentYS = "zz" + PtSendKIMessage(kDisableYeeshaBook,0) + + vault = ptVault() + entry = vault.findChronicleEntry("BahroCave") + + if type(entry) == type(None): + PtDebugPrint("DEBUG: bhroBahroYeeshaCave.OnFirstUpdate: Did not find BahroCave chronicle...creating") + vault.addChronicleEntry("BahroCave",0,"0") + + self.varMap = {'YeeshaSymbolTouched': 0, 'SolutionSymbol': 1, 'YeeshaSpeech': 2} + + self.ageDict = { + 'Teledahn': { + 'State': 0, + 'WedgeAnim': respTeledahnWedge, + 'PoleCollider': soTeledahnPoleCollider, + 'JCDisable': respTeledahnJCDisable, + 'JCClickable': clickTeledahnJC, + 'SolutionSymbols': respTeledahnSolutionSymbols, + 'YSClickable': clickTeledahnYS, + 'YeeshaSpeech': respTeledahnYS, + 'PoleRemove': respTeledahnPoleRemove, + 'OneShotYS': respTeledahnYSOneShot, + 'OneShotJC': respTeledahnJCOneShot + }, + 'Garrison': { + 'State': 0, + 'WedgeAnim': respGarrisonWedge, + 'PoleCollider': soGarrisonPoleCollider, + 'JCDisable': respGarrisonJCDisable, + 'JCClickable': clickGarrisonJC, + 'SolutionSymbols': respGarrisonSolutionSymbols, + 'YSClickable': clickGarrisonYS, + 'YeeshaSpeech': respGarrisonYS, + 'PoleRemove': respGarrisonPoleRemove, + 'OneShotYS': respGarrisonYSOneShot, + 'OneShotJC': respGarrisonJCOneShot + }, + 'Garden': { + 'State': 0, + 'WedgeAnim': respGardenWedge, + 'PoleCollider': soGardenPoleCollider, + 'JCDisable': respGardenJCDisable, + 'JCClickable': clickGardenJC, + 'SolutionSymbols': respGardenSolutionSymbols, + 'YSClickable': clickGardenYS, + 'YeeshaSpeech': respGardenYS, + 'PoleRemove': respGardenPoleRemove, + 'OneShotYS': respGardenYSOneShot, + 'OneShotJC': respGardenJCOneShot + }, + 'Kadish': { + 'State': 0, + 'WedgeAnim': respKadishWedge, + 'PoleCollider': soKadishPoleCollider, + 'JCDisable': respKadishJCDisable, + 'JCClickable': clickKadishJC, + 'SolutionSymbols': respKadishSolutionSymbols, + 'YSClickable': clickKadishYS, + 'YeeshaSpeech': respKadishYS, + 'PoleRemove': respKadishPoleRemove, + 'OneShotYS': respKadishYSOneShot, + 'OneShotJC': respKadishJCOneShot + } + } + + + def OnServerInitComplete(self): + self.ageFrom = PtGetPrevAgeName() + if self.ageFrom == "": + self.ageFrom = "Garrison" + + PtDebugPrint("DEBUG: bhroBahroYeeshaCave.OnServerInitComplete():\tCame from: %s" % self.ageFrom) + + # check if a cleft yeesha imager solution has already been created, otherwise create it + if not self.CheckForSolution(): + PtDebugPrint("No solution found, attempting to create") + self.CreateSolution() + + self.UpdatePoleStates() + self.UpdateToState2() + + autostart = 0 + + # check and see if the yeesha speech variable has been set yet + self.UseYeeshaSpeech = self.GetAgeVariable(self.ageFrom, "YeeshaSpeech") + if self.UseYeeshaSpeech != None: + print "bhroBahroYeeshaCave.OnServerInitComplete(): useYeeshaSpeech = ",self.UseYeeshaSpeech + if int(self.UseYeeshaSpeech) == 0: + serieslen = self.GetNumYSSet() + #self.SetAgeVariable(self.ageFrom, "YeeshaSpeech", serieslen + 1) + self.UseYeeshaSpeech = serieslen + 1 + if self.GetAutoStartLevel() < self.UseYeeshaSpeech: + autostart = 1 + self.IncrementAutoStartLevel() + print "GetAutoStartLevel = ",self.GetAutoStartLevel() + else: + print "bhroBahroYeeshaCave.OnServerInitComplete(): useYeeshaSpeech = None" + + UseYS = self.UseYeeshaSpeech + print "bhroBahroYeeshaCave.OnServerInitComplete(): useYeeshaSpeech = ",UseYS + print "bhroBahroYeeshaCave.OnServerInitComplete(): autostart = ",autostart + + journeyComplete = 0 + #vault = ptVault() + #jcNode = vault.findChronicleEntry("JourneyClothProgress") + #if jcNode.chronicleGetValue() == "Z": + + sdl = xPsnlVaultSDL() + if sdl["CleftVisited"][0]: + journeyComplete = 1 + + # process stuff for each age + starCavernRun = 0 + agelist = ["Teledahn", "Garrison", "Garden", "Kadish"] + for age in agelist: + currentState = self.ageDict[age]['State'] + PtDebugPrint("Current state: %d" % currentState) + + # if the age is not the one that I'm from then run the responder to make it back off + if age != self.ageFrom and currentState < 8: + self.ageDict[age]['WedgeAnim'].run(self.key, fastforward=1) + + if not starCavernRun and currentState > 5: + respStarCavern.run(self.key, state = "CavernVis", fastforward = 1) + starCavernRun = 1 + self.IsStarfield = 0 + + # check the current state to see if the pole is here or not + if currentState in (4, 5, 6, 9): + self.DisablePole(age, 1) + + # check the current state to see if the journey symbol should show up or not + if currentState == 4 or (currentState > 6 and not journeyComplete): + self.ageDict[age]['JCDisable'].run(self.key,fastforward=1) + + # display the appropriate solution symbol + val = self.GetAgeVariable(age, "SolutionSymbol") + self.ageDict[age]['SolutionSymbols'].run(self.key, state=val, fastforward=1) + + if not starCavernRun: + respStarCavern.run(self.key, state = "StarVis", fastforward = 1) + + if autostart: + PtAtTimeCallback(self.key, 3, 1) + + #def OnSDLNotify(self,VARname,SDLname,playerID,tag): + # PtDebugPrint("DEBUG: bhroBahroYeeshaCave.OnSDLNotify():\tEverything ok so far") + # pass + + + def OnNotify(self,state,id,events): + PtDebugPrint("DEBUG: bhroBahroYeeshaCave.OnNotify():\tid = %d" % id) + + if not state: + return + + # Notify from JC click + if id == clickTeledahnJC.id: + self.JCClickHandle("Teledahn") + + elif id == clickGarrisonJC.id: + self.JCClickHandle("Garrison") + + elif id == clickGardenJC.id: + self.JCClickHandle("Garden") + + elif id == clickKadishJC.id: + self.JCClickHandle("Kadish") + + # Notify from YS click + if id == clickTeledahnYS.id: + self.YSClickHandle("Teledahn") + + elif id == clickGarrisonYS.id: + self.YSClickHandle("Garrison") + + elif id == clickGardenYS.id: + self.YSClickHandle("Garden") + + elif id == clickKadishYS.id: + self.YSClickHandle("Kadish") + + # Notify from journey symbol oneshot + elif id == respTeledahnJCOneShot.id: + self.PostJCOneShot("Teledahn") + + elif id == respGarrisonJCOneShot.id: + self.PostJCOneShot("Garrison") + + elif id == respGardenJCOneShot.id: + self.PostJCOneShot("Garden") + + elif id == respKadishJCOneShot.id: + self.PostJCOneShot("Kadish") + + # Notify from yeesha symbol oneshot + elif id == respTeledahnYSOneShot.id: + self.PostYSOneShot("Teledahn") + + elif id == respGarrisonYSOneShot.id: + self.PostYSOneShot("Garrison") + + elif id == respGardenYSOneShot.id: + self.PostYSOneShot("Garden") + + elif id == respKadishYSOneShot.id: + self.PostYSOneShot("Kadish") + + # notify from yeesha speech + elif id == respTeledahnYS.id: + self.SpeechRespReset = 1 + self.PlayYeeshaSpeech("Teledahn") + + elif id == respGarrisonYS.id: + self.SpeechRespReset = 1 + self.PlayYeeshaSpeech("Garrison") + + elif id == respGardenYS.id: + self.SpeechRespReset = 1 + self.PlayYeeshaSpeech("Garden") + + elif id == respKadishYS.id: + self.SpeechRespReset = 1 + self.PlayYeeshaSpeech("Kadish") + + # notify from sequential speech series + elif id == respSequentialYS.id: + self.SpeechRespReset = 1 + self.PlayYeeshaSpeech(self.ageFrom) + + # notify hitting link region + elif id == rgnLinkOut.id: + self.LinkOut() + #self.DoWedge() + + # notify from pole finished going away or coming back + elif id == respTeledahnPoleRemove.id: + self.PostPoleRemove("Teledahn") + + elif id == respGarrisonPoleRemove.id: + self.PostPoleRemove("Garrison") + + elif id == respGardenPoleRemove.id: + self.PostPoleRemove("Garden") + + elif id == respKadishPoleRemove.id: + self.PostPoleRemove("Kadish") + + # notify from cave jump force 3rd person region + elif id == rgnCaveJump.id: + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + print "undid first person and disabled override" + + + def OnTimer(self, id): + PtDebugPrint("DEBUG: bhroBahroYeeshaCave.OnTimer():\tid = %d" % id) + if id == 1: + self.PostYSOneShot(self.ageFrom, 1) + + elif id == 2: + cam = ptCamera() + cam.enableFirstPersonOverride() + + + def UpdatePoleStates(self): + psnlSDL = xPsnlVaultSDL() + + sdllist = psnlSDL.BatchGet( ["TeledahnPoleState", "GardenPoleState", "GarrisonPoleState", "KadishPoleState"] ) + for var in ["Teledahn", "Garrison", "Garden", "Kadish"]: + self.ageDict[var]['State'] = sdllist[var + "PoleState"] + + + def SetState(self, age, state): + if type(state) == type(0): + #PtDebugPrint("Setting %s state to %d" % (age, state)) + psnlSDL = xPsnlVaultSDL() + + psnlSDL[age + "PoleState"] = (state,) + + + def GetAgeNode(self, age): + vault = ptVault() + + chron = vault.findChronicleEntry("BahroCave") + ageChronRefList = chron.getChildNodeRefList() + + for ageChron in ageChronRefList: + ageChild = ageChron.getChild() + + ageChild = ageChild.upcastToChronicleNode() + + if ageChild.chronicleGetName() == age: + return ageChild + + return None + + + def GetAgeVariable(self, age, variable): + node = self.GetAgeNode(age) + + if node != None: + varlist = node.chronicleGetValue().split(",") + return varlist[ self.varMap[variable] ] + else: + return None + + + def SetAgeVariable(self, age, variable, value): + node = self.GetAgeNode(age) + + if node != None: + varlist = node.chronicleGetValue().split(",") + while len(varlist) < len(self.varMap): + varlist.append("0") + varlist[ self.varMap[variable] ] = str(value) + varstr = "" + for var in range(len(varlist) - 1): + varstr += (varlist[var] + ",") + varstr += varlist[-1] + + node.chronicleSetValue(varstr) + node.save() + else: + raise "Could not find chronicle variable to set" + + + def AreListsEquiv(self, list1, list2): + if list1[0] in list2 and len(list1) == len(list2): + # rearrange list + list2Copy = copy.copy(list2) + while list2Copy[0] != list1[0]: + list2Copy.append(list2Copy.pop(0)) + + # check if all values match up now + for i in range(4): + if list2Copy[i] != list1[i]: + return false + + return true + + return false + + + def CheckForSolution(self): + var = self.GetAgeVariable("Teledahn", "SolutionSymbol") + + if var != None: + return 1 + else: + return 0 + + + def CreateSolution(self): + #~ solutionlist = [4,3,6,1] + #~ cleftSolList = [4,3,6,1] + + solutionlist = [3,2,5,0] + cleftSolList = [3,2,5,0] + + while self.AreListsEquiv(solutionlist, cleftSolList): + solutionlist = [] + while len(solutionlist) < 4: + newint = xRandom.randint(0,6) + if not newint in solutionlist: + solutionlist.append(newint) + + vault = ptVault() + entry = vault.findChronicleEntry("BahroCave") + if entry != None: + agelist = ["Teledahn", "Garden", "Garrison", "Kadish"] + for v in range(len(agelist)): + newnode = ptVaultChronicleNode(0) + newnode.chronicleSetName(agelist[v]) + newnode.chronicleSetValue("0," + str(solutionlist[v]) + ",0") + entry.addNode(newnode) + + + def DisablePole(self, age, fforward = 0): + #PtDebugPrint("Disableing %s pole" % age) + self.ageDict[age]['PoleRemove'].run(self.key, state="Remove", fastforward=fforward) + self.ageDict[age]['PoleCollider'].value.physics.suppress(1) + if not fforward: + vault = ptVault() + if type(vault) != type(None): #is the Vault online? + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + ypageSDL = psnlSDL.findVar("YeeshaPage25") + if ypageSDL: + size, state = divmod(ypageSDL.getInt(), 10) + print "YeeshaPage25 = ",state + if state == 1: + print "bhroBahroYeeshaCave.DisablePole(): sending the pole and YeeshaPage25 is on! will do the age's wedge..." + self.DoWedge() + + + def EnablePole(self, age, fforward = 0): + self.ageDict[age]['PoleRemove'].run(self.key, state="PutBack", fastforward=fforward) + self.ageDict[age]['PoleCollider'].value.physics.suppress(0) + + + def JCClickHandle(self, age): + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + PtAtTimeCallback(self.key, 5, 2) + + avatar = PtGetLocalAvatar() + self.ageDict[age]['OneShotJC'].run(self.key, avatar = avatar) + + + def YSClickHandle(self, age): + avatar = PtGetLocalAvatar() + self.ageDict[age]['OneShotYS'].run(self.key, avatar = avatar, state = "trigger") + + + def PostPoleRemove(self, age): + self.ageDict[age]['JCClickable'].enable() + + + def PostJCOneShot(self, age): + vault = ptVault() + if type(vault) != type(None): #is the Vault online? + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + ypageSDL = psnlSDL.findVar("YeeshaPage25") + if ypageSDL: + size, state = divmod(ypageSDL.getInt(), 10) + print "YeeshaPage25 = ",state + if state != 1: + print "bhroBahroYeeshaCave.PostJCOneShot(): can't send pole to Relto, YeeshaPage25 is off! Returning the pole..." + self.ageDict[age]['JCClickable'].disable() + self.ageDict[age]['PoleRemove'].run(self.key, state="Reject") + return + + self.UpdatePoleStates() + + state = self.ageDict[age]['State'] + + PtDebugPrint("Current %s state: %d" % (age, state)) + self.ageDict[age]['JCClickable'].disable() + + if state == 2: + self.DisablePole(age) + self.SetState(age, 3) + elif state == 3: + self.EnablePole(age) + self.SetState(age, 2) + elif state == 6: + self.EnablePole(age) + self.SetState(age, 7) + elif state == 7: + self.DisablePole(age) + self.SetState(age, 6) + elif state == 8: + polesInPsnl = 1 + for tage in ["Teledahn", "Garrison", "Garden", "Kadish"]: + if self.ageDict[tage]['State'] == 9: + polesInPsnl += 1 + if polesInPsnl == 1: + print "Playing Bahro Cave bahro scream" + respBahroScream.run(self.key) + self.DisablePole(age) + self.SetState(age, 9) + elif state == 9: + self.EnablePole(age) + self.SetState(age, 8) + + + def PostYSOneShot(self, age, autotriggered = 0): + if self.AgePlaying != age: + self.ageDict[age]['OneShotYS'].run(self.key, state = "glowstart") + + prevage = self.AgePlaying + self.AgePlaying = age + + if self.currentYS != "zz": + PtDebugPrint("Killing speech %s" % self.currentYS) + respKillSpeeches.run(self.key, state=self.currentYS) + self.currentYS = "zz" + self.ageDict[prevage]["OneShotYS"].run(self.key, state = "glowend") + if prevage == age: + self.AgePlaying = "" + return + + if not int(self.GetAgeVariable(age, "YeeshaSymbolTouched")) and not autotriggered: + PtDebugPrint("DEBUG: bhroBahroYeeshaCave.PostYSOneShot:\tFirst time touching the symbol") + self.SetAgeVariable(age, "YeeshaSymbolTouched", 1) + + self.PlayYeeshaSpeech(age) + + + def PlayYeeshaSpeech(self, age): + + if not self.SpeechRespReset or self.AgePlaying == "": + return + + if age != self.AgePlaying: + age = self.AgePlaying + + speech = self.GetAgeVariable(age, "YeeshaSpeech") + if int(speech) == 0: + speech = str(self.UseYeeshaSpeech) + + if self.currentYS == "a": + self.currentYS = "age" + + elif self.currentYS == "age": + self.currentYS = "b" + + elif self.currentYS == "b": + self.currentYS = "zz" + self.AgePlaying = "" + + else: + self.currentYS = "a" + + if self.currentYS == "age": + print "playing 'age' YeeshaSpeech for: ",age + self.ageDict[age]["YeeshaSpeech"].run(self.key) + self.SpeechRespReset = 0 + elif self.currentYS != "zz": + print "playing 'sequential' YeeshaSpeech..." + print "speech = ",speech + print "self.currentYS = ",self.currentYS + state = speech + self.currentYS + print "state = ",state + respSequentialYS.run(self.key, state) + self.SpeechRespReset = 0 + else: + self.ageDict[age]["OneShotYS"].run(self.key, state = "glowend") + + + def GetNumYSSet(self): + num = 0 + for age in ["Teledahn", "Garrison", "Garden", "Kadish"]: + if int(self.GetAgeVariable(age, "YeeshaSpeech")): + num += 1 + + return num + + + def LinkOut(self): + polesInPsnl = 0 + updateAgeList = [] + + psnlSDL = xPsnlVaultSDL() + + for age in ["Teledahn", "Garrison", "Garden", "Kadish"]: + agevar = age + "PoleState" + sdlval = psnlSDL[agevar][0] + if sdlval == 4 and age != self.ageFrom: + polesInPsnl += 1 + updateAgeList.append( (agevar, (5,)) ) + elif sdlval == 3 and age == self.ageFrom: + if int(self.GetAgeVariable(self.ageFrom, "YeeshaSpeech")) == 0: + self.SetAgeVariable(self.ageFrom, "YeeshaSpeech", self.UseYeeshaSpeech) + + if polesInPsnl == 3 and psnlSDL[self.ageFrom + "PoleState"][0] == 3: + psnlSDL.BatchSet(updateAgeList) + #for age in updateAgeList: + # self.SetState(age, 5) + + #PtSendKIMessage(kEnableYeeshaBook,0) + + if self.IsStarfield: + respLinkOut.run(self.key, state = "starfield") + else: + respLinkOut.run(self.key, state = "cavern") + + + def DoWedge(self): + psnlSDL = xPsnlVaultSDL() + + if self.ageFrom == "Garrison": + sdlName = "psnlBahroWedge01" + elif self.ageFrom == "Garden": + sdlName = "psnlBahroWedge02" + elif self.ageFrom == "Kadish": + sdlName = "psnlBahroWedge03" + elif self.ageFrom == "Teledahn": + sdlName = "psnlBahroWedge04" + else: + print "bhroBahroYeeshaCave.DoWedge(): ERROR. Didn't recognize previous age name, no wedge will be set" + return + + sdlVal = psnlSDL[sdlName][0] + if not sdlVal: + print "bhroBahroYeeshaCave.DoWedge(): previous age was %s, turning wedge SDL of %s to On" % (self.ageFrom,sdlName) + psnlSDL[sdlName] = (1,) + + + def SetCurrentState(self, age, state): + ageSDL = xPsnlVaultSDL() + ageSDL[age + "PoleState"] = (state, ) + + + def UpdateToState2(self): + vault = ptVault() + myAges = vault.getAgesIOwnFolder() + myAges = myAges.getChildNodeRefList() + for ageInfo in myAges: + link = ageInfo.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + spawnPoints = link.getSpawnPoints() + + if ageName == "Gira": + ageName = "Garden" + + if ageName == "Teledahn" or ageName == "Garrison" or ageName == "Garden" or ageName == "Kadish": + for spawnPoint in spawnPoints: + if spawnPoint.getName() == "LinkInPointDefault": + if self.ageDict[ageName]["State"] == 1: + self.SetCurrentState(ageName, 2) + break + self.UpdatePoleStates() + + + def GetAutoStartLevel(self): + print "bhroBahroYeeshaCave.GetAutoStartLevel()" + vault = ptVault() + bc = vault.findChronicleEntry("BahroCave") + if type(bc) != type(None): + val = bc.chronicleGetValue() + if val == "": + return 0 + else: + return int(val) + else: + return 0 + + + def IncrementAutoStartLevel(self): + vault = ptVault() + bc = vault.findChronicleEntry("BahroCave") + if type(bc) != type(None): + val = bc.chronicleGetValue() + if val == "": + val = 0 + else: + val = int(val) + bc.chronicleSetValue(str(val + 1)) + bc.save() + print "bhroBahroYeeshaCave.IncrementAutoStartLevel(): setting BC chron = ",str(val + 1) + else: + print "bhroBahroYeeshaCave.IncrementAutoStartLevel(): no BC chron found" + + + def OnBackdoorMsg(self, target, param): + if target == "kill": + respKillSpeeches.run(self.key, state = param) + self.currentYS = "b" + + elif target == "wedgetoggle": + vault = ptVault() + myAges = vault.getAgesIOwnFolder() + myAges = myAges.getChildNodeRefList() + for ageInfo in myAges: + link = ageInfo.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + if ageName == "Personal": + psnlSDL = xPsnlVaultSDL(1) + else: + psnlSDL = xPsnlVaultSDL(0) + + if param == "Garrison": + sdlName = "psnlBahroWedge01" + elif (param == "Garden") or (param == "Gira"): + param = "Garden" + sdlName = "psnlBahroWedge02" + elif param == "Kadish": + sdlName = "psnlBahroWedge03" + elif param == "Teledahn": + sdlName = "psnlBahroWedge04" + else: + print "bhroBahroYeeshaCave.OnBackdoorMsg(): ERROR. Incorrect age specified, no wedge will be set" + return + + sdlVal = psnlSDL[sdlName][0] + if sdlVal: + print "bhroBahroYeeshaCave.OnBackdoorMsg(): previous age was %s, turning wedge SDL of %s to OFF" % (param,sdlName) + psnlSDL[sdlName] = (0,) + else: + print "bhroBahroYeeshaCave.OnBackdoorMsg(): previous age was %s, turning wedge SDL of %s to ON" % (param,sdlName) + psnlSDL[sdlName] = (1,) + diff --git a/Python/bhroStarfieldOrCavern.py b/Python/bhroStarfieldOrCavern.py new file mode 100644 index 0000000000..feed6f3193 --- /dev/null +++ b/Python/bhroStarfieldOrCavern.py @@ -0,0 +1,73 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: bhroStarfieldOrCavern.py +Age: BahroCave +Date: August 2003 +Author: Adam Van Ornum +Controls whether the starfield or the cavern shows up +""" + +from Plasma import * +from PlasmaTypes import * +from xPsnlVaultSDL import * + +boolCavernObj = ptAttribBoolean(1, "Cavern object", 0) + +class bhroStarfieldOrCavern(ptMultiModifier): + + def __init__(self): + ptModifier.__init__(self) + self.id = 5318 + self.version = 1 + PtDebugPrint("__init__bhroStarfieldOrCavern v. %d" % (self.version)) + + def OnServerInitComplete(self): + sdl = xPsnlVaultSDL() + + if sdl["TeledahnPoleState"][0] > 5 or sdl["KadishPoleState"][0] > 5 or sdl["GardenPoleState"][0] > 5 or sdl["GarrisonPoleState"][0] > 5: + # we want to draw the cavern + if boolCavernObj.value: + #self.EnableObject() + pass + else: + self.DisableObject() + else: + # we want to draw the starfield + if boolCavernObj.value: + self.DisableObject() + else: + #self.EnableObject() + pass + + def EnableObject(self): + self.sceneobject.draw.enable() + self.sceneobject.physics.suppress(false) + + def DisableObject(self): + self.sceneobject.draw.disable() + self.sceneobject.physics.suppress(true) + self.sceneobject.particle.setParticlesPerSecond(0) diff --git a/Python/city.py b/Python/city.py new file mode 100644 index 0000000000..6fc75f8994 --- /dev/null +++ b/Python/city.py @@ -0,0 +1,208 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: City.py +Age: City +Date: October 2002 +event manager hooks for the City +""" + +from Plasma import * +from PlasmaTypes import * + +IsPublic = 0 +IsKadishGallery = 0 + +sdlS1FinaleBahro = [ "islmS1FinaleBahro","islmS1FinaleBahroCity1","islmS1FinaleBahroCity2",\ + "islmS1FinaleBahroCity3","islmS1FinaleBahroCity4","islmS1FinaleBahroCity5",\ + "islmS1FinaleBahroCity6"] +pagesS1FinaleBahro = [ "bahroFlyers_arch","bahroFlyers_city1","bahroFlyers_city2",\ + "bahroFlyers_city3","bahroFlyers_city4","bahroFlyers_city5",\ + "bahroFlyers_city6"] +#S1FinaleBahro = [] + + +class city(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5026 + self.version = 1 + + global IsPublic + global IsKadishGallery + + parentname = None + + try: + agevault = ptAgeVault() + ageinfo = agevault.getAgeInfo() + parent = ageinfo.getParentAgeLink() + parentinfo = parent.getAgeInfo() + parentname = parentinfo.getAgeFilename() + except: + pass + + if parentname == "Neighborhood": + IsPublic = 1 + print "city.__init__(): city version = public" + else: + print "city.__init__(): city version = Yeesha" + + if not IsPublic: + pass + #return + + try: + linkmgr = ptNetLinkingMgr() + link = linkmgr.getCurrAgeLink() + spawnPoint = link.getSpawnPoint() + spTitle = spawnPoint.getTitle() + spName = spawnPoint.getName() + except: + spTitle = "title unknown" + spName = "spawn point unknown" + + print "city.__init__(): spTitle = ",spTitle + print "city.__init__(): spName = ",spName + + ## NOT USING THIS FOR NOW - MAY NEED TO LOAD IN SPECIFIC PAGE(S) FOR FUTURE CITY AREAS... +# if spTitle == "KadishGallery": +# print "city.__init__(): we're linking into KadishGallery, only that page will be loaded" +# IsKadishGallery = 1 +# else: +# print "city.__init__(): we're NOT linking into KadishGallery, will load the entire city" + + pages = [] + + # Add the common pages + ## actually, we'll just set these to load automatically in the .age file + #pages += ["KadishGallery""] + + # For the non-public age, add all the remaining pages + if not IsKadishGallery: + pages += ["canyon","cavetjunction","courtyard","ferry","greatstair","guildhall","harbor","HarborReflect"] + pages += ["islmGreatZeroState","islmJCNote","islmNegilahnCreatureChartGUI","islmNickNote","islmPodMapGUI"] + pages += ["islmWatsonLetterGUI","KahloPub","kahlopubtunnel","library","LibraryInterior"] + pages += ["MuseumInteriorPage","palace","trailerCamPage"] + pages += ["islmBahroShoutFerry","islmBahroShoutLibrary","islmBahroShoutPalace"] + #pages += ["islmDRCStageState01","islmDRCStageState02","islmDRCTentTablePic","islmFanSoundRun"] + #pages += ["islmLibBanners00Vis","islmLibBanners02Vis","islmLibBanners03Vis"] + #pages += ["LibraryAhnonayVis","LibraryErcanaVis","LibraryGarrisonVis","LibraryKadishVis","LibraryTeledahnVis"] + + PtPageInNode(pages) + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): +# if not self.sceneobject.isLocallyOwned(): +# return + try: + ageSDL = PtGetAgeSDL() + n = 0 + for sdl in sdlS1FinaleBahro: + ageSDL.setFlags(sdl,1,1) + ageSDL.sendToClients(sdl) + ageSDL.setNotify(self.key,sdl,0.0) + val = ageSDL[sdl][0] + if val: + self.ILoadS1FinaleBahro(n,1) + n += 1 + except: + print "ERROR! Couldn't find all Bahro sdl, leaving default = 0" + +# ageSDL = PtGetAgeSDL() +# +# ageSDL.setFlags("islmKadishGalleryDoorVis",1,1) +# ageSDL.sendToClients("islmKadishGalleryDoorVis") +# ageSDL.setNotify(self.key,"islmKadishGalleryDoorVis",0.0) +# +# boolDoorVis = ageSDL["islmKadishGalleryDoorVis"][0] +# if boolDoorVis and not IsKadishGallery: +# ageSDL["islmKadishGalleryDoorVis"] = (0,) +# elif not boolDoorVis and IsKadishGallery: +# ageSDL["islmKadishGalleryDoorVis"] = (1,) + + + def Load(self): + pass + + + def OnNotify(self,state,id,events): + pass + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + ageSDL = PtGetAgeSDL() + PtDebugPrint("city.OnSDLNotify():\t VARname: %s, SDLname: %s, tag: %s, value: %d" % (VARname,SDLname,tag,ageSDL[VARname][0])) + + if VARname in sdlS1FinaleBahro: +# if not self.sceneobject.isLocallyOwned(): +# return + id = sdlS1FinaleBahro.index(VARname) + val = ageSDL[sdlS1FinaleBahro[id]][0] + self.ILoadS1FinaleBahro(id,val) + + + def ILoadS1FinaleBahro(self,bahro,state): + print "city.ILoadS1FinaleBahro(): bahro = %d, load = %d" % (bahro,state) +# if not self.sceneobject.isLocallyOwned(): +# return + if state: + PtPageInNode(pagesS1FinaleBahro[bahro]) + else: + PtPageOutNode(pagesS1FinaleBahro[bahro]) + + + def OnBackdoorMsg(self, target, param): + if target == "kadishgallerydoors": + ageSDL = PtGetAgeSDL() + ageSDL.setFlags("islmKadishGalleryDoorVis",1,1) + ageSDL.sendToClients("islmKadishGalleryDoorVis") + ageSDL.setNotify(self.key,"islmKadishGalleryDoorVis",0.0) + tmpdoors = ageSDL["islmKadishGalleryDoorVis"][0] + if param == "on" or param == "1": + if not tmpdoors: + ageSDL["islmKadishGalleryDoorVis"] = (1,) + elif param == "off" or param == "0": + if tmpdoors: + ageSDL["islmKadishGalleryDoorVis"] = (0,) + elif target == "s1finale": + if param == "on" or param == "1": + n = 0 + for p in pagesS1FinaleBahro: + self.ILoadS1FinaleBahro(n,1) + n += 1 + elif param == "off" or param == "0": + n = 0 + for p in pagesS1FinaleBahro: + self.ILoadS1FinaleBahro(n,0) + n += 1 + + diff --git a/Python/clftEndingCredits.py b/Python/clftEndingCredits.py new file mode 100644 index 0000000000..387b58755c --- /dev/null +++ b/Python/clftEndingCredits.py @@ -0,0 +1,236 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: clftEndingCredits.py +Age: Cleft(Tomahna) +Date: September 2003 +Do credits at endgame +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * +from PlasmaKITypes import * +import time +import copy +import PlasmaControlKeys +import xJournalBookDefs + + +respStartCreditsMusic = ptAttribResponder(1,"Resp: Start Credits Music") +respStopCreditsMusic = ptAttribResponder(2,"Resp: Stop Credits Music") +respLeaveCredits = ptAttribResponder(3,"Resp: Exit Credits Cam") +RgnSnsrSndLogTracks = ptAttribActivator(4, "Rgn snsr: SndLogTracks scope") +ClkSndLogTracks = ptAttribActivator(5, "Clickable: SndLogTracks scope") +RespSndLogTracks = ptAttribResponder(6,"Resp: SndLogTracks scope") + + +#globals +gJournalBook = None +gOriginalAmbientVolume = 1.0 +gOriginalSFXVolume = 1.0 +AlreadyClosed = false + +#timer IDs +kFadeOutToCreditsID = 1 +kShowCreditsID = 2 +kFadeInToCreditsID = 3 +kFadeOutToGameID = 4 +kHideBookID = 5 +kFadeInToGameID = 6 + +#Timer delay values +kDelayFadeSeconds = 1.5 +kFadeOutToCreditsSeconds = 2.0 +kFadeInToCreditsSeconds = 1.0 +kFadeOutToGameSeconds = 1.0 +kFadeInToGameSeconds = 2.0 + +class clftEndingCredits(ptResponder): + + + def __init__(self): + ptResponder.__init__(self) + self.id = 8802 + version = 5 + self.version = version + print "__init__ clftEndingCredits v. ",version,".1" + + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + SDLVarSceneBahro = "clftSceneBahroUnseen" + ageSDL.setNotify(self.key,SDLVarSceneBahro,0.0) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global gJournalBook + + ageSDL = PtGetAgeSDL() + + SDLVarSceneBahro = "clftSceneBahroUnseen" + if VARname == SDLVarSceneBahro: + print "OnSDL launched the credits." + boolSceneBahro = ageSDL[SDLVarSceneBahro][0] + if boolSceneBahro == 0: + print "clftEndingCredits.OnSDLNotify(): we're no longer showing the credits here" + cam = ptCamera() + cam.enableFirstPersonOverride() + PtEnableMovementKeys() + PtSendKIMessage(kEnableKIandBB,0) +# print "\tclftEndingCredits.OnSDLNotify: loading journal" +# params = xJournalBookDefs.xJournalBooks["UruCredits"] +# if len(params) == 4: +# width,height,locPath,gui = params +# else: +# width,height,locPath = params +# gui = "BkBook" +# gJournalBook = ptBook(PtGetLocalizedString(locPath),self.key) +# gJournalBook.setSize(width,height) +# gJournalBook.setGUI(gui) +# +# #PtFadeOut(kDelayFadeSeconds,1) +# PtDisableMovementKeys() +# PtAtTimeCallback(self.key,kDelayFadeSeconds,kFadeOutToCreditsID) + else: + print "No credits." + + pass + + + def OnNotify(self,state,id,events): + global AlreadyClosed + + if (id == RgnSnsrSndLogTracks.id and state): + import xSndLogTracks + if xSndLogTracks.IsLogMode(): + print "Start of Egg!!! Enable Riven scope clickable" + ClkSndLogTracks.enable() + else: + print "not this time" + ClkSndLogTracks.disable() + + if (id == ClkSndLogTracks.id and state): + #PtPageInNode("clftSndLogTracks") + RespSndLogTracks.run(self.key,avatar=PtGetLocalAvatar()) + + + if AlreadyClosed: + print "failed AlreadyClosed check" + return + + for event in events: + if event[0] == PtEventType.kBook: + if event[1] == PtBookEventTypes.kNotifyHide: + AlreadyClosed = true + PtFadeOut(kFadeOutToGameSeconds,1) + print "clftEndingCredits.OnNotify(): Book hidden. FadeOut over", kFadeOutToGameSeconds," seconds" + + #The book is already hidden, so just go ahead and fade back in on the game + PtAtTimeCallback(self.key,kFadeOutToGameSeconds,kFadeOutToGameID) + + elif event[1] == PtBookEventTypes.kNotifyClose: + AlreadyClosed = true + PtFadeOut(kFadeOutToGameSeconds,1) + print "clftEndingCredits.OnNotify(): Book closed. FadeOut over", kFadeOutToGameSeconds," seconds" + + #We have to hide the book first before we fade back in on the game + PtAtTimeCallback(self.key,kFadeOutToGameSeconds+1,kHideBookID) + + + def OnTimer(self,id): + + global gJournalBook + print "clftEndingCredits.OnTimer(): Callback from id:",id + if id == kFadeOutToCreditsID: # 1 + self.IFadeOutToCredits() + elif id == kShowCreditsID: # 2 + self.IShowCredits() + elif id == kFadeInToCreditsID: # 3 + self.IFadeInToCredits() + elif id == kFadeOutToGameID: # 4 + self.IFadeOutToGame() + elif id == kHideBookID: # 5 + print "clftEndingCredits.OnTimer(): The credits book is now hidden" + gJournalBook.hide() + PtAtTimeCallback(self.key,kFadeOutToGameSeconds,kFadeOutToGameID) + + elif id == kFadeInToGameID: # 6 + PtFadeIn(kFadeInToGameSeconds,1) + print "clftEndingCredits.OnTimer(): FadeIn over", kFadeInToGameSeconds," seconds" + cam = ptCamera() + cam.enableFirstPersonOverride() + PtEnableMovementKeys() + PtSendKIMessage(kEnableKIandBB,0) + + + def IFadeOutToCredits(self): + PtFadeOut(kFadeOutToCreditsSeconds,1) + print "clftEndingCredits.IFadeOutToCredits(): FadeOut over", kFadeOutToCreditsSeconds," seconds." + PtAtTimeCallback(self.key,4,kShowCreditsID) + + + def IShowCredits(self): + global gJournalBook + global AlreadyClosed + + print "clftEndingCredits.IShowCredits(): Showing Journal now." + gJournalBook.show(0) + AlreadyClosed = false + PtAtTimeCallback(self.key,1,kFadeInToCreditsID) + + + def IFadeInToCredits(self): + global gJournalBook + global gOriginalAmbientVolume + global gOriginalSFXVolume + + # turn down the ambient sound + audio = ptAudioControl() + gOriginalAmbientVolume = audio.getAmbienceVolume() + audio.setAmbienceVolume(0.0) + gOriginalSFXVolume = audio.getSoundFXVolume() + audio.setSoundFXVolume(0.0) + + respStartCreditsMusic.run(self.key) + + PtFadeIn(kFadeInToCreditsSeconds,1) + print "clftEndingCredits.IFadeInToCredits(): FadeIn over", kFadeInToCreditsSeconds," seconds" + + + def IFadeOutToGame(self): + global gOriginalAmbientVolume + global gOriginalSFXVolume + + # restore the ambient sounds + audio = ptAudioControl() + audio.setAmbienceVolume(gOriginalAmbientVolume) + audio.setSoundFXVolume(gOriginalSFXVolume) + + respStopCreditsMusic.run(self.key) + + respLeaveCredits.run(self.key,avatar=PtGetLocalAvatar()) + PtAtTimeCallback(self.key,kFadeInToGameSeconds,kFadeInToGameID) diff --git a/Python/clftGetPersonalBook.py b/Python/clftGetPersonalBook.py new file mode 100644 index 0000000000..ae215771d1 --- /dev/null +++ b/Python/clftGetPersonalBook.py @@ -0,0 +1,241 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: clftGetPersonalBook +Age: Cleft +Date: October 2002 +Author: Doug McBride +Displays Player Book GUI +Plays appropriate book animation, based on player's gender +Sets Chronical Entry to ensure that players who have "solved" the cleft can't return. +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import xLinkingBookDefs +import os + + +# define the attributes that will be entered in max +actClickableBook = ptAttribActivator(1, "Clickable to link") +SmartSeek = ptAttribBehavior(2, "Smart Seek Before GUI") +MultiBeh = ptAttribBehavior(3, "MultiBeh of avatar getting book") +BookAnimMale = ptAttribAnimation(4, "Book Animation - Male Height") +BookAnimFemale = ptAttribAnimation(5, "Book Animation - Female Height") +respLinkResponder = ptAttribResponder(6, "Linking responder") +respLinkOutNew = ptAttribResponder(7, "resp: new linkout") + + +# global variables +LocalAvatar = None +YeeshaBook = None +gDemoMovie = None +kDemoMovieName = "avi/UruPreview.bik" +gWasMuted = 0 +gAreWeLinkingOut = 0 + +kLinkRespID = 7 +kTrailerFadeInID = 5 +kTrailerInSeconds = 1.0 +kTrailerFadeOutID = 3 +kTrailerFadeOutSeconds = 1.0 +kTrailerDoneID = 9 + + +class clftGetPersonalBook(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5219 + self.version = 10 + PtDebugPrint("__init__clftGetPersonalBook v%d.%d" % (self.version,2),level=kWarningLevel) + + def OnFirstUpdate(self): + pass + #~ vault = ptVault() + #~ entry = vault.findChronicleEntry("JourneyClothProgress") + #~ if type(entry) != type(None): + #~ FoundJCs = entry.chronicleGetValue() + #~ if "Z" in FoundJCs: + #~ PtPageOutNode("clftYeeshaBookVis") + #~ PtDebugPrint("clftGetPersonalBook: Paging out the Yeesha Book in the bookroom",level=kDebugDumpLevel) + + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + ageSDL.setNotify(self.key,"clftIsCleftDone",0.0) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname == "clftIsCleftDone": + ageSDL = PtGetAgeSDL() + boolCleftDone = ageSDL["clftIsCleftDone"][0] + if boolCleftDone: + respLinkOutNew.run(self.key,avatar=PtGetLocalAvatar()) + + + def OnNotify(self,state,id,events): + global LocalAvatar + global YeeshaBook + global gAreWeLinkingOut + + # is it from an unknown id? Probably from the ptBook + if id < 0: + for event in events: + # is it from the YeeshaBook? (we only have one book to worry about) + if event[0] == PtEventType.kBook: + PtDebugPrint("clftGetPersonalBook: BookNotify event=%d, id=%d" % (event[1],event[2]),level=kDebugDumpLevel) + if event[1] == PtBookEventTypes.kNotifyImageLink: + if event[2] == xLinkingBookDefs.kYeeshaBookLinkID: + PtDebugPrint("clftGetPersonalBook:Book: hit linking panel",level=kDebugDumpLevel) + gAreWeLinkingOut = 1 + YeeshaBook.hide() + self.ILinktoPersonalAge() + elif event[1] == PtBookEventTypes.kNotifyShow: + pass + elif event[1] == PtBookEventTypes.kNotifyHide: + PtDebugPrint("clftGetPersonalBook:Book: NotifyHide",level=kDebugDumpLevel) + # don't really care if they close the book, but re-enable the clickable for them + if not gAreWeLinkingOut: + actClickableBook.enable() + # only re-enable the KI and BB if they are not linking out + PtSendKIMessage(kEnableKIandBB,0) + pass + elif event[1] == PtBookEventTypes.kNotifyNextPage: + pass + elif event[1] == PtBookEventTypes.kNotifyPreviousPage: + pass + elif event[1] == PtBookEventTypes.kNotifyCheckUnchecked: + pass + + if PtWasLocallyNotified(self.key): + + # click on the book? + if state and id == actClickableBook.id: + # disable the book... need to re-enable if they cancel + actClickableBook.disable() + # prevent Martin from hitting the option menu and playing the live movie + PtSendKIMessage(kDisableKIandBB,0) + gAreWeLinkingOut = 0 + LocalAvatar = PtFindAvatar(events) + SmartSeek.run(LocalAvatar) + + # smart seek is done + if id == SmartSeek.id: + for event in events: + # if smart seek completed. Exit multistage, and show GUI. + if event[0] == kMultiStageEvent and event[2] == kEnterStage: + SmartSeek.gotoStage(LocalAvatar, -1) + YeeshaBook = ptBook(xLinkingBookDefs.xYeeshaBookNoShare,self.key) + YeeshaBook.setSize( xLinkingBookDefs.YeeshaBookSizeWidth, xLinkingBookDefs.YeeshaBookSizeHeight ) + YeeshaBook.show(1) + + # picking up the book is beginning + if id == MultiBeh.id: + for event in events: + if event[0] == kMultiStageEvent and event[2] == kEnterStage: + avatar = PtGetLocalAvatar() + currentgender = avatar.avatar.getAvatarClothingGroup() + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + if currentgender == 1: + #~ print "Playing female book animation" + BookAnimFemale.animation.play() + elif currentgender == 0: + #~ print "Playing male book animation" + BookAnimMale.animation.play() + else: + PtDebugPrint("clftGetPersonalBook: unreadable gender or special character.",level=kErrorLevel) + BookAnimMale.animation.play() + + def ILinktoPersonalAge(self): + global LocalAvatar + # start the alert of the personal book blinking + PtSendKIMessage(kStartBookAlert,0) + #~ print "trying to get book." + MultiBeh.run(LocalAvatar) + self.SolveCleft() + PtAtTimeCallback(self.key, 8, kLinkRespID) + + def SolveCleft(self): + if not PtIsDemoMode(): + vault = ptVault() + vault.addChronicleEntry("CleftSolved",1,"yes") + PtDebugPrint("Chronicle updated with variable 'CleftSolved'.",level=kDebugDumpLevel) + + def OnTimer(self,id): + global gDemoMovie + global gWasMuted + if id == kLinkRespID: + respLinkResponder.run(self.key, self.key,avatar=PtGetLocalAvatar()) + if PtIsDemoMode(): + PtFadeOut(kTrailerFadeOutSeconds,1) + PtAtTimeCallback(self.key, kTrailerFadeOutSeconds, kTrailerFadeOutID) + else: + # only re-enable the KI and BB if they are not in demo mode + PtSendKIMessage(kEnableKIandBB,0) + elif id == kTrailerFadeOutID: + try: + os.stat(kDemoMovieName) + # its there! show the background, which will start the movie + # just continue processing + except: + PtDebugPrint("xLiveTrailer - no intro movie!!!",level=kDebugDumpLevel) + print "Quitting demo now..." + PtConsole("App.Quit") + PtDebugPrint("xLiveTrailer - start showing movie",level=kDebugDumpLevel) + PtShowDialog("IntroBahroBgGUI") + #TrailerDlg.dialog.show() + # stop rendering the scene while showing the movie + PtDisableRenderScene() + # dim the cursor + PtGUICursorDimmed() + # temp mute sound + audio = ptAudioControl() + if audio.isMuted(): + gWasMuted = 1 + else: + gWasMuted = 0 + audio.muteAll() + PtFadeIn(kTrailerInSeconds,0) + PtAtTimeCallback(self.key, kTrailerInSeconds, kTrailerFadeInID) + if PtIsDemoMode(): + gDemoMovie = ptMoviePlayer(kDemoMovieName,self.key) + gDemoMovie.playPaused() + elif id == kTrailerFadeInID: + PtDebugPrint("xLiveTrailer - roll the movie",level=kDebugDumpLevel) + if type(gDemoMovie) != type(None): + gDemoMovie.resume() + elif id == kTrailerDoneID: + print "Quitting demo now..." + PtConsole("App.Quit") + + def OnMovieEvent(self,movieName,reason): + PtDebugPrint("xLiveTrailer: got movie done event on %s, reason=%d" % (movieName,reason),level=kDebugDumpLevel) + if gDemoMovie: + #PtFadeOut(kTrailerFadeOutSeconds, kTrailerDoneID) + PtConsole("App.Quit") diff --git a/Python/clftImager.py b/Python/clftImager.py new file mode 100644 index 0000000000..12cee6292f --- /dev/null +++ b/Python/clftImager.py @@ -0,0 +1,930 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: clftImager.py +Age: clftImager +Date: October 2002 +event manager hooks for the clftImager +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * +from PlasmaKITypes import * +import whrandom +import time +import copy +import PlasmaControlKeys +import string +from xPsnlVaultSDL import * + + +imagerBtn = ptAttribActivator(1,"fake imager button") +imagerBrokenBtn = ptAttribActivator(2,"broken imager go switch") +imagerLockN = ptAttribActivator(3,"imager lock N") +imagerLockS = ptAttribActivator(4,"imager lock S") +imagerLockE = ptAttribActivator(5,"imager lock E") +imagerLockW = ptAttribActivator(6,"imager lock W") +imagerCam = ptAttribSceneobject(7,"imager camera") +# imager animation responders: +imagerRespN = ptAttribResponder(8,"N Responder",['State 1','State 2','State 3','State 4','SOLVED','State 6','State 7']) +imagerRespS = ptAttribResponder(9,"S Responder",['State 1','State 2','State 3','State 4','State 5','State 6','SOLVED']) +imagerRespW = ptAttribResponder(10,"W Responder",['State 1','SOLVED','State 3','State 4','State 5','State 6','State 7']) +imagerRespE = ptAttribResponder(11,"E Responder",['State 1','State 2','State 3','SOLVED','State 5','State 6','State 7']) +# NPC speech responders and stuff +ImagerOneshot = ptAttribResponder(12,"Resp: Player avatar oneshot") +ShortVisionSound = ptAttribResponder(13,"Resp: Short Vision audio", ['on','off']) +LongVisionSound = ptAttribResponder(14,"Resp: Long Vision audio", ['on','off']) +#imagerSolvedBtn = ptAttribActivator(15,"opening speech") +#imagerEndgameBtn = ptAttribActivator(16,"endgame speech") +YeeshaMultiStage = ptAttribBehavior(15, "Yeesha multistage") +YeeshaSpawner = ptAttribActivator(16, "Yeesha spawner") +YeeshaWarpHid = ptAttribSceneobject(17,"warp: Yeesha hidden") +YeeshaWarpVis1 = ptAttribSceneobject(18,"warp: Yeesha vis 1") +#SDL to kill imager anim if you pull the lever while its playing +stringSDLVarLocked = ptAttribString(19,"sdl for windmill lock") +#SDLs for Imager panel/symbol states +stringSDLVarPanelN = ptAttribString(20,"sdl for PanelN") +stringSDLVarPanelS = ptAttribString(21,"sdl for PanelS") +stringSDLVarPanelE = ptAttribString(22,"sdl for PanelE") +stringSDLVarPanelW = ptAttribString(23,"sdl for PanelW") +#Endgame Yeesha speech responders +YeeshaSpeech2 = ptAttribResponder(24,"Resp: Yeesha speech 2", ['on','off']) +respBookAnim = ptAttribResponder(25,"Resp: Tomahna book disabler") +stringSDLVarRunning = ptAttribString(26,"sdl for windmill running") +ImagerBtnVisible = ptAttribResponder(27,"Resp: Imager dummy vis") +ImagerBtnInvisible = ptAttribResponder(28,"Resp: Imager dummy invis") +SeekBehavior = ptAttribBehavior(29, "Smart seek before GUI") +YeeshaWarpVis2 = ptAttribSceneobject(30,"warp: Yeesha vis 2") +GetClothesEvent = ptAttribActivator(31,"event to get Yeeshas Clothes") +StopIntroVisEvent = ptAttribActivator(32,"event to stop intro vis") +StopFinalVisEvent = ptAttribActivator(33,"event to stop final vis") +KillIntroVisMusic = ptAttribResponder(34,"Resp: kill intro vis music") +KillFinalVisMusic = ptAttribResponder(35,"Resp: kill final vis music") +MakeMeVisible = ptAttribActivator(36,"force visible on local avatar") +CamSceneSetup = ptAttribResponder(37,"Resp: Yeesha scene cam") +YeeshaSpeech3 = ptAttribResponder(38,"Resp: Yeesha speech 3") +YeeshaSceneTimerDoorClose = ptAttribActivator(39, "AnmEvt: Yeesha scene close door") +YeeshaSceneTimerDone = ptAttribActivator(40, "AnmEvt: Yeesha scene done") +RgnSnsrBahroStart = ptAttribActivator(41, "RgnSns: Bahro scene start") +YeeshaWarpVis3 = ptAttribSceneobject(42,"warp: Yeesha vis 3") +respPlayTPOTSpeech = ptAttribResponder(43,"resp: TPOT speech",['on','off']) +rgnTPOTShellLink = ptAttribActivator(44,"rgn sns: TPOT shell link") +respTPOTShellLink = ptAttribResponder(45,"resp: TPOT shell link") +StopYeeshaTPOTEvent = ptAttribActivator(46,"event to stop Yeesha TPOT") + + +# globals +PlayFull = 0 # Determines whether full vision will play or not. 0 = partial, 1 = full +minstoptime = 3 # If PlayFull 0, minimum time vision will run in seconds +maxstoptime = 5 # If PlayFull 0, maximum time vision will run in seconds +YeeshaName = None +FoundJCs = None +visionplaying = 0 +visits = 0 +kVision = 99 +kFinished = 55 +kLostPowerID = 33 +PlayFinal = 0 +# lists for Imager panel/symbol states +statesN = ('State 1','State 2','State 3','State 4','SOLVED','State 6','State 7') +statesS = ('State 1','State 2','State 3','State 4','State 5','State 6','SOLVED') +statesE = ('State 1','State 2','State 3','SOLVED','State 5','State 6','State 7') +statesW = ('State 1','SOLVED','State 3','State 4','State 5','State 6','State 7') +imagerBusted = 0 +speechKilled = 0 +PuzzleView = 0 +VisionID = None +PlayScene = 0 +SDLVarSceneYeesha = "clftSceneYeeshaUnseen" +SDLVarTomahnaActive = "clftTomahnaActive" +PlayTPOT = 0 + + +class clftImager(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 50248473 + self.version = 29 + + + def OnFirstUpdate(self): + whrandom.seed() + #self.ageSDL = PtGetAgeSDL() + #self.ageSDL.setFlags(stringSDLVarPanelE.value,1,1) + #self.ageSDL.sendToClients(stringSDLVarPanelE.value) + + + def OnServerInitComplete(self): + global statesN + global statesS + global statesE + global statesW + global imagerBusted + global PlayScene + global SDLVarSceneYeesha + global SDLVarTomahnaActive + + # makes sure Tomahna book is disabled and invisible when linking in to age + respBookAnim.run(self.key) + #TomahnaBookDisable.run(self.key,avatar=PtGetLocalAvatar()) + + self.ageSDL = PtGetAgeSDL() + # register for notification of locked SDL var changes + self.ageSDL.setNotify(self.key,stringSDLVarLocked.value,0.0) + # register for notification of 4 Imager Panels SDL var changes + self.ageSDL.setNotify(self.key,stringSDLVarPanelN.value,0.0) + self.ageSDL.setNotify(self.key,stringSDLVarPanelS.value,0.0) + self.ageSDL.setNotify(self.key,stringSDLVarPanelE.value,0.0) + self.ageSDL.setNotify(self.key,stringSDLVarPanelW.value,0.0) + + # gets SDL values of 4 Imager panels, uses this value to retrieve correct state from 4 state lists, + # and runs the corresponding responder to set initial default state for each state panel + try: + intPanelN = self.ageSDL[stringSDLVarPanelN.value][0] + except: + intPanelN = 3 + PtDebugPrint("ERROR: clftImager.OnServerInitComplete():\tERROR: age sdl read failed, defaulting intPanelN = 3") + panelN = statesN[intPanelN] + imagerRespN.run(self.key,state="%s" % (panelN)) + try: + intPanelS = self.ageSDL[stringSDLVarPanelS.value][0] + except: + intPanelS = 5 + PtDebugPrint("ERROR: clftImager.OnServerInitComplete():\tERROR: age sdl read failed, defaulting intPanelS = 5") + panelS = statesS[intPanelS] + imagerRespS.run(self.key,state="%s" % (panelS)) + try: + intPanelE = self.ageSDL[stringSDLVarPanelE.value][0] + except: + intPanelE = 3 + PtDebugPrint("ERROR: clftImager.OnServerInitComplete():\tERROR: age sdl read failed, defaulting intPanelE = 3") + panelE = statesE[intPanelE] + imagerRespE.run(self.key,state="%s" % (panelE)) + try: + intPanelW = self.ageSDL[stringSDLVarPanelW.value][0] + except: + intPanelW = 0 + PtDebugPrint("ERROR: clftImager.OnServerInitComplete():\tERROR: age sdl read failed, defaulting intPanelW = 0") + panelW = statesW[intPanelW] + imagerRespW.run(self.key,state="%s" % (panelW)) + + boolSceneYeesha = self.ageSDL[SDLVarSceneYeesha][0] + boolTomahnaActive = self.ageSDL[SDLVarTomahnaActive][0] + + if boolTomahnaActive: + PtDebugPrint("clftImager.OnServerInitComplete: SDL says Tomahna is active, will set Imager to break...") + imagerBusted = 1 + else: + PtDebugPrint("clftImager.OnServerInitComplete: SDL says Tomahna is NOT active, will set Imager to work...") + imagerBusted = 0 + + if boolTomahnaActive and boolSceneYeesha: + PtDebugPrint("clftImager.OnServerInitComplete(): TomahnaActive AND SceneYeesha SDL vars are true, will play scene") + PlayScene = 1 + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + print"failed to get local avatar" + return + avatar.avatar.registerForBehaviorNotify(self.key) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + CamSceneSetup.run(self.key,avatar=PtGetLocalAvatar()) + import xSndLogTracks + xSndLogTracks.InitLogTrack("15") + else: + PtDebugPrint("clftImager.OnServerInitComplete(): TomahnaActive and/or SceneYeesha SDL vars are false, no scene for you") + PlayScene = 0 + #YeeshaName.draw.disable() ## we're already doing this in clftImager.py + + + def OnBehaviorNotify(self,type,id,state): + global PlayScene + + PtDebugPrint("clftImager.OnBehaviorNotify(): %d" % (type)) + if type == PtBehaviorTypes.kBehaviorTypeLinkIn and not state: + if PlayScene: + self.SceneYeesha() + avatar = PtGetLocalAvatar() + avatar.avatar.unRegisterForBehaviorNotify(self.key) + + + # kill vision if you pull lever while its running + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global visionplaying + global statesN + global statesS + global statesE + global statesW + global speechKilled + + self.ageSDL = PtGetAgeSDL() + + if VARname == stringSDLVarLocked.value: + windmillLocked = self.ageSDL[stringSDLVarLocked.value][0] + if windmillLocked and visionplaying: + PtAtTimeCallback(self.key,3,kLostPowerID) + #~ speechKilled = 1 + #~ self.StopVision() + #~ imagerBrokenBtn.disableActivator() + #~ imagerLockN.disableActivator() + #~ imagerLockS.disableActivator() + #~ imagerLockW.disableActivator() + #~ imagerLockE.disableActivator() + + # checks if one of the Imager panel/symbol SDL vars has changed, + # sets new state of any changed panels and runs corresponding responder + if VARname == stringSDLVarPanelN.value: + intPanelN = self.ageSDL[stringSDLVarPanelN.value][0] + panelN = statesN[intPanelN] + imagerRespN.run(self.key,state="%s" % (panelN)) + if VARname == stringSDLVarPanelS.value: + intPanelS = self.ageSDL[stringSDLVarPanelS.value][0] + panelS = statesS[intPanelS] + imagerRespS.run(self.key,state="%s" % (panelS)) + if VARname == stringSDLVarPanelE.value: + intPanelE = self.ageSDL[stringSDLVarPanelE.value][0] + panelE = statesE[intPanelE] + imagerRespE.run(self.key,state="%s" % (panelE)) + if VARname == stringSDLVarPanelW.value: + intPanelW = self.ageSDL[stringSDLVarPanelW.value][0] + panelW = statesW[intPanelW] + imagerRespW.run(self.key,state="%s" % (panelW)) + + intPanelN = self.ageSDL[stringSDLVarPanelN.value][0] + intPanelS = self.ageSDL[stringSDLVarPanelS.value][0] + intPanelE = self.ageSDL[stringSDLVarPanelE.value][0] + intPanelW = self.ageSDL[stringSDLVarPanelW.value][0] + if intPanelN == 0 and intPanelS == 0 and intPanelW == 0 and intPanelE == 0: + import xSndLogTracks + if xSndLogTracks.LogTrack("421","15"): + xSndLogTracks.SetLogMode() + + + def OnControlKeyEvent(self,controlKey,activeFlag): + global PuzzleView + + if controlKey == PlasmaControlKeys.kKeyExitMode: + if PuzzleView: + self.IQuitImager() + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + if PuzzleView: + self.IQuitImager() + + + def IQuitImager(self): + global PuzzleView + print "disengage and exit the imager puzzle" + avatar = PtGetLocalAvatar() + imagerCam.value.popCutsceneCamera(avatar.getKey()) + #imagerBtn.enableActivator() + #ImagerBtnVisible.run(self.key) + imagerBrokenBtn.disableActivator() + imagerLockN.disableActivator() + imagerLockS.disableActivator() + imagerLockW.disableActivator() + imagerLockE.disableActivator() + avatar.draw.enable() + #PtFadeLocalAvatar(0) + #reeneable first person + cam = ptCamera() + cam.enableFirstPersonOverride() + #PtGetControlEvents(false,self.key) + PtDisableControlKeyEvents(self.key) + PtEnableForwardMovement() + PtSendKIMessage(kEnableEntireYeeshaBook,0) + PuzzleView = 0 + PtAtTimeCallback(self.key,1,imagerBtn.id) + + + def OnNotify(self,state,id,events): + global YeeshaName + global PlayFull + global visionplaying + global minstoptime + global maxstoptime + global kVision + global kFinished + global inCloseup + global PlayFinal + global imagerBusted + global speechKilled + global PuzzleView + global PlayScene + global PlayTPOT + + self.ageSDL = PtGetAgeSDL() + + if (id == MakeMeVisible.id and state): + if (PtFirstPerson()): + return + avatar=PtFindAvatar(events) + avatar.draw.enable() + print"force avatar visible" + return + + # Causes Yeesha to be spawned out of sight before imager is activated + if (id == YeeshaSpawner.id): + YeeshaName = PtFindAvatar(events) + YeeshaMultiStage.run(YeeshaName) + YeeshaName.physics.suppress(true) + YeeshaName.draw.disable() + PtDebugPrint("clftImager.OnNotify(): YeeshaName = %s" % (YeeshaName)) + + # switch to imager close-up camera + + if (id == imagerBtn.id and state): + print"switch to imager close up" + imagerBtn.disableActivator() + ImagerBtnInvisible.run(self.key) + #~ if visionplaying: + #~ self.StopVision() + #PtGetControlEvents(true,self.key) + PtEnableControlKeyEvents(self.key) + avatar = PtFindAvatar(events) + SeekBehavior.run(avatar) + + if (id == SeekBehavior.id): + if PtWasLocallyNotified(self.key): + for event in events: + if event[0] == kMultiStageEvent and event[2] == kEnterStage: # Smart seek completed. Exit multistage, and show GUI. + avatar = PtFindAvatar(events) + SeekBehavior.gotoStage(avatar, -1) + PtDebugPrint("clftImager.onNotify: enter puzzle view mode now that seek is done") + avatar.draw.disable() + #PtFadeLocalAvatar(1) + imagerCam.value.pushCutsceneCamera(0, avatar.getKey()) + # Disable First Person Camera + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + PtDisableForwardMovement() + PuzzleView = 1 + PtAtTimeCallback(self.key,0.5,imagerBrokenBtn.id) + return + + # trigger the imager to run, reset clickables + if (id == imagerBrokenBtn.id and state): + print "trigger imager" + imagerBrokenBtn.disableActivator() + imagerLockN.disableActivator() + imagerLockS.disableActivator() + imagerLockW.disableActivator() + imagerLockE.disableActivator() + #~ if visionplaying: + #~ # how??? + #~ self.StopVision() + #PtGetControlEvents(false,self.key) + PtDisableControlKeyEvents(self.key) + avatar = PtFindAvatar(events) + imagerCam.value.popCutsceneCamera(avatar.getKey()) + #imagerBtn.enableActivator() + avatar.draw.enable() + #PtFadeLocalAvatar(0) + #reeneable first person + cam = ptCamera() + cam.enableFirstPersonOverride() + #PtEnableForwardMovement() + + if (self.EndgameSolved()): + PlayFull = 0 + PlayFinal = 1 + print "play final speech" + elif (self.OpeningSolved()): + PlayFull = 1 + PlayFinal = 0 + print "play full opening speech" + elif (self.TPOTSolved()): + PlayFull = 0 + PlayFinal = 0 + PlayTPOT = 1 + print "play TPOT speech" + else: + PlayFull = 0 + PlayFinal = 0 + print "play partial opening speech" + + #PtAtTimeCallback(self.key,2,imagerBtn.id) + + for event in events: + if event[0]==2 and event[1]==1: # play avatar oneshot, regardless of whether button is going on or off + ImagerOneshot.run(self.key,events=events,avatar=PtGetLocalAvatar()) + return + + if (id == ImagerOneshot.id): + print"avatar oneshot callback" + PuzzleView = 0 + PtEnableForwardMovement() + PtSendKIMessage(kEnableEntireYeeshaBook,0) + windmillRunning = self.ageSDL[stringSDLVarRunning.value][0] + if windmillRunning == 1 and imagerBusted == 0: + PtDebugPrint("clftImager.OnNotify: SDL says windmill is running, so button will do SOMETHING after oneshot...") + for event in events: + if event[0]==8 and event[1]==1: # toggle vision + if visionplaying: + #~ imagerBrokenBtn.disableActivator() + #~ imagerLockN.disableActivator() + #~ imagerLockS.disableActivator() + #~ imagerLockW.disableActivator() + #~ imagerLockE.disableActivator() + print "Now, killing vision" + speechKilled = 1 + self.StopVision() + elif visionplaying == 0: + self.StartVision() + if PlayFinal == 1: + print "nothing" + # this timer value is approximate right now + #PtAtTimeCallback(self.key, 204.2, kFinished) + elif PlayFinal == 0 and PlayFull == 0 and PlayTPOT == 0: + stopvision = whrandom.randint(minstoptime, maxstoptime) + print "\tImager will autoshut off in %d seconds" % (stopvision) + PtAtTimeCallback(self.key, stopvision, kVision) + elif PlayFull == 1: + print "nothing" + # The full audio of the Yeesha Vision plays for 137 seconds. This ensures turning it off after completion. + #PtAtTimeCallback(self.key, 141.6, kVision) + else: + PtDebugPrint("clftImager.OnNotify: SDL says windmill is NOT running, so button will stop after oneshot...") + PtAtTimeCallback(self.key,1,imagerBtn.id) + + if (id == GetClothesEvent.id and state): + avatar = PtGetLocalAvatar() + currentgender = avatar.avatar.getAvatarClothingGroup() + if currentgender == kFemaleClothingGroup: + clothingName = "02_FTorso11_01" + else: + clothingName = "02_MTorso09_01" + clothingList = avatar.avatar.getWardrobeClothingList() + if clothingName not in clothingList: + print "adding Yeesha reward clothing %s to wardrobe" % (clothingName) + avatar.avatar.addWardrobeClothingItem(clothingName,ptColor().white(),ptColor().black()) + else: + print "player already has Yeesha reward clothing, doing nothing" + + if (id == StopIntroVisEvent.id and state): + speechKilled = 0 + self.StopVision() + + if (id == StopFinalVisEvent.id and state): + speechKilled = 0 + self.StopVision() + + if (id == StopYeeshaTPOTEvent.id and state): + speechKilled = 0 + self.StopVision() + + if (id == YeeshaSceneTimerDoorClose.id and state and PlayScene == 1): + PtDebugPrint("clftImager.OnNotify(): Yeesha's leaving, now shutting Office Door") + self.ageSDL = PtGetAgeSDL() + SDLVarOfficeDoor = "clftOfficeDoorClosed" + xtraInfo = "fromOutside" + boolOfficeDoor = self.ageSDL[SDLVarOfficeDoor][0] + if boolOfficeDoor == 0: + self.ageSDL.setTagString(SDLVarOfficeDoor,xtraInfo) + self.ageSDL[SDLVarOfficeDoor] = (1,) + else: + print "what's wrong with the door?" + + if (id == YeeshaSceneTimerDone.id and state and PlayScene == 1): + print "clftImager.OnNotify(): Yeesha timer is done. Getting rid of Yeesha and setting SDL." + self.ageSDL = PtGetAgeSDL() + YeeshaName.draw.disable() + YeeshaName.physics.warpObj(YeeshaWarpHid.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 0,dirFlag=1,isForward=1) + self.ageSDL[SDLVarSceneYeesha] = (0,) + PlayScene == 0 + cam = ptCamera() + cam.enableFirstPersonOverride() + + if (id == RgnSnsrBahroStart.id and state): + PtSendKIMessage(kDisableKIandBB,0) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + + if (id == rgnTPOTShellLink.id and state): + self.IDoCityLinksChron("Kveer") + respTPOTShellLink.run(self.key,avatar=PtGetLocalAvatar()) + + + def SceneYeesha(self): + global YeeshaName + global PlayScene + + PtDebugPrint("clftImager.SceneYeesha(): PlayScene = %d" % (PlayScene)) + + if PlayScene == 1: + print "clftImager: Playing scene now..." + YeeshaName.draw.enable() + YeeshaName.physics.warpObj(YeeshaWarpVis3.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 3,dirFlag=1,isForward=1) + YeeshaSpeech3.run(self.key,avatar=PtGetLocalAvatar()) + else: + print "clftImager: Nope, not playing scene." + + + def OpeningSolved(self): + solutionList = [4, 3, 6, 1] + imagerList = [] + + imagerList.append(imagerRespN.state_list.index(imagerRespN.getState())) + imagerList.append(imagerRespE.state_list.index(imagerRespE.getState())) + imagerList.append(imagerRespS.state_list.index(imagerRespS.getState())) + imagerList.append(imagerRespW.state_list.index(imagerRespW.getState())) + + print "clftImager.OpenSolved(): solution list:", solutionList + print "clftImager.OpenSolved(): imager list :", imagerList + + if self.AreListsEquiv(solutionList, imagerList): + return true + else: + return false + + + def GetAgeNode(self, age): + vault = ptVault() + + chron = vault.findChronicleEntry("BahroCave") + if type(chron) != type(None): + ageChronRefList = chron.getChildNodeRefList() + + if type(ageChronRefList) != type(None): + for ageChron in ageChronRefList: + ageChild = ageChron.getChild() + + ageChild = ageChild.upcastToChronicleNode() + + if ageChild.chronicleGetName() == age: + return ageChild + + return None + + + def GetAgeSolutionSymbol(self, age): + node = self.GetAgeNode(age) + + if node != None: + varlist = node.chronicleGetValue().split(",") + return varlist[ 1 ] + else: + return None + + + def AreListsEquiv(self, list1, list2): + if list1[0] in list2: + # rearrange list + list2Copy = copy.copy(list2) + while list2Copy[0] != list1[0]: + list2Copy.append(list2Copy.pop(0)) + + # check if all values match up now + for i in range(4): + if list2Copy[i] != list1[i]: + return false + + return true + + return false + + def EndgameSolved(self): + boolCleftSolved = 0 + vault = ptVault() + entry = vault.findChronicleEntry("CleftSolved") + if type(entry) != type(None): + if entry.chronicleGetValue() == "yes": + boolCleftSolved = 1 + + if not boolCleftSolved: + return false + + solutionList = [] + currentStateList = [] + + for age in ["Teledahn", "Garden", "Garrison", "Kadish"]: + symbol = self.GetAgeSolutionSymbol(age) + if type(symbol) == type(""): + symbol = int(symbol) + solutionList.append(symbol) + + currentStateList.append(imagerRespN.state_list.index(imagerRespN.getState())) + currentStateList.append(imagerRespE.state_list.index(imagerRespE.getState())) + currentStateList.append(imagerRespS.state_list.index(imagerRespS.getState())) + currentStateList.append(imagerRespW.state_list.index(imagerRespW.getState())) + + for x in range(4): + currentStateList[x] = (currentStateList[x]+6)%7 + + print "clftImager.EndgameSolved(): solution list: " + str(solutionList) + print "clftImager.EndgameSolved(): currentState list: " + str(currentStateList) + + if self.AreListsEquiv(solutionList, currentStateList): + return true + else: + return false + + + def TPOTSolved(self): + solutionList = self.GetPelletCaveSolution() + currentStateList = [] + + currentStateList.append(imagerRespN.state_list.index(imagerRespN.getState())) + currentStateList.append(imagerRespE.state_list.index(imagerRespE.getState())) + currentStateList.append(imagerRespS.state_list.index(imagerRespS.getState())) + currentStateList.append(imagerRespW.state_list.index(imagerRespW.getState())) + + for x in range(4): + currentStateList[x] = (currentStateList[x]+6)%7 + + print "clftImager.TPOTSolved(): solution list:", solutionList + print "clftImager.TPOTSolved(): currentState list :", currentStateList + + if self.AreListsEquiv(solutionList, currentStateList): + return true + else: + return false + + + def GetPelletCaveSolution(self): + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("PelletBahroCave") + + ageDataFolder = None + + vault = ptVault() + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "PelletCaveSolution": + chronString = chron.getValue() + chronString = chronString.split(",") + chronSolutions = [] + for sol in chronString: + chronSolutions.append(string.atoi(sol)) + print "found pellet cave solution: ",chronSolutions + return chronSolutions + + + def OnTimer(self,id): + global visionplaying + global kVision + global kFinished + global kLostPower + global speechKilled + + if visionplaying == 1 and id == kVision: + print "\nclftImager.Ontimer:Got kVision timer callback. Automatically stopping vision." + self.StopVision() + imagerBrokenBtn.disableActivator() + imagerLockN.disableActivator() + imagerLockS.disableActivator() + imagerLockW.disableActivator() + imagerLockE.disableActivator() + #~ elif visionplaying == 1 and id == kFinished: + #~ print "\nclftImager.Ontimer:Got kFinished timer callback. Automatically stopping vision." + #~ finalDone = 1 + #~ self.StopVision() + #~ imagerBrokenBtn.disableActivator() + #~ imagerLockN.disableActivator() + #~ imagerLockS.disableActivator() + #~ imagerLockW.disableActivator() + #~ imagerLockE.disableActivator() + elif id == imagerBrokenBtn.id: + print "\nclftImager.Ontimer:Got timer callback. Setting up Imager button...." + imagerBtn.disableActivator() + ImagerBtnInvisible.run(self.key) + imagerBrokenBtn.enableActivator() + imagerLockN.enableActivator() + imagerLockS.enableActivator() + imagerLockW.enableActivator() + imagerLockE.enableActivator() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + PtDisableForwardMovement() + elif id == imagerBtn.id: + print "\nclftImager.Ontimer:Got timer callback. Setting up Imager dummy...." + imagerBrokenBtn.disableActivator() + imagerLockN.disableActivator() + imagerLockS.disableActivator() + imagerLockW.disableActivator() + imagerLockE.disableActivator() + imagerBtn.enableActivator() + ImagerBtnVisible.run(self.key) + PtEnableForwardMovement() + PtSendKIMessage(kEnableEntireYeeshaBook,0) + elif id == kLostPowerID: + speechKilled = 1 + self.StopVision() + imagerBrokenBtn.disableActivator() + imagerLockN.disableActivator() + imagerLockS.disableActivator() + imagerLockW.disableActivator() + imagerLockE.disableActivator() + + + def StartVision(self): + global PlayFull + global PlayFinal + global visionplaying + global YeeshaName + global VisionID + + print "clftImager.StartVision: Playing Yeesha vision." + + YeeshaName.draw.enable() + + PtDebugPrint("clftImager.StartVision: PlayFinal = %s" % (PlayFinal)) + + # play the vision + if PlayFinal == 1: + YeeshaName.physics.warpObj(YeeshaWarpVis2.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 2,dirFlag=1,isForward=1) + #respBookAnim.run(self.key,state="on") + visionplaying = 1 + VisionID = "final" + YeeshaSpeech2.run(self.key,state="on") + PtDebugPrint("clftImager.StartVision: play final Yeesha speech 01, then enable Tomahna book...") + PtAtTimeCallback(self.key,1,imagerBtn.id) + elif PlayFinal == 0 and PlayFull == 1: + vault = ptVault() + entry = vault.findChronicleEntry("YeeshaVisionViewed") + if type(entry) == type(None): + vault.addChronicleEntry("YeeshaVisionViewed", 0, "1") + else: + entry.chronicleSetValue("1") + entry.save() + YeeshaName.physics.warpObj(YeeshaWarpVis1.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 1,dirFlag=1,isForward=1) + visionplaying = 1 + VisionID = "long" + LongVisionSound.run(self.key, state="on") + PtAtTimeCallback(self.key,1,imagerBtn.id) + elif PlayTPOT == 1: + respPlayTPOTSpeech.run(self.key,state="on") + visionplaying = 1 + VisionID = "tpots" + PtDebugPrint("clftImager.StartVision: play TPOT speech...") + else: + YeeshaName.physics.warpObj(YeeshaWarpVis1.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 1,dirFlag=1,isForward=1) + visionplaying = 1 + VisionID = "short" + ShortVisionSound.run(self.key, state="on") + PtAtTimeCallback(self.key,1,imagerBtn.id) + + + def StopVision(self): + global PlayFull + global PlayFinal + global visionplaying + global YeeshaName + global speechKilled + global PuzzleView + global VisionID + + print "clftImager.StopVision: Stopping Yeesha vision." + + YeeshaName.draw.disable() + YeeshaName.physics.warpObj(YeeshaWarpHid.value.getKey()) + + #stop the vision + if VisionID == "final": + YeeshaMultiStage.gotoStage(YeeshaName, 0,dirFlag=1,isForward=1) + #respBookAnim.run(self.key,state="off") + visionplaying = 0 + print "TRYING TO KILL FINAL VISION" + if speechKilled == 1: + YeeshaSpeech2.run(self.key,state="on",fastforward=1) + KillFinalVisMusic.run(self.key) + speechKilled = 0 + YeeshaSpeech2.run(self.key,state="off") + #PtAtTimeCallback(self.key,1,imagerBtn.id) + elif VisionID == "long": + YeeshaMultiStage.gotoStage(YeeshaName, 0,dirFlag=1,isForward=1) + visionplaying = 0 + if speechKilled == 1: + LongVisionSound.run(self.key,state="on",fastforward=1) + KillIntroVisMusic.run(self.key) + speechKilled = 0 + LongVisionSound.run(self.key,state="off") + #PtAtTimeCallback(self.key,1,imagerBtn.id) + elif VisionID == "short": + YeeshaMultiStage.gotoStage(YeeshaName, 0,dirFlag=1,isForward=1) + visionplaying = 0 + ShortVisionSound.run(self.key,state="on",fastforward=1) + ShortVisionSound.run(self.key,state="off") + speechKilled = 0 + #PtAtTimeCallback(self.key,1,imagerBtn.id) + elif VisionID == "tpots": + visionplaying = 0 + if speechKilled == 1: + respPlayTPOTSpeech.run(self.key,state="off") + speechKilled = 0 + respPlayTPOTSpeech.run(self.key,state="off") + else: + print "clftImager.StopVision: Don't know which vision to kill!" + + print "PuzzleView = %s" % (PuzzleView) + + avatar = PtGetLocalAvatar() + if PuzzleView: + avatar.draw.disable() + PtAtTimeCallback(self.key,0.5,imagerBrokenBtn.id) + else: + avatar.draw.enable() + PtAtTimeCallback(self.key,0.5,imagerBtn.id) + + + def IDoCityLinksChron(self,agePanel): + CityLinks = [] + vault = ptVault() + entryCityLinks = vault.findChronicleEntry("CityBookLinks") + if type(entryCityLinks) != type(None): + valCityLinks = entryCityLinks.chronicleGetValue() + print "valCityLinks = ",valCityLinks + CityLinks = valCityLinks.split(",") + print "CityLinks = ",CityLinks + if agePanel not in CityLinks: + NewLinks = valCityLinks + "," + agePanel + entryCityLinks.chronicleSetValue(NewLinks) + entryCityLinks.save() + print "xLinkingBookGUIPopup.IDoCityLinksChron(): setting citylinks chron entry to include: ",agePanel + valCityLinks = entryCityLinks.chronicleGetValue() + CityLinks = valCityLinks.split(",") + print "xLinkingBookGUIPopup.IDoCityLinksChron(): citylinks now = ",CityLinks + else: + print "xLinkingBookGUIPopup.IDoCityLinksChron(): do nothing, citylinks chron already contains: ",agePanel + else: + vault.addChronicleEntry("CityBookLinks",0,agePanel) + print "xLinkingBookGUIPopup.IDoCityLinksChron(): creating citylinks chron entry and adding: ",agePanel + + psnlSDL = xPsnlVaultSDL() + GotBook = psnlSDL["psnlGotCityBook"][0] + if not GotBook: + psnlSDL["psnlGotCityBook"] = (1,) + print "xLinkingBookGUIPopup.IDoCityLinksChron(): setting SDL for city book to 1" + + + def OnBackdoorMsg(self, target, param): + if target == "yeesha1" or target == "yeesha2" or target == "yeesha3": + if param == "off": + YeeshaName.draw.disable() + YeeshaName.physics.warpObj(YeeshaWarpHid.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 0,dirFlag=1,isForward=1) + elif param == "on": + if target == "yeesha1": + YeeshaName.draw.enable() + YeeshaName.physics.warpObj(YeeshaWarpVis1.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 1,dirFlag=1,isForward=1) + elif target == "yeesha2": + YeeshaName.draw.enable() + YeeshaName.physics.warpObj(YeeshaWarpVis2.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 2,dirFlag=1,isForward=1) + elif target == "yeesha3": + YeeshaName.draw.enable() + YeeshaName.physics.warpObj(YeeshaWarpVis3.value.getKey()) + YeeshaMultiStage.gotoStage(YeeshaName, 3,dirFlag=1,isForward=1) + elif target == "tpots": + if param == "on" or param == "1": + respPlayTPOTSpeech.run(self.key,state="on") + elif param == "off" or param == "0": + respPlayTPOTSpeech.run(self.key,state="off") + + diff --git a/Python/clftIntroMusic.py b/Python/clftIntroMusic.py new file mode 100644 index 0000000000..5f4fb49d16 --- /dev/null +++ b/Python/clftIntroMusic.py @@ -0,0 +1,106 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: clftIntroMusic.py +Age: Cleft +Date: October 2006 +Author: Tye Hooley +Controls the Intro Music +""" + +from Plasma import * +from PlasmaTypes import * + + +actStartMusic01 = ptAttribActivator(1,"Start Music Activator 01") +actStartMusic02 = ptAttribActivator(2,"Start Music Activator 02") +actStartMusic03 = ptAttribActivator(3,"Start Music Activator 03") +respStartMusic = ptAttribResponder(4,"Start Music Repsonder") +respStartRandomMusic = ptAttribResponder(5,"Start Random Music Responder") + +actStopMusic = ptAttribActivator(6,"Stop Music Activator") +respStopInitialMusic = ptAttribResponder(7,"Stop Initial Music Responder") +respStopRandomMusic = ptAttribResponder(8,"Stop Random Music Responder") + + + +# globals + +#Music States +kOff = 0 +kInitialPlay = 1 +kRandomPlay = 2 + +musicState = kOff + + + +class clftIntroMusic(ptResponder): + + def __init__(self): + global musicState + ptResponder.__init__(self) + self.id = 5249 + self.version = 1 + + + def OnNotify(self,state,id,events): + global musicState + + if state == false: + return + + + #print "clftIntroMusic: We've got notification from ID #:%s" %id + + #-----Activators----- + startMusicActIDs = (actStartMusic01.id, actStartMusic02.id, actStartMusic03.id) + if id in startMusicActIDs: + if musicState == kOff: + print "clftIntroMusic: ---Starting Music---" + musicState = kInitialPlay + respStartMusic.run(self.key) + return + + elif id == actStopMusic.id: + if musicState == kInitialPlay: + print "clftIntroMusic: ###Stopping Music###" + respStopInitialMusic.run(self.key) + elif musicState == kRandomPlay: + print "clftIntroMusic: ###Stopping Music###" + respStopRandomMusic.run(self.key) + musicState = kOff + return + + #-----Responders----- + elif id == respStartMusic.id: + if musicState == kInitialPlay: + print "clftIntroMusic: ___Randomly Starting Music___" + musicState = kRandomPlay + respStartRandomMusic.run(self.key) + return + + diff --git a/Python/clftNpcZandi.py b/Python/clftNpcZandi.py new file mode 100644 index 0000000000..4b9b0c1f35 --- /dev/null +++ b/Python/clftNpcZandi.py @@ -0,0 +1,546 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: clftNpcZandi +Age: Cleft +Date: September 2002 +Author: Doug McBride +Controls Zandi for Phase0 dialog +""" + +from Plasma import * +from PlasmaTypes import * +import whrandom +import time +import PlasmaControlKeys +import xEnum + +# define the attributes that will be entered in max +Activate = ptAttribActivator(1, "Region Sensor",netForce=1) +MultiStage01 = ptAttribBehavior(2, "NPC Multistage behavior",netForce=1) +NpcSpawner = ptAttribActivator(3, "NPC Spawn point") + +##playsound01 = ptAttribResponder(4,"Rspndr: Sound01") +##playsound08 = ptAttribResponder(5,"Rspndr: Sound08") +##playsound10 = ptAttribResponder(6,"Rspndr: Sound10") +##playsound11 = ptAttribResponder(7,"Rspndr: Sound11") +##playsound12 = ptAttribResponder(8,"Rspndr: Sound12") +##playsound15 = ptAttribResponder(9,"Rspndr: Sound15") + +respBrakeNotReleased = ptAttribResponder(10, "Brake not released", ["1", "2"]) +respWindmillNotTurning = ptAttribResponder(11, "Windmill not turning", ["1", "2"]) +respVisionNotSeen = ptAttribResponder(12, "Vision not seen", ["1", "2"]) +respNoTrailerJC = ptAttribResponder(13, "No trailer JC", ["1", "2"]) +respNoImagerJC = ptAttribResponder(14, "No imager room JC", ["1", "2"]) +respNoBedroomJC = ptAttribResponder(15, "No bedroom JC", ["1", "2"]) +respNoWahrkJC = ptAttribResponder(16, "No wahrk JC", ["1", "2"]) +respNoSignJC = ptAttribResponder(17, "No sign JC", ["1", "2"]) +respNoBucketJC = ptAttribResponder(18, "No bucket JC", ["1", "2"]) +respNoDoorJC = ptAttribResponder(19, "No door JC", ["1", "2"]) +respDoorNotOpen = ptAttribResponder(20, "Tree door not opened", ["1", "2"]) + +respZandiSayings = ptAttribResponder(21, "Zandi sayings", ["welcome", "dryheat", "pizza", "keepexploring", "interrupt", "steak", "welcome2"]) +actZandiClick = ptAttribActivator(22, "Zandi clickable") + +# globals +IgnoreTime = 120 +PageTurnInterval = 120 + +TimerID = xEnum.Enum("IgnoreFinished = 10, TurnPage") + +JC = xEnum.Enum("Trailer, Imager, Bedroom, Wahrk, Sign, Bucket, Door") +jcDict = {JC.Trailer: 'c', JC.Imager: 'd', JC.Bedroom: 'e', JC.Wahrk: 'b', JC.Sign: 'a', JC.Bucket: 'g', JC.Door: 'f'} + + +class clftNpcZandi(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5217 + + self.version = 7 + print "__init__clftNpcZandi v.", self.version + self.NpcName = None + self.ZandiFace = None + + + def OnFirstUpdate(self): + self.AlreadyPlayed = 0 + self.IsTalking = 0 + self.IsIgnoring = 0 + self.DoingBehavior = 0 + self.NearZandi = 0 + self.PlayWelcome2 = 0 + self.LastSpeech = -1 + self.PlayOnFinish = 0 + + whrandom.seed() + + vault = ptVault() + #~ entry = vault.findChronicleEntry("JourneyClothProgress") + #~ if type(entry) != type(None): + #~ FoundJCs = entry.chronicleGetValue() + #~ if "Z" in FoundJCs: + #~ PtPageOutNode("clftZandiVis") + #~ print "Zandi seems to have stepped away from the Airstream. Hmmm..." + + entry = vault.findChronicleEntry("YeeshaVisionViewed") + if type(entry) == type(None): + vault.addChronicleEntry("YeeshaVisionViewed", 0, "0") + + PtAtTimeCallback(self.key, PageTurnInterval, TimerID.TurnPage) + + def OnNotify(self,state,id,events): + print "OnNotify id =", id + if id==NpcSpawner.id: # Causes Zandi to Ilde even before avatar visits + self.NpcName = PtFindAvatar(events) + MultiStage01.run(self.NpcName) + + elif id == actZandiClick.id: + print "Zandi was clicked" + if not self.IsTalking: + print "Zandi will talk" + self.ZandiSpeaks(1) + else: + print "Zandi is already talking" + + elif id == Activate.id: + for event in events: + if event[0]==1 and event[1]==1: # avatar physically approached Zandi + self.NearZandi = 1 + if not (self.IsTalking or self.IsIgnoring): + self.ZandiSpeaks() + + elif event[0]==1 and event[1]==0: # avatar physically stepped away from Zandi + #~ print "Stepped away" + self.NearZandi = 0 + self.PlayWelcome2 = 0 + + elif id == MultiStage01.id: + print "notified by behavior" + for event in events: + if event[0]==10 and event[2]==3: # A Zandi behavior just finished. Returning to idle animation. + print "zandi is done doing a behavior" + self.DoingBehavior = 0 + break + + elif id in (respBrakeNotReleased.id, respWindmillNotTurning.id, respVisionNotSeen.id, respNoTrailerJC.id, respNoImagerJC.id, respNoBedroomJC.id, respNoWahrkJC.id, respNoSignJC.id, respNoBucketJC.id, respNoDoorJC.id, respDoorNotOpen.id, respZandiSayings.id ): + print "zandi finished talking" + if self.PlayOnFinish: + print "zandi has more to say" + self.PlayOnFinish = 0 + self.ZandiSpeaks() + else: + print "zandi really is done and is ready to say more" + self.IsTalking = 0 + + def OnTimer(self,id): + #~ global firstpauserange + if id < 10: + print "attempt behavior ", id + if not self.DoingBehavior: + print "doing behavior ", id + self.DoingBehavior = 1 + MultiStage01.gotoStage(self.NpcName, id,dirFlag=1,isForward=1) + if type(self.ZandiFace) == type(""): + print "using zandi face anim:", self.ZandiFace + self.NpcName.avatar.playSimpleAnimation(self.ZandiFace) + + elif id == TimerID.TurnPage: + print "attempt turn page" + if not self.DoingBehavior: + print "do turn page" + self.DoingBehavior = 1 + MultiStage01.gotoStage(self.NpcName, 2,dirFlag=1,isForward=1) #turn page + PtAtTimeCallback(self.key, PageTurnInterval, TimerID.TurnPage) + + elif id == TimerID.IgnoreFinished: + print "timer ignorefinished" + if self.NearZandi: + if self.IsTalking: + print "zandi's talking, play on finish" + self.PlayOnFinish = 1 + else: + "speak zandi speak!" + self.ZandiSpeaks() + else: + print "zandi's done ignoring" + self.IsIgnoring = 0 + + + def GetJCProgress(self): + vault = ptVault() + chron = vault.findChronicleEntry("JourneyClothProgress") + jcProgress = "" + if not type(chron) == type(None): + ageChronRefList = chron.getChildNodeRefList() + for ageChron in ageChronRefList: + ageChild = ageChron.getChild() + + ageChild = ageChild.upcastToChronicleNode() + + if ageChild.chronicleGetName() == "Cleft": + return ageChild.chronicleGetValue() + + return "" + + def CheckForJC(self, progress, jc): + print "check for jc" + if jcDict[jc] in progress: + return 1 + else: + return 0 + + def BahroDoorStillClosed(self, sdl): + print "in bahro door still closed" + if sdl["clftBahroDoorClosed"][0]: + return 1 + else: + return 0 + + def BrakeNotReleased(self, sdl): + print "in brake not released" + if sdl["clftAgeSDLWindmillLocked"][0]: + return 1 + else: + return 0 + + def WindmillNotTurning(self, sdl): + print "in windmill not turning" + if sdl["clftAgeSDLWindmillRunning"][0]: + return 0 + else: + return 1 + + def HaventSeenImagerMessage(self): + print "in haven't seen imager message" + vault = ptVault() + entry = vault.findChronicleEntry("YeeshaVisionViewed") + if type(entry) == type(None): + PtDebugPrint("ERROR: clftNpcZandi.HaventSeenImagerMessage: cannot find YeeshaVisionViewed chronicle entry") + return 1 + + if entry.chronicleGetValue() == "1": + return 0 + else: + return 1 + + def NeedsWelcome(self, clicked = 0): + print "in needs welcome" + if self.LastSpeech < 0 and clicked: + print "last speech less than 0 and clicked" + return 1 + + vault = ptVault() + entry = vault.findChronicleEntry("ZandiWelcome") + if type(entry) == type(None): + if not clicked: + vault.addChronicleEntry("ZandiWelcome", 0, "1") + return 1 + + if entry.chronicleGetValue() == "1": + return 0 + else: + if not clicked: + entry.chronicleSetValue("1") + entry.save() + return 1 + + def PlaySecondWelcome(self): + # we're not actually playing the second welcome, but I don't want to break the logic + respZandiSayings.run(self.key, state = "welcome") + self.ZandiFace = "ZandiOpen01Face" + + def ZandiSpeaks(self, clicked = 0): + + # Multistage numbers: + # 0 Idle + # 1 ScratchHead + # 2 TurnPage + # 3 Directions + # 4 CrossLegs + # 5 RubNose + + useSpeech = "2" + + print "last speech:", self.LastSpeech + + self.IsTalking = 1 + stage = whrandom.randint(1,5) + sdl = PtGetAgeSDL() + + if self.PlayWelcome2 and clicked: + if self.LastSpeech >= 0: + print "we've moved past the welcome, so don't play welcome 2" + self.PlayWelcome2 = 0 + else: + print "let's play welcome2" + self.PlaySecondWelcome() + stage = 4 + + if self.NeedsWelcome(clicked): + print "zandi playes the welcome" + respZandiSayings.run(self.key, state = "welcome") + self.ZandiFace = "ZandiOpen01Face" + self.PlayWelcome2 = 1 + stage = 4 + + elif self.BrakeNotReleased(sdl): + if self.LastSpeech != 0: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 0 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + + print "playing brake not released, speech = ", useSpeech + respBrakeNotReleased.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiRes01aFace" + else: + self.ZandiFace = "ZandiRes01bFace" + + elif self.WindmillNotTurning(sdl): + if self.LastSpeech != 1: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 1 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no windmill, speech = ", useSpeech + respWindmillNotTurning.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiRes02aFace" + else: + self.ZandiFace = "ZandiRes02bFace" + + elif self.HaventSeenImagerMessage(): + if self.LastSpeech != 2: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 2 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no imager message, speech = ", useSpeech + respVisionNotSeen.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiRes03aFace" + else: + self.ZandiFace = "ZandiRes03bFace" + + else: + jcProgress = self.GetJCProgress() + if not self.CheckForJC(jcProgress, JC.Trailer): + if self.LastSpeech != 3: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 3 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no trailer jc, speech = ", useSpeech + respNoTrailerJC.run(self.key, useSpeech) + + if useSpeech == "1": + self.ZandiFace = "ZandiJC01aFace" + else: + self.ZandiFace = "ZandiJC01bFace" + + elif not self.CheckForJC(jcProgress, JC.Imager): + if self.LastSpeech != 4: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 4 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no imager jc, speech = ", useSpeech + respNoImagerJC.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiJC02aFace" + else: + self.ZandiFace = "ZandiJC02bFace" + + elif not self.CheckForJC(jcProgress, JC.Bedroom): + if self.LastSpeech != 5: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 5 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no bedroom jc, speech = ", useSpeech + respNoBedroomJC.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiJC03aFace" + else: + self.ZandiFace = "ZandiJC03bFace" + + elif not self.CheckForJC(jcProgress, JC.Wahrk) and not PtIsDemoMode(): + if self.LastSpeech != 6: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 6 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no whark jc, speech = ", useSpeech + respNoWahrkJC.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiJC04aFace" + else: + self.ZandiFace = "ZandiJC04bFace" + + elif not self.CheckForJC(jcProgress, JC.Sign) and not PtIsDemoMode(): + if self.LastSpeech != 7: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 7 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no sign jc, speech = ", useSpeech + respNoSignJC.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiJC05aFace" + else: + self.ZandiFace = "ZandiJC05bFace" + + elif not self.CheckForJC(jcProgress, JC.Bucket): + if self.LastSpeech != 8: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 8 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no bucket jc, speech = ", useSpeech + respNoBucketJC.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiJC06aFace" + else: + self.ZandiFace = "ZandiJC06bFace" + + elif not self.CheckForJC(jcProgress, JC.Door): + if self.LastSpeech != 9: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 9 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing no door jc, speech = ", useSpeech + respNoDoorJC.run(self.key, useSpeech) + if useSpeech == "1": + self.ZandiFace = "ZandiJC07aFace" + else: + self.ZandiFace = "ZandiJC07bFace" + + elif self.BahroDoorStillClosed(sdl): + if self.LastSpeech != 10: + useSpeech = "1" + self.AlreadyPlayed = 0 + self.LastSpeech = 10 + else: + if not clicked: + self.AlreadyPlayed = 1 + else: + if self.AlreadyPlayed: + useSpeech = "2" + else: + useSpeech = "1" + print "playing door not open speech" + respDoorNotOpen.run(self.key) + self.ZandiFace = "ZandiAllFace" + else: + self.LastSpeech = 11 + sayings = ["welcome", "welcome2", "dryheat", "keepexploring", "steak", "pizza", "interrupt"] + usesaying = whrandom.randint(2,6) + useSpeech = sayings[usesaying] + + self.ZandiFace = "ZandiRand0" + str( usesaying - 1) + "Face" + + if useSpeech != "": + print "playing misc, speech = ", useSpeech + respZandiSayings.run(self.key, state = useSpeech) + + PtAtTimeCallback(self.key, 2, stage) + + if not clicked: + PtAtTimeCallback(self.key, IgnoreTime, TimerID.IgnoreFinished) + self.IsIgnoring = 1 diff --git a/Python/clftRS.py b/Python/clftRS.py new file mode 100644 index 0000000000..81bce9841b --- /dev/null +++ b/Python/clftRS.py @@ -0,0 +1,135 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: Riven scope +Age: Cleft +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys + +# define the attributes that will be entered in max +Activate = ptAttribActivator(1, "Activate Telescope",netForce=1) +Camera = ptAttribSceneobject(2,"Telescope camera") +Vignette = ptAttribString(4,"Vignette dialog - by Name") + +# --------- +# globals + + +LocalAvatar = None +Telescope = ptInputInterface() + +class clftRS(ptModifier): + "Standard telescope modifier class" + def __init__(self): + ptModifier.__init__(self) + self.id = 150 + version = 4 + minorVersion = 1 + self.version = version + PtDebugPrint("__init__clftRS v%d.%d" % (version,minorVersion) ) + + def OnFirstUpdate(self): + pass + + def __del__(self): + "unload the dialog that we loaded" + PtUnloadDialog(Vignette.value) + + def OnNotify(self,state,id,events): + "Activated... start telescope" + global LocalAvatar + PtDebugPrint("xTelescope:OnNotify state=%f id=%d events=" % (state,id),events,level=kDebugDumpLevel) + if state and id == Activate.id and PtWasLocallyNotified(self.key): + LocalAvatar = PtFindAvatar(events) + self.IStartTelescope() + + + def OnGUINotify(self,id,control,event): + "Notifications from the vignette" + PtDebugPrint("GUI Notify id=%d, event=%d control=" % (id,event),control,level=kDebugDumpLevel) + if event == kDialogLoaded: + # if the dialog was just loaded then show it + control.show() + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode: + self.IQuitTelescope() + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + self.IQuitTelescope() + + def IStartTelescope(self): + "Start the action of looking at the telescope" + global LocalAvatar + # disable the activator (only one in the telescope at a time) + PtSendKIMessage(kDisableKIandBB,0) + self.IEngageTelescope() + + def IEngageTelescope(self): + global Telescope + + Telescope.pushTelescope() + # Disable First Person Camera + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + # set camera to telescope + virtCam = ptCamera() + virtCam.save(Camera.sceneobject.getKey()) + # show the cockpit + if type(Vignette.value) != type(None) and Vignette.value != "": + PtLoadDialog(Vignette.value,self.key) + if ( PtIsDialogLoaded(Vignette.value) ): + PtShowDialog(Vignette.value) + # get control key events + PtEnableControlKeyEvents(self.key) + + def IQuitTelescope(self): + "Disengage and exit the telescope mode" + global LocalAvatar + global Telescope + + Telescope.popTelescope() + # exit every thing + if type(Vignette.value) != type(None) and Vignette.value != "": + PtHideDialog(Vignette.value) + virtCam = ptCamera() + virtCam.restore(Camera.sceneobject.getKey()) + PtRecenterCamera() + #disable the Control key events + PtDisableControlKeyEvents(self.key) + #Re-enable first person camera + cam = ptCamera() + cam.enableFirstPersonOverride() + PtAtTimeCallback(self.key,3,1) # wait for player to finish exit one-shot, then reenable clickable + PtDebugPrint("xTelescope.IQuitTelescope:\tdelaying clickable reenable",level=kDebugDumpLevel) + + def OnTimer(self,id): + if id==1: + PtSendKIMessage(kEnableKIandBB,0) diff --git a/Python/clftTreeLadder.py b/Python/clftTreeLadder.py new file mode 100644 index 0000000000..110be707a8 --- /dev/null +++ b/Python/clftTreeLadder.py @@ -0,0 +1,78 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: clftTreeLadder +Age: Cleft +Date: July 2002 +Author: Doug McBride +Manages ladder in the tree of the Cleft. +""" + +from Plasma import * +from PlasmaTypes import * +import PlasmaControlKeys + + +# define the attributes that will be entered in max + +Detector01 = ptAttribActivator(1, "Detector at top",netForce=1) +MultiStage01 = ptAttribBehavior(2, "The multistage behavior",netForce=1) +audioresponder = ptAttribResponder(3, 'Audio responder') +direction = ptAttribString(4, 'Direction: Going up or down?', 'down') #thank your local sound guy for this hack + +LocalAvatar = None + + +class clftTreeLadder(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5214 + + version = 4 + self.version = version + print "__init__clftTreeLadder v.", version + + def OnFirstUpdate(self): + pass + + def Load(self): + pass + + def OnNotify(self,state,id,events): + LocalAvatar = PtFindAvatar(events) + for event in events: + if event[0] == 1: + MultiStage01.run(LocalAvatar) + + elif event[0] == 10 and event[1] == 1 and (direction.value) == "up": # going up + audioresponder.run(self.key) + print "Playing sfx for climbing out of the tree" + + elif event[0] == 10 and event[1] == 0 and (direction.value) == "down": # going down + audioresponder.run(self.key) + print "Playing sfx for climbing into the tree" + + diff --git a/Python/clftWindmill.py b/Python/clftWindmill.py new file mode 100644 index 0000000000..fe5d4c6bd7 --- /dev/null +++ b/Python/clftWindmill.py @@ -0,0 +1,237 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: clftWindmill.py +Age: clftWindmill +Date: October 2002 +event manager hooks for the clftWindmill +""" + +from Plasma import * +from PlasmaTypes import * + + +clickLever = ptAttribActivator(4,"lever clickable") +clickLockCW = ptAttribActivator(5,"clickable CW locked") +clickLockStart = ptAttribActivator(6,"clickable CCW locked / Start") +respLockedCCW = ptAttribResponder(7,"responder CCW Locked") +behLockedCCW = ptAttribBehavior(10,"locked CCW behavior") +behStartWindmill = ptAttribBehavior(11,"start windmill behavior") +respStart = ptAttribResponder(13,"responder Start Windmill",['Start']) +stringSDLVarLocked = ptAttribString(14,"SDL Bool locked windmill") +stringSDLVarRunning = ptAttribString(15,"SDL Bool windmill running") +respStartAtLoad = ptAttribResponder(16,"start windmill at load") +respLightsOnOff = ptAttribResponder(17,"lights on off",['On','Off']) +stringSDLVarUnstuck = ptAttribString(18,"SDL Bool unstuck windmill") +respImagerButtonLight = ptAttribResponder(19,"Imager button light on off",['On','Off']) +respBrakeOff = ptAttribResponder(20,"resp: Gear lever up") +respBrakeOn = ptAttribResponder(21,"resp: Gear lever back") +respBrakeOffAtStart = ptAttribResponder(22,"resp: Gear lever up at start") +respBrakeOnAtStart = ptAttribResponder(23,"resp: Gear lever back at start") +respStop = ptAttribResponder(24,"stop windmill",['Stop']) +respGrinderOn = ptAttribResponder(25,"resp: Grinder wheel on") +respGrinderOff = ptAttribResponder(26,"resp: Grinder wheel off") + + +# globals +windmillLocked = 1 +windmillRunning = 0 +windmillUnstuck = 0 +boolTomahnaActive = 0 +stopGrinder = 0 + + +class clftWindmill(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 50248353 + self.version = 10 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global windmillLocked + global windmillRunning + global windmillUnstuck + global boolTomahnaActive + + if type(stringSDLVarLocked.value) == type("") and stringSDLVarLocked.value != "": + self.ageSDL = PtGetAgeSDL() + self.ageSDL.setFlags(stringSDLVarLocked.value,1,1) + self.ageSDL.sendToClients(stringSDLVarLocked.value) + else: + PtDebugPrint("clftWindmill.OnFirstUpdate():\tERROR: missing SDL var locked in max file") + + if type(stringSDLVarRunning.value) == type("") and stringSDLVarRunning.value != "": + self.ageSDL = PtGetAgeSDL() + self.ageSDL.setFlags(stringSDLVarRunning.value,1,1) + self.ageSDL.sendToClients(stringSDLVarRunning.value) + else: + PtDebugPrint("clftWindmill.OnFirstUpdate():\tERROR: missing SDL var running in max file") + + respLightsOnOff.run(self.key,state='Off') + respImagerButtonLight.run(self.key,state='Off') + + if type(stringSDLVarUnstuck.value) == type("") and stringSDLVarUnstuck.value != "": + self.ageSDL = PtGetAgeSDL() + self.ageSDL.setFlags(stringSDLVarUnstuck.value,1,1) + self.ageSDL.sendToClients(stringSDLVarUnstuck.value) + else: + PtDebugPrint("clftWindmill.OnFirstUpdate():\tERROR: missing SDL var unstuck in max file") + + #self.ResetImager() + self.ageSDL = PtGetAgeSDL() + + # register for notification of locked SDL var changes + self.ageSDL.setNotify(self.key,stringSDLVarLocked.value,0.0) + + SDLVarTomahnaActive = "clftTomahnaActive" + boolTomahnaActive = self.ageSDL[SDLVarTomahnaActive][0] + + # get initial SDL state + windmillLocked = 1 + try: + windmillLocked = self.ageSDL[stringSDLVarLocked.value][0] + except: + windmillLocked = 1 + PtDebugPrint("ERROR: clftWindmill.OnServerInitComplete():\tERROR: age sdl read failed, defaulting windmill locked") + if windmillLocked == 0: + respBrakeOffAtStart.run(self.key) + elif windmillLocked == 1: + respBrakeOnAtStart.run(self.key) + +# register for notification of running SDL var changes + self.ageSDL.setNotify(self.key,stringSDLVarRunning.value,0.0) + + # get initial SDL state + windmillRunning = 0 + try: + windmillRunning = self.ageSDL[stringSDLVarRunning.value][0] + except: + windmillRunning = 0 + PtDebugPrint("ERROR: clftWindmill.OnServerInitComplete():\tERROR: age sdl read failed, defaulting windmill stopped") + if windmillRunning == 1: + respStartAtLoad.run(self.key) + respLightsOnOff.run(self.key,state='On') + respGrinderOn.run(self.key) + if boolTomahnaActive == 0: + PtDebugPrint("clftWindmill.OnServerInitComplete: SDL says Tomahna is active, will set Imager light on...") + respImagerButtonLight.run(self.key,state='On') + + + # register for notification of running SDL var changes + self.ageSDL.setNotify(self.key,stringSDLVarUnstuck.value,0.0) + + # get initial SDL state + windmillUnstuck = 0 + try: + windmillUnstuck = self.ageSDL[stringSDLVarUnstuck.value][0] + except: + windmillUnstuck = 0 + PtDebugPrint("ERROR: clftWindmill.OnServerInitComplete():\tERROR: age sdl read failed, defaulting windmill stuck") + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global windmillLocked + global windmillRunning + global windmillUnstuck + global boolTomahnaActive + global stopGrinder + + self.ageSDL = PtGetAgeSDL() + + if VARname == stringSDLVarLocked.value: + windmillLocked = self.ageSDL[stringSDLVarLocked.value][0] + PtDebugPrint("clftWindmill.OnSDLNotify():\t windmill locked ", windmillLocked) + if windmillLocked ==1 and windmillRunning == 0: + respBrakeOn.run(self.key,avatar=PtGetLocalAvatar()) + if windmillLocked == 1 and windmillRunning == 1: + PtDebugPrint("clftWindmill.OnSDLNotify: Both running and locked are 1, so stop windmill.") + stopGrinder = 1 + respBrakeOn.run(self.key,avatar=PtGetLocalAvatar()) + #respStop.run(self.key,state='Stop',avatar=PtGetLocalAvatar()) + #respLightsOnOff.run(self.key,state='Off',avatar=PtGetLocalAvatar()) + #respImagerButtonLight.run(self.key,state='Off',avatar=PtGetLocalAvatar()) + #windmillRunning = 0 + #self.ageSDL[stringSDLVarRunning.value] = (windmillRunning,) + elif windmillLocked == 0 and windmillUnstuck == 1: + respBrakeOff.run(self.key,avatar=PtGetLocalAvatar()) + PtDebugPrint("clftWindmill.OnSDLNotify: Locked is 0 and windmillUnstuck is 1, run StartAtLoad.") + #respStartAtLoad.run(self.key,avatar=PtGetLocalAvatar()) + #respLightsOnOff.run(self.key,state='On',avatar=PtGetLocalAvatar()) + windmillRunning = 1 + #self.ageSDL[stringSDLVarRunning.value] = (windmillRunning,) + #if boolTomahnaActive == 0: + #respImagerButtonLight.run(self.key,state='On',avatar=PtGetLocalAvatar()) + elif windmillLocked == 0 and windmillUnstuck == 0: + respBrakeOff.run(self.key,avatar=PtGetLocalAvatar()) + + + def OnNotify(self,state,id,events): + global windmillLocked + global windmillRunning + global windmillUnstuck + global boolTomahnaActive + global stopGrinder + + self.ageSDL = PtGetAgeSDL() + + if (id == clickLockStart.id and state): + if windmillLocked == 0: + respStart.run(self.key,state='Start',avatar=PtGetLocalAvatar()) + respLightsOnOff.run(self.key,state='On',avatar=PtGetLocalAvatar()) + respGrinderOn.run(self.key) + if boolTomahnaActive == 0: + respImagerButtonLight.run(self.key,state='On',avatar=PtGetLocalAvatar()) + windmillRunning = 1 + self.ageSDL[stringSDLVarRunning.value] = (windmillRunning,) + windmillUnstuck = 1 + self.ageSDL[stringSDLVarUnstuck.value] = (windmillUnstuck,) + elif windmillLocked == 1: + respLockedCCW.run(self.key,avatar=PtGetLocalAvatar()) + + if (id == respBrakeOn.id): + if stopGrinder: + respGrinderOff.run(self.key) + stopGrinder = 0 + respStop.run(self.key,state='Stop',avatar=PtGetLocalAvatar()) + respLightsOnOff.run(self.key,state='Off',avatar=PtGetLocalAvatar()) + respImagerButtonLight.run(self.key,state='Off',avatar=PtGetLocalAvatar()) + windmillRunning = 0 + self.ageSDL[stringSDLVarRunning.value] = (windmillRunning,) + + if (id == respBrakeOff.id): + if windmillRunning == 1: + respGrinderOn.run(self.key) + respStartAtLoad.run(self.key,avatar=PtGetLocalAvatar()) + respLightsOnOff.run(self.key,state='On',avatar=PtGetLocalAvatar()) + self.ageSDL[stringSDLVarRunning.value] = (windmillRunning,) + if boolTomahnaActive == 0: + respImagerButtonLight.run(self.key,state='On',avatar=PtGetLocalAvatar()) diff --git a/Python/clftYeeshaPage08.py b/Python/clftYeeshaPage08.py new file mode 100644 index 0000000000..0662b6186e --- /dev/null +++ b/Python/clftYeeshaPage08.py @@ -0,0 +1,225 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: clftYeeshaPage08 +Age: Cleft +Date: May 2003 +Author: Adam Van Ornum +Manages and records the finding of Yeesha Pages +!!! NOTE: This file only applies to the cleft but is only used in the global xYeeshaPagesGUI.max file. !!! +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from PlasmaVaultConstants import * +from PlasmaNetConstants import * + + +# define the attributes that will be entered in max +actClickableBook = ptAttribNamedActivator(1,"Act: Clickable Yeesha Page") +GUIDialogObject = ptAttribSceneobject(2, "GUIDialog scene object") +RespOpen = ptAttribResponder(3, "Open Responder") +RespLoop = ptAttribResponder(4, "Loop Responder") +RespClose = ptAttribResponder(5, "Close Responder") + +#Linking Books GUI tags +DialogName="YeeshaPageGUI" + +kPageButton = 100 + +kYeeshaPage01 = 201 +kYeeshaPage02 = 202 +kYeeshaPage03 = 203 +kYeeshaPage04 = 204 +kYeeshaPage05 = 205 +kYeeshaPage06 = 206 +kYeeshaPage07 = 207 +kYeeshaPage08 = 208 +kYeeshaPage09 = 209 +kYeeshaPage10 = 210 +kYeeshaPage12 = 212 +kYeeshaPage13 = 213 +kYeeshaPage14 = 214 +kYeeshaPage15 = 215 +kYeeshaPage16 = 216 +kYeeshaPage17 = 217 +kYeeshaPage18 = 218 +kYeeshaPage19 = 219 +kYeeshaPage20 = 220 +kYeeshaPage21 = 221 +kYeeshaPage22 = 222 +kYeeshaPage23 = 223 +kYeeshaPage24 = 224 +kYeeshaPage25 = 225 +kYeeshaPageCancel = 299 + +isOpen = 0 + + +class clftYeeshaPage08(ptModifier): + "The Yeesha Page 08 cleft imager python code" + def __init__(self): + ptModifier.__init__(self) + self.id = 5312 + self.version = 1 + print "__init__clftYeeshaPage08 v.", self.version + + + def OnFirstUpdate(self): + PtLoadDialog(DialogName, self.key) + pass + + + def __del__(self): + "destructor - get rid of any dialogs that we might have loaded" + #~ PtUnloadDialog(DialogName) + + + def OnNotify(self,state,id,events): + global LocalAvatar + global isOpen + + if id == actClickableBook.id and state and PtWasLocallyNotified(self.key): + #if not PtIsDialogLoaded(DialogName): + # PtLoadDialog(DialogName,self.key) + + self.SetStdGUIVisibility(0) + PtShowDialog(DialogName) + RespOpen.run(self.key) + isOpen = 1 + + elif id == actClickableBook.id and not state and PtWasLocallyNotified(self.key): + if not isOpen: + self.SetStdGUIVisibility(0) + PtShowDialog(DialogName) + RespOpen.run(self.key) + isOpen = 1 + + elif id == RespOpen.id: + RespLoop.run(self.key) + + + def OnGUINotify(self,id,control,event): + global isOpen + btnID = 0 + if isinstance(control,ptGUIControlButton): + btnID = control.getTagID() + + if event == kShowHide: + if control.isEnabled(): + #control.show() + if self.GotPage(): + mydialog = PtGetDialogFromString(DialogName) + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage08)).disable() + + elif event == kAction and btnID == kYeeshaPage08: + PtDebugPrint("DEBUG: clftYeeshaPage08.OnGUINotify():\tPicked up page") + + RespClose.run(self.key) + isOpen = 0 + PtHideDialog(DialogName) + self.SetStdGUIVisibility(1) + + if self.GotPage(): + PtDebugPrint ("DEBUG: clftYeeshaPage08.py: You've already found Yeesha Page #8. Move along. Move along.") + return + else: + PtDebugPrint ("DEBUG: clftYeeshaPage08.py: Yeesha Page #8 is new to you.") + PtDebugPrint ("DEBUG: clftYeeshaPage08.py: Trying to update the value of the SDL variable %s to 1" % ("YeeshaPage8")) + vault = ptVault() + if type(vault) != type(None): #is the Vault online? + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + YeeshaPageVar = psnlSDL.findVar("YeeshaPage8") + YeeshaPageVar.setInt(1) + vault.updatePsnlAgeSDL (psnlSDL) + mydialog = PtGetDialogFromString(DialogName) + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage08)).disable() + PtSendKIMessageInt(kStartBookAlert,0) + + elif event == kAction and btnID == kYeeshaPageCancel: + RespClose.run(self.key) + isOpen = 0 + PtHideDialog(DialogName) + self.SetStdGUIVisibility(1) + + + def GotPage(self): + vault = ptVault() + if type(vault) != type(None): #is the Vault online? + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + YeeshaPageVar = psnlSDL.findVar("YeeshaPage8") + PtDebugPrint ("DEBUG: clftYeeshaPage08.py: The previous value of the SDL variable %s is %s" % ("YeeshaPage8", YeeshaPageVar.getInt())) + if YeeshaPageVar.getInt() != 0: + PtDebugPrint ("DEBUG: clftYeeshaPage08.py: You've already found Yeesha Page #8. Move along. Move along.") + return 1 + else: + return 0 + else: + PtDebugPrint("ERROR: clftYeeshaPage08: Error trying to access the Chronicle psnlSDL. psnlSDL = %s" % ( psnlSDL)) + return 0 + else: + PtDebugPrint("ERROR: clftYeeshaPage08: Error trying to access the Vault. Can't access YeeshaPageChanges chronicle." ) + return 0 + + + def SetStdGUIVisibility(self, visible): + global DialogName + + if visible: + GUIDialogObject.value.draw.enable() + else: + mydialog = PtGetDialogFromString(DialogName) + + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage01)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage02)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage03)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage04)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage05)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage06)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage07)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage09)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage10)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage12)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage13)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage14)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage15)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage16)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage17)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage18)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage19)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage20)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage21)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage22)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage23)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage24)).hide() + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage25)).hide() + + ptGUIControlButton(mydialog.getControlFromTag(kYeeshaPage08)).show() + + GUIDialogObject.value.draw.disable() \ No newline at end of file diff --git a/Python/clftYeeshaPageImager.py b/Python/clftYeeshaPageImager.py new file mode 100644 index 0000000000..c48cb11511 --- /dev/null +++ b/Python/clftYeeshaPageImager.py @@ -0,0 +1,212 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: clftYeeshaPageImager +Age: Cleft +Date: February 2002 +Author: Doug McBride +Controls Imager which currently displays Yeesha Page #8 +""" + +from Plasma import * +from PlasmaTypes import * +import whrandom +import time +import PlasmaControlKeys + +# define the attributes that will be entered in max +ActImager = ptAttribActivator(1,"Imager button") +AvatarOneshot = ptAttribResponder(2,"Rspdnr: Player avatar oneshot") +ImagerOpen = ptAttribResponder(3,"Rspdnr: Imager Open") +ImagerLoop = ptAttribResponder(4,"Rspdnr: Imager Loop") +ImagerClose = ptAttribResponder(5,"Rspdnr: Imager Close") +ClickForGUI = ptAttribActivator(6,"Clickable to get page") + +GreenLightResp = ptAttribResponder(7,"Rspdnr: Green light", ["Solid", "Blinking", "Off"]) + +# globals +PlayFull = 0 # Determines whether full vision will play or not. 0 = partial, 1 = full +visionplaying = 0 +AgeStartedIn = None +inTomahna = 0 + + +class clftYeeshaPageImager(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5201 + + version = 5 + self.version = version + print "__init__clftYeeshaPageImager v.", version + self.ImagerUsable = 1 + + + def OnFirstUpdate(self): + global PlayFull + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + PtUnloadDialog("YeeshaPageGUI") + whrandom.seed() + self.CloseImager(1) + + + def __del__(self): + PtUnloadDialog("YeeshaPageGUI") + + + def OnServerInitComplete(self): + global PlayFull + global inTomahna + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + ageSDL.setNotify(self.key,"clftYeeshaPage08Vis",0.0) + self.ImagerUsable = ageSDL["clftYeeshaPage08Vis"][0] + print "ServerInitComplete: ImagerUsable: %d" % self.ImagerUsable + + ageSDL.setNotify(self.key, "clftAgeSDLWindmillRunning", 0.0) + + powerOn = ageSDL["clftAgeSDLWindmillRunning"][0] + + inTomahna = 0 + if ageSDL["clftTomahnaActive"][0] == 1: + PlayFull = 1 + inTomahna = 1 + + if powerOn: + if inTomahna: + GreenLightResp.run(self.key, state = "Blinking") + #print "starting blinking green light" + else: + GreenLightResp.run(self.key, state = "Solid") + #print "starting solid green light" + else: + GreenLightResp.run(self.key, state = "Off") + #print "green light is off" + + if inTomahna: + PtLoadDialog("YeeshaPageGUI") + + + def OnSDLNotify(self,VARname,SDLname,PlayerID,tag): + print "clftYeeshaPageImager.OnSDLNotify(): var = ",VARname + global inTomahna + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + if VARname == "clftYeeshaPage08Vis": + self.ImagerUsable = ageSDL["clftYeeshaPage08Vis"][0] + elif VARname == "clftAgeSDLWindmillRunning": + powerOn = ageSDL["clftAgeSDLWindmillRunning"][0] + if powerOn: + if inTomahna: + GreenLightResp.run(self.key, state = "Blinking") + #print "starting blinking green light" + else: + GreenLightResp.run(self.key, state = "Solid") + #print "starting solid green light" + else: + GreenLightResp.run(self.key, state = "Off") + #print "green light is off" + self.CloseImager() + + + def OnNotify(self,state,id,events): + global PlayFull + global visionplaying + + if not state: + return + + print "clftYeeshaPageImager.OnNotify()" + print "ImagerUsable: %d" % self.ImagerUsable + + for event in events: + #~ print "YP events: ", event + if event[0]==2 and event[1]==1 and id == ActImager.id: # play avatar oneshot, regardless of whether button is going on or off + print "clftYeeshaPageImager.OnNotify():Imager Button pressed. Playfull = ", PlayFull + if PtWasLocallyNotified(self.key): + #AvatarOneshot.run(self.key,events=events) + AvatarOneshot.run(self.key,avatar=PtGetLocalAvatar()) + + elif event[0]==8 and event[1]==1: # A "Notify triggerer" command was received from one of several responders. The id distinguishes which it is + if not self.ImagerUsable: + # imager not usable and event is something other than the oneshot + print "clftYeeshaPageImager.OnNotify(): imager should be not working right now" + ActImager.enable() + return + + if id == AvatarOneshot.id: # The marker TouchButton marker was reached in the avatar oneshot. Now turn it on or off. + if visionplaying == 0: + self.OpenImager() + elif visionplaying == 1: + self.CloseImager() + + elif id == ImagerOpen.id: #the Imager Open animation sequences completed. Determine if we should loop or auto shut off. + if PlayFull != 1: +# print "Closing. Playfull = ", PlayFull + self.CloseImager() + else: + # imager is done opening and it is starting to loop so enable the clickable + ActImager.enable() +# print "Will loop indefinitely. Playfull = ", PlayFull + ImagerLoop.run(self.key) + + elif id == ImagerClose.id: # imager close anim is complete, reenable clickable. + pass + #ActImager.enable() ## gets enabled in MAX + + + def OpenImager(self): + global visionplaying + global PlayFull + + print "clftYeeshaPageImager: Turning on YP Imager" + + # disable imager clickable so it can't be turned off while opening + ActImager.disable() + + ImagerOpen.run(self.key) + visionplaying = 1 + + if PlayFull == 1: + ClickForGUI.enable() + + + def CloseImager(self,ff=0): + global visionplaying + print "clftYeeshaPageImager: Turning off YP Imager" + + # disable imager clickable so it can't be turned off while closing + ActImager.disable() + + ImagerClose.run(self.key) + visionplaying = 0 + + ClickForGUI.disable() + diff --git a/Python/dsntKILightMachine.py b/Python/dsntKILightMachine.py new file mode 100644 index 0000000000..ff59627ac9 --- /dev/null +++ b/Python/dsntKILightMachine.py @@ -0,0 +1,241 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Module: dsntKILightMachine +# Age: Descent +# Upgrades a player's KI to emit light for a duration +# April 2007 + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import string + + +#============================================================= +# define the attributes that will be entered in max +#============================================================= + +clkDispensor = ptAttribActivator(1,"clk: KI dispensor") +respDispensor = ptAttribResponder(2,"resp: KI dispensor") +respGotKI = ptAttribResponder(3,"resp: got KI") +sdlKILightFunc = ptAttribString(4,"sdl: KI light func") + + +#---------- +# globals +#---------- + +IsAvatarLocal = 0 +LocalAvatar = None +byteKILightFunc = 0 +lightStop = 0 +lightOn = 0 + + +#---------- +# constants +#---------- +kLightTimeShort = 5 +kLightTimeLong = 60 +listLightResps = ["respKILightOff","respKILightOn"] +kLightStopID = 1 +kKILightShortSFXRespName = "respSFX-KILight-Short" +KILightObjectName = "RTOmniKILight" + + +class dsntKILightMachine(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5670 + self.version = 3 + PtDebugPrint("DEBUG: dsntKILightMachine.__init__():\tInitalizing dsntKILightMachine v.%s" % self.version) + + + def OnServerInitComplete(self): + #PtDebugPrint("DEBUG: dsntKILightMachine.OnServerInitComplete()") + global byteKILightFunc + + if sdlKILightFunc.value != "": + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(sdlKILightFunc.value,1,1) + ageSDL.sendToClients(sdlKILightFunc.value) + ageSDL.setNotify(self.key,sdlKILightFunc.value,0.0) + try: + byteKILightFunc = ageSDL[sdlKILightFunc.value][0] + except: + PtDebugPrint("ERROR: dsntKILightMachine.OnServerInitComplete():\tERROR reading SDL name for KI light func") + byteKILightFunc = 0 + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + #PtDebugPrint("DEBUG: dsntKILightMachine.OnSDLNotify()") + global byteKILightFunc + + if VARname == sdlKILightFunc.value: + ageSDL = PtGetAgeSDL() + byteKILightFunc = ageSDL[sdlKILightFunc.value][0] + + + + + + def OnNotify(self,state,id,events): + #PtDebugPrint("dsntKILightMachine.OnNotify(): Notify event state=%f,id=%d,events=" % (state,id),events) + global IsAvatarLocal + global LocalAvatar + +# if not state: +# return + + if id == clkDispensor.id: + LocalAvatar = PtFindAvatar(events) + if LocalAvatar == PtGetLocalAvatar(): + IsAvatarLocal = 1 + else: + IsAvatarLocal = 0 + respDispensor.run(self.key,events=events) + + elif id == respDispensor.id: + kiLevel = PtGetLocalKILevel() + if kiLevel > 1: + print "dsntKILightMachine.OnNotify(): you've got your KI, proceeding..." + respGotKI.run(self.key) + else: + print "dsntKILightMachine.OnNotify(): you don't have your KI yet, machine won't respond" + + elif id == respGotKI.id: + if IsAvatarLocal: + IsAvatarLocal = 0 + if not lightOn: + PtSendKIMessage(kStartKIAlert,0) + self.SetKILightTime(1) + else: + print "light already on, resetting..." + self.SetKILightTime(2) + + + def SetKILightTime(self,on): + global lightStop + global lightOn + print "dsntKILightMachine.SetKILightTime(): byteKILightFunc = ",byteKILightFunc + lightStart = PtGetDniTime() + + if not byteKILightFunc: + return + elif byteKILightFunc == 1: + lightStop = (lightStart + kLightTimeShort) + elif byteKILightFunc == 2: + lightStop = (lightStart + kLightTimeLong) + + timeRemaining = (lightStop - lightStart) + print "timer set, light will shut off in ",timeRemaining," seconds; lightStop = ",lightStop + self.SetKILightChron(0) + + if on == 1: + self.DoKILight(1,0,timeRemaining) + elif on == 2: + PtAtTimeCallback(self.key,timeRemaining,kLightStopID) + print "light was reset, so don't run the responder as it's already on" + + + def SetKILightChron(self,remaining): + vault = ptVault() + entry = vault.findChronicleEntry("KILightStop") + if type(entry) != type(None): + entryValue = entry.chronicleGetValue() + oldVal = string.atoi(entryValue) + if remaining == oldVal: + return + print "set KI light chron to: ",remaining + entry.chronicleSetValue("%d" % (remaining)) + entry.save() + else: + vault.addChronicleEntry("KILightStop",1,"%d" % (remaining)) + PtDebugPrint("Chronicle entry KILight not present, adding entry and setting time to shutoff") + + + def OnTimer(self,id): + #print "dsntKILightMachine.OnTimer(): id = ",id + if id == kLightStopID: + curTime = PtGetDniTime() + print "dsntKILightMachine.OnTimer(): lightStop = ",lightStop,", curTime = ",curTime + if curTime >= (lightStop - 1): + self.DoKILight(0,0) + else: + print "dsntKILightMachine.OnTimer(): timer says shut off light, but times don't match. Light must have been reset, ignoring this callback" + + + def DoKILight(self,state,ff,remaining=0): + global lightOn + + indexResp = state + if indexResp == 2: + indexResp = 1 + thisResp = listLightResps[indexResp] + + LocalAvatar = PtGetLocalAvatar() + avatarKey = LocalAvatar.getKey() + avatarObj = avatarKey.getSceneObject() + respList = avatarObj.getResponders() + + if len(respList) > 0: + PtDebugPrint("dsntKILightMachine.DoKILight(): ...responder list:") + for resp in respList: + PtDebugPrint(" %s" % (resp.getName())) + if resp.getName() == thisResp: + PtDebugPrint("found KI light resp: %s" % (thisResp)) + atResp = ptAttribResponder(42) + atResp.__setvalue__(resp) + atResp.run(self.key,avatar=LocalAvatar,fastforward=ff) + if state: + PtAtTimeCallback(self.key,remaining,kLightStopID) + print "dsntKILightMachine.DoKILight(): turning light on for ",remaining," seconds" + lightOn = 1 + else: + print "dsntKILightMachine.DoKILight(): light is shut off, updating chron if it needs it" + self.SetKILightChron(remaining) + lightOn = 0 + PtSetLightAnimStart(avatarKey, KILightObjectName, false) + elif resp.getName() == kKILightShortSFXRespName and remaining == kLightTimeShort: + PtDebugPrint("dsntKILightMachine.DoKILight():\tRunning short KI Light SFX") + sndResp = ptAttribResponder(43) + sndResp.__setvalue__(resp) + sndResp.run(self.key) + else: + PtDebugPrint("dsntKILightMachine.ISetLight(): ERROR! couldn't find any responders") + + + def BeginAgeUnLoad(self,avObj): + if not lightOn: + return + + if (LocalAvatar == avObj): + print "dsntKILightMachine.BeginAgeUnLoad()-->\tavatar page out" + curTime = PtGetDniTime() + timeRemaining = (lightStop - curTime) + if timeRemaining > 0: + self.DoKILight(0,1,timeRemaining) + diff --git a/Python/dsntWatsonGUIPopup.py b/Python/dsntWatsonGUIPopup.py new file mode 100644 index 0000000000..7fa4837d84 --- /dev/null +++ b/Python/dsntWatsonGUIPopup.py @@ -0,0 +1,221 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: dsntWatsonGUIPopup +Age: Descent +Date: January 2004 + +Special version of xJournalBooksGUIPopup, for use in Expansion 1 +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * +from PlasmaKITypes import * +import string +import xLocalization + + +# define the attributes that will be entered in max +actClickableBook = ptAttribActivator(1,"Actvtr: Clickable small book") +SeekBehavior = ptAttribBehavior(2, "Smart seek before GUI (optional)") +JournalName = ptAttribString(3, 'Name of Journal', '') +StartOpen = ptAttribBoolean(10,"Start Opened",default=0) + +# globals +LocalAvatar = None + +# the global ptBook object.... there can only be one book displayed at one time, so only one global needed (hopefully) +gJournalBook = None + +# stores a list of the last pages of each journal we had open, so we go to the same place +kLastPageOpenChronicle = "LastJournalPageArray" +kChronicleType = 0 + +class dsntWatsonGUIPopup(ptModifier): + "Watson's Journal GUI Popup python code" + def __init__(self): + ptModifier.__init__(self) + self.id = 5656 + self.version = 1 + self.curPage = 0 + + def IGetLastPageMap(self): + vault = ptVault() + chronicle = vault.findChronicleEntry(kLastPageOpenChronicle) + chronicleValue = "" + if type(chronicle) != type(None): + chronicle = chronicle.upcastToChronicleNode() + chronicleValue = chronicle.chronicleGetValue() + values = chronicleValue.split(",") + try: + values.remove('') # remove the trailing blank item if there is one + except: + pass + if len(values) == 0: + # values is an empty list, but if we return it stuff breaks + # so lets just return an empty dictionary instead + return {} + map = {} + for item in values: + parts = item.split(":") + try: + if parts[0] == "" or parts[1] == "": + PtDebugPrint("xJournalBookGUIPopup.IGetLastPageMap(): Item "+str(item)+" is probably in the old format, skipping") + continue # possibly old format, so skip it + except: + PtDebugPrint("xJournalBookGUIPopup.IGetLastPageMap(): Item "+str(item)+" is probably in the old format, skipping") + continue # possibly old format, so skip it + key = parts[0] + value = int(parts[1]) + map[key] = value + return map + + def IWriteLastPageMap(self,map): + vault = ptVault() + chronicleValue = "" + keys = xLocalization.xJournalBookDefs.xJournalBooks.keys() + for key in keys: + chronicleValue += key + ":" + str(map[key]) + "," + vault.addChronicleEntry(kLastPageOpenChronicle,kChronicleType,chronicleValue) + + def OnServerInitComplete(self): + values = self.IGetLastPageMap() + + numJournals = len(xLocalization.xJournalBookDefs.xJournalBooks) + if len(values) < numJournals: + # expand the list so it has an entry for all the journals + PtDebugPrint("xJournalBookGUIPopup: Not enough page entries in the chronicle value, fleshing it out") + keys = xLocalization.xJournalBookDefs.xJournalBooks.keys() + for key in keys: + try: + page = values[key] # if this fails, then the book is missing and needs to be added + except: + values[key] = 1 + self.IWriteLastPageMap(values) + + def __del__(self): + "destructor - get rid of any dialogs that we might have loaded" + pass + + def OnNotify(self,state,id,events): + global LocalAvatar + + # is it a clickable book on a pedestal? + if id == actClickableBook.id: + if PtWasLocallyNotified(self.key) and state: + PtToggleAvatarClickability(false) + if type(SeekBehavior.value) != type(None): #remember, smart seek before GUI is optional. + PtDebugPrint("xJournalBookGUIPopup: Smart seek used",level=kDebugDumpLevel) + LocalAvatar = PtFindAvatar(events) + SeekBehavior.run(LocalAvatar) + return + self.IShowBook() + return + + # is it the seek behavior because we clicked on a book ourself? + elif id == SeekBehavior.id: + if PtWasLocallyNotified(self.key): + for event in events: + if event[0] == kMultiStageEvent and event[2] == kEnterStage: # Smart seek completed. Exit multistage, and show GUI. + SeekBehavior.gotoStage(LocalAvatar, -1) + PtDebugPrint("xJournalBookGUIPopup: attempting to draw link panel gui",level=kDebugDumpLevel) + self.IShowBook() + + # else was it one of the unknown id types? like scene input interface or from a ptBook? + else: + for event in events: + # is it from the OpenBook? (we only have one book to worry about) + if event[0] == PtEventType.kBook: + PtDebugPrint("xJournalBookGUIPopup: BookNotify event=%d, id=%d" % (event[1],event[2]),level=kDebugDumpLevel) + if event[1] == PtBookEventTypes.kNotifyShow: + PtDebugPrint("xJournalBookGUIPopup:Book: NotifyShow",level=kDebugDumpLevel) + if self.curPage > 1: + PtDebugPrint("xJournalBookGUIPopup: The last page that "+JournalName.value+" was on was page "+str(self.curPage)+". Going to that page") + gJournalBook.open(0) + gJournalBook.goToPage(self.curPage) + if event[1] == PtBookEventTypes.kNotifyHide: + PtToggleAvatarClickability(true) + PtDebugPrint("xJournalBookGUIPopup:Book: NotifyHide",level=kDebugDumpLevel) + PtDebugPrint("xJournalBookGUIPopup: Saving the last page we were at to the chronicle: "+str(self.curPage)) + lastPageList = self.IGetLastPageMap() + lastPageList[JournalName.value] = self.curPage + self.IWriteLastPageMap(lastPageList) + elif event[1] == PtBookEventTypes.kNotifyNextPage: + PtDebugPrint("xJournalBookGUIPopup:Book: NotifyNextPage",level=kDebugDumpLevel) + self.curPage = gJournalBook.getCurrentPage() + vault = ptVault() + entry = vault.findChronicleEntry("WatsonJournal") + if type(entry) == type(None): + vault.addChronicleEntry("WatsonJournal",1,"%d" % (1)) + PtDebugPrint("Chronicle entry WatsonJournal not present, adding entry and setting to 1") + else: + PtDebugPrint("Chronicle entry WatsonJournal already present, will do nothing") + elif event[1] == PtBookEventTypes.kNotifyPreviousPage: + PtDebugPrint("xJournalBookGUIPopup:Book: NotifyPreviousPage",level=kDebugDumpLevel) + self.curPage = gJournalBook.getCurrentPage() + elif event[1] == PtBookEventTypes.kNotifyCheckUnchecked: + PtDebugPrint("xJournalBookGUIPopup:Book: NotifyCheckUncheck",level=kDebugDumpLevel) + pass + + def IShowBook(self): + "Show the linking book with no treasure pages" + global gJournalBook + global JournalName + global StartOpen + startOpened = StartOpen.value + journalName = JournalName.value + if journalName: + try: + lastPageList = self.IGetLastPageMap() + lastPage = lastPageList[journalName] + self.curPage = lastPage + params = xLocalization.xJournalBookDefs.xJournalBooks[journalName] + if len(params) == 4: + width,height,module,gui = params + else: + width,height,module = params + gui = "BkBook" + gJournalBook = ptBook(module.xJournalContents,self.key) + gJournalBook.setSize(width,height) + # make sure there is a cover to show + if not startOpened: + if not self.IsThereACover(module.xJournalContents): + startOpened = 1 + gJournalBook.setGUI(gui) + gJournalBook.allowPageTurning(true) + gJournalBook.show(startOpened) + except LookupError: + PtDebugPrint("xJournalBookGUIPopup: could not find journal %s's contents" % (journalName),level=kErrorLevel) + else: + PtDebugPrint("xJournalBookGUIPopup: no journal name",level=kErrorLevel) + + def IsThereACover(self,bookHtml): + # search the bookhtml string looking for a cover + idx = bookHtml.find('= 0: + return 1 + return 0 diff --git a/Python/ercaBakePellets.py b/Python/ercaBakePellets.py new file mode 100644 index 0000000000..9add2a40de --- /dev/null +++ b/Python/ercaBakePellets.py @@ -0,0 +1,587 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaBakePellets.py +Age: Ercana +Date: December 2003 +Author: Chris Doyle +toggles an age sdl bool only if another age sdl bool is true +""" + +from Plasma import * +from PlasmaTypes import * +import string +import PlasmaControlKeys +import xEnum +from math import * + + +# --------- +# max wiring +# --------- + +SDLFinishTime = ptAttribString(1,"SDL: baking finish time") +RespOven1 = ptAttribResponder(2, "resp: oven 1 baking",['off','on']) +RespOven2 = ptAttribResponder(3, "resp: oven 2 baking",['off','on']) +RespOven3 = ptAttribResponder(4, "resp: oven 3 baking",['off','on']) +RespOven4 = ptAttribResponder(5, "resp: oven 4 baking",['off','on']) +SDLPellet1 = ptAttribString(6,"SDL: pellet 1") +SDLPellet2 = ptAttribString(7,"SDL: pellet 2") +SDLPellet3 = ptAttribString(8,"SDL: pellet 3") +SDLPellet4 = ptAttribString(9,"SDL: pellet 4") +SDLPellet5 = ptAttribString(10,"SDL: pellet 5") + + +# --------- +# globals +# --------- + +TimeSDLs = ['ercaTimeSlider1','ercaTimeSlider2','ercaTimeSlider3','ercaTimeSlider4'] +AmountSDLs = ['ercaAmountSlider1','ercaAmountSlider2','ercaAmountSlider3','ercaAmountSlider4'] +TempSDLs = ['ercaTempSlider1','ercaTempSlider2','ercaTempSlider3','ercaTempSlider4'] + +time1 = 0 +time2 = 0 +time3 = 0 +time4 = 0 +amt1 = 0 +amt2 = 0 +amt3 = 0 +amt4 = 0 +temp1 = 0 +temp2 = 0 +temp3 = 0 +temp4 = 0 + +byteFinishTime = 0 +Oven1Start = 0 +Oven2Start = 0 +Oven3Start = 0 +Oven4Start = 0 +ovenStartList = [] +Pellet1 = 0 +Pellet2 = 0 +Pellet3 = 0 +Pellet4 = 0 +Pellet5 = 0 +Recipe = 0 +RecipeSDL = 0 +kTimeScale = 180 # each slider notch is 3 minutes each ## THIS IS THE FINAL SETTING +#kTimeScale = 2 # each slider notch is 2 secs each ## THIS IS FOR QA TESTING ONLY! +kTimeIncrement = 1 +Oven1On = 0 +Oven2On = 0 +Oven3On = 0 +Oven4On = 0 +boolPelletMachine = 0 + + +class ercaBakePellets(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 7031 + self.version = 6 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global byteFinishTime + global Pellet1 + global Pellet2 + global Pellet3 + global Pellet4 + global Pellet5 + global boolPelletMachine + + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLFinishTime.value,1,1) + ageSDL.sendToClients(SDLFinishTime.value) + ageSDL.setFlags(SDLPellet1.value,1,1) + ageSDL.sendToClients(SDLPellet1.value) + ageSDL.setFlags(SDLPellet2.value,1,1) + ageSDL.sendToClients(SDLPellet2.value) + ageSDL.setFlags(SDLPellet3.value,1,1) + ageSDL.sendToClients(SDLPellet3.value) + ageSDL.setFlags(SDLPellet4.value,1,1) + ageSDL.sendToClients(SDLPellet4.value) + ageSDL.setFlags(SDLPellet5.value,1,1) + ageSDL.sendToClients(SDLPellet5.value) + + try: + ageSDL = PtGetAgeSDL() + except: + print "ercaBakePellet.OnServerInitComplete():\tERROR---Cannot find the Ercana Age SDL" + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLFinishTime.value] = (0,) + ageSDL[SDLPellet1.value] = (0,) + ageSDL[SDLPellet2.value] = (0,) + ageSDL[SDLPellet3.value] = (0,) + ageSDL[SDLPellet4.value] = (0,) + ageSDL[SDLPellet5.value] = (0,) + + ageSDL.setNotify(self.key,SDLFinishTime.value,0.0) + ageSDL.setNotify(self.key,SDLPellet1.value,0.0) + ageSDL.setNotify(self.key,SDLPellet2.value,0.0) + ageSDL.setNotify(self.key,SDLPellet3.value,0.0) + ageSDL.setNotify(self.key,SDLPellet4.value,0.0) + ageSDL.setNotify(self.key,SDLPellet5.value,0.0) + + byteFinishTime = ageSDL[SDLFinishTime.value][0] + Pellet1 = ageSDL[SDLPellet1.value][0] + Pellet2 = ageSDL[SDLPellet2.value][0] + Pellet3 = ageSDL[SDLPellet3.value][0] + Pellet4 = ageSDL[SDLPellet4.value][0] + Pellet5 = ageSDL[SDLPellet5.value][0] + + ageSDL.setFlags("ercaPelletMachine",1,1) + ageSDL.sendToClients("ercaPelletMachine") + ageSDL.setNotify(self.key,"ercaPelletMachine",0.0) + boolPelletMachine = ageSDL["ercaPelletMachine"][0] + + if byteFinishTime != 0: + CurTime = PtGetDniTime() + if CurTime > byteFinishTime: + #self.IDoFormula() + fastforward = 1 + self.IGetRecipe(fastforward) + else: + fastforward = 1 + self.IGetRecipe(fastforward) + else: + RespOven1.run(self.key,state="off",fastforward=1) + RespOven2.run(self.key,state="off",fastforward=1) + RespOven3.run(self.key,state="off",fastforward=1) + RespOven4.run(self.key,state="off",fastforward=1) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global byteFinishTime + global Pellet1 + global Pellet2 + global Pellet3 + global Pellet4 + global Pellet5 + global Oven1On + global Oven2On + global Oven3On + global Oven4On + global boolPelletMachine + ageSDL = PtGetAgeSDL() + + if VARname == "ercaPelletMachine": + boolPelletMachine = ageSDL["ercaPelletMachine"][0] + if VARname == SDLFinishTime.value: + byteFinishTime = ageSDL[SDLFinishTime.value][0] + PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for ercaBakeFinishTime is now %d" % (byteFinishTime)) + if byteFinishTime == 1: + print "ONLY CALL GetRecipe ONCE" + fastforward = 0 + self.IGetRecipe(fastforward) + elif byteFinishTime == 0: + print "BYTEFINISHTIME set to O" + if Oven1On: + RespOven1.run(self.key,state="off") + Oven1On = 0 + if Oven2On: + RespOven2.run(self.key,state="off") + Oven2On = 0 + if Oven3On: + RespOven3.run(self.key,state="off") + Oven3On = 0 + if Oven4On: + RespOven4.run(self.key,state="off") + Oven4On = 0 + if VARname == SDLPellet1.value: + Pellet1 = ageSDL[SDLPellet1.value][0] + PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet1 is now %d" % (Pellet1)) + if VARname == SDLPellet2.value: + Pellet2 = ageSDL[SDLPellet2.value][0] + PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet2 is now %d" % (Pellet2)) + if VARname == SDLPellet3.value: + Pellet3 = ageSDL[SDLPellet3.value][0] + PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet3 is now %d" % (Pellet3)) + if VARname == SDLPellet4.value: + Pellet4 = ageSDL[SDLPellet4.value][0] + PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet4 is now %d" % (Pellet4)) + if VARname == SDLPellet5.value: + Pellet5 = ageSDL[SDLPellet5.value][0] + PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet5 is now %d" % (Pellet5)) + + + def OnNotify(self,state,id,events): + global byteFinishTime + ageSDL = PtGetAgeSDL() + + + def IGetRecipe(self,fastforward): + global time1 + global time2 + global time3 + global time4 + global amt1 + global amt2 + global amt3 + global amt4 + global temp1 + global temp2 + global temp3 + global temp4 + global byteFinishTime + ageSDL = PtGetAgeSDL() + + time1 = ageSDL[TimeSDLs[0]][0] + time2 = ageSDL[TimeSDLs[1]][0] + time3 = ageSDL[TimeSDLs[2]][0] + time4 = ageSDL[TimeSDLs[3]][0] + amt1 = ageSDL[AmountSDLs[0]][0] + amt2 = ageSDL[AmountSDLs[1]][0] + amt3 = ageSDL[AmountSDLs[2]][0] + amt4 = ageSDL[AmountSDLs[3]][0] + temp1 = ageSDL[TempSDLs[0]][0] + temp2 = ageSDL[TempSDLs[1]][0] + temp3 = ageSDL[TempSDLs[2]][0] + temp4 = ageSDL[TempSDLs[3]][0] + + PtDebugPrint("ercaBakePellets:IGetRecipe: time1 = %d, time2 = %d, time3 = %d, time4 = %d" % (time1,time2,time3,time4)) + PtDebugPrint("ercaBakePellets:IGetRecipe: amt1 = %d, amt2 = %d, amt3 = %d, amt4 = %d" % (amt1,amt2,amt3,amt4)) + PtDebugPrint("ercaBakePellets:IGetRecipe: temp1 = %d, temp2 = %d, temp3 = %d, temp4 = %d" % (temp1,temp2,temp3,temp4)) + + timeList = [time1,time2,time3,time4] + timeList.sort() + timeList.reverse() + + PtDebugPrint("Longest time is %d" % (timeList[0])) + PtDebugPrint("Shortest time is %d" % (timeList[3])) + + if fastforward == 0: + StartTime = PtGetDniTime() + byteFinishTime = (StartTime + (timeList[0] * kTimeScale)) + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLFinishTime.value] = (byteFinishTime,) + + self.ISetOvens(fastforward) + + + def ISetOvens(self,fastforward): + global Oven1Start + global Oven2Start + global Oven3Start + global Oven4Start + global ovenStartList + + Oven1Start = (byteFinishTime - (time1 * kTimeScale)) + Oven2Start = (byteFinishTime - (time2 * kTimeScale)) + Oven3Start = (byteFinishTime - (time3 * kTimeScale)) + Oven4Start = (byteFinishTime - (time4 * kTimeScale)) + + ovenStartList = [Oven1Start,Oven2Start,Oven3Start,Oven4Start] + + print "IGetRecipe.Oven1Start = ",Oven1Start + print "IGetRecipe.Oven2Start = ",Oven2Start + print "IGetRecipe.Oven3Start = ",Oven3Start + print "IGetRecipe.Oven4Start = ",Oven4Start + + self.IUpdateOvens(fastforward) + + + def IUpdateOvens(self,fastforward): + print "ercaBakePellets.IUpdateOvens()" + global ovenStartList + global Oven1On + global Oven2On + global Oven3On + global Oven4On + ageSDL = PtGetAgeSDL() + + CurTime = PtGetDniTime() + if CurTime < byteFinishTime: + #~ for start in ovenStartList: + #~ if start == CurTime: + #~ PtDebugPrint("%s start baking." % (start)) + if fastforward == 0: + if boolPelletMachine and ((CurTime+7) >= byteFinishTime) and self.sceneobject.isLocallyOwned(): + print "7 seconds or less until baking is done, and the machine is open, so CLOSING..." + ageSDL[SDLPellet1.value] = (0,) + ageSDL[SDLPellet2.value] = (0,) + ageSDL[SDLPellet3.value] = (0,) + ageSDL[SDLPellet4.value] = (0,) + ageSDL[SDLPellet5.value] = (0,) + ageSDL["ercaPelletMachine"] = (0,) + if CurTime == Oven1Start: + print "Start Oven1 bake" + RespOven1.run(self.key,state="on",fastforward=fastforward) + Oven1On = 1 + if CurTime == Oven2Start: + print "Start Oven2 bake" + RespOven2.run(self.key,state="on",fastforward=fastforward) + Oven2On = 1 + if CurTime == Oven3Start: + print "Start Oven3 bake" + RespOven3.run(self.key,state="on",fastforward=fastforward) + Oven3On = 1 + if CurTime == Oven4Start: + print "Start Oven4 bake" + RespOven4.run(self.key,state="on",fastforward=fastforward) + Oven4On = 1 + else: + if CurTime > Oven1Start: + print "Start Oven1 bake" + RespOven1.run(self.key,state="on",fastforward=fastforward) + Oven1On = 1 + if CurTime > Oven2Start: + print "Start Oven2 bake" + RespOven2.run(self.key,state="on",fastforward=fastforward) + Oven2On = 1 + if CurTime > Oven3Start: + print "Start Oven3 bake" + RespOven3.run(self.key,state="on",fastforward=fastforward) + Oven3On = 1 + if CurTime > Oven4Start: + print "Start Oven4 bake" + RespOven4.run(self.key,state="on",fastforward=fastforward) + Oven4On = 1 + + PtAtTimeCallback(self.key,kTimeIncrement,1) + else: + self.IDoFormula() + + + def OnTimer(self,id): + global Recipe + global RecipeSDL + ageSDL = PtGetAgeSDL() + + if id == 1: + if byteFinishTime != 0: + fastforward = 0 + self.IUpdateOvens(fastforward) + else: + print "OnTimer callback, but baking was either finished or cancelled. Doing nothing." + elif id == 2: + if self.sceneobject.isLocallyOwned(): + print "Timer done, Pellets now created with Recipe of: ",Recipe + ageSDL[SDLPellet1.value] = (RecipeSDL,) + ageSDL[SDLPellet2.value] = (RecipeSDL,) + ageSDL[SDLPellet3.value] = (RecipeSDL,) + ageSDL[SDLPellet4.value] = (RecipeSDL,) + ageSDL[SDLPellet5.value] = (RecipeSDL,) + + + def IDoFormula(self,backdoor=0): + if not backdoor: + print "Baking done. IDoFormula called." + global time1 + global time2 + global time3 + global time4 + global amt1 + global amt2 + global amt3 + global amt4 + global temp1 + global temp2 + global temp3 + global temp4 + global Pellet1 + global Pellet2 + global Pellet3 + global Pellet4 + global Pellet5 + global Recipe + global RecipeSDL + ageSDL = PtGetAgeSDL() + + pelletList = [Pellet1,Pellet2,Pellet3,Pellet4,Pellet5] + testVal = 0 + for pellet in pelletList: + if pellet > 0: + testVal = 1 + break + + if testVal and self.sceneobject.isLocallyOwned() and not backdoor: + ageSDL[SDLPellet1.value] = (0,) + ageSDL[SDLPellet2.value] = (0,) + ageSDL[SDLPellet3.value] = (0,) + ageSDL[SDLPellet4.value] = (0,) + ageSDL[SDLPellet5.value] = (0,) + + z = 0 + + # Oven1 adjustments + time1_val = (time1 * 0.025) + time1_opt = 2.1 + amt1_val = (amt1 * 0.1) + amt1_opt = 5.8 + temp1_val = (temp1 * 0.02) + temp1_opt = 1.75 + + if time1_val > time1_opt: + time1_val = (time1_val - (time1_val - time1_opt)) + if amt1_val > amt1_opt: + amt1_val = (amt1_val - (amt1_val - amt1_opt)) + if temp1_val > temp1_opt: + temp1_val = (temp1_val - (temp1_val - temp1_opt)) + + # Oven2 adjustments + time2_val = (time2 * 0.028) + time2_opt = 2.0 + amt2_val = (amt2 * 0.1) + amt2_opt = 7.4 + temp2_val = (temp2 * 0.017) + temp2_opt = 1.1 + + if time2_val > time2_opt: + time2_val = (time2_val - (time2_val - time2_opt)) + if amt2_val > amt2_opt: + amt2_val = (amt2_val - (amt2_val - amt2_opt)) + if temp2_val > temp2_opt: + temp2_val = (temp2_val - (temp2_val - temp2_opt)) + + # Oven3 adjustments + time3_val = (time3 * 0.035) + time3_opt = 3.0 + amt3_val = (amt3 * 0.1) + amt3_opt = 6.0 + temp3_val = (temp3 * 0.0126) + temp3_opt = 0.9 + + if time3_val > time3_opt: + time3_val = (time3_val - (time3_val - time3_opt)) + if amt3_val > amt3_opt: + amt3_val = (amt3_val - (amt3_val - amt3_opt)) + if temp3_val > temp3_opt: + temp3_val = (temp3_val - (temp3_val - temp3_opt)) + + # Oven4 adjustments + time4_val = (time4 * 0.028) + time4_opt = 2.5 + amt4_val = (amt4 * 0.1) + amt4_opt = 8.2 + temp4_val = (temp4 * 0.04) + temp4_opt = 3.5 + + if time4_val > time4_opt: + time4_val = (time4_val - (time4_val - time4_opt)) + if amt4_val > amt4_opt: + amt4_val = (amt4_val - (amt4_val - amt4_opt)) + if temp4_val > temp4_opt: + temp4_val = (temp4_val - (temp4_val - temp4_opt)) + + # Formulas + z1 = (0.15 * amt1_val * 0.75 * time1_val * sin(time1_val) * sin(time1_val * (temp1_val))) + z2 = (0.081 * amt2_val * time2_val * temp2_val * sin(0.7 * time2_val) * sin(1.38 * time2_val * temp2_val)) + z3 = (0.07425 * amt3_val * time3_val * temp3_val * sin(0.6 * time3_val) * sin(1.44 * time3_val * temp3_val)) + if (time4_val * temp4_val) > 3.1: + z4 = 0 + else: + z4 = (0.0864 * amt4_val * time4_val * temp4_val * sin(0.7 * time4_val) * sin(1.38 * time4_val * temp4_val)) + + # Final recipe + z = z1 + z2 + z3 + z4 + + if backdoor: + print "time1_val = ",time1_val + print "amt1_val = ",amt1_val + print "temp1_val = ",temp1_val,"\n" + print "time2_val = ",time2_val + print "amt2_val = ",amt2_val + print "temp2_val = ",temp2_val,"\n" + print "time3_val = ",time3_val + print "amt3_val = ",amt3_val + print "temp3_val = ",temp3_val,"\n" + print "time4_val = ",time4_val + print "amt4_val = ",amt4_val + print "temp4_val = ",temp4_val,"\n" + print "z1 = ",z1 + print "z2 = ",z2 + print "z3 = ",z3 + print "z4 = ",z4 + print "z = ",z,"\n" + recipetest = int(round(100 * z)) + print "recipe test = ",recipetest + return + + Recipe = int(round(100 * z)) + +# if Recipe == 0: +# Recipe = 1 + + print "Pellet recipe = ",Recipe + + RecipeSDL = Recipe + 300 + + if RecipeSDL < 1: + RecipeSDL = 1 + + print "Recipe SDL converted to ",RecipeSDL + + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLFinishTime.value] = (0,) + + PtAtTimeCallback(self.key,0.1,2) + + + def OnBackdoorMsg(self,target,param): + global time1 + global time2 + global time3 + global time4 + global amt1 + global amt2 + global amt3 + global amt4 + global temp1 + global temp2 + global temp3 + global temp4 + if target == "recipe": + ageSDL = PtGetAgeSDL() + time1 = ageSDL[TimeSDLs[0]][0] + time2 = ageSDL[TimeSDLs[1]][0] + time3 = ageSDL[TimeSDLs[2]][0] + time4 = ageSDL[TimeSDLs[3]][0] + amt1 = ageSDL[AmountSDLs[0]][0] + amt2 = ageSDL[AmountSDLs[1]][0] + amt3 = ageSDL[AmountSDLs[2]][0] + amt4 = ageSDL[AmountSDLs[3]][0] + temp1 = ageSDL[TempSDLs[0]][0] + temp2 = ageSDL[TempSDLs[1]][0] + temp3 = ageSDL[TempSDLs[2]][0] + temp4 = ageSDL[TempSDLs[3]][0] + print "RECIPE TEST:\n" + PtDebugPrint("oven1 = %d, %d, %d" % (time1,amt1,temp1)) + PtDebugPrint("oven2 = %d, %d, %d" % (time2,amt2,temp2)) + PtDebugPrint("oven3 = %d, %d, %d" % (time3,amt3,temp3)) + PtDebugPrint("oven4 = %d, %d, %d\n" % (time4,amt4,temp4)) + #PtDebugPrint("time1 = %d, time2 = %d, time3 = %d, time4 = %d" % (time1,time2,time3,time4)) + #PtDebugPrint("amt1 = %d, amt2 = %d, amt3 = %d, amt4 = %d" % (amt1,amt2,amt3,amt4)) + #PtDebugPrint("temp1 = %d, temp2 = %d, temp3 = %d, temp4 = %d" % (temp1,temp2,temp3,temp4)) + self.IDoFormula(1) + diff --git a/Python/ercaBakeryElev.py b/Python/ercaBakeryElev.py new file mode 100644 index 0000000000..067854488f --- /dev/null +++ b/Python/ercaBakeryElev.py @@ -0,0 +1,290 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaBakeryElev.py +Age: Ercana +Date: December 2003 +Author: Chris Doyle +toggles an age sdl bool only if another age sdl bool is true +""" + +from Plasma import * +from PlasmaTypes import * +import string +#import PlasmaControlKeys + +# --------- +# max wiring +# --------- + +ActElevBtn = ptAttribActivator(1,"clk: elevator button") +SDLPlatform1 = ptAttribString(2,"SDL: platform 1") +SDLPlatform2 = ptAttribString(3,"SDL: platform 2") +SDLPlatform3 = ptAttribString(4,"SDL: platform 3") +SDLPlatform4 = ptAttribString(5,"SDL: platform 4") +SDLElevPos = ptAttribString(6,"SDL: elevator pos") +SDLPower = ptAttribString(7,"SDL: bakery power") +RespElevClk = ptAttribResponder(8, "resp: elevator clicker") +RespElevPwr = ptAttribResponder(9, "resp: elevator power",['off','on']) +RespElevOps = ptAttribResponder(10, "resp: elevator ops",['up','jam','down']) +SDLElevBusy = ptAttribString(11,"SDL: elevator busy") +ActBkryPwr = ptAttribActivator(12,"clk: bakery power switch") +RespBkryPwrOff = ptAttribResponder(13, "resp: bakery power off") +RespBkryPwrOn = ptAttribResponder(14, "resp: bakery power on") + + +# --------- +# globals +# --------- + +boolPlat1 = 0 +boolPlat2 = 0 +boolPlat3 = 0 +boolPlat4 = 0 +boolElevPos = 0 +boolPwr = 0 +boolElevBusy = 0 +AutoDown = 0 +LocalAvatar = None + + +class ercaBakeryElev(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 7029 + self.version = 4 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global boolPlat1 + global boolPlat2 + global boolPlat3 + global boolPlat4 + global boolElevPos + global boolPwr + global boolElevBusy + global LocalAvatar + + LocalAvatar = PtGetLocalAvatar() + + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLPlatform1.value,1,1) + ageSDL.sendToClients(SDLPlatform1.value) + ageSDL.setFlags(SDLPlatform2.value,1,1) + ageSDL.sendToClients(SDLPlatform2.value) + ageSDL.setFlags(SDLPlatform3.value,1,1) + ageSDL.sendToClients(SDLPlatform3.value) + ageSDL.setFlags(SDLPlatform4.value,1,1) + ageSDL.sendToClients(SDLPlatform4.value) + ageSDL.setFlags(SDLElevPos.value,1,1) + ageSDL.sendToClients(SDLElevPos.value) + ageSDL.setFlags(SDLPower.value,1,1) + ageSDL.sendToClients(SDLPower.value) + ageSDL.setFlags(SDLElevBusy.value,1,1) + ageSDL.sendToClients(SDLElevBusy.value) + + ageSDL.setNotify(self.key,SDLPlatform1.value,0.0) + ageSDL.setNotify(self.key,SDLPlatform2.value,0.0) + ageSDL.setNotify(self.key,SDLPlatform3.value,0.0) + ageSDL.setNotify(self.key,SDLPlatform4.value,0.0) + ageSDL.setNotify(self.key,SDLElevPos.value,0.0) + ageSDL.setNotify(self.key,SDLPower.value,0.0) + ageSDL.setNotify(self.key,SDLElevBusy.value,0.0) + + try: + boolPlat1 = ageSDL[SDLPlatform1.value][0] + except: + PtDebugPrint("ERROR: ercaBakeryElev.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolPlat1 = 0 + PtDebugPrint("DEBUG: ercaBakeryElev.OnServerInitComplete():\t%s = %d" % (SDLPlatform1.value,ageSDL[SDLPlatform1.value][0]) ) + try: + boolPlat2 = ageSDL[SDLPlatform2.value][0] + except: + PtDebugPrint("ERROR: ercaBakeryElev.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolPlat2 = 0 + PtDebugPrint("DEBUG: ercaBakeryElev.OnServerInitComplete():\t%s = %d" % (SDLPlatform2.value,ageSDL[SDLPlatform2.value][0]) ) + try: + boolPlat3 = ageSDL[SDLPlatform3.value][0] + except: + PtDebugPrint("ERROR: ercaBakeryElev.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolPlat3 = 0 + PtDebugPrint("DEBUG: ercaBakeryElev.OnServerInitComplete():\t%s = %d" % (SDLPlatform3.value,ageSDL[SDLPlatform3.value][0]) ) + try: + boolPlat4 = ageSDL[SDLPlatform4.value][0] + except: + PtDebugPrint("ERROR: ercaBakeryElev.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolPlat4 = 0 + PtDebugPrint("DEBUG: ercaBakeryElev.OnServerInitComplete():\t%s = %d" % (SDLPlatform4.value,ageSDL[SDLPlatform4.value][0]) ) + try: + boolElevPos = ageSDL[SDLElevPos.value][0] + except: + PtDebugPrint("ERROR: ercaBakeryElev.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolElevPos = 0 + PtDebugPrint("DEBUG: ercaBakeryElev.OnServerInitComplete():\t%s = %d" % (SDLElevPos.value,ageSDL[SDLElevPos.value][0]) ) + try: + boolPwr = ageSDL[SDLPower.value][0] + except: + PtDebugPrint("ERROR: ercaBakeryElev.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolPwr = 0 + PtDebugPrint("DEBUG: ercaBakeryElev.OnServerInitComplete():\t%s = %d" % (SDLPower.value,ageSDL[SDLPower.value][0]) ) + try: + boolElevBusy = ageSDL[SDLElevBusy.value][0] + except: + PtDebugPrint("ERROR: ercaBakeryElev.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolElevBusy = 0 + PtDebugPrint("DEBUG: ercaBakeryElev.OnServerInitComplete():\t%s = %d" % (SDLElevBusy.value,ageSDL[SDLElevBusy.value][0]) ) + + if boolElevPos: + RespElevOps.run(self.key,state="up",fastforward=1) + else: + RespElevOps.run(self.key,state="down",fastforward=1) + + if boolPwr: + RespBkryPwrOn.run(self.key,fastforward=1) + RespElevPwr.run(self.key,state="on",fastforward=1) + else: + RespBkryPwrOff.run(self.key,fastforward=1) + RespElevPwr.run(self.key,state="off",fastforward=1) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolPlat1 + global boolPlat2 + global boolPlat3 + global boolPlat4 + global boolElevPos + global boolPwr + global boolElevBusy + global AutoDown + ageSDL = PtGetAgeSDL() + PtDebugPrint("ercaBakeryElev.OnSDLNotify():\t VARname: %s, SDLname: %s, tag: %s, value: %d, playerID: %d" % (VARname,SDLname,tag,ageSDL[VARname][0],playerID)) + + if VARname == SDLPlatform1.value: + boolPlat1 = ageSDL[SDLPlatform1.value][0] + + if VARname == SDLPlatform2.value: + boolPlat2 = ageSDL[SDLPlatform2.value][0] + + if VARname == SDLPlatform3.value: + boolPlat3 = ageSDL[SDLPlatform3.value][0] + + if VARname == SDLPlatform4.value: + boolPlat4 = ageSDL[SDLPlatform4.value][0] + + if VARname == SDLElevPos.value: + boolElevPos = ageSDL[SDLElevPos.value][0] + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLElevBusy.value] = (1,) + RespElevPwr.run(self.key,state="off") + if boolElevPos: + RespElevOps.run(self.key,state="up") + else: + RespElevOps.run(self.key,state="down") + + if VARname == SDLPower.value: + boolPwr = ageSDL[SDLPower.value][0] + if boolElevBusy == 0: + if boolPwr: + RespElevPwr.run(self.key,state="on") + else: + RespElevPwr.run(self.key,state="off") + if boolElevPos: + AutoDown = 1 + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLElevPos.value] = (0,) + + if VARname == SDLElevBusy.value: + boolElevBusy = ageSDL[SDLElevBusy.value][0] + if boolElevBusy: + if not AutoDown: + objAvatar = ptSceneobject(PtGetAvatarKeyFromClientID(playerID),self.key) + RespElevClk.run(self.key,avatar=objAvatar) + + + def OnNotify(self,state,id,events): + PtDebugPrint("ercaBakeryElev:OnNotify state=%d id=%d events=" % (state,id),events,level=kDebugDumpLevel) + global boolPlat1 + global boolPlat2 + global boolPlat3 + global boolPlat4 + global boolElevPos + global boolPwr + global boolElevBusy + global AutoDown + ageSDL = PtGetAgeSDL() + + if (id == ActElevBtn.id and state and LocalAvatar == PtFindAvatar(events)): + print "ActElevBtn callback" + ageSDL[SDLElevBusy.value] = (1,) + + if (id == RespElevClk.id): + print "RespElevClk callback" + if boolElevPos: + if self.sceneobject.isLocallyOwned(): + print "owner" + ageSDL[SDLElevPos.value] = (0,) + else: + pass + else: + if boolPlat1 or boolPlat2 or boolPlat3 or boolPlat4: + RespElevPwr.run(self.key,state="off") + RespElevOps.run(self.key,state="jam") + else: + if self.sceneobject.isLocallyOwned(): + print "owner" + ageSDL[SDLElevPos.value] = (1,) + + if (id == RespElevOps.id): + print "RespElevOps callback" + if self.sceneobject.isLocallyOwned(): + print "owner" + ageSDL[SDLElevBusy.value] = (0,) + if boolPwr: + RespElevPwr.run(self.key,state="on") + if boolElevPos == 0: + if AutoDown: + AutoDown = 0 + + if (id == ActBkryPwr.id and state): + objAvatar = PtFindAvatar(events) + if boolPwr: + RespBkryPwrOff.run(self.key,avatar=objAvatar) + else: + RespBkryPwrOn.run(self.key,avatar=objAvatar) + + if (id == RespBkryPwrOff.id) and self.sceneobject.isLocallyOwned(): + print "owner" + ageSDL[SDLPower.value] = (0,) + + if (id == RespBkryPwrOn.id) and self.sceneobject.isLocallyOwned(): + print "owner" + ageSDL[SDLPower.value] = (1,) + diff --git a/Python/ercaCallCar.py b/Python/ercaCallCar.py new file mode 100644 index 0000000000..b9c4bc65f4 --- /dev/null +++ b/Python/ercaCallCar.py @@ -0,0 +1,157 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaCallCar +Age: Ercana +Date: November 2003 +Author: Chris Doyle +toggles an age sdl bool only if another age sdl bool is true +""" + +from Plasma import * +from PlasmaTypes import * +import string + +# --------- +# max wiring +# --------- + +clkCallCarBtn = ptAttribActivator(1,"clk: call car btn") +SDLCarPos = ptAttribString(2,"SDL: car pos") # e.g. tldnWorkroomPowerOn +respCallCarYes = ptAttribResponder(3,"resp: car ready, call it") +respCallCarNo = ptAttribResponder(4,"resp: car not ready, no call") +SDLCarLev = ptAttribString(5,"SDL: car lev") # e.g. tldnWorkroomPowerOn +respCallBtnReset = ptAttribResponder(6,"resp: car call done, btn reset") +respHullGate = ptAttribResponder(7,"resp: car hull gate",['close','open']) + + +# --------- +# globals +# --------- + +byteCarPos = 0 +boolCarLev = 0 +AgeStartedIn = None + + +class ercaCallCar(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 7026 + self.version = 3 + + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + + def OnServerInitComplete(self): + global byteCarPos + global boolCarLev + + if AgeStartedIn == PtGetAgeName(): + + if type(SDLCarPos.value) == type("") and SDLCarPos.value != "": + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLCarPos.value,1,1) + ageSDL.sendToClients(SDLCarPos.value) + else: + PtDebugPrint("ERROR: ercaCallCar.OnFirstUpdate():\tERROR: missing SDL var name") + if type(SDLCarLev.value) == type("") and SDLCarLev.value != "": + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLCarLev.value,1,1) + ageSDL.sendToClients(SDLCarLev.value) + else: + PtDebugPrint("ERROR: ercaCallCar.OnFirstUpdate():\tERROR: missing SDL var name") + pass + + ageSDL = PtGetAgeSDL() + ageSDL.setNotify(self.key,SDLCarPos.value,0.0) + ageSDL.setNotify(self.key,SDLCarLev.value,0.0) + try: + byteCarPos = ageSDL[SDLCarPos.value][0] + except: + PtDebugPrint("ERROR: ercaCallCar.OnServerInitComplete():\tERROR reading age SDL") + pass + PtDebugPrint("DEBUG: ercaCallCar.OnServerInitComplete():\t%s = %d" % (SDLCarPos.value,ageSDL[SDLCarPos.value][0]) ) + try: + boolCarLev = ageSDL[SDLCarLev.value][0] + except: + PtDebugPrint("ERROR: ercaCallCar.OnServerInitComplete():\tERROR reading age SDL") + pass + PtDebugPrint("DEBUG: ercaCallCar.OnServerInitComplete():\t%s = %d" % (SDLCarLev.value,ageSDL[SDLCarLev.value][0]) ) + + if byteCarPos == 2 or byteCarPos == 3: + respHullGate.run(self.key,state="close") + else: + respHullGate.run(self.key,state="open") + + + def OnNotify(self,state,id,events): + global byteCarPos + global boolCarLev + + ageSDL = PtGetAgeSDL() + + #~ if PtWasLocallyNotified(self.key): + #~ fastforward = 0 + #~ else: + #~ fastforward = 1 + + if (id == clkCallCarBtn.id and state): + if byteCarPos == 1: + PtDebugPrint("DEBUG: ercaCallCar.OnNotify:\tRunning true responder on %s" % (self.sceneobject.getName())) + respCallCarYes.run(self.key,avatar=PtFindAvatar(events)) + else: + PtDebugPrint("DEBUG: ercaCallCar.OnNotify:\tRunning false responder on %s" % (self.sceneobject.getName())) + respCallCarNo.run(self.key,avatar=PtFindAvatar(events)) + + if (id == respCallCarYes.id) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarLev.value] = (1,) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global byteCarPos + global boolCarLev + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + + if VARname == SDLCarPos.value: + PtDebugPrint("DEBUG: ercaCallCar.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d" % (VARname,SDLname,tag,ageSDL[SDLCarPos.value][0])) + byteCarPos = ageSDL[SDLCarPos.value][0] + if byteCarPos == 2: + respHullGate.run(self.key,state="close") + elif byteCarPos == 4: + respHullGate.run(self.key,state="open") + + if VARname == SDLCarLev.value: + PtDebugPrint("DEBUG: ercaCallCar.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d" % (VARname,SDLname,tag,ageSDL[SDLCarLev.value][0])) + boolCarLev = ageSDL[SDLCarLev.value][0] + if boolCarLev == 0: + respCallBtnReset.run(self.key) diff --git a/Python/ercaControlRoom.py b/Python/ercaControlRoom.py new file mode 100644 index 0000000000..4543703a9c --- /dev/null +++ b/Python/ercaControlRoom.py @@ -0,0 +1,562 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaControlRoom +Age: Ercana +Date: November 2003 +Revisions: February 2007 - ? +Author: Chris Doyle +wiring for the Ercana Control Room +""" + +from Plasma import * +from PlasmaTypes import * +import string + +# --------- +# max wiring +# --------- + +SDLImgrView = ptAttribString(1,"SDL: Control Imager view") +ActScrollLeft = ptAttribActivator(2,"clk: imager btn left") +ActScrollRight = ptAttribActivator(3,"clk: imager btn right") +RespScrollLeft = ptAttribResponder(4,"resp: scroll imager left",['From3to2','From2to1','From1to0','At3']) +RespScrollRight = ptAttribResponder(5,"resp: scroll imager right",['From0to1','From1to2','From2to3','At0']) +RespImgrView0 = ptAttribResponder(6,"resp: imager view 0",['exit','enter']) +RespImgrView1 = ptAttribResponder(7,"resp: imager view 1",['exit','enter']) +RespImgrView2 = ptAttribResponder(8,"resp: imager view 2",['exit','enter']) +RespImgrView3 = ptAttribResponder(9,"resp: imager view 3",['exit','enter']) +SDLMixBtn = ptAttribString(10,"SDL: control mixer btn") +RespMixBtn1 = ptAttribResponder(11,"resp: control mixer btn 1",['press','release']) +RespMixBtn2 = ptAttribResponder(12,"resp: control mixer btn 2",['press','release']) +RespMixBtn3 = ptAttribResponder(13,"resp: control mixer btn 3",['press','release']) +RespMixBtn4 = ptAttribResponder(14,"resp: control mixer btn 4",['press','release']) +RespMixIcons = ptAttribResponder(15,"resp: control mixer icons",['off','on']) +SDLOvenBtn = ptAttribString(16,"SDL: control oven btn") +RespOvenBtn1 = ptAttribResponder(17,"resp: control oven btn 1",['press','release']) +RespOvenBtn2 = ptAttribResponder(18,"resp: control oven btn 2",['press','release']) +RespOvenBtn3 = ptAttribResponder(19,"resp: control oven btn 3",['press','release']) +RespOvenBtn4 = ptAttribResponder(20,"resp: control oven btn 4",['press','release']) +RespOvenIcons = ptAttribResponder(21,"resp: control oven icons",['off','on']) +RespScrollBtns = ptAttribResponder(22,"resp: left scroll btn enabler",['on','off']) +ActBladesBtn = ptAttribActivator(23,"clk: mixer blades btn") +ActHatchBtn = ptAttribActivator(24,"clk: mixer hatch btn") +ActValveBtn = ptAttribActivator(25,"clk: mixer valve btn") +ActOvenPwrBtn = ptAttribActivator(26,"clk: oven-scope power btn") +RespScrollBtnRt = ptAttribResponder(27,"resp: right scroll btn enabler",['on','off']) +RgnTunnel1 = ptAttribActivator(28,"rgn: drainage tunnel 1") +RgnTunnel2 = ptAttribActivator(29,"rgn: drainage tunnel 2") +RgnTunnel3 = ptAttribActivator(30,"rgn: drainage tunnel 3") +RgnTunnel4 = ptAttribActivator(31,"rgn: drainage tunnel 4") +RespWarningLight = ptAttribResponder(32,"resp: warning light") + + +# --------- +# globals +# --------- + +byteImgrOld = 0 +byteImgrNew = 0 +statesL = ['From1to0','From2to1','From3to2','At3'] +statesR = ['At0','From0to1','From1to2','From2to3'] +#scrollDir = 0 +byteMixBtnNew = 0 +byteMixBtnOld = 0 +byteOvenBtnNew = 0 +byteOvenBtnOld = 0 +bladesSDLs = ['ercaPool1Blades','ercaPool2Blades','ercaPool3Blades','ercaPool4Blades'] +hatchSDLs = ['ercaPool1Hatch','ercaPool2Hatch','ercaPool3Hatch','ercaPool4Hatch'] +valveSDLs = ['ercaPool1Valve','ercaPool2Valve','ercaPool3Valve','ercaPool4Valve'] +emptySDLs = ['ercaPool1Empty','ercaPool2Empty','ercaPool3Empty','ercaPool4Empty'] +ovenSDLs = ['ercaOven1Pwr','ercaOven2Pwr','ercaOven3Pwr','ercaOven4Pwr'] +OnInit = 0 +AgeStartedIn = None +byteAmBaking = 0 +LocalAvatar = None +RgnTunnelIDs = [28,29,30,31] +Tunnel1 = [] +Tunnel2 = [] +Tunnel3 = [] +Tunnel4 = [] +TunnelsOccupied = [Tunnel1,Tunnel2,Tunnel3,Tunnel4] + + +class ercaControlRoom(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 7027 + self.version = 10 + + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + + def OnServerInitComplete(self): + global byteImgrNew + global byteMixBtnNew + global byteMixBtnOld + global byteOvenBtnNew + global byteOvenBtnOld + global byteAmBaking + global OnInit + global LocalAvatar + + LocalAvatar = PtGetLocalAvatar() + + ageSDL = PtGetAgeSDL() + + ageSDL.setFlags(SDLImgrView.value,1,1) + ageSDL.sendToClients(SDLImgrView.value) + ageSDL.setFlags(SDLMixBtn.value,1,1) + ageSDL.sendToClients(SDLMixBtn.value) + ageSDL.setFlags(SDLOvenBtn.value,1,1) + ageSDL.sendToClients(SDLOvenBtn.value) + ageSDL.setFlags("ercaBakeryElevPos",1,1) + ageSDL.sendToClients("ercaBakeryElevPos") + + ageSDL.setNotify(self.key,SDLImgrView.value,0.0) + ageSDL.setNotify(self.key,SDLMixBtn.value,0.0) + ageSDL.setNotify(self.key,SDLOvenBtn.value,0.0) + ageSDL.setNotify(self.key,"ercaBakeryElevPos",0.0) + + ageSDL.setFlags("ercaBakeFinishTime",1,1) + ageSDL.sendToClients("ercaBakeFinishTime") + ageSDL.setNotify(self.key,"ercaBakeFinishTime",0.0) + + try: + byteImgrNew = ageSDL[SDLImgrView.value][0] + except: + PtDebugPrint("ERROR: ercaControlRoom.OnServerInitComplete():\tERROR reading SDL name for imager view") + byteImgrNew = 3 + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\t%s = %d" % (SDLImgrView.value,ageSDL[SDLImgrView.value][0]) ) + try: + byteMixBtnNew = ageSDL[SDLMixBtn.value][0] + except: + PtDebugPrint("ERROR: ercaControlRoom.OnServerInitComplete():\tERROR reading SDL name for mixer btn") + byteMixBtnNew = 0 + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\t%s = %d" % (SDLMixBtn.value,ageSDL[SDLMixBtn.value][0]) ) + try: + byteOvenBtnNew = ageSDL[SDLOvenBtn.value][0] + except: + PtDebugPrint("ERROR: ercaControlRoom.OnServerInitComplete():\tERROR reading SDL name for oven btn") + byteOvenBtnNew = 0 + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\t%s = %d" % (SDLOvenBtn.value,ageSDL[SDLOvenBtn.value][0]) ) + try: + byteAmBaking = ageSDL["ercaBakeFinishTime"][0] + except: + PtDebugPrint("ERROR: ercaControlRoom.OnServerInitComplete():\tERROR reading SDL name for oven btn") + byteAmBaking = 0 + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\t%s = %d" % (byteAmBaking,ageSDL["ercaBakeFinishTime"][0]) ) + + OnInit = 1 + imageR = statesR[byteImgrNew] + RespScrollRight.run(self.key,state="%s" % (imageR),fastforward=1) + PtDebugPrint("ercaControlRoom.OnServerInitComplete():\tRespScrollRight just run... imageR = %s" % (imageR)) + self.ImgrView(byteImgrNew,"enter",1) + if byteImgrNew == 0: + RespScrollBtns.run(self.key,state="off",fastforward=1) + if byteOvenBtnNew: + self.OvenBtns(byteOvenBtnNew,"press",1) + RespOvenIcons.run(self.key,state="on",fastforward=1) + elif byteImgrNew == 1: + if byteMixBtnNew: + self.MixerBtns(byteMixBtnNew,"press",1) + RespMixIcons.run(self.key,state="on",fastforward=1) + elif byteImgrNew == 3: + RespScrollBtnRt.run(self.key,state="off",fastforward=1) + + if byteImgrNew != 0: + RespOvenIcons.run(self.key,state="off",fastforward=1) + elif byteImgrNew != 1: + RespMixIcons.run(self.key,state="off",fastforward=1) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global byteImgrOld + global byteImgrNew + #global scrollDir + global byteMixBtnNew + global byteMixBtnOld + global byteOvenBtnNew + global byteOvenBtnOld + global byteAmBaking + + ageSDL = PtGetAgeSDL() + + if VARname == SDLImgrView.value: + byteImgrOld = byteImgrNew + byteImgrNew = ageSDL[SDLImgrView.value][0] +# if not self.sceneobject.isLocallyOwned(): +# return + if byteMixBtnNew > 0 and self.sceneobject.isLocallyOwned(): + print "setting SDLMixBtn to 0" + ageSDL[SDLMixBtn.value] = (0,) + elif byteOvenBtnNew > 0 and self.sceneobject.isLocallyOwned(): + print "setting SDLOvenBtn to 0" + ageSDL[SDLOvenBtn.value] = (0,) + self.ImgrView(byteImgrOld,"exit") + PtDebugPrint("DEBUG: ercaControlRoom.OnSDLNotify():\t%s = %d" % (SDLImgrView.value,byteImgrNew) ) + if byteImgrOld == 0: + RespScrollBtnRt.run(self.key,state="off") + elif byteImgrOld == 3: + RespScrollBtns.run(self.key,state="off") + else: + RespScrollBtns.run(self.key,state="off") + RespScrollBtnRt.run(self.key,state="off") + + if byteImgrNew < byteImgrOld: + #if scrollDir == 0: + imageL = statesL[byteImgrNew] + RespScrollLeft.run(self.key,state="%s" % (imageL)) + else: + imageR = statesR[byteImgrNew] + RespScrollRight.run(self.key,state="%s" % (imageR)) + + elif VARname == SDLMixBtn.value: + byteMixBtnOld = byteMixBtnNew + byteMixBtnNew = ageSDL[SDLMixBtn.value][0] +# if not self.sceneobject.isLocallyOwned(): +# return + if byteMixBtnOld == byteMixBtnNew: + return + if byteMixBtnNew == 0: + self.MixerBtns(byteMixBtnOld,"release") + return + if byteMixBtnOld == 0: + self.MixerBtns(byteMixBtnNew,"press") + else: + self.MixerBtns(byteMixBtnOld,"release") + self.MixerBtns(byteMixBtnNew,"press") + PtDebugPrint("DEBUG: ercaControlRoom.OnSDLNotify():\t%s = %d" % (SDLMixBtn.value,ageSDL[SDLMixBtn.value][0]) ) + + elif VARname == SDLOvenBtn.value: + byteOvenBtnOld = byteOvenBtnNew + byteOvenBtnNew = ageSDL[SDLOvenBtn.value][0] + if byteOvenBtnNew == 0: + self.OvenBtns(byteOvenBtnOld,"release") + return + if byteOvenBtnOld == 0: + self.OvenBtns(byteOvenBtnNew,"press") + else: + self.OvenBtns(byteOvenBtnOld,"release") + self.OvenBtns(byteOvenBtnNew,"press") + PtDebugPrint("DEBUG: ercaControlRoom.OnSDLNotify():\t%s = %d" % (SDLOvenBtn.value,ageSDL[SDLOvenBtn.value][0]) ) + + elif VARname == "ercaBakeFinishTime": + byteAmBaking = ageSDL["ercaBakeFinishTime"][0] + + + + def OnNotify(self,state,id,events): + global byteImgrNew + #global scrollDir + global byteMixBtnNew + global byteOvenBtnNew + global OnInit + + ageSDL = PtGetAgeSDL() + + if (id == ActScrollLeft.id and state and LocalAvatar == PtFindAvatar(events)): + print "ActScrollLeft callback" + if byteImgrNew > 0: + #scrollDir = 0 + tempVal = byteImgrNew - 1 + ageSDL[SDLImgrView.value] = (tempVal,) + else: + PtDebugPrint("DEBUG: ercaControlRoom.OnNotify():\tCan't scroll any further to the left.") + + elif (id == ActScrollRight.id and state and LocalAvatar == PtFindAvatar(events)): + print "ActScrollRight callback" + if byteImgrNew < 3: + #scrollDir = 1 + tempVal = byteImgrNew + 1 + ageSDL[SDLImgrView.value] = (tempVal,) + else: + PtDebugPrint("DEBUG: ercaControlRoom.OnNotify():\tCan't scroll any further to the right.") + + elif (id == RespScrollLeft.id) or (id == RespScrollRight.id): + print "RespScrollX callback" + self.ImgrView(byteImgrNew,"enter") + + elif (id == RespImgrView0.id) or (id == RespImgrView1.id) or (id == RespImgrView2.id) or (id == RespImgrView3.id): + print "RespImgrView# callback" + if (id == RespImgrView0.id): + RespScrollBtnRt.run(self.key,state="on") + elif (id == RespImgrView1.id): + RespScrollBtns.run(self.key,state="on") + RespScrollBtnRt.run(self.key,state="on") + elif (id == RespImgrView2.id): + RespScrollBtns.run(self.key,state="on") + RespScrollBtnRt.run(self.key,state="on") + elif (id == RespImgrView3.id): + RespScrollBtns.run(self.key,state="on") + + if OnInit: + OnInit = 0 + if byteImgrNew == 1: + if byteMixBtnNew != 0: + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\tMixer btn SDL is not 0.") + RespMixIcons.run(self.key,state="on",fastforward=0) + if byteMixBtnNew == 1: + RespMixBtn1.run(self.key,state="press",fastforward=1) + elif byteMixBtnNew == 2: + RespMixBtn2.run(self.key,state="press",fastforward=1) + elif byteMixBtnNew == 3: + RespMixBtn3.run(self.key,state="press",fastforward=1) + elif byteMixBtnNew == 4: + RespMixBtn4.run(self.key,state="press",fastforward=1) + else: + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\tOn Mixer view, but btn SDL is 0, so no mixer icons.") + RespMixIcons.run(self.key,state="off",fastforward=0) + else: + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\tNot on mixer view, so no mixer icons.") + RespMixIcons.run(self.key,state="off",fastforward=0) + + if byteImgrNew == 0: + if byteOvenBtnNew != 0: + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\tOven btn SDL is not 0.") + RespOvenIcons.run(self.key,state="on",fastforward=0) + if byteOvenBtnNew == 1: + RespOvenBtn1.run(self.key,state="press",fastforward=1) + elif byteOvenBtnNew == 2: + RespOvenBtn2.run(self.key,state="press",fastforward=1) + elif byteOvenBtnNew == 3: + RespOvenBtn3.run(self.key,state="press",fastforward=1) + elif byteOvenBtnNew == 4: + RespOvenBtn4.run(self.key,state="press",fastforward=1) + else: + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\tOn Oven view, but btn SDL is 0, so no oven icons.") + RespOvenIcons.run(self.key,state="off",fastforward=0) + else: + PtDebugPrint("DEBUG: ercaControlRoom.OnServerInitComplete():\tNot on Oven view, so no oven icons.") + RespOvenIcons.run(self.key,state="off",fastforward=0) + + elif (id == RespMixBtn1.id) or (id == RespMixBtn2.id) or (id == RespMixBtn3.id) or (id == RespMixBtn4.id): + PtDebugPrint("RespMixBtn notify... id = %s, and state = %s" % (id,state)) + RespMixIcons.run(self.key,state="on") + + elif (id == RespOvenBtn1.id) or (id == RespOvenBtn2.id) or (id == RespOvenBtn3.id) or (id == RespOvenBtn4.id): + PtDebugPrint("RespOvenBtn notify... id = %s, and state = %s" % (id,state)) + RespOvenIcons.run(self.key,state="on") + + elif (id == ActBladesBtn.id and state and LocalAvatar == PtFindAvatar(events)): + print "mixer blades btn clicked" + if byteMixBtnNew != 0: + blade = bladesSDLs[byteMixBtnNew - 1] + if ageSDL[blade][0] == 0: + ageSDL[blade] = (1,) + PtDebugPrint("now setting SDL for %s to %d" % (blade,1)) + hatch = hatchSDLs[byteMixBtnNew - 1] + if ageSDL[hatch][0] == 1: + ageSDL[hatch] = (0,) + PtDebugPrint("Blades starting up, but hatch is unlocked. Will now lock hatch, setting SDL for %s to %d" % (hatch,1)) + else: + ageSDL[blade] = (0,) + PtDebugPrint("now setting SDL for %s to %d" % (blade,0)) + else: + PtDebugPrint("Btn is 0, no SDL to set") + return + + elif (id == ActHatchBtn.id and state and LocalAvatar == PtFindAvatar(events)): + print "mixer hatch btn clicked" + if byteMixBtnNew != 0: + hatchNum = byteMixBtnNew - 1 + hatch = hatchSDLs[hatchNum] + blade = bladesSDLs[hatchNum] + if hatch == "ercaPool1Hatch": + PtDebugPrint("Tried to operate pool 1 hatch, but it's can't be drained, and so access is denied!") + return + if ageSDL[blade][0] == 1: + PtDebugPrint("Tried to unlock hatch, but blades are spinning so request denied!") + return + if ageSDL[hatch][0] == 0: + ageSDL[hatch] = (1,) + PtDebugPrint("now setting SDL for %s to %d" % (hatch,1)) + else: + ageSDL[hatch] = (0,) + PtDebugPrint("now setting SDL for %s to %d" % (hatch,0)) + else: + PtDebugPrint("Btn is 0, no SDL to set") + return + + elif (id == ActValveBtn.id and state and LocalAvatar == PtFindAvatar(events)): + print "mixer valve btn clicked" + if byteMixBtnNew != 0: + valveNum = byteMixBtnNew - 1 + valve = valveSDLs[valveNum] + if valve == "ercaPool1Valve": + PtDebugPrint("Tried to operate pool 1 valve, but it's stuck; request denied!") + return + #print "valveNum = ",valveNum + tunnel = TunnelsOccupied[valveNum] + #print "tunnel = ",tunnel + if tunnel != []: + PtDebugPrint("tried to operate valve %d, but the tunnel is occupied; denied!" % (valveNum)) + print "players in this tunnel:" + for player in tunnel: + print player + RespWarningLight.run(self.key) + return + else: + print "that tunnel is clear of players, proceeding..." + if ageSDL[valve][0] == 0: + ageSDL[valve] = (1,) + PtDebugPrint("now setting SDL for %s to %d" % (valve,1)) + empty = emptySDLs[valveNum] + if ageSDL[empty][0] == 0: + ageSDL[empty] = (1,) + PtDebugPrint("Pool wasn't drained before, so will set SDL for %s to %d" % (empty,1)) + else: + ageSDL[valve] = (0,) + PtDebugPrint("now setting SDL for %s to %d" % (valve,0)) + else: + PtDebugPrint("Btn is 0, no SDL to set") + return + + elif (id == ActOvenPwrBtn.id and state and LocalAvatar == PtFindAvatar(events)): + print "oven-scope power btn clicked" + if byteOvenBtnNew != 0: + oven = ovenSDLs[byteOvenBtnNew - 1] + if (ageSDL["ercaBakeryElevPos"][0] != 0) or byteAmBaking: + PtDebugPrint("Tried to operate an oven-scope, but bakery elevator is in use or am baking; request denied!") + return + if ageSDL[oven][0] == 0: + ageSDL[oven] = (1,) + PtDebugPrint("now setting SDL for %s to %d" % (oven,1)) + else: + ageSDL[oven] = (0,) + PtDebugPrint("now setting SDL for %s to %d" % (oven,0)) + else: + PtDebugPrint("Btn is 0, no SDL to set") + return + + elif id == RgnTunnel1.id or id == RgnTunnel2.id or id == RgnTunnel3.id or id == RgnTunnel4.id: + #print "callback from rgn tunnel ID: ",id + for event in events: + if event[0] == kCollisionEvent: + try: + if event[2] == PtGetLocalAvatar(): + playerID = PtGetLocalPlayer().getPlayerID() + if event[1] == 1: + state = 1 + #print "enter tunnel ",id + else: + #print "exit tunnel ",id + state = 0 + else: + return + except NameError: + print "no more local avatar to see if in region" + return + rgn = 0 + for rgnID in RgnTunnelIDs: + if rgnID == id: + break + else: + rgn += 1 +# if state: +# print "playerID: %d has ENTERED tunnel: %d" % (playerID,rgn) +# else: +# print "playerID: %d has EXITED tunnel: %d" % (playerID,rgn) + self.SendNote('self.UpdateTunnelRgn(%d,%d,%d)' % (rgn,state,playerID)) + + elif id == (-1): + #print "incoming event: %s" % (events[0][1]) + code = events[0][1] + #print "playing command: %s" % (code) + exec code + + + def UpdateTunnelRgn(self,rgn,state,playerID): + #print "ercaControlRoom.UpdateTunnelRgn(): rgn = %d, state = %d, playerID = %d" % (rgn,state,playerID) + global TunnelsOccupied + if state: + if playerID not in TunnelsOccupied[rgn]: + TunnelsOccupied[rgn].append(playerID) + else: + if playerID in TunnelsOccupied[rgn]: + TunnelsOccupied[rgn].remove(playerID) + print "TunnelsOccupied = ",TunnelsOccupied + + + def ImgrView(self,view,mode,ff=0): + PtDebugPrint("DEBUG: ercaControlRoom.ImgrView():\tView = %d, and mode = %s" % (view,mode)) + if view == 0: + RespImgrView0.run(self.key,state="%s" % (mode),fastforward=ff) + elif view == 1: + RespImgrView1.run(self.key,state="%s" % (mode),fastforward=ff) + elif view == 2: + RespImgrView2.run(self.key,state="%s" % (mode),fastforward=ff) + elif view == 3: + RespImgrView3.run(self.key,state="%s" % (mode),fastforward=ff) + + + def MixerBtns(self,btn,mode,ff=0): + PtDebugPrint("DEBUG: ercaControlRoom.MixerBtns():\tBtn = %d, and mode = %s" % (btn,mode)) + if mode == "release": + RespMixIcons.run(self.key,state="off") + if btn == 0: + PtDebugPrint("DEBUG: ercaControlRoom.MixerBtns():\tOld btn is 0, do nothing.") + elif btn == 1: + RespMixBtn1.run(self.key,state="%s" % (mode),fastforward=ff) + elif btn == 2: + RespMixBtn2.run(self.key,state="%s" % (mode),fastforward=ff) + elif btn == 3: + RespMixBtn3.run(self.key,state="%s" % (mode),fastforward=ff) + elif btn == 4: + RespMixBtn4.run(self.key,state="%s" % (mode),fastforward=ff) + + + def OvenBtns(self,btn,mode,ff=0): + PtDebugPrint("DEBUG: ercaControlRoom.OvenBtns():\tBtn = %d, and mode = %s" % (btn,mode)) + if mode == "release": + RespOvenIcons.run(self.key,state="off") + if btn == 0: + PtDebugPrint("DEBUG: ercaControlRoom.OvenBtns():\tOld btn is 0, do nothing.") + elif btn == 1: + RespOvenBtn1.run(self.key,state="%s" % (mode),fastforward=ff) + elif btn == 2: + RespOvenBtn2.run(self.key,state="%s" % (mode),fastforward=ff) + elif btn == 3: + RespOvenBtn3.run(self.key,state="%s" % (mode),fastforward=ff) + elif btn == 4: + RespOvenBtn4.run(self.key,state="%s" % (mode),fastforward=ff) + + + def SendNote(self,ExtraInfo): + notify = ptNotify(self.key) + notify.clearReceivers() + notify.addReceiver(self.key) + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + notify.addVarNumber(str(ExtraInfo),1.0) + notify.send() + + diff --git a/Python/ercaHrvstr.py b/Python/ercaHrvstr.py new file mode 100644 index 0000000000..b3f4716663 --- /dev/null +++ b/Python/ercaHrvstr.py @@ -0,0 +1,740 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaHrvstr +Age: Ercana +Date: November 2003 +Author: Chris Doyle +all-powerful script for all things Harvester +""" + +from Plasma import * +from PlasmaTypes import * +import string +import time + +# --------- +# max wiring +# --------- +SDLHrvstrPwr = ptAttribString(1,"SDL: hrvstr power") +SDLHrvstrRev = ptAttribString(2,"SDL: hrvstr reverse") +SDLHrvstrPos = ptAttribString(3,"SDL: hrvstr main pos") +SDLHrvstrDrvLev = ptAttribString(4,"SDL: drive lever pos") +SDLHrvstrWngOk = ptAttribString(5,"SDL: wings allowed") +SDLHrvstrWngLev = ptAttribString(6,"SDL: wings lever pos") +SDLCarPos = ptAttribString(7,"SDL: car pos") +SDLCarLev = ptAttribString(8,"SDL: car lever pos") +ActDrvLev = ptAttribActivator(9,"clk: hrvstr drive lever") +ActWngLev = ptAttribActivator(10,"clk: hrvstr wings lever") +ActCarLev = ptAttribActivator(11,"clk: car lever") +ActCallHrvstrBtn = ptAttribActivator(12,"clk: call hrvstr") +ActCallCarBtn = ptAttribActivator(13,"clk: call car") +ActHrvstrAtStart = ptAttribActivator(14,"anm evt: hrvstr at start pos") +ActHrvstrNearStart = ptAttribActivator(15,"anm evt: hrvstr near start pos") +ActHrvstrNearEnd = ptAttribActivator(16,"anm evt: hrvstr near end pos") +ActHrvstrAtEnd = ptAttribActivator(17,"anm evt: hrvstr at end pos") +ActCarReady = ptAttribActivator(18,"anm evt: car ready to dock") +ActCarNotReady = ptAttribActivator(19,"anm evt: car not ready to dock") +RespDrvLevDwn = ptAttribResponder(20,"resp: drive lever down") +RespDrvLevUp = ptAttribResponder(21,"resp: drive lever up") +RespDrvLevAutoUp = ptAttribResponder(22,"resp: drive lever auto-up") +RespDrvLevOff = ptAttribResponder(23,"resp: drive lever off") +RespHrvstrGoFwd = ptAttribResponder(24,"resp: hrvstr go forward") +RespHrvstrGoRev = ptAttribResponder(25,"resp: hrvstr go reverse") +RespHrvstrStop = ptAttribResponder(26,"resp: hrvstr stop") +RespCarGoFwd = ptAttribResponder(27,"resp: car go forward") +RespCarGoRev = ptAttribResponder(28,"resp: car go reverse") +RespCarStop = ptAttribResponder(29,"resp: car stop") +RespWngLevOff = ptAttribResponder(30,"resp: wings lever off") +RespWngLevDwn = ptAttribResponder(31,"resp: wings lever down") +RespWngLevUp = ptAttribResponder(32,"resp: wings lever up") +RespLadderGoDwn = ptAttribResponder(33,"resp: ladder go down") +RespLadderGoUp = ptAttribResponder(34,"resp: ladder go up") +RespWngGoDwn = ptAttribResponder(35,"resp: wings go down") +RespWngGoUp = ptAttribResponder(36,"resp: wings go up") +RespCarLevOff = ptAttribResponder(37,"resp: car lever off") +RespCarGoUp = ptAttribResponder(38,"resp: car go up") +RespCarGoDwn = ptAttribResponder(39,"resp: car go down") +RespCallCarBtnDwn = ptAttribResponder(40,"resp: car call btn down") +RespCallCarBtnUp = ptAttribResponder(41,"resp: car call btn up") +RespCallHrvstrBtnDwn = ptAttribResponder(42,"resp: hrvstr call btn down") +RespCallHrvstrBtnUp = ptAttribResponder(43,"resp: hrvstr call btn up") +RespCallCar = ptAttribResponder(44,"resp: call car") +RespCallHrvstr = ptAttribResponder(45,"resp: call hrvstr") +ActRevKnob = ptAttribActivator(46,"clk: reverse knob") +RespRevKnobDwn = ptAttribResponder(47,"resp: reverse knob down") +RespRevKnobUp = ptAttribResponder(48,"resp: reverse knob up") +RespRevKnobAutoUp = ptAttribResponder(49,"resp: reverse knob auto-up") +SDLHrvstrMoving = ptAttribString(50,"SDL: hrvstr in motion") +SDLDockGate = ptAttribString(51,"SDL: dock gate") +RespRampsGoDwn = ptAttribResponder(52,"resp: ramps go down") +RespRampsGoUp = ptAttribResponder(53,"resp: ramps go up") +RespCallCarUp = ptAttribResponder(54,"resp: call car up") +ActLadderTop = ptAttribActivator(55, "rgn snsr: ladder top") +ActLadderBtm = ptAttribActivator(56, "rgn snsr: ladder bottom") +MltStgLadderTop = ptAttribBehavior(57, "multistage: ladder top",netForce=1) +MltStgLadderBtm = ptAttribBehavior(58, "multistage: ladder bottom",netForce=1) +RespDrvLevDwnOnInit = ptAttribResponder(59,"resp: drv lev down OnInit") +RespCarLevDwnOnInit = ptAttribResponder(60,"resp: car lev down OnInit") + + +# --------- +# globals +# --------- +boolPwr = 0 +boolRev = 0 +bytePos = 0 +boolDrvLev = 0 +boolWngOk = 0 +boolWngLev = 0 +byteCarPos = 0 +boolCarLev = 0 +boolMoving = 0 +callHrvstr = 0 +boolGate = 0 +carDocking = 0 +#AgeStartedIn = None +LocalAvatar = None +TopLadder = 0 +BtmLadder = 0 + + +class ercaHrvstr(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 7025 + self.version = 8 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global boolPwr + global boolRev + global bytePos + global boolDrvLev + global boolWngOk + global boolWngLev + global byteCarPos + global boolCarLev + global boolMoving + global boolGate + global LocalAvatar + + LocalAvatar = PtGetLocalAvatar() + + ageSDL = PtGetAgeSDL() + + ageSDL.setFlags(SDLHrvstrPwr.value,1,1) + ageSDL.sendToClients(SDLHrvstrPwr.value) + ageSDL.setFlags(SDLHrvstrRev.value,1,1) + ageSDL.sendToClients(SDLHrvstrRev.value) + ageSDL.setFlags(SDLHrvstrPos.value,1,1) + ageSDL.sendToClients(SDLHrvstrPos.value) + ageSDL.setFlags(SDLHrvstrDrvLev.value,1,1) + ageSDL.sendToClients(SDLHrvstrDrvLev.value) + ageSDL.setFlags(SDLHrvstrWngOk.value,1,1) + ageSDL.sendToClients(SDLHrvstrWngOk.value) + ageSDL.setFlags(SDLHrvstrWngLev.value,1,1) + ageSDL.sendToClients(SDLHrvstrWngLev.value) + ageSDL.setFlags(SDLCarPos.value,1,1) + ageSDL.sendToClients(SDLCarPos.value) + ageSDL.setFlags(SDLCarLev.value,1,1) + ageSDL.sendToClients(SDLCarLev.value) + ageSDL.setFlags(SDLHrvstrMoving.value,1,1) + ageSDL.sendToClients(SDLHrvstrMoving.value) + ageSDL.setFlags(SDLDockGate.value,1,1) + ageSDL.sendToClients(SDLDockGate.value) + + ageSDL.setNotify(self.key,SDLHrvstrPwr.value,0.0) + ageSDL.setNotify(self.key,SDLHrvstrRev.value,0.0) + ageSDL.setNotify(self.key,SDLHrvstrPos.value,0.0) + ageSDL.setNotify(self.key,SDLHrvstrDrvLev.value,0.0) + ageSDL.setNotify(self.key,SDLHrvstrWngOk.value,0.0) + ageSDL.setNotify(self.key,SDLHrvstrWngLev.value,0.0) + ageSDL.setNotify(self.key,SDLCarPos.value,0.0) + ageSDL.setNotify(self.key,SDLCarLev.value,0.0) + ageSDL.setNotify(self.key,SDLHrvstrMoving.value,0.0) + ageSDL.setNotify(self.key,SDLDockGate.value,0.0) + + + try: + boolPwr = ageSDL[SDLHrvstrPwr.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + boolPwr = 1 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLHrvstrPwr.value,boolPwr) ) + try: + boolRev = ageSDL[SDLHrvstrRev.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + boolRev = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLHrvstrRev.value,boolRev) ) + try: + bytePos = ageSDL[SDLHrvstrPos.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + bytePos = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLHrvstrPos.value,bytePos) ) + try: + boolDrvLev = ageSDL[SDLHrvstrDrvLev.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + boolDrvLev = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLHrvstrDrvLev.value,boolDrvLev) ) + try: + boolWngOk = ageSDL[SDLHrvstrWngOk.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + boolWngOk = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLHrvstrWngOk.value,boolWngOk) ) + try: + boolWngLev = ageSDL[SDLHrvstrWngLev.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + boolWngLev = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLHrvstrWngLev.value,boolWngLev) ) + try: + byteCarPos = ageSDL[SDLCarPos.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + byteCarPos = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLCarPos.value,byteCarPos) ) + try: + boolCarLev = ageSDL[SDLCarLev.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + boolCarLev = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLCarLev.value,boolCarLev) ) + try: + boolMoving = ageSDL[SDLHrvstrMoving.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + boolMoving = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLHrvstrMoving.value,boolMoving) ) + try: + boolGate = ageSDL[SDLDockGate.value][0] + except: + PtDebugPrint("ERROR: ercaHrvstr.OnServerInitComplete():\tERROR reading age SDL") + boolGate = 0 + PtDebugPrint("DEBUG: ercaHrvstr.OnServerInitComplete():\t%s = %d" % (SDLDockGate.value,boolGate) ) + + if boolRev: + RespRevKnobDwn.run(self.key,fastforward=1) + else: + RespRevKnobUp.run(self.key,fastforward=1) + + + ## if other players are already in the age, don't pre-set the Harvester + if len(PtGetPlayerList()): + if boolDrvLev: + RespDrvLevDwnOnInit.run(self.key,fastforward=1) + if boolCarLev: + RespCarLevDwnOnInit.run(self.key,fastforward=1) + if boolMoving: + RespLadderGoUp.run(self.key,fastforward=1) + if bytePos != 0 and bytePos != 4: + RespRampsGoUp.run(self.key,fastforward=1) + else: + RespRampsGoDwn.run(self.key,fastforward=1) + return + + ## otherwise if I'm linking in and no one's here, make sure the Harvester is properly pre-set + if byteCarPos == 4: + ageSDL[SDLCarPos.value] = (1,) + byteCarPos = 1 + elif byteCarPos == 2: + ageSDL[SDLCarPos.value] = (3,) + byteCarPos = 3 + + if boolDrvLev: + boolDrvLev = 0 + ageSDL[SDLHrvstrDrvLev.value] = (0,) + if boolRev: + RespHrvstrGoRev.run(self.key,fastforward=1) + RespHrvstrStop.run(self.key) + if byteCarPos == 0: + RespCarGoRev.run(self.key,fastforward=1) + RespCarStop.run(self.key) + RespRampsGoDwn.run(self.key,fastforward=1) + else: + RespRampsGoUp.run(self.key,fastforward=1) + else: + RespHrvstrGoFwd.run(self.key,fastforward=1) + RespHrvstrStop.run(self.key) + if byteCarPos == 0: + RespCarGoFwd.run(self.key,fastforward=1) + RespCarStop.run(self.key) + RespRampsGoDwn.run(self.key,fastforward=1) + else: + RespRampsGoUp.run(self.key,fastforward=1) + RespDrvLevAutoUp.run(self.key,fastforward=1) + #RespHrvstrStop.run(self.key,fastforward=1) + #RespCarStop.run(self.key,fastforward=1) + RespLadderGoDwn.run(self.key,fastforward=1) + else: + if bytePos == 0 and byteCarPos == 0: + RespRampsGoDwn.run(self.key,fastforward=1) + elif bytePos == 4 and byteCarPos == 1: + RespRampsGoDwn.run(self.key,fastforward=1) + else: + RespRampsGoUp.run(self.key,fastforward=1) + + if bytePos == 0 and boolRev == 1: + ageSDL[SDLHrvstrPwr.value] = (0,) + boolPwr = 0 + elif bytePos == 4 and boolRev == 0: + ageSDL[SDLHrvstrPwr.value] = (0,) + boolPwr = 0 + else: + if boolPwr == 0: + ageSDL[SDLHrvstrPwr.value] = (1,) + boolPwr = 1 + + if boolMoving: + boolMoving = 0 + ageSDL[SDLHrvstrMoving.value] = (0,) + + if byteCarPos == 1: + RespCarGoDwn.run(self.key,fastforward=1) + if boolGate: + ageSDL[SDLDockGate.value] = (0,) + boolGate = 0 + elif byteCarPos == 3: + RespCarGoUp.run(self.key,fastforward=1) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolPwr + global boolRev + global bytePos + global boolDrvLev + global boolWngOk + global boolWngLev + global byteCarPos + global boolCarLev + global callHrvstr + global boolMoving + + ageSDL = PtGetAgeSDL() + + if VARname == SDLHrvstrPwr.value: + boolPwr = ageSDL[SDLHrvstrPwr.value][0] + + if VARname == SDLHrvstrRev.value: + boolRev = ageSDL[SDLHrvstrRev.value][0] + PtDebugPrint("boolRev now equals %d" % (boolRev)) + if not self.sceneobject.isLocallyOwned(): + return + if callHrvstr: + ageSDL[SDLHrvstrDrvLev.value] = (1,) + elif bytePos == 0 and boolRev == 1: + ageSDL[SDLHrvstrPwr.value] = (0,) + elif bytePos == 4 and boolRev == 0: + ageSDL[SDLHrvstrPwr.value] = (0,) + else: + if boolPwr == 0: + ageSDL[SDLHrvstrPwr.value] = (1,) + + if VARname == SDLHrvstrPos.value: + bytePos = ageSDL[SDLHrvstrPos.value][0] + if not self.sceneobject.isLocallyOwned(): + return + if bytePos == 0: + ageSDL[SDLHrvstrDrvLev.value] = (0,) + if boolRev == 1: + ageSDL[SDLHrvstrPwr.value] = (0,) + elif bytePos == 2: + print "SDLHrvstrPos set to 2" + elif bytePos == 4: + ageSDL[SDLHrvstrDrvLev.value] = (0,) + if boolRev == 0: + ageSDL[SDLHrvstrPwr.value] = (0,) + else: + if boolPwr == 0: + ageSDL[SDLHrvstrPwr.value] = (1,) + + if VARname == SDLHrvstrDrvLev.value: + boolDrvLev = ageSDL[SDLHrvstrDrvLev.value][0] + if boolDrvLev: + if callHrvstr: + print "onSDLnotify for drvlev, if callHrvstr true will DriveHrvstr" + self.DriveHrvstr() + else: + print "onSDLnotify for drvlev, says callHrvstr is false and will runRespLadderGoUp" + if bytePos == 0 and byteCarPos == 0: + RespRampsGoUp.run(self.key) + elif bytePos == 4 and byteCarPos == 1: + RespRampsGoUp.run(self.key) + RespLadderGoUp.run(self.key) + if TopLadder: + print "I'm getting kicked from top ladder multistage" + MltStgLadderTop.gotoStage(LocalAvatar, -1) + if BtmLadder: + print "I'm getting kicked from bottom ladder multistage" + MltStgLadderBtm.gotoStage(LocalAvatar, -1) + else: + print "SDL for lever set to 0, did this happen?" + self.DriveHrvstr() + + if VARname == SDLHrvstrWngOk.value: + boolWngOk = ageSDL[SDLHrvstrWngOk.value][0] + + if VARname == SDLHrvstrWngLev.value: + boolWngLev = ageSDL[SDLHrvstrWngLev.value][0] + self.HrvstrWings() + + if VARname == SDLCarPos.value: + byteCarPos = ageSDL[SDLCarPos.value][0] + + if VARname == SDLCarLev.value: + boolCarLev = ageSDL[SDLCarLev.value][0] + if boolCarLev: + RespCallCarUp.run(self.key) + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarPos.value] = (2,) + + if VARname == SDLHrvstrMoving.value: + boolMoving = ageSDL[SDLHrvstrMoving.value][0] + if boolMoving and self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrPos.value] = (2,) + + if VARname == SDLDockGate.value: + boolGate = ageSDL[SDLDockGate.value][0] + + + def OnNotify(self,state,id,events): + global boolPwr + global boolRev + global bytePos + global boolDrvLev + global boolWngOk + global boolWngLev + global byteCarPos + global boolCarLev + global boolMoving + global callHrvstr + global carDocking + global TopLadder + global BtmLadder + + ageSDL = PtGetAgeSDL() + + #if (id == ActRevKnob.id and state and LocalAvatar == PtFindAvatar(events)): + if (id == ActRevKnob.id and state): + print "ActRevKnob callback" + if boolRev: + if boolMoving: + print "insert stuck/down oneshot here" + else: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tRev knob moving up.") + RespRevKnobUp.run(self.key,avatar=PtFindAvatar(events)) + else: + if boolMoving: + print "insert stuck/up oneshot here" + else: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tRev knob moving down.") + RespRevKnobDwn.run(self.key,avatar=PtFindAvatar(events)) + + if (id == RespRevKnobUp.id) and self.sceneobject.isLocallyOwned(): + print "RespRevKnobDwn callback" + ageSDL[SDLHrvstrRev.value] = (0,) + + if (id == RespRevKnobDwn.id) and self.sceneobject.isLocallyOwned(): + print "RespRevKnobDwn callback" + ageSDL[SDLHrvstrRev.value] = (1,) + + if (id == RespRevKnobAutoUp.id) and self.sceneobject.isLocallyOwned(): + if callHrvstr: + print "in RespRevKnobAutoUp, will set SDL for rev to 0" + ageSDL[SDLHrvstrRev.value] = (0,) + + if (id == ActDrvLev.id and state): + if boolPwr: + if boolDrvLev: + if carDocking: + RespDrvLevOff.run(self.key,avatar=PtFindAvatar(events)) + else: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tDrv lev is moving up.") + RespDrvLevUp.run(self.key,avatar=PtFindAvatar(events)) + else: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tDrv lev is moving down.") + ActLadderTop.disable() + ActLadderBtm.disable() + RespDrvLevDwn.run(self.key,avatar=PtFindAvatar(events)) + else: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tDrv lev has no power.") + RespDrvLevOff.run(self.key,avatar=PtFindAvatar(events)) + + if (id == RespDrvLevUp.id) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrDrvLev.value] = (0,) + + if (id == RespDrvLevAutoUp.id) and self.sceneobject.isLocallyOwned(): + if callHrvstr: + print "in RespDrvLevAutoUp, will set SDL for drvlev to 0" + ageSDL[SDLHrvstrDrvLev.value] = (0,) + + if (id == RespDrvLevDwn.id) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrDrvLev.value] = (1,) + + if (id == ActHrvstrAtStart.id and state) and self.sceneobject.isLocallyOwned(): + if boolRev: + ageSDL[SDLHrvstrPos.value] = (0,) + print "Anim event to set SDLHrvstrPos to 0, is this happening?" + + if (id == ActHrvstrNearStart.id and state) and self.sceneobject.isLocallyOwned(): + print "blah" + #ageSDL[SDLHrvstrPos.value] = (1,) + + if (id == ActHrvstrNearEnd.id and state) and self.sceneobject.isLocallyOwned(): + print "blah" + #ageSDL[SDLHrvstrPos.value] = (3,) + + if (id == ActHrvstrAtEnd.id and state) and self.sceneobject.isLocallyOwned(): + if not boolRev: + ageSDL[SDLHrvstrPos.value] = (4,) + print "Anim event to set SDLHrvstrPos to 4, is this happening?" + + if (id == RespLadderGoUp.id): + self.DriveHrvstr() + + if (id == RespLadderGoDwn.id): + pass + #ActLadderTop.enable() + #ActLadderBtm.enable() + + if (id == ActCarNotReady.id and state) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarPos.value] = (0,) + + if (id == ActCarReady.id and state) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarPos.value] = (1,) + + if (id == ActWngLev.id and state): + if boolPwr and boolWngOk: + if boolWngLev: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tWngs lev is moving up.") + RespWngLevUp.run(self.key,avatar=PtFindAvatar(events)) + else: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tWngs lev is moving down.") + RespWngLevDwn.run(self.key,avatar=PtFindAvatar(events)) + else: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tWng lev has no power or not OK to use now.") + RespWngLevOff.run(self.key,avatar=PtFindAvatar(events)) + + if (id == RespWngLevUp.id) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrWngLev.value] = (0,) + + if (id == RespWngLevDwn.id) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrWngLev.value] = (1,) + + if (id == ActCarLev.id and state): + if bytePos != 4: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tCar lever can't be used now.") + RespCarLevOff.run(self.key,avatar=PtFindAvatar(events)) + elif byteCarPos == 1: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tCar moving up.") + RespCarGoUp.run(self.key,avatar=PtFindAvatar(events)) + ageSDL[SDLCarPos.value] = (2,) + elif byteCarPos == 3: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tCar moving down.") + RespCarGoDwn.run(self.key,avatar=PtFindAvatar(events)) + carDocking = 1 + ageSDL[SDLCarPos.value] = (4,) + ageSDL[SDLDockGate.value] = (0,) + + if (id == RespCarGoUp.id) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarPos.value] = (3,) + ageSDL[SDLDockGate.value] = (1,) + + if (id == RespCarGoDwn.id): + carDocking = 0 + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarPos.value] = (1,) + if bytePos == 4: + RespRampsGoDwn.run(self.key) + + if (id == ActCallCarBtn.id and state): + RespCallCarBtnDwn.run(self.key,avatar=PtFindAvatar(events)) + + if (id == RespCallCarBtnDwn.id): + if bytePos == 4 and byteCarPos == 3: + RespCallCar.run(self.key) + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarPos.value] = (4,) + ageSDL[SDLDockGate.value] = (0,) + else: + RespCallCarBtnUp.run(self.key) + + if (id == ActCallHrvstrBtn.id and state): + RespCallHrvstrBtnDwn.run(self.key,avatar=PtFindAvatar(events)) + + if (id == RespCallHrvstrBtnDwn.id): + if byteCarPos == 3 and bytePos != 4: + callHrvstr = 1 + if boolMoving: + print "in RespCallHrvstrBtnDown, will now run lev auto up" + RespDrvLevAutoUp.run(self.key) + else: + RespCallHrvstr.run(self.key) + else: + RespCallHrvstrBtnUp.run(self.key) + + if (id == RespCallCar.id): + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarPos.value] = (1,) + RespCallCarBtnUp.run(self.key) + + if (id == RespCallHrvstr.id): + if boolRev: + print "in RespCallHrvstr, boolRev is true so will run RespRevKnobAutoUp" + RespRevKnobAutoUp.run(self.key) + else: + print "in RespCallHrvstr, will set drvlev SDL to true" + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrDrvLev.value] = (1,) + + if (id == RespHrvstrStop.id): + print "resp hrvstr stop, did this happen?" + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrMoving.value] = (0,) + if callHrvstr: + print "will run RespCallHrvstr, if callHrvstr in RespHrvstrStop notify" + RespCallHrvstr.run(self.key) + + if (id == RespCallCarUp.id) and self.sceneobject.isLocallyOwned(): + ageSDL[SDLCarLev.value] = (0,) + ageSDL[SDLCarPos.value] = (3,) + ageSDL[SDLDockGate.value] = (1,) + + if (id == ActLadderTop.id and state): + #print "ActLadderTop callback" + if LocalAvatar == PtFindAvatar(events): + print "TopLadder = 1" + TopLadder = 1 + MltStgLadderTop.run(avatar=PtFindAvatar(events)) + #ageSDL[SDLHrvstrPwr.value] = (0,) + + if (id == ActLadderBtm.id and state): + #print "ActLadderBtm callback" + if LocalAvatar == PtFindAvatar(events): + print "BtmLadder = 1" + BtmLadder = 1 + MltStgLadderBtm.run(avatar=PtFindAvatar(events)) + #ageSDL[SDLHrvstrPwr.value] = (0,) + + if (id == MltStgLadderTop.id): + #print "MltStgLadderTop callback" + if LocalAvatar == PtFindAvatar(events): + print "TopLadder = 0" + TopLadder = 0 + #ageSDL[SDLHrvstrPwr.value] = (1,) + + if (id == MltStgLadderBtm.id): + #print "MltStgLadderBtm callback" + if LocalAvatar == PtFindAvatar(events): + print "BtmLadder = 0" + BtmLadder = 0 + #ageSDL[SDLHrvstrPwr.value] = (1,) + + + def DriveHrvstr(self): + global boolPwr + global boolRev + global bytePos + global boolDrvLev + global boolWngOk + global boolWngLev + global byteCarPos + global boolCarLev + global boolMoving + global callHrvstr + + ageSDL = PtGetAgeSDL() + + if boolDrvLev: + if boolPwr: + if boolRev: + print "in DriveHrvstr, will now run RespHrvstrGoRev" + RespHrvstrGoRev.run(self.key) + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrMoving.value] = (1,) + if byteCarPos == 0 or byteCarPos == 1: + RespCarGoRev.run(self.key) + else: + print "in DriveHrvstr, will now run RespHrvstrGoFwd" + RespHrvstrGoFwd.run(self.key) + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrMoving.value] = (1,) + if byteCarPos == 0 or byteCarPos == 1: + RespCarGoFwd.run(self.key) + else: + PtDebugPrint("DEBUG: ercaHrvstr.DriveHrvstr:\tThis shouldn't be possible.") + else: + print "DriveHrvstr, boolDrvLev is 0, is this happening?" + if bytePos == 0 or bytePos == 4: + if callHrvstr: + RespCallHrvstrBtnUp.run(self.key) + callHrvstr = 0 + RespDrvLevAutoUp.run(self.key) + RespHrvstrStop.run(self.key) + if byteCarPos == 0 or byteCarPos == 1: + RespCarStop.run(self.key) + if bytePos == 0 or bytePos == 4: + RespRampsGoDwn.run(self.key) + if not callHrvstr: + RespLadderGoDwn.run(self.key) + + + def HrvstrWings(self): + global boolPwr + global boolRev + global bytePos + global boolDrvLev + global boolWngOk + global boolWngLev + global byteCarPos + global boolCarLev + global boolMoving + + ageSDL = PtGetAgeSDL() + + if boolPwr and boolWngOk: + if boolWngLev: + RespWngGoDwn.run(self.key) + else: + RespWngGoUp.run(self.key) + else: + PtDebugPrint("DEBUG: ercaHrvstr.HrvstrWings:\tThis shouldn't be possible.") + + + def OnTimer(self,id): + print "ercaHrvstr.OnTimer" + + + diff --git a/Python/ercaLadderHatch.py b/Python/ercaLadderHatch.py new file mode 100644 index 0000000000..2be351235b --- /dev/null +++ b/Python/ercaLadderHatch.py @@ -0,0 +1,226 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaLadderHatch.py +Age: Ercana +Date: December 2003 +Author: Chris Doyle +toggles an age sdl bool only if another age sdl bool is true +""" + +from Plasma import * +from PlasmaTypes import * +import string +import PlasmaControlKeys + +# --------- +# max wiring +# --------- + +SDLHatch = ptAttribString(1,"SDL: hatch unlocked") +SDLEmpty = ptAttribString(2,"SDL: pool empty") +ActLddr = ptAttribActivator(3,"rgn snsr: ladder hatch") +MltStgLddr = ptAttribBehavior(4, "mlt stg: use hatch/climb ladder") +RespHatchOps = ptAttribResponder(5, "resp: hatch ops",['lockedabove','openabove','lockedbelow','openbelow','close']) +StrDirection = ptAttribString(6, 'Direction: Going up or down?', 'up') +RespHatchLocked = ptAttribResponder(7, "resp: hatch locked - only at top") + + +# --------- +# globals +# --------- + +boolHatch = 0 +boolEmpty = 0 +iamclimber = false +LocalAvatar = None + + +class ercaLadderHatch(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 7028 + self.version = 4 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global boolHatch + global boolEmpty + ageSDL = PtGetAgeSDL() + + ageSDL.setFlags(SDLHatch.value,1,1) + ageSDL.sendToClients(SDLHatch.value) + ageSDL.setFlags(SDLEmpty.value,1,1) + ageSDL.sendToClients(SDLEmpty.value) + + ageSDL.setNotify(self.key,SDLHatch.value,0.0) + ageSDL.setNotify(self.key,SDLEmpty.value,0.0) + + try: + boolHatch = ageSDL[SDLHatch.value][0] + except: + PtDebugPrint("ERROR: ercaLadderHatch.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolHatch = 0 + PtDebugPrint("DEBUG: ercaLadderHatch.OnServerInitComplete():\t%s = %d" % (SDLHatch.value,ageSDL[SDLHatch.value][0]) ) + try: + boolEmpty = ageSDL[SDLEmpty.value][0] + except: + PtDebugPrint("ERROR: ercaLadderHatch.OnServerInitComplete():\tERROR reading SDL name for pool empty") + boolEmpty = 0 + PtDebugPrint("DEBUG: ercaLadderHatch.OnServerInitComplete():\t%s = %d" % (SDLEmpty.value,ageSDL[SDLEmpty.value][0]) ) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolHatch + global boolEmpty + ageSDL = PtGetAgeSDL() + + if VARname == SDLHatch.value: + boolHatch = ageSDL[SDLHatch.value][0] + + if VARname == SDLEmpty.value: + boolEmpty = ageSDL[SDLEmpty.value][0] + + + def OnNotify(self,state,id,events): + global boolHatch + global boolEmpty + global iamclimber + global LocalAvatar + ageSDL = PtGetAgeSDL() + + if (StrDirection.value) == "down": + if (id == ActLddr.id and state and PtWasLocallyNotified(self.key) and not iamclimber): + LocalAvatar = PtFindAvatar(events) + if boolHatch: + MltStgLddr.run(LocalAvatar) + #RespHatchOps.run(self.key,state='openabove') + iamclimber = true + return + else: + RespHatchLocked.run(self.key,avatar=LocalAvatar) + return + + if (StrDirection.value) == "up": + if (id == ActLddr.id and state and PtWasLocallyNotified(self.key)): + LocalAvatar = PtFindAvatar(events) + MltStgLddr.run(LocalAvatar) + + for event in events: + # multistage callback from stage 2 send when advancing + if event[0] == kMultiStageEvent: + if type(LocalAvatar) == type(None): + return + if PtFindAvatar(events) == LocalAvatar: + + if (StrDirection.value) == "up": + if event[2] == kAdvanceNextStage: + stageNum = event[1] + print "Going up. Got stage advance callback from stage %d" % stageNum + if stageNum == 1: + print "In stage 2, negotiating hatch." + self.INegotiateHatch(); + elif stageNum == 2: + # after the "it's locked" anim, return to the climb... + MltStgLddr.gotoStage(LocalAvatar, 1,0,0) + elif stageNum == 2 or stageNum == 3 or stageNum == 5: + print "Got through hatch: finishing & removing brain." + MltStgLddr.gotoStage(LocalAvatar, -1) + + elif (StrDirection.value) == "down": + stageNum = event[1] + print "Going down. Message from multistage %i" % stageNum + if event[2] == kRegressPrevStage: # and stageNum == 2: + print "Got stage Regress callback from stage %d" % stageNum + self.INegotiateHatch() + elif event[2] == kAdvanceNextStage: + if stageNum == 1: # finished getting on, now find out if water is up + print "checking drained" + if boolEmpty == 0: + MltStgLddr.gotoStage(LocalAvatar, 7,0,0); + print "water not drained" + if stageNum == 4: + if boolEmpty == 0: + MltStgLddr.gotoStage(LocalAvatar, 7,dirFlag=1,isForward=1) + # after the "it's locked" anim, return to the climb... + else: + MltStgLddr.gotoStage(LocalAvatar, 2,dirFlag=1,isForward=1) + print "now stage 3/7 again" + elif stageNum == 6: + print "Got through hatch: finishing & removing brain." + MltStgLddr.gotoStage(LocalAvatar, -1) + iamclimber = false + #ActStart.enable() + elif stageNum == 3: + print "done with bottom" + iamclimber = false + MltStgLddr.gotoStage(LocalAvatar, -1) + + if (id == RespHatchLocked.id): + RespHatchOps.run(self.key,state='lockedabove') + + + def INegotiateHatch(self): + global boolHatch + print "Negotiating hatch" + if boolHatch == 0: + self.IHatchLocked() + else: + self.IHatchUnlocked() + + + def IHatchLocked(self): + "Hatch is locked; show the frustrated animation and return to previous stage" + global LocalAvatar + if (StrDirection.value) == "up": + print "Going up. Hatch is locked; Sending gotoStage(2)" + RespHatchOps.run(self.key,state='lockedbelow') + MltStgLddr.gotoStage(LocalAvatar,2,0,1) + elif (StrDirection.value) == "down": + print "Going down. Hatch is locked; Sending gotoStage(4)" + MltStgLddr.gotoStage(LocalAvatar,4,dirFlag=1,isForward=1,setTimeFlag=1,newTime=0.0) + RespHatchOps.run(self.key,state='lockedbelow') + + + def IHatchUnlocked(self): + "Hatch is unlocked; open it and pass through." + global LocalAvatar + global iamclimber + if (StrDirection.value) == "up": + print "Going up. Hatch is unlocked; Sending gotoStage(3)" + #RespHatchOps.run(self.key,state='openbelow') + MltStgLddr.gotoStage(LocalAvatar,4,0,0) + elif (StrDirection.value) == "down": + print "Going down. Hatch is unlocked; Sending gotoStage(5)" + MltStgLddr.gotoStage(LocalAvatar,5,dirFlag=1,isForward=1,setTimeFlag=1,newTime=0.0) + #RespHatchOps.run(self.key,state='openbelow') + iamclimber = false + diff --git a/Python/ercaOvenScope.py b/Python/ercaOvenScope.py new file mode 100644 index 0000000000..dba4eb3bb5 --- /dev/null +++ b/Python/ercaOvenScope.py @@ -0,0 +1,662 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaOvenScope +Age: Ercana +Date: December, 2003 +Author: Chris Doyle, based on xTelescope.py by Mark DeForest, Bill Slease, Doug McBride +This is the handler for Ercana's bakery oven-scopes +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys +import string +import xEnum +from math import * + + +# define the attributes that will be entered in max +Activate = ptAttribActivator(1, "clk: Oven scope",netForce=1) +Camera = ptAttribSceneobject(2,"Oven scope camera") +Behavior = ptAttribBehavior(3, "Scope behavior (multistage)",netForce=1) +Vignette = ptAttribString(4,"Vignette dialog - by Name") +SDLBakeryPwr = ptAttribString(5,"SDL: bakery power") +SDLScopePwr = ptAttribString(6,"SDL: scope power") +CameraBad = ptAttribSceneobject(7,"Oven scope camera - no power") +VignetteBad = ptAttribString(8,"Vignette dialog - no power") +ScopeNum = ptAttribInt(9,"Oven scope #") +RespTimeSlider = ptAttribResponder(10,"resp: time slider",['off','on']) +RespAmountSlider = ptAttribResponder(11,"resp: amount slider",['off','on']) +RespTempSlider = ptAttribResponder(12,"resp: temp slider",['off','on']) +RespSoundTest = ptAttribResponder(13,"resp: sound test") +RespMayBake = ptAttribResponder(14,"resp: may bake",['no','yes']) +RespSfxTimerWheel = ptAttribResponder(15,"resp: timer wheel sfx",['off','on']) + + +#----------------------------------- +# konstants for the GUI buttons and time scale + +kTimeSlider = 100 +kAmountSlider = 200 +kTempSlider = 300 +kBakeBtn = 400 +kTimerWheel = 500 +kTempWheel = 600 +kTimeScale = 180 # each slider notch is 3 minutes each ## THIS IS THE FINAL SETTING +#kTimeScale = 2 # each slider notch is 2 secs each ## THIS IS FOR QA TESTING ONLY! + +# --------- +# globals + +LocalAvatar = None +boolScopeOperator = 0 +boolOperated = 0 +Telescope = ptInputInterface() +boolBakeryPwr = 0 +boolScopePwr = 0 +WasPowered = 1 +listTimeSDLs = ['ercaTimeSlider1','ercaTimeSlider2','ercaTimeSlider3','ercaTimeSlider4'] +listAmountSDLs = ['ercaAmountSlider1','ercaAmountSlider2','ercaAmountSlider3','ercaAmountSlider4'] +listTempSDLs = ['ercaTempSlider1','ercaTempSlider2','ercaTempSlider3','ercaTempSlider4'] +timeSDL = None +amountSDL = None +tempSDL = None +byteTime = 0 +byteAmount = 0 +byteTemp = 0 +timeSlider = None +amountSlider = None +tempSlider = None +bakeBtn = None +timerWheel = None +tempWheel = None +boolMayBake = 0 +IsBaking = 0 +exitScope = 0 +setTempWheel = 0 + +class ercaOvenScope(ptModifier): + + def __init__(self): + ptModifier.__init__(self) + self.id = 7030 + self.version = 9 + + + def OnFirstUpdate(self): + self.SDL.setDefault("boolOperated",(0,)) + self.SDL.setDefault("OperatorID",(-1,)) + self.SDL.sendToClients("boolOperated") + self.SDL.sendToClients("OperatorID") + + + def OnServerInitComplete(self): + global boolBakeryPwr + global boolScopePwr + global timeSDL + global amountSDL + global tempSDL + global byteTime + global byteAmount + global byteTemp + global boolMayBake + global IsBaking + + timeSDL = listTimeSDLs[ScopeNum.value - 1] + amountSDL = listAmountSDLs[ScopeNum.value - 1] + tempSDL = listTempSDLs[ScopeNum.value - 1] + + ageSDL = PtGetAgeSDL() + + ageSDL.setFlags(SDLBakeryPwr.value,1,1) + ageSDL.sendToClients(SDLBakeryPwr.value) + ageSDL.setFlags(SDLScopePwr.value,1,1) + ageSDL.sendToClients(SDLScopePwr.value) + ageSDL.setFlags(timeSDL,1,1) + ageSDL.sendToClients(timeSDL) + ageSDL.setFlags(amountSDL,1,1) + ageSDL.sendToClients(amountSDL) + ageSDL.setFlags(tempSDL,1,1) + ageSDL.sendToClients(tempSDL) + ageSDL.setFlags("ercaMayBake",1,1) + ageSDL.sendToClients("ercaMayBake") + ageSDL.setFlags("ercaBakeFinishTime",1,1) + ageSDL.sendToClients("ercaBakeFinishTime") + + ageSDL.setNotify(self.key,SDLBakeryPwr.value,0.0) + ageSDL.setNotify(self.key,SDLScopePwr.value,0.0) + ageSDL.setNotify(self.key,timeSDL,0.0) + ageSDL.setNotify(self.key,amountSDL,0.0) + ageSDL.setNotify(self.key,tempSDL,0.0) + ageSDL.setNotify(self.key,"ercaMayBake",0.0) + ageSDL.setNotify(self.key,"ercaBakeFinishTime",0.0) + + try: + boolBakeryPwr = ageSDL[SDLBakeryPwr.value][0] + except: + PtDebugPrint("ERROR: ercaOvenScope.OnServerInitComplete():\tERROR reading SDL name for bakery power") + boolBakeryPwr = 0 + PtDebugPrint("DEBUG: ercaOvenScope.OnServerInitComplete():\t%s = %d" % (SDLBakeryPwr.value,ageSDL[SDLBakeryPwr.value][0]) ) + try: + boolScopePwr = ageSDL[SDLScopePwr.value][0] + except: + PtDebugPrint("ERROR: ercaOvenScope.OnServerInitComplete():\tERROR reading SDL name for scope power") + boolScopePwr = 0 + PtDebugPrint("DEBUG: ercaOvenScope.OnServerInitComplete():\t%s = %d" % (SDLScopePwr.value,ageSDL[SDLScopePwr.value][0]) ) + try: + boolMayBake = ageSDL["ercaMayBake"][0] + except: + PtDebugPrint("ERROR: ercaOvenScope.OnServerInitComplete():\tERROR reading SDL name for ercaMayBake") + boolMayBake = 0 + PtDebugPrint("DEBUG: ercaOvenScope.OnServerInitComplete():\tercaMayBake = %d" % (ageSDL["ercaMayBake"][0]) ) + try: + IsBaking = ageSDL["ercaBakeFinishTime"][0] + except: + PtDebugPrint("ERROR: ercaOvenScope.OnServerInitComplete():\tERROR reading SDL name for ercaBakeFinishTime") + IsBaking = 0 + PtDebugPrint("DEBUG: ercaOvenScope.OnServerInitComplete():\tercaBakeFinishTime = %d" % (ageSDL["ercaBakeFinishTime"][0]) ) + + byteTime = ageSDL[timeSDL][0] + byteAmount = ageSDL[amountSDL][0] + byteTemp = ageSDL[tempSDL][0] + + if type(Vignette.value) != type(None) and Vignette.value != "": + PtLoadDialog(Vignette.value,self.key) + + + def Load(self): + global boolScopeOperated + + solo = true + if len(PtGetPlayerList()): + solo = false + + boolOperated = self.SDL["boolOperated"][0] + if boolOperated: + if solo: + PtDebugPrint("ercaOvenScope.Load():\tboolOperated=%d but no one else here...correcting" % boolOperated,level=kDebugDumpLevel) + boolOperated = 0 + self.SDL["boolOperated"] = (0,) + self.SDL["OperatorID"] = (-1,) + Activate.enable() + else: + Activate.disable() + PtDebugPrint("ercaOvenScope.Load():\tboolOperated=%d, disabling telescope clickable" % boolOperated,level=kDebugDumpLevel) + + + def AvatarPage(self, avObj, pageIn, lastOut): + "reset scope accessibility if scope user quits or crashes" + global boolScopeOperated + + if pageIn: + return + + avID = PtGetClientIDFromAvatarKey(avObj.getKey()) + if avID == self.SDL["OperatorID"][0]: + Activate.enable() + self.SDL["OperatorID"] = (-1,) + self.SDL["boolOperated"] = (0,) + PtDebugPrint("ercaOvenScope.AvatarPage(): telescope operator paged out, reenabled telescope.",level=kDebugDumpLevel) + else: + return + + + def __del__(self): + "unload the dialog that we loaded" + PtUnloadDialog(Vignette.value) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolBakeryPwr + global boolScopePwr + global timeSDL + global amountSDL + global tempSDL + global byteTime + global byteAmount + global byteTemp + global boolMayBake + global IsBaking + global timeSlider + global amountSlider + global tempSlider + global bakeBtn + global timerWheel + global tempWheel + ageSDL = PtGetAgeSDL() + + if VARname == SDLBakeryPwr.value: + boolBakeryPwr = ageSDL[SDLBakeryPwr.value][0] + if boolBakeryPwr == 0: + if IsBaking != 0 and self.sceneobject.isLocallyOwned(): + ageSDL["ercaBakeFinishTime"] = (0,) + if boolMayBake and self.sceneobject.isLocallyOwned(): + ageSDL["ercaMayBake"] = (0,) + else: + self.ICheckScopes() + + if VARname == SDLScopePwr.value: + boolScopePwr = ageSDL[SDLScopePwr.value][0] + + if VARname == "ercaMayBake": + boolMayBake = ageSDL["ercaMayBake"][0] + PtDebugPrint("ercaOvenScope:OnSDLNotify: SDL for ercaMayBake now set to %d" % (boolMayBake)) + if boolMayBake: + RespMayBake.run(self.key,state="yes") + else: + RespMayBake.run(self.key,state="no") + + if VARname == "ercaBakeFinishTime": + IsBaking = ageSDL["ercaBakeFinishTime"][0] + #PtDebugPrint("ercaOvenScope:OnSDLNotify: SDL for ercaBakeFinishTime now set to %d" % (IsBaking)) + if IsBaking != 0: + timeSlider.disable() + amountSlider.disable() + tempSlider.disable() + bakeBtn.disable() + else: + timerWheel.setValue(0) + tempWheel.setValue(0) + timeSlider.enable() + amountSlider.enable() + tempSlider.enable() + bakeBtn.enable() + + if VARname == timeSDL: + byteTimeOld = byteTime + byteTime = ageSDL[timeSDL][0] + PtDebugPrint("ercaOvenScope:OnSDLNotify: SDL for %s now set to %d" % (timeSDL,byteTime)) + RespSoundTest.run(self.key) + if byteTime == 0 and byteTimeOld > 0: + RespTimeSlider.run(self.key,state="off") + if boolMayBake != 0 and self.sceneobject.isLocallyOwned(): + ageSDL["ercaMayBake"] = (0,) + elif byteTime > 0 and byteTimeOld == 0: + RespTimeSlider.run(self.key,state="on") + if boolMayBake == 0: + self.ICheckScopes() + + if VARname == amountSDL: + byteAmountOld = byteAmount + byteAmount = ageSDL[amountSDL][0] + PtDebugPrint("ercaOvenScope:OnSDLNotify: SDL for %s now set to %d" % (amountSDL,byteAmount)) + RespSoundTest.run(self.key) + if byteAmount == 0 and byteAmountOld > 0: + RespAmountSlider.run(self.key,state="off") + if boolMayBake != 0 and self.sceneobject.isLocallyOwned(): + ageSDL["ercaMayBake"] = (0,) + elif byteAmount > 0 and byteAmountOld == 0: + RespAmountSlider.run(self.key,state="on") + if boolMayBake == 0: + self.ICheckScopes() + + if VARname == tempSDL: + byteTempOld = byteTemp + byteTemp = ageSDL[tempSDL][0] + PtDebugPrint("ercaOvenScope:OnSDLNotify: SDL for %s now set to %d" % (tempSDL,byteTemp)) + RespSoundTest.run(self.key) + if byteTemp == 0 and byteTempOld > 0: + RespTempSlider.run(self.key,state="off") + if boolMayBake != 0 and self.sceneobject.isLocallyOwned(): + ageSDL["ercaMayBake"] = (0,) + elif byteTemp > 0 and byteTempOld == 0: + RespTempSlider.run(self.key,state="on") + if boolMayBake == 0: + self.ICheckScopes() + + + def ICheckScopes(self): + global boolMayBake + global boolBakeryPwr + ageSDL = PtGetAgeSDL() + + for xSDL in listTimeSDLs: + xVal = ageSDL[xSDL][0] + if xVal == 0: + break + for ySDL in listAmountSDLs: + yVal = ageSDL[ySDL][0] + if yVal == 0: + break + for zSDL in listTempSDLs: + zVal = ageSDL[zSDL][0] + if zVal == 0: + break + + if xVal != 0 and yVal != 0 and zVal != 0: + if boolBakeryPwr: + if self.sceneobject.isLocallyOwned(): + ageSDL["ercaMayBake"] = (1,) + else: + if self.sceneobject.isLocallyOwned(): + ageSDL["ercaMayBake"] = (0,) + + + def OnNotify(self,state,id,events): + "Activated... start telescope" + global LocalAvatar + global boolScopeOperator + PtDebugPrint("ercaOvenScope:OnNotify state=%d id=%d events=" % (state,id),events,level=kDebugDumpLevel) + if state and id == Activate.id and PtWasLocallyNotified(self.key): + LocalAvatar = PtFindAvatar(events) + self.IStartTelescope() + # check if its an advance stage notify + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + if boolScopeOperator: + self.IEngageTelescope() + boolScopeOperator = 0 + break + + + def OnGUINotify(self,id,control,event): + global timeSDL + global amountSDL + global tempSDL + global byteTime + global byteAmount + global byteTemp + global timeSlider + global amountSlider + global tempSlider + global bakeBtn + global timerWheel + global tempWheel + global byteTime + global byteAmount + global byteTemp + global boolMayBake + global IsBaking + global WasPowered + global setTempWheel + "Notifications from the vignette" + PtDebugPrint("GUI Notify id=%d, event=%d control=" % (id,event),control,level=kDebugDumpLevel) + ageSDL = PtGetAgeSDL() + + if event == kDialogLoaded: + if WasPowered == 0: + return + timeSlider = ptGUIControlKnob(control.getControlFromTag(kTimeSlider)) + amountSlider = ptGUIControlKnob(control.getControlFromTag(kAmountSlider)) + tempSlider = ptGUIControlKnob(control.getControlFromTag(kTempSlider)) + bakeBtn = ptGUIControlButton(control.getControlFromTag(kBakeBtn)) + timerWheel = ptGUIControlProgress(control.getControlFromTag(kTimerWheel)) + tempWheel = ptGUIControlProgress(control.getControlFromTag(kTempWheel)) + + elif event == kShowHide: + if WasPowered == 0: + return + if control.isEnabled(): + control.show() + PtDebugPrint("ercaOvenScope:OnGUINotify: SDL %s is %d" % (timeSDL,byteTime)) + PtDebugPrint("ercaOvenScope:OnGUINotify: SDL %s is %d" % (amountSDL,byteAmount)) + PtDebugPrint("ercaOvenScope:OnGUINotify: SDL %s is %d" % (tempSDL,byteTemp)) + if IsBaking != 0: + print "OnGUINotfiy.ShowHide: will now set timerWheel to: ",byteTime + print "OInGUINotfiy.ShowHide: will now set tempWheel to: ",byteTemp + if setTempWheel: + tempWheel.setValue(byteTemp) + self.IDoTimerWheel() + timeSlider.disable() + amountSlider.disable() + tempSlider.disable() + bakeBtn.disable() + else: + timerWheel.setValue(0) + tempWheel.setValue(0) + timeSlider.enable() + amountSlider.enable() + tempSlider.enable() + bakeBtn.enable() + + elif event == kValueChanged: + if type(control) != type(None): + knobID = control.getTagID() + if knobID == kTimeSlider: + newVal = int(round(timeSlider.getValue())) + if byteTime != newVal: + ageSDL[timeSDL] = (newVal,) + elif knobID == kAmountSlider: + newVal = int(round(amountSlider.getValue())) + if byteAmount != newVal: + ageSDL[amountSDL] = (newVal,) + elif knobID == kTempSlider: + newVal = int(round(tempSlider.getValue())) + if byteTemp != newVal: + ageSDL[tempSDL] = (newVal,) + + elif event == kAction: + if type(control) != type(None): + btnID = control.getTagID() + if btnID == kBakeBtn: + if isinstance(control,ptGUIControlButton) and control.isButtonDown(): + PtDebugPrint("ercaOvenScope:GUINotify Bake button down",level=kDebugDumpLevel) + else: + PtDebugPrint("ercaOvenScope:GUINotify Bake button up",level=kDebugDumpLevel) + if boolMayBake == 1 and IsBaking == 0: + timerPercent = byteTime * .01 + timerWheel.animateToPercent(timerPercent) +# if self.sceneobject.isLocallyOwned(): + ageSDL["ercaBakeFinishTime"] = (1,) + PtAtTimeCallback(self.key,1,2) + + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode: + self.IQuitTelescope() + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + self.IQuitTelescope() + + + def IStartTelescope(self): + "Start the action of looking at the telescope" + global LocalAvatar + global boolScopeOperator + # disable the activator (only one in the telescope at a time) + PtSendKIMessage(kDisableKIandBB,0) + Activate.disable() + boolScopeOperator = 1 # me! I'm the operator + self.SDL["boolOperated"] = (1,) + avID = PtGetClientIDFromAvatarKey(LocalAvatar.getKey()) + self.SDL["OperatorID"] = (avID,) + PtDebugPrint("ercaOvenScope.OnNotify:\twrote SDL - scope operator id = ", avID,level=kDebugDumpLevel) + # start the behavior + Behavior.run(LocalAvatar) + + + def IEngageTelescope(self): + global Telescope + global WasPowered + global byteTime + global byteAmount + global byteTemp + global timeSlider + global amountSlider + global tempSlider + global bakeBtn + global exitScope + + exitScope = 0 + Telescope.pushTelescope() + "After the behavior gets our eyes in the telescope, engage ourselves with the camera" + # Disable First Person Camera + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + # set camera to telescope + virtCam = ptCamera() + + if boolBakeryPwr and boolScopePwr: + WasPowered = 1 + virtCam.save(Camera.sceneobject.getKey()) + # show the cockpit + if ( PtIsDialogLoaded(Vignette.value) ): + timeSlider.setValue(byteTime) + if byteTime != 0: + RespTimeSlider.run(self.key,state="on",fastforward=1) + else: + RespTimeSlider.run(self.key,state="off",fastforward=1) + amountSlider.setValue(byteAmount) + if byteAmount != 0: + RespAmountSlider.run(self.key,state="on",fastforward=1) + else: + RespAmountSlider.run(self.key,state="off",fastforward=1) + tempSlider.setValue(byteTemp) + if byteTemp != 0: + RespTempSlider.run(self.key,state="on",fastforward=1) + else: + RespTempSlider.run(self.key,state="off",fastforward=1) + if boolMayBake: + RespMayBake.run(self.key,state="yes",fastforward=1) + else: + RespMayBake.run(self.key,state="no",fastforward=1) + + PtLoadDialog(Vignette.value,self.key) + if ( PtIsDialogLoaded(Vignette.value) ): + PtShowDialog(Vignette.value) + + else: + WasPowered = 0 + virtCam.save(CameraBad.sceneobject.getKey()) + # show the cockpit + if type(VignetteBad.value) != type(None) and VignetteBad.value != "": + PtLoadDialog(VignetteBad.value,self.key) + if ( PtIsDialogLoaded(VignetteBad.value) ): + PtShowDialog(VignetteBad.value) + + # get control key events + PtEnableControlKeyEvents(self.key) + + + def IQuitTelescope(self): + "Disengage and exit the telescope mode" + global LocalAvatar + global boolScopeOperator + global Telescope + global WasPowered + global exitScope + global timerWheel + global tempWheel + + exitScope = 1 + Telescope.popTelescope() + # exit every thing + + if WasPowered: + if type(Vignette.value) != type(None) and Vignette.value != "": + PtHideDialog(Vignette.value) + virtCam = ptCamera() + virtCam.restore(Camera.sceneobject.getKey()) + timerWheel.setValue(0) + RespSfxTimerWheel.run(self.key,state="off") + tempWheel.setValue(0) + else: + if type(VignetteBad.value) != type(None) and VignetteBad.value != "": + PtHideDialog(VignetteBad.value) + virtCam = ptCamera() + virtCam.restore(CameraBad.sceneobject.getKey()) + WasPowered = 1 + + PtRecenterCamera() + # exit behavior...which is in the next stage + #Behavior.gotoStage(LocalAvatar,2) + Behavior.nextStage(LocalAvatar) + #disable the Control key events + PtDisableControlKeyEvents(self.key) + # re-enable the telescope for someone else to use + boolScopeOperator = 0 + self.SDL["boolOperated"] = (0,) + self.SDL["OperatorID"] = (-1,) + #Re-enable first person camera + cam = ptCamera() + cam.enableFirstPersonOverride() + PtAtTimeCallback(self.key,3,1) # wait for player to finish exit one-shot, then reenable clickable + PtDebugPrint("ercaOvenScope.IQuitTelescope:\tdelaying clickable reenable",level=kDebugDumpLevel) + + + def OnTimer(self,id): + global exitScope + if id == 1: + Activate.enable() + PtDebugPrint("ercaOvenScope.OnTimer:\tclickable reenabled",level=kDebugDumpLevel) + PtSendKIMessage(kEnableKIandBB,0) + if id == 2: + if not exitScope: + self.IDoTimerWheel() + + + def IDoTimerWheel(self): + print "in IDoTimerWheel." + global byteTime + global IsBaking + global timerWheel + global byteTemp + global tempWheel + global setTempWheel + ageSDL = PtGetAgeSDL() + + if not IsBaking: + return + print "ercaOvenScope:IDoTimerWheel: IsBaking is true" + StartTime = (IsBaking - (byteTime * kTimeScale)) + FinishTime = IsBaking + CurTime = PtGetDniTime() + TimeRemaining = (FinishTime - CurTime) + BakeDuration = (FinishTime - StartTime) + PreHeat = (StartTime - 3) + PostHeat = (StartTime + 2) + + if CurTime < FinishTime: + #print "PreHeat = ",PreHeat + #print "CurTime = ",CurTime + if PreHeat < CurTime: + #print "PostHeat = ",PostHeat + if PostHeat < CurTime: + print "setTempWheel =",setTempWheel + if not setTempWheel: + tempWheel.setValue(byteTemp) + setTempWheel = 1 + else: + if not setTempWheel: + tempPercent = byteTemp * .01 + tempWheel.animateToPercent(tempPercent) + print "animating Temp Wheel, byteTemp = ",byteTemp + print "animating Temp Wheel, tempPercent = ",tempPercent + setTempWheel = 1 + #print "StartTime = ",StartTime + if StartTime < CurTime: + PtDebugPrint("ercaOvenScope:IDoTimerWheel: Now updating timer wheel of scope# %d to %d seconds remaining" % (ScopeNum.value,TimeRemaining)) + TimeRemaining = (TimeRemaining * 1.0) + BakeDuration = (BakeDuration * 1.0) + newTimerVal = ((TimeRemaining / BakeDuration) * (byteTime * 10)) + timerWheel.setValue(newTimerVal) + RespSfxTimerWheel.run(self.key,state="on") + else: + timerWheel.setValue(byteTime*10) + PtAtTimeCallback(self.key,1,2) + diff --git a/Python/ercaPelletRoom.py b/Python/ercaPelletRoom.py new file mode 100644 index 0000000000..c8f6a33614 --- /dev/null +++ b/Python/ercaPelletRoom.py @@ -0,0 +1,767 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaPelletRoom.py +Age: Ercana +Date: December 2003 +Revisions: March 2007 - ? +Author: Chris Doyle +wiring for the Ercana pellet room, including the pellet dispensing machine and linking-out with/without a pellet +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import string +import PlasmaControlKeys +import xEnum +from math import * +from xPsnlVaultSDL import * +import time +from PlasmaNetConstants import * + + +# --------- +# max wiring +# --------- + +SDLPellet1 = ptAttribString(1,"SDL: pellet 1") +SDLPellet2 = ptAttribString(2,"SDL: pellet 2") +SDLPellet3 = ptAttribString(3,"SDL: pellet 3") +SDLPellet4 = ptAttribString(4,"SDL: pellet 4") +SDLPellet5 = ptAttribString(5,"SDL: pellet 5") +SDLMachine = ptAttribString(6,"SDL: big ol' pellet machine") +ActUseMachine = ptAttribActivator(7, "clk: use big machine btn") +RespUseMachine = ptAttribResponder(8, "resp: use machine btn") +RespMachineEnable = ptAttribResponder(9, "resp: machine enable/disable",['Enable','Disable','IfOpening']) +RespMachineMode = ptAttribResponder(10, "resp: machine open/close",['Open','Close']) +ActSpitPellet = ptAttribActivator(11, "clk: spit next pellet") +SDLChamber = ptAttribString(12,"SDL: pellet machine chamber") +RespUseSpitBtn = ptAttribResponder(13, "resp: use spit pellet btn",['allow','deny']) +RespRotateChamber = ptAttribResponder(14, "resp: rotate pellet chamber",['Chamber1','Chamber2','Chamber3','Chamber4','Chamber5']) +RespSpitPellet = ptAttribResponder(15, "resp: spit out the pellet",['Chamber1','Chamber2','Chamber3','Chamber4','Chamber5']) +RespDropPellet = ptAttribResponder(16, "resp: drop the pellet",['normal','taken']) +RespShowAllPellets = ptAttribResponder(17, "resp: show all pellets") +RespHidePellet = ptAttribResponder(18, "resp: hide pellet",['pellet1','pellet2','pellet3','pellet4','pellet5']) +ActTakePellet = ptAttribActivator(19, "clk: take a pellet") +RespTouchPellet = ptAttribResponder(20, "resp: touch pellet",['Touch','Untouch']) +ActFlushLever = ptAttribActivator(21, "clk: flush lever") +RespFlushOneShot = ptAttribResponder(22, "resp: flush lever oneshot") +RespFlushLever = ptAttribResponder(23, "resp: use flush lever") +SDLFlush = ptAttribString(24,"SDL: flush lever") +RespFlushAPellet = ptAttribResponder(25, "resp: flush a pellet",['flush1','flush2','flush3','flush4','flush5']) +ActPelletToSilo = ptAttribActivator(26, "clk: link to silo w/pellet") +ActPelletToCave = ptAttribActivator(27, "clk: link to cave w/pellet") +RespLinkPellet = ptAttribResponder(28, "resp: link w/pellet",['CitySilo','PelletCave']) +MltStgLinkPellet = ptAttribBehavior(29, "mlt stg: link w/pellet") +#RespUseMachineOneShot = ptAttribResponder(30, "resp: use machine one shot") + + + +# --------- +# globals +# --------- + +Pellet1 = 0 +Pellet2 = 0 +Pellet3 = 0 +Pellet4 = 0 +Pellet5 = 0 +PelletReady = 0 +boolMachine = 0 +byteChamber = 0 +TakePellet = 0 +boolFlush = 0 +MayFlush = 0 +Toucher = None +LocalAvatar = None +LastPellet = 0 +#ISpit = 0 +iLink = 0 +#WaitHack = 0 +InitCorrection = 0 + + +class ercaPelletRoom(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 7033 + self.version = 9 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + print "ercaPelletRoom.OnServerInitComplete()" + global Pellet1 + global Pellet2 + global Pellet3 + global Pellet4 + global Pellet5 + global pelletList + global PelletReady + global boolMachine + global byteChamber + global boolFlush + global MayFlush + global LocalAvatar + global InitCorrection + + LocalAvatar = PtGetLocalAvatar() + + vault = ptVault() + entry = vault.findChronicleEntry("GotPellet") + if type(entry) != type(None): + entryValue = entry.chronicleGetValue() + oldGotPellet = string.atoi(entryValue) + if oldGotPellet != 0: + entry.chronicleSetValue("%d" % (0)) + entry.save() + PtDebugPrint("ercaPelletRoom.OnServerInitComplete(): chron entry GotPellet still contained a recipe, setting to 0") + + try: + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLPellet1.value,1,1) + ageSDL.sendToClients(SDLPellet1.value) + ageSDL.setNotify(self.key,SDLPellet1.value,0.0) + ageSDL.setFlags(SDLPellet2.value,1,1) + ageSDL.sendToClients(SDLPellet2.value) + ageSDL.setNotify(self.key,SDLPellet2.value,0.0) + ageSDL.setFlags(SDLPellet3.value,1,1) + ageSDL.sendToClients(SDLPellet3.value) + ageSDL.setNotify(self.key,SDLPellet3.value,0.0) + ageSDL.setFlags(SDLPellet4.value,1,1) + ageSDL.sendToClients(SDLPellet4.value) + ageSDL.setNotify(self.key,SDLPellet4.value,0.0) + ageSDL.setFlags(SDLPellet5.value,1,1) + ageSDL.sendToClients(SDLPellet5.value) + ageSDL.setNotify(self.key,SDLPellet5.value,0.0) + ageSDL.setFlags(SDLMachine.value,1,1) + ageSDL.sendToClients(SDLMachine.value) + ageSDL.setNotify(self.key,SDLMachine.value,0.0) + ageSDL.setFlags(SDLChamber.value,1,1) + ageSDL.sendToClients(SDLChamber.value) + ageSDL.setNotify(self.key,SDLChamber.value,0.0) + ageSDL.setFlags(SDLFlush.value,1,1) + ageSDL.sendToClients(SDLFlush.value) + ageSDL.setNotify(self.key,SDLFlush.value,0.0) + except: + print "ercaPelletRoom.OnServerInitComplete():\tERROR---Cannot find the Ercana Age SDL" + ageSDL[SDLPellet1.value] = (0,) + ageSDL[SDLPellet2.value] = (0,) + ageSDL[SDLPellet3.value] = (0,) + ageSDL[SDLPellet4.value] = (0,) + ageSDL[SDLPellet5.value] = (0,) + ageSDL[SDLMachine.value] = (0,) + ageSDL[SDLChamber.value] = (0,) + ageSDL[SDLFlush.value] = (0,) + + boolMachine = ageSDL[SDLMachine.value][0] + print "boolMachine = ",boolMachine + byteChamber = ageSDL[SDLChamber.value][0] + print "byteChamber = ",byteChamber + boolFlush = ageSDL[SDLFlush.value][0] + if not boolMachine and byteChamber: + print "machine is closed, but chamber = ",byteChamber,". Resetting chamber to 0" + ageSDL[SDLChamber.value] = (0,) + byteChamber = 0 + print "corrected chamber = ",byteChamber + + Pellet1 = ageSDL[SDLPellet1.value][0] + if not Pellet1 or (Pellet1 and byteChamber == 1): + RespHidePellet.run(self.key,state="pellet1") + if Pellet1: + Pellet1 = 0 + ageSDL[SDLPellet1.value] = (0,) + print "must've left age before pellet1 dropped and no other players were there, correcting..." + InitCorrection = 1 + Pellet2 = ageSDL[SDLPellet2.value][0] + if not Pellet2 or (Pellet2 and byteChamber == 2): + RespHidePellet.run(self.key,state="pellet2") + if Pellet2: + Pellet2 = 0 + ageSDL[SDLPellet2.value] = (0,) + print "must've left age before pellet2 dropped and no other players were there, correcting..." + InitCorrection = 1 + Pellet3 = ageSDL[SDLPellet3.value][0] + if not Pellet3 or (Pellet3 and byteChamber == 3): + RespHidePellet.run(self.key,state="pellet3") + if Pellet3: + Pellet3 = 0 + ageSDL[SDLPellet3.value] = (0,) + print "must've left age before pellet3 dropped and no other players were there, correcting..." + InitCorrection = 1 + Pellet4 = ageSDL[SDLPellet4.value][0] + if not Pellet4 or (Pellet4 and byteChamber == 4): + RespHidePellet.run(self.key,state="pellet4") + if Pellet4: + Pellet4 = 0 + ageSDL[SDLPellet4.value] = (0,) + print "must've left age before pellet4 dropped and no other players were there, correcting..." + InitCorrection = 1 + Pellet5 = ageSDL[SDLPellet5.value][0] + if not Pellet5 or (Pellet5 and byteChamber == 5): + RespHidePellet.run(self.key,state="pellet5") + if Pellet5: + Pellet5 = 0 + ageSDL[SDLPellet5.value] = (0,) + print "must've left age before pellet5 dropped and no other players were there, correcting..." + InitCorrection = 1 + + pelletList = [Pellet1,Pellet2,Pellet3,Pellet4,Pellet5] + for pellet in pelletList: + if pellet > 0: + PelletReady = 1 + break + print "PelletReady = ",PelletReady + + if PelletReady: + if boolMachine: + MayFlush = 1 + RespMachineMode.run(self.key,state="Open",fastforward=1) + RespMachineEnable.run(self.key,state="IfOpening",fastforward=1) + if byteChamber == 1: + RespRotateChamber.run(self.key,state="Chamber1",fastforward=1) + elif byteChamber == 2: + RespRotateChamber.run(self.key,state="Chamber2",fastforward=1) + elif byteChamber == 3: + RespRotateChamber.run(self.key,state="Chamber3",fastforward=1) + elif byteChamber == 4: + RespRotateChamber.run(self.key,state="Chamber4",fastforward=1) + elif byteChamber == 5: + RespRotateChamber.run(self.key,state="Chamber5",fastforward=1) + ActSpitPellet.enableActivator() + else: + MayFlush = 0 + RespMachineMode.run(self.key,state="Close",fastforward=1) + RespMachineEnable.run(self.key,state="Enable",fastforward=1) + else: + RespMachineEnable.run(self.key,state="Disable",fastforward=1) + MayFlush = 0 + if boolMachine: + print "We shouldn't get here. Just in case some states got hosed." + RespMachineMode.run(self.key,state="Close",fastforward=1) + if not len(PtGetPlayerList()): + ageSDL[SDLMachine.value] = (0,) + ageSDL[SDLChamber.value] = (0,) + boolMachine = 0 + byteChamber = 0 + else: + RespMachineMode.run(self.key,state="Close",fastforward=1) + if not len(PtGetPlayerList()): + ageSDL[SDLChamber.value] = (0,) + byteChamber = 0 + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global Pellet1 + global Pellet2 + global Pellet3 + global Pellet4 + global Pellet5 + global pelletList + global PelletReady + global boolMachine + global byteChamber + global boolFlush + global MayFlush + global LastPellet + global InitCorrection + ageSDL = PtGetAgeSDL() + + pelletUpdate = 0 + + if VARname == SDLPellet1.value: + Pellet1 = ageSDL[SDLPellet1.value][0] + #PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet1 is now %d" % (Pellet1)) + pelletUpdate = 1 + if VARname == SDLPellet2.value: + Pellet2 = ageSDL[SDLPellet2.value][0] + #PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet2 is now %d" % (Pellet2)) + pelletUpdate = 1 + if VARname == SDLPellet3.value: + Pellet3 = ageSDL[SDLPellet3.value][0] + #PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet3 is now %d" % (Pellet3)) + pelletUpdate = 1 + if VARname == SDLPellet4.value: + Pellet4 = ageSDL[SDLPellet4.value][0] + #PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet4 is now %d" % (Pellet4)) + pelletUpdate = 1 + if VARname == SDLPellet5.value: + Pellet5 = ageSDL[SDLPellet5.value][0] + #PtDebugPrint("ercaBakePellets:OnSDLNotify: SDL for Pellet5 is now %d" % (Pellet5)) + pelletUpdate = 1 + if VARname == SDLMachine.value: + boolMachine = ageSDL[SDLMachine.value][0] + PtDebugPrint("ercaPelletRoom:OnSDLNotify: SDL for BigMachine is now %d" % (boolMachine)) + pelletUpdate = 0 + if boolMachine: + RespShowAllPellets.run(self.key) + objAvatar = ptSceneobject(PtGetAvatarKeyFromClientID(playerID),self.key) + print "Got boolMachine SDL = 1 notify, will now run RespUseMachine" + RespUseMachine.run(self.key,avatar=objAvatar) + else: + MayFlush = 0 + RespMachineMode.run(self.key,state="Close",fastforward=InitCorrection) + if InitCorrection: + InitCorrection = 0 + #~ if byteChamber == 5: + #~ ageSDL[SDLChamber.value] = (0,) + if VARname == SDLChamber.value: + byteChamber = ageSDL[SDLChamber.value][0] + PtDebugPrint("ercaPelletRoom:OnSDLNotify: SDL for machine chamber is now %d" % (byteChamber)) + if byteChamber != 0: + pelletUpdate = 0 + objAvatar = ptSceneobject(PtGetAvatarKeyFromClientID(playerID),self.key) + RespUseSpitBtn.run(self.key,avatar=objAvatar,state="allow") + if VARname == SDLFlush.value: + boolFlush = ageSDL[SDLFlush.value][0] + PtDebugPrint("ercaPelletRoom:OnSDLNotify: SDL for flush lever is now %d" % (boolFlush)) + if boolFlush: + objAvatar = ptSceneobject(PtGetAvatarKeyFromClientID(playerID),self.key) + print "Got boolFlush SDL = 1 notify, will now run RespFlushOneShot" + RespFlushOneShot.run(self.key,avatar=objAvatar) + else: + pass + + if pelletUpdate: + pelletList = [Pellet1,Pellet2,Pellet3,Pellet4,Pellet5] + print "ercaPelletRoom:OnSDLNotify(): pelletList = ",pelletList + testVal = 0 + for pellet in pelletList: + if pellet > 0: + if boolMachine: + MayFlush = 1 + testVal = 1 + break + + if testVal == 1 and PelletReady == 1: + ActSpitPellet.enableActivator() + elif testVal == 1 and PelletReady == 0: + PelletReady = 1 + RespMachineEnable.run(self.key,state="Enable") + elif testVal == 0 and PelletReady == 1: + PelletReady = 0 + LastPellet = 1 + #ageSDL[SDLMachine.value] = (0,) + + + def OnNotify(self,state,id,events): + global Pellet1 + global Pellet2 + global Pellet3 + global Pellet4 + global Pellet5 + global byteChamber + global TakePellet + global boolFlush + global MayFlush + global Toucher + global LastPellet + #global ISpit + global iLink + #global WaitHack + ageSDL = PtGetAgeSDL() + + if (id == ActUseMachine.id and state and LocalAvatar == PtFindAvatar(events)): + print "ActUseMachine callback" + #RespUseMachineOneShot.run(self.key,avatar=PtFindAvatar(events)) + ageSDL[SDLMachine.value] = (1,) + + elif (id == RespUseMachine.id): + print "Got notify from RespUseMachine, will now open machine" + RespMachineEnable.run(self.key,state="IfOpening") + RespMachineMode.run(self.key,state="Open") + + elif (id == RespMachineMode.id): + print "ercaPelletRoom.OnNotify: Machine has closed." + if not PelletReady: + RespMachineEnable.run(self.key,state="Disable") + if byteChamber: + ageSDL[SDLChamber.value] = (0,) + + elif (id == RespMachineEnable.id): + print "RespMachineEnable callback" + MayFlush = 1 + print "set MayFlush = ",MayFlush + + elif (id == ActSpitPellet.id and state and LocalAvatar == PtFindAvatar(events)): + if TakePellet: + print "TakePellet is still active, must wait a few seconds before allowing another pellet to be spit out" + RespUseSpitBtn.run(self.key,avatar=LocalAvatar,state="deny") + return + print "ActSpitPellet callback" + #ISpit = 1 + ActSpitPellet.disableActivator() + MayFlush = 0 + if byteChamber == 5: + print "Trying to spit pellet, but we're on Chamber5. This shouldn't be possible. Closing machine..." + ageSDL[SDLMachine.value] = (0,) + ageSDL[SDLChamber.value] = (0,) + ageSDL[SDLPellet1.value] = (0,) + ageSDL[SDLPellet2.value] = (0,) + ageSDL[SDLPellet3.value] = (0,) + ageSDL[SDLPellet4.value] = (0,) + ageSDL[SDLPellet5.value] = (0,) + ageSDL[SDLFlush.value] = (0,) + return + newVal = (byteChamber + 1) + ageSDL[SDLChamber.value] = (newVal,) + + elif (id == RespUseSpitBtn.id): + print "RespUseSpitBtn callback" + if byteChamber == 1: + RespRotateChamber.run(self.key,state="Chamber1") + elif byteChamber == 2: + RespRotateChamber.run(self.key,state="Chamber2") + elif byteChamber == 3: + RespRotateChamber.run(self.key,state="Chamber3") + elif byteChamber == 4: + RespRotateChamber.run(self.key,state="Chamber4") + elif byteChamber == 5: + RespRotateChamber.run(self.key,state="Chamber5") + + elif (id == RespRotateChamber.id): + print "RespRotateChamber callback" + if byteChamber == 1: + RespSpitPellet.run(self.key,state="Chamber1") + elif byteChamber == 2: + RespSpitPellet.run(self.key,state="Chamber2") + elif byteChamber == 3: + RespSpitPellet.run(self.key,state="Chamber3") + elif byteChamber == 4: + RespSpitPellet.run(self.key,state="Chamber4") + elif byteChamber == 5: + RespSpitPellet.run(self.key,state="Chamber5") + + elif (id == RespSpitPellet.id): +# if not ISpit: +# return + print "RespSpitPellet callback" + #TakePellet = 0 + self.SendNote('self.UpdateTakePellet(%d)' % (0)) + #ActTakePellet.enableActivator() + PtAtTimeCallback(self.key,10,1) + #ISpit = 0 + + elif (id == ActTakePellet.id and state and LocalAvatar == PtFindAvatar(events)): + print "ActTakePellet callback" + #ActTakePellet.disableActivator() + #TakePellet = 1 + self.SendNote('self.UpdateTakePellet(%d)' % (1)) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + RespTouchPellet.run(self.key,state="Touch") + Toucher = PtFindAvatar(events) + MltStgLinkPellet.run(Toucher) + PtEnableControlKeyEvents(self.key) + + elif (id == RespTouchPellet.id): + if Toucher: + print "RespTouchPellet callback for Untouch, will now try to kill multistage" + MltStgLinkPellet.gotoStage(Toucher, -1) + cam = ptCamera() + cam.enableFirstPersonOverride() + Toucher = None + + elif (id == ActPelletToSilo.id and state and LocalAvatar == PtFindAvatar(events)): + print "ActPelletToSilo callback" + iLink = 1 + #TakePellet = 2 + self.SendNote('self.UpdateTakePellet(%d)' % (2)) + MltStgLinkPellet.gotoStage(Toucher, 1,dirFlag=1,isForward=1) + PtAtTimeCallback(self.key,0.6,3) + + elif (id == ActPelletToCave.id and state and LocalAvatar == PtFindAvatar(events)): + print "ActPelletToCave callback" + iLink = 1 + #TakePellet = 2 + self.SendNote('self.UpdateTakePellet(%d)' % (2)) + MltStgLinkPellet.gotoStage(Toucher, 2,dirFlag=1,isForward=1) + PtAtTimeCallback(self.key,0.6,4) + + elif (id == RespLinkPellet.id): + if not iLink: + return + iLink = 0 + print "RespLinkPellet callback" + Recipe = 0 + if byteChamber == 1: + Recipe = Pellet1 + ageSDL[SDLPellet1.value] = (0,) + elif byteChamber == 2: + Recipe = Pellet2 + ageSDL[SDLPellet2.value] = (0,) + elif byteChamber == 3: + Recipe = Pellet3 + ageSDL[SDLPellet3.value] = (0,) + elif byteChamber == 4: + Recipe = Pellet4 + ageSDL[SDLPellet4.value] = (0,) + elif byteChamber == 5: + Recipe = Pellet5 + ageSDL[SDLPellet5.value] = (0,) + cam = ptCamera() + cam.enableFirstPersonOverride() + + vault = ptVault() + entry = vault.findChronicleEntry("GotPellet") + if type(entry) != type(None): + entry.chronicleSetValue("%d" % (Recipe)) + entry.save() + PtDebugPrint("Chronicle entry GotPellet already added, setting to Recipe value of %d" % (Recipe)) + else: + vault.addChronicleEntry("GotPellet",1,"%d" % (Recipe)) + PtDebugPrint("Chronicle entry GotPellet not present, adding entry and setting to Recipe value of %d" % (Recipe)) + + thisState = RespLinkPellet.getState() + if thisState == "PelletCave": + self.LinkToPelletCave("upper") + + + elif (id == RespDropPellet.id): + print "RespDropPellet callback" + #WaitHack = 1 + #PtAtTimeCallback(self.key,5,6) + #ActSpitPellet.enableActivator() + if byteChamber == 1: + ageSDL[SDLPellet1.value] = (0,) + RespHidePellet.run(self.key,state="pellet1") + elif byteChamber == 2: + ageSDL[SDLPellet2.value] = (0,) + RespHidePellet.run(self.key,state="pellet2") + elif byteChamber == 3: + ageSDL[SDLPellet3.value] = (0,) + RespHidePellet.run(self.key,state="pellet3") + elif byteChamber == 4: + ageSDL[SDLPellet4.value] = (0,) + RespHidePellet.run(self.key,state="pellet4") + elif byteChamber == 5: + ageSDL[SDLPellet5.value] = (0,) + RespHidePellet.run(self.key,state="pellet5") + if LastPellet or not len(PtGetPlayerList()): + ageSDL[SDLMachine.value] = (0,) + LastPellet = 0 + + elif (id == ActFlushLever.id and state and LocalAvatar == PtFindAvatar(events)): + print "ActFlushLever callback" + ageSDL[SDLFlush.value] = (1,) + + elif (id == RespFlushOneShot.id): + print "RespFlushOneShot callback" + print "MayFlush = ",MayFlush + RespFlushLever.run(self.key) + if MayFlush: + ActSpitPellet.disableActivator() + + elif (id == RespFlushLever.id): + print "RespFlushLever callback" + print "MayFlush = ",MayFlush + if MayFlush: + #MayFlush = 0 + self.IFlushPellets() + else: + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLFlush.value] = (0,) + + elif (id == RespFlushAPellet.id): + print "RespFlushAPellet callback" + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLPellet1.value] = (0,) + ageSDL[SDLPellet2.value] = (0,) + ageSDL[SDLPellet3.value] = (0,) + ageSDL[SDLPellet4.value] = (0,) + ageSDL[SDLPellet5.value] = (0,) + ageSDL[SDLMachine.value] = (0,) + + elif id == (-1): + #print "incoming event: %s" % (events[0][1]) + code = events[0][1] + #print "playing command: %s" % (code) + exec code + + + def OnControlKeyEvent(self,controlKey,activeFlag): + global TakePellet + global Toucher + if controlKey == PlasmaControlKeys.kKeyExitMode: + if TakePellet == 1: + print "ercaPelletRoom.OnControlKeyEvent(): hit exit key" + #TakePellet = 0 + self.SendNote('self.UpdateTakePellet(%d)' % (0)) + #ActTakePellet.enableActivator() + PtDisableControlKeyEvents(self.key) + MltStgLinkPellet.gotoStage(Toucher, 0,newTime=1.2,dirFlag=1,isForward=0) + PtAtTimeCallback(self.key,0.8,5) + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + if TakePellet == 1: + print "ercaPelletRoom.OnControlKeyEvent(): hit movement key" + #TakePellet = 0 + self.SendNote('self.UpdateTakePellet(%d)' % (0)) + #ActTakePellet.enableActivator() + PtDisableControlKeyEvents(self.key) + MltStgLinkPellet.gotoStage(Toucher, 0,newTime=1.2,dirFlag=1,isForward=0) + PtAtTimeCallback(self.key,0.8,5) + + + def OnTimer(self,id): + print "ercaPelletRoom.OnTimer(): id = ",id + global byteChamber + global TakePellet + global Toucher + #global WaitHack + + ageSDL = PtGetAgeSDL() + + if id == 1: + if TakePellet == 2: + RespDropPellet.run(self.key,state="taken") + #print "taken" + #TakePellet = 0 + #self.SendNote('self.UpdateTakePellet(%d)' % (0)) + PtAtTimeCallback(self.key,10,6) + else: + #ActTakePellet.disableActivator() + RespDropPellet.run(self.key,state="normal") + if TakePellet == 1: + #TakePellet = 0 + self.SendNote('self.UpdateTakePellet(%d)' % (0)) + print "onTimer, TakePellet = 1" + if Toucher: + MltStgLinkPellet.gotoStage(Toucher, 0,newTime=1.2,dirFlag=1,isForward=0) + PtAtTimeCallback(self.key,0.8,5) + elif id == 2: + print "OnTimer.Is taking a pellet reseting it's SDL to O???" + ActSpitPellet.enableActivator() + elif id == 3: + RespLinkPellet.run(self.key,avatar=Toucher,state="CitySilo") + elif id == 4: + RespLinkPellet.run(self.key,avatar=Toucher,state="PelletCave") + elif id == 5: + RespTouchPellet.run(self.key,state="Untouch") + elif id == 6: + self.SendNote('self.UpdateTakePellet(%d)' % (0)) + + + def IFlushPellets(self): + print "in IFlushPellets." + global Pellet1 + global Pellet2 + global Pellet3 + global Pellet4 + global Pellet5 + global MayFlush + ageSDL = PtGetAgeSDL() + + ActSpitPellet.disableActivator() + if Pellet1 != 0: + RespFlushAPellet.run(self.key,state="flush1") + #ageSDL[SDLPellet1.value] = (0,) + if Pellet2 != 0: + RespFlushAPellet.run(self.key,state="flush2") + #ageSDL[SDLPellet2.value] = (0,) + if Pellet3 != 0: + RespFlushAPellet.run(self.key,state="flush3") + #ageSDL[SDLPellet3.value] = (0,) + if Pellet4 != 0: + RespFlushAPellet.run(self.key,state="flush4") + #ageSDL[SDLPellet4.value] = (0,) + if Pellet5 != 0: + RespFlushAPellet.run(self.key,state="flush5") + #ageSDL[SDLPellet5.value] = (0,) + #ageSDL[SDLMachine.value] = (0,) + MayFlush = 0 + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLFlush.value] = (0,) + + + def UpdateTakePellet(self,tp): + global TakePellet + print "ercaPelletRoom.UpdateTakePellet(): tp = ",tp + TakePellet = tp + + + def SendNote(self,ExtraInfo): + notify = ptNotify(self.key) + notify.clearReceivers() + notify.addReceiver(self.key) + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + notify.addVarNumber(str(ExtraInfo),1.0) + notify.send() + + + def OnClickToLinkToPelletCaveFromErcana(self): + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "PelletCaveGUID": + print "Found pellet cave guid - ", chron.getValue() + return chron.getValue() + return "" + + + def LinkToPelletCave(self,spawnPt): + pelletCaveGUID = str(self.OnClickToLinkToPelletCaveFromErcana()) + print "pelletCaveGUID = ",pelletCaveGUID + caveInfo = ptAgeInfoStruct() + caveInfo.setAgeFilename("PelletBahroCave") + caveInfo.setAgeInstanceName("PelletBahroCave") + caveInfo.setAgeInstanceGuid(pelletCaveGUID) + caveLink = ptAgeLinkStruct() + caveLink.setAgeInfo(caveInfo) + caveInfo = caveLink.getAgeInfo() + caveInstance = caveInfo + if type(caveInstance) == type(None): + PtDebugPrint("pellet cave instance is none, aborting link") + return; + info = ptAgeInfoStruct() + info.copyFrom(caveInstance) + als = ptAgeLinkStruct() + spawnPoint = ptSpawnPointInfo() + spawnPoint.setName("LinkInPointDefault") + als.setAgeInfo(info) + als.setSpawnPoint(spawnPoint) + als.setLinkingRules(PtLinkingRules.kBasicLink) + print "-- linking to pellet cave --" + linkMgr = ptNetLinkingMgr() + #linkMgr.linkToAge(als) + linkMgr.linkToAge(als,"TouchPellet") + diff --git a/Python/ercaSDLIntShowHide.py b/Python/ercaSDLIntShowHide.py new file mode 100644 index 0000000000..74ae1f7162 --- /dev/null +++ b/Python/ercaSDLIntShowHide.py @@ -0,0 +1,128 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: ercaSDLIntShowHide +Age: Ercana +Date: December 2003 +Author: Chris Doyle, based on script by xAgeSDLIntShowHide by Adam Van Ornum +Ercana-specific version of script which detects age SDL variable change and shows (on unspecified states) or hides (on unspecified states) the object it's attached to +Enter in the states you wish the item to be *INvisible* in as a comma separated list +""" + +from Plasma import * +from PlasmaTypes import * +import string + +stringVarName = ptAttribString(1,"Age SDL Var Name") +stringShowStates = ptAttribString(2,"States in which hidden") + +AgeStartedIn = None + +class ercaSDLIntShowHide(ptMultiModifier): + + def __init__(self): + ptMultiModifier.__init__(self) + self.id = 7032 + self.version = 2 + self.enabledStateList = [] + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + + def OnServerInitComplete(self): + if type(stringVarName.value) == type("") and stringVarName.value != "": + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(stringVarName.value,1,1) + ageSDL.sendToClients(stringVarName.value) + try: + self.enabledStateList = stringShowStates.value.split(",") + for i in range(len(self.enabledStateList)): + self.enabledStateList[i] = int(self.enabledStateList[i].strip()) + except: + PtDebugPrint("ERROR: ercaSDLIntShowHide.OnFirstUpdate():\tERROR: couldn't process start state list") + pass + else: + PtDebugPrint("ERROR: ercaSDLIntShowHide.OnFirstUpdate():\tERROR: missing SDL var name") + pass + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + if type(stringVarName.value) == type("") and stringVarName.value != "": + #PtDebugPrint("Setting notify on %s..." % stringVarName.value) + ageSDL.setNotify(self.key,stringVarName.value,0.0) + try: + SDLvalue = ageSDL[stringVarName.value][0] + except: + PtDebugPrint("ERROR: ercaSDLIntShowHide.OnServerInitComplete():\tERROR: age sdl read failed, SDLvalue = 0 by default. stringVarName = %s" % (stringVarName.value)) + SDLvalue = 0 + + try: + if SDLvalue in self.enabledStateList: + PtDebugPrint("DEBUG: ercaSDLIntShowHide.OnServerInitComplete: Attempting to disable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.disable() + self.sceneobject.physics.suppress(true) + else: + PtDebugPrint("DEBUG: ercaSDLIntShowHide.OnServerInitComplete: Attempting to enable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.enable() + self.sceneobject.physics.suppress(false) + except: + PtDebugPrint("ERROR: ercaSDLIntShowHide.OnServerInitComplete():\tERROR enabling/disabling object %s" % self.sceneobject.getName()) + pass + else: + PtDebugPrint("ERROR: ercaSDLIntShowHide.OnServerInitComplete():\tERROR: missing SDL var name") + pass + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname != stringVarName.value: + return + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + SDLvalue = ageSDL[stringVarName.value][0] + if SDLvalue in self.enabledStateList: + self.DisableObject() + else: + self.EnableObject() + + def EnableObject(self): + PtDebugPrint("DEBUG: ercaSDLIntShowHide.EnableObject: Attempting to enable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.enable() + self.sceneobject.physics.suppress(false) + + def DisableObject(self): + PtDebugPrint("DEBUG: ercaSDLIntShowHide.DisableObject: Attempting to disable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.disable() + self.sceneobject.physics.suppress(true) + + def OnBackdoorMsg(self, target, param): + if type(stringVarName.value) != type(None) and stringVarName.value != "": + if target == stringVarName.value: + if param.lower() in self.enabledStateList: + self.DisableObject() + else: + self.EnableObject() diff --git a/Python/giraAgeSDLBoolRespondLightpost.py b/Python/giraAgeSDLBoolRespondLightpost.py new file mode 100644 index 0000000000..35873d1ad8 --- /dev/null +++ b/Python/giraAgeSDLBoolRespondLightpost.py @@ -0,0 +1,110 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: giraAgeSDLBoolRespondLightpost +Age: global +Date: January 2003 +Author: Bill Slease +Detects age SDL bool type variable change and runs +one of two responders depending on new state +""" + +from Plasma import * +from PlasmaTypes import * +import string + +# --------- +# max wiring +# --------- + +stringVarName = ptAttribString(1,"Age SDL Var Name") +respBoolTrue = ptAttribResponder(2,"Run if bool true:") +respBoolFalse = ptAttribResponder(3,"Run if bool false:") +boolVltMgrFastForward = ptAttribBoolean(4,"F-Forward on VM notify", 1) +boolFFOnInit = ptAttribBoolean(5,"F-Forward on Init",1) +stringVarSolved = ptAttribString(6,"Age SDL Solved Var Name") + + +class giraAgeSDLBoolRespondLightpost(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 50344 + self.version = 1 + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(stringVarName.value,1,1) + ageSDL.sendToClients(stringVarName.value) + ageSDL.setFlags(stringVarSolved.value,1,1) + ageSDL.sendToClients(stringVarSolved.value) + + ageSDL.setNotify(self.key,stringVarName.value,0.0) + ageSDL.setNotify(self.key,stringVarSolved.value,0.0) + solved = ageSDL[stringVarSolved.value][0] + if (solved): + print "solved ",stringVarSolved.value + else: + return + if (ageSDL[stringVarName.value][0]): + PtDebugPrint("DEBUG: giraAgeSDLBoolRespondLightpost.OnServerInitComplete:\tRunning true responder on %s, fastforward=%d" % (self.sceneobject.getName(), boolFFOnInit.value)) + respBoolTrue.run(self.key,fastforward=boolFFOnInit.value) + else: + PtDebugPrint("DEBUG: giraAgeSDLBoolRespondLightpost.OnServerInitComplete:\tRunning false responder on %s, fastforward=%d" % (self.sceneobject.getName(), boolFFOnInit.value)) + respBoolFalse.run(self.key,fastforward=boolFFOnInit.value) + + # in case someone other than me changes my var(s) + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + + # is it a var we care about? + if VARname != stringVarName.value: + return + + ageSDL = PtGetAgeSDL() + PtDebugPrint("DEBUG: giraAgeSDLBoolRespondLightpost.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d" % (VARname,SDLname,tag,ageSDL[stringVarName.value][0])) + solved = ageSDL[stringVarSolved.value][0] + if not solved: + return + print "cave puzzle solved ",stringVarSolved.value + # is state change from player or vault manager? + if playerID: # non-zero means it's a player + objAvatar = ptSceneobject(PtGetAvatarKeyFromClientID(playerID),self.key) + fastforward = 0 + else: # invalid player aka Vault Manager + objAvatar = None + fastforward = boolVltMgrFastForward.value # we need to skip any one-shots + PtDebugPrint("DEBUG: giraAgeSDLBoolRespondLightpost.OnSDLNotify():\tnotification from playerID: %d" % (playerID)) + + # run the appropriate responder! + if ageSDL[stringVarName.value][0]: + PtDebugPrint("DEBUG: giraAgeSDLBoolRespondLightpost.OnSDLNotify:\tRunning true responder on %s, fastforward=%d" % (self.sceneobject.getName(), fastforward)) + respBoolTrue.run(self.key,avatar=objAvatar,fastforward=fastforward) + else: + PtDebugPrint("DEBUG: giraAgeSDLBoolRespondLightpost.OnSDLNotify:\tRunning false responder on %s, fastforward=%d" % (self.sceneobject.getName(), fastforward)) + respBoolFalse.run(self.key,avatar=objAvatar,fastforward=fastforward) + if stringVarName.value == "giraLightswitch03On": + import xSndLogTracks + xSndLogTracks.LogTrack("143","277") diff --git a/Python/grsn1stFloorClimb.py b/Python/grsn1stFloorClimb.py new file mode 100644 index 0000000000..0f2e8e24e0 --- /dev/null +++ b/Python/grsn1stFloorClimb.py @@ -0,0 +1,145 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +# for save/load +import cPickle + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## + +climbTrigger = ptAttribActivator(1,"the trigger to climb") +climbBehavior = ptAttribBehavior(2,"climb behavior") + +descendTrigger = ptAttribActivator(3,"the trigger to descend") +descendBehavior = ptAttribBehavior(4,"descend behavior") + +climbTopReset = ptAttribActivator(5,"clear region at top") +climbBottomReset = ptAttribActivator(6,"clear region at bottom") + +climbSoundAnim = ptAttribAnimation(7, "climb up sound anim") +descendSoundAnim = ptAttribAnimation(8,"climb down sound anim") + +############################################################## +# grsn1stFloorClimb +############################################################## +class grsn1stFloorClimb(ptResponder): + "subworld transition test" + + # constants + + def __init__(self): + "construction" + PtDebugPrint("grsn1stFloorClimb::init begin") + ptResponder.__init__(self) + self.id = 50112 + self.version = 4 + PtDebugPrint("grsn1stFloorClimb::init end") + + def OnFirstUpdate(self): + self.SDL.setDefault("intSDLClimber",(-1,)) + self.SDL.setDefault("intSDLDescender",(-1,)) + climbTopReset.enable() + climbBottomReset.enable() + climbTrigger.enable() + descendTrigger.enable() + + def OnNotify(self,state,id,events): + PtDebugPrint("********************************") + for event in events: + + PtDebugPrint("event[0] " + `event[0]`) + PtDebugPrint("event[1] " + `event[1]`) + PtDebugPrint("event[2] " + `event[2]`) + + climber = PtFindAvatar(events) + climberID = PtGetClientIDFromAvatarKey(climber.getKey()) + PtDebugPrint("climber ID = " + `climberID`) + currentClimber = self.SDL["intSDLClimber"][0] + currentDescender = self.SDL["intSDLDescender"][0] + PtDebugPrint("current climber = " + `currentClimber`) + PtDebugPrint("current descender = " + `currentClimber`) + + # execute climb behaviors + + if id == climbBehavior.id: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + climbSoundAnim.animation.play() + PtDebugPrint("starting to climb") + return + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + PtDebugPrint("finshed climb") + return + + if id == descendBehavior.id: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + descendSoundAnim.animation.play() + PtDebugPrint("starting to descend") + return + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + # temporary hack here + climber.physics.warp(ptPoint3(116.787,-478.983,-263.936)) + # end temporary hack + PtDebugPrint("finshed descent") + return + + # initiate climbing or descending + + if id == climbTrigger.id and event[0] == 1 and event[1] == 1: #someone is entering + if self.SDL["intSDLClimber"][0] == -1 and self.SDL["intSDLDescender"][0] == -1: #nobody currently climbing up/down + PtDebugPrint("initiated climbing avatar # "+ `climberID`) + self.SDL["intSDLClimber"]=(climberID,) + climbBehavior.run(climber) + return + + if id == descendTrigger.id and event[0] == 1 and event[1] == 1: #someone is entering + if self.SDL["intSDLClimber"][0] == -1 and self.SDL["intSDLDescender"][0] == -1: #no one currently climbing / descending + PtDebugPrint("initiated descent") + self.SDL["intSDLDescender"]=(climberID,) + + test = self.SDL["intSDLDescender"][0] + PtDebugPrint("just set descender to " + `test`) + + descendBehavior.run(climber) + return + + # reset the climb regions + + if id == climbTopReset.id and event[0] == 1 and event[1] == 0: #someone is exiting + if self.SDL["intSDLClimber"][0] == climberID and self.SDL["intSDLDescender"][0] == -1: #it's our recent climber + PtDebugPrint("reset climb / descend regions") + self.SDL["intSDLClimber"]=(-1,) + return + + if id == climbBottomReset.id and event[0] == 1 and event[1] == 0: #someone is exiting + if self.SDL["intSDLClimber"][0] == -1 and self.SDL["intSDLDescender"][0] == climberID: #it's our recent descender + PtDebugPrint("reset climb / descend regions") + self.SDL["intSDLDescender"]=(-1,) + return + diff --git a/Python/grsnDownElevator.py b/Python/grsnDownElevator.py new file mode 100644 index 0000000000..c11e4210be --- /dev/null +++ b/Python/grsnDownElevator.py @@ -0,0 +1,299 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + +# for visitor checking/dialogs +import xVisitorUtils + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## + +downElevTrigger = ptAttribActivator(1,"down elevator button") +downElevStartPoint = ptAttribSceneobject(2,"the point you start down from") +downBehavior = ptAttribBehavior(3,"down elevator behavior", netForce = 0) +downElevWarpPoint = ptAttribSceneobject(4,"the point you warp to on going down") + +upElevTrigger = ptAttribActivator(5,"up elevator button") +upElevStartPoint = ptAttribSceneobject(6,"the point you start up from") +upBehavior = ptAttribBehavior(7,"up elevator behavior", netForce = 0) +upElevWarpPoint = ptAttribSceneobject(8,"the point you warp to on going up") +upElevWarpHack = ptAttribSceneobject(9,"hack to get you where you should go") + +subworld = ptAttribSceneobject(10,"subworld") + +startUpCamera = ptAttribSceneobject(11,"up elev bottom cam") +finishUpCamera = ptAttribSceneobject(12,"up elev top cam") + +startDownCamera = ptAttribSceneobject(13,"down elev bottom cam") +finishDownCamera = ptAttribSceneobject(14,"down elev top cam") +exitTopCamera = ptAttribSceneobject(22,"exit top camera") + +downElevatorTopOpenAnim = ptAttribAnimation(15, "down elevDoorOpen", 1, netForce = 1) +downElevatorTopCloseAnim = ptAttribAnimation(16, "down elevDoorClose", 1, netForce = 1) +upElevatorTopOpenAnim = ptAttribAnimation(17, "up elevDoorOpen", 1, netForce = 1) +upElevatorTopCloseAnim = ptAttribAnimation(18, "up elevDoorClose", 1, netForce = 1) + +downElevatorBottomTrigger = ptAttribNamedResponder(19,"bottom down door opener",['on','off']) +upElevatorBottomTrigger = ptAttribNamedActivator(20,"bottom up elevator trigger") +upElevatorDoorTrigger = ptAttribNamedResponder(21,"bottom up door trigger",['on','off']) + +upElevBotSoundDummyAnim = ptAttribAnimation(23,"sound dummy up bottom") +upElevTopSoundDummyAnim = ptAttribAnimation(24,"sound dummy up top") +dnElevBotSoundDummyAnim = ptAttribAnimation(25,"sound dummy dn bottom") +dnElevTopSoundDummyAnim = ptAttribAnimation(26,"sound dummy dn top") + +upElevSDL = ptAttribString(27,"up elevator SDL var") +dnElevSDL = ptAttribString(28,"down elevator SDL var") + +upElevatorLights = ptAttribNamedResponder(29,"up elevator button lights",['TurnOn','TurnOff']) +dnElevatorLights = ptAttribResponder(30,"down elevator lights",['TurnOn','TurnOff']) +WellTopDefaultCam = ptAttribSceneobject(31,"well top camera") + +respDnElevFloorAnim = ptAttribNamedResponder(32,"down elev floor anim",netForce=1) +respUpElevFloorAnim = ptAttribNamedResponder(33,"up elev floor anim",netForce=1) + + +############################################################## +# grsnDownElevator +############################################################## +kOpenUpElevatorTop = 1 +kCloseUpElevatorTop = 2 +kOpenUpElevatorBottom = 3 +kCloseUpElevatorBottom = 4 +kOpenDownElevatorTop = 5 +kCloseDownElevatorTop = 6 +kOpenDownElevatorBottom = 7 +kCloseDownElevatorBottom = 8 + + +class grsnDownElevator(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 51001 + self.version = 9 + PtLoadDialog(xVisitorUtils.kVisitorNagDialog) + print "Initialized: grsnDownElevator" + + def __del__(self): + PtUnloadDialog(xVisitorUtils.kVisitorNagDialog) + + def OnServerInitComplete(self): + #set initial elevator state + ageSDL = PtGetAgeSDL() + + #register for sdl var changes + ageSDL.setNotify(self.key,upElevSDL.value,0.0) + ageSDL.setNotify(self.key,dnElevSDL.value,0.0) + + downOn = ageSDL[dnElevSDL.value][0] + if (downOn): + dnElevatorLights.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar()) + downElevTrigger.enable() + print "grsnDownElevator: down elevator on at load" + else: + dnElevatorLights.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + downElevTrigger.disable() + print "grsnDownElevator: down elevator off at load" + + upOn = ageSDL[upElevSDL.value][0] + if (upOn): + upElevatorLights.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar()) + upElevatorBottomTrigger.enable() + print "grsnDownElevator: up elevator on at load" + else: + upElevatorLights.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + upElevatorBottomTrigger.disable() + print "grsnDownElevator: up elevator off at load" + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + ageSDL = PtGetAgeSDL() + + if VARname == dnElevSDL.value: + downOn = ageSDL[dnElevSDL.value][0] + if (downOn): + dnElevatorLights.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar()) + downElevTrigger.enable() + print "grsnDownElevator: turn on down elevator" + else: + dnElevatorLights.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + downElevTrigger.disable() + print "grsnDownElevator: turn off down elevator" + + elif VARname == upElevSDL.value: + upOn = ageSDL[upElevSDL.value][0] + if (upOn): + upElevatorLights.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar()) + upElevatorBottomTrigger.enable() + print "grsnDownElevator: turn on up elevator" + else: + upElevatorLights.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + upElevatorBottomTrigger.disable() + print "grsnDownElevator: turn off up elevator" + + def OnTimer(self,id): + global kOpenUpElevatorTop + global kCloseUpElevatorTop + global kOpenUpElevatorBottom + global kCloseUpElevatorBottom + global kOpenDownElevatorTop + global kCloseDownElevatorTop + global kOpenDownElevatorBottom + global kCloseDownElevatorBottom + + if id == kOpenDownElevatorTop: + downElevatorTopOpenAnim.animation.play() + PtAtTimeCallback(self.key, 2.6, kCloseDownElevatorTop) + elif id == kCloseDownElevatorTop: + downElevatorTopCloseAnim.animation.play() + elif id == kOpenUpElevatorBottom: + upElevatorDoorTrigger.run(self.key,state='on') + elif id == kOpenUpElevatorTop: + upElevatorTopOpenAnim.animation.play() + elif id == kOpenDownElevatorBottom: + downElevatorBottomTrigger.run(self.key,state='on') + + + def OnNotify(self,state,id,events): + global avatarInElevator + + print "grsnDownElevator.OnNotify: state=%s id=%d events=%s %s" % (state, id, str(events[0][1]), str(events[0][2])) + + if id == downBehavior.id: + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage and avatarInElevator == PtGetLocalAvatar() and PtWasLocallyNotified(self.key): + print "grsnDownElevator: enter stage play" + PtAtTimeCallback(self.key, 1, kOpenDownElevatorTop) + dnElevTopSoundDummyAnim.animation.play() + return + + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage and avatarInElevator == PtGetLocalAvatar() and PtWasLocallyNotified(self.key): + print "grsnDownElevator: warping to down point" + respDnElevFloorAnim.run(self.key) + dnElevBotSoundDummyAnim.animation.play() + #downElevatorTopCloseAnim.animation.play() + startDownCamera.value.pushCutsceneCamera(1, avatarInElevator.getKey()) + #startDownCamera.value.pushCamera(avatarInElevator.getKey()) + #finishDownCamera.value.popCutsceneCamera(avatarInElevator.getKey()) + avatarInElevator.avatar.exitSubWorld() + avatarInElevator.physics.warpObj(downElevWarpPoint.value.getKey()) + PtAtTimeCallback(self.key,1.66,kOpenDownElevatorBottom) + return + + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + print "grsnDownElevator: other player warp" + avatarInElevator.avatar.exitSubWorld() + avatarInElevator.physics.warpObj(downElevWarpPoint.value.getKey()) + return + + elif event[0] == kMultiStageEvent and event[1] == 1 and event[2] == kAdvanceNextStage and avatarInElevator == PtGetLocalAvatar() and PtWasLocallyNotified(self.key): + print "grsnDownElevator: finished coming out of elevator" + #avatarInElevator.physics.warp(ptPoint3(78,-561.3,-279.041)) + startDownCamera.value.pushCamera(avatarInElevator.getKey()) + startDownCamera.value.popCutsceneCamera(avatarInElevator.getKey()) + cam = ptCamera() + cam.enableFirstPersonOverride() + downElevTrigger.enable() + PtSendKIMessage(kEnableEntireYeeshaBook,0) + return + + elif event[0] == kMultiStageEvent and event[1] == 1 and event[2] == kAdvanceNextStage: + print "grsnDownElevator: enable trigger" + downElevTrigger.enable() + return + + elif id == upBehavior.id: + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage and avatarInElevator == PtGetLocalAvatar() and PtWasLocallyNotified(self.key): + print "grsnDownElevator: enter stage play" + respUpElevFloorAnim.run(self.key) + PtAtTimeCallback(self.key,1,kOpenUpElevatorBottom) + upElevBotSoundDummyAnim.animation.play() + return + + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage and avatarInElevator == PtGetLocalAvatar() and PtWasLocallyNotified(self.key): + print "grsnDownElevator: warping to up point" + upElevTopSoundDummyAnim.animation.play() + avatarInElevator.avatar.enterSubWorld(subworld.value) + avatarInElevator.physics.warpObj(upElevWarpPoint.value.getKey()) + exitTopCamera.value.pushCamera(avatarInElevator.getKey()) + startUpCamera.value.popCutsceneCamera(avatarInElevator.getKey()) + PtAtTimeCallback(self.key,1.66,kOpenUpElevatorTop) + return + + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + print "grsnDownElevator: other player warp" + avatarInElevator.avatar.enterSubWorld(subworld.value) + avatarInElevator.physics.warpObj(upElevWarpPoint.value.getKey()) + return + + elif event[0] == kMultiStageEvent and event[1] == 1 and event[2] == kAdvanceNextStage and avatarInElevator == PtGetLocalAvatar() and PtWasLocallyNotified(self.key): + print "grsnDownElevator: finished coming out of elevator" + cam = ptCamera() + cam.enableFirstPersonOverride() + WellTopDefaultCam.value.pushCamera(avatarInElevator.getKey()) + upElevatorTopCloseAnim.animation.play() + upElevatorBottomTrigger.enable() + PtSendKIMessage(kEnableEntireYeeshaBook,0) + return + + elif event[0] == kMultiStageEvent and event[1] == 1 and event[2] == kAdvanceNextStage: + print "grsnDownElevator: enable trigger" + upElevatorBottomTrigger.enable() + return + + if state: + if not PtIsSubscriptionActive(): + print "grsnDownElevator: Elevators are disabled for visitors" + PtShowDialog(xVisitorUtils.kVisitorNagDialog) + return + + if id == downElevTrigger.id: + downElevTrigger.disable() + avatarInElevator = PtFindAvatar(events) + cam = ptCamera() + if (avatarInElevator == PtGetLocalAvatar()): + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + finishDownCamera.value.pushCutsceneCamera(0, avatarInElevator.getKey()) + print "grsnDownElevator: triggered down elevator" + downBehavior.run(avatarInElevator) + + elif id == upElevatorBottomTrigger.id: + upElevatorBottomTrigger.disable() + avatarInElevator = PtFindAvatar(events) + print "grsnDownElevator: triggered up elevator" + cam = ptCamera() + if (avatarInElevator == PtGetLocalAvatar()): + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + upBehavior.run(avatarInElevator) + startUpCamera.value.pushCutsceneCamera(0, avatarInElevator.getKey()) diff --git a/Python/grsnElevRespTrigger.py b/Python/grsnElevRespTrigger.py new file mode 100644 index 0000000000..2a52047437 --- /dev/null +++ b/Python/grsnElevRespTrigger.py @@ -0,0 +1,46 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## +trigger = ptAttribActivator(1,"sound trigger") +sound = ptAttribResponder(2,"sound responder",['play']) + + +class grsnElevRespTrigger(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 50224 + self.version = 1 + PtDebugPrint("Initialized: grsnElevRespTrigger", 4) + + def OnNotify(self,state,id,events): + if id == trigger.id: + sound.run(self.key, state='play') diff --git a/Python/grsnEmgrPhase0.py b/Python/grsnEmgrPhase0.py new file mode 100644 index 0000000000..21e6c4e2a2 --- /dev/null +++ b/Python/grsnEmgrPhase0.py @@ -0,0 +1,101 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: grsnEmgrPhase0.py +Age: Garrison +Date: January 2002 +Event Manager interface for Garrison Phase 0 content +""" + +from Plasma import * +from PlasmaTypes import * +import string + +#globals +variable = None + +BooleanVARs = [ + + ] + +AgeStartedIn = None + + + +class grsnEmgrPhase0(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5213 + + version = 1 + self.version = version + print "__init__grsnEmgrPhase0 v.", version + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + for variable in BooleanVARs: + print "tying together", variable + ageSDL.setNotify(self.key,variable,0.0) + self.IManageBOOLs(variable, "") + + def OnSDLNotify(self,VARname,SDLname,PlayerID,tag): + global variable + global sdlvalue + + + PtDebugPrint("grsnEmgrPhase0.SDLNotify - name = %s, SDLname = %s" % (VARname,SDLname)) + + if VARname in BooleanVARs: + print "grsnEmgrPhase0.OnSDLNotify : %s is a BOOLEAN Variable" % (VARname) + self.IManageBOOLs(VARname,SDLname) + + else: + PtDebugPrint("grsnEmgrPhase0.OnSDLNotify:\tERROR: Variable %s was not recognized as a Boolean, Performance, or State Variable. " % (VARname)) + pass + + + def IManageBOOLs(self,VARname,SDLname): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + if ageSDL[VARname][0] == 1: # are we paging things in? + PtDebugPrint("grsnEmgrPhase0.OnSDLNotify:\tPaging in room ", VARname) + PtPageInNode(VARname) + elif ageSDL[VARname][0] == 0: #are we paging things out? + print "variable = ", VARname + PtDebugPrint("grsnEmgrPhase0.OnSDLNotify:\tPaging out room ", VARname) + PtPageOutNode(VARname) + else: + sdlvalue = ageSDL[VARname][0] + PtDebugPrint("grsnEmgrPhase0.OnSDLNotify:\tERROR: Variable %s had unexpected SDL value of %s" % (VARname,sdlvalue)) + + + diff --git a/Python/grsnGearRide.py b/Python/grsnGearRide.py new file mode 100644 index 0000000000..3c5b2c4074 --- /dev/null +++ b/Python/grsnGearRide.py @@ -0,0 +1,359 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +# for save/load +import cPickle + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## + +gearEnterExclude = ptAttribExcludeRegion(1,"gear enter exclude") +failedEnterExclude = ptAttribExcludeRegion(2,"failed enter exclude") +failedExitExclude = ptAttribExcludeRegion(3,"failed exit exclude") + +crackOpenEvent = ptAttribActivator(4,"open crack event") +crackCloseEvent = ptAttribActivator(5,"close crack event") + +exitOpenEvent = ptAttribActivator(6,"exit open event") +exitCloseEvent = ptAttribActivator(7,"exit close event") + +gearEnterRegion = ptAttribActivator(8,"trigger subworld entry") +gearExitRegion = ptAttribActivator(9,"exit subworld at gear") + +gearSubWorld = ptAttribSceneobject(10,"gear niche subworld") + +safetyRegion1 = ptAttribActivator(11,"safety region 1") +safetyRegion2 = ptAttribActivator(12,"safety region 2") +safetyRegion3 = ptAttribActivator(13,"safety region 3") + +enterSafePoint = ptAttribSceneobject(14,"enter safe point") +exitSafePoint = ptAttribSceneobject(15,"exit safe point") + +gearExitCrackRegion = ptAttribActivator(16,"exit subworld at crack") + +rideCamera = ptAttribSceneobject(17,"ride camera") +gearExitCamera = ptAttribSceneobject(18,"exit at gear camera") +crackExitCamera = ptAttribSceneobject(19,"exit at crack camera") + +popExitCrackCamera = ptAttribActivator(20,"pop exit crack camera") + +safetyRegion4 = ptAttribActivator(21,"safety region 4") +safetyRegion5 = ptAttribActivator(22,"safety region 5") + +stringSDLVarPower = ptAttribString(23,"SDL Bool Power") + +keepAwayFromGear = ptAttribExcludeRegion(24,"keep away from gear rgn") +keepAwayOn = ptAttribActivator(25,"keep away region on") +keepAwayOff = ptAttribActivator(26,"keep away region off") + +gearTeleportSpot = ptAttribSceneobject(27,"gear room teleport point") + +AgeStartedIn = None + +############################################################## +# grsnGearRide +############################################################## +class grsnGearRide(ptResponder): + "subworld transition test" + + # constants + + def __init__(self): + "construction" + PtDebugPrint("grsnGearRide::init begin") + ptResponder.__init__(self) + self.id = 50113 + self.version = 3 + PtDebugPrint("grsnGearRide::init end") + + def clearExcludeRegions(self): + gearEnterExclude.clear(self.key) + failedEnterExclude.clear(self.key) + failedExitExclude.clear(self.key) + + def releaseExcludeRegions(self): + gearEnterExclude.release(self.key) + failedEnterExclude.release(self.key) + failedExitExclude.release(self.key) + + def EnableSafetyRegions(self): + safetyRegion1.enable() + safetyRegion2.enable() + safetyRegion3.enable() + + def DisableSafetyRegions(self): + safetyRegion1.disable() + safetyRegion2.disable() + safetyRegion3.disable() + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + self.SDL.setDefault("exitOpen",(0,)) + self.SDL.setDefault("crackOpen",(0,)) + self.SDL.setDefault("avatarRidingGear",(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1)) + self.SDL.setDefault("avatarWithExitCam",(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1)) + self.clearExcludeRegions() + + def OnServerInitComplete(self): + + # fix up our region detectors to fire on every enter + + + if self.SDL["exitOpen"][0]: + PtDebugPrint("opening gear niche at load") + self.releaseExcludeRegions() + else: + PtDebugPrint("closing gear niche at load") + self.clearExcludeRegions() + + if self.SDL["crackOpen"][0]: + PtDebugPrint("opening gear exit at load") + gearExitRegion.enable() + gearEnterExclude.release(self.key) + failedExitExclude.release(self.key) + else: + PtDebugPrint("closing gear exit at load") + self.clearExcludeRegions() + gearExitRegion.disable() + + gearEnterRegion.volumeSensorIgnoreExtraEnters(0) + gearExitRegion.volumeSensorIgnoreExtraEnters(0) + gearExitCrackRegion.volumeSensorIgnoreExtraEnters(0) + + def OnNotify(self,state,id,events): + + #for event in events: + # PtDebugPrint("new event:") + # PtDebugPrint("event[0] " + `event[0]`) + # PtDebugPrint("event[1] " + `event[1]`) + # PtDebugPrint("event[2] " + `event[2]`) + + if id == crackOpenEvent.id: + for event in events: + if event[0] == kPickedEvent and event[1] == 1 and self.SDL["crackOpen"][0] == 0: + #PtDebugPrint("opening gear niche") + gearEnterRegion.enable() + gearExitCrackRegion.enable() + self.releaseExcludeRegions() + self.SDL["crackOpen"] = (1,) + return + + if id == crackCloseEvent.id: + for event in events: + if event[0] == kPickedEvent and event[1] == 1 and self.SDL["crackOpen"][0] == 1: + #PtDebugPrint("closing gear niche") + gearEnterRegion.disable() + gearExitCrackRegion.disable() + self.clearExcludeRegions() + self.SDL["crackOpen"] = (0,) + return + + if id == exitOpenEvent.id: + for event in events: + if event[0] == kPickedEvent and event[1] == 1 and self.SDL["exitOpen"][0] == 0: + print"opening gear exit" + self.DisableSafetyRegions() + gearExitRegion.enable() + gearEnterRegion.enable() + gearEnterExclude.release(self.key) + failedExitExclude.release(self.key) + self.SDL["exitOpen"] = (1,) + return + + if id == keepAwayOn.id: + for event in events: + if event[0] == kPickedEvent and event[1] == 1 and self.SDL["exitOpen"][0] == 0: + print"back off" + keepAwayFromGear.clear(self.key) + return + + if id == keepAwayOff.id: + for event in events: + if event[0] == kPickedEvent and event[1] == 1 and self.SDL["exitOpen"][0] == 0: + print"back off" + keepAwayFromGear.release(self.key) + return + + if id == exitCloseEvent.id: + for event in events: + if event[0] == kPickedEvent and event[1] == 1 and self.SDL["exitOpen"][0] == 1: + print"closing gear exit" + self.clearExcludeRegions() + gearExitRegion.disable() + gearEnterRegion.disable() + self.SDL["exitOpen"] = (0,) + self.EnableSafetyRegions() + return + + if id == safetyRegion1.id or id == safetyRegion2.id or id == safetyRegion3.id: + avatarRidingGear = PtFindAvatar(events) + avatarID = PtGetClientIDFromAvatarKey(avatarRidingGear.getKey()) + for event in events: + if event[0] == kCollisionEvent: + if event[1] == 1: + for count in [0,1,2,3,4,5,6,7,8,9]: + if self.SDL["avatarRidingGear"][count] == avatarID: + rgn = 0 + if id == safetyRegion1.id: + rgn = 1 + elif id == safetyRegion2.id: + rgn = 2 + elif id == safetyRegion3.id: + rgn = 3 + PtDebugPrint("avatar ID " + `avatarID` + " entered safe region " + `rgn`) + gearExitRegion.disable() + avatarRidingGear.avatar.enterSubWorld(gearSubWorld.value) + avatarRidingGear.physics.warpObj(enterSafePoint.value.getKey()) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + rideCamera.value.pushCutsceneCamera(1,avatarRidingGear.getKey()) + self.SDL.setIndex("avatarRidingGear",count,avatarID) + + return + for count in [0,1,2,3,4,5,6,7,8,9]: + if self.SDL["avatarRidingGear"][count] == -1: + PtDebugPrint("avatar ID " + `avatarID` + " entered gear subworld") + gearExitRegion.disable() + avatarRidingGear.avatar.enterSubWorld(gearSubWorld.value) + avatarRidingGear.physics.warpObj(enterSafePoint.value.getKey()) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + rideCamera.value.pushCutsceneCamera(1,avatarRidingGear.getKey()) + self.SDL.setIndex("avatarRidingGear",count,avatarID) + return + elif self.SDL["avatarRidingGear"][count] == avatarID: + return + PtDebugPrint("error - more than 10 people in gear niche?!?") + +# if id == safetyRegion4.id or id == safetyRegion5.id: +# avatarEntering = PtFindAvatar(events) +# avatarEntering.avatar.exitSubWorld() +# avatarEntering.avatar.warpObj(exitSafePoint.value.getKey()) +# return + + + if id == gearEnterRegion.id: + avatarRidingGear = PtFindAvatar(events) + avatarID = PtGetClientIDFromAvatarKey(avatarRidingGear.getKey()) + for event in events: + if event[0] == kCollisionEvent: + if event[1] == 1: + for count in [0,1,2,3,4,5,6,7,8,9]: + if self.SDL["avatarRidingGear"][count] == avatarID: + PtDebugPrint("avatar ID " + `avatarID` + " entered gear subworld TWICE?!?") + PtDebugPrint("avatar ID " + `avatarID` + " entered gear subworld") + gearExitRegion.disable() + avatarRidingGear.avatar.enterSubWorld(gearSubWorld.value) + avatarRidingGear.physics.warpObj(enterSafePoint.value.getKey()) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + avatarRidingGear.draw.enable() + PtFadeLocalAvatar(0) + rideCamera.value.pushCutsceneCamera(1,avatarRidingGear.getKey()) + self.SDL.setIndex("avatarRidingGear",count,avatarID) + return + for count in [0,1,2,3,4,5,6,7,8,9]: + if self.SDL["avatarRidingGear"][count] == -1: + PtDebugPrint("avatar ID " + `avatarID` + " entered gear subworld") + gearExitRegion.disable() + avatarRidingGear.avatar.enterSubWorld(gearSubWorld.value) + avatarRidingGear.physics.warpObj(enterSafePoint.value.getKey()) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + avatarRidingGear.draw.enable() + PtFadeLocalAvatar(0) + rideCamera.value.pushCutsceneCamera(1,avatarRidingGear.getKey()) + self.SDL.setIndex("avatarRidingGear",count,avatarID) + return + elif self.SDL["avatarRidingGear"][count] == avatarID: + return + PtDebugPrint("error - more than 10 people in gear niche?!?") + + if id == gearExitRegion.id: + avatarExitingGear = PtFindAvatar(events) + avatarID = PtGetClientIDFromAvatarKey(avatarExitingGear.getKey()) + for event in events: + if event[0] == kCollisionEvent: + if event[1] == 1: + for count in [0,1,2,3,4,5,6,7,8,9]: + if self.SDL["avatarRidingGear"][count] == avatarID: + PtDebugPrint("avatar ID " + `avatarID` + " entered exit region at gear room") + cam = ptCamera() + gearExitCamera.value.pushCamera(avatarExitingGear.getKey()) + rideCamera.value.popCutsceneCamera(avatarExitingGear.getKey()) + avatarExitingGear.avatar.exitSubWorld() + avatarExitingGear.physics.warpObj(gearTeleportSpot.value.getKey()) + cam.enableFirstPersonOverride() + avatarExitingGear.draw.enable() + self.SDL.setIndex("avatarRidingGear",count,-1) + return + PtDebugPrint("avatar ID " + `avatarID` + " entered gear exit region but wasn't in the niche?!?") + + if id == gearExitCrackRegion.id: + avatarExitingGear = PtFindAvatar(events) + avatarID = PtGetClientIDFromAvatarKey(avatarExitingGear.getKey()) + for event in events: + if event[0] == kCollisionEvent: + if event[1] == 1: + for count in [0,1,2,3,4,5,6,7,8,9]: + if self.SDL["avatarRidingGear"][count] == avatarID: + PtDebugPrint("avatar ID " + `avatarID` + " entered exit region at crack") + avatarExitingGear.avatar.exitSubWorld() + avatarExitingGear.physics.warpObj(exitSafePoint.value.getKey()) + cam = ptCamera() + cam.enableFirstPersonOverride() + crackExitCamera.value.pushCutsceneCamera(1,avatarExitingGear.getKey()) + avatarExitingGear.draw.enable() + self.SDL.setIndex("avatarRidingGear",count,-1) + self.SDL.setIndex("avatarWithExitCam",count,avatarID) + return + PtDebugPrint("avatar ID " + `avatarID` + " entered gear exit region but wasn't in the niche?!?") + + if id == popExitCrackCamera.id: + avatarExitingCrack = PtFindAvatar(events) + avatarID = PtGetClientIDFromAvatarKey(avatarExitingCrack.getKey()) + for event in events: + if event[0] == kCollisionEvent: + if event[1] == 1: + for count in [0,1,2,3,4,5,6,7,8,9]: + if self.SDL["avatarWithExitCam"][count] == avatarID: + PtDebugPrint("avatar ID " + `avatarID` + " exiting crack after exiting niche - popping camera") + cam = ptCamera() + cam.enableFirstPersonOverride() + crackExitCamera.value.popCutsceneCamera(avatarExitingCrack.getKey()) + self.SDL.setIndex("avatarWithExitCam",count,-1) + return + diff --git a/Python/grsnGetKI.py b/Python/grsnGetKI.py new file mode 100644 index 0000000000..2c6f9686b1 --- /dev/null +++ b/Python/grsnGetKI.py @@ -0,0 +1,72 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: grsnGetKI +Age: Garrison +Allows player to get the normal KI +version 1.1 +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + +#============================================================= +# define the attributes that will be entered in max +#============================================================= +clkDispensor = ptAttribActivator(1,"The clickable to get KI") +rspDispensor = ptAttribResponder(2, "The responder to get KI") + +#---------- +# globals +#---------- +WasAvatarLocal = 0 + +#---------- +# constants +#---------- + +#==================================== +class grsnGetKI(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 50130 + self.version = 1 + + def OnNotify(self,state,id,events): + global WasAvatarLocal + #~ PtDebugPrint("grsnGetKI: Notify event state=%f,id=%d,events=" % (state,id),events) + # is this our activator notifying us? + if state and id == clkDispensor.id: + avatar_who_clicked = PtFindAvatar(events) + if avatar_who_clicked == PtGetLocalAvatar(): + WasAvatarLocal = 1 + else: + WasAvatarLocal = 0 + rspDispensor.run(self.key,events=events) + if state and id == rspDispensor.id: + if WasAvatarLocal: + PtSendKIMessageInt(kUpgradeKILevel,kNormalKI) + WasAvatarLocal = 0 diff --git a/Python/grsnMainWallPython.py b/Python/grsnMainWallPython.py new file mode 100644 index 0000000000..9ac1231452 --- /dev/null +++ b/Python/grsnMainWallPython.py @@ -0,0 +1,253 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +# for save/load +import cPickle + +## COMMENTED OUT by Jeff due to the re-write in the garrison wall + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## +northWall = ptAttribSceneobjectList(1,"North Wall Decals",byObject=1) +southWall = ptAttribSceneobjectList(2,"South Wall Decals",byObject=1) +northBlocker = ptAttribSceneobjectList(3,"North Wall Blockers",byObject=1) +southBlocker = ptAttribSceneobjectList(4,"South Wall Blockers",byObject=1) +############################################################## +# grsnMainWallPython +############################################################## + +## keep track of what to draw +NorthBlockers = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] +SouthBlockers = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] + +ReceiveInit = false +""" +NorthState = ptClimbingWallMsgState.kWaiting +SouthState = ptClimbingWallMsgState.kWaiting +""" + +## for team light responders +kTeamLightsOn = 0 +kTeamLightsOff = 1 +kTeamLightsBlink = 2 + +## game states + +kWaiting = 0 +kNorthSit = 1 +kSouthSit = 2 +kNorthSelect = 3 +kSouthSelect = 4 +kNorthReady = 5 +kSouthReady = 6 +kNorthPlayerEntry = 7 +kSouthPlayerEntry = 8 +kGameInProgress = 9 +kNorthWin = 10 +kSouthWin = 11 +kSouthQuit = 12 +kNorthQuit = 13 + + +class grsnMainWallPython(ptResponder): + + # constants + + def __init__(self): + "construction" + PtDebugPrint("grsnMainWallPython::init begin") + ptResponder.__init__(self) + self.id = 52394 + self.version = 1 + PtDebugPrint("grsnMainWallPython::init end") +""" + def OnServerInitComplete(self): + global ReceiveInit + + PtDebugPrint("grsnWallPython::OnServerInitComplete") + solo = true + if len(PtGetPlayerList()): + solo = false + ReceiveInit = true + return + else: + print"solo in climbing wall" + + def OnClimbingBlockerEvent(self,blocker): + + print"looking for blocker named ",blocker.getName() + i = 0 + while i < 171: + if (northBlocker.value[i] == blocker): + northWall.value[i].runAttachedResponder(kTeamLightsBlink) + print"found matching texture named ",northWall.value[i].getName() + return + elif (southBlocker.value[i] == blocker): + southWall.value[i].runAttachedResponder(kTeamLightsBlink) + print"found matching texture named ",southWall.value[i].getName() + return + i = i + 1 + + + def OnClimbingWallInit(self,type,state,value): + global ReceiveInit + global SouthState + global NorthState + + print"grsnMainClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value + if (ReceiveInit == false): + print"failed to receive init" + return + if (type == ptClimbingWallMsgType.kEndGameState): + ReceiveInit = false + print "finished receiving total game state" + # update lights display + if (SouthState == ptClimbingWallMsgState.kSouthWin or \ + NorthState == ptClimbingWallMsgState.kNorthWin or \ + NorthState == ptClimbingWallMsgState.kNorthQuit or \ + SouthState == ptClimbingWallMsgState.kSouthQuit): + #display wall settings + i = 0 + while (i < 20): + value = SouthBlockers[i] + if (value > -1): + southWall.value[value].runAttachedResponder(kTeamLightsOn) + print"drawing s wall index",value + value = NorthBlockers[i] + if (value > -1): + northWall.value[value].runAttachedResponder(kTeamLightsOn) + print"drawing n wall index",value + i = i + 1 + + if (type == ptClimbingWallMsgType.kTotalGameState): + SouthState = state + NorthState = value + print "begin receiving total game state" + + elif (type == ptClimbingWallMsgType.kAddBlocker and state > 0): + self.SetWallIndex(state,true,value) + + + def OnClimbingWallEvent(self,type,state,value): + global NorthState + global SouthState + global NorthBlockers + global SouthBlockers + + print"grsnMainClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value + + if (type == ptClimbingWallMsgType.kNewState): + if (value == 1): + NorthState = state + else: + SouthState = state + if (state == ptClimbingWallMsgState.kSouthWin or \ + state == ptClimbingWallMsgState.kNorthWin or \ + state == ptClimbingWallMsgState.kNorthQuit or \ + state == ptClimbingWallMsgState.kSouthQuit): + #display wall settings + i = 0 + while (i < 20): + value = SouthBlockers[i] + if (value > -1): + southWall.value[value].runAttachedResponder(kTeamLightsOn) + print"drawing s wall index",value + value = NorthBlockers[i] + if (value > -1): + northWall.value[value].runAttachedResponder(kTeamLightsOn) + print"drawing n wall index",value + i = i + 1 + elif (state == ptClimbingWallMsgState.kSouthSelect): + #clear wall settings + i = 0 + while (i < 171): + southWall.value[i].runAttachedResponder(kTeamLightsOff) + if (i < 20): + SouthBlockers[i] = -1 + i = i + 1 + elif (state == ptClimbingWallMsgState.kNorthSelect): + #clear wall settings + i = 0 + while (i < 171): + if (i < 20): + NorthBlockers[i] = -1 + northWall.value[i].runAttachedResponder(kTeamLightsOff) + i = i + 1 + + elif (type == ptClimbingWallMsgType.kAddBlocker): + self.SetWallIndex(state,true,value) + + + elif (type == ptClimbingWallMsgType.kRemoveBlocker): + self.SetWallIndex(state,false,value) + + def SetWallIndex(self,index,value,north): + global SouthBlockers + global NorthBlockers + + i = 0 + if (value): + if (north): + while (NorthBlockers[i] >= 0): + i = i + 1 + if (i == 20): + print"yikes - somehow overran the array!" + return + NorthBlockers[i] = index + print"set north wall index ",index," in slot ",i," to true" + else: + while (SouthBlockers[i] >= 0): + i = i + 1 + if (i == 20): + print"yikes - somehow overran the array!" + return + SouthBlockers[i] = index + print"set south wall index ",index," in slot ",i," to true" + else: + if (north): + while (NorthBlockers[i] != index): + i = i + 1 + if (i == 20): + print"this should not get hit - looked for non-existent NorthWall entry!" + return + NorthBlockers[i] = -1 + print"removed index ",index," from list slot ",i + else: + while (SouthBlockers[i] != index): + i = i + 1 + if (i == 20): + print"this should not get hit - looked for non-existent SouthWall entry!" + return + SouthBlockers[i] = -1 + print"removed index ",index," from list slot ",i + + + + """ diff --git a/Python/grsnNexusBookMachine.py b/Python/grsnNexusBookMachine.py new file mode 100644 index 0000000000..01bd0e268e --- /dev/null +++ b/Python/grsnNexusBookMachine.py @@ -0,0 +1,122 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ + + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * +from PlasmaKITypes import * + +purpleResp = ptAttribResponder(1,"purple responder") +yellowResp = ptAttribResponder(2,"yellow responder") +bookPurpleInPos = ptAttribActivator(3,"Purple book in position event") +bookYellowInPos = ptAttribActivator(4,"Yellow book in position event") +bookPurpleOutResponder = ptAttribResponder(5,"Purple book out") +bookYellowOutResponder = ptAttribResponder(6,"Yellow book out") +bookPurpleClickable = ptAttribActivator(7,"purple book clickable") +bookYellowClickable = ptAttribActivator(8,"yellow book clickable") +teamPurpleTeleport = ptAttribSceneobject(9,"team purple teleport") +teamYellowTeleport = ptAttribSceneobject(10,"team yellow teleport") +resetResponder = ptAttribResponder(11,"reset floor",netForce=1) +entryTrigger = ptAttribActivator(12,"entry trigger region",netForce=0) +fakeLinkBehavior = ptAttribBehavior(13,"link out behavior",netForce=0) + +waitingOnPBook = false +waitingOnYBook = false +yellowLink = false + +class grsnNexusBookMachine(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + print"book machine init" + self.id = 53624 + self.version = 2 + + + def OnServerInitComplete(self): + pass + + + def OnFirstUpdate(self): + pass + + def OnTimer(self,id): + global yellowLink + + avatar = PtGetLocalAvatar() + if (yellowLink): + PtFakeLinkAvatarToObject(avatar.getKey(),teamYellowTeleport.value.getKey()) + else: + PtFakeLinkAvatarToObject(avatar.getKey(),teamPurpleTeleport.value.getKey()) + + resetResponder.run(self.key,avatar=PtGetLocalAvatar()) + PtSendKIMessage(kEnableEntireYeeshaBook,0) + + def OnNotify(self,state,id,events): + global waitingOnPBook + global waitingOnYBook + global yellowLink + + print"id ",id + + avatar=PtFindAvatar(events) + local = PtGetLocalAvatar() + + if (avatar != local): + return + + if (id == fakeLinkBehavior.id): + print"notified of link behavior, yellow book ",yellowLink + for event in events: + if (event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage): + print"started touching book, set warp out timer" + PtAtTimeCallback(self.key ,1.0 ,0) + return + + if not state: + return + + if (id == bookPurpleInPos.id): + print"Purple book aligned" + bookPurpleOutResponder.run(self.key) + + if (id == bookYellowInPos.id): + print"Yellow book aligned" + bookYellowOutResponder.run(self.key) + + if (id == entryTrigger.id): + PtWearMaintainerSuit(avatar.getKey(),false) + + if (id == bookPurpleClickable.id): + print"touched purple team room book" + yellowLink = false + avatar.avatar.runBehaviorSetNotify(fakeLinkBehavior.value,self.key,fakeLinkBehavior.netForce) + + if (id == bookYellowClickable.id): + print"touched yellow team room book" + yellowLink = true + avatar.avatar.runBehaviorSetNotify(fakeLinkBehavior.value,self.key,fakeLinkBehavior.netForce) \ No newline at end of file diff --git a/Python/grsnPageMaster.py b/Python/grsnPageMaster.py new file mode 100644 index 0000000000..6680df391d --- /dev/null +++ b/Python/grsnPageMaster.py @@ -0,0 +1,116 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: grsnPageMaster.py +Age: Garrison +Date: December 2006 +manages page loading for public vs. non-public Garrisons +""" + +from Plasma import * +from PlasmaTypes import * + + +IsPublic = 0 + + +class grsnPageMaster(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 50100 + self.version = 1 + + global IsPublic + + parentname = None + + try: + agevault = ptAgeVault() + ageinfo = agevault.getAgeInfo() + parent = ageinfo.getParentAgeLink() + parentinfo = parent.getAgeInfo() + parentname = parentinfo.getAgeFilename() + except: + pass + + if parentname == "Neighborhood": + IsPublic = 1 + print "grsnPageMaster.__init__(): Garrison version = public" + else: + print "grsnPageMaster.__init__(): Garrison version = Yeesha" + + pages = [] + + # Add the common pages + ## actually, we'll just set these to load automatically in the .age file + #pages += ["grsnWellInner","grsnWellFirstFloorRooms","grsnWellCameras"] + + # for public version, add any pages specific only for that + if IsPublic: + pages += ["WellWindowFake"] + # for non-public version, add all the remaining pages + else: + pages += ["grsnWellOccluders","grsnWellSecondFloorRooms","grsnWellSecondFloorGearRoom","grsnElevator","grsnExterior"] + pages += ["grsnVeranda","grsnVerandaExterior","grsnObsRoom01Imager","grsnObsRoom02Imager","grsnPrison","grsnPrisonTunnels"] + pages += ["grsnTeamRoom01","grsnTeamRoom02","grsnTrainingCenterHalls","grsnTrainingCenterMudRooms","grsnTrainingCntrLinkRm"] + pages += ["TrnCtrControlRoom01","TrnCtrControlRoom02","trainingCenterObservationRooms","NexusBlackRoom","NexusWhiteRoom"] + pages += ["WallRoom","grsnWallRoomClimbingPhys"] + pages += ["FemaleElevatorArrivingBottom","FemaleElevatorArrivingTop","FemaleElevatorLeavingBottom","FemaleElevatorLeavingTop"] + pages += ["FemaleLandingRoll","FemaleReadyIdle","FemaleReadyJump","FemaleTubeFall"] + pages += ["FemaleWallClimbDismountDown","FemaleWallClimbDismountLeft","FemaleWallClimbDismountRight","FemaleWallClimbDismountUp"] + pages += ["FemaleWallClimbDown","FemaleWallClimbFallOff","FemaleWallClimbIdle","FemaleWallClimbLeft"] + pages += ["FemaleWallClimbMountDown","FemaleWallClimbMountLeft","FemaleWallClimbMountRight","FemaleWallClimbMountUp"] + pages += ["FemaleWallClimbRelease","FemaleWallClimbRight","FemaleWallClimbUp"] + pages += ["MaleElevatorArrivingBottom","MaleElevatorArrivingTop","MaleElevatorLeavingBottom","MaleElevatorLeavingTop"] + pages += ["MaleLandingRoll","MaleReadyIdle","MaleReadyJump","MaleTubeFall"] + pages += ["MaleWallClimbDismountDown","MaleWallClimbDismountLeft","MaleWallClimbDismountRight","MaleWallClimbDismountUp"] + pages += ["MaleWallClimbDown","MaleWallClimbFallOff","MaleWallClimbIdle","MaleWallClimbLeft"] + pages += ["MaleWallClimbMountDown","MaleWallClimbMountLeft","MaleWallClimbMountRight","MaleWallClimbMountUp"] + pages += ["MaleWallClimbRelease","MaleWallClimbRight","MaleWallClimbUp"] + + PtPageInNode(pages) + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + pass + + + def Load(self): + pass + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + pass + + + def OnNotify(self,state,id,events): + pass + diff --git a/Python/grsnPowerOn.py b/Python/grsnPowerOn.py new file mode 100644 index 0000000000..24fd806508 --- /dev/null +++ b/Python/grsnPowerOn.py @@ -0,0 +1,731 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +# for save/load +import cPickle + +import xEnum + +# ############################################################# +# define the attributes/parameters that we need from the 3dsMax scene +# ############################################################# + + +firstFloorDoors = ptAttribNamedResponder(1,"first floor doors On",['TurnOn','TurnOff'],netForce=1) +secondFloorDoors = ptAttribNamedResponder(2,"second floor doors On",['TurnOn','TurnOff'],netForce=1) + +gearSwitch = ptAttribActivator(6, "gear switch") +upElevSwitch = ptAttribActivator(7, "up elevator switch") +dnElevSwitch = ptAttribActivator(8, "down elevator switch") +mainSwitch = ptAttribActivator(9, "main switch") +gearBrake01 = ptAttribActivator(11, "gear switch") +gearBrake02 = ptAttribActivator(12, "gear switch") + +gearBrake01Resp = ptAttribResponder(13,"gear brake 01",['Unlock','Trip','Lock','AutoReturn'],netForce=1) +gearBrake02Resp = ptAttribResponder(14,"gear brake 02",['Unlock','Trip','Lock','AutoReturn'],netForce=1) +mainSwitchResp = ptAttribResponder(15,"main switch responder",['TurnOn','TurnOff','Trip','Break','PrimerExpired'],netForce=1) +gearSwitchResp = ptAttribResponder(16,"gear switch responder",['TurnOn','TurnOff','Trip','Break','TripEngaged'],netForce=1) +upElevSwitchResp = ptAttribResponder(18,"upElev switch responder",['TurnOn','TurnOff','Trip','Break','TripEngaged'],netForce=1) +dnElevSwitchResp = ptAttribResponder(19,"dnElev switch responder",['TurnOn','TurnOff','Trip','Break','TripEngaged'],netForce=1) + +mainSwitchSDL = ptAttribString(20,"main switch SDL") +gearSwitchSDL = ptAttribString(21,"gear switch SDL") +upElevSwitchSDL = ptAttribString(23,"upElev switch SDL") +dnElevSwitchSDL = ptAttribString(24,"dnElev switch SDL") +gearBrake01SDL = ptAttribString(25,"brake 01 SDL") +gearBrake02SDL = ptAttribString(26,"brake 02 SDL") + +initResponder = ptAttribResponder(27,"init lever arm resp",netForce=1) + +weightHighDown = ptAttribActivator(28,"weight high down event") +weightMedDown = ptAttribActivator(29,"weight Med down event") +weightLowDown = ptAttribActivator(30,"weight Low down event") +weightLowestDown = ptAttribActivator(31,"weight Lowest down event") + +weightHighUp = ptAttribActivator(32,"weight high up event") +weightMedUp = ptAttribActivator(33,"weight Med up event") +weightLowUp = ptAttribActivator(34,"weight Low up event") +weightLowestUp = ptAttribActivator(35,"weight Lowest up event") + +flashingLightsResponder = ptAttribResponder(36,"button and floor lights",['Off','Blink','On'],netForce=1) +switchGlowResponder = ptAttribResponder(37,"main switch glow indicator",['On','Off'],netForce=1) +gearGlowResponder = ptAttribResponder(38,"gear switch glow indicator",['On','Off'],netForce=1) +upElevGlowResponder = ptAttribResponder(39,"up switch glow indicator",['On','Off'],netForce=1) +dnElevGlowResponder = ptAttribResponder(40,"dn switch glow indicator",['On','Off'],netForce=1) + +weightControlResponder = ptAttribResponder(41,"weight control responder",['High','Medium','Low','Lowest','HighDown'],netForce=1) +weightTrigger = ptAttribActivator(42,"weight activator") + +mainPowerOnResponder = ptAttribResponder(43,"main power on",netForce=1) +mainPowerOffResponder = ptAttribResponder(44,"main power off",['GearOff','GearDown'],netForce=1) +mainBreakerResponder = ptAttribResponder(45,"main breaker responder",netForce=1) +gearRoomDoors = ptAttribResponder(46,"gear room doors",['TurnOn','TurnOff'],netForce=1) + +reverser = ptAttribResponder(47,"weight reverser",['Forward','Reverse'],netForce=1) +weightUnTrigger = ptAttribActivator(48,"weight deactivator") + +weightAnimation = ptAttribAnimation(49,"weight animation",netForce = 1) +weightGearAnimation = ptAttribAnimation(50,"weight gear animation",netForce = 1) +weightMatlAnimation = ptAttribAnimation(51,"weight material animation",netForce = 1) + +weightStartSoundResp = ptAttribResponder(52,"weight start sound responder",['Start','Loop','Stop','StopAll'],netForce=1) +weightStartSoundTrigger = ptAttribActivator(53,"start sound anim event") +weightStopSoundTrigger = ptAttribActivator(54,"stop sound anim event") +weightAtTopTrigger = ptAttribActivator(55,"weigh at top anim event") +weightStopDownSoundTrigger = ptAttribActivator(56,"weigh near bottom anim event") + +gearStopTrigger = ptAttribActivator(57,"gear stop event") +gearLoopSound = ptAttribResponder(58,"persistent loop sound",netForce=1) + +kDown = 0 +kUp = 1 +kCameraReturn = 99 + +AgeStartedIn = None +generatorPrimed = false +scaleEngaged = false +weightDirection = kDown +weightNearUpEnd = false +weightNearDownEnd = false +weightSoundLoopingDown = false +gearStopping = false +gearStartingDown = false +weightEngageDisabled = false + +TimerID = xEnum.Enum("UpElevatorSwitch, DownElevatorSwitch") + +# history +# +# version 4 big ole rewrite for new power sequence +# version 5 robustness enhanced + +# ############################################################# +# grsnPowerGearOn +# ############################################################# +class grsnPowerOn(ptResponder): + + # constants + + def __init__(self): + "construction" + PtDebugPrint("grsnPowerGearOn::init begin") + ptResponder.__init__(self) + self.id = 50119 + self.version = 5 + print "grsnPowerGearOn::init end, version ",self.version + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + initResponder.run(self.key,fastforward=true) + flashingLightsResponder.run(self.key,state='Off') + + + def OnServerInitComplete(self): + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + + ageSDL.setFlags(mainSwitchSDL.value,1,1) + ageSDL.sendToClients(mainSwitchSDL.value) + + ageSDL.setFlags(gearSwitchSDL.value,1,1) + ageSDL.sendToClients(gearSwitchSDL.value) + + ageSDL.setFlags(upElevSwitchSDL.value,1,1) + ageSDL.sendToClients(upElevSwitchSDL.value) + + ageSDL.setFlags(dnElevSwitchSDL.value,1,1) + ageSDL.sendToClients(dnElevSwitchSDL.value) + + + ageSDL.setFlags(gearBrake01SDL.value,1,1) + ageSDL.sendToClients(gearBrake01SDL.value) + + ageSDL.setFlags(gearBrake02SDL.value,1,1) + ageSDL.sendToClients(gearBrake02SDL.value) + + #start fresh for testing + #ageSDL[mainSwitchSDL.value] = (0,) + #ageSDL[gearSwitchSDL.value] = (0,) + #ageSDL[upElevSwitchSDL.value] = (0,) + #ageSDL[dnElevSwitchSDL.value] = (0,) + #ageSDL[gearBrake01SDL.value] = (1,) + #ageSDL[gearBrake02SDL.value] = (1,) + + initResponder.run(self.key,avatar=PtGetLocalAvatar(),fastforward=true) + + # get initial SDL state + gearOn = false + try: + gearOn = ageSDL[gearSwitchSDL.value][0] + print"server says gear on ",gearOn + except: + gearOn = false + print"failed to retrieve gear on state from server" + + upElevOn = false + try: + upElevOn = ageSDL[upElevSwitchSDL.value][0] + print"server says up elevator on ",upElevOn + except: + upElevOn = false + print"failed to retrieve elevator switch state from server" + + dnElevOn = false + try: + dnElevOn = ageSDL[dnElevSwitchSDL.value][0] + print"server says down elevator on ",dnElevOn + except: + dnElevOn = false + print"failed to retrieve elevator switch state from server" + + if (gearOn): + ageSDL[mainSwitchSDL.value] = (1,) + ageSDL[gearBrake01SDL.value] = (0,) + ageSDL[gearBrake02SDL.value] = (0,) + weightEngageDisabled = true + mainSwitchResp.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar(),fastforward=true) + gearSwitchResp.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar(),fastforward=true) + mainPowerOnResponder.run(self.key,avatar=PtGetLocalAvatar(),fastforward=true) + flashingLightsResponder.run(self.key,state='On',avatar=PtGetLocalAvatar(),fastforward=true) + switchGlowResponder.run(self.key,state='On',avatar=PtGetLocalAvatar(),fastforward=true) + gearGlowResponder.run(self.key,state='On',avatar=PtGetLocalAvatar(),fastforward=true) + gearRoomDoors.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar(),fastforward=true) + firstFloorDoors.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar(),fastforward=true) + secondFloorDoors.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar(),fastforward=true) + gearBrake01Resp.run(self.key,state='Unlock',avatar=PtGetLocalAvatar(),fastforward=true) + gearBrake02Resp.run(self.key,state='Unlock',avatar=PtGetLocalAvatar(),fastforward=true) + gearLoopSound.run(self.key,avatar=PtGetLocalAvatar()) + + if (upElevOn): + upElevSwitchResp.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar(),fastforward=true) + else: + upElevSwitchResp.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar(),fastforward=true) + + if (dnElevOn): + dnElevSwitchResp.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar(),fastforward=true) + else: + dnElevSwitchResp.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar(),fastforward=true) + + else: #main off + print"main off" + ageSDL[mainSwitchSDL.value] = (0,) + ageSDL[gearSwitchSDL.value] = (0,) + ageSDL[upElevSwitchSDL.value] = (0,) + ageSDL[dnElevSwitchSDL.value] = (0,) + ageSDL[gearBrake01SDL.value] = (1,) + ageSDL[gearBrake02SDL.value] = (1,) + mainSwitchResp.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar(),fastforward=true) + gearSwitchResp.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar(),fastforward=true) + flashingLightsResponder.run(self.key,state='Off',avatar=PtGetLocalAvatar(),fastforward=true) + switchGlowResponder.run(self.key,state='Off',avatar=PtGetLocalAvatar(),fastforward=true) + gearGlowResponder.run(self.key,state='Off',avatar=PtGetLocalAvatar(),fastforward=true) + gearBrake01Resp.run(self.key,state='AutoReturn',avatar=PtGetLocalAvatar(),fastforward=true) + gearBrake02Resp.run(self.key,state='AutoReturn',avatar=PtGetLocalAvatar(),fastforward=true) + gearRoomDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar(),fastforward=true) + firstFloorDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar(),fastforward=true) + secondFloorDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar(),fastforward=true) + + + + def DisableCamera(self): + PtAtTimeCallback(self.key,8.0,kCameraReturn) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + pass + + + def OnNotify(self,state,id,events): + global generatorPrimed + global scaleEngaged + global weightDirection + global weightNearUpEnd + global weightNearDownEnd + global weightSoundLoopingDown + global gearStopping + global gearStartingDown + global weightEngageDisabled + + if (state == 0): + return + + print"id ",id + ageSDL = PtGetAgeSDL() + + mainOn = false + try: + mainOn = ageSDL[mainSwitchSDL.value][0] + except: + mainOn = false + + gearOn = false + try: + gearOn = ageSDL[gearSwitchSDL.value][0] + except: + gearOn = false + + upElevOn = false + try: + upElevOn = ageSDL[upElevSwitchSDL.value][0] + except: + upElevOn = false + + dnElevOn = false + try: + dnElevOn = ageSDL[dnElevSwitchSDL.value][0] + except: + dnElevOn = false + + brake01On = false + try: + brake01On = ageSDL[gearBrake01SDL.value][0] + except: + brake01On = false + + brake02On = false + try: + brake02On = ageSDL[gearBrake02SDL.value][0] + except: + brake02On = false + + triggerer = PtFindAvatar(events) + + + if (id == weightTrigger.id): + scaleEngaged = true + print"weight activator" + if (gearOn): + print"gear on" + import xSndLogTracks + xSndLogTracks.LogTrack("15","27") + weightEngageDisabled = true + return + print"set weight forward" + reverser.run(self.key,state='Forward',avatar=triggerer) + weightControlResponder.run(self.key,state='High',avatar=triggerer) + weightDirection = kUp + if (weightNearDownEnd): + print"weight sound looping down" + weightStartSoundResp.run(self.key,state='Loop',avatar=triggerer) + weightNearDownEnd = false + weightSoundLoopingDown = true + + if (generatorPrimed == false): + generatorPrimed = true + flashingLightsResponder.run(self.key,state='Blink',avatar=PtGetLocalAvatar()) + print"generator primed" + if (mainOn): + switchGlowResponder.run(self.key,state='On',avatar=triggerer) + + if (id == weightUnTrigger.id and generatorPrimed): + if (weightEngageDisabled): + return + scaleEngaged = false + if (gearOn == false): + generatorPrimed = true + flashingLightsResponder.run(self.key,state='Blink',avatar=PtGetLocalAvatar()) + print"generator primed" + if (mainOn): + switchGlowResponder.run(self.key,state='On',avatar=triggerer) + print"set weight reverse" + reverser.run(self.key,state='Reverse',avatar=triggerer) + weightControlResponder.run(self.key,state='High',avatar=triggerer) + weightDirection = kDown + if (weightNearUpEnd): + weightStartSoundResp.run(self.key,state='Loop',avatar=triggerer) + weightNearUpEnd = false + return + + if (id == weightStartSoundTrigger.id): + if (weightDirection == kUp): + weightStartSoundResp.run(self.key,state='Start',avatar=triggerer) + weightSoundLoopingDown = true + elif (weightDirection == kDown): + if (weightSoundLoopingDown): + print"stop all at bottom" + weightSoundLoopingDown = false + weightStartSoundResp.run(self.key,state='StopAll',avatar=triggerer) + else: + print"let weight stop sound play out" + return + + if (id == weightStopSoundTrigger.id): + if (weightDirection == kUp): + weightStartSoundResp.run(self.key,state='Stop',avatar=triggerer) + weightNearUpEnd = true + elif(weightDirection == kDown): + weightNearUpEnd = false + return + + if (id == weightAtTopTrigger.id): + if (weightDirection == kDown): + weightStartSoundResp.run(self.key,state='Loop',avatar=triggerer) + weightNearUpEnd = false + elif(weightDirection == kUp): + weightStartSoundResp.run(self.key,state='StopAll',avatar=triggerer) + return + + if (id == weightStopDownSoundTrigger.id): + if (weightDirection == kDown): + weightStartSoundResp.run(self.key,state='Stop',avatar=triggerer) + weightNearDownEnd = true + print"weight near down end" + elif (weightDirection == kUp): + weightNearDownEnd = false + weightSoundLoopingDown = false + return + + #weightLevel=0 + #if (brake01On == false): + # weightLevel = weightLevel + 1 + #if (brake02On == false): + # weightLevel = weightLevel + 1 + #if (mainOn): + # weightLevel = weightLevel + 1 + #print"weight level ",weightLevel + #if (weightLevel == 0): + # weightControlResponder.run(self.key,state='High',avatar=triggerer) + #elif (weightLevel == 1): + # weightControlResponder.run(self.key,state='Medium',avatar=triggerer) + #elif (weightLevel == 2): + # weightControlResponder.run(self.key,state='Low',avatar=triggerer) + #else: + # weightControlResponder.run(self.key,state='Lowest',avatar=triggerer) + + + if (id == weightHighUp.id): +# or \ +# id == weightLowDown.id or \ +# id == weightMedDown.id or \ +# id == weightLowestDown.id): + print"weight down" + weightEngageDisabled = false + if (scaleEngaged): + return + generatorPrimed = false + if (gearOn): + return + flashingLightsResponder.run(self.key,state='Off',avatar=PtGetLocalAvatar()) + if (mainOn): + ageSDL[mainSwitchSDL.value] = (0,) + mainSwitchResp.run(self.key,state='PrimerExpired',avatar=triggerer) + switchGlowResponder.run(self.key,state='Off',avatar=triggerer) + if (brake01On == false): + gearBrake01Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake01SDL.value] = (1,) + if (brake02On == false): + gearBrake02Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake02SDL.value] = (1,) + return + + if (id == gearBrake01Resp.id): + #lock just finished unlocking, check to see that power didn't go off while it was in motion, + if (generatorPrimed == false): + gearBrake01Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake01SDL.value] = (1,) + + if (id == gearBrake02Resp.id): + #lock just finished unlocking, check to see that power didn't go off while it was in motion, + if (generatorPrimed == false): + gearBrake02Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake02SDL.value] = (1,) + + if (id == gearStopTrigger.id): + print"gear stop trigger" + if (gearStopping): + print"gear stop trigger: gear stopped, begin final descent" + gearStopping = false + if (gearStartingDown): + print"gear stop trigger: gear still in initial descent - do nothing" + else: + mainPowerOffResponder.run(self.key,state='GearDown',avatar=PtGetLocalAvatar()) + + if (id == mainPowerOffResponder.id): + if (gearStartingDown): + print"main power responder callback - gear finished initial descent" + #gear is finished moving partway down, okay to start second half + gearStartingDown = false + if (gearStopping == false): + print"main power responder callback - gear also stopped, begin final descent" + mainPowerOffResponder.run(self.key,state='GearDown',avatar=PtGetLocalAvatar()) + else: + print"main power responder callback - gear still turning, wait for it to stop" + return + if (gearStopping == false and gearStartingDown == false): + print"main power responder callback - reengage locks" + #gear is down, reengage the locks + if (generatorPrimed == false): + if (brake01On == false): + gearBrake01Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake01SDL.value] = (1,) + + if (brake02On == false): + gearBrake02Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake02SDL.value] = (1,) + + if (id == mainSwitchResp.id): + print"main switch callback" + if (mainOn): + print"main switch now on" + if (generatorPrimed): + switchGlowResponder.run(self.key,state='On',avatar=triggerer) + else: + print"main switch now off" + flashingLightsResponder.run(self.key,state='Off',avatar=PtGetLocalAvatar()) + if (upElevOn): + upElevSwitchResp.run(self.key,state='Break',avatar=triggerer) + ageSDL[upElevSwitchSDL.value]=(0,) + if(gearOn): + upElevGlowResponder.run(self.key,state='Off',avatar=triggerer) + + if (dnElevOn): + dnElevSwitchResp.run(self.key,state='Break',avatar=triggerer) + ageSDL[dnElevSwitchSDL.value]=(0,) + if(gearOn): + dnElevGlowResponder.run(self.key,state='Off',avatar=triggerer) + + if (gearOn): + gearSwitchResp.run(self.key,state='Break',avatar=triggerer) + gearGlowResponder.run(self.key,state='Off',avatar=triggerer) + switchGlowResponder.run(self.key,state='Off',avatar=triggerer) + mainPowerOffResponder.run(self.key,state='GearOff',avatar=triggerer) + gearStopping = true + gearStartingDown = true + ageSDL[gearSwitchSDL.value]=(0,) + + else: # gear not on, but locks may be... + if (brake01On == false): + if (gearStartingDown): + return + gearBrake01Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake01SDL.value] = (1,) + + if (brake02On == false): + if (gearStartingDown): + return + gearBrake02Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake02SDL.value] = (1,) + + mainBreakerResponder.run(self.key,avatar=triggerer) + + + if (id == mainSwitch.id): + print"main switch" + if (mainOn): + print"main going off" + ageSDL[mainSwitchSDL.value] = (0,) + if (gearOn): + gearRoomDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + firstFloorDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + secondFloorDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + mainSwitchResp.run(self.key,state='Break',avatar=triggerer) + self.DisableCamera() + print"break main switch" + else: + mainSwitchResp.run(self.key,state='TurnOff',avatar=triggerer) + print"turn off main switch" + if (generatorPrimed): + switchGlowResponder.run(self.key,state='Off',avatar=triggerer) + + else: + print"main going on" + if (generatorPrimed): + ageSDL[mainSwitchSDL.value] = (1,) + mainSwitchResp.run(self.key,state='TurnOn',avatar=triggerer) + else: #generator not primed, just trip + mainSwitchResp.run(self.key,state='Trip',avatar=triggerer) + + return + + if (id == gearSwitchResp.id): + print"gear switch callback" + if (gearOn): + print"gear switch now on" + mainPowerOnResponder.run(self.key,avatar=triggerer) + flashingLightsResponder.run(self.key,state='On',avatar=triggerer) + gearGlowResponder.run(self.key,state='On',avatar=triggerer) + if (generatorPrimed == false): + #lights went out while firing up + switchGlowResponder.run(self.key,state='On',avatar=triggerer) + else: + print"gear switch now off" + mainPowerOffResponder.run(self.key,state='GearOff',avatar=triggerer) + gearStopping = true + gearStartingDown=true + flashingLightsResponder.run(self.key,state='Off',avatar=triggerer) + if (mainOn): + switchGlowResponder.run(self.key,state='Off',avatar=triggerer) + gearGlowResponder.run(self.key,state='Off',avatar=triggerer) + ageSDL[mainSwitchSDL.value] = (0,) + mainSwitchResp.run(self.key,state='PrimerExpired',avatar=triggerer) + + if (upElevOn): + upElevSwitchResp.run(self.key,state='Break',avatar=triggerer) + ageSDL[upElevSwitchSDL.value]=(0,) + upElevGlowResponder.run(self.key,state='Off',avatar=triggerer) + + if (dnElevOn): + dnElevSwitchResp.run(self.key,state='Break',avatar=triggerer) + ageSDL[dnElevSwitchSDL.value]=(0,) + dnElevGlowResponder.run(self.key,state='Off',avatar=triggerer) + + + if (id == gearSwitch.id): + if (mainOn): + if (gearOn): + self.DisableCamera() + ageSDL[gearSwitchSDL.value] = (0,) + gearSwitchResp.run(self.key,state='TurnOff',avatar=triggerer) + gearRoomDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + firstFloorDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + secondFloorDoors.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + + else: + if (generatorPrimed and brake01On == false and brake02On == false): + self.DisableCamera() + ageSDL[gearSwitchSDL.value] = (1,) + weightEngageDisabled = true + gearSwitchResp.run(self.key,state='TurnOn',avatar=triggerer) + gearRoomDoors.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar()) + firstFloorDoors.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar()) + secondFloorDoors.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar()) + ageSDL[dnElevSwitchSDL.value] = (0,) + ageSDL[upElevSwitchSDL.value] = (0,) + else: + gearSwitchResp.run(self.key,state='TripEngaged',avatar=triggerer) + else: # main off + gearSwitchResp.run(self.key,state='Trip',avatar=triggerer) + return + + if (id == dnElevSwitch.id): + dnElevSwitch.disable() + + cbTime = 6 + if (mainOn): + if (gearOn): + elevOn = ageSDL[dnElevSwitchSDL.value][0] + if (elevOn): + ageSDL[dnElevSwitchSDL.value] = (0,) + dnElevSwitchResp.run(self.key,state='TurnOff',avatar=triggerer) + else: + ageSDL[dnElevSwitchSDL.value] = (1,) + dnElevSwitchResp.run(self.key,state='TurnOn',avatar=triggerer) + cbTime = 8 + else: #main on, gear off + dnElevSwitchResp.run(self.key,state='TripEngaged',avatar=triggerer) + else: # main off + dnElevSwitchResp.run(self.key,state='Trip',avatar=triggerer) + + PtAtTimeCallback(self.key, cbTime, TimerID.DownElevatorSwitch) + return + + if (id == upElevSwitch.id): + upElevSwitch.disable() + + cbTime = 6 + if (mainOn): + if (gearOn): + elevOn = ageSDL[upElevSwitchSDL.value][0] + if (elevOn): + ageSDL[upElevSwitchSDL.value] = (0,) + upElevSwitchResp.run(self.key,state='TurnOff',avatar=triggerer) + else: + ageSDL[upElevSwitchSDL.value] = (1,) + upElevSwitchResp.run(self.key,state='TurnOn',avatar=triggerer) + cbTime = 8 + else:#main on, gear off + upElevSwitchResp.run(self.key,state='TripEngaged',avatar=triggerer) + else: # main off + upElevSwitchResp.run(self.key,state='Trip',avatar=triggerer) + + PtAtTimeCallback(self.key, cbTime, TimerID.UpElevatorSwitch) + return + + if (id == gearBrake01.id): + print"brake01" + if (gearOn): + gearBrake01Resp.run(self.key,state='Trip',avatar=triggerer) + return + elif (mainOn == false): + print"main off" + gearBrake01Resp.run(self.key,state='Trip',avatar=triggerer) + else: #main on + print"main on" + if (generatorPrimed): + if (brake01On): + print"unlock" + gearBrake01Resp.run(self.key,state='Unlock',avatar=triggerer) + ageSDL[gearBrake01SDL.value]=(0,) + else: + print"lock" + gearBrake01Resp.run(self.key,state='Lock',avatar=triggerer) + ageSDL[gearBrake01SDL.value]=(1,) + else: #generator not primed + print"trip" + gearBrake01Resp.run(self.key,state='Trip',avatar=triggerer) + return + + if (id == gearBrake02.id): + print"brake02" + if (gearOn): + gearBrake02Resp.run(self.key,state='Trip',avatar=triggerer) + return + elif (mainOn == false): + print"main off" + gearBrake02Resp.run(self.key,state='Trip',avatar=triggerer) + else: #main on + print"main on" + if (generatorPrimed): + if (brake02On): + print"unlock" + gearBrake02Resp.run(self.key,state='Unlock',avatar=triggerer) + ageSDL[gearBrake02SDL.value]=(0,) + else: + print"lock" + gearBrake02Resp.run(self.key,state='Lock',avatar=triggerer) + ageSDL[gearBrake02SDL.value]=(1,) + else: #generator not primed + print"trip" + gearBrake02Resp.run(self.key,state='Trip',avatar=triggerer) + return + + def OnTimer(self, id): + if id == TimerID.UpElevatorSwitch: + upElevSwitch.enable() + elif id == TimerID.DownElevatorSwitch: + dnElevSwitch.enable() + elif id == kCameraReturn: + cam = ptCamera() + cam.enableFirstPersonOverride() + diff --git a/Python/grsnPrisonRandomSDLItems.py b/Python/grsnPrisonRandomSDLItems.py new file mode 100644 index 0000000000..68503e1422 --- /dev/null +++ b/Python/grsnPrisonRandomSDLItems.py @@ -0,0 +1,165 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: grsnPrisonRandomItems +Age: Garrison Prison +Date: February 2002 +Randomizes contents of the Garrison Prison Cell +""" + +from Plasma import * +from PlasmaTypes import * +import whrandom + +#globals +kMinNumItems = 1 +kMaxNumItems = 10 +kChanceOfYP = 0.5 # 0.0 = no chance. 1.0 = 100% chance + +AllItems = [ + "grsnPrisonBones01vis", + "grsnPrisonBones02vis", + "grsnPrisonBowls01vis", + "grsnPrisonBowls02vis", + "grsnPrisonBowls03vis", + "grsnPrisonBowls04vis", + "grsnPrisonBowls05vis", + "grsnPrisonChains01vis", + "grsnPrisonChains02vis", + "grsnPrisonDirt01vis", + "grsnPrisonDirt02vis", + "grsnPrisonMattress01vis", + "grsnPrisonMattress02vis", + "grsnPrisonWindow01vis", + "grsnPrisonWindow02vis" + ] + + +class grsnPrisonRandomSDLItems(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5205 + + version = 2 + self.version = version + print "__init__grsnPrisonRandomItems v.", version + + def OnServerInitComplete(self): + global AllItems + + return + + ageSDL = PtGetAgeSDL() + + # pick items to display + whrandom.seed() + + ItemsToPick = whrandom.randint(kMinNumItems, kMaxNumItems) + AlreadyPicked = [ ] + + while len(AlreadyPicked) < ItemsToPick: + randitem = whrandom.choice(AllItems) + if randitem not in AlreadyPicked: + AlreadyPicked.append (randitem) + + for item in AlreadyPicked: + if (item == "grsnPrisonBones01vis"): + ageSDL["grsnPrisonBones01vis"]=(1,) + + if (item == "grsnPrisonBones02vis"): + ageSDL["grsnPrisonBones02vis"]=(1,) + + if (item == "grsnPrisonBowls01vis"): + ageSDL["grsnPrisonBowls01vis"]=(1,) + + if (item == "grsnPrisonBowls02vis"): + ageSDL["grsnPrisonBowls02vis"]=(1,) + + if (item == "grsnPrisonBowls03vis"): + ageSDL["grsnPrisonBowls03vis"]=(1,) + + if (item == "grsnPrisonBowls04vis"): + ageSDL["grsnPrisonBowls04vis"]=(1,) + + if (item == "grsnPrisonBowls05vis"): + ageSDL["grsnPrisonBowls05vis"]=(1,) + + if (item == "grsnPrisonChains01vis"): + ageSDL["grsnPrisonChains01vis"]=(1,) + + if (item == "grsnPrisonChains02vis"): + ageSDL["grsnPrisonChains02vis"]=(1,) + + if (item == "grsnPrisonDirt01vis"): + ageSDL["grsnPrisonDirt01vis"]=(1,) + + if (item == "grsnPrisonDirt02vis"): + ageSDL["grsnPrisonDirt02vis"]=(1,) + + if (item == "grsnPrisonMattress01vis"): + ageSDL["grsnPrisonMattress01vis"]=(1,) + + if (item == "grsnPrisonMattress02vis"): + ageSDL["grsnPrisonMattress02vis"]=(1,) + + if (item == "grsnPrisonWindow01vis"): + ageSDL["grsnPrisonWindow01vis"]=(1,) + + if (item == "grsnPrisonWindow02vis"): + ageSDL["grsnPrisonWindow02vis"]=(1,) + + self.IManageYeeshaPage() + + def IManageYeeshaPage(self): + vault = ptVault() + + + if type(vault) != type(None): #is the Vault online? + entry = vault.findChronicleEntry("VisitedGrsnPrison") + + if type(entry) == type(None): + vault.addChronicleEntry("VisitedGrsnPrison",1,"yes") + PtDebugPrint ("grsnPrisonRandomItems: This is your first visit to the Prison. Updated Chronicle.") + + else: + PtDebugPrint ("grsnPrisonRandomItems: You've been to the Prison before.") + + chance = whrandom.random() + ageSDL = PtGetAgeSDL() + if chance > (1-kChanceOfYP): + ageSDL["grsnYeeshaPage02Vis"] = (1,) + PtDebugPrint ("grsnPrisonRandomItems: A YP is here.") + else: + ageSDL["grsnYeeshaPage02Vis"] = (0,) + PtDebugPrint ("grsnPrisonRandomItems: A YP is NOT here.") + + ageSDL.sendToClients("grsnYeeshaPage02Vis") + + else: + PtDebugPrint("grsnPrisonRandomItems: Error trying to access the Chronicle." ) + + diff --git a/Python/grsnTrnCtrBridgeSafety.py b/Python/grsnTrnCtrBridgeSafety.py new file mode 100644 index 0000000000..6def9e0a14 --- /dev/null +++ b/Python/grsnTrnCtrBridgeSafety.py @@ -0,0 +1,72 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: GarrisonTrnCtrExtTrans.py +Age: GarrisonTrnCtrExtTrans +Date: October 2002 +event manager hooks for the GarrisonTrnCtrExtTrans +""" + +from Plasma import * +from PlasmaTypes import * + +arrivePt = ptAttribSceneobject(1,"warp point") +triggerRgn1 = ptAttribActivator(2,"upper box") +triggerRgn2 = ptAttribActivator(3,"lower box") + +inRegion1 = false + + +class grsnTrnCtrBridgeSafety(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 3278 + self.version = 1 + + def OnNotify(self,state,id,events): + global inRegion1 + + local = PtGetLocalAvatar() + avatar = PtFindAvatar(events) + if (avatar != local): + return + + if (id == triggerRgn1.id): + for event in events: + if (event[0]==1): + print "in region 1 ",event[1] + inRegion1 = event[1] + return + + if (id == triggerRgn2.id): + if (inRegion1): + for event in events: + if (event[0]==1 and event[1]==1): + print"in both regions - warp up" + PtGetLocalAvatar().physics.warpObj(arrivePt.value.getKey()) + return + \ No newline at end of file diff --git a/Python/grsnTrnCtrDoorEnter.py b/Python/grsnTrnCtrDoorEnter.py new file mode 100644 index 0000000000..c2e71ae867 --- /dev/null +++ b/Python/grsnTrnCtrDoorEnter.py @@ -0,0 +1,144 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + +arrivePt = ptAttribSceneobject(1,"arrive point") +triggerRgn1 = ptAttribActivator(2,"door 1 region sensor") +triggerRgn2 = ptAttribNamedActivator(3,"door 2 region sensor") +door1OpenResponder = ptAttribResponder(4,"door 1 open responder",netForce=1) +door1CloseResponder = ptAttribResponder(5,"door 1 close responder",netForce=1) +door2OpenResponder = ptAttribNamedResponder(6,"door 2 open responder",netForce=1) +door2CloseResponder = ptAttribNamedResponder(7,"door 2 close responder",netForce=1) +behaviorWalkIn = ptAttribBehavior(8,"walk in behavior",netForce=1) +behaviorWalkOut = ptAttribBehavior(9,"walk out behavior",netForce=1) +subWorld = ptAttribSceneobject(10,"subworld") +camera = ptAttribSceneobject(11,"exit camera") + +avatarEntering = 0 + +class grsnTrnCtrDoorEnter(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 3276 + self.version = 1 + PtDebugPrint("grsnTrnCtrDoorEnter: Max version %d - minor version %d" % (self.version,2)) + + def OnNotify(self,state,id,events): + global avatarEntering + + if (id == triggerRgn1.id): + if (PtFindAvatar(events) != PtGetLocalAvatar()): + return + print" must have ki" + kiLevel = PtGetLocalKILevel() + if (kiLevel < 2): + return + for event in events: + if (event[0]==1 and event[1]==1): + avatarEntering = PtFindAvatar(events) + print"entered the region, disable this one and the other door's triggers" + triggerRgn1.disable() + triggerRgn2.disable() + if (avatarEntering == PtGetLocalAvatar()): + print"stop this avatar" + PtDisableMovementKeys() + print"take away first person" + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + print"open the door" + door1OpenResponder.run(self.key,avatar=avatarEntering) + return + + if (id == door1OpenResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + + print" door is open, walk in" + avatarEntering.avatar.runBehaviorSetNotify(behaviorWalkIn.value,self.key,behaviorWalkIn.netForce) + return + + if (id == behaviorWalkIn.id): + if (avatarEntering != PtGetLocalAvatar()): + return + + for event in events: + if event[0] == kMultiStageEvent and event[2] == kAdvanceNextStage: + print" Smart seek completed. Exit multistage, close exterior door" + behaviorWalkIn.gotoStage(avatarEntering,-1) + door1CloseResponder.run(self.key,avatar=avatarEntering) + return + + if (id == door1CloseResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + + print"door closed, teleport and open other door" + if (avatarEntering == PtGetLocalAvatar()): + camera.value.pushCameraCut(avatarEntering.getKey()) + avatarEntering.avatar.exitSubWorld() + avatarEntering.physics.warpObj(arrivePt.value.getKey()) + door2OpenResponder.run(self.key,avatar=avatarEntering) + return + + if (id == door2OpenResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + + print"interior door open, walk out" + avatarEntering.avatar.runBehaviorSetNotify(behaviorWalkOut.value,self.key,behaviorWalkOut.netForce) + return + + if (id == behaviorWalkOut.id): + if (avatarEntering != PtGetLocalAvatar()): + return + + for event in events: + if event[0] == kMultiStageEvent and event[2] == kAdvanceNextStage: + print" Smart seek completed. Exit multistage, close interior door" + door2CloseResponder.run(self.key,avatar=avatarEntering) + behaviorWalkOut.gotoStage(avatarEntering,-1) + return + + if (id == door2CloseResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + + print" process complete, re-enable detectors and free avatar " + triggerRgn1.enable() + triggerRgn2.enable() + if (avatarEntering == PtGetLocalAvatar()): + PtEnableMovementKeys() + cam = ptCamera() + cam.enableFirstPersonOverride() + PtSendKIMessage(kEnableEntireYeeshaBook,0) + avatarEntering = 0 + diff --git a/Python/grsnTrnCtrDoorExit.py b/Python/grsnTrnCtrDoorExit.py new file mode 100644 index 0000000000..e6c9199800 --- /dev/null +++ b/Python/grsnTrnCtrDoorExit.py @@ -0,0 +1,144 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: GarrisonTrnCtrExtTrans.py +Age: GarrisonTrnCtrExtTrans +Date: October 2002 +event manager hooks for the GarrisonTrnCtrExtTrans +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + + +arrivePt = ptAttribSceneobject(1,"arrive point") +triggerRgn1 = ptAttribNamedActivator(2,"door 1 region sensor") +triggerRgn2 = ptAttribActivator(3,"door 2 region sensor") +door1OpenResponder = ptAttribNamedResponder(4,"door 1 open responder",netForce=1) +door1CloseResponder = ptAttribNamedResponder(5,"door 1 close responder",netForce=1) +door2OpenResponder = ptAttribResponder(6,"door 2 open responder",netForce=1) +door2CloseResponder = ptAttribResponder(7,"door 2 close responder",netForce=1) +behaviorWalkIn = ptAttribBehavior(8,"walk in behavior",netForce=1) +behaviorWalkOut = ptAttribBehavior(9,"walk out behavior",netForce=1) +subWorld = ptAttribSceneobject(10,"subworld") +startCamera = ptAttribSceneobject(11,"enter door camera") +endCamera = ptAttribSceneobject(12,"exit door camera") + +avatarEntering = 0 +class grsnTrnCtrDoorExit(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 3277 + self.version = 1 + PtDebugPrint("grsnTrnCtrDoorExit: Max version %d - minor version %d" % (self.version,2)) + + def OnNotify(self,state,id,events): + global avatarEntering + + if (id == triggerRgn1.id): + if (PtFindAvatar(events) != PtGetLocalAvatar()): + return + print" must have ki" + kiLevel = PtGetLocalKILevel() + if (kiLevel < 2): + return + for event in events: + if (event[0]==1 and event[1]==1): + avatarEntering = PtFindAvatar(events) + print"entered the region, disable this one and the other door's triggers" + triggerRgn1.disable() + triggerRgn2.disable() + print"stop this avatar" + PtDisableMovementKeys() + print"take away first person" + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + print"open the door" + door1OpenResponder.run(self.key,avatar=PtGetLocalAvatar()) + print"switch to the initial camera" + startCamera.value.pushCameraCut(PtGetLocalAvatar().getKey()) + return + + if (id == door1OpenResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + print" door is open, walk in" + PtGetLocalAvatar().avatar.runBehaviorSetNotify(behaviorWalkIn.value,self.key,behaviorWalkIn.netForce) + return + + if (id == behaviorWalkIn.id): + if (avatarEntering != PtGetLocalAvatar()): + return + for event in events: + if event[0] == kMultiStageEvent and event[2] == kAdvanceNextStage: + print" Smart seek completed. Exit multistage, close exterior door" + behaviorWalkIn.gotoStage(PtGetLocalAvatar(),-1) + door1CloseResponder.run(self.key,avatar=PtGetLocalAvatar()) + return + + if (id == door1CloseResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + print"door closed, teleport and open other door" + endCamera.value.pushCameraCut(PtGetLocalAvatar().getKey()) + PtGetLocalAvatar().avatar.enterSubWorld(subWorld.value) + PtGetLocalAvatar().physics.warpObj(arrivePt.value.getKey()) + door2OpenResponder.run(self.key,avatar=PtGetLocalAvatar()) + return + + if (id == door2OpenResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + print"interior door open, walk out" + PtGetLocalAvatar().avatar.runBehaviorSetNotify(behaviorWalkOut.value,self.key,behaviorWalkOut.netForce) + return + + if (id == behaviorWalkOut.id): + if (avatarEntering != PtGetLocalAvatar()): + return + for event in events: + if event[0] == kMultiStageEvent and event[2] == kAdvanceNextStage: + print" Smart seek completed. Exit multistage, close interior door" + door2CloseResponder.run(self.key,avatar=PtGetLocalAvatar()) + behaviorWalkOut.gotoStage(PtGetLocalAvatar(),-1) + return + + if (id == door2CloseResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + print" process complete, re-enable detectors and free avatar " + triggerRgn1.enable() + triggerRgn2.enable() + PtEnableMovementKeys() + cam = ptCamera() + cam.enableFirstPersonOverride() + PtSendKIMessage(kEnableEntireYeeshaBook,0) + avatarEntering = 0 + diff --git a/Python/grsnTrnCtrDoors.py b/Python/grsnTrnCtrDoors.py new file mode 100644 index 0000000000..d8a1ed9c08 --- /dev/null +++ b/Python/grsnTrnCtrDoors.py @@ -0,0 +1,288 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: grsnTrnCtrDoors.py +Age: grsnTrnCtrDoors +Date: March 2007 +event manager hooks for the grsnTrnCtrDoors +Karl +""" + +from Plasma import * +from PlasmaTypes import * + + +triggerRgn = ptAttribActivator(1, "region sensor") +doorOpenResponder = ptAttribResponder(2, "door open responder", netForce=0) +doorCloseResponder = ptAttribResponder(3, "door close responder", netForce=0) +doorKiNeededBool = ptAttribBoolean(4,"Require Ki?", 0) + +doorSDLstates = {'closed':0,'opening':1,'open':2,'closing':3,'opentoclose':4,'closetoopen':5,'movingopen':6,'movingclosed':7} + +class grsnTrnCtrDoors(ptResponder): + ########################################## + def __init__(self): + ptResponder.__init__(self) + self.id = 509823 + self.version = 3 + + self.grsnPrevDoorState = 0 + self.grsnDoorState = 0 + self.grsnDoorStack = [] + self.init = 0 + + ########################################## + def OnServerInitComplete(self): + + self.SDL.sendToClients('grsnDoorState') + + + + try: + self.grsnDoorState = self.SDL['grsnDoorState'][0] + except: + self.SDL['grsnDoorState'] = (0,) + self.grsnDoorState = self.SDL['grsnDoorState'][0] + + print "grsnTrnCtrDoors: self.SDL = %d" % self.grsnDoorState + print "grsnTrnCtrDoors: Player List = %d" % len(PtGetPlayerList()) + + if len(PtGetPlayerList()) > 0: + + print "grsnTrnCtrDoors: Somebody is already in the age. Attempting to sync states." + + if self.grsnDoorState == doorSDLstates['open'] or self.grsnDoorState == doorSDLstates['opening']: + doorOpenResponder.run(self.key,fastforward=1) + print "grsnTrnCtrDoors: Door is open." + print "grsnTrnCtrDoors: Door State = %d" % self.grsnDoorState + + elif self.grsnDoorState == doorSDLstates['closing']: + doorCloseResponder.run(self.key,fastforward=1) + print "grsnTrnCtrDoors: Door is closed." + print "grsnTrnCtrDoors: Door State = %d" % self.grsnDoorState + + else: + print "grsnTrnCtrDoors: Exception. Door State = %d" % self.grsnDoorState + + elif len(PtGetPlayerList()) < 1: + # the door is really shut, someone left it open + self.SDL['grsnDoorState'] = (doorSDLstates['closed'],) + self.grsnDoorState = self.SDL['grsnDoorState'][0] + print "grsnTrnCtrDoors: Nobody is here, setting door states to closed." + + self.init = 1 + ########################################## + def OnNotify(self,state,id,events): + if not self.init: + return + + ageSDL = PtGetAgeSDL() + #Notify Section + if id == (-1): + print "grsnTrnCtrDoors: Recieved Notify... Contents Are %s" % str(events[0][1]) + if events[0][1].find('rgnTriggerEnter') != -1 and self.sceneobject.isLocallyOwned(): + if self.grsnDoorState == doorSDLstates['closed']: + self.UpdateDoorState(doorSDLstates['opening']) + print "grsnTrnCtrDoors: I triggered the region and I'm changing the sdl to opening." + + elif self.grsnDoorState == doorSDLstates['movingclosed'] or self.grsnDoorState == doorSDLstates['closing']: + self.UpdateDoorState(doorSDLstates['closetoopen']) + print "grsnTrnCtrDoors: I triggered the region and I'm changing the sdl to closetoopen." + + elif self.grsnDoorState == doorSDLstates['opentoclose']: + self.UpdateDoorState(doorSDLstates['movingopen']) + print "grsnTrnCtrDoors: I triggered the region and I'm changing the sdl to movingopen." + + elif events[0][1].find('rgnTriggerExit') != -1 and self.sceneobject.isLocallyOwned(): + if self.grsnDoorState == doorSDLstates['open']: + self.UpdateDoorState(doorSDLstates['closing']) + print "grsnTrnCtrDoors: I triggered the region and I'm changing the sdl to closing." + + elif self.grsnDoorState == doorSDLstates['movingopen'] or self.grsnDoorState == doorSDLstates['opening']: + self.UpdateDoorState(doorSDLstates['opentoclose']) + print "grsnTrnCtrDoors: I triggered the region and I'm changing the sdl to opentoclose." + + elif self.grsnDoorState == doorSDLstates['closetoopen']: + self.UpdateDoorState(doorSDLstates['movingclosed']) + print "grsnTrnCtrDoors: I triggered the region and I'm changing the sdl to movingclosed." + + + elif events[0][1].find('Responder') != -1 and events[0][1].find('rgnTriggerEnter') == -1 and events[0][1].find('rgnTriggerExit') == -1: + self.grsnDoorStack.append(events[0][1]) + print "grsnTrnCtrDoors: New list is: %s" % (str(self.grsnDoorStack)) + + if len(self.grsnDoorStack) == 1: + print "grsnTrnCtrDoors: List is only one command long, so I'm playing it" + code = self.grsnDoorStack[0] + print "grsnTrnCtrDoors: Playing command: %s" % (code) + exec code + + ############################################################################################################ + elif events[0][1].find('DoorState') != 1 and events[0][1].find('rgnTriggerEnter') == -1 and events[0][1].find('rgnTriggerExit') == -1 and events[0][1].find('Responder') == -1: + + curState = int(events[0][1].lstrip('DoorState=')) + print "grsnTrnCtrDoors: Door State Updated to %d" % curState + print "grsnTrnCtrDoors: Door State SDL Set to %d" % self.SDL['grsnDoorState'][0] + + if curState == doorSDLstates['closed']: + print "grsnTrnCtrDoors: Door is closed and nobody is in the region." + self.grsnDoorState = doorSDLstates['closed'] + print "grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState + + elif curState == doorSDLstates['opening']: + + print "grsnTrnCtrDoors: Someone entered the region with a KI. Opening up the door." + + self.grsnDoorState = doorSDLstates['opening'] + print "grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState + + if self.sceneobject.isLocallyOwned(): + self.SendNote("doorOpenResponder.run(self.key,netPropagate=0)") + + elif curState == doorSDLstates['open']: + self.grsnDoorState = doorSDLstates['open'] + print "grsnTrnCtrDoors: Door is open and region is still occupied." + print "grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState + + elif curState == doorSDLstates['closing']: + + print "grsnTrnCtrDoors: Door is now going to close." + + self.grsnDoorState = doorSDLstates['closing'] + print "grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState + + if self.sceneobject.isLocallyOwned(): + self.SendNote("doorCloseResponder.run(self.key,netPropagate=0)") + + elif curState == doorSDLstates['opentoclose']: + self.grsnDoorState = doorSDLstates['opentoclose'] + print "grsnTrnCtrDoors: Everyone exited the region while the door was opening." + print "grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState + + elif curState == doorSDLstates['closetoopen']: + self.grsnDoorState = doorSDLstates['closetoopen'] + print "grsnTrnCtrDoors: Someone with a good KI entered the region while the door was closing." + print "grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState + + elif curState == doorSDLstates['movingopen']: + self.grsnDoorState = doorSDLstates['movingopen'] + print "grsnTrnCtrDoors: Going back to staying open." + print "grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState + + elif curState == doorSDLstates['movingclosed']: + self.grsnDoorState = doorSDLstates['movingclosed'] + print "grsnTrnCtrDoors: Going back to staying closed." + print "grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState + + + ##################################################################################### + + + elif id == triggerRgn.id: + #Region Triggered + for event in events: + #true when you enter the region + + if event[0] == 1 and event[1] == 1 and PtFindAvatar(events) == PtGetLocalAvatar(): + if doorKiNeededBool.value == 0: + self.SendNote("rgnTriggerEnter") + return + + elif doorKiNeededBool.value == 1: + + if self.grsnDoorState == doorSDLstates['opentoclose']: + self.SendNote("rgnTriggerEnter") + return + + print "grsnTrnCtrDoors: I triggered the region" + + if PtGetLocalKILevel() < 2: + print "grsnTrnCtrDoors: KiLevel too low, cannot open door" + return + else: + self.SendNote("rgnTriggerEnter") + + + #true when you leave the region + elif event[0] == 1 and event[1] == 0 and self.sceneobject.isLocallyOwned(): + + self.SendNote("rgnTriggerExit") + + + elif id == doorOpenResponder.id: + + self.UpdateRespStack() + + print "grsnTrnCtrDoors: Door is now open." + if self.sceneobject.isLocallyOwned(): + if self.grsnDoorState == doorSDLstates['opentoclose']: + self.UpdateDoorState(doorSDLstates['closing']) + + elif self.grsnDoorState == doorSDLstates['movingopen'] or self.grsnDoorState == doorSDLstates['opening']: + self.UpdateDoorState(doorSDLstates['open']) + + elif id == doorCloseResponder.id: + + self.UpdateRespStack() + + print "grsnTrnCtrDoors: Door is now closed." + if self.sceneobject.isLocallyOwned(): + if self.grsnDoorState == doorSDLstates['closetoopen']: + self.UpdateDoorState(doorSDLstates['opening']) + + elif self.grsnDoorState == doorSDLstates['movingclosed'] or self.grsnDoorState == doorSDLstates['closing']: + self.UpdateDoorState(doorSDLstates['closed']) + + else: + print "grsnTrnCtrDoors: Events that came through:\t", events +############################################################### + def SendNote(self, ExtraInfo): + #Thanks Derek + notify = ptNotify(self.key) + + notify.clearReceivers() + notify.addReceiver(self.key) + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + + notify.addVarNumber(str(ExtraInfo),1.0) + notify.send() + + ########################################## + def UpdateRespStack (self): + #Updates the Responder List + old = self.grsnDoorStack.pop(0) + print "grsnTrnCtrDoors: Getting rid of Resp: %s" % (old) + if len(self.grsnDoorStack): + print "grsnTrnCtrDoors: There's at lest one more Resp to play." + code = self.grsnDoorStack[0] + print "Playing command: %s" % (code) + exec code + + def UpdateDoorState (self, StateNum): + self.SDL['grsnDoorState'] = (StateNum,) + self.SendNote('DoorState='+str(StateNum)) \ No newline at end of file diff --git a/Python/grsnWallImagerDisplayN.py b/Python/grsnWallImagerDisplayN.py new file mode 100644 index 0000000000..754c413acc --- /dev/null +++ b/Python/grsnWallImagerDisplayN.py @@ -0,0 +1,130 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +# for save/load +import cPickle + +## COMMENTED OUT by Jeff due to the re-write in the garrison wall + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## +northWall = ptAttribSceneobjectList(1,"North Wall",byObject=1) +############################################################## +# grsnWallImagerDisplayN +############################################################## +ReceiveInit = false + +## for team light responders +kTeamLightsOn = 0 +kTeamLightsOff = 1 + +## game states + +kWaiting = 0 +kNorthSit = 1 +kSouthSit = 2 +kNorthSelect = 3 +kSouthSelect = 4 +kNorthReady = 5 +kSouthReady = 6 +kNorthPlayerEntry = 7 +kSouthPlayerEntry = 8 +kGameInProgress = 9 +kNorthWin = 10 +kSouthWin = 11 +kSouthQuit = 12 +kNorthQuit = 13 + + +class grsnWallImagerDisplayN(ptResponder): + + # constants + + def __init__(self): + "construction" + PtDebugPrint("grsnWallImagerDisplayN::init begin") + ptResponder.__init__(self) + self.id = 52398 + self.version = 1 + PtDebugPrint("grsnWallImagerDisplayN::init end") +""" + def OnServerInitComplete(self): + global ReceiveInit + + PtDebugPrint("grsnWallPython::OnServerInitComplete") + solo = true + if len(PtGetPlayerList()): + solo = false + ReceiveInit = true + return + else: + print"solo in climbing wall" + + + def OnClimbingWallInit(self,type,state,value): + global ReceiveInit + + print"grsnClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value + if (ReceiveInit == false): + print"failed to receive init" + return + if (type == ptClimbingWallMsgType.kEndGameState): + ReceiveInit = false + print "finished receiving total game state" + + if (type == ptClimbingWallMsgType.kTotalGameState): + print "begin receiving total game state" + + elif (type == ptClimbingWallMsgType.kAddBlocker and state > 0 and value): + northWall.value[state].runAttachedResponder(kTeamLightsOn) + + def OnClimbingWallEvent(self,type,state,value): + + if (type == ptClimbingWallMsgType.kAddBlocker and value == true): #display wall settings + northWall.value[state].runAttachedResponder(kTeamLightsOn) + print"Imager display N drawing n wall index",state + + elif (type == ptClimbingWallMsgType.kRemoveBlocker and value == true): + northWall.value[state].runAttachedResponder(kTeamLightsOff) + print"Imager display N clearing n wall index",state + + elif (type == ptClimbingWallMsgType.kNewState): + if (state == ptClimbingWallMsgState.kSouthSit or state == ptClimbingWallMsgState.kNorthSit ): + #clear wall settings + i = 0 + while (i < 171): + northWall.value[i].runAttachedResponder(kTeamLightsOff) + i = i + 1 +""" + + + + + diff --git a/Python/grsnWallImagerDisplayS.py b/Python/grsnWallImagerDisplayS.py new file mode 100644 index 0000000000..ca124fa42c --- /dev/null +++ b/Python/grsnWallImagerDisplayS.py @@ -0,0 +1,126 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +# for save/load +import cPickle + +## COMMENTED OUT by Jeff due to the re-write in the garrison wall + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## +southWall = ptAttribSceneobjectList(2,"South Wall",byObject=1) +############################################################## +# grsnWallImagerDisplayS +############################################################## + +ReceiveInit = false + +## for team light responders +kTeamLightsOn = 0 +kTeamLightsOff = 1 + +## game states + +kWaiting = 0 +kNorthSit = 1 +kSouthSit = 2 +kNorthSelect = 3 +kSouthSelect = 4 +kNorthReady = 5 +kSouthReady = 6 +kNorthPlayerEntry = 7 +kSouthPlayerEntry = 8 +kGameInProgress = 9 +kNorthWin = 10 +kSouthWin = 11 +kSouthQuit = 12 +kNorthQuit = 13 + + +class grsnWallImagerDisplayS(ptResponder): + + # constants + + def __init__(self): + "construction" + PtDebugPrint("grsnWallImagerDisplayS::init begin") + ptResponder.__init__(self) + self.id = 52397 + self.version = 1 + PtDebugPrint("grsnWallImagerDisplayS::init end") +""" + def OnServerInitComplete(self): + global ReceiveInit + + PtDebugPrint("grsnWallPython::OnServerInitComplete") + solo = true + if len(PtGetPlayerList()): + solo = false + ReceiveInit = true + return + else: + print"solo in climbing wall" + + + def OnClimbingWallInit(self,type,state,value): + global ReceiveInit + + print"grsnClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value + if (ReceiveInit == false): + print"failed to receive init" + return + if (type == ptClimbingWallMsgType.kEndGameState): + ReceiveInit = false + print "finished receiving total game state" + + if (type == ptClimbingWallMsgType.kTotalGameState): + print "begin receiving total game state" + + elif (type == ptClimbingWallMsgType.kAddBlocker and state > 0 and value == 0): + southWall.value[state].runAttachedResponder(kTeamLightsOn) + + def OnClimbingWallEvent(self,type,state,value): + + if (type == ptClimbingWallMsgType.kAddBlocker and value == false): #display wall settings + southWall.value[state].runAttachedResponder(kTeamLightsOn) + print"Imager display S drawing wall index",state + + elif (type == ptClimbingWallMsgType.kRemoveBlocker and value == false): + southWall.value[state].runAttachedResponder(kTeamLightsOff) + print"Imager display S clearing wall index",state + + elif (type == ptClimbingWallMsgType.kNewState): + if (state == ptClimbingWallMsgState.kSouthSit or state == ptClimbingWallMsgState.kNorthSit ): + #clear wall settings + i = 0 + while (i < 171): + southWall.value[i].runAttachedResponder(kTeamLightsOff) + i = i + 1 +""" diff --git a/Python/grsnWallPython.py b/Python/grsnWallPython.py new file mode 100644 index 0000000000..2541bce159 --- /dev/null +++ b/Python/grsnWallPython.py @@ -0,0 +1,1233 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + +# for save/load +import cPickle + +## COMMENTED OUT by Jeff due to the re-write in the garrison wall + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## + +northPanelClick = ptAttribActivator(1,"North Panel Clickables") +southPanelClick = ptAttribActivator(2,"South Panel Clickables") + +northPanel = ptAttribSceneobjectList(3,"North Panel Objects",byObject=1) +southPanel = ptAttribSceneobjectList(4,"South Panel Objects",byObject=1) + +# if northWall = 5 and southWall = 6 then your control panel +# controls the wall that YOU climb on (useful for debugging) +# just remember to switch them back before going live... +northWall = ptAttribSceneobjectList(5,"North Wall",byObject=1) +southWall = ptAttribSceneobjectList(6,"South Wall",byObject=1) + +northChair = ptAttribActivator(7,"North Chair") +southChair = ptAttribActivator(8,"South Chair") + +northLights = ptAttribSceneobjectList(9,"North Panel Lights",byObject=1) +southLights = ptAttribSceneobjectList(10,"South Panel Lights",byObject=1) + +northCountLights = ptAttribSceneobjectList(11,"North Count Lights",byObject=1) +southCountLights = ptAttribSceneobjectList(12,"South Count Lights",byObject=1) + +upButtonS = ptAttribActivator(13, "S up count button") +dnButtonS = ptAttribActivator(14, "S down count button") +readyButtonS = ptAttribActivator(15, "S ready button") + +upButtonN = ptAttribActivator(18, "N up count button") +dnButtonN = ptAttribActivator(19, "N down count button") +readyButtonN = ptAttribActivator(20, "N ready button") + +goButtonN = ptAttribActivator(21,"N Go Button activator") +goButtonS = ptAttribActivator(22,"S Go Button activator") + +goBtnNObject = ptAttribSceneobject(23,"N Go Button object") +goBtnSObject = ptAttribSceneobject(24,"S Go Button object") + +nChairSit = ptAttribActivator(25,"N sit component") +sChairSit = ptAttribActivator(26,"S sit component") + +fiveBtnN = ptAttribActivator(27,"5 btn N") +tenBtnN = ptAttribActivator(28,"10 btn N") +fifteenBtnN = ptAttribActivator(29,"15 btn N") + +fiveBtnS = ptAttribActivator(30,"5 btn S") +tenBtnS = ptAttribActivator(31,"10 btn S") +fifteenBtnS = ptAttribActivator(32,"15 btn S") + +sTubeOpen = ptAttribNamedResponder(33,"S tube open",netForce=1) +nTubeOpen = ptAttribNamedResponder(34,"N tube open",netForce=1) + +sTubeClose = ptAttribNamedResponder(35,"S tube close",netForce=1) +nTubeClose = ptAttribNamedResponder(36,"N tube close",netForce=1) + +sTubeEntry = ptAttribNamedActivator(37,"S tube entry trigger") +nTubeEntry = ptAttribNamedActivator(38,"N tube entry trigger") + +sTubeMulti = ptAttribBehavior(43,"s tube entry multi",netForce=0) +nTubeMulti = ptAttribBehavior(44,"n tube entry multi",netForce=0) + +sTubeExclude = ptAttribExcludeRegion(45,"s tube exclude") +nTubeExclude = ptAttribExcludeRegion(46,"n tube exclude") + +sTeamWarpPt = ptAttribSceneobject(47,"s team warp point") +nTeamWarpPt = ptAttribSceneobject(48,"n team warp point") + +sTeamWin = ptAttribActivator(49,"s team win") +nTeamWin = ptAttribActivator(50,"n team win") + +sTeamQuit = ptAttribActivator(51,"s team quit") +nTeamQuit = ptAttribActivator(52,"n team quit") + +sTeamWinTeleport = ptAttribSceneobject(53,"s team win point") +nTeamWinTeleport = ptAttribSceneobject(54,"n team win point") + +nQuitBehavior = ptAttribBehavior(55,"s quit behavior") +sQuitBehavior = ptAttribBehavior(56,"n quit behavior") + +# sfx responders + +nPanelSound = ptAttribResponder(57,"n panel sound",['main','up','down','select','blockerOn','blockerOff','gameStart','denied'],netForce=1) +sPanelSound = ptAttribResponder(58,"s panel sound",['main','up','down','select','blockerOn','blockerOff','gameStart','denied'],netForce=1) + + + +############################################################## +# grsnWallPython +############################################################## + +## globals + +## for team light responders +kTeamLightsOn = 0 +kTeamLightsOff = 1 +kRedOn = 3 +kRedOff = 4 +kRedFlash = 2 + +## for go button light states +kDim = 0 +kBright = 1 +kPulse = 2 +## + +## game states + +kWaiting = 0 +kNorthSit = 1 +kSouthSit = 2 +kNorthSelect = 3 +kSouthSelect = 4 +kNorthReady = 5 +kSouthReady = 6 +kNorthPlayerEntry = 7 +kSouthPlayerEntry = 8 +kGameInProgress = 9 +kNorthWin = 10 +kSouthWin = 11 +kSouthQuit = 12 +kNorthQuit = 13 + +## sdl replacements +""" +SouthState = ptClimbingWallMsgState.kWaiting +NorthState = ptClimbingWallMsgState.kWaiting +""" +NorthCount = 0 +BlockerCountLimit = 0 +SouthCount = 0 +NorthWall = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] +SouthWall = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] +ReceiveInit = false + +class grsnWallPython(ptResponder): + + # constants + + def __init__(self): + "construction" + PtDebugPrint("grsnWallPython::init begin") + ptResponder.__init__(self) + self.id = 52392 + self.version = 3 +""" + def Load(self): + PtDebugPrint("grsnWallPython::Load") + + def LookupIndex(self,index,north): + global NorthWall + global SouthWall + global BlockerCountLimit + + i = 0 + print"looking north ",north + if (north): + while (i < BlockerCountLimit): + if (NorthWall[i] == index): + print"index found in north list in slot ",i + return true + print "north wall [",i,"] = ",NorthWall[i] + i = i + 1 + else: + while (i < BlockerCountLimit): + if (SouthWall[i] == index): + print"index found in south list in slot ",i + return true + print "south wall [",i,"] = ",SouthWall[i] + i = i + 1 + + print"index not found" + return false + + def SetWallIndex(self,index,value,north): + global NorthWall + global SouthWall + global SouthCount + global NorthCount + + i = 0 + if (value): + if (north): + while (NorthWall[i] >= 0): + i = i + 1 + if (i == 20): + print"yikes - somehow overran the array!" + return + NorthWall[i] = index + NorthCount = NorthCount + 1 + print"set north wall index ",index," in slot ",i," to true" + else: + while (SouthWall[i] >= 0): + i = i + 1 + if (i == 20): + print"yikes - somehow overran the array!" + return + SouthWall[i] = index + SouthCount = SouthCount + 1 + print"set south wall index ",index," in slot ",i," to true" + else: + if (north): + while (NorthWall[i] != index): + i = i + 1 + if (i == 20): + print"this should not get hit - looked for non-existent NorthWall entry!" + return + NorthWall[i] = -1 + NorthCount = NorthCount - 1 + print"removed index ",index," from list slot ",i + else: + while (SouthWall[i] != index): + i = i + 1 + if (i == 20): + print"this should not get hit - looked for non-existent SouthWall entry!" + return + SouthWall[i] = -1 + SouthCount = SouthCount - 1 + print"removed index ",index," from list slot ",i + + def ClearIndices(self,north): + global NorthWall + global SouthWall + global NorthCount + global SouthCount + i = 0 + while (i < 171): + if (i < 20): + if (north): + NorthWall[i] = -1 + else: + SouthWall[i] = -1 + + if (north): + northLights.value[i].runAttachedResponder(kTeamLightsOff) + else: + southLights.value[i].runAttachedResponder(kTeamLightsOff) + i = i + 1 + + if (north): + NorthCount = 0 + else: + SouthCount = 0 + + def SetSPanelMode(self,state): + global NorthState + global SouthState + global NorthCount + global SouthCount + global BlockerCountLimit + global NorthWall + global SouthWall + + if (state == ptClimbingWallMsgState.kWaiting): + #turn everything off + self.ResetSouthPanel(false) + self.ClearIndices(false) + sTubeExclude.clear(self.key) + sTubeClose.run(self.key,avatar=PtGetLocalAvatar()) + + elif (state == ptClimbingWallMsgState.kSouthSit): + #set go button to bright + goBtnSObject.value.runAttachedResponder(kBright) + elif (state == ptClimbingWallMsgState.kSouthSelect): + self.ClearIndices(false) + # make all of the counter lights flash + i = 0 + while i<20: + southCountLights.value[i].runAttachedResponder(kRedFlash) + i = i + 1 + #enable up / down buttons + upButtonS.enable() + dnButtonS.enable() + readyButtonS.enable() + fiveBtnS.enable() + tenBtnS.enable() + fifteenBtnS.enable() + elif (state == ptClimbingWallMsgState.kSouthReady): + # turn unselected count lights solid, and turn off the other lights + i = 0 + while i < BlockerCountLimit: + southCountLights.value[i].runAttachedResponder(kTeamLightsOff) + i = i + 1 + i = BlockerCountLimit + while i < 20: + southCountLights.value[i].runAttachedResponder(kRedOn) + i = i + 1 + #disable adjustment buttons + upButtonS.disable() + dnButtonS.disable() + readyButtonS.disable() + fiveBtnS.disable() + tenBtnS.disable() + fifteenBtnS.disable() + + elif (state == ptClimbingWallMsgState.kSouthPlayerEntry): + #disable all panel buttons + self.EnableSouthButtons(false) + #run responder to open tube + if (NorthState == ptClimbingWallMsgState.kNorthPlayerEntry): + sTubeOpen.run(self.key,avatar=PtGetLocalAvatar()) + goBtnSObject.value.runAttachedResponder(kBright) + nTubeOpen.run(self.key,avatar=PtGetLocalAvatar()) + goBtnNObject.value.runAttachedResponder(kBright) + print"tubes open" + + + def SetNPanelMode(self,state): + global NorthState + global SouthState + global NorthCount + global SouthCount + global BlockerCountLimit + global NorthWall + global SouthWall + + print"set N Panel Mode called with state ",state + if (state == ptClimbingWallMsgState.kWaiting): + #turn everything off + self.ResetNorthPanel(false) + self.ClearIndices(true) + nTubeExclude.clear(self.key) + nTubeClose.run(self.key,avatar=PtGetLocalAvatar()) + goBtnNObject.value.runAttachedResponder(kDim) + elif (state == ptClimbingWallMsgState.kNorthSit): + #set go button to bright + goBtnNObject.value.runAttachedResponder(kBright) + elif (state == ptClimbingWallMsgState.kNorthSelect): + self.ClearIndices(true) + # make all of the counter lights flash + i = 0 + while i<20: + northCountLights.value[i].runAttachedResponder(kRedFlash) + print"run red flash ",i + i = i + 1 + #enable up / down buttons + upButtonN.enable() + dnButtonN.enable() + readyButtonN.enable() + fiveBtnN.enable() + tenBtnN.enable() + fifteenBtnN.enable() + goBtnNObject.value.runAttachedResponder(kDim) + print"enabled all n switches" + elif (state == ptClimbingWallMsgState.kNorthReady): + # turn unselected count lights solid, and turn off the other lights + i = 0 + while i < BlockerCountLimit: + northCountLights.value[i].runAttachedResponder(kTeamLightsOff) + i = i + 1 + i = BlockerCountLimit + while i < 20: + northCountLights.value[i].runAttachedResponder(kRedOn) + i = i + 1 + #disable adjustment buttons + upButtonN.disable() + dnButtonN.disable() + readyButtonN.disable() + fiveBtnN.disable() + tenBtnN.disable() + fifteenBtnN.disable() + goBtnNObject.value.runAttachedResponder(kRedFlash) + elif (state == ptClimbingWallMsgState.kNorthPlayerEntry): + #disable all panel buttons + self.EnableNorthButtons(false) + #run responder to open tube + if (SouthState == ptClimbingWallMsgState.kSouthPlayerEntry): + sTubeOpen.run(self.key,avatar=PtGetLocalAvatar()) + goBtnSObject.value.runAttachedResponder(kBright) + nTubeOpen.run(self.key,avatar=PtGetLocalAvatar()) + goBtnNObject.value.runAttachedResponder(kBright) + print"tubes open" + + def IAmMaster(self): + return (self.sceneobject.isLocallyOwned()) + + + def ChangeGameState(self,newState): + + print"sending change game state message with state ",newState + msg = ptClimbingWallMsg(self.key) + msg.init(ptClimbingWallMsgType.kNewState, newState, 0) + msg.send() + + def ChangeBlockerCount(self, newCount): + print"sending change blocker count message with new count ",newCount + msg = ptClimbingWallMsg(self.key) + msg.init(ptClimbingWallMsgType.kSetBlockerNum, 1, newCount) + msg.send() + + def ZeroBlockerCount(self): + msg = ptClimbingWallMsg(self.key) + msg.init(ptClimbingWallMsgType.kSetBlockerNum, 0, 0) + msg.send() + + def ChangeBlockerState(self, on, index, north): + msg = ptClimbingWallMsg(self.key) + if (on): + msg.init(ptClimbingWallMsgType.kAddBlocker,index,north) + else: + msg.init(ptClimbingWallMsgType.kRemoveBlocker,index,north) + msg.send() + + + def OnClimbingWallInit(self,type,state,value): + global ReceiveInit + global SouthState + global NorthState + global BlockerCountLimit + global NorthWall + global SouthWall + + + print"grsnClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value + if (ReceiveInit == false): + print"failed to receive init" + return + if (type == ptClimbingWallMsgType.kEndGameState): + ReceiveInit = false + print "finished receiving total game state" + # update lights display + i = 0 + while i < BlockerCountLimit: + northCountLights.value[i].runAttachedResponder(kTeamLightsOff) + southCountLights.value[i].runAttachedResponder(kTeamLightsOff) + i = i + 1 + i = BlockerCountLimit + while i < 20: + northCountLights.value[i].runAttachedResponder(kRedOn) + southCountLights.value[i].runAttachedResponder(kRedOn) + i = i + 1 + i = 0 + j = 0 + while (i < BlockerCountLimit): + if (SouthWall[i] > 0): + southCountLights.value[j].runAttachedResponder(kTeamLightsOn) + j = j + 1 + i = i + 1 + i = 0 + j = 0 + while (i < BlockerCountLimit): + if (NorthWall[i] > 0): + northCountLights.value[j].runAttachedResponder(kTeamLightsOn) + j = j + 1 + i = i + 1 + + return + + if (type == ptClimbingWallMsgType.kTotalGameState): + SouthState = state + NorthState = value + print "begin receiving total game state" + + elif (type == ptClimbingWallMsgType.kAddBlocker and state > 0): + self.SetWallIndex(state,true,value) + if (value): + self.ChangeNorthBlocker(state) + else: + self.ChangeSouthBlocker(state) + + elif (type == ptClimbingWallMsgType.kSetBlockerNum): + BlockerCountLimit = value + self.UpdateBlockerCountDisplay(state) + + def OnClimbingWallEvent(self,type,state,value): + global NorthState + global SouthState + global BlockerCountLimit + global ReceiveInit + global NorthWall + global SouthWall + + if (ReceiveInit): + return + + print"grsnClimbingWall::OnClimbingWallMsg type ",type," state ",state," value ",value + if (type == ptClimbingWallMsgType.kNewState): + if (value == 1): + NorthState = state + self.SetNPanelMode(state) + else: + SouthState = state + self.SetSPanelMode(state) + + elif (type == ptClimbingWallMsgType.kAddBlocker): + self.SetWallIndex(state,true,value) + if (value): + self.ChangeNorthBlocker(state) + else: + self.ChangeSouthBlocker(state) + + + elif (type == ptClimbingWallMsgType.kRemoveBlocker): + self.SetWallIndex(state,false,value) + if (value): + self.ChangeNorthBlocker(state) + else: + self.ChangeSouthBlocker(state) + + elif (type == ptClimbingWallMsgType.kSetBlockerNum): + BlockerCountLimit = value + self.UpdateBlockerCountDisplay(state) + + elif (type == ptClimbingWallMsgType.kRequestGameState): + if (self.IAmMaster() == false): + return + msg = ptClimbingWallMsg(self.key) + msg.createGameState(BlockerCountLimit,SouthState,NorthState) + i = 0 + while (i < BlockerCountLimit): + msg.addBlocker(NorthWall[i],i,true) + msg.addBlocker(SouthWall[i],i,false) + i = i + 1 + msg.send() + + + def OnServerInitComplete(self): + global ReceiveInit + + PtDebugPrint("grsnWallPython::OnServerInitComplete") + solo = true + if len(PtGetPlayerList()): + solo = false + ReceiveInit = true + i = 0 + while i<171: + southWall.value[i].physics.suppress(true) + northWall.value[i].physics.suppress(true) + i = i + 1 + sTubeClose.run(self.key,fastforward=true,netForce=0) + nTubeClose.run(self.key,fastforward=true,netForce=0) + print"requesting game state message from master client" + msg = ptClimbingWallMsg(self.key) + msg.init(ptClimbingWallMsgType.kRequestGameState,0,0) + msg.send() + return + else: + print"solo in climbing wall" + + ageSDL = PtGetAgeSDL() + # these need to send immediate + #ageSDL.setFlags("lastChangedIndexN",1,1) + #ageSDL.setFlags("lastChangedIndexS",1,1) + #ageSDL.setFlags("northCount", 1, 1) + #ageSDL.setFlags("southCount", 1, 1) + # don't send immediate for any others + + #ageSDL.setFlags("northCountLimit",0, 1) + #ageSDL.setFlags("southCountLimit", 0, 1) + #ageSDL.setFlags("northWall", 0, 1) + #ageSDL.setFlags("southWall", 0, 1) + ageSDL.setFlags("nChairOccupant",0,1) + ageSDL.setFlags("sChairOccupant",0,1) + #ageSDL.setFlags("nChairState",0,1) + #ageSDL.setFlags("sChairState",0,1) + + #ageSDL.setNotify(self.key,"northCount", 0.0) + #ageSDL.setNotify(self.key,"northCountLimit", 0.0) + #ageSDL.setNotify(self.key,"southCount", 0.0) + #ageSDL.setNotify(self.key,"southCountLimit", 0.0) + #ageSDL.setNotify(self.key,"northWall", 0.0) + #ageSDL.setNotify(self.key,"southWall", 0.0) + ageSDL.setNotify(self.key,"nChairOccupant",0.0) + ageSDL.setNotify(self.key,"sChairOccupant",0.0) + #ageSDL.setNotify(self.key,"nChairState",0.0) + #ageSDL.setNotify(self.key,"sChairState",0.0) + + #ageSDL.sendToClients("northCount") + #ageSDL.sendToClients("northCountLimit") + #ageSDL.sendToClients("southCount") + #ageSDL.sendToClients("southCountLimit") + #ageSDL.sendToClients("northWall") + #ageSDL.sendToClients("southWall") + ageSDL.sendToClients("nChairOccupant") + ageSDL.sendToClients("sChairOccupant") + #ageSDL.sendToClients("nChairState") + #ageSDL.sendToClients("sChairState") + #ageSDL.setIndex("lastChangedIndexS",0,-1) + #ageSDL.setIndex("lastChangedIndexN",0,-1) + + self.ResetSouthPanel(false) + self.ResetNorthPanel(false) + sTubeClose.run(self.key) + nTubeClose.run(self.key) + + if (solo): + #set everything to cleared state + ageSDL.setIndex("nChairOccupant",0,-1) + ageSDL.setIndex("sChairOccupant",0,-1) + #ageSDL.setIndex("nChairState",0,kWaiting) + #ageSDL.setIndex("sChairState",0,kWaiting) + ageSDL.setIndex("nWallPlayer",0,-1) + ageSDL.setIndex("sWallPlayer",0,-1) + SouthState = ptClimbingWallMsgState.kWaiting + NorthState = ptClimbingWallMsgState.kWaiting + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + return + + def UpdateBlockerCountDisplay(self,flash): + global BlockerCountLimit + + numSelected = BlockerCountLimit + i = 0 + while i < numSelected: + northCountLights.value[i].runAttachedResponder(kTeamLightsOn) + southCountLights.value[i].runAttachedResponder(kTeamLightsOn) + i = i + 1 + i = numSelected + while i < 20: + northCountLights.value[i].runAttachedResponder(kRedFlash) + southCountLights.value[i].runAttachedResponder(kRedFlash) + i = i + 1 + if (flash == 0): + i = 0 + while i < 20: + northCountLights.value[i].runAttachedResponder(kTeamLightsOff) + southCountLights.value[i].runAttachedResponder(kTeamLightsOff) + i = i + 1 + + + def ChangeSouthBlocker(self,index): + global BlockerCountLimit + + # we clicked or un-clicked on a control panel button corresponding to a wall blocker + print"found South index ",index + wallPicked = southWall.value[index] + animPicked = southLights.value[index] + if (self.LookupIndex(index,false)): + #turn this guy on + wallPicked.physics.suppress(false) + animPicked.runAttachedResponder(kTeamLightsOn) + counterPicked = southCountLights.value[SouthCount - 1] + counterPicked.runAttachedResponder(kTeamLightsOn) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='blockerOn') + else: + wallPicked.physics.suppress(true) + animPicked.runAttachedResponder(kTeamLightsOff) + counterPicked = southCountLights.value[SouthCount] + counterPicked.runAttachedResponder(kTeamLightsOff) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='blockerOff') + return + + def ChangeNorthBlocker(self,index): + global BlockerCountLimit + + # we clicked or un-clicked on a control panel button corresponding to a wall blocker + print"found North index ",index + wallPicked = northWall.value[index] + animPicked = northLights.value[index] + if (self.LookupIndex(index,true)): + #turn this guy on + wallPicked.physics.suppress(false) + animPicked.runAttachedResponder(kTeamLightsOn) + counterPicked = northCountLights.value[NorthCount - 1] + counterPicked.runAttachedResponder(kTeamLightsOn) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='blockerOn') + else: + wallPicked.physics.suppress(true) + animPicked.runAttachedResponder(kTeamLightsOff) + counterPicked = northCountLights.value[NorthCount] + counterPicked.runAttachedResponder(kTeamLightsOff) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='blockerOff') + return + + def EnableSouthButtons(self,enable): + + i = 0 + while i < 171: + if (enable): + southPanel.value[i].physics.enable() + else: + southPanel.value[i].physics.disable() + i = i + 1 + + if (enable): + upButtonS.enable() + dnButtonS.enable() + readyButtonS.enable() + fiveBtnS.enable() + tenBtnS.enable() + fifteenBtnS.enable() + else: + upButtonS.disable() + dnButtonS.disable() + readyButtonS.disable() + fiveBtnS.disable() + tenBtnS.disable() + fifteenBtnS.disable() + + def EnableNorthButtons(self,enable): + + i = 0 + while i < 171: + if (enable): + northPanel.value[i].physics.enable() + else: + northPanel.value[i].physics.disable() + i = i + 1 + + if (enable): + upButtonN.enable() + dnButtonN.enable() + readyButtonN.enable() + fiveBtnN.enable() + tenBtnN.enable() + fifteenBtnN.enable() + else: + upButtonN.disable() + dnButtonN.disable() + readyButtonN.disable() + fiveBtnN.disable() + tenBtnN.disable() + fifteenBtnN.disable() + + def ResetSouthPanel(self,enable): + global SouthCount + + self.EnableSouthButtons(enable) + ageSDL = PtGetAgeSDL() + i = 0 + while i<171: + southLights.value[i].runAttachedResponder(kTeamLightsOff) + if (i < 20): + southCountLights.value[i].runAttachedResponder(kTeamLightsOff) + + if (enable == 0): + southWall.value[i].physics.suppress(true) + #print"disabled south wall ",i + i = i + 1 + + self.ZeroBlockerCount() + SouthCount = 0 + #ageSDL.setIndex("southCount",0,0) + #ageSDL.setIndex("southCountLimit",0,0) + goBtnSObject.value.runAttachedResponder(kDim) + + def ResetNorthPanel(self,enable): + global NorthCount + + self.EnableNorthButtons(enable) + ageSDL = PtGetAgeSDL() + i = 0 + while i<171: + northLights.value[i].runAttachedResponder(kTeamLightsOff) + if (i < 20): + northCountLights.value[i].runAttachedResponder(kTeamLightsOff) + if (enable): + # ageSDL.setIndex("northWall",i,1) + print"enabled north wall - this should not happen " + else: + #ageSDL.setIndex("northWall",i,0) + northWall.value[i].physics.suppress(true) + #print"disabled north wall ",i + i = i + 1 + self.ZeroBlockerCount() + NorthCount = 0 + #ageSDL.setIndex("northCount",0,0) + #ageSDL.setIndex("northCountLimit",0,0) + goBtnNObject.value.runAttachedResponder(kDim) + + def OnTimer(self,id): + avatar = PtGetLocalAvatar() + if (id == kNorthQuit): + PtFakeLinkAvatarToObject(avatar.getKey(),sTeamWinTeleport.value.getKey()) + self.ChangeGameState(ptClimbingWallMsgState.kSouthQuit) + self.ChangeGameState(ptClimbingWallMsgState.kNorthWin) + else: + PtFakeLinkAvatarToObject(avatar.getKey(),nTeamWinTeleport.value.getKey()) + self.ChangeGameState(ptClimbingWallMsgState.kSouthWin) + self.ChangeGameState(ptClimbingWallMsgState.kNorthQuit) + + + + def OnNotify(self,state,id,events): + global NorthState + global SouthState + global NorthCount + global SouthCount + global BlockerCountLimit + global NorthWall + global SouthWall + + #print "grsnWall - Notify ",state,id,events + ageSDL = PtGetAgeSDL() + avatar = PtFindAvatar(events) + + southState = SouthState + northState = NorthState + print"southState = ",southState + print"northState = ",northState + + # responder / behavior notifications + + if (id == sQuitBehavior.id): + for event in events: + if (event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage): + print"start touching quit jewel, warp out" + if (avatar == PtGetLocalAvatar()): + PtAtTimeCallback(self.key ,0.8 ,kSouthQuit) + return + + if (id == nQuitBehavior.id): + for event in events: + if (event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage): + print"start touching quit jewel, warp out" + if (avatar == PtGetLocalAvatar()): + PtAtTimeCallback(self.key ,0.8 ,kNorthQuit) + return + + if (id == nTubeOpen.id): + print"tube finished opening" + nTubeExclude.release(self.key) + + if (id == nTubeMulti.id): + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + print"Smart seek completed. close tube" + nTubeClose.run(self.key,avatar=avatar) + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + print"multistage complete, warp to wall south room with suit" + if (avatar == PtGetLocalAvatar()): + PtWearMaintainerSuit(PtGetLocalAvatar().getKey(),true) + PtSendKIMessage(kDisableEntireYeeshaBook,0) + avatar.physics.warpObj(sTeamWarpPt.value.getKey()) + + if (id == sTubeOpen.id): + print"tube finished opening" + sTubeExclude.release(self.key) + + if (id == sTubeMulti.id): + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage: + print"Smart seek completed. close tube" + sTubeClose.run(self.key,avatar=avatar) + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + print"multistage complete, warp to wall north room with suit" + if (avatar == PtGetLocalAvatar()): + PtWearMaintainerSuit(PtGetLocalAvatar().getKey(),true) + PtSendKIMessage(kDisableEntireYeeshaBook,0) + avatar.physics.warpObj(nTeamWarpPt.value.getKey()) + + + + # activator notifications + if (id == sTeamWin.id and state): + print"you win" + PtFakeLinkAvatarToObject(avatar.getKey(),sTeamWinTeleport.value.getKey()) + #avatar.physics.warpObj(sTeamWinTeleport.value.getKey()) + self.ChangeGameState(ptClimbingWallMsgState.kSouthWin) + self.ChangeGameState(ptClimbingWallMsgState.kNorthQuit) + #ageSDL.setIndex("sChairState",0,kSouthWin) + #ageSDL.setIndex("nChairState",0,kNorthQuit) + + if (id == nTeamWin.id and state): + print"you win" + PtFakeLinkAvatarToObject(avatar.getKey(),nTeamWinTeleport.value.getKey()) + #avatar.physics.warpObj(nTeamWinTeleport.value.getKey()) + self.ChangeGameState(ptClimbingWallMsgState.kNorthWin) + self.ChangeGameState(ptClimbingWallMsgState.kSouthQuit) + #ageSDL.setIndex("sChairState",0,kSouthQuit) + #ageSDL.setIndex("nChairState",0,kNorthWin) + + if (id == nTeamQuit.id and state): + avatar.avatar.runBehaviorSetNotify(nQuitBehavior.value,self.key,nQuitBehavior.netForce) + self.ChangeGameState(ptClimbingWallMsgState.kNorthQuit) + self.ChangeGameState(ptClimbingWallMsgState.kSouthWin) + #ageSDL.setIndex("sChairState",0,kSouthWin) + #ageSDL.setIndex("nChairState",0,kNorthQuit) + return + + if (id == sTeamQuit.id and state): + avatar.avatar.runBehaviorSetNotify(sQuitBehavior.value,self.key,sQuitBehavior.netForce) + self.ChangeGameState(ptClimbingWallMsgState.kNorthWin) + self.ChangeGameState(ptClimbingWallMsgState.kSouthQuit) + #ageSDL.setIndex("sChairState",0,kSouthQuit) + #ageSDL.setIndex("nChairState",0,kNorthWin) + return + + if (id == southChair.id): + print"clicked south chair" + avID = PtGetClientIDFromAvatarKey(avatar.getKey()) + if state: + occupant = ageSDL["sChairOccupant"][0] + print"occupant ",occupant + if (1): + print"sitting down in south chair" + southChair.disable() + ageSDL.setIndex("sChairOccupant",0,avID) + if (southState == ptClimbingWallMsgState.kWaiting or southState == ptClimbingWallMsgState.kSouthWin or southState == ptClimbingWallMsgState.kSouthQuit): + self.ChangeGameState(ptClimbingWallMsgState.kSouthSit) + #if (northState == ptClimbingWallMsgState.kNorthQuit or northState == ptClimbingWallMsgState.kNorthWin): + #self.ChangeGameState(ptClimbingWallMsgState.kWaiting) + #ageSDL.setIndex("sChairState",0,kSouthSit) + return + + if id==sChairSit.id: + for event in events: + if event[0]==6 and event[1]==1 and state == 0: + if (1): + print"standing up from south chair" + southChair.enable() + ageSDL.setIndex("sChairOccupant",0,-1) + + return + + if (id == northChair.id): + print"clicked north chair" + avID = PtGetClientIDFromAvatarKey(avatar.getKey()) + if state: + occupant = ageSDL["nChairOccupant"][0] + print"occupant ",occupant + if (1): + print"sitting down in south chair" + northChair.disable() + ageSDL.setIndex("nChairOccupant",0,avID) + if (northState == ptClimbingWallMsgState.kWaiting or northState == ptClimbingWallMsgState.kNorthWin or northState == ptClimbingWallMsgState.kNorthQuit): + self.ChangeGameState(ptClimbingWallMsgState.kNorthSit) + #if (southState == ptClimbingWallMsgState.kSouthQuit or southState == ptClimbingWallMsgState.kSouthWin): + #self.ChangeGameState(ptClimbingWallMsgState.kWaiting) + return + + if id==nChairSit.id: + for event in events: + if event[0]==6 and event[1]==1 and state == 0: + if (1): + print"standing up from north chair" + northChair.enable() + ageSDL.setIndex("nChairOccupant",0,-1) + + return + + + elif not state: + return + if (avatar != PtGetLocalAvatar()): + print"not activated by me" + return + + if (id == nTubeEntry.id): + trigger = PtFindAvatar(events) + print"entered team 1 tube, run behavior" + ageSDL.setIndex("nWallPlayer",0,PtGetClientIDFromAvatarKey(trigger.getKey())) + trigger.avatar.runBehaviorSetNotify(nTubeMulti.value,self.key,0) + + if (id == sTubeEntry.id): + trigger = PtFindAvatar(events) + print"entered team 2 tube, run behavior" + ageSDL.setIndex("sWallPlayer",0,PtGetClientIDFromAvatarKey(trigger.getKey())) + trigger.avatar.runBehaviorSetNotify(sTubeMulti.value,self.key,0) + + if id == upButtonS.id: + print "up button south" + if (southState == ptClimbingWallMsgState.kSouthSelect): + print"correct state, blocker count limit ",BlockerCountLimit + if (BlockerCountLimit < 20): + self.ChangeBlockerCount(BlockerCountLimit + 1) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + else: + print"somehow think blocker count limit greater than 20?" + return + elif id == dnButtonS.id: + print "down button south" + if (southState == ptClimbingWallMsgState.kSouthSelect): + if (BlockerCountLimit > 0): + self.ChangeBlockerCount(BlockerCountLimit - 1) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='down') + + return + elif id == fiveBtnS.id: + print"five button south" + if (southState == ptClimbingWallMsgState.kSouthSelect): + self.ChangeBlockerCount(5) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + return + elif id == tenBtnS.id: + print"ten button south" + if (southState == ptClimbingWallMsgState.kSouthSelect): + self.ChangeBlockerCount(10) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + return + elif id == fifteenBtnS.id: + print"fifteen button south" + if (southState == ptClimbingWallMsgState.kSouthSelect): + self.ChangeBlockerCount(15) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + return + + elif id == readyButtonS.id: + print "ready button south" + if (southState == ptClimbingWallMsgState.kSouthSelect): + self.ChangeGameState(ptClimbingWallMsgState.kSouthReady) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='select') + if (northState == ptClimbingWallMsgState.kNorthSelect): + self.ChangeGameState(ptClimbingWallMsgState.kNorthReady) + else: + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + + return + elif id == goButtonS.id: + print"picked s go button" + if (southState == ptClimbingWallMsgState.kSouthSit): + print"set index to kSouthSelect" + self.ClearIndices(false) + self.ChangeGameState(ptClimbingWallMsgState.kSouthSelect) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='main') + if (northState == ptClimbingWallMsgState.kWaiting or northState == ptClimbingWallMsgState.kNorthSit or \ + northState == ptClimbingWallMsgState.kNorthWin or northState == ptClimbingWallMsgState.kNorthQuit ): + print"force north chair to keep up" + self.ChangeGameState(ptClimbingWallMsgState.kNorthSelect) + elif(southState == ptClimbingWallMsgState.kSouthReady): + print"check to see if you've used all your wall blockers" + #numSelected = ageSDL["southCount"][0] + #maxSelections = ageSDL["southCountLimit"][0] + numSelected = SouthCount + maxSelections = BlockerCountLimit + if (numSelected < maxSelections): + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + else: + #ageSDL.setIndex("sChairState",0,kSouthPlayerEntry) + self.ChangeGameState(ptClimbingWallMsgState.kSouthPlayerEntry) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='gameStart') + return + + if id == upButtonN.id: + print "up button north" + if (northState == ptClimbingWallMsgState.kNorthSelect): + #numSelected = ageSDL["northCountLimit"][0] + numSelected = BlockerCountLimit + if (numSelected < 20): + numSelected = numSelected + 1 + #ageSDL.setIndex("northCountLimit",0,numSelected) + self.ChangeBlockerCount(numSelected) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + #if (southState == kSouthSelect): + # ageSDL.setIndex("southCountLimit",0,numSelected) + + return + elif id == dnButtonN.id: + print "down button north" + if (northState == ptClimbingWallMsgState.kNorthSelect): + #numSelected = ageSDL["northCountLimit"][0] + numSelected = BlockerCountLimit + if (numSelected > 0): + numSelected = numSelected - 1 + #ageSDL.setIndex("northCountLimit",0,numSelected) + self.ChangeBlockerCount(numSelected) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='down') + #if (southState == kSouthSelect): + # ageSDL.setIndex("southCountLimit",0,numSelected) + + return + elif id == fiveBtnN.id: + print"five button north" + if (northState == ptClimbingWallMsgState.kNorthSelect): + self.ChangeBlockerCount(5) + #ageSDL.setIndex("northCountLimit",0,5) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + #if (southState == kSouthSelect): + # ageSDL.setIndex("southCountLimit",0,5) + return + elif id == tenBtnN.id: + print"ten button north" + if (northState == ptClimbingWallMsgState.kNorthSelect): + self.ChangeBlockerCount(10) + #ageSDL.setIndex("northCountLimit",0,10) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + #if (southState == kSouthSelect): + # ageSDL.setIndex("southCountLimit",0,10) + return + elif id == fifteenBtnN.id: + print"fifteen button north" + if (northState == ptClimbingWallMsgState.kNorthSelect): + self.ChangeBlockerCount(15) + #ageSDL.setIndex("northCountLimit",0,15) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + #if (southState == kSouthSelect): + # ageSDL.setIndex("southCountLimit",0,15) + return + + elif id == readyButtonN.id: + print "ready button north" + if (northState == ptClimbingWallMsgState.kNorthSelect): + self.ChangeGameState(ptClimbingWallMsgState.kNorthReady) + #ageSDL.setIndex("nChairState",0,kNorthReady) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='select') + if (southState == ptClimbingWallMsgState.kSouthSelect): + self.ChangeGameState(ptClimbingWallMsgState.kSouthReady) + #ageSDL.setIndex("sChairState",0,kSouthReady) + print"force south chair to keep up" + else: + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + return + elif id == goButtonN.id: + print"picked n go button" + if (northState == ptClimbingWallMsgState.kNorthSit): + print"set index to kNorthSelect" + self.ChangeGameState(ptClimbingWallMsgState.kNorthSelect) + self.ClearIndices(true) + #ageSDL.setIndex("nChairState",0,kNorthSelect) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='main') + if (southState == ptClimbingWallMsgState.kWaiting or southState == ptClimbingWallMsgState.kSouthSit or \ + southState == ptClimbingWallMsgState.kSouthWin or southState == ptClimbingWallMsgState.kSouthWin): + self.ChangeGameState(ptClimbingWallMsgState.kSouthSelect) + #ageSDL.setIndex("sChairState",0,kSouthSelect) + print"force south chair to keep up" + elif(northState == ptClimbingWallMsgState.kNorthReady): + print"check to see if you've used all your wall blockers" + #numSelected = ageSDL["northCount"][0] + #maxSelections = ageSDL["northCountLimit"][0] + numSelected = NorthCount + maxSelections = BlockerCountLimit + if (numSelected < maxSelections): + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + else: + #ageSDL.setIndex("nChairState",0,kNorthPlayerEntry) + self.ChangeGameState(ptClimbingWallMsgState.kNorthPlayerEntry) + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='gameStart') + return + + for event in events: + if event[0]==kPickedEvent and event[1] == 1: + panelPicked = event[3] + objName = panelPicked.getName() + print "player picked blocker named ", objName + north = 0 + try: + index = northPanel.value.index(panelPicked) + north = 1 + except: + try: + index = southPanel.value.index(panelPicked) + except: + print"no wall blocker found" + return; + if (north): #you picked something on the north panel + if (northState != ptClimbingWallMsgState.kNorthReady): + print"no blocker picking for you!" + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + return + #numSelected = ageSDL["northCount"][0] + numSelected = NorthCount + #ageSDL.setIndex("lastChangedIndexN",0,index) + print"numSelected = ",numSelected + #maxSelections = ageSDL["northCountLimit"][0] + maxSelections = BlockerCountLimit + #if (ageSDL["northWall"][index]==0): + if (self.LookupIndex(index,true) == 0): + if (numSelected == maxSelections): + print"you've picked all you can" + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + return + #numSelected = numSelected + 1 + #ageSDL.setIndex("northCount",0,numSelected) + #NorthCount = numSelected + #self.SetWallIndex(index,true,true) + self.ChangeBlockerState(true, index, true) + else: + numSelected = numSelected - 1 + if (numSelected == -1): + print"what?!?" + return + #ageSDL.setIndex("northCount",0,numSelected) + #NorthCount = numSelected + #self.SetWallIndex(index,false,true) + self.ChangeBlockerState(false,index,true) + else: #you picked one on the south panel + if (southState != ptClimbingWallMsgState.kSouthReady): + print"no blocker picking for you!" + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + return + #numSelected = ageSDL["southCount"][0] + numSelected = SouthCount + #ageSDL.setIndex("lastChangedIndexS",0,index) + print"numSelected = ",numSelected + #maxSelections = ageSDL["southCountLimit"][0] + maxSelections = BlockerCountLimit + #if (ageSDL["southWall"][index]==0): + if (self.LookupIndex(index,false) == 0): + if (numSelected == maxSelections): + print"you've picked all you can" + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + return + #numSelected = numSelected + 1 + #ageSDL.setIndex("southCount",0,numSelected) + #SouthCount = numSelected + #self.SetWallIndex(index,true,false) + self.ChangeBlockerState(true,index,false) + else: + numSelected = numSelected - 1 + if (numSelected == -1): + print"what?!?" + return + #ageSDL.setIndex("southCount",0,numSelected) + #SouthCount = numSelected + #self.SetWallIndex(index,false,false) + self.ChangeBlockerState(false,index,false) +""" diff --git a/Python/grsnWellJump.py b/Python/grsnWellJump.py new file mode 100644 index 0000000000..e5d3ffbd8c --- /dev/null +++ b/Python/grsnWellJump.py @@ -0,0 +1,63 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +# for save/load +import cPickle + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## + +rockPillarCamTrigger = ptAttribActivator(1,"rock cam trigger") +rockPillarCamera = ptAttribSceneobject(2,"rock pillar camera") + +############################################################## +# grsnWellJump +############################################################## +class grsnWellJump(ptResponder): + "subworld transition test" + + # constants + + def __init__(self): + "construction" + PtDebugPrint("grsnWellJump::init begin") + ptResponder.__init__(self) + self.id = 50118 + self.version = 1 + PtDebugPrint("grsnWellJump::init end") + + + def OnNotify(self,state,id,events): + + if state: + if id == rockPillarCamTrigger.id: + PtDebugPrint("triggered camera change") + #rockPillarCamera.value.pushCamera() + return diff --git a/Python/grtzAccessDoors.py b/Python/grtzAccessDoors.py new file mode 100644 index 0000000000..d417d77d63 --- /dev/null +++ b/Python/grtzAccessDoors.py @@ -0,0 +1,278 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: grtzAccessDoors.py +Age: Great Zero +Date: March 2007 +event manager hooks for the grtzAccessDoors +Karl +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + + +triggerRgn = ptAttribActivator(1, "region sensor") +doorResponder = ptAttribResponder(2,"door responder",['OpenTheDoor','CloseTheDoor','NoAccess'],netForce=0) +doorKiNeededBool = ptAttribBoolean(3,"Require Ki?", 0) + +doorSDLstates = {'closed':0,'opening':1,'open':2,'closing':3,'opentoclose':4,'closetoopen':5,'movingopen':6,'movingclosed':7, 'closedfail':8} + +class grtzAccessDoors(ptResponder): + ########################################## + def __init__(self): + ptResponder.__init__(self) + self.id = 207 + self.version = 2 + + self.grtzPrevDoorState = 0 + self.grtzDoorState = 0 + self.grtzDoorStack = [] + self.init = 0 + + ########################################## + def OnServerInitComplete(self): + + self.SDL.sendToClients('DoorOpen') + + + + try: + self.grtzDoorState = self.SDL['DoorOpen'][0] + except: + self.SDL['DoorOpen'] = (0,) + self.grtzDoorState = self.SDL['DoorOpen'][0] + + print "grtzAccessDoors: self.SDL = %d" % self.grtzDoorState + print "grtzAccessDoors: Player List = %d" % len(PtGetPlayerList()) + + if len(PtGetPlayerList()) > 0: + + print "grtzAccessDoors: Somebody is already in the age. Attempting to sync states." + + if self.grtzDoorState == doorSDLstates['open'] or self.grtzDoorState == doorSDLstates['opening']: + doorResponder.run(self.key,state='OpenTheDoor',fastforward=1,netPropagate=0) + print "grtzAccessDoors: Door is open." + print "grtzAccessDoors: Door State = %d" % self.grtzDoorState + + elif self.grtzDoorState == doorSDLstates['closing']: + doorResponder.run(self.key,state='CloseTheDoor',fastforward=1,netPropagate=0) + print "grtzAccessDoors: Door is closed." + print "grtzAccessDoors: Door State = %d" % self.grtzDoorState + + else: + print "grtzAccessDoors: Exception. Door State = %d" % self.grtzDoorState + + if self.grtzDoorState == doorSDLstates['opening'] or self.grtzDoorState == doorSDLstates['movingopen'] or self.grtzDoorState == doorSDLstates['opentoclose']: + doorResponder.run(self.key,state='OpenTheDoor',netPropagate=0) + self.grtzDoorStack.append("doorResponder.run(self.key,state='OpenTheDoor',netPropagate=0)") + + + elif self.grtzDoorState == doorSDLstates['closing'] or self.grtzDoorState == doorSDLstates['movingclosed'] or self.grtzDoorState == doorSDLstates['closetoopen']: + doorResponder.run(self.key,state='CloseTheDoor',netPropagate=0) + self.grtzDoorStack.append("doorResponder.run(self.key,state='CloseTheDoor',netPropagate=0)") + + + elif self.grtzDoorState == doorSDLstates['closedfail']: + doorResponder.run(self.key,state='NoAccess',netPropagate=0) + self.grtzDoorStack.append("doorResponder.run(self.key,state='NoAccess',netPropagate=0)") + + + elif self.grtzDoorState == doorSDLstates['open']: + doorResponder.run(self.key,state='OpenTheDoor',fastforward=1,netPropagate=0) + + + elif len(PtGetPlayerList()) < 1: + # the door is really shut, someone left it open + self.SDL['DoorOpen'] = (doorSDLstates['closed'],) + self.grtzDoorState = self.SDL['DoorOpen'][0] + print "grtzAccessDoors: Nobody is here, setting door states to closed." + + self.init = 1 + ########################################## + def OnNotify(self,state,id,events): + if not self.init: + return + + ageSDL = PtGetAgeSDL() + #Notify Section + if id == (-1): + print "grtzAccessDoors: Recieved Notify... Contents Are %s" % str(events[0][1]) + if events[0][1].find('rgnTriggerEnter') != -1 and self.sceneobject.isLocallyOwned(): + if self.grtzDoorState == doorSDLstates['closed']: + self.UpdateDoorState(doorSDLstates['opening']) + print "grtzAccessDoors: I triggered the region and I'm changing the sdl to opening." + + elif self.grtzDoorState == doorSDLstates['movingclosed'] or self.grtzDoorState == doorSDLstates['closing'] or self.grtzDoorState == doorSDLstates['closedfail']: + self.UpdateDoorState(doorSDLstates['closetoopen']) + print "grtzAccessDoors: I triggered the region and I'm changing the sdl to closetoopen." + + elif self.grtzDoorState == doorSDLstates['opentoclose']: + self.UpdateDoorState(doorSDLstates['movingopen']) + print "grtzAccessDoors: I triggered the region and I'm changing the sdl to movingopen." + + elif events[0][1].find('rgnTriggerExit') != -1 and self.sceneobject.isLocallyOwned(): + if self.grtzDoorState == doorSDLstates['open']: + self.UpdateDoorState(doorSDLstates['closing']) + print "grtzAccessDoors: I triggered the region and I'm changing the sdl to closing." + + elif self.grtzDoorState == doorSDLstates['movingopen'] or self.grtzDoorState == doorSDLstates['opening']: + self.UpdateDoorState(doorSDLstates['opentoclose']) + print "grtzAccessDoors: I triggered the region and I'm changing the sdl to opentoclose." + + elif self.grtzDoorState == doorSDLstates['closetoopen']: + self.UpdateDoorState(doorSDLstates['movingclosed']) + print "grtzAccessDoors: I triggered the region and I'm changing the sdl to movingclosed." + + elif events[0][1].find('rgnTriggerFail') != -1 and self.sceneobject.isLocallyOwned(): + if self.grtzDoorState == doorSDLstates['closed']: + self.UpdateDoorState(doorSDLstates['closedfail']) + + + + elif events[0][1].find('Responder') != -1 and events[0][1].find('rgnTriggerEnter') == -1 and events[0][1].find('rgnTriggerExit') == -1: + self.grtzDoorStack.append(events[0][1]) + print "grtzAccessDoors: New list is: %s" % (str(self.grtzDoorStack)) + + if len(self.grtzDoorStack) == 1: + print "grtzAccessDoors: List is only one command long, so I'm playing it" + code = self.grtzDoorStack[0] + print "grtzAccessDoors: Playing command: %s" % (code) + exec code + + ############################################################################################################ + elif events[0][1].find('DoorState') != 1 and events[0][1].find('rgnTriggerEnter') == -1 and events[0][1].find('rgnTriggerExit') == -1 and events[0][1].find('Responder') == -1 and events[0][1].find('rgnTriggerFail') == -1: + + curState = int(events[0][1].lstrip('DoorState=')) + print "grtzAccessDoors: Door State Updated to %d" % curState + print "grtzAccessDoors: Door State SDL Set to %d" % self.SDL['DoorOpen'][0] + + if curState != self.grtzDoorState: + self.grtzDoorState = curState + print "grtzAccessDoors: Door state is now %d" % self.grtzDoorState + return + + + + + ##################################################################################### + + + elif id == triggerRgn.id: + #Region Triggered + for event in events: + #true when you enter the region + + if event[0] == 1 and event[1] == 1 and PtFindAvatar(events) == PtGetLocalAvatar(): + if doorKiNeededBool.value == 0: + self.SendNote("rgnTriggerEnter") + return + + elif doorKiNeededBool.value == 1: + + if self.grtzDoorState == doorSDLstates['opentoclose']: + self.SendNote("rgnTriggerEnter") + return + + print "grtzAccessDoors: I triggered the region" + + if PtDetermineKIMarkerLevel() < kKIMarkerNormalLevel: + print "grtzAccessDoors: KiLevel too low, cannot open door" + self.SendNote("rgnTriggerFail") + return + else: + self.SendNote("rgnTriggerEnter") + + + #true when you leave the region + elif event[0] == 1 and event[1] == 0 and self.sceneobject.isLocallyOwned(): + + self.SendNote("rgnTriggerExit") + + + elif id == doorResponder.id: + + self.UpdateRespStack() + + if self.sceneobject.isLocallyOwned(): + if self.grtzDoorState == doorSDLstates['opentoclose']: + self.UpdateDoorState(doorSDLstates['closing']) + + elif self.grtzDoorState == doorSDLstates['movingopen'] or self.grtzDoorState == doorSDLstates['opening']: + self.UpdateDoorState(doorSDLstates['open']) + + elif self.grtzDoorState == doorSDLstates['closetoopen']: + self.UpdateDoorState(doorSDLstates['opening']) + + elif self.grtzDoorState == doorSDLstates['movingclosed'] or self.grtzDoorState == doorSDLstates['closing']: + self.UpdateDoorState(doorSDLstates['closed']) + + elif self.grtzDoorState == doorSDLstates['closedfail']: + self.UpdateDoorState(doorSDLstates['closed']) + + else: + print "grtzAccessDoors: Events that came through:\t", events +############################################################### + def SendNote(self, ExtraInfo): + notify = ptNotify(self.key) + notify.clearReceivers() + notify.addReceiver(self.key) + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + notify.addVarNumber(str(ExtraInfo),1.0) + notify.send() + + ########################################## + def UpdateRespStack (self): + #Updates the Responder List + old = self.grtzDoorStack.pop(0) + print "grtzAccessDoors: Getting rid of Resp: %s" % (old) + if len(self.grtzDoorStack): + print "grtzAccessDoors: There's at lest one more Resp to play." + code = self.grtzDoorStack[0] + print "Playing command: %s" % (code) + exec code + + def UpdateDoorState (self, StateNum): + if StateNum != self.grtzDoorState: + self.grtzDoorState = StateNum + self.SDL['DoorOpen'] = (StateNum,) + self.SendNote('DoorState='+str(StateNum)) + + if self.grtzDoorState == doorSDLstates['opening']: + self.SendNote("doorResponder.run(self.key,state='OpenTheDoor',netPropagate=0)") + print "grtzAccessDoors: Notifying Clients to play Open Door Responder" + + elif self.grtzDoorState == doorSDLstates['closing']: + self.SendNote("doorResponder.run(self.key,state='CloseTheDoor',netPropagate=0)") + print "grtzAccessDoors: Notifying Clients to play Close Door Responder" + + elif self.grtzDoorState == doorSDLstates['closedfail']: + self.SendNote("doorResponder.run(self.key,state='NoAccess',netPropagate=0)") + print "grtzAccessDoors: Notifying Clients to play Failed Door Responder" + diff --git a/Python/grtzGZMaster.py b/Python/grtzGZMaster.py new file mode 100644 index 0000000000..d635884e38 --- /dev/null +++ b/Python/grtzGZMaster.py @@ -0,0 +1,142 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: grtzGZMaster.py +Age: Great Zero +Date: December 2006 +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys +import string +import time + + +sdlGZActive = ptAttribString(1,"sdl: GZ active (beam)") +respGZActive = ptAttribResponder(2,"resp: GZ active",['Off','On']) +respGZActiveAtStart = ptAttribResponder(3,"resp: GZ active ON INIT",['Off','On']) + +boolGZActive = 0 + + +class grtzGZMaster(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 215 + self.version = 1 + PtDebugPrint("grtzGZMaster__init__(): version# %d" % (self.version)) + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global boolGZActive + ageSDL = PtGetAgeSDL() + + ageSDL.setFlags(sdlGZActive.value,1,1) + ageSDL.sendToClients(sdlGZActive.value) + ageSDL.setNotify(self.key,sdlGZActive.value,0.0) + + try: + boolGZActive = ageSDL[sdlGZActive.value][0] + except: + PtDebugPrint("ERROR: grtzGZMaster.OnServerInitComplete():\tERROR reading SDL name for GZActive") + boolGZActive = 0 + PtDebugPrint("DEBUG: grtzGZMaster.OnServerInitComplete():\t grtzGZActive = %d" % (ageSDL[sdlGZActive.value][0]) ) + + if boolGZActive: + respGZActiveAtStart.run(self.key,state="On") + else: + respGZActiveAtStart.run(self.key,state="Off") + + #self.AddSharperJournalChron("sjGreatZeroVisited") + + +# def AddSharperJournalChron(self, var): +# vault = ptVault() +# entry = vault.findChronicleEntry(var) +# if not entry: +# vault.addChronicleEntry(var, 0, str(int( time.time() )) ) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolGZActive + + if VARname == sdlGZActive.value: + ageSDL = PtGetAgeSDL() + boolGZActive = ageSDL[sdlGZActive.value][0] + #LocalAvatar = PtGetLocalAvatar() + if boolGZActive: + #respGZActive.run(self.key,state="On",avatar=LocalAvatar) + respGZActive.run(self.key,state="On") + #PtDisableMovementKeys() + #PtSendKIMessage(kDisableKIandBB,0) + else: + #respGZActive.run(self.key,state="Off",avatar=LocalAvatar) + respGZActive.run(self.key,state="Off") + + + def OnNotify(self,state,id,events): + PtDebugPrint("grtzGZMaster:OnNotify(): state=%f id=%d events=" % (state,id),events,level=kDebugDumpLevel) + + if not (state and PtWasLocallyNotified(self.key)): + return + + if id == respGZActive.id: + pass + #print "grtzGZMaster:OnNotify(): got callback from resp" + #PtEnableMovementKeys() + #PtSendKIMessage(kEnableKIandBB,0) + + + def OnBackdoorMsg(self, target, param): + if target == "gzactive": + ageSDL = PtGetAgeSDL() + tmpbeam = ageSDL[sdlGZActive.value][0] + if param == "on" or param == "1": + if not tmpbeam: + ageSDL[sdlGZActive.value] = (1,) + elif param == "off" or param == "0": + if tmpbeam: + ageSDL[sdlGZActive.value] = (0,) + elif target == "gzstate": + ageSDL = PtGetAgeSDL() + ageSDL.setFlags("grtzGreatZeroState",1,1) + ageSDL.sendToClients("grtzGreatZeroState") + ageSDL.setNotify(self.key,"grtzGreatZeroState",0.0) + tmpmachine = ageSDL["grtzGreatZeroState"][0] + if param == "on" or param == "1": + if not tmpmachine: + ageSDL["grtzGreatZeroState"] = (1,) + elif param == "off" or param == "0": + if tmpmachine: + ageSDL["grtzGreatZeroState"] = (0,) + diff --git a/Python/grtzKIMarkerMachine.py b/Python/grtzKIMarkerMachine.py new file mode 100644 index 0000000000..d8cb07fa86 --- /dev/null +++ b/Python/grtzKIMarkerMachine.py @@ -0,0 +1,534 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: grtzKIMarkerMachine +Age: GreatZero +Date: Nov. 10, 2003 +Author: Mark DeForest +This for the KI marker machine in the GreatZero near the link area +""" +MaxVersionNumber = 2 +MinorVersionNumber = 4 + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import string +import xLinkingBookDefs +from xPsnlVaultSDL import * + +aKISlotAct = ptAttribActivator(1,"KI Slot activator") +aKIAvatarResp = ptAttribResponder(2, "Avatar Behavior resp",statelist=["Short","Longer"]) +aKILogoResp = ptAttribResponder(3, "Show KI Logo resp") +aKILightsResp = ptAttribResponderList(4, "Light Responder List",statelist=["LightOn","LightOff"],byObject=1) +aKISoundsResp = ptAttribResponder(5, "Sound responder",statelist=["UpLoadMarkers","DownLoadMarkers","ShowMarkers"]) + +gGZPlaying = 0 +gGZMarkerInRange = 0 +gGZMarkerInRangeRepy = None +# what is the to get color +gMarkerToGetColor = 'off' +gMarkerGottenColor = 'off' +gMarkerToGetNumber = 0 +gMarkerGottenNumber = 0 + +gMarkerTargetToGetNumber = 0 + +gAvatar = None + +gIsDownloadingLastGame = 0 + +#--- -constants +kLightShiftOnDelaySeconds = 0.1 +kLightShiftOnID = 100 + +kTimeInbetweenDownAndUpload = 1.5 + +kLightShiftOffDelaySeconds = 0.1 +kLightShiftOffID = 200 + +kLightsOffSeconds = 2 +kLightsOffDelayID = 10 + +kReEnableClickableSeconds = 8 +kReEnableClickableID = 500 +kNumGZMarkers = 40 + +gLightRespNames = [\ + "cRespKIMachLight01",\ + "cRespKIMachLight02",\ + "cRespKIMachLight03",\ + "cRespKIMachLight04",\ + "cRespKIMachLight05",\ + "cRespKIMachLight06",\ + "cRespKIMachLight07",\ + "cRespKIMachLight08",\ + "cRespKIMachLight09",\ + "cRespKIMachLight10",\ + "cRespKIMachLight11",\ + "cRespKIMachLight12",\ + "cRespKIMachLight13",\ + "cRespKIMachLight14",\ + "cRespKIMachLight15",\ + ] + +#Utility classes +def ResetMarkerGame(): + "Resets marker game chronicle states" + #This is used for when the KI or the grtzKIMarkerMachine entcounters a corrupted vault + vault = ptVault() + + # First, reset the KI Marker Level + entry = vault.findChronicleEntry(kChronicleKIMarkerLevel) + if type(entry) != type(None): + entry.chronicleSetValue("0") + entry.save() + + # Next, reset the Marker's Aquired Data + UpdateGZMarkers(kGZMarkerInactive) + + # Now reset the chronicle display settings + resetString = "0 off:off 0:0" + entry = vault.findChronicleEntry(kChronicleGZGames) + if type(entry) != type(None): + entry.chronicleSetValue(resetString) + + #Who knows what state we were in so we'll reset the CGZs as well!!! + PtSendKIMessage(kMGStopCGZGame, 0) + + # Finally, update the KI display + PtSendKIMessage(kGZUpdated,0) + +def UpdateGZMarkers(markerStatus): + "Stops the actual markers from being displayed in the game" + statusTypes = (kGZMarkerInactive, kGZMarkerAvailable, kGZMarkerCaptured, kGZMarkerUploaded) + + if not markerStatus in statusTypes: + PtDebugPrint("ERROR: grtzKIMarkerMachine.UpdateGZMarkers(): Invalid markerStatus: %s" %markerStatus) + return + + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleGZMarkersAquired) + if type(entry) != type(None): + markers = entry.chronicleGetValue() + resetValue = markerStatus * len(markers) + entry.chronicleSetValue(resetValue) + entry.save() + else: + markers = markerStatus * kNumGZMarkers + vault.addChronicleEntry(kChronicleGZMarkersAquired,kChronicleGZMarkersAquiredType,markers) + +class grtzKIMarkerMachine(ptModifier): + + def __init__(self): + ptModifier.__init__(self) + self.id = 206 + self.version = MaxVersionNumber + PtDebugPrint("grtzKIMarkerMachine: Max version %d - minor version %d.1" % (MaxVersionNumber,MinorVersionNumber),level=kDebugDumpLevel) + + def OnNotify(self,state,id,events): + "Notify from region sensor or from the KI" + global gAvatar + global gIsDownloadingLastGame + global kNumGZMarkers + PtDebugPrint("grtzKIMarkerMachine: Notify state=%f, id=%d" % (state,id),level=kDebugDumpLevel) + + # if this is from the region sensor, then determine if this + if id == aKISlotAct.id: + avatar = PtFindAvatar(events) + # disable the clickable, so that someone else doesn't try using it until we're done with it + aKISlotAct.disable() + gAvatar = avatar + if state: + # the avatar responder ... the avatar's hand is in the KI slot + if PtDetermineKILevel() >= kNormalKI: + # Run the avatar behavior responder + aKIAvatarResp.run(self.key,avatar=avatar,state='Longer') + else: + aKIAvatarResp.run(self.key,avatar=avatar,state='Short') + if gAvatar != PtGetLocalAvatar(): + PtAtTimeCallback(self.key, kReEnableClickableSeconds, kReEnableClickableID) + if id == aKIAvatarResp.id: + # make sure this is our avatar + if gAvatar != PtGetLocalAvatar(): + return + # the avatar responder ... the avatar's hand is in the KI slot + if PtDetermineKILevel() >= kNormalKI: + # show the logo: + aKILogoResp.run(self.key) + # pop up their miniKI + PtSendKIMessage(kKIShowMiniKI,0) + # determine where they are in the GZMarker thing + markerKILevel = PtDetermineKIMarkerLevel() + + if markerKILevel > kKIMarkerFirstLevel: + print "Making Sure Nexus Link Exists." + self.IUpdateNexusLink() + + #Don't try and get the game if we've got a normal KI marker level (i.e. finished with first two marker games) + #It will clobber any marker game progress if we try! + if markerKILevel >= kKIMarkerNormalLevel: + # they are finished with this... nothing to do + PtDebugPrint("grtzKIMarkerMachine: They're all done with this!",level=kDebugDumpLevel) + aKISlotAct.enable() + return + + + self.IGetGZGame() + gIsDownloadingLastGame = 0 + # is this the first time? + if markerKILevel == kKIMarkerNotUpgraded: + PtDebugPrint("grtzKIMarkerMachine: Starting first GZ game",level=kDebugDumpLevel) + PtSendKIMessageInt(kUpgradeKIMarkerLevel,kKIMarkerFirstLevel) + self.IUploadGame1() + PtSendKIMessageInt(kGZUpdated, kNumGZMarkers) + #Ensure that the chronicle entry is setup correctly + #The case we're most concerned with is a vault corruption issue where the chronicle entry exists, but is not initialized correctly + #Since we're turning on for the first time, we'll enable each marker + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleGZMarkersAquired) + if type(entry) == type(None): + # if there is none, then just add another entry - start off as active + markers = kGZMarkerAvailable * kNumGZMarkers + vault.addChronicleEntry(kChronicleGZMarkersAquired,kChronicleGZMarkersAquiredType,markers) + else: + markers = kGZMarkerAvailable * kNumGZMarkers + entry.chronicleSetValue(markers) + entry.save() + + # after fun with lights then the activator will be enabled + # are we working on the first game... is it done? + elif markerKILevel == kKIMarkerFirstLevel: + if gMarkerGottenNumber >= gMarkerToGetNumber: + PtDebugPrint("grtzKIMarkerMachine: Done with first game",level=kDebugDumpLevel) + # they got them all... download them + PtSendKIMessageInt(kUpgradeKIMarkerLevel,kKIMarkerSecondLevel) + self.IDownloadGame1() + # after fun with lights then the activator will be enabled + else: + PtDebugPrint("grtzKIMarkerMachine: In the middle of the first game...",level=kDebugDumpLevel) + self.IShowCurrentGame() + aKISlotAct.enable() + elif markerKILevel == kKIMarkerSecondLevel: + PtDebugPrint("grtzKIMarkerMachine: In the middle of the second game",level=kDebugDumpLevel) + if gMarkerGottenNumber >= gMarkerToGetNumber: + PtDebugPrint("grtzKIMarkerMachine: Done with second game",level=kDebugDumpLevel) + gIsDownloadingLastGame = 1 + self.IDownloadGame2() + UpdateGZMarkers(kGZMarkerUploaded) + PtSendKIMessage(kGZUpdated,0) + # after fun with lights then the activator will be enabled + else: + PtDebugPrint("grtzKIMarkerMachine: In the middle of the second game...",level=kDebugDumpLevel) + self.IShowCurrentGame() + aKISlotAct.enable() + else: + # if they don't have a KI then do nothing... + PtDebugPrint("grtzKIMarkerMachine: KI level not high enough",level=kDebugDumpLevel) + aKISlotAct.enable() + + def IGetGZGame(self): + global gGZPlaying + global gMarkerGottenColor + global gMarkerToGetColor + global gMarkerGottenNumber + global gMarkerToGetNumber + vault = ptVault() + # is there a chronicle for the GZ games? + entry = vault.findChronicleEntry(kChronicleGZGames) + error = 0 + if type(entry) != type(None): + markerGameString = entry.chronicleGetValue() + args = markerGameString.split() + + if len(args) == 3: + try: + gGZPlaying = string.atoi(args[0]) + colors = args[1].split(':') + outof = args[2].split(':') + if len(colors) != 2 or len(outof) != 2: + raise ValueError + + gMarkerGottenColor = colors[0] + gMarkerToGetColor = colors[1] + gMarkerGottenNumber = string.atoi(outof[0]) + gMarkerToGetNumber = string.atoi(outof[1]) + return + except: + PtDebugPrint("grtzKIMarkerMachine - error trying to read GZGames Chronicle",level=kErrorLevel) + error = 1 + else: + PtDebugPrint("grtzKIMarkerMachine - error GZGames string formation error",level=kErrorLevel) + error = 1 + gGZPlaying = 0 + gMarkerGottenColor = 'off' + gMarkerToGetColor = 'off' + gMarkerGottenNumber = 0 + gMarkerToGetNumber = 0 + #We'll save the game now (this will help reduce vault corruption issues (i.e. the 1515 bug). + self.ISetGZGame() + + if error: + # This is a vault corruption issue... yes, very bad + # We're going to re-initialize the marker games to give the user a chance to go on + # Although I'm sure they'll still be upset! + PtDebugPrint("grtzKIMarkerMachine - vault corruption error: RESETTING all Marker Game data!!!!", level=kErrorLevel) + ResetMarkerGame() + + + + + def IFlashGZGame(self): + global gGZPlaying + global gMarkerGottenColor + global gMarkerToGetColor + global gMarkerGottenNumber + global gMarkerToGetNumber + # flash the markers in the miniKI + upstring = "%d %s:%s %d:%d" % (gGZPlaying,gMarkerGottenColor,gMarkerToGetColor,gMarkerGottenNumber,gMarkerToGetNumber) + PtSendKIMessage(kGZFlashUpdate,upstring) + + def ISetGZGame(self): + global gGZPlaying + global gMarkerGottenColor + global gMarkerToGetColor + global gMarkerGottenNumber + global gMarkerToGetNumber + # set the markers in the miniKI + vault = ptVault() + # is there a chronicle for the GZ games? + entry = vault.findChronicleEntry(kChronicleGZGames) + upstring = "%d %s:%s %d:%d" % (gGZPlaying,gMarkerGottenColor,gMarkerToGetColor,gMarkerGottenNumber,gMarkerToGetNumber) + 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) + + def IUploadGame1(self): + "Upload the first game of 15 GZMarkers" + global gGZPlaying + global gMarkerGottenColor + global gMarkerToGetColor + global gMarkerGottenNumber + global gMarkerToGetNumber + global gMarkerTargetToGetNumber + PtDebugPrint("grtzKIMarkerMachine - uploading game 1 - shifting lights",level=kDebugDumpLevel) + aKISoundsResp.run(self.key,state='UpLoadMarkers') + gGZPlaying = 1 + gMarkerGottenColor = 'green' + gMarkerToGetColor = 'greenlt' + gMarkerGottenNumber = 0 + gMarkerToGetNumber = 0 + gMarkerTargetToGetNumber = 15 + PtAtTimeCallback(self.key, kLightShiftOnDelaySeconds, kLightShiftOnID) + + def IRefreshNextLightOn(self): + "turn on a light and set miniKIlight on, also" + global gMarkerToGetNumber + global gMarkerTargetToGetNumber + if gMarkerToGetNumber < gMarkerTargetToGetNumber: + PtDebugPrint("grtzKIMarkerMachine - lighting light %d"%(gMarkerToGetNumber+1),level=kDebugDumpLevel) + lidx = gMarkerToGetNumber + aKILightsResp.run(self.key,state='LightOn',objectName=gLightRespNames[lidx]) + gMarkerToGetNumber += 1 + self.IFlashGZGame() + PtAtTimeCallback(self.key, kLightShiftOnDelaySeconds, kLightShiftOnID) + else: + PtDebugPrint("grtzKIMarkerMachine - all done shifting",level=kDebugDumpLevel) + gMarkerToGetNumber = gMarkerTargetToGetNumber + self.ISetGZGame() + PtSendKIMessage(kGZUpdated,0) + PtAtTimeCallback(self.key, kLightsOffSeconds, kLightsOffDelayID) + + def IDownloadGame1(self): + "Download the first games GZMarkers" + aKISoundsResp.run(self.key,state='DownLoadMarkers') + aKILightsResp.run(self.key,state='LightOn') + PtAtTimeCallback(self.key, kLightShiftOffDelaySeconds, kLightShiftOffID) + + def IRefreshNextLightOff(self): + "turn on a light and set miniKIlight on, also" + global gMarkerToGetNumber + global gMarkerTargetToGetNumber + global gIsDownloadingLastGame + if gMarkerToGetNumber > 0: + gMarkerToGetNumber -= 1 + lidx = gMarkerToGetNumber + aKILightsResp.run(self.key,state='LightOff',objectName=gLightRespNames[lidx]) + self.IFlashGZGame() + PtAtTimeCallback(self.key, kLightShiftOffDelaySeconds, kLightShiftOffID) + else: + # need to start next thing... if there is one + if not gIsDownloadingLastGame: + self.IUploadGame2() + else: + # else that's all there is to do + # wipe out the last game + vault = ptVault() + # is there a chronicle for the GZ games? + entry = vault.findChronicleEntry(kChronicleGZGames) + if type(entry) != type(None): + entry.chronicleSetValue("0") + entry.save() + # they've made it to the next level + PtSendKIMessageInt(kUpgradeKIMarkerLevel,kKIMarkerNormalLevel) + # re-enable the activator + aKISlotAct.enable() + + def IUploadGame2(self): + "Upload the second game of 15 GZMarkers" + global gGZPlaying + global gMarkerGottenColor + global gMarkerToGetColor + global gMarkerGottenNumber + global gMarkerToGetNumber + global gMarkerTargetToGetNumber + self.IUpdateNexusLink() + PtDebugPrint("grtzKIMarkerMachine - uploading game 1 - shifting lights",level=kDebugDumpLevel) + aKISoundsResp.run(self.key,state='UpLoadMarkers') + gGZPlaying = 2 + gMarkerGottenColor = 'red' + gMarkerToGetColor = 'redlt' + gMarkerGottenNumber = 0 + gMarkerToGetNumber = 0 + gMarkerTargetToGetNumber = 15 + PtAtTimeCallback(self.key, kTimeInbetweenDownAndUpload, kLightShiftOnID) + + def IDownloadGame2(self): + "Download the second games GZMarkers" + aKILightsResp.run(self.key,state='LightOn') + PtAtTimeCallback(self.key, kLightShiftOffDelaySeconds, kLightShiftOffID) + + def IShowCurrentGame(self): + "display what they've gotten so far... sorta" + if gMarkerGottenNumber == 0: + PtDebugPrint("grtzKIMarkerMachine - turn all the lights on",level=kDebugDumpLevel) + aKISoundsResp.run(self.key,state='ShowMarkers') + aKILightsResp.run(self.key,state='LightOn') + else: + PtDebugPrint("grtzKIMarkerMachine - turn only %d lights on" % (gMarkerToGetNumber-gMarkerGottenNumber),level=kDebugDumpLevel) + aKISoundsResp.run(self.key,state='ShowMarkers') + for idx in range(gMarkerGottenNumber,gMarkerToGetNumber): + aKILightsResp.run(self.key,state='LightOn',objectName=gLightRespNames[idx]) + PtAtTimeCallback(self.key, kLightsOffSeconds, kLightsOffDelayID) + + def IGetHoodLinkNode(self): + vault = ptVault() + folder = vault.getAgesIOwnFolder() + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if type(link) != type(None): + info = link.getAgeInfo() + if not info: continue + ageName = info.getAgeFilename() + if ageName == "Neighborhood": + return link + return None + + def IGetHoodInfoNode(self): + link = self.IGetHoodLinkNode() + if type(link) == type(None): + return None + info = link.getAgeInfo() + return info + + def IUpdateNexusLink(self): + childAgeFolder = self.IGetHoodInfoNode().getChildAgesFolder() + contents = childAgeFolder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + name = link.getAgeInfo().getAgeFilename() + if name == "GreatZero": + GZSpawnPoints = link.getSpawnPoints() + for SpawnPoint in GZSpawnPoints: + title = SpawnPoint.getTitle().lower() + name = SpawnPoint.getName().lower() + #print "Title: %s\nName: %s" % (title,name) + if title == "great zero" and name == "bigroomlinkinpoint": + print "grtzKIMarkerMachine: Nexus link already exists." + return + #self.IDoCityLinksChron("BigRoomLinkInPoint") # this will be used if we want to add this to the city book + outerRoomSP = ptSpawnPointInfo("Great Zero","BigRoomLinkInPoint") + #print "NewSpawnPointInfo\nName: %s\nTitle: %s" % (outerRoomSP.getName(), outerRoomSP.getTitle()) + link.addSpawnPoint(outerRoomSP) + link.save() + print "grtzKIMarkerMachine: Nexus link added." + PtSendKIMessage(kKILocalChatStatusMsg,PtGetLocalizedString("KI.Messages.NexusLinkAdded")) + PtDebugPrint("grtzKIMarkerMachine - setting new spawn point for GZ",level=kDebugDumpLevel) + return + PtDebugPrint("grtzKIMarkerMachine - error - could not find link to add spawnpoint to") + + def OnTimer(self,id): + if id == kLightsOffDelayID: + if gMarkerGottenNumber == 0: + PtDebugPrint("grtzKIMarkerMachine - turn all the lights off",level=kDebugDumpLevel) + aKILightsResp.run(self.key,state='LightOff') + else: + PtDebugPrint("grtzKIMarkerMachine - turn only %d lights off" % (gMarkerToGetNumber-gMarkerGottenNumber),level=kDebugDumpLevel) + for idx in range(gMarkerGottenNumber,gMarkerToGetNumber): + aKILightsResp.run(self.key,state='LightOff',objectName=gLightRespNames[idx]) + aKISlotAct.enable() + elif id == kLightShiftOnID: + self.IRefreshNextLightOn() + elif id == kLightShiftOffID: + self.IRefreshNextLightOff() + elif id == kReEnableClickableID: + aKISlotAct.enable() + + + def IDoCityLinksChron(self,agePanel): # ganked from xLinkingBookGUIPopup.py + CityLinks = [] + vault = ptVault() + entryCityLinks = vault.findChronicleEntry("CityBookLinks") + if type(entryCityLinks) != type(None): + valCityLinks = entryCityLinks.chronicleGetValue() + print "valCityLinks = ",valCityLinks + CityLinks = valCityLinks.split(",") + print "CityLinks = ",CityLinks + if agePanel not in CityLinks: + NewLinks = valCityLinks + "," + agePanel + entryCityLinks.chronicleSetValue(NewLinks) + entryCityLinks.save() + print "grtzKIMarkerMachine.IDoCityLinksChron(): setting citylinks chron entry to include: ",agePanel + valCityLinks = entryCityLinks.chronicleGetValue() + CityLinks = valCityLinks.split(",") + print "grtzKIMarkerMachine.IDoCityLinksChron(): citylinks now = ",CityLinks + else: + print "grtzKIMarkerMachine.IDoCityLinksChron(): do nothing, citylinks chron already contains: ",agePanel + else: + vault.addChronicleEntry("CityBookLinks",0,agePanel) + print "grtzKIMarkerMachine.IDoCityLinksChron(): creating citylinks chron entry and adding: ",agePanel + + psnlSDL = xPsnlVaultSDL() + GotBook = psnlSDL["psnlGotCityBook"][0] + if not GotBook: + psnlSDL["psnlGotCityBook"] = (1,) + print "grtzKIMarkerMachine.IDoCityLinksChron(): setting SDL for city book to 1" \ No newline at end of file diff --git a/Python/grtzMarkerGames.py b/Python/grtzMarkerGames.py new file mode 100644 index 0000000000..8b92d8a637 --- /dev/null +++ b/Python/grtzMarkerGames.py @@ -0,0 +1,485 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +kChronCurCGZGame = "CurCGZGame" + + +from Plasma import * +from PlasmaTypes import * +import string +import xMarkerGameManager + +def GetCGZGameName(num): + "returns the name of the game" + if num < 0: + return None + + try: + mg = mgs[num] + return mg[1] + except: + return None + +def GetCurrentCGZGame(): + "return which game (if any) is playing now" + gameData = xMarkerGameManager.chronicleMarkerGameData() + return gameData.data['CGZGameNum'] + +def GetCurrentGameType(): + "returns which game type (if any) is currently played" + gameData = xMarkerGameManager.chronicleMarkerGameData() + return gameData.data['svrGameTypeID'] + + +def UpdateScore(gameNum, startTime, bestTime): + "Updates the score of a specified game, only updates best time if it's a better time" + #TODO: Tye: We need to change this from 14 single entries in the chronicle, to a single entry! + + #SPECIAL NOTES: + # If startTime < 0 or bestTime < 0 it will NOT update the corresponding value! + if gameNum < 0 or gameNum > len(mgs): + PtDebugPrint("ERROR: grtzMarkerGames.UpdateScore():\tAborting update, invalid game number: %s" %gameNum) + return + + vault = ptVault() + gameName = GetCGZGameName(gameNum) + entry = vault.findChronicleEntry(gameName) + isNewBestTime = 0 + + if type(entry) == type(None): + # Here we actually do need to save a startTime value (negative is invalid) + # But only if we're creating a new variable! + if startTime < 0: + startTime = 0.0 + vault.addChronicleEntry(gameName, 1, "%f,%f" % (startTime, bestTime)) + + if bestTime > 0: + isNewBestTime = 1 + PtDebugPrint("grtzMarkerGames.UpdateScore():\tDEBUG: Found no previous bestTime entry, setting new best time!") + + PtDebugPrint("grtzMarkerGames.UpdateScore():\tDEBUG: Game Num: %d, updated for the first time: StartTime = %f BestTime = %f" %(gameNum,startTime,bestTime)) + return + else: + statString = entry.chronicleGetValue() + statList = statString.split(",") + + if len(statList) == 2: + try: + # If we're not updating startTime, then we'd better get the old one! + if startTime < 0: + startTime = string.atof(statList[0]) + + #Only update bestTime if we have a better time + oldBestTime = string.atof(statList[1]) + if bestTime > 0.1: + if bestTime < oldBestTime or oldBestTime < 0.1: + isNewBestTime = 1 + PtDebugPrint("grtzMarkerGames.UpdateScore():\tDEBUG: Found new best time, updating... old best time score: %f" % oldBestTime) + else: + bestTime = oldBestTime + else: + bestTime = oldBestTime + except: + pass + + PtDebugPrint("grtzMarkerGames.UpdateScore():\tDEBUG: Game Num: %d, updated score: Start Time = %f BestTime = %f" %(gameNum,startTime,bestTime)) + entry.chronicleSetValue("%f,%f" %(startTime,bestTime)) + entry.save() + +def GetGameTime(gameName): + "returns the currentTime,bestTime" + # assume no times + startTime = 0.0 + bestTime = 0.0 + vault = ptVault() + + # is there a chronicle for the GZ games? + entry = vault.findChronicleEntry(gameName) + if type(entry) != type(None): + progressString = entry.chronicleGetValue() + progList = progressString.split(',') + if len(progList) == 2: + try: + startTime = string.atof(progList[0]) + except ValueError: + pass + try: + bestTime = string.atof(progList[1]) + except ValueError: + pass + return startTime,bestTime + +def GetGameProgress(): + "returns the game number, number of captured markers, and number of markers for the currently played game" + gameData = xMarkerGameManager.chronicleMarkerGameData() + return gameData.data['CGZGameNum'], gameData.data['numCapturedMarkers'], gameData.data['numMarkers'] + + +def GetGameScore(gameNum): + "returns the score for the specified CGZ game number" + vault = ptVault() + gameName = GetCGZGameName(gameNum) + entry = vault.findChronicleEntry(gameName) + if type(entry) == type(None): + return -1 + + statString = entry.chronicleGetValue() + statList = statString.split(",") + + #Make sure that we've got the correct input + if len(statList) != 2: + if statString != "": + #If we're here, then we've got corrupted stats, delete existing game stats! + entry.chronicle.SetValue("") + entry.save() + return -1 + + try: + bestTime = string.atof(statList[1]) + except: + bestTime = -1 + return bestTime + + +def GetNumMarkers(gameNum): + "returns the number of markers in this game" + try: + mg = mgs[gameNum] + return len(mg[0][4]) + except: + return 0 + +# [ ownerID,ownerName,type,roundLength, +# [ [markerText,x,y,z,age,torans,hspans,vspans],]] +# +# GZ markers one +MG01 = [ 1, "GZ guy", 2, 120 , + [ + [ "3, 53, -80", 0.113123, -156.593, 221.15, "city", 3, 53, -80 ], + [ "62334, 63, -85", 17.0199, -315.718, 144.806, "city", 62334, 63, -85 ], + [ "62432, 63, -86", 6.97063, -312.509, 131.561, "city", 62432, 63, -86 ], + [ "62143, 71, -89", 40.9337, -437.902, 82.8586, "city", 62143, 71, -89 ], + [ "32257, 84, -93", -142.135, -634.978, 8.21551, "city", 32257, 84, -93 ], + [ "61728, 78, -93", 97.9118, -555.991, 6.74272, "city", 61728, 78, -93 ], + [ "61363, 80, -93", 146.221, -571.129, 9.02309, "city", 61363, 80, -93 ], + [ "61984, 75, -93", 62.3171, -496.638, 6.83943, "city", 61984, 75, -93 ], + [ "61188, 45, -79", 95.1365, -14.2289, 243.928, "city", 61188, 45, -79 ], + [ "59651, 44, -76", 198.983, 27.1469, 291.171, "city", 59651, 44, -76 ], + [ "60329, 44, -76", 154.969, 4.03381, 290.841, "city", 60329, 44, -76 ], + [ "9, 64, -85", -0.621237, -329.797, 135.381, "city", 9, 64, -85 ], + ] +] + +MG02 = [ 1, "GZ guy", 2, 120 , + [ + [ "56815, 100, -79", 866.687, -645.153, 238.134, "city", 56815, 100, -79 ], + [ "56972, 104, -79", 884.89, -722.404, 232.785, "city", 56972, 104, -79 ], + [ "56953, 99, -79", 840.865, -645.9, 244.26, "city", 56953, 99, -79 ], + [ "61041, 70, -84", 164.1, -408.321, 162.822, "city", 61041, 70, -84 ], + [ "32495, 62, -86", -130.384, -284.278, 127.039, "city", 32495, 62, -86 ], + [ "32479, 62, -86", -128.733, -283.422, 127.041, "city", 32479, 62, -86 ], + [ "32461, 62, -86", -126.874, -283.311, 127.042, "city", 32461, 62, -86 ], + [ "32452, 62, -86", -125.991, -283.299, 127.043, "city", 32452, 62, -86 ], + [ "32143, 58, -86", -90.4871, -233.48, 127.11, "city", 32143, 58, -86 ], + [ "32372, 59, -86", -112.979, -239.741, 127.444, "city", 32372, 59, -86 ], + [ "32449, 59, -86", -121.025, -244.955, 131.027, "city", 32449, 59, -86 ], + [ "32712, 60, -86", -147.008, -248.051, 127.11, "city", 32712, 60, -86 ], + [ "33992, 44, -80", -199.518, 19.7047, 225.826, "city", 33992, 44, -80 ], + [ "34005, 44, -80", -199.09, 24.6076, 225.826, "city", 34005, 44, -80 ], + [ "33954, 43, -80", -193.792, 30.2368, 225.826, "city", 33954, 43, -80 ], + [ "34580, 43, -78", -234.291, 47.5248, 253.739, "city", 34580, 43, -78 ], + [ "35207, 45, -78", -290.803, 25.9652, 254.499, "city", 35207, 45, -78 ], + [ "35030, 40, -78", -245.232, 104.78, 254.478, "city", 35030, 40, -78 ], + [ "60876, 66, -83", 173.349, -349.866, 180.313, "city", 60876, 66, -83 ], + [ "56945, 99, -79", 841.677, -644.558, 244.414, "city", 56945, 99, -79 ], + [ "60826, 66, -83", 179.525, -354.162, 180.313, "city", 60826, 66, -83 ], + [ "61133, 77, -84", 169.036, -519.697, 160.798, "city", 61133, 77, -84 ], + [ "56971, 99, -79", 839.212, -648.525, 243.975, "city", 56971, 99, -79 ], + [ "57070, 101, -81", 845.905, -690.159, 209.033, "city", 57070, 101, -81 ], + ] +] +MG03 = [ 1, "GZ guy", 2, 120 , + [ + [ "57090, 94, -78", 779.755, -587.08, 259.243, "city", 57090, 94, -78 ], + [ "58559, 73, -75", 454.014, -382.702, 297.221, "city", 58559, 73, -75 ], + [ "57287, 109, -78", 873.06, -808.26, 259.243, "city", 57287, 109, -78 ], + [ "56817, 111, -78", 966.86, -801.529, 259.254, "city", 56817, 111, -78 ], + [ "57116, 107, -78", 885.322, -770.273, 259.243, "city", 57116, 107, -78 ], + [ "57046, 107, -77", 898.188, -768.307, 269.941, "city", 57046, 107, -77 ], + [ "56510, 107, -77", 972.309, -712.254, 269.975, "city", 56510, 107, -77 ], + [ "56679, 98, -77", 867.876, -607.192, 269.983, "city", 56679, 98, -77 ], + [ "57191, 99, -77", 806.465, -662.197, 269.863, "city", 57191, 99, -77 ], + [ "57473, 87, -78", 675.79, -518.872, 256.664, "city", 57473, 87, -78 ], + [ "58059, 71, -78", 491.578, -324.465, 251.259, "city", 58059, 71, -78 ], + ] +] +MG04 = [ 1, "GZ guy", 2, 120 , + [ + [ "60415, 78, -79", 262.733, -532.497, 239.805, "city", 60415, 78, -79 ], + [ "60676, 77, -80", 225.478, -513.173, 216.521, "city", 60676, 77, -80 ], + [ "32205, 84, -93", -135.211, -637.171, 10.4902, "city", 32205, 84, -93 ], + [ "57235, 109, -78", 881.076, -803.77, 259.244, "city", 57235, 109, -78 ], + [ "57253, 108, -78", 877.444, -803.838, 259.244, "city", 57253, 108, -78 ], + [ "57287, 108, -78", 870.754, -803.964, 259.244, "city", 57287, 108, -78 ], + [ "57438, 107, -79", 840.792, -804.53, 246.271, "city", 57438, 107, -79 ], + [ "5, 63, -85", -0.0876787, -314.3, 144.145, "city", 5, 63, -85 ], + [ "62339, 53, -80", 13.9271, -154.523, 224.159, "city", 62339, 53, -80 ], + [ "31905, 50, -80", -59.7848, -110.308, 221.673, "city", 31905, 50, -80 ], + [ "32534, 54, -80", -118.658, -163.122, 221.597, "city", 32534, 54, -80 ], + [ "32813, 55, -80", -146.071, -180.047, 218.473, "city", 32813, 55, -80 ], + [ "33459, 59, -82", -215.992, -225.902, 186.949, "city", 33459, 59, -82 ], + [ "33293, 58, -82", -197.099, -213.275, 194.361, "city", 33293, 58, -82 ], + [ "32998, 57, -80", -165.729, -195.325, 220.011, "city", 32998, 57, -80 ], + [ "61600, 51, -80", 75.1814, -125.345, 223.846, "city", 61600, 51, -80 ], + [ "60901, 65, -83", 167.221, -328.274, 178.47, "city", 60901, 65, -83 ], + [ "60287, 67, -83", 238.621, -351.974, 181.112, "city", 60287, 67, -83 ], + [ "59951, 73, -83", 296.351, -428.617, 178.973, "city", 59951, 73, -83 ], + [ "59898, 78, -79", 323.009, -503.966, 244.604, "city", 59898, 78, -79 ], + ] +] +MG05 = [ 1, "GZ guy", 2, 120 , + [ + [ "60315, 43, -76", 152.191, 21.0605, 293.854, "city", 60315, 43, -76 ], + [ "58121, 56, -78", 383.555, -111.711, 257.587, "city", 58121, 56, -78 ], + [ "57888, 47, -76", 343.068, 16.5379, 292.971, "city", 57888, 47, -76 ], + [ "58029, 45, -76", 318.848, 41.6997, 291.357, "city", 58029, 45, -76 ], + [ "62028, 53, -80", 40.6364, -152.596, 224.379, "city", 62028, 53, -80 ], + [ "61452, 59, -82", 100.535, -247.86, 193.841, "city", 61452, 59, -82 ], + [ "57064, 94, -78", 782.075, -583.084, 259.243, "city", 57064, 94, -78 ], + [ "57268, 87, -78", 704.187, -510.593, 259.243, "city", 57268, 87, -78 ], + [ "56531, 86, -75", 779.124, -436.175, 296.512, "city", 56531, 86, -75 ], + [ "56122, 83, -75", 798.406, -367.264, 297.593, "city", 56122, 83, -75 ], + [ "56783, 77, -75", 672.346, -335.633, 297.594, "city", 56783, 77, -75 ], + [ "57442, 66, -75", 521.539, -233.122, 294.92, "city", 57442, 66, -75 ], + [ "58796, 74, -75", 431.085, -401.132, 294.896, "city", 58796, 74, -75 ], + [ "59227, 77, -75", 399.419, -467.361, 299.302, "city", 59227, 77, -75 ], + [ "59302, 82, -77", 416.217, -547.247, 277.85, "city", 59302, 82, -77 ], + [ "59674, 82, -79", 370.373, -565.982, 239.353, "city", 59674, 82, -79 ], + [ "59992, 76, -79", 306.196, -485.725, 243.624, "city", 59992, 76, -79 ], + [ "60421, 78, -79", 262.047, -532.807, 237.377, "city", 60421, 78, -79 ], + [ "60536, 74, -81", 234.399, -468.967, 208.197, "city", 60536, 74, -81 ], + [ "60288, 73, -81", 261.147, -452.115, 206.569, "city", 60288, 73, -81 ], + [ "59939, 73, -83", 298.73, -431.849, 178.966, "city", 59939, 73, -83 ], + [ "60343, 66, -83", 230.511, -343.587, 178.72, "city", 60343, 66, -83 ], + [ "60667, 65, -83", 191.976, -327.469, 178.508, "city", 60667, 65, -83 ], + [ "61584, 46, -80", 68.7406, -40.7315, 230.585, "city", 61584, 46, -80 ], + [ "58848, 42, -76", 244.142, 67.786, 291.356, "city", 58848, 42, -76 ], +# [ "57756, 45, -76", 332.792, 58.5213, 291.296, "city", 57756, 45, -76 ], +# [ "58265, 52, -77", 349.096, -67.2592, 274.02, "city", 58265, 52, -77 ], +# [ "57142, 56, -75", 462.965, -72.0451, 297.591, "city", 57142, 56, -75 ], + ] +] +MG06 = [ 1, "GZ guy", 2, 120 , + [ + [ "60283, 1005, -70", 275.215, -713.491, 19.1162, "Neighborhood", 60283, 1005, -70 ], + [ "60270, 1003, -70", 261.281, -750.158, 21.5005, "Neighborhood", 60270, 1003, -70 ], + [ "60238, 1003, -71", 213.126, -767.487, 9.8439, "Neighborhood", 60238, 1003, -71 ], + [ "60213, 1003, -71", 172.793, -775.21, 3.32227, "Neighborhood", 60213, 1003, -71 ], + [ "60275, 1000, -71", 280.228, -796.492, 9.01678, "Neighborhood", 60275, 1000, -71 ], + [ "60234, 998, -71", 226.41, -854.221, 1.65846, "Neighborhood", 60234, 998, -71 ], + [ "60160, 994, -73", 123.435, -931.588, -19.6041, "Neighborhood", 60160, 994, -73 ], + [ "60218, 1002, -73", 186.016, -792.772, -18.2181, "Neighborhood", 60218, 1002, -73 ], + [ "60209, 1005, -72", 160.845, -750.635, -10.8941, "Neighborhood", 60209, 1005, -72 ], + [ "60302, 1005, -70", 305.288, -706.162, 21.0971, "Neighborhood", 60302, 1005, -70 ], + [ "60327, 1003, -70", 354.996, -742.071, 19.1236, "Neighborhood", 60327, 1003, -70 ], + [ "60306, 1002, -70", 324.906, -766.67, 19.1239, "Neighborhood", 60306, 1002, -70 ], + [ "60218, 999, -71", 195.939, -835.297, 5.82845, "Neighborhood", 60218, 999, -71 ], + [ "60191, 1004, -71", 135.273, -767.306, 11.7715, "Neighborhood", 60191, 1004, -71 ], + ] +] +MG07 = [ 1, "GZ guy", 2, 120 , + [ + [ "60109, 1006, -71", 0.380994, -771.841, 8.10068, "Neighborhood", 60109, 1006, -71 ], + [ "60143, 1004, -71", 59.4292, -782.611, 8.15849, "Neighborhood", 60143, 1004, -71 ], + [ "60100, 1005, -71", -11.4838, -788.725, 8.10068, "Neighborhood", 60100, 1005, -71 ], + [ "60096, 1006, -71", -20.6219, -775.695, 8.10068, "Neighborhood", 60096, 1006, -71 ], + [ "60095, 1007, -71", -25.0077, -763.53, 8.10068, "Neighborhood", 60095, 1007, -71 ], + [ "60155, 1003, -71", 84.2148, -804.868, 15.692, "Neighborhood", 60155, 1003, -71 ], + [ "60125, 1004, -66", 31.4565, -796.199, 81.4172, "Neighborhood", 60125, 1004, -66 ], + [ "60224, 997, -73", 214.071, -873.879, -18.5609, "Neighborhood", 60224, 997, -73 ], + [ "60256, 1003, -71", 240.256, -759.147, 9.85464, "Neighborhood", 60256, 1003, -71 ], + [ "60266, 997, -71", 280.289, -857.252, 5.71199, "Neighborhood", 60266, 997, -71 ], + [ "60142, 1005, -70", 55.9215, -780.317, 29.2447, "Neighborhood", 60142, 1005, -70 ], + [ "60179, 1006, -71", 107.642, -735.816, 7.56582, "Neighborhood", 60179, 1006, -71 ], + [ "60193, 1004, -71", 137.585, -766.796, 12.0827, "Neighborhood", 60193, 1004, -71 ], + [ "60219, 1003, -71", 182.913, -774.13, 10.5281, "Neighborhood", 60219, 1003, -71 ], + [ "60259, 1002, -71", 250.806, -779.415, 9.80428, "Neighborhood", 60259, 1002, -71 ], + [ "60287, 1001, -71", 297.308, -783.464, 9.14582, "Neighborhood", 60287, 1001, -71 ], + ] +] +MG08 = [ 1, "GZ guy", 2, 120 , + [ + [ "59972, 78, -79", 316.219, -514.793, 237.373, "city", 59972, 78, -79 ], + [ "59700, 82, -79", 365.981, -563.018, 237.389, "city", 59700, 82, -79 ], + [ "59283, 81, -77", 415.82, -538.035, 274.685, "city", 59283, 81, -77 ], + [ "58884, 74, -75", 425.815, -416.746, 294.899, "city", 58884, 74, -75 ], + [ "58296, 71, -75", 469.789, -341.995, 294.9, "city", 58296, 71, -75 ], + [ "58273, 70, -75", 467.679, -330.837, 294.91, "city", 58273, 70, -75 ], + [ "58246, 70, -77", 465.28, -318.14, 268.098, "city", 58246, 70, -77 ], + [ "59585, 56, -78", 260.434, -160.43, 260.027, "city", 59585, 56, -78 ], + [ "60078, 55, -78", 214.6, -160.99, 259.761, "city", 60078, 55, -78 ], + [ "61042, 55, -80", 129.821, -176.251, 215.822, "city", 61042, 55, -80 ], + [ "60692, 65, -83", 189.439, -327.706, 178.497, "city", 60692, 65, -83 ], + [ "60749, 64, -83", 180.853, -314.042, 177.981, "city", 60749, 64, -83 ], + [ "60186, 66, -84", 245.511, -333.635, 150.648, "city", 60186, 66, -84 ], + [ "61719, 52, -80", 65.3244, -127.249, 221.673, "city", 61719, 52, -80 ], + [ "35, 44, -80", -2.39575, -13.6359, 220.941, "city", 35, 44, -80 ], + [ "31681, 53, -77", -42.9333, -145.408, 277.339, "city", 31681, 53, -77 ], + [ "31789, 56, -76", -54.6834, -191.584, 278.654, "city", 31789, 56, -76 ], + [ "31978, 55, -77", -71.0139, -181.946, 274.244, "city", 31978, 55, -77 ], + [ "31966, 54, -76", -68.8656, -167.067, 284.985, "city", 31966, 54, -76 ], + [ "467, 56, -77", -42.0513, -195.511, 277.165, "city", 467, 56, -77 ], + ] +] +MG09 = [ 1, "GZ guy", 2, 120 , + [ + [ "62480, 52, -80", 1.77311, -143.133, 220.935, "city", 62480, 52, -80 ], + [ "31746, 52, -80", -47.6192, -128.094, 221.671, "city", 31746, 52, -80 ], + [ "32656, 56, -80", -133.881, -194.159, 221.659, "city", 32656, 56, -80 ], + [ "31642, 48, -80", -36.892, -77.407, 221.679, "city", 31642, 48, -80 ], + [ "33745, 44, -80", -182.53, 15.0192, 221.679, "city", 33745, 44, -80 ], + [ "161, 46, -80", -11.8993, -39.2203, 220.12, "city", 161, 46, -80 ], + [ "31354, 41, -80", -13.1011, 35.0907, 220.104, "city", 31354, 41, -80 ], + [ "62068, 47, -80", 32.8043, -51.3977, 221.76, "city", 62068, 47, -80 ], + [ "61889, 51, -80", 50.5303, -118.34, 221.66, "city", 61889, 51, -80 ], + [ "61990, 52, -80", 42.9236, -133.187, 221.661, "city", 61990, 52, -80 ], + [ "60797, 45, -78", 123.175, -9.2883, 261.196, "city", 60797, 45, -78 ], + [ "61535, 53, -80", 82.4942, -144.117, 222.015, "city", 61535, 53, -80 ], + [ "61746, 57, -82", 70.1662, -220.908, 195.87, "city", 61746, 57, -82 ], + [ "51, 57, -82", -4.62847, -215.158, 194.066, "city", 51, 57, -82 ], + [ "62417, 56, -81", 7.58955, -205.743, 199.97, "city", 62417, 56, -81 ], + [ "62485, 49, -80", 1.26902, -94.9741, 220.931, "city", 62485, 49, -80 ], + ] +] +MG10 = [ 1, "GZ guy", 2, 120 , + [ + [ "32489, 82, -93", -169.248, -599.338, 8.22528, "city", 32489, 82, -93 ], + [ "32437, 80, -93", -159.089, -572.478, 8.22528, "city", 32437, 80, -93 ], + [ "32370, 78, -93", -146.356, -536.789, 8.22528, "city", 32370, 78, -93 ], + [ "62074, 74, -90", 50.8871, -483.389, 62.6932, "city", 62074, 74, -90 ], + [ "62442, 70, -88", 6.66464, -425.883, 92.6597, "city", 62442, 70, -88 ], + [ "26, 61, -84", -2.43234, -276.531, 155.824, "city", 26, 61, -84 ], + [ "62466, 53, -80", 2.97976, -148.419, 223.733, "city", 62466, 53, -80 ], + [ "61768, 52, -80", 61.4058, -129.401, 221.671, "city", 61768, 52, -80 ], + [ "61208, 54, -80", 113.078, -162.948, 214.661, "city", 61208, 54, -80 ], + [ "57996, 69, -75", 489.8, -304.099, 294.899, "city", 57996, 69, -75 ], + [ "56916, 64, -75", 549.031, -170.577, 297.581, "city", 56916, 64, -75 ], + [ "57008, 65, -75", 553.686, -196.203, 297.581, "city", 57008, 65, -75 ], + [ "56889, 68, -75", 588.206, -227.224, 297.593, "city", 56889, 68, -75 ], + [ "56898, 70, -75", 603.84, -253.754, 297.593, "city", 56898, 70, -75 ], + [ "56809, 76, -75", 666.27, -332.168, 297.594, "city", 56809, 76, -75 ], + [ "56149, 81, -75", 775.175, -341.96, 297.595, "city", 56149, 81, -75 ], + [ "56238, 85, -75", 801.331, -397.677, 297.595, "city", 56238, 85, -75 ], + [ "56477, 85, -75", 777.84, -421.14, 299.93, "city", 56477, 85, -75 ], + [ "57179, 87, -78", 715.306, -504.603, 256.659, "city", 57179, 87, -78 ], + [ "57176, 93, -78", 765.788, -589.046, 259.234, "city", 57176, 93, -78 ], + [ "56459, 95, -78", 874.804, -556.476, 259.243, "city", 56459, 95, -78 ], + [ "56182, 100, -78", 951.983, -589.045, 259.243, "city", 56182, 100, -78 ], + [ "56248, 102, -78", 968.839, -630.479, 259.243, "city", 56248, 102, -78 ], + [ "56381, 108, -78", 1000.34, -713.188, 259.243, "city", 56381, 108, -78 ], + [ "56481, 110, -78", 1003.1, -748.014, 259.243, "city", 56481, 110, -78 ], +# [ "56588, 109, -78", 978.66, -745.66, 259.243, "city", 56588, 109, -78 ], +# [ "57190, 109, -78", 893.636, -809.511, 259.243, "city", 57190, 109, -78 ], +# [ "57452, 109, -80", 849.176, -824.857, 222.094, "city", 57452, 109, -80 ], + ] +] +# +# distance ferry +MG11 = [ 1, "GZ guy", 2, 120 , + [ + [ "3, 53, -80", -0.0891117, -155.874, 223.466, "city", 3, 53, -80 ], + [ "3, 75, -93", 0.0849568, -510.678, 6.83298, "city", 3, 75, -93 ], + [ "3, 73, -92", 0.046029, -468.112, 30.0315, "city", 3, 73, -92 ], + [ "3, 70, -88 ", 0.0126944, -425.414, 90.2389, "city", 3, 70, -88 ], + [ "3, 64, -85", 0.0880445, -330.854, 134.733, "city", 3, 64, -85 ], + [ "3, 63, -85 ", -0.0940349, -308.747, 144.135, "city", 3, 63, -85 ], + [ "3, 49, -80", 0.107221, -82.8188, 220.945, "city", 3, 49, -80 ], + [ "3, 41, -80", 0.0100019, 31.4722, 220.945, "city", 3, 41, -80 ], + [ "0, 1, -3", 0.000921001, -25.3192, -40.0522, "GreatZero", 0, 1, -3 ], + ] +] +# +# ferry hieght +MG12 = [ 1, "GZ guy", 2, 120 , + [ + [ "31851, 73, -93", -76.7246, -463.087, 8.21978, "city", 31851, 73, -93 ], + [ "97, 69, -88", -10.8075, -413.394, 92.4359, "city", 97, 69, -88 ], + [ "114, 63, -86 ", -11.6655, -320.016, 133.759, "city", 114, 63, -86 ], + [ "39, 63, -85", -3.82988, -312.859, 144.135, "city", 39, 63, -85 ], + [ "32254, 62, -86", -107.042, -293.259, 130.295, "city", 32254, 62, -86 ], + [ "32694, 57, -86", -140.033, -212.729, 127.077, "city", 32694, 57, -86 ], + [ "32694, 57, -77", -140.033, -212.729, 274.241, "city", 32694, 57, -77 ], + [ "62496, 53, -80 ", 0.388106, -150.975, 220.94, "city", 62496, 53, -80 ], + [ "61577, 46, -80", 69.3479, -41.5769, 221.68, "city", 61577, 46, -80 ], + ] +] +# +# circles +MG13 = [ 1, "GZ guy", 2, 120 , + [ + [ "22, 3, -3", -0.107815, -48.5057, -40.0535, "GreatZero", 22, 3, -3 ], + [ "18929, 3, -3 ", -46.3505, 16.0544, -40.0403, "GreatZero", 18929, 3, -3 ], + [ "40365, 3, -3 ", 38.3031, 29.4412, -40.04, "GreatZero", 40365, 3, -3 ], + [ "32420, 74, -93", -146.164, -481.771, 8.22064, "city", 32420, 74, -93 ], + [ "31834, 74, -93 ", -76.4565, -492.799, 7.64378, "city", 31834, 74, -93 ], + [ "41, 74, -93", -4.83725, -489.336, 6.84302, "city", 41, 74, -93 ], + [ "61808, 74, -90 ", 83.4286, -493.755, 60.0126, "city", 61808, 74, -90 ], + [ "60496, 74, -81", 239.618, -470.852, 208.239, "city", 60496, 74, -81 ], +# [ "GZ markers one marker", -158.327, -582.118, 8.22524, "city", 32417, 80, -93 ], +# [ "GZ markers one marker", 97.3248, -544.326, 6.83208, "city", 30420, 78, -93 ], +# [ "GZ markers one marker", 108.532, -551.111, 6.82993, "city", 30336, 78, -93 ], +# [ "GZ markers one marker", 86.5805, -492.784, 60.0166, "city", 30473, 74, -90 ], +# [ "GZ markers one marker", -132.169, -637.239, 8.11365, "city", 32177, 84, -93 ], + ] +] +# +# Palace +MG14 = [ 1, "GZ guy", 2, 120 , + [ + [ "58277, 70, -75 ", 467.321, -331.116, 294.91, "city", 58277, 70, -75 ], + [ "58384, 60, -78 ", 386.313, -177.083, 260.518, "city", 58384, 60, -78 ], + [ "57792, 46, -76 ", 338.75, 41.1883, 291.95, "city", 57792, 46, -76 ], + [ "58422, 44, -76 ", 282.086, 53.5703, 293.757, "city", 58422, 44, -76 ], + [ "60215, 66, -84", 243.691, -339.626, 157.405, "city", 60215, 66, -84 ], + [ "60822, 64, -84", 173.38, -315.199, 158.217, "city", 60822, 64, -84 ], + [ "60987, 69, -83 ", 167.893, -392.185, 181.574, "city", 60987, 69, -83 ], + [ "61857, 56, -81 ", 58.2999, -197.159, 209.46, "city", 61857, 56, -81 ], + [ "61013, 55, -80", 131.894, -172.566, 216.863, "city", 61013, 55, -80 ], + [ "31661, 53, -77 ", -41.2759, -146.405, 274.388, "city", 31661, 53, -77 ], + [ "60963, 52, -78 ", 128.527, -122.188, 261.352, "city", 60963, 52, -78 ], + [ "46, 43, -80 ", -3.08397, 12.4945, 223.141, "city", 46, 43, -80 ], + [ "32498, 46, -80 ", -98.4153, -28.1701, 223.632, "city", 32498, 46, -80 ], + [ "33231, 55, -81", -182.556, -170.771, 198.891, "city", 33231, 55, -81 ], + [ "33290, 58, -82 ", -196.998, -214.11, 196.267, "city", 33290, 58, -82 ], + [ "31789, 47, -80 ", -47.6542, -61.9222, 221.684, "city", 31789, 47, -80 ], + [ "32022, 50, -80", -68.2777, -96.0332, 221.684, "city", 32022, 50, -80 ], + [ "32188, 47, -80", -77.9, -55.3034, 221.684, "city", 32188, 47, -80 ], + [ "31995, 48, -80", -64.4581, -74.3091, 221.684, "city", 31995, 48, -80 ], + ] +] + + + +mgs = [(MG01,'MG01'),(MG02,'MG02'),(MG03,'MG03'),(MG04,'MG04'),(MG05,'MG05'),(MG06,'MG06'),(MG07,'MG07'),(MG08,'MG08'),(MG09,'MG09'),(MG10,'MG10'),(MG11,'MG11'),(MG12,'MG12'),(MG13,'MG13'),(MG14,'MG14'),] diff --git a/Python/grtzMarkerScopeGUI.py b/Python/grtzMarkerScopeGUI.py new file mode 100644 index 0000000000..3bd86befcd --- /dev/null +++ b/Python/grtzMarkerScopeGUI.py @@ -0,0 +1,505 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: grtzMarkerScopeGUI +Age: Great Zero +Author: Mark DeForest +Date: Dec. 8, 2003 + +Re-design: +---->Author: Tye Hooley +---->Date: Dec 2006 + +This is the python handler for the MarkerGame Machine (CGZs) GUI interface handler +""" + +MaxVersionNumber = 2 +MinorVersionNumber = 1 + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from PlasmaVaultConstants import * + +import string +import time + +import grtzMarkerGames +from PlasmaGameConstants import * +import PlasmaControlKeys + + + + +# define the attributes that will be entered in max +MarkerGameDlg = ptAttribGUIDialog(1,"The MarkerGame GUI") +MGAnim = ptAttribAnimation(2,"Turn on/off entire animation") +MGMachineOnResp = ptAttribResponder(3,"Turn On responder") +MGMachineOffResp = ptAttribResponder(4,"Turn Off responder") +aScope1Act = ptAttribNamedActivator(5,"CGZ Scope1 Python", netForce=1) +aScope2Act = ptAttribNamedActivator(6,"CGZ Scope2 Python", netForce=1) +aScope3Act = ptAttribNamedActivator(7,"CGZ Scope3 Python", netForce=1) +aScope4Act = ptAttribNamedActivator(8,"CGZ Scope4 Python", netForce=1) + +# constants +kBogusGameName = "bogusGame" + +# TagIDs for the GUI +kRGMarkerGameSelect = 500 +kMarkerGameFieldStart = 200 +kMarkerGameFieldEnd = 340 +kMarkerGameNumFieldOffset = 0 +kMarkerGameNameFieldOffset = 1 + +#Timer Callback Types +kDisplayTimer = 0 + +#Score Refresh types +kNoRefresh = 0 +kFullRefresh = 1 +kPartialRefresh = 2 +kOneTimeFullRefresh = 3 + + +class grtzMarkerScopeGUI(ptModifier): + "The MarkerScope get a game GUI handler" + def __init__(self): + ptModifier.__init__(self) + self.id = 213 + self.version = MaxVersionNumber + self.selectorChanged = 0 + self.init = 0 + self.lastGame = -1 + self.lastGameScore = -1 + self.updateLevel = kNoRefresh + self.scopeID = -1 + self.debug = 0 + PtDebugPrint("__grtzMarkerScopeGUI: Max version %d - minor version %d" % (MaxVersionNumber,MinorVersionNumber)) + + def __del__(self): + "the destructor - unload any dialogs we loaded" + PtUnloadDialog("MarkerGameGUI") + + def OnFirstUpdate(self): + "First update, load our dialogs" + PtLoadDialog("MarkerGameGUI",self.key) + + def OnNotify(self,state,id,events): + "Activated... start telescope" + #~PtDebugPrint("grtzMarkerScopeGUI:OnNotify state=%f id=%d events=" % (state,id),events,level=kDebugDumpLevel) + if id == (-1): + print "Tye: YEA!! IT WORKED!" + return + + if id == aScope1Act.id or id == aScope2Act.id or id == aScope3Act.id or id == aScope4Act.id: + self.scopeID = id + if PtDetermineKIMarkerLevel() < kKIMarkerNormalLevel: + MarkerGameDlg.dialog.hide() + else: + MGMachineOffResp.run(self.key,netPropagate=0) + elif id == MGMachineOffResp.id: + MarkerGameDlg.dialog.hide() + actList = (aScope1Act, aScope2Act, aScope3Act, aScope4Act) + for act in actList: + if act.id == self.scopeID: + self.scopeID = -1 + act.enable() + PtDisableControlKeyEvents(self.key) + return + elif id == MGMachineOnResp.id: + PtEnableControlKeyEvents(self.key) + + def OnGUINotify(self,id,control,event): + "Events from all the dialogs in the MarkerGameGUI Age..." + if id != MarkerGameDlg.id: + return + + #~PtDebugPrint("grtzMarkerScopeGUI::OnGUINotify id=%d, event=%d control=" % (id,event),control)#,level=kDebugDumpLevel ) + if event == kDialogLoaded: + PtDebugPrint("DEBUG: grtzMarkerScopeGUI():\tMarker Scope GUU--->Dialog Loaded!") + # hide stuff until needed + MGAnim.animation.skipToTime(1.5) + + elif event == kShowHide: + if control.isEnabled(): + PtDebugPrint("DEBUG: grtzMarkerScopeGUI():\tMarker Scope-GUI--->Show Dialog") + # make sure the player has enough level to see the GUI + gameType = grtzMarkerGames.GetCurrentGameType() + if PtDetermineKIMarkerLevel() < kKIMarkerNormalLevel: + PtDebugPrint("DEBUG: grtzMarkerScopeGUI.OnGUINotify():\tKI Level not high enough, disabling GUI controls") + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + gameSelector.setValue(-1) + gameSelector.disable() + self.updateLevel = kNoRefresh + elif gameType > -1 and gameType != PtMarkerGameTypes.kMarkerGameCGZ: + PtDebugPrint("DEBUG: grtzMarkerScopeGUI.OnGUINotify():\tUser Created Marker Game in Progress, disabling GUI controls") + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + gameSelector.setValue(-1) + gameSelector.disable() + self.updateLevel = kNoRefresh + msg = "Please quit existing User-Created Marker Game, to play a CGZ Game." + PtSendKIMessage(kKILocalChatStatusMsg, msg) + self.IRefreshGamesDisplay() + MGMachineOnResp.run(self.key,netPropagate=0) + else: #We're loading the GUI + # Get gameData (if Any) + gameNum,numCaptured,numMarkers = grtzMarkerGames.GetGameProgress() + PtDebugPrint("DEBUG: grtzMarkerScopeGUI.OnGUINotify():\tInitializing GUI, current gameNum = %s" % gameNum) + + #Set refresh level to not update, later we'll change it if necessary... + self.updateLevel = kNoRefresh + self.lastGame = -1 + self.lastGameScore = -1 + + if gameNum > -1 and numCaptured > -1 and numMarkers > -1: + if numCaptured == numMarkers: + #We've got a completed game!!! + #Stop the game.... + PtSendKIMessage(kMGStopCGZGame, 0) + + #Save the game information + self.lastGame = gameNum + self.lastGameScore = grtzMarkerGames.GetGameScore(gameNum) + + #Now set the selector to unselected... + gameNum = -1 + + #Setup the timer to refresh the display + self.updateLevel = kPartialRefresh + + + # Set selector to the game being played (if Any) + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + gameSelector.enable() + oldGame = gameSelector.getValue() + if gameNum != oldGame: + gameSelector.setValue(gameNum) + self.init = 0 + else: + #We've already initialized properly, no need to do it again! + self.init = 1 + + if gameNum > -1: + # start/continue the counting + self.updateLevel = kPartialRefresh + + #Refresh Display + self.IRefreshGamesDisplay() + MGMachineOnResp.run(self.key,netPropagate=0) + + if self.updateLevel > kNoRefresh: + PtAtTimeCallback(self.key,1,kDisplayTimer) + else: + PtDebugPrint("DEBUG: grtzMarkerScopeGUI():\tMarker Scope-GUI--->Hide dialog") + #Hide scope... + MGAnim.animation.skipToTime(1.5) + self.lastGame = -1 + self.lastGameScore = -1 + + #Stop the timer callbacks... + self.updateLevel = kNoRefresh + + #Get the game selected + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + reqGameNum = gameSelector.getValue() + curGameNum = grtzMarkerGames.GetCurrentCGZGame() + + #Start the game if necessary + if self.selectorChanged: + #Exit if somehow we really don't have a valid game! + if reqGameNum < 0 or reqGameNum > len(grtzMarkerGames.mgs): + PtDebugPrint("ERROR: grtzMarkerScopeGUI.OnGUINotify:\tCannot start invalid game number: %d" %reqGameNum) + return + + #Finally, start the new game! + PtDebugPrint("DEBUG: grtzMarkerScopeGUI.OnGUINotify():\tReceived GUI notification to start game: %s" %reqGameNum) + PtSendKIMessageInt(kMGStartCGZGame, reqGameNum) + + #Reset selector sensor + self.selectorChanged = 0 + + elif event == kValueChanged: + rgid = control.getTagID() + if rgid == kRGMarkerGameSelect: + #The first time we update the selector, we don't want to register a new game selected!!! + #All played games are initialized upon age load, not upon marker scope GUI load.... + if self.init == 0: + PtDebugPrint("DEBUG: grtzMarkerScopeGUI.OnGUINotify():\tFinished initialization.... (ignoring selector change)") + self.init = 1 #Make sure we don't try to re-init! + return + + self.selectorChanged = 1 #let us know if the selector changed for (so we can start/stop a game if necessary) + + gameNum = control.getValue() + PtDebugPrint("DEBUG: grtzMarkerScopeGUI.OnGUINotify():\tReceived CGZ Game Selector change: %s" %gameNum) + + + #If we were playing an existing game, we need to quit it!!! + curGame = grtzMarkerGames.GetCurrentCGZGame() + if curGame != None and curGame > -1: + PtDebugPrint("DEBUG: grtzMarkerScopeGUI.OnGUINotify():\tSelector value changed, stopping current game!") + PtSendKIMessage(kMGStopCGZGame,0) + self.updateLevel = kOneTimeFullRefresh + + #Reset the score if we've seleced a game + prevRefresh = self.updateLevel + if gameNum > -1 and gameNum < len(grtzMarkerGames.mgs): + grtzMarkerGames.UpdateScore(gameNum,PtGetDniTime(),0.0) + self.updateLevel = kPartialRefresh + else: + #just need to refresh the entire display to ensure we've stopped any timer displays + self.updateLevel = kOneTimeFullRefresh + pass + + #Force one update... + self.IRefreshGamesDisplay() + + #Update display... only if we didn't have plans to update... + if prevRefresh == kNoRefresh: + PtAtTimeCallback(self.key,0 ,kDisplayTimer) + + + def OnTimer(self,id): + "timer event, update things" + if id == kDisplayTimer: + if self.updateLevel == kFullRefresh: + self.IRefreshGamesDisplay() + elif self.updateLevel == kPartialRefresh: + self.IPartialRefreshDisplay() + elif self.updateLevel == kOneTimeFullRefresh: + self.IRefreshGamesDisplay() + + #Stop the timer if we don't have a new game selected.... + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + curGame = gameSelector.getValue() + if curGame < 0: + self.updateLevel = kNoRefresh + else: + self.updateLevel = kPartialRefresh + + #Call our next refresh (if necessary) + if self.updateLevel > kNoRefresh: + PtAtTimeCallback(self.key,1,kDisplayTimer) + + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode: + self.IQuitScope() + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + self.IQuitScope() + + + def IQuitScope(self): + scopeNames = ("GZMachineScope01","GZMachineScope02","GZMachineScope03","GZMachineScope04") + notify = ptNotify(self.key) + notify.clearReceivers() + + for name in scopeNames: + try: + obj = PtFindSceneobject(name, "GreatZero") + pythonScripts = obj.getPythonMods() + for script in pythonScripts: + notify.addReceiver(script) + except: + PtDebugPrint("ERROR: IQuitTelescope():\tCould not send quit message to the scope named: %s" % name) + + notify.netPropagate(0) + notify.setActivate(1.0) + notify.send() + + + + def IRefreshGamesDisplay(self): + "refresh the number and best time fields for the games" + if self.debug: + print "---->FULL UPDATE!" + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + curGame = gameSelector.getValue() + + curGameName = grtzMarkerGames.GetCGZGameName(curGame) + for fieldID in range(kMarkerGameFieldStart,kMarkerGameFieldEnd,10): + numTB = ptGUIControlTextBox(MarkerGameDlg.dialog.getControlFromTag(fieldID+kMarkerGameNumFieldOffset)) + timeTB = ptGUIControlTextBox(MarkerGameDlg.dialog.getControlFromTag(fieldID+kMarkerGameNameFieldOffset)) + gameidx = (fieldID-kMarkerGameFieldStart)/10 + numTB.setString("%d" % (grtzMarkerGames.GetNumMarkers(gameidx))) + gameName = grtzMarkerGames.GetCGZGameName(gameidx) + + startTime,bestTime = grtzMarkerGames.GetGameTime(gameName) + showZeros = 0 + if curGameName == gameName: + # use the currentTime + bestTime = PtGetDniTime() - startTime + showZeros = 1 + + if showZeros == 1 and bestTime == 0: + timeTB.setString("00:00:00") + elif bestTime >= 0.1 : + tuptime = time.gmtime(bestTime) + preText = "" + postText = "" + + #Check for best game.... + if self.lastGame == gameidx: + if self.lastGameScore < bestTime or (self.lastGameScore > 0 and bestTime <= 0): + preText = "*" + postText = "*" + if tuptime[2] == 1: + ostring = preText+"%02d:%02d:%02d"+postText + timeTB.setString(ostring % (tuptime[3],tuptime[4],tuptime[5])) + else: + ostring = preText+"%02d:%02d:%02d:%02d"+postText + timeTB.setString(ostring % (tuptime[2]-1,tuptime[3],tuptime[4],tuptime[5])) + else: + timeTB.setString("--:--:--") + + + + def IPartialRefreshDisplay(self): + "Refreshes only the volitile time entries (i.e. a game being played or a completed game)" + + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + curGame = gameSelector.getValue() + + + #check a completed game + if self.lastGame > -1: + if self.debug: + print "PARTIAL--LASTGAME!" + fieldID = self.lastGame * 10 + kMarkerGameFieldStart + timeTB = ptGUIControlTextBox(MarkerGameDlg.dialog.getControlFromTag(fieldID+kMarkerGameNameFieldOffset)) + gameName = grtzMarkerGames.GetCGZGameName(self.lastGame) + + startTime,bestTime = grtzMarkerGames.GetGameTime(gameName) + + if bestTime >= 0.1: + tuptime = time.gmtime(bestTime) + modText = "" + + if self.lastGameScore < bestTime or (self.lastGameScore > 0 and bestTime <= 0): + modText = "*" + #Kill the timer if we were only awaiting a best game update + if curGame == -1: + self.updateLevel = kNoRefresh + if tuptime[2] == 1: + ostring = modText+"%02d:%02d:%02d"+modText + timeTB.setString(ostring % (tuptime[3],tuptime[4],tuptime[5])) + else: + ostring = modText+"%02d:%02d:%02d:%02d"+modText + timeTB.setString(ostring % (tuptime[2]-1,tuptime[3],tuptime[4],tuptime[5])) + else: + timeTB.setString("--:--:--") + + #Check the current game + if curGame > -1: + if self.debug: + print "PARTIAL--CURRENT!" + fieldID = curGame * 10 + kMarkerGameFieldStart + timeTB = ptGUIControlTextBox(MarkerGameDlg.dialog.getControlFromTag(fieldID+kMarkerGameNameFieldOffset)) + gameName = grtzMarkerGames.GetCGZGameName(curGame) + + startTime,bestTime = grtzMarkerGames.GetGameTime(gameName) + bestTime = PtGetDniTime() - startTime + + if bestTime == 0: + timeTB.setString("00:00:00") + elif bestTime >= 0.1: + tuptime = time.gmtime(bestTime) + if tuptime[2] == 1: + ostring = "%02d:%02d:%02d" + timeTB.setString(ostring % (tuptime[3],tuptime[4],tuptime[5])) + else: + ostring = "%02d:%02d:%02d:%02d" + timeTB.setString(ostring % (tuptime[2]-1,tuptime[3],tuptime[4],tuptime[5])) + else: + timeTB.setString("--:--:--") + + + def OnBackdoorMsg(self, target, param): + if target.lower() == "updatelevel": + #Setup the levels for nice and easy string output + levels = ("kNoRefresh","kFullRefresh","kPartialRefresh","kOneTimeFullRefresh") + + if param.lower() == "print": + print "***Current Update Level = %s" %levels[self.updateLevel] + else: + reqLevel = -1 + try: + reqLevel = int(param) + if reqLevel < 0 or reqLevel > len(levels): + raise + except: + print "@@@ ERROR: invalid argument @@@" + return + + print "***Setting Update Level = %s" % reqLevel + oldLevel = self.updateLevel + self.updateLevel = reqLevel + if reqLevel > kNoRefresh and oldLevel > kNoRefresh: + PtAtTimeCallback(self.key,1,kDisplayTimer) + + elif target.lower() == "lastgame": + if param.lower() == "print": + print "***Last Game = %s, with last score = %s" % (self.lastGame, self.lastGameScore) + else: + try: + reqGame = int(param) + if reqGame < 0 or reqGame > 13: + raise + except: + print "@@@ ERROR: invalid argument @@@" + return + + print "***Setting Last Game = %s" %reqGame + self.lastGame = reqGame + + elif target.lower() == "lastgamescore": + if param.lower() == "print": + print "***Last Game = %s, with last score = %s" % (self.lastGame, self.lastGameScore) + else: + try: + reqScore = int(param) + if reqScore < 0: + raise + except: + print "@@@ ERROR: invalid argument @@@" + return + print "***Setting Last Game Score = %s" %reqScore + self.lastGameScore = reqScore + + elif target.lower() == "debug": + self.debug = abs(self.debug - 1) + mode = "OFF" + if self.debug: + mode = "ON" + + print "***Turning on CGZ Marker Scope GUI Debug Mode: %s" % mode + + + + + + + + diff --git a/Python/grtzMarkerScopes.py b/Python/grtzMarkerScopes.py new file mode 100644 index 0000000000..257bda23ec --- /dev/null +++ b/Python/grtzMarkerScopes.py @@ -0,0 +1,203 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: grtzMarkerScope.py +Age: Great Zero +Date: Nov. 12, 2003 +""" +MaxVersionNumber = 1 +MinorVersionNumber = 2 + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys + + +aTrigger = ptAttribActivator(1,"Activate the scope", netForce=1) +aBehavior = ptAttribBehavior(2, "Telescope behavior (multistage)",netForce=1) + +# --------- +# globals + + +LocalAvatar = None +boolScopeOperator = 0 +boolOperated = 0 +Telescope = ptInputInterface() + + +class grtzMarkerScopes(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 212 + self.version = MaxVersionNumber + PtDebugPrint("grtzMarkerScope: Max version %d - minor version %d" % (MaxVersionNumber,MinorVersionNumber),level=kDebugDumpLevel) + self.pendingClose = 0 + + def OnFirstUpdate(self): + self.SDL.setDefault("boolOperated",(0,)) + self.SDL.setDefault("OperatorID",(-1,)) + self.SDL.sendToClients("boolOperated") + self.SDL.sendToClients("OperatorID") + + + def Load(self): + global boolScopeOperated + + solo = true + if len(PtGetPlayerList()): + solo = false + + boolOperated = self.SDL["boolOperated"][0] + if boolOperated: + if solo: + PtDebugPrint("grtzMarkerScope.Load():\tboolOperated=%d but no one else here...correcting" % boolOperated,level=kDebugDumpLevel) + boolOperated = 0 + self.SDL["boolOperated"] = (0,) + self.SDL["OperatorID"] = (-1,) + aTrigger.enable() + else: + aTrigger.disable() + PtDebugPrint("grtzMarkerScope.Load():\tboolOperated=%d, disabling telescope clickable" % boolOperated,level=kDebugDumpLevel) + + def AvatarPage(self, avObj, pageIn, lastOut): + "reset scope accessibility if scope user quits or crashes" + global boolScopeOperated + + if pageIn: + return + + avID = PtGetClientIDFromAvatarKey(avObj.getKey()) + if avID == self.SDL["OperatorID"][0]: + aTrigger.enable() + self.SDL["OperatorID"] = (-1,) + self.SDL["boolOperated"] = (0,) + PtDebugPrint("grtzMarkerScope.AvatarPage(): telescope operator paged out, reenabled telescope.",level=kDebugDumpLevel) + else: + return + + def __del__(self): + "unload the dialog that we loaded" + PtUnloadDialog("MarkerGameGUI") + + def OnNotify(self,state,id,events): + "Activated... start telescope" + global LocalAvatar + global boolScopeOperator + PtDebugPrint("grtzMarkerScope:OnNotify state=%f id=%d events=" % (state,id),events,level=kDebugDumpLevel) + + if id == (-1): + if self.pendingClose == 1: + self.pendingClose = 0 + self.IQuitTelescope() + + + if state and id == aTrigger.id and PtWasLocallyNotified(self.key): + LocalAvatar = PtFindAvatar(events) + self.IStartTelescope() + # check if its an advance stage notify + for event in events: + if event[0] == kMultiStageEvent and (event[1] == 0 or event[1] == 1) and event[2] == kAdvanceNextStage: + if boolScopeOperator: + self.IEngageTelescope() + boolScopeOperator = 0 + break + + + def OnGUINotify(self,id,control,event): + "Notifications from the vignette" + PtDebugPrint("grtzMarkerScope.GUI Notify id=%d, event=%d control=" % (id,event),control,level=kDebugDumpLevel) + if event == kDialogLoaded: + # if the dialog was just loaded then show it + control.show() + + + def OnControlKeyEvent(self,controlKey,activeFlag): + self.pendingClose = 1 + + def IStartTelescope(self): + "Start the action of looking at the telescope" + global LocalAvatar + global boolScopeOperator + # disable the activator (only one in the telescope at a time) + PtSendKIMessage(kDisableKIandBB,0) + aTrigger.disable() + boolScopeOperator = 1 # me! I'm the operator + self.SDL["boolOperated"] = (1,) + avID = PtGetClientIDFromAvatarKey(LocalAvatar.getKey()) + self.SDL["OperatorID"] = (avID,) + PtDebugPrint("grtzMarkerScope.OnNotify:\twrote SDL - scope operator id = ", avID,level=kDebugDumpLevel) + # start the behavior + aBehavior.run(LocalAvatar) + + def IEngageTelescope(self): + global Telescope + + Telescope.pushTelescope() + "After the behavior gets our eyes in the telescope, engage ourselves with the camera" + # show the cockpit + PtLoadDialog("MarkerGameGUI") + if ( PtIsDialogLoaded("MarkerGameGUI") ): + PtShowDialog("MarkerGameGUI") + # get control key events + PtEnableControlKeyEvents(self.key) + + def IQuitTelescope(self): + "Disengage and exit the telescope mode" + global LocalAvatar + global boolScopeOperator + global Telescope + + Telescope.popTelescope() + # exit every thing + note = ptNotify(self.key) + note.addVarNumber("Quit",1) + note.netPropagate(0) + note.netForce(0) + note.send() + # exit behavior...which is in the next stage + PtAtTimeCallback(self.key,0.5,1) # wait for player to finish exit one-shot, then reenable clickable + #disable the Control key events + PtDisableControlKeyEvents(self.key) + # re-enable the telescope for someone else to use + boolScopeOperator = 0 + self.SDL["boolOperated"] = (0,) + self.SDL["OperatorID"] = (-1,) + PtDebugPrint("grtzMarkerScope.IQuitMarkerScope:\tdelaying clickable reenable",level=kDebugDumpLevel) + + def OnTimer(self,id): + global LocalAvatar + if id == 1: + # just use gotoStage the last stage by number because of a bug in the SDL send state + #aBehavior.nextStage(LocalAvatar) + aBehavior.gotoStage(LocalAvatar,3) + PtAtTimeCallback(self.key,3,2) # wait for player to finish exit one-shot, then reenable clickable + if id == 2: + aTrigger.enable() + PtDebugPrint("grtzMarkerScope.OnTimer:\tclickable reenabled",level=kDebugDumpLevel) + PtSendKIMessage(kEnableKIandBB,0) diff --git a/Python/islmEmgrPhase0.py b/Python/islmEmgrPhase0.py new file mode 100644 index 0000000000..c9890367fd --- /dev/null +++ b/Python/islmEmgrPhase0.py @@ -0,0 +1,153 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: islmEmgrPhase0.py +Age: The D'ni City +Date: January 2002 +Event Manager interface for the City Phase 0 content +""" + +from Plasma import * +from PlasmaTypes import * +import string + +#globals +variable = None + +BooleanVARs = [ + ] + +AgeStartedIn = None + +########################################### +# These functions deal with the specific "State" (i.e. Non-boolean) cases. Each is of type INT in the neighborhood.sdl file +# +#Note that the following functions have to be outside of the main class +#in order for the dictionary StateVARs (below) to point to the proper values +########################################### + +#This identifies the maximum valid value for INT Variables +#The range is always from 00 to the value specified here +islmDRCStageStateMaxINT = 02 + + +def OutOfRange(VARname, NewSDLValue, myMaxINT): + PtDebugPrint("islmEmgrPhase0.OutOfRange:\tERROR: Variable %s expected range from 0 - %d. Received value of %d" % (VARname,NewSDLValue,myMaxINT)) + + +def DRCStageState(VARname, NewSDLValue): + + if NewSDLValue > islmDRCStageStateMaxINT: + OutOfRange(VARname, NewSDLValue, islmDRCStageStateMaxINT) + + elif NewSDLValue == 0: + PtDebugPrint("islmEmgrPhase0.DRCStageState: paging out DRC stage") + PtPageOutNode("islmDRCStageState01") + PtPageOutNode("islmDRCStageState02") + + elif NewSDLValue == 1: + PtDebugPrint("islmEmgrPhase0.DRCStageState: paging in DRC stage") + PtPageOutNode("islmDRCStageState02") + PtPageInNode("islmDRCStageState01") + + elif NewSDLValue == 2: + PtDebugPrint("islmEmgrPhase0.DRCStageState: paging in deco DRC stage") + PtPageInNode("islmDRCStageState01") + PtPageInNode("islmDRCStageState02") + + else: + PtDebugPrint("islmEmgrPhase0.DRCStageState: \tERROR: Unexpected value. VARname: %s NewSDLValue: %s" % (VARname, NewSDLValue)) + +StateVARs = {'islmDRCStageState' : DRCStageState} + +class islmEmgrPhase0(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5223 + + version = 2 + self.version = version + print "__init__islmEmgrPhase0 v.", version + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + + for variable in BooleanVARs: + print "tying together", variable + ageSDL.setNotify(self.key,variable,0.0) + self.IManageBOOLs(variable, "") + + for variable in StateVARs.keys(): + PtDebugPrint("setting notify on %s" % variable) + ageSDL.setNotify(self.key,variable,0.0) + StateVARs[variable](variable,ageSDL[variable][0]) + + def OnSDLNotify(self,VARname,SDLname,PlayerID,tag): + global variable + global sdlvalue + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + PtDebugPrint("islmEmgrPhase0.SDLNotify - name = %s, SDLname = %s" % (VARname,SDLname)) + + if VARname in BooleanVARs: + print "islmEmgrPhase0.OnSDLNotify : %s is a BOOLEAN Variable" % (VARname) + self.IManageBOOLs(VARname,SDLname) + + elif VARname in StateVARs.keys(): + PtDebugPrint("islmEmgrPhas0.OnSDLNotify : %s is a STATE variable" % (VARname)) + + NewSDLValue = ageSDL[VARname][0] + + StateVARs[VARname](VARname, NewSDLValue) + + else: + PtDebugPrint("islmEmgrPhase0.OnSDLNotify:\tERROR: Variable %s was not recognized as a Boolean, Performance, or State Variable. " % (VARname)) + pass + + + def IManageBOOLs(self,VARname,SDLname): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + if ageSDL[VARname][0] == 1: # are we paging things in? + PtDebugPrint("islmEmgrPhase0.OnSDLNotify:\tPaging in room ", VARname) + PtPageInNode(VARname) + elif ageSDL[VARname][0] == 0: #are we paging things out? + print "variable = ", VARname + PtDebugPrint("islmEmgrPhase0.OnSDLNotify:\tPaging out room ", VARname) + PtPageOutNode(VARname) + else: + sdlvalue = ageSDL[VARname][0] + PtDebugPrint("islmEmgrPhase0.OnSDLNotify:\tERROR: Variable %s had unexpected SDL value of %s" % (VARname,sdlvalue)) + + + diff --git a/Python/islmGZBeamBrain.py b/Python/islmGZBeamBrain.py new file mode 100644 index 0000000000..12c826e79e --- /dev/null +++ b/Python/islmGZBeamBrain.py @@ -0,0 +1,120 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: islmGZBeamBrain.py +Age: D'ni City Island Main +Author: Doug McBride, January 2004 +Modified by: Chris Doyle, Jan '07 +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + +Beamlight = ptAttribSceneobject (1,"GZBeam RT Light") +respRotateBeam = ptAttribResponder (2,"resp: Rotate GZBeam") +#respShowShell = ptAttribResponder(3, "resp: Shell pulse") +#actBeamAlign = ptAttribActivator(4,"rgn: Shell beam detector") +#actShellJump = ptAttribActivator(5,"rgn: Shell jump detector") + +#shellseen = 0 +#timeforloop = 0 + +boolGZBeamVis = 0 + + +class islmGZBeamBrain(ptResponder): + + def __init__(self): + # run parent class init + ptResponder.__init__(self) + self.id = 5246 + + version = 2 + self.version = version + print "__init__islmGZBeamBrain v.", version,".3" + + + def OnServerInitComplete(self): + global boolGZBeamVis + + try: + ageSDL = PtGetAgeSDL() + ageSDL.setFlags("islmGZBeamVis",1,1) + ageSDL.sendToClients("islmGZBeamVis") + ageSDL.setNotify(self.key,"islmGZBeamVis",0.0) + boolGZBeamVis = ageSDL["islmGZBeamVis"][0] + except: + print "islmGZBeamBrain.OnServerInitComplete: ERROR! Can't find the boolGZBeamVis sdl, doing nothing." + return + + if boolGZBeamVis: + print "islmGZBeamBrain.OnServerInitComplete: The Great Zero beam IS active." + self.TurnBeamOn() + else: + print "islmGZBeamBrain.OnServerInitComplete: The Great Zero beam is NOT active." + self.TurnBeamOff() + + + def TurnBeamOn(self): + print "islmGZBeamBrain.RotateBeam: Trying to turn the beam ON." + Beamlight.sceneobject.draw.enable() + respRotateBeam.run(self.key) + + + def TurnBeamOff(self): + print "islmGZBeamBrain.RotateBeam: Trying to turn the beam OFF." + Beamlight.sceneobject.draw.disable() + #~ respRotateBeam.animation.stop() + + + def OnNotify(self,state,id,events): + pass + #global shellseen + +# if id == actBeamAlign.id: +# shellseen = shellseen + 1 +# #print "islmGZBeamBrain: The Shell has been seen", shellseen," times." +# respShowShell.run(self.key) +# +# elif id == actShellJump.id: +# print "islmGZBeamBrain: The avatar has jumped into the Shell. Stopping the fall." +# avatar = PtGetLocalAvatar() +# avatar.physics.suppress(1) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + print "islmGZBeamBrain.OnSDLNotify(): VARname = ", VARname + global boolGZBeamVis + + if VARname == "islmGZBeamVis": + ageSDL = PtGetAgeSDL() + boolGZBeamVis = ageSDL["islmGZBeamVis"][0] + + if boolGZBeamVis: + self.TurnBeamOn() + else: + self.TurnBeamOff() + diff --git a/Python/islmMemorialImager.py b/Python/islmMemorialImager.py new file mode 100644 index 0000000000..65aa22d55e --- /dev/null +++ b/Python/islmMemorialImager.py @@ -0,0 +1,362 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Author: Karl Johnson +Date: April 16, 2007 +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from PlasmaVaultConstants import * +import string + +#============================================================= +# define the attributes that will be entered in max +#============================================================= +ImagerName = ptAttribString(1,"Name of the Imager") +FontColor = ptAttribString(2,"Color: Red,Green,Blue,Alpha") +FontSize = ptAttribInt(3,"Font Size") +FontFace = ptAttribString(4,"Font Face") +TextXOffset = ptAttribInt(7,"Text X Offset", 0, (-10000,1000000)) +TextYOffset = ptAttribInt(8,"Text Y Offset", 0, (-10000,1000000)) +UpdateTime = ptAttribFloat(9,"Update Interval", 0, (0,100)) +IncAmount = ptAttribInt(10,"Increment px amount per update.") +ImagerMap1 = ptAttribDynamicMap(11, "The Dynamic Texture Map1") +ImagerMap2 = ptAttribDynamicMap(12, "The Dynamic Texture Map2") +ImagerMap3 = ptAttribDynamicMap(13, "The Dynamic Texture Map3") +ImagerMap4 = ptAttribDynamicMap(14, "The Dynamic Texture Map4") +#---------- +# globals +#---------- +kFontColor = [] +kTextFontSize = 0 +kTextFontFace = "" +kTextXStart = 0 +kTextYStart = 0 +kUpdateTime = 0 +kMessage = "" +kTextXPos = [] +kIncAmount = 0 +kCursorStart = [0,0,0,0] +kCursorEnd = [0,0,0,0] +CurrentMessage = ["","","",""] +kNextChar = [0,0,0,0] +kFirstChar = [0,0,0,0] +kTextWidth = [0,0,0,0] +kLastUpdate = 0 +kNewChar = 0 + + +#==================================== + +class islmMemorialImager(ptModifier): + + def __init__(self): + global Instance + ptModifier.__init__(self) + Instance = self + self.id = 5105 + self.version = 1 + print "islmMemorialImager: init version=%d.%d"%(self.version,3) + ############################ + def OnServerInitComplete(self): + + global kTextFontSize + global kFontColor + global kTextFontFace + global kTextXStart + global kTextYStart + global kUpdateTime + global kCharWidth + global kMessage + global kTextXPos + global kIncAmount + global kCursorStart + global kCursorEnd + global CurrentMessage + global kLastUpdate + +# ageSDL = PtGetAgeSDL() +# ageSDL.sendToClients("MemorialImagerStartTime") +# ageSDL.setFlags("MemorialImagerStartTime", 1, 1) +# ageSDL.setNotify(self.key, "MemorialImagerStartTime", 0.0) + + kTextFontSize = FontSize.value + kTextFontFace = FontFace.value + kTextXStart = 0 + kTextYStart = 0 + kUpdateTime = float(UpdateTime.value) + kTextXPos = [kTextXStart,kTextXStart,kTextXStart,kTextXStart] + kIncAmount = IncAmount.value + + kFontColor = FontColor.value.split(",") + #print "islmMemorialImager: Font Color: R:%s,G:%s,B:%s,A:%s" % (float(kFontColor[0]),float(kFontColor[1]),float(kFontColor[2]),float(kFontColor[3])) + kFontColor = ptColor(red=float(kFontColor[0]),green=float(kFontColor[1]),blue=float(kFontColor[2]),alpha=float(kFontColor[3])) + self.UpdateMarqueeMessage() + kLastUpdate = PtGetDniTime() + if kMessage == "": + self.setTimerCallback(30) + return + self.getMaxChars() + self.setTimerCallback(kUpdateTime) + + ############################ + def OnTimer(self,id): + if kMessage == "": + self.UpdateMarqueeMessage() + return + self.UpdateMarqueeStrPosition(kMessage) + self.UpdateMarquee(ImagerMap1,0) + self.UpdateMarquee(ImagerMap2,1) + self.UpdateMarquee(ImagerMap3,2) + self.UpdateMarquee(ImagerMap4,3) + self.setTimerCallback(kUpdateTime) + ############################ + def UpdateMarquee(self, ImagerMap, x): + imagertext = CurrentMessage[x] + #print "islmMemorialImager: kTextXPos:%s \t kTextYStart:%s \n imagertext:%s" % (str(kTextXPos[x]),str(kTextYStart),str(imagertext)) + ImagerMap.textmap.clearToColor(ptColor(0,0,0,0)) + ImagerMap.textmap.drawText(kTextXPos[x],kTextYStart,imagertext) + ImagerMap.textmap.flush() + ############################ + def UpdateMarqueeStrPosition(self, imgMessage): + global kTextWidth + global kCursorStart + global kCursorEnd + global CurrentMessage + global kNextChar + global kFirstChar + global kLastUpdate + #print "islmMemorialImager: PtGetDniTime: " + str(PtGetDniTime()) + "kLastUpdate: " + str(kLastUpdate) + movedSince = int(((long(PtGetDniTime()) - long(kLastUpdate)) / kUpdateTime) * kIncAmount) + #print "islmMemorialImager: Distance to move:" , movedSince + kLastUpdate = PtGetDniTime() + for x in range(4): + #print "islmMemorialImager: Imager%d \n kcursorstart:%d \t kcursorend:%d" % (x,kCursorStart[x],kCursorEnd[x]) + self.UpdateMarqueeOffset(x,movedSince) + #print "islmMemorialImager: kTextXPos[%d]: %d" % (x, kTextXPos[x]) + self.UpdateStartCursor(x,imgMessage) + self.UpdateEndCursor(x,imgMessage) + + ############################ + def UpdateStartCursor(self, x, imgMessage): + global kCursorStart + global kFirstChar + global kNewChar + + if kNewChar == 1: + + CurrentMessage[x] = "" + if kCursorStart[x] > len(imgMessage) - 1: + kCursorStart[x] = 1 + if x == 0: + self.UpdateMarqueeMessage() + else: + kCursorStart[x] = kCursorStart[x] + 1 + if kCursorStart[x] <= len(imgMessage) - 1: + (kFirstChar[x],z) = ImagerMap1.textmap.calcTextExtents(kMessage[kCursorStart[x]]) + elif kCursorStart[x] > len(imgMessage) - 1: + (kFirstChar[x],z) = ImagerMap1.textmap.calcTextExtents(kMessage[0]) + kNewChar = 0 + + ############################ + def UpdateEndCursor(self, x, imgMessage): + global kTextWidth + global kCursorEnd + global kNextChar + global CurrentMessage + for i in range(len(imgMessage)): + (kTextWidth[x],z) = ImagerMap1.textmap.calcTextExtents(CurrentMessage[x]) + if (((kTextXPos[x] - kTextXStart) + kTextWidth[x]) + kNextChar[x]) > ImagerMap1.textmap.getWidth(): break + + #print "islmMemorialImager: Value of offset plus the nextChar width", ((kTextXPos[x] - kTextXStart[x]) + kTextWidth[x]) + if kCursorEnd[x] > len(imgMessage) - 1: + kCursorEnd[x] = 0 + else: + kCursorEnd[x] = kCursorEnd[x] + 1 + + if kCursorEnd[x] <= len(imgMessage) - 1: + (kNextChar[x],z) = ImagerMap1.textmap.calcTextExtents(kMessage[kCursorEnd[x]]) + elif kCursorEnd[x] > len(imgMessage) - 1: + (kNextChar[x],z) = ImagerMap1.textmap.calcTextExtents(kMessage[0]) + + if kCursorStart[x] < kCursorEnd[x]: + CurrentMessage[x] = imgMessage[kCursorStart[x]:kCursorEnd[x]] + if kCursorStart[x] > kCursorEnd[x]: + CurrentMessage[x] = imgMessage[kCursorStart[x]:len(imgMessage)] + kMessage[0:kCursorEnd[x]] + + ############################ + def UpdateMarqueeOffset(self, x, movedSince): + global kTextXPos + global kNewChar + + if kTextXPos[x] <= (kTextXStart - kFirstChar[x]) + movedSince: + kTextXPos[x] = kTextXStart - (((kTextXStart - kFirstChar[x]) + movedSince) - kTextXPos[x]) + kNewChar = 1 + else: + kTextXPos[x] = kTextXPos[x] - movedSince + #print "islmMemorialImager: Updating Offset to:",kTextXPos[x] + ############################ + def UpdateMarqueeMessage(self): + global kMessage + global kLastUpdate + + inbox = ptVault().getGlobalInbox() + inboxChildList = inbox.getChildNodeRefList() + + for child in inboxChildList: + PtDebugPrint("islmMemorialImager: looking at node " + str(child),level=kDebugDumpLevel) + node = child.getChild() + folderNode = node.upcastToFolderNode() + if type(folderNode) != type(None): + PtDebugPrint("islmMemorialImager: node is named %s" % (folderNode.getFolderName()),level=kDebugDumpLevel) + if folderNode.getFolderName() == "MemorialImager": + folderNodeChildList = folderNode.getChildNodeRefList() + for folderChild in folderNodeChildList: + PtDebugPrint("islmMemorialImager: looking at child node " + str(folderChild),level=kDebugDumpLevel) + childNode = folderChild.getChild() + textNode = childNode.upcastToTextNoteNode() + if type(textNode) != type(None): + PtDebugPrint("islmMemorialImager: child node is named %s" % (textNode.getTitle()),level=kDebugDumpLevel) + if textNode.getTitle() == "MemorialImager": + if textNode.getText() == "": + if kMessage == "": + self.setTimerCallback(30) + #print "islmMemorialImager: No message was found." + + elif kMessage != textNode.getText(): + oldmessage = kMessage + kMessage = textNode.getText() + self.setMarquee(ImagerMap1,0) + self.setMarquee(ImagerMap2,1) + self.setMarquee(ImagerMap3,2) + self.setMarquee(ImagerMap4,3) + self.getMaxChars() + if oldmessage == "": + kLastUpdate = PtGetDniTime() + self.setTimerCallback(kUpdateTime) + PtDebugPrint("islmMemorialImager: Marquee contents are '%s'" % (kMessage),level=kDebugDumpLevel) + return + self.setTimerCallback(30) + #print "islmMemorialImager: Message Node not found." + + #print "islmMemorialImager: Message Updated" + #print "islmMemorialImager: Message Length:", len(kMessage) + ############################ + + #def SetMemorialSDL(self): + # #print "islmMemorialImager: Updating SDL with the new time value." + # ageSDL = PtGetAgeSDL() + # ageSDL["MemorialImagerStartTime"] = (PtGetDniTime(),) + + ############################ +# def syncMessagePosition(self): +# global kCursorStart +# global kLastUpdate +# if kMessage == "": +# self.UpdateMarqueeMessage() +# return +# #print "islmMemorialImager: Synching my imager to the age owners." +# ageSDL = PtGetAgeSDL() +# updatetime = long(PtGetDniTime()) - long(ageSDL["MemorialImagerStartTime"][0]) +# movedsince = int((updatetime / kUpdateTime) * kIncAmount) +# #print "islmMemorialImager: UpdateTime: " + str(updatetime) + " \t MovedSince: " + str(movedsince) +# textWidth = 0 +# cursor = len(kMessage) +# #print "islmMemorialImager: Cursor: ", cursor +# for i in range(len(kMessage)): +# (textWidth,z) = ImagerMap1.textmap.calcTextExtents(kMessage[0:cursor]) +# if textWidth < movedsince: break +# cursor = cursor - 1 +# kCursorStart[0] = cursor +# +# kLastUpdate = PtGetDniTime() +# + ############################ + def getMaxChars(self): + global kTextWidth + global CurrentMessage + global kCursorEnd + global kNextChar + global kFirstChar + global kCursorStart + global kMessage + if not len(kMessage): + return + + textWidth = 0 + startposdistance = int(len(kMessage) / 4) + i = 1 + for x in range(4): + StartCursor = kCursorStart[x] + i = StartCursor + for g in range(len(kMessage)): + + if i >= StartCursor: + testmessage = kMessage[StartCursor:i] + elif i < StartCursor: + testmessage = kMessage[StartCursor:len(kMessage)] + kMessage[0:i-(len(kMessage) * (i / len(kMessage)))] + + (textWidth,z) = ImagerMap1.textmap.calcTextExtents(testmessage) + if textWidth > ImagerMap1.textmap.getWidth(): break + i = i + 1 + if i > len(kMessage): + i = 0 + + i = i - 1 + + if not len(testmessage): + print "islmMemorialImager: Message Length = 0" + kMessage = "" + return + testmessage = testmessage[0:len(testmessage) - 1] + CurrentMessage[x] = testmessage + kCursorEnd[x] = (len(testmessage) + i)-(len(kMessage) * (i / len(kMessage))) + (kFirstChar[x], z) = ImagerMap1.textmap.calcTextExtents(testmessage[0]) + (kTextWidth[x],z) = ImagerMap1.textmap.calcTextExtents(testmessage) + (kNextChar[x], z) = ImagerMap1.textmap.calcTextExtents(kMessage[i-(len(kMessage) + 1 * (i / len(kMessage))) + 1]) + + if x < 3: + kCursorStart[x+1] = int(StartCursor + startposdistance) - (len(kMessage) * ((StartCursor + startposdistance) / len(kMessage))) + kTextXPos[x] = kTextXStart + + ############################ + + def setMarquee(self, ImagerMap, x): + + ImagerMap.textmap.clearToColor(ptColor(0,0,0,0)) + ImagerMap.textmap.setTextColor(kFontColor, true) + ImagerMap.textmap.setFont(kTextFontFace,kTextFontSize) + ImagerMap.textmap.setJustify(PtJustify.kLeftJustify) + ImagerMap.textmap.setLineSpacing(0) + ImagerMap.textmap.drawText(kTextXPos[x],kTextYStart,kMessage) + ImagerMap.textmap.flush() + ############################ + + def setTimerCallback(self, timerlength): + PtClearTimerCallbacks(self.key) + PtAtTimeCallback(self.key,timerlength,1) \ No newline at end of file diff --git a/Python/islmPassable.py b/Python/islmPassable.py new file mode 100644 index 0000000000..f0cd5f27b2 --- /dev/null +++ b/Python/islmPassable.py @@ -0,0 +1,56 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: islmPassable +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + +# --------- +# max wiring +# --------- + +respBoolTrue = ptAttribResponder(1,"Run if passable:") +respBoolFalse = ptAttribResponder(2,"Run if not passable:") + +class islmPassable(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 220 + self.version = 1 + + def OnServerInitComplete(self): + if PtDetermineKIMarkerLevel() >= kKIMarkerFirstLevel: + print "islmPassable: The Player has started the GZ marker game." + print "islmPassable: Disabling baracades at the bottom of the Great Stair." + respBoolTrue.run(self.key,fastforward=1) + else: + print "islmPassable: The player has NOT started the GZ marker game." + print "islmPassable: Enabling baracades at the bottom of the Great Stair." + respBoolFalse.run(self.key,fastforward=1) diff --git a/Python/islmPodMap.py b/Python/islmPodMap.py new file mode 100644 index 0000000000..c4d981618f --- /dev/null +++ b/Python/islmPodMap.py @@ -0,0 +1,140 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: islmPodMap +Age: The D'ni City +Date: January 2007 +Author: Derek Odell +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys + +# define the attributes that will be entered in max +Activate = ptAttribActivator(1, " clickable ") +Vignette = ptAttribString(2, "Toggle dialog - by Name") +respZoom = ptAttribResponder(3, "resp: Zoom", ["in", "out"], netForce=0) + +# define global variables +LocalAvatar = None +kExit=99 +kZoomButton = 100 +gToggle = 0 +KeyMap = {} +KeyMap[PlasmaControlKeys.kKeyMoveForward] = PlasmaControlKeys.kKeyCamPanUp +KeyMap[PlasmaControlKeys.kKeyMoveBackward] = PlasmaControlKeys.kKeyCamPanDown +KeyMap[PlasmaControlKeys.kKeyRotateLeft] = PlasmaControlKeys.kKeyCamPanLeft +KeyMap[PlasmaControlKeys.kKeyRotateRight] = PlasmaControlKeys.kKeyCamPanRight + +#==================================== +class islmPodMap(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 221 + self.version = 1 + print "islmPodMap: init version = %d" % self.version + + ########################### + def IGetAgeFilename(self): + "returns the .age file name of the age" + ageInfo = PtGetAgeInfo() + if type(ageInfo) != type(None): + return ageInfo.getAgeFilename() + else: + return "GUI" # use default GUI age if we can't find the age name for some reason + + ########################### + def OnFirstUpdate(self): + PtLoadDialog(Vignette.value,self.key,self.IGetAgeFilename()) + + ########################### + def __del__(self): + "unload the dialog that we loaded" + PtUnloadDialog(Vignette.value) + + ########################### + def OnNotify(self,state,id,events): + "Activated... " + global LocalAvatar + if state and id == Activate.id and PtFindAvatar(events) == PtGetLocalAvatar(): + LocalAvatar = PtFindAvatar(events) + self.IStartDialog() + + ########################### + def OnGUINotify(self,id,control,event): + "Notifications from the vignette" + global gToggle + #print "GUI Notify id=%d, event=%d control=" % (id,event),control + if event == kAction: + if control.getTagID() == kExit: #off + self.IQuitDialog() + elif control.getTagID() == kZoomButton: + gToggle = not gToggle + if gToggle: + respZoom.run(self.key, state="in", netForce=0, netPropagate=0) + else: + respZoom.run(self.key, state="out", netForce=0, netPropagate=0) + elif event == kExitMode: + self.IQuitDialog() + + ########################### + def OnControlKeyEvent(self,controlKey,activeFlag): + "Control key events... anything we're interested in?" + PtDebugPrint("Got controlKey event %d and its activeFlage is %d" % (controlKey,activeFlag), level=kDebugDumpLevel) + if controlKey == PlasmaControlKeys.kKeyExitMode: + self.IQuitDialog() + + ########################### + def IStartDialog(self): + "Start the Dialog" + global LocalAvatar + PtLoadDialog(Vignette.value,self.key,self.IGetAgeFilename()) + if PtIsDialogLoaded(Vignette.value): + PtSendKIMessage(kDisableKIandBB,0) + respZoom.run(self.key, state="out", netForce=0, netPropagate=0) + PtShowDialog(Vignette.value) + print "dialog: %s goes up" % Vignette.value + # get control key events + PtGetControlEvents(true,self.key) + + ########################### + def IQuitDialog(self): + "Disengage and exit" + global LocalAvatar + # exit every thing + if type(Vignette.value) != type(None) and Vignette.value != "": + PtSendKIMessage(kEnableKIandBB,0) + PtHideDialog(Vignette.value) + print "Dialog: %s goes down" % Vignette.value + else: + print "WTH!!!" + #disable the Control key events + PtGetControlEvents(false,self.key) + + diff --git a/Python/islmRandomBahroScream.py b/Python/islmRandomBahroScream.py new file mode 100644 index 0000000000..0f5ab05c68 --- /dev/null +++ b/Python/islmRandomBahroScream.py @@ -0,0 +1,83 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: islmRandomBahroScream.py +Age: The D'ni City +Date: November 2003 +Randomly plays Bahro scream based on SDL value +""" + +from Plasma import * +from PlasmaTypes import * +from xEnum import Enum +import xRandom + +respScream = ptAttribResponder(1, "Scream responder") +strChanceVar = ptAttribString(2, "Chance Variable") + +#globals +AgeStartedIn = "" +ScreamChanceVar = "islmScreamChance" + +TimerID = Enum("TurnOn") + +class islmRandomBahroScream(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5320 + + self.version = 2 + print "__init__islmRandomBahroScream v.", self.version + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + global ScreamChanceVar + + if AgeStartedIn == PtGetAgeName(): + if type(strChanceVar.value) == type("") and len(strChanceVar.value) > 0: + ScreamChanceVar = strChanceVar.value + + PtAtTimeCallback(self.key, 60, TimerID.TurnOn) + + def OnTimer(self, id): + ageSDL = PtGetAgeSDL() + + if id == TimerID.TurnOn: + try: + chanceval = ageSDL[ScreamChanceVar][0] + cur_chance = xRandom.randint(0, 100) + print "RandomBahroScream: Chance val - %d, Cur Chance - %d" % (chanceval, cur_chance) + if cur_chance <= chanceval: + # turn on + print "RandomBahroScream: turning on" + respScream.run(self.key) + except: + print "RandomBahroScream: could not find SDL for %s in %s" % (ScreamChanceVar,AgeStartedIn) + PtAtTimeCallback(self.key, 600, TimerID.TurnOn) + \ No newline at end of file diff --git a/Python/islmRegisterNexusLink.py b/Python/islmRegisterNexusLink.py new file mode 100644 index 0000000000..46ccdce6d2 --- /dev/null +++ b/Python/islmRegisterNexusLink.py @@ -0,0 +1,106 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: islmRegisterNexusLink +Age: City +Date: September, 2002 +Author: Bill Slease +Adds a backlink to player's KI folder for use in the Nexus machine +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys + + +# define the attributes that will be entered in max +stationName = ptAttribString(1,"station name","foggy bottom") +linkpointName = ptAttribString(2,"linkpoint object name","foo") +actClick = ptAttribActivator(3,"Actvtr: click me") +respClick = ptAttribResponder(4,"Rspndr: sans ki",netForce=1) +respClickGlow = ptAttribResponder(5,"Rspndr: with ki",netForce=1) + + +class islmRegisterNexusLink(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5019 + version = 2 + self.version = version + PtDebugPrint( "__init__islmRegisterNexusLink v.%d.3" % (version) ) + self.avatar = 0 + + + def OnNotify(self,state,id,events): + if not state: + return + + if id==actClick.id: + if PtFindAvatar(events) != PtGetLocalAvatar(): + return + + # does clicker have a normal KI or better? + self.avatar = PtGetLocalAvatar() + kiLevel = PtDetermineKILevel() + PtDebugPrint( "islmRegisterNexusLink.OnNotify:\tplayer ki level is %d" % (kiLevel) ) + if kiLevel < kNormalKI: + self.avatar = 0 + respClick.run(self.key,events=events) + # no ki with which to register link so return + return + respClickGlow.run(self.key,events=events) + + elif id == respClickGlow.id and PtGetLocalAvatar() == self.avatar: + #Register Nexus Link + vault = ptVault() + # we'll use this Chronicle hack so the Nexus machine will know to include this non-city link in its Public city list + if stationName.value == "Kveer": + entryName = "GotLinkToKveerPublic" + entry = vault.findChronicleEntry(entryName) + if type(entry) != type(None): + entryValue = entry.chronicleGetValue() + if entryValue != "yes": + entry.chronicleSetValue("yes") + entry.save() + PtDebugPrint("islmRegisterNexusLink.OnNotify(): Chronicle entry 'GotLinkToKveerPublic' already added, setting to 'yes'") + else: + vault.addChronicleEntry("GotLinkToKveerPublic",1,"yes") + PtDebugPrint("islmRegisterNexusLink.OnNotify(): Chronicle entry 'GotLinkToKveerPublic' not present, adding entry and setting to 'yes'") + PtSendKIMessage(kKILocalChatStatusMsg,PtGetLocalizedString("KI.Messages.NexusLinkAdded")) + else: + # just business-as-usual here + self.avatar = 0 + cityLink = vault.getLinkToCity() + if type(cityLink) != type(None): + if not cityLink.hasSpawnPoint(linkpointName.value): + #Display link added message + PtDebugPrint( "Nexus Link added message displayed %s,%s" % (stationName.value,linkpointName.value) ) + PtSendKIMessage(kKILocalChatStatusMsg,PtGetLocalizedString("KI.Messages.NexusLinkAdded")) + # will only register if not there already + vault.registerMTStation(stationName.value,linkpointName.value) + PtDebugPrint( "islmRegisterNexusLink.OnNotify:\tregistering MTStation %s,%s" % (stationName.value,linkpointName.value) ) + diff --git a/Python/jlakField.py b/Python/jlakField.py new file mode 100644 index 0000000000..cf64c680de --- /dev/null +++ b/Python/jlakField.py @@ -0,0 +1,839 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: jlakField.py +Age: Jalak +Date: June 2007 +wiring for Jalak playing field, the REAL version +""" + +from Plasma import * +from PlasmaTypes import * +import xRandom +import string + + +objColumns = ptAttribSceneobjectList(1,"obj: column phys") +animColumn = ptAttribAnimation(2,"anim: columns",byObject=1) +objSpheres = ptAttribSceneobjectList(3,"obj: spheres") +objLilBoxes = ptAttribSceneobjectList(4,"obj: lil' boxes") +objBigBoxes = ptAttribSceneobjectList(5,"obj: big boxes") +objRamps = ptAttribSceneobjectList(6,"obj: ramps") +objRects = ptAttribSceneobjectList(7,"obj: rectangles") +warpSpheres = ptAttribSceneobjectList(8,"obj: sphere warps - home") +warpLilBoxes = ptAttribSceneobjectList(9,"obj: lil' box warps - home") +warpBigBoxes = ptAttribSceneobjectList(10,"obj: big box warps - home") +warpRamps = ptAttribSceneobjectList(11,"obj: ramp warps - home") +warpRects = ptAttribSceneobjectList(12,"obj: rectangle warps - home") +warpWidgetsPlay = ptAttribSceneobjectList(13,"obj: widget warps - play") +clkColumnUp = ptAttribActivatorList(14,"clk: column up") +clkColumnDn = ptAttribActivatorList(15,"clk: column down") +warpPlayers = ptAttribSceneobjectList(16,"obj: player warps") +respWallToggle = ptAttribResponder(17,"resp: toggle wall",['on','off'],netForce=0) +respGameOps = ptAttribResponder(18,"resp: game ops",['start','end','reset'],netForce=0) +respSfxColumn = ptAttribResponderList(19,"resp: sfx column",statelist=['up','down','off'],byObject=1) +rgnWallSensors = ptAttribActivatorList(20,"rgn sns: wall hit sensors") +#rgnZeroPhysicals = ptAttribActivator(21,"rgn sns: zero out physicals") +respBulkMoveSFX = ptAttribResponder(22, "resp: BulkMove SFX", statelist=['off', 'on', 'end'], netForce=0) +respCreateWidgetSFX = ptAttribResponder(23, "resp: Create Widget SFX", netForce=0) + + +kInitPos = 9 +kMinPos = 0 +kMaxPos = 19 + +LocalAvatar = None +listObjCols = [] +byteColumns = [] +listSfxCols = [] +kMaxEachWidget = 4 +kSphere = "Sphere" +kLilBox = "LilBox" +kBigBox = "BigBox" +kRamp = "Ramp" +kRect = "Rect" +kEmoteTimerID = 500 +kSFXCompleteID= 501 +kEmoteTimer = 2.0 +kBulkMoveVar = "BulkMove" +sdlStartPt = "jlakPlayerStartPt" +sdlWall = "jlakForceField" +sdlSphere = "jlakCurrentSphere" +sdlLilBox = "jlakCurrentLilBox" +sdlBigBox = "jlakCurrentBigBox" +sdlRamp = "jlakCurrentRamp" +sdlRect = "jlakCurrentRectangle" +sdlColumns = [ "jlakColumn00","jlakColumn01","jlakColumn02","jlakColumn03","jlakColumn04",\ + "jlakColumn05","jlakColumn06","jlakColumn07","jlakColumn08","jlakColumn09",\ + "jlakColumn10","jlakColumn11","jlakColumn12","jlakColumn13","jlakColumn14",\ + "jlakColumn15","jlakColumn16","jlakColumn17","jlakColumn18","jlakColumn19",\ + "jlakColumn20","jlakColumn21","jlakColumn22","jlakColumn23","jlakColumn24"] +sdlGUILock = "jlakGUIButtonsLocked" +byteStartPt = 0 +boolWall = 0 +byteSphere = 0 +byteLilBox = 0 +byteBigBox = 0 +byteRamp = 0 +byteRect = 0 +byteColumns = [] +boolGUILock = 0 +PendingCol = -1 +PendingPos = -1 +PendingDir = "" +kZeroed = None +warpWidgets = None +listWarpPlayers = [] + + +class jlakField(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 6005 + self.version = 10 + self.bulkMove = 0 + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global LocalAvatar + global listObjCols + global listSfxCols + global kZeroed + global listWarpPlayers + global byteStartPt + global boolWall + global byteSphere + global byteLilBox + global byteBigBox + global byteRamp + global byteRect + global byteColumns + global boolGUILock + global warpWidgets + LocalAvatar = PtGetLocalAvatar() + + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(sdlStartPt,1,1) + ageSDL.setFlags(sdlWall,1,1) + ageSDL.setFlags(sdlSphere,1,1) + ageSDL.setFlags(sdlLilBox,1,1) + ageSDL.setFlags(sdlBigBox,1,1) + ageSDL.setFlags(sdlRamp,1,1) + ageSDL.setFlags(sdlRect,1,1) + ageSDL.setFlags(sdlGUILock,1,1) + ageSDL.sendToClients(sdlStartPt) + ageSDL.sendToClients(sdlWall) + ageSDL.sendToClients(sdlSphere) + ageSDL.sendToClients(sdlLilBox) + ageSDL.sendToClients(sdlBigBox) + ageSDL.sendToClients(sdlRamp) + ageSDL.sendToClients(sdlRect) + ageSDL.sendToClients(sdlGUILock) + ageSDL.setNotify(self.key,sdlStartPt,0.0) + ageSDL.setNotify(self.key,sdlWall,0.0) + ageSDL.setNotify(self.key,sdlSphere,0.0) + ageSDL.setNotify(self.key,sdlLilBox,0.0) + ageSDL.setNotify(self.key,sdlBigBox,0.0) + ageSDL.setNotify(self.key,sdlRamp,0.0) + ageSDL.setNotify(self.key,sdlRect,0.0) + ageSDL.setNotify(self.key,sdlGUILock,0.0) + byteStartPt = ageSDL[sdlStartPt][0] + boolWall = ageSDL[sdlWall][0] + byteSphere = ageSDL[sdlSphere][0] + byteLilBox = ageSDL[sdlLilBox][0] + byteBigBox = ageSDL[sdlBigBox][0] + byteRamp = ageSDL[sdlRamp][0] + byteRect = ageSDL[sdlRect][0] + + #If the last person links out while a bulk move is being performed the SDL gets stuck! + #So we'll reset it only if we're the first person entering the age.... + if len(PtGetPlayerList()) == 0: + PtDebugPrint("jlakField.OnServerInitComplete():\tResetting GUI lock as we're the only ones here!") + ageSDL[sdlGUILock] = (0,) + boolGUILock = 0 + else: + boolGUILock = ageSDL[sdlGUILock][0] + + print "jlakField.OnServerInitComplete(): byteStartPt = ",byteStartPt + print "jlakField.OnServerInitComplete(): boolWall = ",boolWall + print "jlakField.OnServerInitComplete(): byteSphere = ",byteSphere + print "jlakField.OnServerInitComplete(): byteLilBox = ",byteLilBox + print "jlakField.OnServerInitComplete(): byteBigBox = ",byteBigBox + print "jlakField.OnServerInitComplete(): byteRamp = ",byteRamp + print "jlakField.OnServerInitComplete(): byteRect = ",byteRect + print "jlakField.OnServerInitComplete(): boolGUILock = ",boolGUILock + for sdl in sdlColumns: + ageSDL.setFlags(sdl,1,1) + ageSDL.sendToClients(sdl) + ageSDL.setNotify(self.key,sdl,0.0) + val = ageSDL[sdl][0] + byteColumns.append(val) + print "jlakField.OnServerInitComplete(): byteColumns = ",byteColumns + + kZeroed = ptVector3(0,0,0) + + for objCol in objColumns.value: + obj = objCol.getName() + listObjCols.append(obj) + print "listObjCols = ",listObjCols + + if len(clkColumnUp.value) != len(listObjCols): + print "error! not enough up clickables" + elif len(clkColumnDn.value) != len(listObjCols): + print "error! not enough down clickables" + + for resp in respSfxColumn.value: + aResp = resp.getName() + listSfxCols.append(aResp) + #print "listSfxCols = ",listSfxCols + + for warp in warpPlayers.value: + pt = warp.getName() + listWarpPlayers.append(pt) + #print "listWarpPlayers = ",listWarpPlayers + + if not len(PtGetPlayerList()): + print "jlakField.OnServerInitComplete(): on link-in, am only player here. Will reset player start point" + newPoint = byteStartPt + while newPoint == byteStartPt: + newPoint = xRandom.randint(0,len(listWarpPlayers)-1) + byteStartPt = newPoint + # make sure any widgets that are supposed to be 'home' are really there + if byteSphere == len(objSpheres.value): + self.WarpWidgetsHome(0) + if byteLilBox == len(objLilBoxes.value): + self.WarpWidgetsHome(1) + if byteBigBox == len(objBigBoxes.value): + self.WarpWidgetsHome(2) + if byteRamp == len(objRamps.value): + self.WarpWidgetsHome(3) + if byteRect == len(objRects.value): + self.WarpWidgetsHome(4) + elif len(PtGetPlayerList()) == 1: + print "jlakField.OnServerInitComplete(): on link-in, 1 player already here. Will warp 2 points away (across from previous point)" + byteStartPt = byteStartPt+2 + if byteStartPt == 4: + byteStartPt = 0 + elif byteStartPt >= 5: # greater than 5 shouldn't be possible, but as a safety... + byteStartPt = 1 + else: + print "jlakField.OnServerInitComplete(): on link-in, 2 or more players already here. Will warp to next point" + if byteStartPt == 0: + byteStartPt = 2 + elif byteStartPt == 1: + byteStartPt = 0 + elif byteStartPt == 2: + byteStartPt = 3 + elif byteStartPt == 3: + byteStartPt = 1 + print "jlakField.OnServerInitComplete(): player start point = ",byteStartPt + + onInit = 1 + i = 0 + for pos in byteColumns: + if pos != 0: + self.MoveColumn(i,pos,onInit) + i += 1 + + warpWidgets = warpWidgetsPlay.value[0].getKey() + + warpPt = warpPlayers.value[byteStartPt].getKey() + LocalAvatar.physics.warpObj(warpPt) + ageSDL[sdlStartPt] = (byteStartPt,) + +# vault = ptVault() +# if not vault.amOwnerOfCurrentAge(): +# return + + if boolWall: + respWallToggle.run(self.key,state="on",fastforward=1,netPropagate=0) + self.DoWallSensors(1) + else: + respWallToggle.run(self.key,state="off",fastforward=1,netPropagate=0) + self.DoWallSensors(0) + + if PtGetLocalKILevel() < 2: + print "jlakField.OnServerInitComplete(): KI level too low, columns will not be clickable" + for up in clkColumnUp.value: + up.disable() + for dn in clkColumnDn.value: + dn.disable() + + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global byteStartPt + global boolWall + global byteColumns + global byteSphere + global byteLilBox + global byteBigBox + global byteRamp + global byteRect + global boolGUILock + ageSDL = PtGetAgeSDL() + PtDebugPrint("jlakField.OnSDLNotify():\t VARname: %s, SDLname: %s, tag: %s, value: %d" % (VARname,SDLname,tag,ageSDL[VARname][0])) + + if VARname == sdlStartPt: + byteStartPt = ageSDL[sdlStartPt][0] + print "jlakField.OnSDLNotify(): byteStartPt = ",byteStartPt + if VARname == sdlWall: + boolWall = ageSDL[sdlWall][0] + print "jlakField.OnSDLNotify(): boolWall = ",boolWall + if boolWall: + respWallToggle.run(self.key,state="on",fastforward=0,netPropagate=0) + self.DoWallSensors(1) + else: + respWallToggle.run(self.key,state="off",fastforward=0,netPropagate=0) + self.DoWallSensors(0) + if VARname in sdlColumns: + id = sdlColumns.index(VARname) + col = listObjCols[id] + oldPos = byteColumns[id] + newPos = ageSDL[sdlColumns[id]][0] + diffPos = abs(newPos-oldPos) + #print "oldPos = ",oldPos + #print "newPos = ",newPos + #print "diffPos = ",diffPos + clkColumnUp.value[id].disable() + clkColumnDn.value[id].disable() + animColumn.byObject[col].playToTime(newPos) + byteColumns[id] = newPos + print "jlakField.OnSDLNotify(): byteColumns[%d] = %d" % (id,newPos) + if newPos > oldPos: + dir = "up" + else: + dir = "down" + if not self.bulkMove: + respSfxColumn.run(self.key,state=(dir),objectName=listSfxCols[id]) + PtAtTimeCallback(self.key,diffPos,id) + if VARname == sdlGUILock: + boolGUILock = ageSDL[sdlGUILock][0] + print "jlakField.OnSDLNotify(): boolGUILock = ",boolGUILock + if VARname == sdlSphere: + byteSphere = ageSDL[sdlSphere][0] + if byteSphere == len(objSpheres.value): + self.WarpWidgetsHome(0) + else: + widget = objSpheres.value[byteSphere] + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpWidgets + widget.physics.enable(1) + widget.physics.warpObj(warpPt) + respCreateWidgetSFX.run(self.key) + print "jlakField.OnSDLNotify(): dropping: ",widgetName + print "jlakField.OnSDLNotify(): byteSphere = ",byteSphere + if VARname == sdlLilBox: + byteLilBox = ageSDL[sdlLilBox][0] + if byteLilBox == len(objLilBoxes.value): + self.WarpWidgetsHome(1) + else: + widget = objLilBoxes.value[byteLilBox] + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpWidgets + widget.physics.enable(1) + widget.physics.warpObj(warpPt) + respCreateWidgetSFX.run(self.key) + print "jlakField.OnSDLNotify(): dropping: ",widgetName + print "jlakField.OnSDLNotify(): byteLilBox = ",byteLilBox + if VARname == sdlBigBox: + byteBigBox = ageSDL[sdlBigBox][0] + if byteBigBox == len(objBigBoxes.value): + self.WarpWidgetsHome(2) + else: + widget = objBigBoxes.value[byteBigBox] + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpWidgets + widget.physics.enable(1) + widget.physics.warpObj(warpPt) + print "jlakField.OnSDLNotify(): dropping: ",widgetName + respCreateWidgetSFX.run(self.key) + print "jlakField.OnSDLNotify(): byteBigBox = ",byteBigBox + if VARname == sdlRamp: + byteRamp = ageSDL[sdlRamp][0] + if byteRamp == len(objRamps.value): + self.WarpWidgetsHome(3) + else: + widget = objRamps.value[byteRamp] + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpWidgets + widget.physics.enable(1) + widget.physics.warpObj(warpPt) + respCreateWidgetSFX.run(self.key) + print "jlakField.OnSDLNotify(): dropping: ",widgetName + print "jlakField.OnSDLNotify(): byteRamp = ",byteRamp + if VARname == sdlRect: + byteRect = ageSDL[sdlRect][0] + if byteRect == len(objRects.value): + self.WarpWidgetsHome(4) + else: + widget = objRects.value[byteRect] + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpWidgets + widget.physics.enable(1) + widget.physics.warpObj(warpPt) + respCreateWidgetSFX.run(self.key) + print "jlakField.OnSDLNotify(): dropping: ",widgetName + print "jlakField.OnSDLNotify(): byteRect = ",byteRect + + + def OnNotify(self,state,id,events): + ageSDL = PtGetAgeSDL() + #print "jlakField.OnNotify(): id = ",id + #if not state: + #return + + if ((id == clkColumnUp.id) or (id == clkColumnDn.id)) and state and LocalAvatar == PtFindAvatar(events) and PtGetLocalKILevel() >= 2: + for event in events: + if event[0] == kPickedEvent: + xEvent = event[3] + theClk = xEvent.getName() + print "jlakField.OnNotify(): pressed: ",theClk + if id == clkColumnUp.id: + direction = 1 + numClk = string.atoi(theClk[6:]) + else: + direction = 0 + numClk = string.atoi(theClk[6:]) + #print "numClk = ",numClk + self.CalcPos(numClk,direction) + +# elif id == rgnZeroPhysicals.id: +# print "rgnZeroPhysicals" +# print state +# for event in events: +# if event[0] == kCollisionEvent: +# print "collision event" +# hitter = event[2] + elif id == respBulkMoveSFX.id: + if self.sceneobject.isLocallyOwned() and boolGUILock: + ageSDL[sdlGUILock] = (0,) + elif id == (-1): + if events[0][1] == kBulkMoveVar: + if events[0][3] > 0: #We'll only enable bulk SFX if we've got a good reason to! + self.bulkMove = 1 #Disable individual Pillar SFX + if self.sceneobject.isLocallyOwned() and not boolGUILock: + print "jlakField.OnNotify(): bulk-move requested, will ignore GUI bulk-move buttons until done" + ageSDL[sdlGUILock] = (1,) + respBulkMoveSFX.run(self.key, state='on', netPropagate=0) + PtAtTimeCallback(self.key,events[0][3],kSFXCompleteID) + else: + print "incoming event: %s" % (events[0][1]) + code = events[0][1] + print "playing command: %s" % (code) + exec code + + + def CalcPos(self,id,dir): + #print "jlakField.CalcPos()" + global PendingCol + global PendingPos + global PendingDir + + PtForceCursorHidden() + PtEmoteAvatar("KITap") + PtAtTimeCallback(self.key,kEmoteTimer,kEmoteTimerID) + + oldPos = byteColumns[id] + if dir: + op = "up" + #print "jlakField.CalcPos(): request for column: ",id,", to go: ",op + if oldPos < kMaxPos: + newPos = oldPos + 1 + else: + print "but already at max" + return + else: + op = "down" + #print "jlakField.CalcPos(): request for column: ",id,", to go: ",op + if oldPos > kMinPos: + newPos = oldPos - 1 + else: + print "but already at min" + return + + PendingCol = id + PendingPos = newPos + PendingDir = op + PtAtTimeCallback(self.key,1.0,100) + + + def AutoColumns(self,mode,preset=None): + print "jlakField.AutoColumns(): requested all columns move using mode: ",mode + if boolGUILock: + print "jlakField.AutoColumns(): but a previous move is currently in-progress... so it's DENIED!" + return + anythingMoved = 0 + if mode == 0: #lowest + newPos = kMinPos + elif mode == 1: #mid + newPos = kInitPos + elif mode == 2: #highest + newPos = kMaxPos + elif mode == 3: #mild random + lowPos = kInitPos-5 + highPos = kInitPos+5 + anythingMoved = 1 + elif mode == 4: #extreme random + lowPos = kMinPos + highPos = kMaxPos + anythingMoved = 1 + elif mode == 5: + # experimental 'preset' mode + if preset == None: + print "no preset, ignoring" + return + else: + print "running preset..." + pass + + #Tye's Note: had to make this code work in two phases for SFX. + #The first phase creates the movement, analyzes it in the process, and prepares the SFX accordingly. + #The second phase actually moves the columns. + #The problem is that the SFX needs to prepare for any bulk movments before the movements happen. + #Unfortunately this makes the code less efficient.... but I've tried to optimize where possible + + i = 0 + maxDist = -1 + newColumns = [] + for col in listObjCols: + if mode in (0,1,2): + newColumns.append(newPos) + if byteColumns[i] != newPos: + maxDist = self.getMaxDist(maxDist, byteColumns[i], newPos) + anythingMoved = 1 + elif mode in (3,4): + newPos = byteColumns[i] + while newPos == byteColumns[i]: + newPos = xRandom.randint(lowPos,highPos) + maxDist = self.getMaxDist(maxDist, byteColumns[i], newPos) + newColumns.append(newPos) + elif mode == 5: + newPos = preset[i] + if newPos < 0 or newPos > 19: + newPos = 9 + newColumns.append(newPos) + if byteColumns[i] != newPos: + maxDist = self.getMaxDist(maxDist, byteColumns[i], newPos) + anythingMoved = 1 + i += 1 + + + #Determine what type of SFX to play (i.e. the note will disable individual SFX while enabling bulk SFX) + if anythingMoved and maxDist > 0: + #Send a note to start movement SFX! + notify = ptNotify(self.key) + notify.clearReceivers() + notify.addReceiver(self.key) + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + + notify.addVarNumber(kBulkMoveVar, maxDist) + notify.send() + + #Now finally start the movement.... + i = 0 + for col in listObjCols: + if newColumns[i] != byteColumns[i]: + self.MoveColumn(i,newColumns[i]) + i += 1 + + + def getMaxDist(self, maxDist, oldPoint, newPoint): + dist = abs(newPoint - oldPoint) + if dist > maxDist: + maxDist = dist + return maxDist + + + def MoveColumn(self,id,pos,onInit=0): + ageSDL = PtGetAgeSDL() + oldPos = byteColumns[id] + col = listObjCols[id] + #animColumn.byObject[col].speed(spd) #ensure animation plays at normal speed + if onInit: + print "jlakField.MoveColumn(): on init, fastforwarding column ",id," from position ",oldPos," to ",pos + animColumn.byObject[col].skipToTime(pos) + else: + ageSDL[sdlColumns[id]] = (pos,) + + + def DropWidget(self,widget): + ageSDL = PtGetAgeSDL() + + if widget == kSphere: + SphereCur = byteSphere + if SphereCur < (len(objSpheres.value)-1): + SphereCur += 1 + else: + SphereCur = 0 + ageSDL[sdlSphere] = (SphereCur,) + elif widget == kLilBox: + LilBoxCur = byteLilBox + if LilBoxCur < (len(objLilBoxes.value)-1): + LilBoxCur += 1 + else: + LilBoxCur = 0 + ageSDL[sdlLilBox] = (LilBoxCur,) + elif widget == kBigBox: + BigBoxCur = byteBigBox + if BigBoxCur < (len(objBigBoxes.value)-1): + BigBoxCur += 1 + else: + BigBoxCur = 0 + ageSDL[sdlBigBox] = (BigBoxCur,) + elif widget == kRamp: + RampCur = byteRamp + if RampCur < (len(objRamps.value)-1): + RampCur += 1 + else: + RampCur = 0 + ageSDL[sdlRamp] = (RampCur,) + elif widget == kRect: + RectCur = byteRect + if RectCur < (len(objRects.value)-1): + RectCur += 1 + else: + RectCur = 0 + ageSDL[sdlRect] = (RectCur,) + #print "jlakField.DropWidget(): dropping widget: ",widgetName + + + def ResetWidgets(self): + #print "jlakField.ResetWidgets()" + ageSDL = PtGetAgeSDL() + + ageSDL[sdlSphere] = (len(objSpheres.value),) + ageSDL[sdlLilBox] = (len(objLilBoxes.value),) + ageSDL[sdlBigBox] = (len(objBigBoxes.value),) + ageSDL[sdlRamp] = (len(objRamps.value),) + ageSDL[sdlRect] = (len(objRects.value),) + + + def WarpWidgetsHome(self,widgetType): + if widgetType == 0: + a = 0 + for widget in objSpheres.value: + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpSpheres.value[a].getKey() + widget.physics.warpObj(warpPt) + print "jlakField.WarpWidgetsHome(): resetting: ",widgetName + a += 1 + elif widgetType == 1: + b = 0 + for widget in objLilBoxes.value: + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpLilBoxes.value[b].getKey() + widget.physics.warpObj(warpPt) + print "jlakField.WarpWidgetsHome(): resetting: ",widgetName + b += 1 + elif widgetType == 2: + c = 0 + for widget in objBigBoxes.value: + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpBigBoxes.value[c].getKey() + widget.physics.warpObj(warpPt) + print "jlakField.WarpWidgetsHome(): resetting: ",widgetName + c += 1 + elif widgetType == 3: + d = 0 + for widget in objRamps.value: + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpRamps.value[d].getKey() + widget.physics.warpObj(warpPt) + print "jlakField.WarpWidgetsHome(): resetting: ",widgetName + d += 1 + elif widgetType == 4: + e = 0 + for widget in objRects.value: + widget.physics.setLinearVelocity(kZeroed) + widget.physics.setAngularVelocity(kZeroed) + widgetName = widget.getName() + warpPt = warpRects.value[e].getKey() + widget.physics.warpObj(warpPt) + print "jlakField.WarpWidgetsHome(): resetting: ",widgetName + e += 1 + + + def ToggleWall(self): + print "jlakField.ToggleWall()" + ageSDL = PtGetAgeSDL() + if boolWall: + ageSDL[sdlWall] = (0,) + else: + ageSDL[sdlWall] = (1,) + + + def DoWallSensors(self,state): + print "jlakField.DoWallSensors()" + for rgn in rgnWallSensors.value: + if state: + #print "jlakField.DoWallSensors(): ",rgn.getName()," enabled" + rgn.enable() + else: + #print "jlakField.DoWallSensors(): ",rgn.getName()," disabled" + rgn.disable() + + + def OnTimer(self,id): + global PendingCol + global PendingPos + global PendingDir + ageSDL = PtGetAgeSDL() + + if id >= 0 and id <= 99: + #print "jlakField.OnTimer(): reenabling up/down clickables for column: ",id + respSfxColumn.run(self.key,state="off",objectName=listSfxCols[id]) + clkColumnUp.value[id].enable() + clkColumnDn.value[id].enable() + elif id == 100: + if PendingCol != -1 and PendingPos != -1 and PendingDir != "": + self.MoveColumn(PendingCol,PendingPos,0) + PendingCol = -1 + PendingPos = -1 + PendingDir = "" + else: + print "timer callback to do pending column move, but vars are bad...?" + elif id == kEmoteTimerID: + PtForceCursorShown() + elif id == kSFXCompleteID: + self.bulkMove = 0 + respBulkMoveSFX.run(self.key, state='end', netPropagate=0) + + + def SaveColumns(self,fName): + fWrite = file(fName,'w') + print "jlakField.SaveColumns(): writing to presets file '%s'" % (fName) + i = 0 + for pos in byteColumns: + fWrite.write(str(pos)+"\n") + print "jlakField.SaveColumns(): column: %d at position: %d" % (i,pos) + i += 1 + fWrite.close() + + + def LoadColumns(self,fName): + try: + fRead = file(fName,'r') + except: + print "jlakField.LoadColumns(): ERROR! File '%s' not found, load canceled." % (fName) + #templist = [PtGetLocalPlayer()] + #PtSendRTChat(PtGetLocalPlayer(),templist,"doh!",1) + return + preset = [] + i = 0 + for line in fRead: + pos = string.atoi(line) + if pos < 0 or pos > 19: + print "jlakField.LoadColumns(): ERROR! Column %d has an invalid position of %d, must be an integer between 0 and 19. Load canceled." % (i,pos) + fRead.close() + return + else: + preset.append(pos) + i += 1 + if len(preset) != 25: + print "jlakField.LoadColumns(): ERROR! File contains %d positions, must contain positions for 25 columns, only. Load canceled." % (len(preset)) + else: + print "jlakField.LoadColumns(): reading preset file '%s'" % (fName) + print "this preset's columns = ",preset + self.AutoColumns(5,preset) + fRead.close() + + + def OnBackdoorMsg(self, target, param): + print "jlakField.OnBackdoorMsg()" + if target == "height": + param = string.atoi(param) + if param < kMinPos or param > kMaxPos: + print "invalid height parameter, must be a # between ",kMinPos," and ",kMaxPos + return + newPos = param + anythingMoved = 0 + i = 0 + for col in listObjCols: + if byteColumns[i] != newPos: + self.MoveColumn(i,newPos,0) + anythingMoved = 1 + i += 1 + if anythingMoved: + #respGameOps.run(self.key,state="reset") + pass + elif target == "reset": + if param == "widgets": + self.ResetWidgets() + else: + print "invalid reset parameter, can only use 'widgets' for now" + + + +#ColumnPos AnimStart +# 19 570 +# 18 540 +# 17 510 +# 16 480 +# 15 450 +# 14 420 +# 13 390 +# 12 360 +# 11 330 +# 10 300 +# ----------- +# 9 270 +# 8 240 +# 7 210 +# 6 180 +# 5 150 +# 4 120 +# 3 90 +# 2 60 +# 1 30 +# 0 0 + + diff --git a/Python/kdshGlowInTheDark.py b/Python/kdshGlowInTheDark.py new file mode 100644 index 0000000000..43ca0652fe --- /dev/null +++ b/Python/kdshGlowInTheDark.py @@ -0,0 +1,535 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: kdshGlowInTheDark.py +Age: Kadish Tolesa +Author: Doug McBride +Date: July 2002 +Operates the Glow in the Dark puzzle. +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import xSndLogTracks + +# define the attributes that will be entered in 3dsMAX +actSwitch01 = ptAttribActivator(1, "Act: Roof Button") +respButtonOneshot = ptAttribResponder(21,"Resp: Main Light Oneshot") + +respFloorDark = ptAttribResponder(2,"Resp: Floor Dark") +respFloorGlow = ptAttribResponder(3,"Resp: Floor Glow") +respFloorLitFromDark = ptAttribResponder(4,"Resp: LitFromDark") +respFloorLitFromGlow = ptAttribResponder(5,"Resp: LitFromGlow") + +respZone01 = ptAttribActivator(6, "Glow Zone 01") +respZone02 = ptAttribActivator(7, "Glow Zone 02") +respZone03 = ptAttribActivator(8, "Glow Zone 03") +respZone04 = ptAttribActivator(9, "Glow Zone 04") +respZone05 = ptAttribActivator(10, "Glow Zone 05") +respZone06 = ptAttribActivator(11, "Glow Zone 06") +respZone07 = ptAttribActivator(12, "Glow Zone 07") +respZone08 = ptAttribActivator(13, "Glow Zone 08") +respZone09 = ptAttribActivator(14, "Glow Zone 09") +respZone10 = ptAttribActivator(15, "Glow Zone 10") +respFloorZone = ptAttribActivator(16, "Floor Zone") + +rgnEnterSubTop = ptAttribActivator(17, "Elev Rgn at top") +respElevDown = ptAttribResponder(18,"resp: Elev Down",netForce=1) + +rgnEnterSubBtm = ptAttribActivator(19, "Elev Rgn at bottom") +respElevUp = ptAttribResponder(20,"resp: Elev Up",netForce=1) +# id 21 used above + +elevatorsubworld = ptAttribSceneobject(22,"elevator subworld") + +actResetBtn = ptAttribActivator(23, "act:Reset Button") +respResetBtn = ptAttribResponder(24, "resp:Reset Button") + +xRgnTop = ptAttribExcludeRegion(25, "xRgn Top of Shaft") +xRgnBottom = ptAttribExcludeRegion(26, "xRgn Bottom of Shaft") + +rgnExitSubTop = ptAttribActivator(27, "rgn:Exit Subworld Top") +rgnExitSubBtm = ptAttribActivator(28, "rgn:Exit Subworld Btm") + +objExitTop = ptAttribSceneobjectList(29,"ExitTopRegions") + +OnlyOneOwner = ptAttribSceneobject(30,"OnlyOneOwner") #ensures that after a oneshots, only one client toggles the SDL values + + +#globals +ElapsedTime = 0 +SecondsToCharge = 60 +baton = 0 +ElevatorDelay = 5 +Resetting = 0 + + +class kdshGlowInTheDark(ptResponder): + + def __init__(self): + # run parent class init + ptResponder.__init__(self) + self.id = 5212 + + version = 10 + self.version = version + print "__init__kdshGlowInTheDark v.", version,".5" + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + if ageSDL == None: + print "kdshGlowInTheDark:\tERROR---Cannot find the Kadish Age SDL" + #ageSDL["RoofClosed"] = (1, ) + #ageSDL["GlowCharged"] = (0, ) + #ageSDL["TimeOpened"] = (0, ) + #ageSDL["GlowInTheDarkSolved"] = (0,) + + ageSDL.setNotify(self.key,"RoofClosed",0.0) + ageSDL.setNotify(self.key,"GlowCharged",0.0) + ageSDL.setNotify(self.key,"TimeOpened",0.0) + + ageSDL.sendToClients("RoofClosed") + ageSDL.sendToClients("GlowCharged") + ageSDL.sendToClients("TimeOpened") + ageSDL.sendToClients("GlowInTheDarkSolved") + + ageSDL.setFlags("RoofClosed",1,1) + ageSDL.setFlags("GlowCharged",1,1) + ageSDL.setFlags("TimeOpened",1,1) + ageSDL.setFlags("GlowInTheDarkSolved",1,1) + + + RoofClosed = ageSDL["RoofClosed"][0] + GlowCharged = ageSDL["GlowCharged"][0] + solved = ageSDL["GlowInTheDarkSolved"][0] + + print "kdshGlowInTheDark: When I got here:" + + if not RoofClosed: + print "\tThe roof was open when I got here." + respFloorLitFromGlow.run(self.key,fastforward=1) + else: + print "\tThe roof is still closed." + + if RoofClosed and GlowCharged: + print "\tThe floor was glowing when I got here." + PtAtTimeCallback(self.key,1,5) + #~ respFloorGlow.run(self.key,fastforward=1) + else: + print "\tThe floor is not charged." + + if solved: + print "\tThe puzzle was solved." + print "\tThere are", len(PtGetPlayerList()), " other players in this Kadish instance." + if len(PtGetPlayerList()) == 0: + print "\t I'm alone, so I'm starting the elevator." + respElevDown.run(self.key) + PtAtTimeCallback(self.key,3,2) # clear xRgn at top + else: + print "\t Someone else was already in this Kadish instance. Depending on Overriding HighSDL component to synch elevator." + else: + print "\t The puzzle has not been solved. Putting elevator at the top." + respElevUp.run(self.key, fastforward=true) + + + + def OnNotify(self,state,id,events): + global baton + global Resetting + + ageSDL = PtGetAgeSDL() + + #~ print "kdshGlowInTheDark.OnNotify: state=%f id=%d events=" % (state,id),events + + if not state: + return + + if id == actSwitch01.id: + respButtonOneshot.run(self.key, events=events) + return + + elif id == respButtonOneshot.id and OnlyOneOwner.sceneobject.isLocallyOwned(): + print "##" + oldstate = ageSDL["RoofClosed"][0] # 1 is closed, 0 is open + + if oldstate == 1: # roof was previously closed + print "kdshGlowInTheDark: The roof is now open." + self.RecordOpenTime() + + GlowCharged = ageSDL["GlowCharged"][0] + print "kdshGlowInTheDark: GlowCharged = ", GlowCharged + #~ if GlowCharged: + #~ respFloorLitFromGlow.run(self.key) + #~ else: + #~ respFloorLitFromDark.run(self.key) + + elif oldstate == 0: # roof was previously open + print "kdshGlowInTheDark: The roof is now closed." + self.CalculateTimeOpen() + #~ respFloorDark.run(self.key) + + else: + print "kdshGlowInTheDark: Unexpected roof state: (%s)" % newstate + + newstate = abs(oldstate-1) # toggle roof state value + ageSDL["RoofClosed"] = (newstate, ) #write new state value to SDL + return + + elif id == respElevDown.id: + print "kdshGlowInTheDark: The elevator has reached the bottom." + PtAtTimeCallback(self.key,ElevatorDelay,1) # wait 10 seconds, then raise elevator again + xRgnBottom.releaseNow(self.key) + rgnEnterSubBtm.enable() + return + + elif id == respElevUp.id: + print "kdshGlowInTheDark: The elevator has reached the top." + PtAtTimeCallback(self.key,ElevatorDelay,3) # wait 10 seconds, then lower elevator again + xRgnTop.releaseNow(self.key) + rgnEnterSubTop.enable() + #~ rgnExitSubTop.enable() + for region in objExitTop.value: + region.physics.suppress(0) + return + + elif id >= 6 and id <= 15: #The 10 tiles + self.BatonPassCheck(id,events) + return + + elif id == 16: # The Entire Floor Zone + for event in events: + if event[0] == 1 and event[1] == 1: + print "kdshGlowInTheDark: A second player stepped on floor." + baton = 0 + elif event[0] == 1: + print "kdshGlowInTheDark: Floor unoccupied." + return + + elif id == actResetBtn.id: + print "kdshGlowInTheDark Reset Button clicked." + Resetting = 1 + respResetBtn.run(self.key,events=events) + return + + elif id == respResetBtn.id and OnlyOneOwner.sceneobject.isLocallyOwned(): + print "kdshGlowInTheDark Reset Button Pushed. Puzzle resetting." + + ageSDL["RoofClosed"] = (1, ) + ageSDL["GlowCharged"] = (0, ) + ageSDL["TimeOpened"] = (0, ) + + #Turn the looping elevator off + ageSDL["GlowInTheDarkSolved"] = (0,) + + # huevo + xSndLogTracks.LogTrack("94","143") + return + + elif id == rgnExitSubTop.id and PtWasLocallyNotified(self.key): + print "kdshGlowInTheDark: You stepped off the elevator at the top. Removing from Subworld" + avatarInElevator = PtFindAvatar(events) + avatarInElevator.avatar.exitSubWorld() + return + + elif id == rgnExitSubBtm.id and PtWasLocallyNotified(self.key): + print "kdshGlowInTheDark: You stepped off the elevator at the btm. Removing from Subworld" + avatarInElevator = PtFindAvatar(events) + avatarInElevator.avatar.exitSubWorld() + return + + elif id == rgnEnterSubTop.id and PtWasLocallyNotified(self.key): + print "You stepped on the elevator at the top. Joining subworld." + #~ rgnExitSubTop.disable() + + + avatarInElevator = PtFindAvatar(events) + avatarInElevator.avatar.enterSubWorld(elevatorsubworld.value) + return + + + elif id == rgnEnterSubBtm.id and PtWasLocallyNotified(self.key): + print "You stepped on the elevator at the bottom. Joining subworld." + rgnExitSubBtm.disable() + avatarInElevator = PtFindAvatar(events) + avatarInElevator.avatar.enterSubWorld(elevatorsubworld.value) + return + + + + else: + for event in events: + if event[0] == kVariableEvent: # Did another player just get out of the bucket by hitting ESC/backspace? (An OnControlKeyEvent I wouldn't have received) + TimerID=int(event[3]) + #~ print "\tTimer #", TimerID,"callback came through." + + if TimerID==1: + print "kdshGlowInTheDark: Timer 1 Callback. Raising elevator again." + xRgnBottom.clearNow(self.key) + rgnExitSubBtm.disable() + + if not self.sceneobject.isLocallyOwned(): + print "\tI'm not the owner, so I'll let another client netforce raise the elevator." + return + else: + respElevUp.run(self.key) + + if TimerID== 2: + print "kdshGlowInTheDark: Timer 2 Callback. Clearing top Xrgn" + xRgnTop.clearNow(self.key) + rgnEnterSubTop.disable() + + if TimerID== 3: + print "kdshGlowInTheDark: Timer 3 Callback." + ageSDL = PtGetAgeSDL() + solved = ageSDL["GlowInTheDarkSolved"][0] + if solved: + print "\t Puzzle is still solved. Lowering Elevator again." + PtAtTimeCallback(self.key,1,2) # clear Xrgn in 1 second + for region in objExitTop.value: + region.physics.suppress(1) + + rgnExitSubBtm.enable() + if not self.sceneobject.isLocallyOwned(): + print "\tI'm not the owner, so I'll let another client netforce lower the elevator." + return + else: + respElevDown.run(self.key) + + else: + print "\t Puzzle has been reset. Leaving elevator alone at top." + rgnEnterSubTop.disable() + for region in objExitTop.value: + region.physics.suppress(0) + if TimerID== 4: + print "kdshGlowInTheDark: Timer 4 Callback." + print "\tkdshGlowInTheDark.OnTimer: Running from Lit to Dark." + respFloorDark.run(self.key) + Resetting = 0 + + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global Resetting + ageSDL = PtGetAgeSDL() + + #~ print "kdshGlowInTheDark.OnSDLNotify: Variable",VARname,"updated." + + + if VARname == "RoofClosed": + + RoofClosed = ageSDL["RoofClosed"][0] + GlowCharged = ageSDL["GlowCharged"][0] + + if RoofClosed and GlowCharged and Resetting: + return + + if RoofClosed == 0: + if GlowCharged == 0: + respFloorLitFromDark.run(self.key) + else: + respFloorLitFromGlow.run(self.key) + + elif RoofClosed == 1: + if GlowCharged == 1: + respFloorGlow.run(self.key) + else: + respFloorDark.run(self.key) + + + elif VARname == "TimeOpened": + TimeOpened = ageSDL["TimeOpened"][0] + + elif VARname == "GlowCharged": + if not Resetting: + return + GlowCharged = ageSDL["GlowCharged"][0] + print "\tkdshGlowInTheDark.OnSDLNotify: GlowCharged now =",GlowCharged + + PtAtTimeCallback(self.key,6,4) + respFloorLitFromGlow.run(self.key) + + return + + def RecordOpenTime(self): + ageSDL = PtGetAgeSDL() + CurrentTime = PtGetDniTime() + print "kdshGlowInTheDark: The roof was opened at: ", CurrentTime + ageSDL["TimeOpened"] = (CurrentTime, ) #write new state value to SDL + + + def CalculateTimeOpen(self): + global SecondsToCharge + global ElapsedTime + ageSDL = PtGetAgeSDL() + + TimeOpened = ageSDL["TimeOpened"][0] + CurrentTime = PtGetDniTime() + #~ print "Though it's now closed, the roof was once opened at:", TimeOpened + #~ print "The roof was closed at: ", CurrentTime + + ElaspedTime = CurrentTime - TimeOpened + + #~ print "The roof was open for:", ElaspedTime + + if ElaspedTime > SecondsToCharge: + #~ print "The roof was open for:", ElaspedTime + print "kdshGlowInTheDark: The floor is now charged" + ageSDL["GlowCharged"] = (1, ) + else: + pass + #~ print "Not enough time to charge, because" + #~ print "ElapsedTime = ", ElaspedTime + #~ print "SecondsToCharge = ", SecondsToCharge + + def BatonPassCheck(self,id,events): + global baton + ageSDL = PtGetAgeSDL() + print "##" + + for event in events: + if event[0] == 7: # pruning a redundant event, so we only process enters and exits + break + + + if event[1] == 1 : #Player enters a zone + print "kdshGlowInTheDark: Entered Zone:", id-5 + if id == 6: # true as player enters start of Glow Path, effectively resetting baton setting + baton = 1 + elif id == baton+6: # true if player is entering a new zone, and the "baton" is in one less zone. Progress is being made here in solving the puzzle. + baton = baton + 1 + + + elif event[1] == 0: # Player exits a zone + print " kdshGlowInTheDark: Exited Zone:", id-5 + if baton != (id-4) and baton != 0: # Correctly advancing players always enter a new zone before exiting the current one. If this progress hasn't already been made, drop the baton. + print "kdshGlowInTheDark: Dropped the baton." + baton = 0 + + if id == 14 and baton == 10: #if you just exited region 9, you are in region 10, and your baton is 10, you solved the puzzle + solved = ageSDL["GlowInTheDarkSolved"][0] + if not solved: + print "GlowInTheDark: Puzzle solved." + ageSDL["GlowInTheDarkSolved"] = (1,) + baton = 0 + else: + print "GlowInTheDark: Yes, you completed the path, but I thought the path was already solved." + return + + if PtWasLocallyNotified(self.key): + print "kdshGlowInTheDark: Since you solved the puzzle, putting your avatar on elevator" + avatarInElevator = PtFindAvatar(events) + avatarInElevator.avatar.enterSubWorld(elevatorsubworld.value) + + rgnEnterSubTop.enable() + for region in objExitTop.value: + region.physics.suppress(1) + respElevDown.run(self.key) + + + PtAtTimeCallback(self.key,3,2) # clear xRgn at top + + + if baton > 0: + print "kdshGlowInTheDark: Baton value is now:", baton + + + def OnTimer(self,id): + global Resetting + + if id==1: + note = ptNotify(self.key) + note.clearReceivers() + note.addReceiver(self.key) + note.setActivate(1) + note.addVarNumber("foo",id) + note.send() + + #~ print "kdshGlowInTheDark: Timer 1 Callback. Raising elevator again." + #~ respElevUp.run(self.key) + #~ xRgnBottom.clearNow(self.key) + #~ rgnExitSubBtm.disable() + + if id == 2: + + if not self.sceneobject.isLocallyOwned(): + print "\tI'm not the owner, so I'll let another client tell all clients to clear top Xrgn." + return + else: + note = ptNotify(self.key) + note.clearReceivers() + note.addReceiver(self.key) + note.setActivate(1) + note.addVarNumber("foo",id) + note.send() + + #~ print "kdshGlowInTheDark: Timer 2 Callback. Clearing top Xrgn" + #~ xRgnTop.clearNow(self.key) + #~ rgnEnterSubTop.disable() + if id == 3: + note = ptNotify(self.key) + note.clearReceivers() + note.addReceiver(self.key) + note.setActivate(1) + note.addVarNumber("foo",id) + note.send() + + #~ print "kdshGlowInTheDark: Timer 3 Callback." + #~ ageSDL = PtGetAgeSDL() + #~ solved = ageSDL["GlowInTheDarkSolved"][0] + #~ if solved: + #~ print "\t Puzzle is still solved. Lowering Elevator again." + #~ respElevDown.run(self.key) + #~ PtAtTimeCallback(self.key,1,2) # clear Xrgn in 1 second + ##!!rgnExitSubTop.disable() + #~ for region in objExitTop.value: + #~ region.physics.suppress(1) + + #~ rgnExitSubBtm.enable() + + #~ else: + #~ print "\t Puzzle has been reset. Leaving elevator alone at top." + #~ rgnEnterSubTop.disable() + #~ for region in objExitTop.value: + #~ region.physics.suppress(0) + if id == 4: + note = ptNotify(self.key) + note.clearReceivers() + note.addReceiver(self.key) + note.setActivate(1) + note.addVarNumber("foo",id) + note.send() + + #~ print "kdshGlowInTheDark: Timer 4 Callback." + #~ print "\tkdshGlowInTheDark.OnTimer: Running from Lit to Dark." + #~ respFloorDark.run(self.key) + #~ Resetting = 0 + + if id == 5: + print "kdshGlowInTheDark: It's been one second. FF'ing floor to glow state." + respFloorGlow.run(self.key,fastforward=1) + + + diff --git a/Python/kdshPillarRoom.py b/Python/kdshPillarRoom.py new file mode 100644 index 0000000000..0a6ea1ba4f --- /dev/null +++ b/Python/kdshPillarRoom.py @@ -0,0 +1,645 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: kdshPillarRoom.py +Age: Kadish Tolesa +Author: Doug McBride +Date: June 2002, May 2003 +Operates the Pillar Room puzzle. +""" + +from Plasma import * +from PlasmaTypes import * +import string + + +# define the attributes that will be entered in 3dsMAX +actLever01 = ptAttribActivator(1, "Actvr: Lever 01") # Lever are numbered from left to right in the Max file +actLever02 = ptAttribActivator(2, "Actvr: Lever 02") +actLever03 = ptAttribActivator(3, "Actvr: Lever 03") +actLever04 = ptAttribActivator(4, "Actvr: Lever 04") +actLever05 = ptAttribActivator(5, "Actvr: Reset Ring") # Reset lever + +respLever01 = ptAttribResponder(6,"Rspndr: Lever 01") # responders which animate the motion of the levers themselves +respLever02 = ptAttribResponder(7,"Rspndr: Lever 02") +respLever03 = ptAttribResponder(8,"Rspndr: Lever 03") +respLever04 = ptAttribResponder(9,"Rspndr: Lever 04") +respLever05 = ptAttribResponder(10,"Rspndr: Reset Ring") + +PillarAnim = ptAttribAnimation(15,"Pillar Animation",byObject=1) +CounterAnim = ptAttribAnimation(16,"Counterweight Animation") +SolutionResp = ptAttribResponder(17, "resp: Lower Solution Ladder") + + +Ladderbox1 = ptAttribActivator(18, "Act: Ladderbox1") +Ladderbox2 = ptAttribActivator(19, "Act: Ladderbox2") +Ladderbox3 = ptAttribActivator(20, "Act: Ladderbox3") +Ladderbox4 = ptAttribActivator(21, "Act: Ladderbox4") +Ladderbox5 = ptAttribActivator(22, "Act: Ladderbox5") +Ladderbox6 = ptAttribActivator(23, "Act: Ladderbox6") +Ladderbox7 = ptAttribActivator(24, "Act: Ladderbox7") +Ladderbox8 = ptAttribActivator(25, "Act: Ladderbox8") +#these are the three where you hang +Ladderbox9 = ptAttribActivator(26, "Act: Ladderbox9") +Ladderbox10 = ptAttribActivator(27, "Act: Ladderbox10") +Ladderbox11 = ptAttribActivator(28, "Act: Ladderbox11") + +MultiStage1 = ptAttribBehavior(29, "Mbeh01: Ladder1 Bottom",netForce=1) +MultiStage2 = ptAttribBehavior(30, "Mbeh02: Ladder1 Top",netForce=1) +MultiStage3 = ptAttribBehavior(31, "Mbeh03: Ladder2 Bottom",netForce=1) +MultiStage4 = ptAttribBehavior(32, "Mbeh04: Ladder2 Top",netForce=1) +MultiStage5 = ptAttribBehavior(33, "Mbeh05: Ladder3 Bottom",netForce=1) +MultiStage6 = ptAttribBehavior(34, "Mbeh06: Ladder3 Top",netForce=1) +MultiStage7 = ptAttribBehavior(35, "Mbeh07: Ladder4 Bottom",netForce=1) +MultiStage8 = ptAttribBehavior(36, "Mbeh08: Ladder4 Top",netForce=1) +#these are the three where you hang +MultiStage9 = ptAttribBehavior(37, "Mbeh09: Ladder2 Top Hang",netForce=1) +MultiStage10 = ptAttribBehavior(38, "Mbeh10: Ladder3 Top Hang",netForce=1) +MultiStage11 = ptAttribBehavior(39, "Mbeh11: Ladder4 Top Hang",netForce=1) + +SolutionLadderBtm = ptAttribActivator(40, "Act:Solution Ladder Btm") +MultiSolutionBtm = ptAttribBehavior(41, "Mbeh:Solution Ladder Btm",netForce=1) +SolutionLadderTop = ptAttribActivator(42, "Act:Solution Ladder Top") +MultiSolutionTop = ptAttribBehavior(43, "Mbeh:Solution Ladder Top",netForce=1) + +RedLight = ptAttribResponder(44, "resp:Red Indicator Light") + +actResetBtn = ptAttribActivator(45, "act:Reset Button") +respResetBtn = ptAttribResponder(46, "resp:Reset Button") +RaiseSolutionLadder = ptAttribResponder(47, "resp: Raise Solution Ladder") + +PillarCamBlocker = ptAttribAnimation(48,"Deprecated") + +respSfxRaisePillar01 = ptAttribResponder(49,"resp:SFX Raise Pillar01") +respSfxRaisePillar02 = ptAttribResponder(50,"resp:SFX Raise Pillar02") +respSfxRaisePillar03 = ptAttribResponder(51,"resp:SFX Raise Pillar03") +respSfxRaisePillar04 = ptAttribResponder(52,"resp:SFX Raise Pillar04") + +respSfxLowerSolution = ptAttribResponder(53,"resp:SFX Lower Solution Rings") +respSfxSolutionReset = ptAttribResponder(54,"resp:SFX Reset Solution Rings") + +respSfxResetFromHeight1 = ptAttribResponder(55,"SFX Reset Pillar height 1",netForce=1) +respSfxResetFromHeight2 = ptAttribResponder(56,"SFX Reset Pillar height 2",netForce=1) +respSfxResetFromHeight3 = ptAttribResponder(57,"SFX Reset Pillar height 3",netForce=1) +respSfxResetFromHeight4 = ptAttribResponder(58,"SFX Reset Pillar height 4",netForce=1) + +respSolutionCam = ptAttribResponder(59,"resp:Solution Cam") + +OnlyOneOwner = ptAttribSceneobject(60,"OnlyOneOwner") #ensures that after a oneshots, only one client toggles the SDL values + +#globals +Resetting = false +PullsInProgress = 0 +PillarRoomSolvedCheck = 0 + + +class kdshPillarRoom(ptResponder): + + def __init__(self): + # run parent class init + ptResponder.__init__(self) + self.id = 5210 + + version = 19 + self.version = version + print "__init__kdshPillarRoom v.", version,".1" + + def OnServerInitComplete(self): + global PillarRoomSolvedCheck + + ageSDL = PtGetAgeSDL() + if ageSDL == None: + print "kdshPillarRoom.OnFirstUpdate():\tERROR---missing SDL (%s)" + return + + ageSDL.sendToClients("pheight01") + ageSDL.sendToClients("pheight02") + ageSDL.sendToClients("pheight03") + ageSDL.sendToClients("pheight04") + ageSDL.sendToClients("PillarsOccupied") + ageSDL.sendToClients("budget") + ageSDL.sendToClients("PillarsResetting") + + + ageSDL.setFlags("pheight01",1,1) + ageSDL.setFlags("pheight02",1,1) + ageSDL.setFlags("pheight02",1,1) + ageSDL.setFlags("pheight04",1,1) + ageSDL.setFlags("PillarsOccupied",1,1) + ageSDL.setFlags("budget",1,1) + ageSDL.setFlags("PillarsResetting",1,1) + + self.CleanUpLaddersIfImAlone() + + # register for notification of age SDL var changes + ageSDL.setNotify(self.key,"pheight01",0.0) + ageSDL.setNotify(self.key,"pheight02",0.0) + ageSDL.setNotify(self.key,"pheight03",0.0) + ageSDL.setNotify(self.key,"pheight04",0.0) + ageSDL.setNotify(self.key,"PillarsOccupied",0.0) + ageSDL.setNotify(self.key,"budget",0.0) + ageSDL.setNotify(self.key,"PillarRoomSolved",0.0) + ageSDL.setNotify(self.key,"PillarsResetting",0.0) + + print "kdshPillarRoom: When I got here:" + # initialize pillar whatnots based on SDL state + pillar = 1 + for pillar in [1,2,3,4]: + + currentheight = ageSDL["pheight0" + str(pillar)][0] + print "\t pheight0%s = %s " % (pillar, currentheight) + + if currentheight > 0: + + PillarAnim.byObject["pillar0" + str(pillar)].skipToTime(currentheight * 10) + #~ PillarCamBlocker.byObject["pillar0" + str(pillar) + "Collision"].skipToTime(currentheight * 10) + + #~ print "\t\tUpdating ladderboxes because of pillar #", pillar, " initial state" + self.EnableAppropriateLadders(pillar) + + print "\t budget = ", ageSDL["budget"][0] + CounterAnim.animation.skipToTime((8 - ageSDL["budget"][0]) * 10) + if ageSDL["pheight01"][0] == 1 and ageSDL["pheight02"][0] == 4 and ageSDL["pheight03"][0] == 1 and ageSDL["pheight04"][0] == 2 and ageSDL["PillarRoomSolved"][0] != 1: # true if puzzle correct + #hopefully, this will make sure that the solution is set to solved in case they weren't + PillarRoomSolvedCheck = 1 + ageSDL["PillarRoomSolved"] = (1,) + + print "\t PillarRoomSolved = ", ageSDL["PillarRoomSolved"][0] + if ageSDL["PillarRoomSolved"][0] == 1: + SolutionResp.run(self.key, fastforward=1) + + SolutionLadderBtm.enable() + SolutionLadderTop.enable() + + + def OnNotify(self,state,id,events): + global Resetting + global PullsInProgress + + ageSDL = PtGetAgeSDL() + #~ print "kdshPilllarRoom:OnNotify state=%f id=%d events=" % (state,id),events + + if id in [1,2,3,4,5]: # One of the four levers or the reset ring were clicked by a player + code = "respLever0" + str(id) + ".run(self.key, events=events)" + exec code + return + + elif id in [6,7,8,9] and OnlyOneOwner.sceneobject.isLocallyOwned(): # One of the four levers actually pulled by an avatar + if Resetting: + print "Lever pull ignored because the puzzle is still resetting." + return + + if (self.PillarIsSafeToMove(id)): #check to see if a climber is in the way of this pillar being rased + + if ageSDL["budget"][0] == 0: # true if 8 "raises" have already happened + print "Counterweight expired.\n" + + elif ageSDL["pheight0" + str(id-5)][0] == 4: # True if that particular pillar has already been raised 4 times + print "Pillar0%d is already at maximum height." % (id-5) + + else: + newheight = ageSDL["pheight0" + str(id-5)][0] + 1 + ageSDL["pheight0" + str(id-5)] = (newheight, ) + + + newbudget = ageSDL["budget"][0] - 1 + ageSDL["budget"] = (newbudget, ) + print "%d pulls left" % (newbudget) + else: + RedLight.run(self.key) + return + + + + + elif id == respResetBtn.id or id == respLever05.id: + if not OnlyOneOwner.sceneobject.isLocallyOwned(): + return + + if PullsInProgress > 0: + print "Can't reset now. PullsInProgress = ", PullsInProgress + return + + safetoreset = true + for pillarcheck in [6,7,8,9]: #using 6-9 because those ID numbers correspond with the callbacks after the "pull lever" oneshot, as if the lever was pulled + + if (self.PillarIsSafeToMove(pillarcheck)): + pass + else: + print "kdshPillar.OnNotify: A reset button was pushed, but Pillar", pillarcheck-4, "can't reset now." + safetoreset = false + + if safetoreset: + print "kdshShadowPath Reset Button Pushed." + self.ResetPuzzle() + return + + if not state: + return + + elif id >= 18 and id <=28 and PtWasLocallyNotified(self.key): + print "Ladderbox %s entered." % ( id- 17) + + LocalAvatar = PtFindAvatar(events) + + code = "MultiStage" + str(id-17) + ".run(LocalAvatar)" + #~ print "code = ", code + exec code + + return + + elif id == SolutionLadderBtm.id and PtWasLocallyNotified(self.key): + print "Solution Ladder mounted from bottom." + LocalAvatar = PtFindAvatar(events) + MultiSolutionBtm.run(LocalAvatar) + return + + elif id == SolutionLadderTop.id and PtWasLocallyNotified(self.key): + print "Solution Ladder mounted from top." + LocalAvatar = PtFindAvatar(events) + MultiSolutionTop.run(LocalAvatar) + return + + elif id == actResetBtn.id: + print "kdshPillarRoom Reset Button clicked." + LocalAvatar = PtFindAvatar(events) + respResetBtn.run(self.key,events=events) + return + + elif id == respSolutionCam.id and PtWasLocallyNotified(self.key): + # Cinematic payoff cam has finished. Reneable first person camera + cam = ptCamera() + cam.enableFirstPersonOverride() + return + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global Resetting + global PillarRoomSolvedCheck + ageSDL = PtGetAgeSDL() + + if VARname == "budget" or VARname == "PillarsOccupied": + return + elif VARname == "PillarRoomSolved" and PillarRoomSolvedCheck == 1: + PillarRoomSolvedCheck = 0 + elif VARname == "PillarRoomSolved": + + PillarRoomSolved = ageSDL["PillarRoomSolved"][0] + + if PillarRoomSolved: + SolutionResp.run(self.key) + respSfxLowerSolution.run(self.key) + SolutionLadderBtm.enable() + SolutionLadderTop.enable() + else: + RaiseSolutionLadder.run(self.key) + respSfxSolutionReset.run(self.key) + SolutionLadderBtm.disable() + SolutionLadderTop.disable() + + elif VARname == "PillarsResetting": + Resetting = ageSDL["PillarsResetting"][0] + print "kdshPillarRoom.OnSDLNotify: Resetting =",Resetting + + if Resetting: + + #this loop disables all ladder boxes, so the ladders can't be climbed. + for count in range(1,12): + code = "Ladderbox" + str(count) + ".disable()" + exec code + + #determine the height of the highest pillar so we can reset them at the same speed as the pillars reset + highest = 0 + sumofpulls = 0 + for pillar in [1,2,3,4]: + thisheight = ageSDL["pheight0" + str(pillar)][0] + sumofpulls=sumofpulls + thisheight + if thisheight > highest: + highest = thisheight + print "The highest pillar when you reset was ", highest," notches high." + + if highest != 0: + PtAtTimeCallback(self.key,5*highest,6) #disable everything until all the pillars are down + + code = "respSfxResetFromHeight" + str(highest) + ".run(self.key)" + exec code + + # if the counterweights have been lowered at all, this loop resets them + if ageSDL["budget"][0] != 8: + #CounterAnim.value.backwards(1) + + CounterAnim.value.speed(2*(float(sumofpulls)/float(highest))) # ensures counterweights will be reset by the same time, or before, the highest pillar + rangestart = (8 - ageSDL["budget"][0]) * 10 + #CounterAnim.value.playRange(0, rangestart) + CounterAnim.value.playRange(rangestart,0) + + ageSDL["budget"] = (8,) + + + for count in [1,2,3,4]: # this loop resets the pillars + if ageSDL["pheight0" + str(count)][0] != 0: # true for any pillar currently raised + PillarAnim.byObject["pillar0" + str(count)].backwards(1) + PillarAnim.byObject["pillar0" + str(count)].speed(2) # "Hurry up, I've got a puzzle to solve..." + rangestart = ageSDL["pheight0" + str(count)][0] * 10 + PillarAnim.byObject["pillar0" + str(count)].playRange(0, rangestart) + + #~ PillarCamBlocker.byObject["pillar0" + str(count) + "Collision"].backwards(1) + #~ PillarCamBlocker.byObject["pillar0" + str(count) + "Collision"].speed(2) # "Hurry up, I've got a puzzle to solve..." + #~ PillarCamBlocker.byObject["pillar0" + str(count) + "Collision"].playRange(0, rangestart) + + + ageSDL["pheight0" + str(count)] = (0,) + print "Pillar0%d height is now: %d" % (count, ageSDL["pheight0" +str(count)][0]) + + + return + + elif not Resetting: # Any other SDL VARname that would come through would have to do with raising a pillar. + id = string.atoi(VARname[-1:]) + + newpheight = ageSDL["pheight0" + str(id)][0] + if newpheight == 0: # if height is now 0, don't move it with RaiseAPillar, because ResetPuzzle has already taken care of it + return + + #~ print "OnSDLNotify: Pillar # %d was updated" % (id) + self.RaiseAPillar(id) + self.LowerCounterweight() + self.CheckSolution(playerID) + self.DisableAppropriateLadders(id) + + PtAtTimeCallback(self.key,10,id) # This will enable the appropriate ladders 10 seconds later + + def CleanUpLaddersIfImAlone(self): + ageSDL = PtGetAgeSDL() + + if len(PtGetPlayerList()) == 0: + ageSDL["PillarsOccupied"] = (0,) + ageSDL["PillarsResetting"] = (0,) + else: + print "kdshPillar.Load: I'm not alone in Kadish. Leaving Ladder SDLs as they previously were." + + def PillarIsSafeToMove(self,id): + ageSDL = PtGetAgeSDL() + + if ageSDL["PillarsOccupied"][0]: + print "PillarIsSafeToMove: Can't do that now. Someone is on a pillar." + return false + else: + #~ print "PillarIsSafeToMove: Pillar",id-5,"is OK to move now." + return true + + def RaiseAPillar(self,id): + ageSDL = PtGetAgeSDL() + PillarAnim.byObject["pillar0" + str(id)].backwards(0) # ensure animation plays forward + PillarAnim.byObject["pillar0" + str(id)].speed(1) # ensure animation plays at normal speed + rangestart = (ageSDL["pheight0" + str(id)][0] - 1) * 10 + rangeend = ageSDL["pheight0" + str(id)][0] * 10 + PillarAnim.byObject["pillar0" + str(id)].playRange(rangestart, rangeend) + + #~ PillarCamBlocker.byObject["pillar0" + str(id) + "Collision"].backwards(0) # ensure animation plays forward + #~ PillarCamBlocker.byObject["pillar0" + str(id) + "Collision"].speed(1) # ensure animation plays at normal speed + #~ PillarCamBlocker.byObject["pillar0" + str(id) + "Collision"].playRange(rangestart, rangeend) + + #play the sound effect for that pillar + code = "respSfxRaisePillar0" + str(id) + ".run(self.key)" + exec code + + print "\n##" + print "Pillar0%d height is now: %d" % (id, ageSDL["pheight0" + str(id)][0]) + + def LowerCounterweight(self): + global PullsInProgress + ageSDL = PtGetAgeSDL() + CounterAnim.value.backwards(0) # ensures animation plays forward + + PullsInProgress = PullsInProgress + 1 + + CounterAnim.value.speed(PullsInProgress) # lower counterweights faster, because two pillars are in motion. + #~ print "\tCounterweight lowering at speed of ", PullsInProgress,"x" + + rangeend = (8 - ageSDL["budget"][0]) * 10 + #~ print "\t Lowering counterweight to: (rangeend)", rangeend + CounterAnim.animation.playToTime(rangeend) + + def CheckSolution(self,pullerID): + ageSDL = PtGetAgeSDL() + + if ageSDL["pheight01"][0] == 1 and ageSDL["pheight02"][0] == 4 and ageSDL["pheight03"][0] == 1 and ageSDL["pheight04"][0] == 2: # true if puzzle correct + print "kdshPillarRoom: Puzzle solved. \n" + PtAtTimeCallback(self.key,10,5) # 10 second delay before lowering solution rings + + #run the solution cam, but only for the person who pulled the final lever + avatar = PtGetLocalAvatar() + myID = PtGetClientIDFromAvatarKey(avatar.getKey()) + print "kdshPillarRoom.CheckSolution: pullerID=", pullerID,"myID=",myID + if myID == pullerID: + print "\tI pulled the final lever. Playing solution cam." + + # Disable First Person Camera + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + respSolutionCam.run(self.key) + + else: + print "\tI did not pull the final lever." + + + def ResetPuzzle(self): + ageSDL = PtGetAgeSDL() + budget = ageSDL["budget"][0] + print "kdshPillarRoom.ResetPuzzle: budget = ", budget + if budget != 8: + + ageSDL["PillarsResetting"] = (1,) + ageSDL["PillarRoomSolved"] = (0,) + print "\tAt least one pillar has been raised. Resetting Pillar puzzle" + else: + print "Each of the four pillars was already down. Won't reset." + return + + def OnTimer(self,id): + ageSDL = PtGetAgeSDL() + global Resetting + global PullsInProgress + + if id in [1,2,3,4]: + #~ print "Pillar #",id," has finished moving." + self.EnableAppropriateLadders(id) + PullsInProgress = PullsInProgress - 1 + + elif id == 5: # 10 second delay before lowering solution rings + ageSDL["PillarRoomSolved"]= (1,) + + elif id == 6: + if Resetting: + #~ print "kdshPillarRoom: Puzzle is done resetting (caused by reset ring)" + ageSDL["PillarsResetting"] = (0,) + Resetting = 0 + + def DisableAppropriateLadders(self,pillar): # only the ladders boxes affected by raising this pillar are disabled during movement + #sometimes it's easier to just list things directly + if pillar == 1: + ladderstodisable = [1,2,3,4,9] + elif pillar == 2: + ladderstodisable = [3,4,5,6,9,10] + elif pillar == 3: + ladderstodisable = [5,6,7,8,10,11] + elif pillar == 4: + ladderstodisable = [7,8,11] + + #~ print "DisableAppropriateLadders: pillar = ", pillar, + #~ print " ladderstodisable = ", ladderstodisable + + for each in ladderstodisable: + code = "Ladderbox" +str(each) + ".disable()" + exec code + #~ print "Immediately disabling ladderbox", each + + def EnableAppropriateLadders(self,id): # when pillar is done raising, enable appropriate ladder boxes with new lengths + ageSDL = PtGetAgeSDL() + + # Manage the 2 ladder boxes related to the ladder ON this pillar (connecting this pillar with the PREVIOUS one) + if id != 1: # true unless the first pillar was raised; Pillar #1 has no proceeding pillar + difference01 = ageSDL["pheight0" + str(id)][0] - ageSDL["pheight0" + str(id-1)][0] # calculates difference between this and proceeding pillar + tolerance01 = (5 - id) # Pillar01 ladder is 4 notches high, Pillar02 ladder is 3 notches high, pillar03 ladder is 2 notches high, pillar04 ladder is 1 notch high + #print "Ladder tolerance for proceeding pillar:", tolerance01 + + if difference01 >= 1: # true if this pillar is higher than proceeding pillar + #~ print "\nPillar0%d is %d notches higher than the proceeding pillar" % (id, difference01) + if difference01 > tolerance01: # true if the ladder on this pillar is out of reach from the proceeding pillar + #~ print "Ascending Ladder box #%d is now disabled, since the ladder doesn't reach down that far" % (id * 2 - 1) + # do something to ladder box (id * 2 - 1) + code = "Ladderbox" + str(id * 2 - 1) + ".disable()" + exec code + + #~ print "Descending Ladder box #%d is now enabled, but only to %d rungs, and then you hang." % (id + 7, (6*(5-id) - 4)) # + # do something to ladder box (id * 2) + code = "Ladderbox" + str(id * 2) + ".disable()" + exec code + #do something to ladderbox (id + 7) + code = "Ladderbox" + str(id + 7) + ".enable()" + exec code + + else: # Now progression from the previous pillar can happen + #~ print "Ascending Ladder box #%d enabled with %d rungs." % (id * 2 - 1, 6 * difference01 - 4) + # do something to ladder box (id * 2 - 1) + code = "Ladderbox" + str(id * 2 - 1) + ".enable()" + exec code + code = "MultiStage" + str(id * 2 - 1) + ".setLoopCount(1," + str( 6 * difference01 - 4) + ")" + exec code + + + + #~ print "Descending Ladder box #%d enabled with %d rungs." % (id * 2, 6 * difference01 - 4) + # do something to ladder box (id * 2) + code = "Ladderbox" + str(id * 2) + ".enable()" + exec code + code = "MultiStage" + str(id * 2) + ".setLoopCount(1," + str(6 * difference01 - 4) + ")" + exec code + + #disable the "hang" ladder box + code = "Ladderbox" + str(id + 7) + ".disable()" + exec code + + + + else: + #~ print "\nPillar0%d is level with or below the proceeding pillar." % (id) + code = "Ladderbox" + str(id * 2 - 1) + ".disable()" + exec code + code = "Ladderbox" + str(id * 2) + ".disable()" + exec code + + + else: # special condition for pillar01 + # do something to ladder box 1 + #~ print "Pillar01 is %d notches higher than ground level" % (ageSDL["pheight01"][0]) + #~ print "Ascending Ladder box #1 is now enabled with %d rungs." % (ageSDL["pheight01"][0] * 10) + rungs = 6 * (ageSDL["pheight01"][0]) - 4 + #~ print "Ladderbox1 rungs = ", rungs + MultiStage1.setLoopCount(1,rungs) + Ladderbox1.enable() + + + #~ print "Descending Ladder box #2 is now enabled with %d rungs." % (ageSDL["pheight01"][0] * 10) + # do something to ladder box 2 + rungs = 6 * (ageSDL["pheight01"][0]) - 4 + #~ print "Ladderbox2 rungs = ", rungs + MultiStage2.setLoopCount(1,rungs) + Ladderbox2.enable() + + + # Manage the 2 ladder boxes related to the ladder on the NEXT pillar (connecting this pillar with the NEXT one) + if id != 4: # true unless the last pillar was raised; Pillar #4 as no following pillar + difference02 = ageSDL["pheight0" + str(id+1)][0] - ageSDL["pheight0" + str(id)][0] # calculates difference between this and following pillar + tolerance02 = (5 - (id+1)) # Pillar01 ladder is 4 notches high, Pillar02 ladder is 3 notches high, pillar03 ladder is 2 notches high, pillar04 is 1 notch high. Note that we're concerned about the NEXT pillar's ladder, hence the id+1. + + if difference02 >= 1: + #~ print "\nPillar0%d is %d notches lower than the following pillar" % (id, difference02) + if difference02 > tolerance02: # true if the next pillar's ladder is out of reach from this pillar + #~ print "Ascending Ladder box #%d is now disabled, since the ladder doesn't reach down that far" % (id * 2 + 1) + #do something to ladder box (id * 2 + 1) + code = "Ladderbox" + str(id * 2 + 1) + ".disable()" + exec code + + #~ print "Descending Ladder box #%d is enabled, but only down %d rungs, and then you hang." % (id + 8, (6 *(4-id) - 4)) # "4 - id" here same as "(5 - (id+1))" + # do something to ladder box (id * 2 + 2) + code = "Ladderbox" + str(id * 2 + 2) + ".disable()" + exec code + #do something to ladderbox (id + 8) + code = "Ladderbox" + str(id + 8) + ".enable()" + exec code + + + + else: # Now progression to the following pillar can happen + #~ print "Ascending Ladder box #%d enabled with %d rungs." % (id * 2 + 1, 6 * difference02 - 4) + # do something to ladder box (id * 2 + 1) + code = "Ladderbox" + str(id * 2 + 1) + ".enable()" + exec code + code = "MultiStage" + str(id * 2 + 1) + ".setLoopCount(1," + str( 6 * difference02 - 4) + ")" + exec code + + + #~ print "Descending Ladder box #%d enabled with %d rungs." % (id * 2 + 2, 6 * difference02 -4) + # do something to ladder box (id * 2 + 2) + code = "Ladderbox" + str(id * 2 + 2) + ".enable()" + exec code + code = "MultiStage" + str(id * 2 + 2) + ".setLoopCount(1," + str(6 * difference02 - 4) + ")" + exec code + + #disable the "hang" ladder box + code = "Ladderbox" + str(id + 8) + ".disable()" + exec code + + else: + #~ print "\nPillar0%d is level with or above the following pillar" % (id) + pass + + else: #special condition for pillar04 + if ageSDL["pheight04"][0] == 4: + print "Pillar04 has reached the red herring door" \ No newline at end of file diff --git a/Python/kdshShadowPath.py b/Python/kdshShadowPath.py new file mode 100644 index 0000000000..f4e161605a --- /dev/null +++ b/Python/kdshShadowPath.py @@ -0,0 +1,327 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: kdshShadowPath.py +Age: Kadish Tolesa +Author: Doug McBride +Date: July 2002 +Operates the Shadow Path puzzle. +""" + +from Plasma import * +from PlasmaTypes import * +import string + +# define the attributes that will be entered in 3dsMAX +actSwitch01 = ptAttribActivator(1, "Actvr: Switch 01") # Switches are numbered left to right in a counterclockwise fashion +actSwitch02 = ptAttribActivator(2, "Actvr: Switch 02") +actSwitch03 = ptAttribActivator(3, "Actvr: Switch 03") +actSwitch04 = ptAttribActivator(4, "Actvr: Switch 04") +actSwitch05 = ptAttribActivator(5, "Actvr: Switch 05") + + +respSwitch01 = ptAttribResponder(6,"Rspndr: Switch 01",['on', 'off']) # responders which animate the motion of the switches themselves +respSwitch02 = ptAttribResponder(7,"Rspndr: Switch 02",['on', 'off']) +respSwitch03 = ptAttribResponder(8,"Rspndr: Switch 03",['on', 'off']) +respSwitch04 = ptAttribResponder(9,"Rspndr: Switch 04",['on', 'off']) +respSwitch05 = ptAttribResponder(10,"Rspndr: Switch 05",['on', 'off']) + +regZone01 = ptAttribActivator(11, "Stair Zone 01") +regZone02 = ptAttribActivator(12, "Stair Zone 02") +regZone03 = ptAttribActivator(13, "Stair Zone 03") +regZone04 = ptAttribActivator(14, "Stair Zone 04") +regZone05 = ptAttribActivator(15, "Stair Zone 05") +regZone06 = ptAttribActivator(16, "Stair Zone 06") +regZone07 = ptAttribActivator(17, "Stair Zone 07") +regZone08 = ptAttribActivator(18, "Stair Zone 08") +regZone09 = ptAttribActivator(19, "Stair Zone 09") +#regZone10 = ptAttribActivator(20, "Stair Zone 10") + +RevealStairs = ptAttribResponder(21,"resp:Open Floor") + +FloorZone = ptAttribActivator(22,"Floor Zone") + +actResetBtn = ptAttribActivator(23, "act:Reset Button") +respResetBtn = ptAttribResponder(24, "resp:Reset Button") + +ConcealStairs = ptAttribResponder(25,"resp:Close Floor") + +respBtnPush01 = ptAttribResponder(26,"resp:Btn Push 01",netForce=1) +respBtnPush02 = ptAttribResponder(27,"resp:Btn Push 02",netForce=1) +respBtnPush03 = ptAttribResponder(28,"resp:Btn Push 03",netForce=1) +respBtnPush04 = ptAttribResponder(29,"resp:Btn Push 04",netForce=1) +respBtnPush05 = ptAttribResponder(30,"resp:Btn Push 05",netForce=1) + +OnlyOneOwner = ptAttribSceneobject(31,"OnlyOneOwner") #ensures that after a oneshots, only one client toggles the SDL values + +regZoneStart = ptAttribActivator(32, "Stair Zone Start") +regZoneFinish = ptAttribActivator(33, "Stair Zone Finish") +regZoneReset = ptAttribActivator(34, "Stair Zone Reset") + + +# define globals +baton = 0 +TwoOnFloor = false +lightClickedByAvatar = None #the avatar who clicked on a light +resetBtnByAvatar = None #the avatar who clicked on the reset button +localAvatar = None #The Local Avatar +gameStarted = 0 + +class kdshShadowPath(ptResponder): + + def __init__(self): + # run parent class init + ptResponder.__init__(self) + self.id = 5211 + + version = 10 + self.version = version + print "__init__kdshShadowPath v.", version,".2" + + + def OnServerInitComplete(self): + global localAvatar + localAvatar = PtGetLocalAvatar() + + ageSDL = PtGetAgeSDL() + + # register for notification of age SDL var changes + ageSDL.setNotify(self.key,"ShadowPathLight01",0.0) + ageSDL.setNotify(self.key,"ShadowPathLight02",0.0) + ageSDL.setNotify(self.key,"ShadowPathLight03",0.0) + ageSDL.setNotify(self.key,"ShadowPathLight04",0.0) + ageSDL.setNotify(self.key,"ShadowPathLight05",0.0) + ageSDL.setNotify(self.key,"ShadowPathSolved",0.0) + + + ageSDL.sendToClients("ShadowPathLight01") + ageSDL.sendToClients("ShadowPathLight02") + ageSDL.sendToClients("ShadowPathLight03") + ageSDL.sendToClients("ShadowPathLight04") + ageSDL.sendToClients("ShadowPathLight05") + ageSDL.sendToClients("ShadowPathSolved") + + ageSDL.setFlags("ShadowPathLight01",1,1) + ageSDL.setFlags("ShadowPathLight02",1,1) + ageSDL.setFlags("ShadowPathLight03",1,1) + ageSDL.setFlags("ShadowPathLight04",1,1) + ageSDL.setFlags("ShadowPathLight05",1,1) + ageSDL.setFlags("ShadowPathSolved",1,1) + + + + print "kdshShadowPath: When I got here:" + # initialize pillar whatnots based on SDL state + + for light in [1,2,3,4,5]: + + lightstate = ageSDL["ShadowPathLight0" + str(light)][0] + print "\t ShadowPathLight0%s = %s " % (light, lightstate) + + if lightstate == 1: + + code = "respSwitch0" + str(light) + ".run(self.key,fastforward=1)" + exec code + + print "\t\tTurning on light #", light + + solved = ageSDL["ShadowPathSolved"][0] + if solved: + print "\tThe Shadow Path was already solved. Revealing stairs." + RevealStairs.run(self.key,fastforward=1) + + + def Load(self): + count = 1 + while count < 5: + print "kdshShadowPath.Load(): ageSDL[ShadowPathLight0",count,"]=%d" % (ageSDL["ShadowPathLight0" + str(count)][0]) + count = count + 1 + + def OnNotify(self,state,id,events): + global TwoOnFloor + global baton + global lightClickedByAvatar + global resetBtnByAvatar + global LocalAvatar + global gameStarted + ageSDL = PtGetAgeSDL() + + print "kdshShadowPath:OnNotify state=%f id=%d events=" % (state,id),events + + + if id == FloorZone.id: + if events[0][1] == 1: + print "kdshShadowPath.OnNotify: More than one person on the floor!" + regZoneStart.disable() + gameStarted = 0 + elif events[0][1] == 0: + print "kdshShadowPath.OnNotify: Only one person on the floor!" + regZoneStart.enable() + + elif id == regZoneReset.id: + if events[0][1] == 1: + print "kdshShadowPath.OnNotify: Someone in the stairwell, reset disabled." + actResetBtn.disable() + elif events[0][1] == 0: + print "kdshShadowPath.OnNotify: No one's in the stairwell, reset enabled." + actResetBtn.enable() + + elif id in [1,2,3,4,5]: #true if one of the five switches clicked + if not state: + return + if PtFindAvatar(events) == localAvatar: + lightClickedByAvatar = localAvatar #this should only happen from the local triggerer + else: + lightClickedByAvatar = None + return + + print "Light ", id, " clicked." + code = 'respBtnPush0' + str(id) + '.run(self.key,events=events)' + exec code + + elif id in [26,27,28,29,30]: + if lightClickedByAvatar != localAvatar: #Make sure we don't have any rogue avatars reporting... + lightClickedByAvatar = None + return + + lightClickedByAvatar = None #Reset avatar reporting + + print "Light ", id-25, " actually touched by avatar." + oldstate = ageSDL["ShadowPathLight0" + str(id-25)][0] + newstate = abs(oldstate-1) # toggle value of switch state + ageSDL["ShadowPathLight0" + str(id-25)] = (newstate, ) # write new state value to SDL + return + + elif id in [regZone01.id,regZone02.id,regZone03.id,regZone04.id,regZone05.id,regZone06.id,regZone07.id,regZone08.id,regZone09.id]: + if gameStarted: + print "Triggered Bad Region!" + gameStarted = 0 + + elif id == regZoneStart.id: + print "Triggered Start Region!" + gameStarted = 1 + + elif id == regZoneFinish.id: + if gameStarted: + gameStarted = 0 + print "kdshShadowPath: Puzzle solved." + ageSDL["ShadowPathSolved"] = (1, ) # write new state value to SDL + + elif state and id == actResetBtn.id: + print "kdshShadowPath Reset Button clicked." + resetBtnByAvatar = PtFindAvatar(events) + respResetBtn.run(self.key,events=events) + + elif id == respResetBtn.id: + if resetBtnByAvatar != localAvatar: + resetBtnByAvatar = None + return + + print "kdshShadowPath Reset Button Pushed. Puzzle resetting." + resetBtnByAvatar = None + + #turn off the lights + for light in [1,2,3,4,5]: + lightstate = ageSDL["ShadowPathLight0" + str(light)][0] + if lightstate == 1: + code = 'ageSDL["ShadowPathLight0' + str(light) + '"] = (0,)' + print "resetcode = ", code + exec code + + print "\tTurning off light #", light + + #...and close the floor + ageSDL["ShadowPathSolved"] = (0,) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + ageSDL = PtGetAgeSDL() + #~ print "OnSDLNotified." + + if VARname == "ShadowPathSolved": + if ageSDL["ShadowPathSolved"][0] == 1: + print "kdshShadowPath: Opening floor" + RevealStairs.run(self.key) + else: + print "kdshShadowPath: Closing floor" + ConcealStairs.run(self.key) + + elif VARname[:15] == "ShadowPathLight": + light = string.atoi(VARname[-2:]) #get the last two digits, which is the light number + + #~ print "OnSDLNotify: Light ", light," SDL updated." + + newstate = ageSDL["ShadowPathLight0" + str(light)][0] + + if newstate == 0: # true if that switch is now off + print "kdshShadowPath.OnSDLNotify: Light", light," was on. Turning it off." + code = "respSwitch0" + str(light) + ".run(self.key, state='off')" + #~ print "off code = ", code + exec code + + elif newstate == 1: # true if that switch is now on + print "kdshShadowPath.OnSDLNotify: Light", light," was off. Turning it on." + code = "respSwitch0" + str(light) + ".run(self.key, state='on')" + #~ print "On code = ", code + exec code + + else: + print "Error. Not sure what the light thought it was." + +''' + def BatonPassCheck(self,id,events,ageSDL): + global baton + print "##" + + for event in events: + if event[0] == 7: # pruning a redundant event, so we only process enters and exits + break + + + if event[1] == 1 : #Player enters a zone + print "kdshShadowPath: Entered Zone:", id-10 + if id == 11: # true as player enters start of Shadow Path, effectively resetting baton setting + baton = 1 + elif id == baton+11: # true if player is entering a new zone, and the "baton" is in one less zone. Progress is being made here in solving the puzzle. + baton = baton + 1 + if baton == 10: + print "kdshShadowPath: Puzzle solved." + ageSDL["ShadowPathSolved"] = (1, ) # write new state value to SDL + + elif baton != 0: # true if player stepped off the path. Must start over to solve puzzle. + baton = 0 + print "Baton dropped. \n" + + + elif event[1] == 0: # Player exits a zone + print "kdshShadowPath: Exited Zone:", id-10 + if baton != 0 and baton != (id-9): # Correctly advancing players always enter a new zone before exiting the current one. If this progress hasn't already been made, drop the baton. + print "kdshShadowPath: Dropped the baton." + baton = 0 + + + + if baton > 0: + print "Baton value is now:", baton +''' diff --git a/Python/kdshTreeRings.py b/Python/kdshTreeRings.py new file mode 100644 index 0000000000..6e32cb1956 --- /dev/null +++ b/Python/kdshTreeRings.py @@ -0,0 +1,386 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: kdshTreeRings +Age: Kadish Tolesa +Date: March 2002 +Author: Doug McBride +As players engage and use the GUI, this sets the proper SDL values in the Kadish.sdl file +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys + +# define the attributes that will be entered in max +Activate = ptAttribActivator(1, "Activate Telescope", netForce=1) +Camera = ptAttribSceneobject(2,"Telescope camera") +Behavior = ptAttribBehavior(3, "Telescope behavior (multistage)",netForce=1) + +ScopeNumber = ptAttribInt(4, "Scope Number (1-3)") + +actResetBtn = ptAttribActivator(5, "act:Reset(only on scope3") +respResetBtn = ptAttribResponder(6, "resp:Reset Button",['Reset','OnInit']) + +respSfxRings = ptAttribResponder(7, "resp: Sfx Rings") +OnlyOneOwner = ptAttribSceneobject(8,"OnlyOneOwner") #ensures that after a oneshots, only one client toggles the SDL values + +# globals +LocalAvatar = None +boolScopeOperator = 0 +boolOperated = 0 + + +Telescope = ptInputInterface() + +kGUIRingTurnLeft = 110 +kGUIRingTurnCenter = 111 +kGUIRingTurnRight = 112 + +oldbearing = 0 +OuterRing = 0 +MiddleRing = 0 +InnerRing = 0 + + + + +class kdshTreeRings(ptModifier): + "Standard telescope modifier class" + def __init__(self): + ptModifier.__init__(self) + self.id = 5228 + + version = 13 + self.version = version + print "__init__kdshTreeRings v.", version,".1" + + def OnFirstUpdate(self): + PtLoadDialog("kdshScope0" + str(ScopeNumber.value), self.key, "Kadish") + #~ print "kdshTreeRings: Loading dialog ", ("kdshScope0" + str(ScopeNumber.value)) + """ ###Commented this out because it was never available anyway (note the 2nd defn)!!! + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + if ageSDL == None: + print "kdshTreeRings.OnFirstUpdate():\tERROR---missing age SDL (%s)" % varstring.value + + if ScopeNumber.value == 1: + ageSDL.sendToClients("boolOperatedScope01") + ageSDL.sendToClients("OperatorIDScope01") + ageSDL.setFlags("boolOperatedScope01",1,1) + ageSDL.setFlags("OperatorIDScope01",1,1) + + + ageSDL.sendToClients("OuterRing01") + ageSDL.sendToClients("MiddleRing01") + ageSDL.sendToClients("InnerRing01") + ageSDL.setFlags("OuterRing01",1,1) + ageSDL.setFlags("MiddleRing01",1,1) + ageSDL.setFlags("InnerRing01",1,1) + + elif ScopeNumber.value == 2: + ageSDL.sendToClients("boolOperatedScope02") + ageSDL.sendToClients("OperatorIDScope02") + ageSDL.setFlags("boolOperatedScope02",1,1) + ageSDL.setFlags("OperatorIDScope02",1,1) + + ageSDL.sendToClients("OuterRing02") + ageSDL.sendToClients("MiddleRing02") + ageSDL.sendToClients("InnerRing02") + ageSDL.setFlags("OuterRing02",1,1) + ageSDL.setFlags("MiddleRing02",1,1) + ageSDL.setFlags("InnerRing02",1,1) + + + elif ScopeNumber.value == 3: + ageSDL.sendToClients("boolOperatedScope03") + ageSDL.sendToClients("OperatorIDScope03") + ageSDL.setFlags("boolOperatedScope03",1,1) + ageSDL.setFlags("OperatorIDScope03",1,1) + + ageSDL.sendToClients("OuterRing03") + ageSDL.sendToClients("MiddleRing03") + ageSDL.sendToClients("InnerRing03") + ageSDL.setFlags("OuterRing03",1,1) + ageSDL.setFlags("MiddleRing03",1,1) + ageSDL.setFlags("InnerRing03",1,1) +""" + + def OnServerInitComplete(self): + global OuterRing + global MiddleRing + global InnerRing + global boolScopeOperated + ageSDL = PtGetAgeSDL() + + OuterRing = ageSDL["OuterRing0" + str(ScopeNumber.value)][0] + MiddleRing = ageSDL["MiddleRing0" + str(ScopeNumber.value)][0] + InnerRing = ageSDL["InnerRing0" + str(ScopeNumber.value)][0] + + print "Current %s Ring settings:" % (ScopeNumber.value) + print "/tOuterRing: ", OuterRing + print "/tMiddleRing: ", MiddleRing + print "/tInnerRing: ", InnerRing + + solo = true + if len(PtGetPlayerList()): + solo = false + + boolOperated = ageSDL["boolOperatedScope0" + str(ScopeNumber.value)][0] + if boolOperated: + if solo: + print "kdshTreeRings.Load():\tboolOperated=%d but no one else here...correcting" % boolOperated + boolOperated = 0 + ageSDL["boolOperatedScope0" + str(ScopeNumber.value)] = (0,) + ageSDL["OperatorIDScope0" + str(ScopeNumber.value)] = (-1,) + Activate.enable() + else: + Activate.disable() + print "kdshTreeRings.Load():\tboolOperated=%d, disabling telescope clickable" % boolOperated + #START-->multiplayer fix + ageSDL.sendToClients(('boolOperatedScope0' + str(ScopeNumber.value))) + ageSDL.setFlags(('boolOperatedScope0' + str(ScopeNumber.value)), 1, 1) + ageSDL.sendToClients(('OperatorIDScope0' + str(ScopeNumber.value))) + ageSDL.setFlags(('OperatorIDScope0' + str(ScopeNumber.value)), 1, 1) + ageSDL.sendToClients(('OuterRing0' + str(ScopeNumber.value))) + ageSDL.setFlags(('OuterRing0' + str(ScopeNumber.value)), 1, 1) + ageSDL.sendToClients(('MiddleRing0' + str(ScopeNumber.value))) + ageSDL.setFlags(('MiddleRing0' + str(ScopeNumber.value)), 1, 1) + ageSDL.sendToClients(('InnerRing0' + str(ScopeNumber.value))) + ageSDL.setFlags(('InnerRing0' + str(ScopeNumber.value)), 1, 1) + #END-->multiplayer fix + + if ScopeNumber.value == 3: + boolDoorClosed = ageSDL["TreeRingDoorClosed"][0] + if boolDoorClosed: + respResetBtn.run(self.key,state='OnInit',fastforward=1) + + + def AvatarPage(self, avObj, pageIn, lastOut): + "reset scope accessibility if scope user quits or crashes" + global boolScopeOperated + ageSDL = PtGetAgeSDL() + + if pageIn: + return + + avID = PtGetClientIDFromAvatarKey(avObj.getKey()) + if avID == ageSDL["OperatorIDScope0" + str(ScopeNumber.value)][0]: + Activate.enable() + ageSDL["OperatorIDScope0" + str(ScopeNumber.value)] = (-1,) + ageSDL["boolOperatedScope0" + str(ScopeNumber.value)] = (0,) + print "kdshTreeRings.AvatarPage(): telescope operator paged out, reenabled telescope." + else: + return + + def __del__(self): + "unload the dialog that we loaded" + #~ PtUnloadDialog(DialogName) + + + def OnNotify(self,state,id,events): + global LocalAvatar + global boolScopeOperator + ageSDL = PtGetAgeSDL() + #~ print "kdshTreeRings:OnNotify state=%f id=%d events=" % (state,id),events + + if state and id == Activate.id and PtWasLocallyNotified(self.key): + LocalAvatar = PtFindAvatar(events) + self.IStartTelescope() + + elif id == actResetBtn.id: + respResetBtn.run(self.key,state='Reset',events=events) + + elif id == respResetBtn.id and OnlyOneOwner.sceneobject.isLocallyOwned(): + print "kdshTreeRing Reset Button Pushed. Puzzle resetting." + + #close the door + ageSDL.setTagString("TreeRingDoorClosed","fromInside") + ageSDL["TreeRingDoorClosed"] = (1,) + + #reset the positions of the rings + for scope in [1,2,3]: + ageSDL["OuterRing0" + str(scope)] = (1,) + ageSDL["MiddleRing0" + str(scope)] = (1,) + ageSDL["InnerRing0" + str(scope)] = (1,) + + + # check if its an advance stage notify + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + if boolScopeOperator: + self.IEngageTelescope() + boolScopeOperator = 0 + break + + + def OnGUINotify(self,id,control,event): + global oldbearing + global OuterRing01 + ageSDL = PtGetAgeSDL() + + #~ print "kdshTreeRings: GUI Notify id=%d, event=%d control=" % (id,event),control + + #~ if event == kExitMode: + #~ self.IQuitTelescope() + + if event == kDialogLoaded: + return + print "GUI Notify id=%d, event=%d control=" % (id,event),control + # if the dialog was just loaded then show it + #~ control.show() + PtShowDialog("kdshScope0" + str(ScopeNumber.value)) + print "kdshTreeRings: Showing scope dialog ", ("kdshScope0" + str(ScopeNumber.value)) + + btnID = 0 + + if isinstance(control,ptGUIControlButton): + btnID = control.getTagID() + + if event == 5: # duplicate send on the first click of each button. Ignore it. + return + + if btnID == kGUIRingTurnLeft: + newbearing = ageSDL["OuterRing0" + str(ScopeNumber.value)][0] + 1 + if newbearing == 9: + newbearing = 1 + ageSDL["OuterRing0" + str(ScopeNumber.value)] = (newbearing,) + #~ PtDebugPrint ("kdshTreeRings: updated SDL %s value to %s" % (("OuterRing0" + str (ScopeNumber.value)), newbearing)) + + if btnID == kGUIRingTurnCenter or btnID == kGUIRingTurnLeft: + newbearing = ageSDL["MiddleRing0" + str(ScopeNumber.value)][0] + 1 + if newbearing == 9: + newbearing = 1 + ageSDL["MiddleRing0" + str(ScopeNumber.value)] = (newbearing,) + #~ PtDebugPrint ("kdshTreeRings: updated SDL %s value to %s" % (("MiddleRing0" + str (ScopeNumber.value)), newbearing)) + + + if btnID == kGUIRingTurnRight or btnID == kGUIRingTurnCenter or btnID == kGUIRingTurnLeft: + + #No matter which of the three buttons is pushed, play the sound + respSfxRings.run(self.key) + + newbearing = ageSDL["InnerRing0" + str(ScopeNumber.value)][0] + 1 + if newbearing == 9: + newbearing = 1 + ageSDL["InnerRing0" + str(ScopeNumber.value)] = (newbearing,) + #~ PtDebugPrint ("kdshTreeRings: updated SDL %s value to %s" % (("InnerRing0" + str (ScopeNumber.value)), newbearing)) + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode: + self.IQuitTelescope() + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + self.IQuitTelescope() + + + + def IStartTelescope(self): + "Start the action of looking at the telescope" + ageSDL = PtGetAgeSDL() + global LocalAvatar + global boolScopeOperator + + #disable KI and linking book + PtSendKIMessage(kDisableKIandBB,0) + + # disable the activator (only one in the telescope at a time) + Activate.disable() + boolScopeOperator = 1 # me! I'm the operator + ageSDL["boolOperatedScope0" + str(ScopeNumber.value)] = (1,) + avID = PtGetClientIDFromAvatarKey(LocalAvatar.getKey()) + ageSDL["OperatorIDScope0" + str(ScopeNumber.value)] = (avID,) + print "kdshTreeRings.OnNotify:\twrote SDL - scope operator id = ", avID + # start the behavior + Behavior.run(LocalAvatar) + + + def IEngageTelescope(self): + global Telescope + ageSDL = PtGetAgeSDL() + + Telescope.pushTelescope() + "After the behavior gets our eyes in the telescope, engage ourselves with the camera" + + #Send note to kdshTreeRingsSolution to fast forward the fake rings + note = ptNotify(self.key) + note.setActivate(1.0) + note.addVarNumber("FastForward",ScopeNumber.value) + note.send() + # get control key events + PtEnableControlKeyEvents(self.key) + + + + + # Disable First Person Camera + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + # set camera to telescope + virtCam = ptCamera() + virtCam.save(Camera.sceneobject.getKey()) + + # show the cockpit + PtShowDialog("kdshScope0" + str(ScopeNumber.value)) + #~ print "kdshTreeRings: Showing scope dialog ", ("kdshScope0" + str(ScopeNumber.value)) + + + def IQuitTelescope(self): + "Disengage and exit the telescope mode" + global LocalAvatar + global boolScopeOperator + global Telescope + ageSDL = PtGetAgeSDL() + + Telescope.popTelescope() + # exit every thing + PtHideDialog("kdshScope0" + str(ScopeNumber.value)) + + PtHideDialog("kdshScope0" + str(ScopeNumber.value)) + + virtCam = ptCamera() + virtCam.restore(Camera.sceneobject.getKey()) + # exit behavior...which is in the next stage + #Behavior.gotoStage(LocalAvatar,2) + Behavior.nextStage(LocalAvatar) + #disable the Control key events + PtDisableControlKeyEvents(self.key) + PtSendKIMessage(kEnableKIandBB,0) + # re-enable the telescope for someone else to use + boolScopeOperator = 0 + ageSDL["boolOperatedScope0" + str(ScopeNumber.value)] = (0,) + ageSDL["OperatorIDScope0" + str(ScopeNumber.value)] = (-1,) + #Re-enable first person camera + cam = ptCamera() + cam.enableFirstPersonOverride() + PtAtTimeCallback(self.key,3,1) # wait for player to finish exit one-shot, then reenable clickable + #~ PtDebugPrint("kdshTreeRings.IQuitTelescope:\tdelaying clickable reenable") + + def OnTimer(self,id): + if id==1: + Activate.enable() + #~ PtDebugPrint("kdshTreeRings.OnTimer:\tScope #%s clickable reenabled" % (ScopeNumber.value)) diff --git a/Python/kdshTreeRingsSolution.py b/Python/kdshTreeRingsSolution.py new file mode 100644 index 0000000000..3e78377a70 --- /dev/null +++ b/Python/kdshTreeRingsSolution.py @@ -0,0 +1,380 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: kdshTreeRingsSolution +Age: Kadish Tolesa +Date: March 2002 +Author: Doug McBride +As SDL values are updated in the Kadish.sdl file, this file animates and updates the rings accordingly. +Also checks for the solution. +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys +import string + +# If there were another way to have done this, believe me, I would have. +# In the mean time, the following 122 items are dedicated to the memory of Pete Gage + +#Ring 01 +OuterRing01_01 = ptAttribAnimation(1, "anim: OuterRing01_01") +OuterRing01_02 = ptAttribAnimation(2, "anim: OuterRing01_02") +OuterRing01_03 = ptAttribAnimation(3, "anim: OuterRing01_03") +OuterRing01_04 = ptAttribAnimation(4, "anim: OuterRing01_04") +OuterRing01_05 = ptAttribAnimation(5, "anim: OuterRing01_05") +OuterRing01_06 = ptAttribAnimation(6, "anim: OuterRing01_06") +OuterRing01_07 = ptAttribAnimation(7, "anim: OuterRing01_07") +OuterRing01_08 = ptAttribAnimation(8, "anim: OuterRing01_08") + +MiddleRing01_01 = ptAttribAnimation(9, "anim: MiddleRing01_01") +MiddleRing01_02 = ptAttribAnimation(10, "anim: MiddleRing01_02") +MiddleRing01_03 = ptAttribAnimation(11, "anim: MiddleRing01_03") +MiddleRing01_04 = ptAttribAnimation(12, "anim: MiddleRing01_04") +MiddleRing01_05 = ptAttribAnimation(13, "anim: MiddleRing01_05") +MiddleRing01_06 = ptAttribAnimation(14, "anim: MiddleRing01_06") +MiddleRing01_07 = ptAttribAnimation(15, "anim: MiddleRing01_07") +MiddleRing01_08 = ptAttribAnimation(16, "anim: MiddleRing01_08") + +InnerRing01_01 = ptAttribAnimation(17, "anim: InnerRing01_01") +InnerRing01_02 = ptAttribAnimation(18, "anim: InnerRing01_02") +InnerRing01_03 = ptAttribAnimation(19, "anim: InnerRing01_03") +InnerRing01_04 = ptAttribAnimation(20, "anim: InnerRing01_04") +InnerRing01_05 = ptAttribAnimation(21, "anim: InnerRing01_05") +InnerRing01_06 = ptAttribAnimation(22, "anim: InnerRing01_06") +InnerRing01_07 = ptAttribAnimation(23, "anim: InnerRing01_07") +InnerRing01_08 = ptAttribAnimation(24, "anim: InnerRing01_08") + +#Ring 02 +OuterRing02_01 = ptAttribAnimation(25, "anim: OuterRing02_01") +OuterRing02_02 = ptAttribAnimation(26, "anim: OuterRing02_02") +OuterRing02_03 = ptAttribAnimation(27, "anim: OuterRing02_03") +OuterRing02_04 = ptAttribAnimation(28, "anim: OuterRing02_04") +OuterRing02_05 = ptAttribAnimation(29,"anim: OuterRing02_05") +OuterRing02_06 = ptAttribAnimation(30, "anim: OuterRing02_06") +OuterRing02_07 = ptAttribAnimation(31, "anim: OuterRing02_07") +OuterRing02_08 = ptAttribAnimation(32, "anim: OuterRing02_08") + +MiddleRing02_01 = ptAttribAnimation(33, "anim: MiddleRing02_01") +MiddleRing02_02 = ptAttribAnimation(34, "anim: MiddleRing02_02") +MiddleRing02_03 = ptAttribAnimation(35, "anim: MiddleRing02_03") +MiddleRing02_04 = ptAttribAnimation(36, "anim: MiddleRing02_04") +MiddleRing02_05 = ptAttribAnimation(37, "anim: MiddleRing02_05") +MiddleRing02_06 = ptAttribAnimation(38, "anim: MiddleRing02_06") +MiddleRing02_07 = ptAttribAnimation(39, "anim: MiddleRing02_07") +MiddleRing02_08 = ptAttribAnimation(40, "anim: MiddleRing02_08") + +InnerRing02_01 = ptAttribAnimation(41, "anim: InnerRing02_01") +InnerRing02_02 = ptAttribAnimation(42, "anim: InnerRing02_02") +InnerRing02_03 = ptAttribAnimation(43, "anim: InnerRing02_03") +InnerRing02_04 = ptAttribAnimation(44, "anim: InnerRing02_04") +InnerRing02_05 = ptAttribAnimation(45, "anim: InnerRing02_05") +InnerRing02_06 = ptAttribAnimation(46, "anim: InnerRing02_06") +InnerRing02_07 = ptAttribAnimation(47, "anim: InnerRing02_07") +InnerRing02_08 = ptAttribAnimation(48, "anim: InnerRing02_08") + + +#Ring 03 +OuterRing03_01 = ptAttribAnimation(49, "anim: OuterRing03_01") +OuterRing03_02 = ptAttribAnimation(50, "anim: OuterRing03_02") +OuterRing03_03 = ptAttribAnimation(51, "anim: OuterRing03_03") +OuterRing03_04 = ptAttribAnimation(52, "anim: OuterRing03_04") +OuterRing03_05 = ptAttribAnimation(53, "anim: OuterRing03_05") +OuterRing03_06 = ptAttribAnimation(54, "anim: OuterRing03_06") +OuterRing03_07 = ptAttribAnimation(55, "anim: OuterRing03_07") +OuterRing03_08 = ptAttribAnimation(56, "anim: OuterRing03_08") + +MiddleRing03_01 = ptAttribAnimation(57, "anim: MiddleRing03_01") +MiddleRing03_02 = ptAttribAnimation(58, "anim: MiddleRing03_02") +MiddleRing03_03 = ptAttribAnimation(59, "anim: MiddleRing03_03") +MiddleRing03_04 = ptAttribAnimation(60, "anim: MiddleRing03_04") +MiddleRing03_05 = ptAttribAnimation(61, "anim: MiddleRing03_05") +MiddleRing03_06 = ptAttribAnimation(62, "anim: MiddleRing03_06") +MiddleRing03_07 = ptAttribAnimation(63, "anim: MiddleRing03_07") +MiddleRing03_08 = ptAttribAnimation(64, "anim: MiddleRing03_08") + +InnerRing03_01 = ptAttribAnimation(65, "anim: InnerRing03_01") +InnerRing03_02 = ptAttribAnimation(66, "anim: InnerRing03_02") +InnerRing03_03 = ptAttribAnimation(67, "anim: InnerRing03_03") +InnerRing03_04 = ptAttribAnimation(68, "anim: InnerRing03_04") +InnerRing03_05 = ptAttribAnimation(69, "anim: InnerRing03_05") +InnerRing03_06 = ptAttribAnimation(70, "anim: InnerRing03_06") +InnerRing03_07 = ptAttribAnimation(71, "anim: InnerRing03_07") +InnerRing03_08 = ptAttribAnimation(72, "anim: InnerRing03_08") + +#"Fake" Ring 1 as seen in the GUI when looking through Scope #2 +GUIOuter01_01 = ptAttribAnimation(73, "anim: GUIOuter01_01") +GUIOuter01_02 = ptAttribAnimation(74, "anim: GUIOuter01_02") +GUIOuter01_03 = ptAttribAnimation(75, "anim: GUIOuter01_03") +GUIOuter01_04 = ptAttribAnimation(76, "anim: GUIOuter01_04") +GUIOuter01_05 = ptAttribAnimation(77, "anim: GUIOuter01_05") +GUIOuter01_06 = ptAttribAnimation(78, "anim: GUIOuter01_06") +GUIOuter01_07 = ptAttribAnimation(79, "anim: GUIOuter01_07") +GUIOuter01_08 = ptAttribAnimation(80, "anim: GUIOuter01_08") + +GUIMiddle01_01 = ptAttribAnimation(81, "anim: GUIMiddle01_01") +GUIMiddle01_02 = ptAttribAnimation(82, "anim: GUIMiddle01_02") +GUIMiddle01_03 = ptAttribAnimation(83, "anim: GUIMiddle01_03") +GUIMiddle01_04 = ptAttribAnimation(84, "anim: GUIMiddle01_04") +GUIMiddle01_05 = ptAttribAnimation(85, "anim: GUIMiddle01_05") +GUIMiddle01_06 = ptAttribAnimation(86, "anim: GUIMiddle01_06") +GUIMiddle01_07 = ptAttribAnimation(87, "anim: GUIMiddle01_07") +GUIMiddle01_08 = ptAttribAnimation(88, "anim: GUIMiddle01_08") + +GUIInner01_01 = ptAttribAnimation(89, "anim: GUIInner01_01") +GUIInner01_02 = ptAttribAnimation(90, "anim: GUIInner01_02") +GUIInner01_03 = ptAttribAnimation(91, "anim: GUIInner01_03") +GUIInner01_04 = ptAttribAnimation(92, "anim: GUIInner01_04") +GUIInner01_05 = ptAttribAnimation(93, "anim: GUIInner01_05") +GUIInner01_06 = ptAttribAnimation(94, "anim: GUIInner01_06") +GUIInner01_07 = ptAttribAnimation(95, "anim: GUIInner01_07") +GUIInner01_08 = ptAttribAnimation(96, "anim: GUIInner01_08") + + +#"Fake" Ring 2 as seen in the GUI when looking through Scope #3 +GUIOuter02_01 = ptAttribAnimation(97, "anim: GUIOuter02_01") +GUIOuter02_02 = ptAttribAnimation(98, "anim: GUIOuter02_02") +GUIOuter02_03 = ptAttribAnimation(99, "anim: GUIOuter02_03") +GUIOuter02_04 = ptAttribAnimation(100, "anim: GUIOuter02_04") +GUIOuter02_05 = ptAttribAnimation(101, "anim: GUIOuter02_05") +GUIOuter02_06 = ptAttribAnimation(102, "anim: GUIOuter02_06") +GUIOuter02_07 = ptAttribAnimation(103, "anim: GUIOuter02_07") +GUIOuter02_08 = ptAttribAnimation(104, "anim: GUIOuter02_08") + +GUIMiddle02_01 = ptAttribAnimation(105, "anim: GUIMiddle02_01") +GUIMiddle02_02 = ptAttribAnimation(106, "anim: GUIMiddle02_02") +GUIMiddle02_03 = ptAttribAnimation(107, "anim: GUIMiddle02_03") +GUIMiddle02_04 = ptAttribAnimation(108, "anim: GUIMiddle02_04") +GUIMiddle02_05 = ptAttribAnimation(109, "anim: GUIMiddle02_05") +GUIMiddle02_06 = ptAttribAnimation(110, "anim: GUIMiddle02_06") +GUIMiddle02_07 = ptAttribAnimation(111, "anim: GUIMiddle02_07") +GUIMiddle02_08 = ptAttribAnimation(112, "anim: GUIMiddle02_08") + +GUIInner02_01 = ptAttribAnimation(113, "anim: GUIInner02_01") +GUIInner02_02 = ptAttribAnimation(114, "anim: GUIInner02_02") +GUIInner02_03 = ptAttribAnimation(115, "anim: GUIInner02_03") +GUIInner02_04 = ptAttribAnimation(116, "anim: GUIInner02_04") +GUIInner02_05 = ptAttribAnimation(117, "anim: GUIInner02_05") +GUIInner02_06 = ptAttribAnimation(118, "anim: GUIInner02_06") +GUIInner02_07 = ptAttribAnimation(119, "anim: GUIInner02_07") +GUIInner02_08 = ptAttribAnimation(120, "anim: GUIInner02_08") + +actScope2 = ptAttribActivator(121, "Act: Scope2") +actScope3 = ptAttribActivator(122, "Act: Scope3") + +# globals +ScopeNumber = 2 +Outerbearing = 1 +Middlebearing = 1 +Innerbearing = 1 + +StillSolved = false +kPatienceDelayToSolve = 2 + +class kdshTreeRingsSolution(ptModifier): + "Standard telescope modifier class" + def __init__(self): + ptModifier.__init__(self) + self.id = 5233 + + version = 6 + self.version = version + print "__init__kdshTreeRingsSolution v.", version,".2" + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + if ageSDL == None: + print "kdshTreeRingsResp.OnFirstUpdate():\tERROR---missing age SDL (%s)" % varstring.value + + ageSDL.setNotify(self.key,"OuterRing01",0.0) + ageSDL.setNotify(self.key,"MiddleRing01",0.0) + ageSDL.setNotify(self.key,"InnerRing01",0.0) + + ageSDL.setNotify(self.key,"OuterRing02",0.0) + ageSDL.setNotify(self.key,"MiddleRing02",0.0) + ageSDL.setNotify(self.key,"InnerRing02",0.0) + + ageSDL.setNotify(self.key,"OuterRing03",0.0) + ageSDL.setNotify(self.key,"MiddleRing03",0.0) + ageSDL.setNotify(self.key,"InnerRing03",0.0) + + self.InitRings() + + def InitRings(self): + ageSDL = PtGetAgeSDL() + + OuterRing01 = ageSDL["OuterRing01"][0] + MiddleRing01 = ageSDL["MiddleRing01"][0] + InnerRing01 = ageSDL["InnerRing01"][0] + OuterRing02 = ageSDL["OuterRing02"][0] + MiddleRing02 = ageSDL["MiddleRing02"][0] + InnerRing02 = ageSDL["InnerRing02"][0] + OuterRing03 = ageSDL["OuterRing03"][0] + MiddleRing03 = ageSDL["MiddleRing03"][0] + InnerRing03 = ageSDL["InnerRing03"][0] + + print "kdshTreeRingSolution: When I got here:" + #~ print "\tOuterRing01=",OuterRing01 + #~ print "\tMiddleRing01=",MiddleRing01 + #~ print "\tInnerRing01=",InnerRing01 + #~ print "\tOuterRing02=",OuterRing02 + #~ print "\tMiddleRing02=",MiddleRing02 + #~ print "\tInnerRing02=",InnerRing02 + #~ print "\tOuterRing03=",OuterRing03 + #~ print "\tMiddleRing03=",MiddleRing03 + #~ print "\tInnerRing03=",InnerRing03 + + for i in ["Outer", "Middle", "Inner"]: + for j in ["1","2","3"]: + + ffcode1 = "InitState = "+i + "Ring0" +j + #~ print "ffcode1 = ", ffcode1 + + exec ffcode1 + #~ print "InitState = ", InitState + + ffcode2 = i + "Ring0" + j + "_0" + str(InitState) + ".animation.skipToEnd()" + #~ print "ffcode2 = ", ffcode2 + + exec ffcode2 + + #~ print "Fastforwarding: Set = ",j," Ring = ",i," Position = ",InitState + print "\t",i,"Ring0",j," = ", InitState + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global StillSolved + ageSDL = PtGetAgeSDL() + #~ PtDebugPrint("kdshTreeRingsSolution.OnSDLNotify():\t VARname:%s, playerID:%s, tag:%s" % (VARname,playerID,tag)) + + StillSolved = false + newbearing = ageSDL[VARname][0] + #~ print "VARname = ", VARname, "newbear = ", newbearing + + code = VARname + "_0" + str(newbearing) + ".animation.play()" + #~ print "code = ", code + exec code # this runs the animation on the actual ring in the garden + + if "3" in VARname: + #~ print "TRS: Nothing to ff. VARname = ", VARname + pass + else: + GUIcode = "GUI" + string.join(string.split(VARname, "Ring"), "") + "_0" + str(newbearing) + ".animation.play()" + #~ print "GUIcode = ", GUIcode + exec GUIcode # this runs the animation on the "fake" ring in front of the GUI + +### +#Check to see if the Puzzle has been solved +### + + OuterRing01 = ageSDL["OuterRing01"][0] + MiddleRing01 = ageSDL["MiddleRing01"][0] + InnerRing01 = ageSDL["InnerRing01"][0] + OuterRing02 = ageSDL["OuterRing02"][0] + MiddleRing02 = ageSDL["MiddleRing02"][0] + InnerRing02 = ageSDL["InnerRing02"][0] + OuterRing03 = ageSDL["OuterRing03"][0] + MiddleRing03 = ageSDL["MiddleRing03"][0] + InnerRing03 = ageSDL["InnerRing03"][0] + + print "Current Scope Positions [Outer, Middle, Inner]:" + print "\tRing #1: [", OuterRing01 ,", ",MiddleRing01,", ",InnerRing01," ]" + print "\tRing #2: [", OuterRing02 ,", ",MiddleRing02,", ",InnerRing02," ]" + print "\tRing #3: [", OuterRing03 ,", ",MiddleRing03,", ",InnerRing03," ]" + + if OuterRing01 == 5 and\ + MiddleRing01 == 6 and\ + InnerRing01 == 3 and\ + OuterRing02 == 1 and\ + MiddleRing02 == 1 and\ + InnerRing02 == 4 and\ + OuterRing03 == 4 and\ + MiddleRing03 == 3 and\ + InnerRing03 == 6: + print "Tree Ring Puzzle solved. Opening Door." + StillSolved = true + PtAtTimeCallback(self.key,kPatienceDelayToSolve,1) # Put in this delay to avoid people "speed clicking" past solution and opening door. + + def OnNotify(self,state,id,events): + global ScopeNumber + global Outerbearing + global Middlebearing + global Innerbearing + + + if id == actScope2.id: + #~ print "kdshTreeRingsSolution: Scope #2 occupied. Fast forwarding Scope 1 Rings in GUI" + ScopeNumber = 2 + elif id == actScope3.id: + #~ print "kdshTreeRingsSolution: Scope #3 occupied. Fast forwarding Scope 2 Rings in GUI" + ScopeNumber = 3 + else: + print "ERROR: Not sure who the notify came from." + print "id = ", id + return + + ageSDL = PtGetAgeSDL() + if ageSDL == None: + print "kdshTreeRings.OnFirstUpdate():\tERROR---missing age SDL (%s)" % varstring.value + + Outerbearing = ageSDL["OuterRing0" + str(ScopeNumber-1)][0] + Middlebearing = ageSDL["MiddleRing0" + str(ScopeNumber-1)][0] + Innerbearing = ageSDL["InnerRing0" + str(ScopeNumber-1)][0] + + #~ print "Outerbearing = ", Outerbearing + #~ print "Middlebearing = ", Middlebearing + #~ print "Innerbearing = ", Innerbearing + + + GUIcode = "GUIOuter0" + str(ScopeNumber-1) + "_0" + str(Outerbearing) + ".animation.skipToEnd()" + #~ print "FF Outer code = ", GUIcode + exec GUIcode + + GUIcode = "GUIMiddle0" + str(ScopeNumber-1) + "_0" + str(Middlebearing) + ".animation.skipToEnd()" + #~ print "FF Middle code = ", GUIcode + exec GUIcode + + GUIcode = "GUIInner0" + str(ScopeNumber-1) + "_0" + str(Innerbearing) + ".animation.skipToEnd()" + #~ print "FF Inner code = ", GUIcode + exec GUIcode + + #~ GUIcode = "GUI" + string.join(string.split(VARname, "Ring"), "") + "_0" + str(newbearing) + ".animation.play()" + #~ print "GUIcode = ", GUIcode + #~ exec GUIcode # this runs the animation on the "fake" ring in front of the GUI + + + + def OnTimer(self,timer): + global StillSolved + ageSDL = PtGetAgeSDL() + if timer == 1: + if StillSolved: + ageSDL.setTagString("TreeRingDoorClosed","fromOutside") + ageSDL["TreeRingDoorClosed"] = (0,) + else: + print "Patience, grasshopper." + \ No newline at end of file diff --git a/Python/kdshVault.py b/Python/kdshVault.py new file mode 100644 index 0000000000..46acb3bb2e --- /dev/null +++ b/Python/kdshVault.py @@ -0,0 +1,389 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: kdshPillarRoom.py +Age: Kadish Tolesa +Author: Doug McBride +Date: May 2003 +Operates the Vault puzzle. +""" + +from Plasma import * +from PlasmaTypes import * +import PlasmaControlKeys +import string + +# VCP = Vault Control Panel + +# define the attributes that will be entered in 3dsMAX +actButton1 = ptAttribActivator(1, "Act: Button 01") # Buttons are numbered from left to right in the Max file +actButton2 = ptAttribActivator(2, "Act: Button 02") +actButton3 = ptAttribActivator(3, "Act: Button 03") +actButton4 = ptAttribActivator(4, "Act: Button 04") +actButton5 = ptAttribActivator(5, "Act: Button 05") +actButton6 = ptAttribActivator(6, "Act: Button 06") + +respButton1 = ptAttribResponder(7, "Resp: Button 01 Down") +respButton2 = ptAttribResponder(8, "Resp: Button 02 Down") +respButton3 = ptAttribResponder(9, "Resp: Button 03 Down") +respButton4 = ptAttribResponder(10, "Resp: Button 04 Down") +respButton5 = ptAttribResponder(11, "Resp: Button 05 Down") +respButton6 = ptAttribResponder(12, "Resp: Button 06 Down") + +Activate = ptAttribActivator(13, "Act: VCP Clickable") +VCPCamera = ptAttribSceneobject(14,"VCP camera") +Behavior = ptAttribBehavior(15, "VCP idle behavior") +RaiseVCPClickable = ptAttribResponder(16, "Raise VCP Clickable") +LowerVCPClickable = ptAttribResponder(17, "Lower VCP Clickable") + +RgnDisengage = ptAttribActivator(18, "Act: Disengage Rgn") +VaultRoomCamera = ptAttribSceneobject(19,"Release camera") +respResetButtons = ptAttribResponder(20, "Reset All Buttons") +respOpenVault = ptAttribResponder(21, "Open Vault Door") +respCloseVault = ptAttribResponder(22, "Close Vault Door") + +actResetBtn = ptAttribActivator(23, "act:Reset Button") +respResetBtn = ptAttribResponder(24, "resp:Reset Button") + +OnlyOneOwner = ptAttribSceneobject(25,"OnlyOneOwner") #ensures that after a oneshots, only one client toggles the SDL values + +# globals +LocalAvatar = None + +VCPboolOperated = false +VCPVCPOperatorID = -1 + +ButtonsPushed=0 +VaultClosed=1 +VaultDoorMoving=0 + + + + +class kdshVault(ptResponder): + + def __init__(self): + # run parent class init + ptResponder.__init__(self) + self.id = 5234 + + version = 6 + self.version = version + print "__init__kdshVault v. ", version,".2" + + def OnServerInitComplete(self): + global ButtonsPushed + ageSDL = PtGetAgeSDL() + + ageSDL.sendToClients("ButtonsPushed") + ageSDL.sendToClients("VaultClosed") + ageSDL.sendToClients("VCPboolOperated") + ageSDL.sendToClients("VCPVCPOperatorID") + + ageSDL.setFlags("ButtonsPushed",1,1) + ageSDL.setFlags("VaultClosed",1,1) + ageSDL.setFlags("VCPboolOperated",1,1) + ageSDL.setFlags("VCPVCPOperatorID",1,1) + + # register for notification of age SDL var changes + ageSDL.setNotify(self.key,"ButtonsPushed",0.0) + ageSDL.setNotify(self.key,"VaultClosed",0.0) + + ButtonsPushed = ageSDL["ButtonsPushed"][0] + + print "kdshVault: When I got here:" + print "\t ButtonsPushed = ", ButtonsPushed + + ButtonsPushed = str(ButtonsPushed) + + if len(ButtonsPushed) >= 6: + print "All 6 buttons were already pushed. Resetting." + respResetButtons.run(self.key) + ageSDL["ButtonsPushed"] = (0,) + + return + + if "1" in ButtonsPushed: + print "fast forwarding button 1" + respButton1.run(self.key, fastforward=1) + actButton1.disable() + if "2" in ButtonsPushed: + print "fast forwarding button 2" + respButton2.run(self.key, fastforward=1) + actButton2.disable() + if "3" in ButtonsPushed: + print "fast forwarding button 3" + respButton3.run(self.key, fastforward=1) + actButton3.disable() + if "4" in ButtonsPushed: + print "fast forwarding button 4" + respButton4.run(self.key, fastforward=1) + actButton4.disable() + if "5" in ButtonsPushed: + print "fast forwarding button 5" + respButton5.run(self.key, fastforward=1) + actButton5.disable() + if "6" in ButtonsPushed: + print "fast forwarding button 6" + respButton6.run(self.key, fastforward=1) + actButton6.disable() + if "0" in ButtonsPushed: + print "No buttons have been pushed." + #~ string.join(string.split(ButtonsPushed, "0"), "") + ageSDL["ButtonsPushed"] = (0,) + + + + def Load(self): + global VCPboolOperated + global ButtonsPushed + ageSDL = PtGetAgeSDL() + + solo = true + if len(PtGetPlayerList()): + solo = false + + VCPboolOperated = ageSDL["VCPboolOperated"][0] + if VCPboolOperated: + if solo: + print "kdshVault.Load():\tVCPboolOperated=%d but no one else here...correcting" % VCPboolOperated + VCPboolOperated = 0 + ageSDL["VCPboolOperated"] = (0,) + ageSDL["VCPOperatorID"] = (-1,) + Activate.enable() + else: + Activate.disable() + print "kdshVault.Load():\tVCPboolOperated=%d, disabling Vault Control Panel clickable" % VCPboolOperated + + def AvatarPage(self, avObj, pageIn, lastOut): + "reset scope accessibility if scope user quits or crashes" + ageSDL = PtGetAgeSDL() + + global VCPboolScopeOperated + + if pageIn: + return + + avID = PtGetClientIDFromAvatarKey(avObj.getKey()) + if avID == ageSDL["VCPOperatorID"][0]: + Activate.enable() + ageSDL["VCPOperatorID"] = (-1,) + ageSDL["VCPboolOperated"] = (0,) + LowerVCPClickable.run(self.key) + print "kdshVault.AvatarPage(): Vault Control Panel operator paged out, reenabled VCP clickable." + else: + return + + + + def OnNotify(self,state,id,events): + "Activated... start Vault Control Panel" + global LocalAvatar + global VCPboolOperated + global ButtonsPushed + global VaultDoorMoving + + ageSDL = PtGetAgeSDL() + + #~ print "kdshVault:OnNotify state=%f id=%d events=" % (state,id),events + + #Hacked this in to work with the UruLive changes + avatar = PtFindAvatar(events) + + if state and id == Activate.id and avatar == PtGetLocalAvatar(): + print "kdshVault: I'm engaging VCP." + + # Disable First Person Camera + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + LocalAvatar = avatar + Behavior.run(LocalAvatar) + RaiseVCPClickable.run(self.key) + + Activate.disable() + + ageSDL = PtGetAgeSDL() + ageSDL["VCPboolOperated"] = (1,) + avID = PtGetClientIDFromAvatarKey(LocalAvatar.getKey()) + ageSDL["VCPOperatorID"] = (avID,) + + + elif id == Behavior.id and avatar == PtGetLocalAvatar(): # Smart seek done + #~ print "Done with smart seek" + LocalAvatar = avatar + Behavior.gotoStage(LocalAvatar, -1) + + # Disable forward movement + PtDisableForwardMovement() + + # set camera to Shelf Camera + virtCam = ptCamera() + virtCam.save(VCPCamera.sceneobject.getKey()) + + PtGetControlEvents(true,self.key) + #~ PtDisableMovementKeys() + + #~ PtFadeLocalAvatar(1) + # Wait .1 seconds before fading avatar out + PtAtTimeCallback(self.key,.2,2) + + + elif state and id in [1,2,3,4,5,6] and avatar == PtGetLocalAvatar(): + if VaultDoorMoving: + print "Button has no effect. The Vault Door is already moving." + return + + print "\tkdshVault.OnNotify: Button #%d pushed" % (id) + + + #append the pushed button to the list of those already clicked + ButtonsPushed = ageSDL["ButtonsPushed"][0] + ButtonsPushed = str(ButtonsPushed) + print "kdshVault.OnNotify: Before, ButtonsPushed was ", ButtonsPushed + + + ButtonsPushed = string.atoi(ButtonsPushed + (str(id))) + print "kdshVault.OnNotify: Now, ButtonsPushed = ", ButtonsPushed + + #update the ageSDL value for that button + ageSDL["ButtonsPushed"] = (ButtonsPushed,) + + if len(str(ButtonsPushed)) >= 6: + PtAtTimeCallback(self.key,1,1) + #~ self.CheckSolution() + + elif state and id == actResetBtn.id: + #~ print "kdshVault.OnNotify: Reset Button clicked." + LocalAvatar = PtFindAvatar(events) + respResetBtn.run(self.key,events=events) + + elif id == respResetBtn.id and OnlyOneOwner.sceneobject.isLocallyOwned(): + if VaultDoorMoving: + print "Button has no effect. The Vault Door is already moving." + return + + print "kdshVault.OnNotify: Reset Button Pushed. Toggling Vault Door state." + + vaultclosed = ageSDL["VaultClosed"][0] + if vaultclosed == 1: + #Open the door + print "\t trying to open the Vault." + + ageSDL.setTagString("VaultClosed","fromOutside") + ageSDL["VaultClosed"] = (0,) + + elif vaultclosed == 0: + #Close the door + print "\t trying to close the Vault." + ageSDL.setTagString("VaultClosed","fromInside") + ageSDL["VaultClosed"] = (1,) + + #Make sure nobody can fool with the vault door until it stops moving 18 seconds later. + VaultDoorMoving=1 + PtAtTimeCallback(self.key,18,3) + + + def IDisengageVCP(self): + + LowerVCPClickable.run(self.key) + Activate.enable() + + PtFadeLocalAvatar(0) + #reeneable first person + cam = ptCamera() + cam.enableFirstPersonOverride() + # go back to the Vault Room Camera + virtCam = ptCamera() + virtCam.save(VaultRoomCamera.sceneobject.getKey()) + + # Enable forward movement + PtEnableForwardMovement() + + PtGetControlEvents(false,self.key) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + ageSDL = PtGetAgeSDL() + + print "kdshVault.OnSDLNotify:\tVARname=",VARname," value=",ageSDL[VARname][0] + + + if VARname == "ButtonsPushed": + + ButtonsPushed = ageSDL["ButtonsPushed"][0] + + if ButtonsPushed == 0: + return + + ButtonsPushed = str(ButtonsPushed) + lastbuttonpushed = ButtonsPushed[-1:] + print "kdshVault.OnSDLNotify: new ButtonsPushed = ", ButtonsPushed + #~ print "kdshVault.OnSDLNotify: lastbuttonpushed = ", lastbuttonpushed + + #run the animation on the button itself + code = "respButton" + str(lastbuttonpushed) + ".run(self.key)" + #~ print "code = ", code + exec code + + #disable the clickable for that button + code = "actButton" + str(lastbuttonpushed) + ".disable()" + #~ print "code = ", code + exec code + + def OnTimer(self,id): + global VaultDoorMoving + + ageSDL = PtGetAgeSDL() + if id==1: + ButtonsPushed = ageSDL["ButtonsPushed"][0] + print "kdshVault: Check solution. ButtonsPushed = ", ButtonsPushed + if ButtonsPushed == 152346: + print "kdshVault: Puzzle solved. Opening door." + + ageSDL.setTagString("VaultClosed","fromOutside") + ageSDL["VaultClosed"] = (0,) + + #Make sure nobody can fool with the vault door until it stops moving 18 seconds later. + VaultDoorMoving=1 + PtAtTimeCallback(self.key,18,3) + + respResetButtons.run(self.key) + ageSDL["ButtonsPushed"] = (0,) + + elif id==2: + PtFadeLocalAvatar(1) + + elif id == 3: + print "kdshVault: The Vault door has stopped moving." + VaultDoorMoving=0 + + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode: + self.IDisengageVCP() + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + self.IDisengageVCP() + diff --git a/Python/kemoEmgrPhase0.py b/Python/kemoEmgrPhase0.py new file mode 100644 index 0000000000..c18beff0e5 --- /dev/null +++ b/Python/kemoEmgrPhase0.py @@ -0,0 +1,101 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: kemoEmgrPhase0.py +Age: Eder Kemo +Date: January 2002 +Event Manager interface for the Garden Phase 0 content +""" + +from Plasma import * +from PlasmaTypes import * +import string + +#globals +variable = None + +BooleanVARs = [ + "kemoJourneySymbolVis", +] + + +AgeStartedIn = None + + +class kemoEmgrPhase0(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5229 + + version = 1 + self.version = version + print "__init__kemoEmgrPhase0 v.", version + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + for variable in BooleanVARs: + print "tying together", variable + ageSDL.setNotify(self.key,variable,0.0) + self.IManageBOOLs(variable, "") + + def OnSDLNotify(self,VARname,SDLname,PlayerID,tag): + global variable + global sdlvalue + + + PtDebugPrint("kemoEmgrPhase0.SDLNotify - name = %s, SDLname = %s" % (VARname,SDLname)) + + if VARname in BooleanVARs: + print "kemoEmgrPhase0.OnSDLNotify : %s is a BOOLEAN Variable" % (VARname) + self.IManageBOOLs(VARname,SDLname) + + else: + PtDebugPrint("kemoEmgrPhase0.OnSDLNotify:\tERROR: Variable %s was not recognized as a Boolean, Performance, or State Variable. " % (VARname)) + pass + + + def IManageBOOLs(self,VARname,SDLname): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + if ageSDL[VARname][0] == 1: # are we paging things in? + PtDebugPrint("kemoEmgrPhase0.OnSDLNotify:\tPaging in room ", VARname) + PtPageInNode(VARname) + elif ageSDL[VARname][0] == 0: #are we paging things out? + print "variable = ", VARname + PtDebugPrint("kemoEmgrPhase0.OnSDLNotify:\tPaging out room ", VARname) + PtPageOutNode(VARname) + else: + sdlvalue = ageSDL[VARname][0] + PtDebugPrint("kemoEmgrPhase0.OnSDLNotify:\tERROR: Variable %s had unexpected SDL value of %s" % (VARname,sdlvalue)) + + + diff --git a/Python/kemoJourneyClothGate.py b/Python/kemoJourneyClothGate.py new file mode 100644 index 0000000000..a7b91ad519 --- /dev/null +++ b/Python/kemoJourneyClothGate.py @@ -0,0 +1,257 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: kemoJourneyClothGate +Age: Eder Kemo +Date: January 2002 +Author: Doug McBride + +Communicates with the Chronicle to determine the amount of JCs found by the person who clicked. +Sets SDL, which is being listened to by xStandardDoor, and handles the door opening/closing/persistence +Handles the link out to the Cleft at the back of the cave +""" + +from Plasma import * +from PlasmaTypes import * +import string +from PlasmaVaultConstants import * +from PlasmaNetConstants import * + +# --------- +# max wiring +# --------- + +stringVarName = ptAttribString(1,"Gate SDL variable") + +actTrigger = ptAttribActivator(2,"act: Hand clickable") +respOneShot = ptAttribResponder(3, "Resp: One Shot") + +PalmGlowWeak = ptAttribResponder(4, "Resp: PalmGlow Weak",netForce=1) +PalmGlowStrong = ptAttribResponder(5, "Resp: PalmGlow Strong",netForce=1) + +rgnAutoClose = ptAttribActivator(6,"Autoclose region") +stringInfo = ptAttribString(7,"Extra info to pass along") # string passed as hint to listeners if needed (e.g. which side of the door did the player click on?) + +actBackofCave = ptAttribActivator(8, "Link Rgn at back of cave") +respBackofCave = ptAttribResponder(9, "Resp: link to Cleft") + +# --------- +# globals +# --------- +AllCloths = "abcdefghij" + +GateInUse = 0 +GateCurrentlyClosed = true + +AgeStartedIn = None + +class kemoJourneyClothGate(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5227 + self.version = 8 + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + global GateCurrentlyClosed + + if AgeStartedIn == PtGetAgeName(): + if type(stringVarName.value) == type("") and stringVarName.value != "": + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(stringVarName.value,1,1) + ageSDL.sendToClients(stringVarName.value) + else: + PtDebugPrint("kemoJourneyClothGate.OnFirstUpdate():\tERROR: missing SDL var name") + + ageSDL = PtGetAgeSDL() + if type(stringVarName.value) == type("") and stringVarName.value != "": + ageSDL.setNotify(self.key,stringVarName.value,0.0) + try: + GateCurrentlyClosed = ageSDL[stringVarName.value][0] + except: + PtDebugPrint("kemoJourneyClothGate.OnServerInitComplete():\tERROR reading age SDL") + PtDebugPrint("kemoJourneyClothGate.OnServerInitComplete():\t%s = %d" % (stringVarName.value,GateCurrentlyClosed) ) + else: + PtDebugPrint("kemoJourneyClothGate.OnServerInitComplete():\tERROR: missing SDL var name") + + def OnNotify(self,state,id,events): + global GateCurrentlyClosed + global GateInUse + + if not state: + return + + print "##" + + if id == actTrigger.id: + + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + try: + GateCurrentlyClosed = ageSDL[stringVarName.value][0] + except: + PtDebugPrint("kemoJourneyClothGate.OnServerInitComplete():\tERROR reading age SDL") + GateCurrentlyClosed = false + + print "OnNotify: GateCurrentlyClosed = " , GateCurrentlyClosed + if not GateCurrentlyClosed: + PtDebugPrint ("The gate is already open.") + return + + if GateInUse: + PtDebugPrint ("Journey Cloth Gate has not yet reset.") + return + GateInUse = 1 + respOneShot.run(self.key, events=events) # run the oneshot + return + + + if id == actBackofCave.id and PtWasLocallyNotified(self.key): + PtDebugPrint ("You're likely to be eaten by a grue...") + vault = ptVault() + entry = vault.findChronicleEntry("JourneyClothProgress") + if type(entry) != type(None): + FoundJCs = entry.chronicleGetValue() + length = len(FoundJCs) + PtDebugPrint ("Are you the one? You've found %s Cloths." % (length)) + + if length == 10: + vault = ptVault() + entry = vault.findChronicleEntry("JourneyClothProgress") + FoundJCs = entry.chronicleGetValue() + FoundJCs = FoundJCs + "Z" + print "Updating Chronicle entry to ", FoundJCs + entry.chronicleSetValue("%s" % (FoundJCs)) + entry.save() + respBackofCave.run(self.key, events=events) + + return + + if id == rgnAutoClose.id: + if GateCurrentlyClosed: + return + else: + PtDebugPrint ("Autoclose Gate.") + self.ToggleSDL(stringInfo.value) + GateInUse = 1 + PtAtTimeCallback(self.key,4,1) + return + + # if you've gotten this far in the OnNotify, it means you've just reached the DoorButtonTouch marker of the oneshot + + PtAtTimeCallback(self.key,8,1) + + if not PtWasLocallyNotified(self.key): + print "Somebody touched the Journey Cloth Gate" + return + + print "You clicked on the Gate" + vault = ptVault() + if type(vault) != type(None): #is the Vault online? + + entry = vault.findChronicleEntry("JourneyClothProgress") + if type(entry) == type(None): # is this the player's first Journey Cloth? + print "No cloths have been found. Get to work!" + else: + FoundJCs = entry.chronicleGetValue() + length = len(FoundJCs) + all = len(AllCloths) + + print "You've found the following %d Journey Cloths: %s" % (length, FoundJCs) + + if length < 0 or length > 11: + print "xJourneyClothGate: ERROR: Unexpected length value received." + return + + if "Z" in FoundJCs: + print "You've been here before, traveller." + PalmGlowStrong.run(self.key) + self.ToggleSDL("fromOutside") + return + + for each in FoundJCs: + if each not in AllCloths: + print "Unexpected value among the 10 letters in the Chronicle:", each + return + + if length < all: + print "There are more Cloths out there. Get to work." + PalmGlowWeak.run(self.key) + + elif length == all: + print "All expected Cloths were found. Opening Door." + PalmGlowStrong.run(self.key) + self.ToggleSDL("fromOutside") + + else: + PtDebugPrint("kemoJourneyClothGate: Error trying to access the Vault. Can't access JourneyClothProgress chronicle." ) + + + def ToggleSDL(self,hint): + global GateCurrentlyClosed + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + try: + GateCurrentlyClosed = ageSDL[stringVarName.value][0] + except: + PtDebugPrint("kemoJourneyClothGate.OnServerInitComplete():\tERROR reading age SDL") + GateCurrentlyClosed = false + + print "ToggleSDL: GateCurrentlyClosed = ", GateCurrentlyClosed + + # Toggle the sdl value + if GateCurrentlyClosed: + GateCurrentlyClosed = false + ageSDL.setTagString(stringVarName.value,hint) + else: + GateCurrentlyClosed = true + ageSDL.setTagString(stringVarName.value,hint) + ageSDL[stringVarName.value] = (GateCurrentlyClosed,) + PtDebugPrint("kemoJourneyClothGate.OnNotify():\tset age SDL var %s to %d" % (stringVarName.value,GateCurrentlyClosed) ) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global GateCurrentlyClosed + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + if VARname == stringVarName.value: + PtDebugPrint("kemoJourneyClothGate.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d" % (VARname,SDLname,tag,ageSDL[stringVarName.value][0])) + GateCurrentlyClosed = ageSDL[stringVarName.value][0] + + def OnTimer(self,id): + global GateInUse + print "Gate reactivated." + if id==1: + GateInUse = 0 + + diff --git a/Python/kemoStormWaterModifier.py b/Python/kemoStormWaterModifier.py new file mode 100644 index 0000000000..1351985c95 --- /dev/null +++ b/Python/kemoStormWaterModifier.py @@ -0,0 +1,130 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: kemoStormWaterModifier.py +Age: Garden +Date: January 2004 +""" + +from Plasma import * +from PlasmaTypes import * + +theWater = ptAttribWaveSet(1, "Wave set") +startRain = ptAttribActivator(2, "Start rain drops") +stopRain = ptAttribActivator(3, "Stop rain drops") + +NoiseStartValue = 0 +TexAmpStartValue = 0 + +class kemoStormWaterModifier(ptModifier): + + def __init__(self): + ptModifier.__init__(self) + self.id = 5330 + self.version = 1 + + def OnFirstUpdate(self): + global NoiseStartValue + global TexAmpStartValue + + NoiseStartValue = theWater.waveset.getSpecularNoise() + TexAmpStartValue = theWater.waveset.getTexAmpOverLen() + + def OnNotify(self,state,id,events): + + if not state: + return + + if id == startRain.id: + print "starting rain drops on water" + rainlevel = 3.0 + texamp = 0.2 + #print "changing specular noise from %f to %f" % (theWater.waveset.getSpecularNoise(), rainlevel) + #print "changing tex amplitude from %f to %f" % (theWater.waveset.getTexAmpOverLen(), texamp) + theWater.waveset.setSpecularNoise(rainlevel, 5) + theWater.waveset.setTexAmpOverLen(texamp, 5) + elif id == stopRain.id: + print "stoping raindrops on water" + rainlevel = NoiseStartValue + texamp = TexAmpStartValue + #print "changing specular noise from %f to %f" % (theWater.waveset.getSpecularNoise(), rainlevel) + #print "changing tex amplitude from %f to %f" % (theWater.waveset.getTexAmpOverLen(), texamp) + theWater.waveset.setSpecularNoise(rainlevel, 5) + theWater.waveset.setTexAmpOverLen(texamp, 5) + + def OnServerInitComplete(self): + pass + + def OnTimer(self, id): + pass + + def OnBackdoorMsg(self, target, param): + if target == "watertest": + wdir = dir(theWater.waveset) + + val = 1 + for x in wdir: + if x[:3] == "set": + if x == "setWindDir" or x == "setWaterOffset" or x == "setDepthFalloff" or x == "setMaxAtten" or x == "setMinAtten": + p = ptVector3(0,val,0) + elif x == "setWaterTint": + p = ptColor().red() + elif x == "setSpecularTint": + p = ptColor().green() + elif x == "setEnvCenter": + p = ptPoint3(0,val,0) + else: + if x[3:] == "SpecularMute": + p = 0.5 + else: + p = val + + print "Using: get/set" + x[3:] + + startval = getattr(theWater.waveset, "get" + x[3:])() + + if type(p) == type(ptColor().red()): + print "\tstartval = " + str( (startval.getRed(), startval.getGreen(), startval.getBlue()) ) + print "\tsetting to " + str( (p.getRed(), p.getGreen(), p.getBlue()) ) + elif type(p) == type(ptPoint3()) or type(p) == type(ptVector3()): + print "\tstartval = " + str( (startval.getX(), startval.getY(), startval.getZ()) ) + print "\tsetting to " + str( (p.getX(), p.getY(), p.getZ()) ) + else: + print "\tstartval = " + str(startval) + print "\tsetting to " + str(p) + + getattr(theWater.waveset, x)(p) + + endval = getattr(theWater.waveset, "get" + x[3:])() + + if type(p) == type(ptColor().red()): + print "\tendval = " + str( (endval.getRed(), endval.getGreen(), endval.getBlue()) ) + elif type(p) == type(ptPoint3()) or type(p) == type(ptVector3()): + print "\tendval = " + str( (endval.getX(), endval.getY(), endval.getZ()) ) + else: + print "\tendval = " + str(endval) + + val += 1 diff --git a/Python/krelPodium.py b/Python/krelPodium.py new file mode 100644 index 0000000000..371c280efb --- /dev/null +++ b/Python/krelPodium.py @@ -0,0 +1,118 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: krelPodium.py +Age: Kirel Neighborhood +Author: Doug McBride +Date: January 2004 +""" + +from Plasma import * +from PlasmaTypes import * + +# define the attributes that will be entered in 3dsMAX +actSwitch01 = ptAttribActivator(1, "act: Podium Button") +respButtonOneshot = ptAttribResponder(2,"resp: Push Podium oneshot") + +respSpeech01 = ptAttribResponder(3, "resp: Speech #1") + +#~ respSpeech02 = ptAttribResponder(4, "resp: Speech #2") +#~ respSpeech03 = ptAttribResponder(5, "resp: Speech #3") + +respSilence = ptAttribResponder(4, "resp: Shut all speeches off") + +#~ respSpeech04 = ptAttribResponder(6, "Speech #4 Responder") +#~ respSpeech05 = ptAttribResponder(7, "Speech #5 Responder") + + + +#globals +ElapsedTime = 0 +SecondsToCharge = 60 +baton = 0 +ElevatorDelay = 5 +Resetting = 0 + + +class krelPodium(ptResponder): + + def __init__(self): + # run parent class init + ptResponder.__init__(self) + self.id = 5245 + + version = 2 + self.version = version + print "__init__krelPodium v.", version,".0" + + def OnServerInitComplete(self): + try: + ageSDL = PtGetAgeSDL() + except: + print "krelPodium:\tERROR---Cannot find the Kirel Age SDL" + ageSDL["nb01CmnRmSpeech"] = (0, ) + + ageSDL.setNotify(self.key,"nb01CmnRmSpeech",0.0) + + ageSDL.sendToClients("nb01CmnRmSpeech") + + ageSDL.setFlags("nb01CmnRmSpeech",1,1) + + + nb01CmnRmSpeech = ageSDL["nb01CmnRmSpeech"][0] + + ageSDL["nb01CmnRmSpeech"] = (0, ) + + def OnNotify(self,state,id,events): + ageSDL = PtGetAgeSDL() + + print "krelPodium.OnNotify: state=%f id=%d events=" % (state,id),events + + if not state: + return + + if id == actSwitch01.id: + respButtonOneshot.run(self.key, events=events) + return + + elif id == respButtonOneshot.id and self.sceneobject.isLocallyOwned(): + print "##" + nb01CmnRmSpeech = ageSDL["nb01CmnRmSpeech"][0] + + if nb01CmnRmSpeech == 0: # No speech was playing + print "krelPodium: No speech was previously playing. Playing speech #1." + respSpeech01.run(self.key) + ageSDL["nb01CmnRmSpeech"] = (1,) + + else: + print "krelPodium: Speech #1 was stopped manually by the avatar." + respSilence.run(self.key) + ageSDL["nb01CmnRmSpeech"] = (0,) + + + elif id == respSpeech01.id: + print "krelPodium: Speech #1 was stopped automatically after it finished playing." + respSilence.run(self.key) + ageSDL["nb01CmnRmSpeech"] = (0,) diff --git a/Python/minkCage.py b/Python/minkCage.py new file mode 100644 index 0000000000..43bd320d81 --- /dev/null +++ b/Python/minkCage.py @@ -0,0 +1,146 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: minkCage.py +Age: Minkata +Date: April 2007 +Author: Derek Odell +""" + +from Plasma import * +from PlasmaTypes import * + +# define the attributes that will be entered in max +regCageSymbol = ptAttribActivator(1, "reg: Cage Symbol") +respCageSymbol = ptAttribResponder(15, "resp: Cage Symbol", ["1", "2", "3", "4", "5", "Link", "Hide"]) +respSymbolSFX = ptAttribResponder(16, "resp: Symbol SFX", ["0", "1", "2", "3", "4", "5"]) + +# define globals + +#==================================== + +class minkCage(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 5261 + version = 2 + self.version = version + print "__init__minkCage v.", version,".0" + + ########################### + def OnFirstUpdate(self): + # set flags on age SDL vars we'll be changing + try: + ageSDL = PtGetAgeSDL() + except: + print "minkCage.OnFirstUpdate(): ERROR --- Cannot find Minkata age SDL" + + ageSDL.setFlags("minkSymbolPart01", 1, 1) + ageSDL.setFlags("minkSymbolPart02", 1, 1) + ageSDL.setFlags("minkSymbolPart03", 1, 1) + ageSDL.setFlags("minkSymbolPart04", 1, 1) + ageSDL.setFlags("minkSymbolPart05", 1, 1) + + ageSDL.sendToClients("minkSymbolPart01") + ageSDL.sendToClients("minkSymbolPart02") + ageSDL.sendToClients("minkSymbolPart03") + ageSDL.sendToClients("minkSymbolPart04") + ageSDL.sendToClients("minkSymbolPart05") + + ageSDL.setNotify(self.key, "minkSymbolPart01", 0.0) + ageSDL.setNotify(self.key, "minkSymbolPart02", 0.0) + ageSDL.setNotify(self.key, "minkSymbolPart03", 0.0) + ageSDL.setNotify(self.key, "minkSymbolPart04", 0.0) + ageSDL.setNotify(self.key, "minkSymbolPart05", 0.0) + + print "minkCage.OnFirstUpdate(): Hiding all Cage Symbol pieces" + respCageSymbol.run(self.key, state="Hide") + + symbolCount = 0 + + if ageSDL["minkSymbolPart01"][0]: + print "minkCage.OnFirstUpdate(): You've found piece 1" + respCageSymbol.run(self.key, state="1") + symbolCount += 1 + + if ageSDL["minkSymbolPart02"][0]: + print "minkCage.OnFirstUpdate(): You've found piece 2" + respCageSymbol.run(self.key, state="2") + symbolCount += 1 + + if ageSDL["minkSymbolPart03"][0]: + print "minkCage.OnFirstUpdate(): You've found piece 3" + respCageSymbol.run(self.key, state="3") + symbolCount += 1 + + if ageSDL["minkSymbolPart04"][0]: + print "minkCage.OnFirstUpdate(): You've found piece 4" + respCageSymbol.run(self.key, state="4") + symbolCount += 1 + + if ageSDL["minkSymbolPart05"][0]: + print "minkCage.OnFirstUpdate(): You've found piece 5" + respCageSymbol.run(self.key, state="5") + symbolCount += 1 + + # Run SFX + PtDebugPrint("DEBUG: minkCage.OnFirstUpdate():\tRunning SFX Level: %s" % symbolCount) + respSymbolSFX.run(self.key, state="%s"%symbolCount) + + + if ageSDL["minkSymbolPart01"][0] and ageSDL["minkSymbolPart02"][0] and ageSDL["minkSymbolPart03"][0] and ageSDL["minkSymbolPart04"][0] and ageSDL["minkSymbolPart05"][0]: + print "minkCage.OnFirstUpdate(): You've found all the Pieces, enabling link" + regCageSymbol.enable() + + ########################### + def OnNotify(self,state,id,events): + print "minkCage.OnNotify(): state=%s id=%d events=" % (state, id), events + + if id == regCageSymbol.id and PtFindAvatar(events) == PtGetLocalAvatar(): + print "minkCage.OnNotify(): Linking to bahro cave." + respCageSymbol.run(self.key, state="Link", avatar=PtGetLocalAvatar()) + + ########################### + def OnBackdoorMsg(self, target, param): + if target.lower() == "bahrocave" and self.sceneobject.isLocallyOwned(): + respCageSymbol.run(self.key, state="1") + respCageSymbol.run(self.key, state="2") + respCageSymbol.run(self.key, state="3") + respCageSymbol.run(self.key, state="4") + respCageSymbol.run(self.key, state="5") + regCageSymbol.enable() + + elif target.lower() == "resetsymbol": + PtDebugPrint("DEBUG: minkCage.OnBackdoorMsg(\'ResetSymbols\'):\tResetting Bahro Cave Symbols...") + respCageSymbol.run(self.key, state="Hide") + ageSDL = PtGetAgeSDL() + ageSDL["minkSymbolPart01"] = (0,) + ageSDL["minkSymbolPart02"] = (0,) + ageSDL["minkSymbolPart03"] = (0,) + ageSDL["minkSymbolPart04"] = (0,) + ageSDL["minkSymbolPart05"] = (0,) + regCageSymbol.disable() diff --git a/Python/minkDayClicks.py b/Python/minkDayClicks.py new file mode 100644 index 0000000000..ba11a46f65 --- /dev/null +++ b/Python/minkDayClicks.py @@ -0,0 +1,123 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: minkDayClicks.py +Age: Minkata +Date: April 2007 +Author: Derek Odell +""" + +from Plasma import * +from PlasmaTypes import * + +# define the attributes that will be entered in max +clkCave01 = ptAttribActivator(1, "clk: Cave 01", netForce=1) +clkCave02 = ptAttribActivator(2, "clk: Cave 02", netForce=1) +clkCave03 = ptAttribActivator(3, "clk: Cave 03", netForce=1) +clkCave04 = ptAttribActivator(4, "clk: Cave 04", netForce=1) +clkCave05 = ptAttribActivator(5, "clk: Cave 05", netForce=1) +clkCage = ptAttribActivator(6, "clk: Cage", netForce=1) + +behRespCave01 = ptAttribResponder(7, "beh resp: Cave 01") +behRespCave02 = ptAttribResponder(8, "beh resp: Cave 02") +behRespCave03 = ptAttribResponder(9, "beh resp: Cave 03") +behRespCave04 = ptAttribResponder(10, "beh resp: Cave 04") +behRespCave05 = ptAttribResponder(11, "beh resp: Cave 05") +behRespCage = ptAttribResponder(12, "beh resp: Cage") + +# define globals +ClickToResponder = { + clkCave01.id : behRespCave01, + clkCave02.id : behRespCave02, + clkCave03.id : behRespCave03, + clkCave04.id : behRespCave04, + clkCave05.id : behRespCave05, + clkCage.id : behRespCage, + } + +ResponderId = [ + behRespCave01.id, + behRespCave02.id, + behRespCave03.id, + behRespCave04.id, + behRespCave05.id, + behRespCage.id, + ] + +#==================================== + +class minkDayClicks(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 5259 + version = 1 + self.version = version + print "__init__minkDayClicks v.", version,".0" + + ########################### + def OnFirstUpdate(self): + ageSDL = PtGetAgeSDL() + + if not len(PtGetPlayerList()) and ageSDL["minkIsDayTime"][0]: + print "minkDayClicks.OnFirstUpdate(): Resetting Show and Touch vars." + ageSDL["minkSymbolShow01"] = (0,) + ageSDL["minkSymbolShow02"] = (0,) + ageSDL["minkSymbolShow03"] = (0,) + ageSDL["minkSymbolShow04"] = (0,) + ageSDL["minkSymbolShow05"] = (0,) + + ageSDL["minkSymbolTouch01"] = (0,) + ageSDL["minkSymbolTouch02"] = (0,) + ageSDL["minkSymbolTouch03"] = (0,) + ageSDL["minkSymbolTouch04"] = (0,) + ageSDL["minkSymbolTouch05"] = (0,) + + ########################### + def OnNotify(self,state,id,events): + print "minkDayClicks.OnNotify(): state=%s id=%d events=" % (state, id), events + + if id in ClickToResponder.keys() and state and PtFindAvatar(events) == PtGetLocalAvatar(): + print "minkDayClicks.OnNotify(): Clicked on %d, running %d" % (id, ClickToResponder[id].id) + LocalAvatar = PtFindAvatar(events) + clkCave01.disable() + clkCave02.disable() + clkCave03.disable() + clkCave04.disable() + clkCave05.disable() + clkCage.disable() + ClickToResponder[id].run(self.key, avatar=LocalAvatar) + + elif id in ResponderId: + print "minkDayClicks.OnNotify(): Responder Finished, Updating SDL" + ageSDL = PtGetAgeSDL() + ageSDL["minkIsDayTime"] = (not ageSDL["minkIsDayTime"][0],) + + if id != behRespCage.id: + num = ResponderId.index(id) + 1 + print "minkDayClicks.OnNotify(): Should show %d" % (num) + code = "ageSDL[\"minkSymbolShow0%d\"] = (1,)" % (num) + exec code diff --git a/Python/minkDayNight.py b/Python/minkDayNight.py new file mode 100644 index 0000000000..618bdf30ec --- /dev/null +++ b/Python/minkDayNight.py @@ -0,0 +1,143 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: minkDayNight.py +Age: Minkata +Date: April 2007 +Author: Derek Odell +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + +# define the attributes that will be entered in max +respLinkIn = ptAttribResponder(1, "resp: Link In Sound") +respExcludeRegion = ptAttribResponder(2, "resp: Exclude Regions", ["Clear", "Release"]) + +# define globals +HackIt = 1 + +#==================================== + +class minkDayNight(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 5258 + version = 1 + self.version = version + print "__init__minkDayNight v.", version,".0" + + ########################### + def OnServerInitComplete(self): + # set flags on age SDL vars we'll be changing + try: + ageSDL = PtGetAgeSDL() + ageSDL["minkIsDayTime"][0] + except: + print "minkDayNight.OnServerInitComplete(): ERROR --- Cannot find Minkata age SDL" + ageSDL["minkIsDayTime"] = (1,) + + ageSDL.setFlags("minkIsDayTime", 1, 1) + ageSDL.sendToClients("minkIsDayTime") + ageSDL.setNotify(self.key, "minkIsDayTime", 0.0) + + if not len(PtGetPlayerList()): + ageSDL["minkIsDayTime"] = (1,) + + if ageSDL["minkIsDayTime"][0]: + print "minkDayNight.OnServerInitComplete(): It's Day Time, Loading Day Page" + PtPageInNode("minkExteriorDay") + else: + print "minkDayNight.OnServerInitComplete(): It's Night Time, Loading Night Page" + PtPageInNode("minkExteriorNight") + + ########################### + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + ageSDL = PtGetAgeSDL() + print "minkDayNight.OnSDLNotify(): VARname:%s, SDLname:%s, tag:%s, value:%s, playerID:%d" % (VARname,SDLname,tag,ageSDL[VARname][0],playerID) + + if VARname == "minkIsDayTime" and not HackIt: + print "minkDayNight.OnSDLNotify(): SDL Updated, Fading Screen" + PtDisableMovementKeys() + PtSendKIMessage(kDisableKIandBB,0) + PtFadeOut(1.5, 1) + PtAtTimeCallback(self.key, 1.75, 3) + PtAtTimeCallback(self.key, 2.0, 1) + + ########################### + def OnTimer(self, id): + if id == 1: + ageSDL = PtGetAgeSDL() + if ageSDL["minkIsDayTime"][0]: + print "minkDayNight.OnTimer(): Paging in Day Page" + PtPageInNode("minkExteriorDay") + else: + print "minkDayNight.OnTimer(): Paging in Night Page" + PtPageInNode("minkExteriorNight") + + elif id == 2: + print "minkDayNight.OnTimer(): Finished faux link, Re-enable controls" + PtEnableMovementKeys() + PtSendKIMessage(kEnableKIandBB,0) + + elif id == 3: + PtFadeOut(0.0, 1) + respExcludeRegion.run(self.key, state="Clear") + + ########################### + def OnPageLoad(self,what,who): + global HackIt + print "minkDayNight.OnPageLoad(): what=%s who=%s" % (what, who) + + if what == kLoaded: + if who == "Minkata_District_minkExteriorDay" or who == "Minkata_minkExteriorDay": + if HackIt: + HackIt = 0 + return + print "minkDayNight.OnPageLoad(): Day Page loaded, unloading Night" + PtPageOutNode("minkExteriorNight") + elif who == "Minkata_District_minkExteriorNight" or who == "Minkata_minkExteriorNight": + if HackIt: + HackIt = 0 + return + print "minkDayNight.OnPageLoad(): Night Page loaded, unloading Day" + PtPageOutNode("minkExteriorDay") + + elif what == kUnloaded: + if who == "Minkata_District_minkExteriorDay" or who == "Minkata_District_minkExteriorNight" or who == "Minkata_minkExteriorDay" or who == "Minkata_minkExteriorNight": + print "minkDayNight.OnPageLoad(): Page unloaded, Fading screen back in" + PtFadeIn(1.5, 1) + respExcludeRegion.run(self.key, state="Release") + PtAtTimeCallback(self.key, 2, 2) + respLinkIn.run(self.key) + + ########################### + def OnBackdoorMsg(self, target, param): + if target == "switch" and self.sceneobject.isLocallyOwned(): + ageSDL = PtGetAgeSDL() + ageSDL["minkIsDayTime"] = (not ageSDL["minkIsDayTime"][0],) diff --git a/Python/minkSymbols.py b/Python/minkSymbols.py new file mode 100644 index 0000000000..0245ca8a4e --- /dev/null +++ b/Python/minkSymbols.py @@ -0,0 +1,196 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: minkSymbols.py +Age: Minkata +Date: April 2007 +Author: Derek Odell +""" + +from Plasma import * +from PlasmaTypes import * + +# define the attributes that will be entered in max +regCave01 = ptAttribActivator(1, "reg: Cave 01") +regCave02 = ptAttribActivator(2, "reg: Cave 02") +regCave03 = ptAttribActivator(3, "reg: Cave 03") +regCave04 = ptAttribActivator(4, "reg: Cave 04") +regCave05 = ptAttribActivator(5, "reg: Cave 05") + +respCave01 = ptAttribResponder(6, "resp: Cave 01") +respCave02 = ptAttribResponder(7, "resp: Cave 02") +respCave03 = ptAttribResponder(8, "resp: Cave 03") +respCave04 = ptAttribResponder(9, "resp: Cave 04") +respCave05 = ptAttribResponder(10, "resp: Cave 05") + +respDisableCave01 = ptAttribResponder(11, "resp: Disable Cave 01") +respDisableCave02 = ptAttribResponder(12, "resp: Disable Cave 02") +respDisableCave03 = ptAttribResponder(13, "resp: Disable Cave 03") +respDisableCave04 = ptAttribResponder(14, "resp: Disable Cave 04") +respDisableCave05 = ptAttribResponder(15, "resp: Disable Cave 05") + +respMusic = ptAttribResponder(16, "resp: Music") + +# define globals +RegionToResponder = { + regCave01.id : respCave01, + regCave02.id : respCave02, + regCave03.id : respCave03, + regCave04.id : respCave04, + regCave05.id : respCave05 + } + +#==================================== + +class minkSymbols(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 5260 + version = 1 + self.version = version + print "__init__minkSymbols v.", version,".0" + + ########################### + def OnFirstUpdate(self): + # set flags on age SDL vars we'll be changing + try: + ageSDL = PtGetAgeSDL() + except: + print "minkSymbols.OnFirstUpdate(): ERROR --- Cannot find Minkata age SDL" + + ageSDL.setFlags("minkSymbolPart01", 1, 1) + ageSDL.setFlags("minkSymbolPart02", 1, 1) + ageSDL.setFlags("minkSymbolPart03", 1, 1) + ageSDL.setFlags("minkSymbolPart04", 1, 1) + ageSDL.setFlags("minkSymbolPart05", 1, 1) + ageSDL.setFlags("minkSymbolShow01", 1, 1) + ageSDL.setFlags("minkSymbolShow02", 1, 1) + ageSDL.setFlags("minkSymbolShow03", 1, 1) + ageSDL.setFlags("minkSymbolShow04", 1, 1) + ageSDL.setFlags("minkSymbolShow05", 1, 1) + ageSDL.setFlags("minkSymbolTouch01", 1, 1) + ageSDL.setFlags("minkSymbolTouch02", 1, 1) + ageSDL.setFlags("minkSymbolTouch03", 1, 1) + ageSDL.setFlags("minkSymbolTouch04", 1, 1) + ageSDL.setFlags("minkSymbolTouch05", 1, 1) + + ageSDL.sendToClients("minkSymbolPart01") + ageSDL.sendToClients("minkSymbolPart02") + ageSDL.sendToClients("minkSymbolPart03") + ageSDL.sendToClients("minkSymbolPart04") + ageSDL.sendToClients("minkSymbolPart05") + ageSDL.sendToClients("minkSymbolShow01") + ageSDL.sendToClients("minkSymbolShow02") + ageSDL.sendToClients("minkSymbolShow03") + ageSDL.sendToClients("minkSymbolShow04") + ageSDL.sendToClients("minkSymbolShow05") + ageSDL.sendToClients("minkSymbolTouch01") + ageSDL.sendToClients("minkSymbolTouch02") + ageSDL.sendToClients("minkSymbolTouch03") + ageSDL.sendToClients("minkSymbolTouch04") + ageSDL.sendToClients("minkSymbolTouch05") + + ageSDL.setNotify(self.key, "minkSymbolPart01", 0.0) + ageSDL.setNotify(self.key, "minkSymbolPart02", 0.0) + ageSDL.setNotify(self.key, "minkSymbolPart03", 0.0) + ageSDL.setNotify(self.key, "minkSymbolPart04", 0.0) + ageSDL.setNotify(self.key, "minkSymbolPart05", 0.0) + ageSDL.setNotify(self.key, "minkSymbolShow01", 0.0) + ageSDL.setNotify(self.key, "minkSymbolShow02", 0.0) + ageSDL.setNotify(self.key, "minkSymbolShow03", 0.0) + ageSDL.setNotify(self.key, "minkSymbolShow04", 0.0) + ageSDL.setNotify(self.key, "minkSymbolShow05", 0.0) + ageSDL.setNotify(self.key, "minkSymbolTouch01", 0.0) + ageSDL.setNotify(self.key, "minkSymbolTouch02", 0.0) + ageSDL.setNotify(self.key, "minkSymbolTouch03", 0.0) + ageSDL.setNotify(self.key, "minkSymbolTouch04", 0.0) + ageSDL.setNotify(self.key, "minkSymbolTouch05", 0.0) + + if ageSDL["minkSymbolPart01"][0] or not ageSDL["minkSymbolShow01"][0]: + print "minkSymbols.OnFirstUpdate(): You already found piece 1" + respDisableCave01.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolPart02"][0] or not ageSDL["minkSymbolShow02"][0]: + print "minkSymbols.OnFirstUpdate(): You already found piece 2" + respDisableCave02.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolPart03"][0] or not ageSDL["minkSymbolShow03"][0]: + print "minkSymbols.OnFirstUpdate(): You already found piece 3" + respDisableCave03.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolPart04"][0] or not ageSDL["minkSymbolShow04"][0]: + print "minkSymbols.OnFirstUpdate(): You already found piece 4" + respDisableCave04.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolPart05"][0] or not ageSDL["minkSymbolShow05"][0]: + print "minkSymbols.OnFirstUpdate(): You already found piece 5" + respDisableCave05.run(self.key, netPropagate=0) + + + #If someone links in and someone else already activated the symbol, we need to try syncing them + if ageSDL["minkSymbolTouch01"][0]: + print "minkSymbols.OnFirstUpdate(): Piece 1 was touched this session." + respCave01.run(self.key, fastforward=1, netPropagate=0) + respMusic.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolTouch02"][0]: + print "minkSymbols.OnFirstUpdate(): Piece 2 was touched this session." + respCave02.run(self.key, fastforward=1, netPropagate=0) + respMusic.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolTouch03"][0]: + print "minkSymbols.OnFirstUpdate(): Piece 3 was touched this session." + respCave03.run(self.key, fastforward=1, netPropagate=0) + respMusic.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolTouch04"][0]: + print "minkSymbols.OnFirstUpdate(): Piece 4 was touched this session." + respCave04.run(self.key, fastforward=1, netPropagate=0) + respMusic.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolTouch05"][0]: + print "minkSymbols.OnFirstUpdate(): Piece 5 was touched this session." + respCave05.run(self.key, fastforward=1, netPropagate=0) + respMusic.run(self.key, netPropagate=0) + + ########################### + def OnNotify(self,state,id,events): + print "minkSymbols.OnNotify(): state=%s id=%d events=" % (state, id), events + + if id in RegionToResponder.keys(): + print "minkSymbols.OnNotify(): Region %d triggered" % (id) + code = "regCave0" + str(id) + ".disable()" + exec code + + ageSDL = PtGetAgeSDL() + code = "ageSDL[\"minkSymbolPart0" + str(id) + "\"] = (1,)" + exec code + + code = "ageSDL[\"minkSymbolTouch0" + str(id) + "\"] = (1,)" + exec code + + RegionToResponder[id].run(self.key) diff --git a/Python/mymod.py b/Python/mymod.py new file mode 100644 index 0000000000..ee71e2dfe3 --- /dev/null +++ b/Python/mymod.py @@ -0,0 +1,178 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: mymod +Age: global +Author: Mark DeForest +Date: Jan. 21, 2002 +This is an example module based of a ptModifier. +To be used with Plasma20, Python File Component +""" + +from Plasma import * +from PlasmaTypes import * +import cPickle + +#============================================================= +# define the attributes that will be entered in max +#============================================================= +myinteger = ptAttribInt(1,'My integer',10) +openb = ptAttribBoolean(2, 'Open?') +thenumber = ptAttribFloat(3, 'The special number', 1.5, (1.0, 9.0)) +colorname = ptAttribString(4, 'What is your favorite color?', 'Blue') +object = ptAttribSceneobject(5, 'Pick a sceneobject') +activator = ptAttribActivator(6, 'Activate me') +door = ptAttribResponder(7, 'A responder to run',['open','close']) +marquee_map = ptAttribDynamicMap(8, "Dynamic Texture Map for Marquee") +marquee_string = ptAttribString(9, "Marquee text") +marquee_speed = ptAttribFloat(10, "Marquee speed (in seconds)", 0.25) +doDance = ptAttribBehavior(11, "Dance behavior") + +#---------- +# globals +#---------- +theobject = None +blue = ptColor().blue() +cyan = ptColor().cyan() +white = ptColor().white() +black = ptColor().black() + +#---------- +# constants +#---------- +kMarqueeTimerId = 1 + +#==================================== +# This is the class where my code is +#==================================== +class mymod(ptModifier): + "Example ptModifier" + def __init__(self): + ptModifier.__init__(self) + self.id = 22332 + self.svMyNumber = 3 + self._scrollingtext = "" + self.helperslist = [] + + def OnFirstUpdate(self): + "On the first update, do some initialization" + self._scrollingtext = marquee_string.value + PtAtTimeCallback(self.key,marquee_speed.value,kMarqueeTimerId) + marquee_map.textmap.setClipping(0,0,128,128) + marquee_map.textmap.setTextColor(cyan) + marquee_map.textmap.setFont("Comic Sans MS", 16) + + def OnNotify(self,state,id,events): + "Notify: should only be from the activator" + global activator + global openb + global door + global theobject + PtDebugPrint("mymod: Notify event state=%f,id=%d,events=" % (state,id),events) + # is this our activator notifying us? + if state and id == activator.id: + # first have the player do a little dance + doDance.run(PtFindAvatar(events)) + + # yes, then run the responder + if openb.value: + door.run(self.key,state='open') + theobject = object.value + self.svMyNumber += 1 + openb.value = false + else: + door.run(self.key,state='close') + openb.value = true + # get the avatar to create a myHelper class + # find avatar + for event in events: + if event[0] == kCollisionEvent: + self.helperslist.append(myHelper(event[2])) # save the last hitter + if event[0] == kPickedEvent: + self.helperslist.append(myHelper(event[2])) # save the last hitter + # test the Save function + savefile = open('pfile.txt','w') + self.Save(savefile) + savefile.close() + + def OnTimer(self,id): + "Timer event: should only be to update the marquee" + #PtDebugPrint("mymod: timer event id=%d" % (id)) + # if this the marquee update? + if id == kMarqueeTimerId: + #PtDebugPrint("mymod: marquee timer hit") + # first erase the last thing we put up + marquee_map.textmap.fillRect( 0, 0, 128, 128, black ) + marquee_map.textmap.drawText( 0, 0, self._scrollingtext ) + marquee_map.textmap.flush() + # rotate the text + self._scrollingtext = self._scrollingtext[1:] + self._scrollingtext[:1] + # restart the timer + PtAtTimeCallback(self.key,marquee_speed.value,kMarqueeTimerId) + else: + for helper in helperslist: + helper.bump_count + + def Save(self,savefile): + "Save variables that we need to be persistent" + print "Save variables" + cPickle.dump(self.svMyNumber,savefile) + cPickle.dump(openb.value,savefile) + # this will recursively go through all the elements of the list and pickle each item + # ... which should call __getinitargs__ and save that to construct a new one in the future + cPickle.dump(self.helperslist,savefile) + + def Load(self, loadfile): + "Load the persistent variables" + print "Load variables" + self.svMyNumber = cPickle.load(loadfile) + openb.value = cPickle.load(loadfile) + # this will recreate a list of myHelper objects + self.helperslist = cPickle.load(loadfile) + + def OnPageLoad(self,what,who): + if what==kLoaded: + print "%s is finished loading" % (who) + elif what == kUnloaded: + print "%s is finished unloading" % (who) + +#==================================== +# Helper class +#==================================== +class myHelper: + "Just a class to show pickling of a class of our own making" + def __init__(self,avatar,count=0,name=None): + "constructor for a myHelper class" + self.avatar = avatar + self.count = count + self.name = name + + def __getinitargs__(self): + "get constructor arguments for Pickling support" + return (self.avatar,self.count,self.name) + + def bump_count(self): + "increment the counter" + self.count += 1 diff --git a/Python/mystFireplace.py b/Python/mystFireplace.py new file mode 100644 index 0000000000..f5412f29d2 --- /dev/null +++ b/Python/mystFireplace.py @@ -0,0 +1,417 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: mystFireplace.py +Age: Myst Library Age +Date: February 2004 +Author: Adam Van Ornum +""" + +from Plasma import * +from PlasmaTypes import * +import PlasmaControlKeys +import xEnum + +actButton = ptAttribActivator(1, "Fireplace button") +respPressButton = ptAttribResponder(2, "Fireplace button resp") + +respFPDoor = ptAttribResponder(3, "FP door open close", ["open", "close"]) +respFPRotate = ptAttribResponder(4, "FP rotate", ["back", "front"]) + +respResetPanel = ptAttribResponder(5, "Reset panel", byObject = 1) + +actPanelButtons = ptAttribActivator(6, "Panel buttons", byObject = 1) +respMorphButtons = ptAttribResponder(7, "Morph button resp", ["press", "depress"], byObject = 1) + +strBookSDL = ptAttribString(8, "Book SDL Var") +strYeeshaPageSDL = ptAttribString(9, "Yeesha page SDL Var") +strByronsEggsSDL = ptAttribString(10, "Byron's Eggs SDL Var") + +actExitFPClick = ptAttribActivator(11, "FP Exit Clickable") +actExitFPRegion = ptAttribActivator(12, "FP Exit Rgn Sensor") +respExitFP = ptAttribResponder(13, "FP Exit Responder") + +actEnterFPClick = ptAttribActivator(14, "FP Enter Clickable") +actEnterFPRegion = ptAttribActivator(15, "FP Enter Rgn Sensor") +respEnterFP = ptAttribResponder(16, "FP Enter Responder") + +soSubworld = ptAttribSceneobject(17, "Subworld sceneobject") + +actPanelView = ptAttribActivator(18, "Panel view clickable") +camThirdPerson = ptAttribSceneobject(19, "Third person cam") +camPanelView = ptAttribSceneobject(20, "Panel camera") +respMovePanelEntry = ptAttribResponder(21, "Move panel entry", ["up", "down"]) + +# globals +#============== +CheckedButtons = [] +InPanelView = 0 +IgnorePanelClick = [] + +#YeeshaPageSolution = ["A02"] +#EggSolution = ["A03"] +#KveerSolution = ["A01"] + +YeeshaPageSolution = ["A01", "A03", "A04", "A05", "A06", "B01", "B02", "B05", "B06", "C02", "C03", "C06", "D04", "D06", "E02", "E05", "E06", "F05", "G01", "G02", "G03", "G04", "G06", "H01", "H02", "H03", "H04"] +EggSolution = ["A03", "A04", "B02", "B05", "C01", "C03", "C04", "C06", "D01", "D03", "D04", "D06", "E01", "E06", "F02", "F05", "G02", "G05", "H03", "H04"] +KveerSolution = ["A01", "A05", "B02", "B05", "C01", "C04", "D03", "D06", "E03", "E05", "F01", "F03", "G01", "G03", "G05", "H02", "H05"] + +States = xEnum.Enum("DoorOpen, DoorClosed, Rotated") +CurrentState = States.DoorClosed + +class mystFireplace(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5335 + + self.version = 3 + print "__init__MystFireplace v.", self.version + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + + if strBookSDL.value != "": + ageSDL.setFlags(strBookSDL.value, 1, 1) + ageSDL.sendToClients(strBookSDL.value) + #ageSDL.setNotify(self.key, strBookSDL.value, 0.0) + + if strYeeshaPageSDL.value != "": + ageSDL.setFlags(strYeeshaPageSDL.value, 1, 1) + ageSDL.sendToClients(strYeeshaPageSDL.value) + #ageSDL.setNotify(self.key, strYeeshaPageSDL.value, 0.0) + + if strByronsEggsSDL.value != "": + ageSDL.setFlags(strByronsEggsSDL.value, 1, 1) + ageSDL.sendToClients(strByronsEggsSDL.value) + #ageSDL.setNotify(self.key, strByronsEggsSDL.value, 0.0) + + ageSDL["KveerBookVis"] = (0,) + ageSDL["YeeshaPageVis"] = (0,) + ageSDL["ByronsEggsVis"] = (0,) + + def OnFirstUpdate(self): + #actPanelButtons.disable() + respFPDoor.run(self.key, state = "close", fastforward = 1) + + #for key,value in actPanelButtons.byObject.items(): + #print key + #p = value.getParentKey() + #if p: + #print "\t", p.getName() + #actPanelButtons.enable(objectName=key) + + + def OnNotify(self,state,id,events): + global IgnorePanelClick + + print "onnotify: id -", id + + if id == actButton.id and state: + #actPanelButtons.disable() + self.ExitPanelView(1) + respPressButton.run(self.key, events = events) + + elif id == respPressButton.id: + self.OnButtonPressed(events) + + elif id == actPanelButtons.id and state: + self.OnPanelClick(events) + + elif id == actExitFPClick.id or id == actExitFPRegion.id and state: + self.ExitFireplace(events) + + elif id == actEnterFPClick.id or id == actEnterFPRegion.id and state: + self.EnterFireplace(events) + + elif id == actPanelView.id and state: + self.EnterPanelView(events) + + elif id == respMorphButtons.id: + if len(IgnorePanelClick) > 0: + id = IgnorePanelClick[0] + del IgnorePanelClick[0] + + for rkey,rvalue in actPanelButtons.byObject.items(): + parent = rvalue.getParentKey() + if parent: + pname = parent.getName() + if id == pname[-3:]: + rvalue.enable() + break + + elif id == respEnterFP.id or id == respExitFP.id: + cam = ptCamera() + cam.enableFirstPersonOverride() + + def OnButtonPressed(self, events): + global CurrentState + + if CurrentState == States.DoorOpen: + # close the door + respFPDoor.run(self.key, state = "close") + respMovePanelEntry.run(self.key, state = "down", fastforward = 1) + CurrentState = States.DoorClosed + + elif CurrentState == States.DoorClosed: + actPanelView.disable() + + ageSDL = PtGetAgeSDL() + # check for solutions and do stuff + if self.CheckForSolution(KveerSolution): + vault = ptVault() + entry = vault.findChronicleEntry("Blah") + if not entry: + vault.addChronicleEntry("Blah", 0, "1") + else: + if int(entry.chronicleGetValue()) < 1: + entry.chronicleSetValue("1") + # show kveer book + ageSDL["KveerBookVis"] = (1,) + ageSDL["YeeshaPageVis"] = (0,) + ageSDL["ByronsEggsVis"] = (0,) + + respFPRotate.run(self.key, state = "back") + CurrentState = States.Rotated + + elif self.CheckForSolution(YeeshaPageSolution): + # show yeesha page + ageSDL["KveerBookVis"] = (0,) + ageSDL["YeeshaPageVis"] = (1,) + ageSDL["ByronsEggsVis"] = (0,) + + respFPRotate.run(self.key, state = "back") + CurrentState = States.Rotated + + elif self.CheckForSolution(EggSolution): + # show egg recipe + ageSDL["KveerBookVis"] = (0,) + ageSDL["YeeshaPageVis"] = (0,) + ageSDL["ByronsEggsVis"] = (1,) + + respFPRotate.run(self.key, state = "back") + CurrentState = States.Rotated + + else: + ageSDL["KveerBookVis"] = (0,) + ageSDL["YeeshaPageVis"] = (0,) + ageSDL["ByronsEggsVis"] = (0,) + + respFPDoor.run(self.key, state = "open") + respMovePanelEntry.run(self.key, state = "up", fastforward = 1) + CurrentState = States.DoorOpen + + elif CurrentState == States.Rotated: + # rotate the room back + respFPRotate.run(self.key, state = "front") + CurrentState = States.DoorClosed + + self.ResetPanel() + + def OnPanelClick(self, events): + global CheckedButtons + global IgnorePanelClick + + for event in events: + if event[0]==kPickedEvent: + panelPicked = event[3] + panelName = panelPicked.getName() + + try: + #id = int(panelName[-2:]) + id = panelName[-3:] + except: + PtDebugPrint("mystFirePlace.OnPanelClick: Couldn't extract the panel id...not responding to click") + return + + if id in IgnorePanelClick: + return + else: + IgnorePanelClick.append(id) + for rkey,rvalue in actPanelButtons.byObject.items(): + parent = rvalue.getParentKey() + if parent: + pname = parent.getName() + if id == pname[-3:]: + rvalue.disable() + break + + if id in CheckedButtons: + bstate = "depress" + CheckedButtons.remove(id) + else: + bstate = "press" + CheckedButtons.append(id) + + print panelName, bstate + + for rkey,rvalue in respMorphButtons.byObject.items(): + parent = rvalue.getParentKey() + if parent: + pname = parent.getName() + #pnum = 8*(int(pname[-2:]) - 1) + (ord(pname[-3]) - ord("A")) + #print id, pnum + #if panelName == parent.getName(): + if id == pname[-3:]: + respMorphButtons.run(self.key,objectName=rkey, state = bstate) + break + + break + + + def EnterFireplace(self, events): + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + respEnterFP.run(self.key, events = events) + + def ExitFireplace(self, events): + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + PtFadeLocalAvatar(0) + + # run responder + respExitFP.run(self.key, events = events) + + def EnterPanelView(self, events): + global InPanelView + + actPanelView.disable() + + InPanelView = 1 + + PtDisableMovementKeys() + PtGetControlEvents(1, self.key) + + av = PtGetLocalAvatar() + + PtRecenterCamera() + camPanelView.sceneobject.pushCutsceneCamera(0, av.getKey()) + + av = PtGetLocalAvatar() + av.draw.disable() + + cam = ptCamera() + #cam.undoFirstPerson() + cam.disableFirstPersonOverride() + #cam.save(camPanelView.sceneobject.getKey()) + + #PtAtTimeCallback(self.key, .1, 1) + + respMovePanelEntry.run(self.key, state = "up", fastforward = 1) + + PtDisableMovementKeys() + PtGetControlEvents(1, self.key) + + #def OnTimer(self, id): + #if id == 1: + #av = PtGetLocalAvatar() + #av.draw.disable() + + def ExitPanelView(self, buttonClicked): + global InPanelView + + if InPanelView: + respMovePanelEntry.run(self.key, state = "down", fastforward = 1) + + av = PtGetLocalAvatar() + av.draw.enable() + + cam = ptCamera() + cam.enableFirstPersonOverride() + #cam.save(camThirdPerson.sceneobject.getKey()) + camPanelView.sceneobject.popCutsceneCamera(av.getKey()) + + PtEnableMovementKeys() + PtGetControlEvents(0, self.key) + + if not buttonClicked: + actPanelView.enable() + + InPanelView = 0 + + def CheckForSolution(self, solution): + global CheckedButtons + + CheckedButtons.sort() + solution.sort() + + print "CheckedButtons:", CheckedButtons + print "solution :", solution + + return CheckedButtons == solution + + def ResetPanel(self): + global CheckedButtons + global IgnorePanelClick + + #respResetPanel.run(self.key, fastforward=1) + #for rkey,rvalue in respResetPanel.byObject.items(): + # respResetPanel.run(self.key,objectName=rkey, fastforward=0) + + for but in CheckedButtons: + id = but[-3:] + for rkey,rvalue in respMorphButtons.byObject.items(): + parent = rvalue.getParentKey() + if parent: + pname = parent.getName() + if id == pname[-3:]: + respMorphButtons.run(self.key,objectName=rkey, state = "depress") + break + + CheckedButtons = [] + IgnorePanelClick = [] + + def OnControlKeyEvent(self,controlKey,activeFlag): + global InPanelView + + if InPanelView: + if controlKey == PlasmaControlKeys.kKeyExitMode or controlKey == PlasmaControlKeys.kKeyMoveBackward: + self.ExitPanelView(0) + + def OnBackdoorMsg(self, target, param): + global CurrentState + global CheckedButtons + + if target == "fp": + if param == "dooropen": + respFPDoor.run(self.key, state = "open") + CurrentState = States.DoorOpen + + elif param == "kveer": + CheckedButtons = KveerSolution + + elif param == "yeeshapage": + CheckedButtons = YeeshaPageSolution + + elif param == "eggs": + CheckedButtons = EggSolution + + elif param == "open": + CheckedButtons = [] + \ No newline at end of file diff --git a/Python/nb01DRCImager.py b/Python/nb01DRCImager.py new file mode 100644 index 0000000000..9b3ce2a162 --- /dev/null +++ b/Python/nb01DRCImager.py @@ -0,0 +1,200 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: nb01DRCImager +Age: neighborhood +Author: Adam Van Ornum +Date: March 2003 +""" + +from Plasma import * +from PlasmaTypes import * +import string + +#============================================================= +# define the attributes that will be entered in max +#============================================================= +ImagerMap = ptAttribDynamicMap(1, "The Dynamic Texture Map") +ImagerTime = ptAttribInt(2, "Number of seconds on each image",default=10) +ImagerObject = ptAttribSceneobject(3, "Imager Object (for ownership test)") + +AgeStartedIn = None + + +def doneSettingDeviceInbox(node,nodeRef,resultCode): + "once inbox has been set, turns the imager on." + PtDebugPrint("nb01DRCImager: doneSettingDeviceInbox result code = %d" % resultCode) + + # Update the inbox reference in the class + nb01DRCImager.Instance.ChangeInbox() + PtAtTimeCallback(nb01DRCImager.Instance.key,0,nb01DRCImager.Instance.current_state) + +def doneAddingDevice(node,nodeRef,resultCode): + "initializes new imager device with default inbox folder." + PtDebugPrint("nb01DRCImager: doneAddingDevice, result code = %d" % resultCode) + +#==================================== +class nb01DRCImager(ptModifier): + Instance = None + + def __init__(self): + ptModifier.__init__(self) + self.id = 5305 + self.version = 2 + PtDebugPrint("nb01DRCImager: init version=%d"%(self.version)) + self.current_state = 0 + self.current_image = 0 + self.number_of_images = 0 + self.inbox = None + nb01DRCImager.Instance = self + + #def ClearDevice(self): + # imagerdevice = None + # devices = ptAgeVault().getAgeDevicesFolder() + # devicelist = devices.getChildNodeRefList() + + # for device in devicelist: + # folder = device.getChild() + # folder = folder.upcastToTextNoteNode() + # if folder.getTitle() == "DRCImager": + # imagerdevice = device.getChild() + # break + + # if type(imagerdevice) != type(None): + # for node in imagerdevice.getChildNodeRefList(): + # imagerdevice.removeNode(node.getChild()) + + def ChangeInbox(self): + PtDebugPrint("nb01DRCImager.ChangeInbox: Attempting to get the inbox") + #imagerdevice = None + #devices = ptAgeVault().getAgeDevicesFolder() + #devicelist = devices.getChildNodeRefList() + + #for device in devicelist: + # folder = device.getChild() + # folder = folder.upcastToTextNoteNode() + # if folder.getTitle() == "DRCImager": + # imagerdevice = device.getChild() + # break + + #imagerfolder = imagerdevice.getChildNodeRefList() + #imagerfolder = imagerfolder[0].getChild() + #self.inbox = imagerfolder.upcastToFolderNode() + + self.inbox = ptAgeVault().getDeviceInbox("DRCImager") + + def SetImage(self,id): + + if type(self.inbox) != type(None): + PtDebugPrint("nb01DRCImager.SetImage: inbox %s id = %d" % (self.inbox.folderGetName(),self.inbox.getID())) + + if self.number_of_images > 0: + fcontents = self.inbox.getChildNodeRefList() + for element in fcontents: + image = element.getChild() + if image.getID() == id: + image = image.upcastToImageNode() + PtDebugPrint("nb01DRCImager: now showing image %s" % (image.imageGetTitle())) + try: + ImagerMap.textmap.drawImage(0,0,image.imageGetImage(),0) + ImagerMap.textmap.flush() + except: + PtDebugPrint("nb01DRCImager: couldn't draw image...") + pass + return + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + ageSDL.setNotify(self.key, "nb01DRCImagerState",0.0) + + self.current_state = ageSDL["nb01DRCImagerState"][0] + + #self.ClearDevice() + + PtDebugPrint("nb01DRCImager.OnServerInitComplete: Adding device") + ptAgeVault().addDevice("DRCImager",doneAddingDevice) + PtDebugPrint("nb01DRCImager.OnServerInitComplete: Setting device inbox - %s" % ("DRCImagerState%d" % self.current_state)) + ptAgeVault().setDeviceInbox("DRCImager", "DRCImagerState%d" % self.current_state, doneSettingDeviceInbox) + + def OnTimer(self,id): + PtDebugPrint("nb01DRCImager.OnTimer executing") + + if id == self.current_state: + + self.number_of_images = self.inbox.getChildNodeCount() + + if self.number_of_images > 0: + self.current_image = (self.current_image + 1) % self.number_of_images + + if ImagerObject.sceneobject.isLocallyOwned(): + + folder = self.inbox.getChildNodeRefList() + element = folder[self.current_image].getChild() + if type(element) != type(None): + nextID = element.getID() + else: + nextID = -1 + + selfnotify = ptNotify(self.key) + selfnotify.clearReceivers() + selfnotify.addReceiver(self.key) + selfnotify.netPropagate(1) + selfnotify.netForce(1) + selfnotify.setActivate(1.0) + sname = "dispID=%d" % (nextID) + selfnotify.addVarNumber(sname,1.0) + selfnotify.send() + + PtAtTimeCallback(self.key,ImagerTime.value,self.current_state) + + def OnNotify(self,state,id,events): + PtDebugPrint("nb01DRCImager.OnNotify executing") + for event in events: + if event[0] == kVariableEvent: + if event[1][:7] == "dispID=": + newID = string.atoi(event[1][7:]) + if newID != self.current_image: + self.SetImage(newID) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolCurrentValue + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + if VARname == "nb01DRCImagerState": + self.current_state = ageSDL["nb01DRCImagerState"][0] + + PtDebugPrint("nb01DRCImager.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d" % (VARname,SDLname,tag,self.current_state)) + + #self.ClearDevice() + ImagerMap.textmap.clearToColor(ptColor(0,0,0,0)) + ImagerMap.textmap.flush() + + ptAgeVault().setDeviceInbox("DRCImager", "DRCImagerState%d" % self.current_state, doneSettingDeviceInbox) diff --git a/Python/nb01Easel.py b/Python/nb01Easel.py new file mode 100644 index 0000000000..ec44685312 --- /dev/null +++ b/Python/nb01Easel.py @@ -0,0 +1,104 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +"""Module: nb01Easel +Age: hood +Author: Bill Slease +Date: October 2002 +puts the name of a neighborhood instance on a dynamic text map - adpated from xDynaTextBoy +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaVaultConstants import * +import xLocTools + +#============================================================= +# define the attributes that will be entered in max +#============================================================= +dyna_map = ptAttribDynamicMap(1, "The Dynamic Texture Map") +#dyna_string = ptAttribString(2, "Static text") +#dyna_x = ptAttribFloat(3,"Start text at X",0.0,(-100,100)) +#dyna_y = ptAttribFloat(4,"Start text at Y",0.0,(-100,100)) +dyna_fontname = ptAttribString(5, "Font face","Sharper") +dyna_fontsize = ptAttribInt(6, "Font size",28) +dyna_fontcolorr = ptAttribFloat(7, "Font color - red",0.0) +dyna_fontcolorg = ptAttribFloat(8, "Font color - green",0.0) +dyna_fontcolorb = ptAttribFloat(9, "Font color - blue",0.0) +dyna_fontcolora = ptAttribFloat(10, "Font color - alpha",1.0) +#dyna_clearcolorr = ptAttribFloat(11, "Clear color - red",0.0) +#dyna_clearcolorb = ptAttribFloat(12, "Clear color - blue",0.0) +#dyna_clearcolorg = ptAttribFloat(13, "Clear color - green",0.0) +#dyna_clearcolora = ptAttribFloat(14, "Clear color - alpha",1.0) +dyna_fontspacing = ptAttribInt(15, "Line spacing", 5) + +#---------- +# globals +#---------- + +#==================================== +# This is the class where my code is +#==================================== +class nb01Easel(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5027 + self.version = 2 + + def OnFirstUpdate(self): + self.IWriteHoodName() + + def OnAgeVaultEvent(self,event,tupdata): + "An age vault event received" + if event == PtVaultCallbackTypes.kVaultNodeSaved or event == PtVaultCallbackTypes.kVaultNodeInitialized: + if tupdata[0].getType() == PtVaultNodeTypes.kAgeInfoNode: + # hood name may have changed + self.IWriteHoodName() + + def IWriteHoodName(self): + fontcolor = ptColor(dyna_fontcolorr.value,dyna_fontcolorg.value,dyna_fontcolorb.value,dyna_fontcolora.value) + clearcolor = ptColor(0,0,0,0) + + ageVault = ptAgeVault() + try: + ageInfoNode = ageVault.getAgeInfo() + hoodName = "%s %s" % (ageInfoNode.getAgeUserDefinedName(), ageInfoNode.getAgeInstanceName()) + PtDebugPrint("nb01Easel:\tinscribing %s" % hoodName) + except: + PtDebugPrint("nb01Easel:\tERROR age vault or hood node failure") + return + hoodName = xLocTools.LocalizeAgeName(hoodName) + text = PtGetLocalizedString("Neighborhood.Messages.Welcome", [hoodName]) + + dyna_map.textmap.netPropagate(false) # we don't want our text appearing on other machines, since we are going to be localized + dyna_map.textmap.clearToColor(clearcolor) + dyna_map.textmap.setTextColor(fontcolor,true) + dyna_map.textmap.setWrapping(dyna_map.textmap.getWidth(),dyna_map.textmap.getHeight()) + dyna_map.textmap.setFont(dyna_fontname.value, dyna_fontsize.value) + dyna_map.textmap.setJustify(PtJustify.kCenter) + dyna_map.textmap.setLineSpacing(dyna_fontspacing.value) + dyna_map.textmap.drawTextW(0,0,text) + dyna_map.textmap.flush() + diff --git a/Python/nb01EmgrPhase0.py b/Python/nb01EmgrPhase0.py new file mode 100644 index 0000000000..ed7f599112 --- /dev/null +++ b/Python/nb01EmgrPhase0.py @@ -0,0 +1,270 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: nb01EmgrPhase0.py +Age: Neighborhood +Date: December 2002 +Event Manager interface for Neighborhood Phase 0 content +""" + +from Plasma import * +from PlasmaTypes import * +import string +import time +import xRandom + +#globals +variable = None + +BooleanVARs = [ + "nb01LinkBookGarrisonVis", + "nb01RatCreatureVis" + ] + +byteEderToggle = 0 +sdlEderToggle = "nb01LinkBookEderToggle" +sdlEderGlass = "nb01StainedGlassEders" +byteEderGlass = 0 +AgeStartedIn = None +sdlGZGlass = "nb01StainedGlassGZ" +byteGZGlass = 0 +numGZGlasses = 3 + + +########################################### +# These functions deal with the specific "State" (i.e. Non-boolean) cases. Each is of type INT in the neighborhood.sdl file +# +#Note that the following functions have to be outside of the main class +#in order for the dictionary StateVARs (below) to point to the proper values +########################################### + +#This identifies the maximum valid value for INT Variables +#The range is always from 00 to the value specified here +nb01Ayhoheek5Man1StateMaxINT = 02 +nb01PuzzleWallStateMaxINT = 03 + +def OutOfRange(VARname, NewSDLValue, myMaxINT): + PtDebugPrint("ERROR: nb01EmgrPhase0.OutOfRange:\tERROR: Variable %s expected range from 0 - %d. Received value of %d" % (VARname,NewSDLValue,myMaxINT)) + pass + +def Ayhoheek5Man1State(VARname, NewSDLValue): + #~ print "Ayhoheek5Man1State Notified." + #~ print "VARname = ",VARname + #~ print "Received value is ", NewSDLValue + + if NewSDLValue > nb01Ayhoheek5Man1StateMaxINT: + OutOfRange(VARname, NewSDLValue, nb01Ayhoheek5Man1StateMaxINT) + + elif NewSDLValue == 0: + PtDebugPrint ("DEBUG: nb01EmgrPhase0.Ayhoheek5Man1State:\t Paging out 5 Man Heek table completely.") + PtPageOutNode("nb01Ayhoheek5Man1State") + PtPageOutNode("nb01Ayhoheek5Man1Dead") + + elif NewSDLValue == 1: + PtDebugPrint ("DEBUG: nb01EmgrPhase0.Ayhoheek5Man1State:\t Paging in broken 5 Man Heek table.") + PtPageInNode("nb01Ayhoheek5Man1Dead") + PtPageOutNode("nb01Ayhoheek5Man1State") + + + elif NewSDLValue == 2: + PtDebugPrint ("DEBUG: nb01EmgrPhase0.Ayhoheek5Man1State:\t Paging in functional 5 Man Heek table.") + PtPageInNode("nb01Ayhoheek5Man1State") + PtPageOutNode("nb01Ayhoheek5Man1Dead") + + else: + PtDebugPrint("ERROR: nb01EmgrPhase0.Ayhoheek5Man1State: \tERROR: Unexpected value. VARname: %s NewSDLValue: %s" % (VARname, NewSDLValue)) + +def CityLightsArchState(VARname, NewSDLValue): + print "CityLightsArchiState Notified." + print "VARname = ",VARname + print "Received value is ", NewSDLValue + +def PuzzleWallState(VARname, NewSDLValue): + print "PuzzleWallState Notified." + print "VARname = ",VARname + print "Received value is ", NewSDLValue + + +StateVARs = { # the expected range of these intergers is defined in the list above. Convention is "variablename" + "MaxINT" + 'nb01Ayhoheek5Man1State' : Ayhoheek5Man1State, + 'nb01PuzzleWallState' : PuzzleWallState +} + + +class nb01EmgrPhase0(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5222 + + version = 7 + self.version = version + print "__init__nb01EmgrPhase0 v.", version + + + def OnFirstUpdate(self): + print "nb01EmgrPhase0.OnFirstUpdate()" + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + + def OnServerInitComplete(self): + global byteEderToggle + global byteEderGlass + global byteGZGlass + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(sdlEderToggle,1,1) + ageSDL.sendToClients(sdlEderToggle) + ageSDL.setNotify(self.key,sdlEderToggle,0.0) + byteEderToggle = ageSDL[sdlEderToggle][0] + print "nb01EmgrPhase0.OnServerInitComplete(): byteEderToggle = ",byteEderToggle + + ageSDL.setFlags(sdlEderGlass,1,1) + ageSDL.sendToClients(sdlEderGlass) + ageSDL.setNotify(self.key,sdlEderGlass,0.0) + byteEderGlass = ageSDL[sdlEderGlass][0] + print "nb01EmgrPhase0.OnServerInitComplete(): byteEderGlass = ",byteEderGlass + + ageSDL.setFlags(sdlGZGlass,1,1) + ageSDL.sendToClients(sdlGZGlass) + ageSDL.setNotify(self.key,sdlGZGlass,0.0) + byteGZGlass = ageSDL[sdlGZGlass][0] + print "nb01EmgrPhase0.OnServerInitComplete(): byteGZGlass = ",byteGZGlass + + if self.sceneobject.isLocallyOwned(): + print "nb01EmgrPhase0.OnServerInitComplete(): will check the Eder Delin/Tsogal book and its stained glass..." + self.IManageEders() + + if (byteGZGlass > numGZGlasses) and self.sceneobject.isLocallyOwned(): + newGlass = xRandom.randint(1,numGZGlasses) + print "nb01EmgrPhase0.OnServerInitComplete(): GZ stained glass randomly picked to be #: ",newGlass + ageSDL = PtGetAgeSDL() + ageSDL[sdlGZGlass] = (newGlass, ) + + for variable in BooleanVARs: + ageSDL.setNotify(self.key,variable,0.0) + self.IManageBOOLs(variable, "") + for variable in StateVARs: + ageSDL.setNotify(self.key,variable,0.0) + StateVARs[variable](variable,ageSDL[variable][0]) + + + def OnSDLNotify(self,VARname,SDLname,PlayerID,tag): + ageSDL = PtGetAgeSDL() + PtDebugPrint("nb01EmgrPhase0.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d" % (VARname,SDLname,tag,ageSDL[VARname][0])) + global byteEderToggle + global byteEderGlass + global byteGZGlass + + if VARname in BooleanVARs: + #~ print "nb01EmgrPhase0.OnSDLNotify : %s is a BOOLEAN Variable" % (VARname) + self.IManageBOOLs(VARname,SDLname) + + elif VARname in StateVARs.keys(): + #~ print "nb01EmgrPhase0.OnSDLNotify : %s is a STATE Variable" % (VARname) + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + NewSDLValue = ageSDL[VARname][0] + StateVARs[VARname](VARname, NewSDLValue) + print "Sending new value", NewSDLValue + + elif VARname == sdlEderToggle: + byteEderToggle = ageSDL[sdlEderToggle][0] + print "nb01EmgrPhase0.OnSDLNotify(): byteEderToggle = ",byteEderToggle +# if self.sceneobject.isLocallyOwned(): +# self.IManageEders() + + elif VARname == sdlEderGlass: + byteEderGlass = ageSDL[sdlEderGlass][0] + print "nb01EmgrPhase0.OnSDLNotify(): byteEderGlass = ",byteEderGlass + + elif VARname == sdlGZGlass: + byteGZGlass = ageSDL[sdlGZGlass][0] + print "nb01EmgrPhase0.OnSDLNotify(): byteGZGlass = ",byteGZGlass + + else: + PtDebugPrint("ERROR: nb01EmgrPhase0.OnSDLNotify:\tERROR: Variable %s was not recognized as a Boolean, Performance, or State Variable. " % (VARname)) + pass + + + def IManageBOOLs(self,VARname,SDLname): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + try: + if ageSDL[VARname][0] == 1: # are we paging things in? + PtDebugPrint("DEBUG: nb01EmgrPhase0.IManageBOOLs:\tPaging in room ", VARname) + PtPageInNode(VARname) + elif ageSDL[VARname][0] == 0: #are we paging things out? + print "variable = ", VARname + PtDebugPrint("DEBUG: nb01EmgrPhase0.IManageBOOLs:\tPaging out room ", VARname) + PtPageOutNode(VARname) + else: + sdlvalue = ageSDL[VARname][0] + PtDebugPrint("ERROR: nb01EmgrPhase0.IManageBOOLs:\tVariable %s had unexpected SDL value of %s" % (VARname,sdlvalue)) + except: + PtDebugPrint("ERROR: nb01EmgrPhase0.IManageBOOLs: problem with %s" % VARname) + pass + + + def IManageEders(self,onInit=0): + print "nb01EmgrPhase0.IManageEders(): byteEderToggle = ",byteEderToggle,"; byteEderGlass = ",byteEderGlass + if byteEderToggle: + if byteEderToggle == 2 and byteEderGlass not in (0,1,2,3): + self.IPickEderGlass(2) + elif byteEderToggle == 3 and byteEderGlass not in (0,4,5,6): + self.IPickEderGlass(3) + elif byteEderToggle not in (2,3): + self.IPickEderBooks() + else: + if byteEderGlass: + self.IPickEderGlass(0) + + + def IPickEderBooks(self): + print "nb01EmgrPhase0.IPickEderBooks()" + newBook = xRandom.randint(2,3) + ageSDL = PtGetAgeSDL() + ageSDL[sdlEderToggle] = (newBook, ) + self.IPickEderGlass(newBook) + + + def IPickEderGlass(self,eder): + print "nb01EmgrPhase0.IPickEderGlass()" + newGlass = 0 + if eder == 2: + newGlass = xRandom.randint(1,3) + elif eder == 3: + newGlass = xRandom.randint(4,6) + ageSDL = PtGetAgeSDL() + ageSDL[sdlEderGlass] = (newGlass, ) + + + def OnBackdoorMsg(self, target, param): + pass + + diff --git a/Python/nb01RPSGame.py b/Python/nb01RPSGame.py new file mode 100644 index 0000000000..45307a0017 --- /dev/null +++ b/Python/nb01RPSGame.py @@ -0,0 +1,765 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from PlasmaGame import * +from PlasmaGameConstants import * +import string +import xEnum + +################################ +### constants +################################ +kNone=0 +kRock=1 +kPaper=2 +kScissors=3 +kColors=("none","B","G","R") + +############################################################## +# define the attributes/parameters that we need from the 3dsMax scene +############################################################## + + +# detectors +detButtonRock = ptAttribActivatorList(1,"Rock ButtonClick det",netForce=1) # notifies me +detButtonPaper = ptAttribActivatorList(2,"Paper ButtonClick det",netForce=1) # notifies me +detButtonScissors = ptAttribActivatorList(3,"Scissors ButtonClick det",netForce=1) # notifies me + +detSitting0 = ptAttribActivator(50,"Player1 Sit det",netForce=1) # notifies me +detSitting1 = ptAttribActivator(51,"Player2 Sit det",netForce=1) # notifies me +detSitting2 = ptAttribActivator(52,"Player3 Sit det",netForce=1) # notifies me +detSitting3 = ptAttribActivator(53,"Player4 Sit det",netForce=1) # notifies me +detSitting4 = ptAttribActivator(54,"Player5 Sit det",netForce=1) # notifies me + +#responders +# P1 +respRock0 = ptAttribResponder(70,"Rock1 round win/lose resp", ['lose','win'],netForce=1) +respPaper0 = ptAttribResponder(71,"Paper1 round win/lose resp", ['lose','win'],netForce=1) +respScissors0=ptAttribResponder(72,"Scissors1 round win/lose resp", ['lose','win'],netForce=1) +respGame0 = ptAttribResponder(73,"Game win/lose resp", ['rock','paper','scissors','stop'],netForce=1) + +# P2 +respRock1 = ptAttribResponder(90,"Rock2 round win/lose resp", ['lose','win'],netForce=1) +respPaper1 = ptAttribResponder(91,"Paper2 round win/lose resp", ['lose','win'],netForce=1) +respScissors1=ptAttribResponder(92,"Scissors2 round win/lose resp", ['lose','win'],netForce=1) + +# P3 +respRock2 = ptAttribResponder(110,"Rock3 round win/lose resp", ['lose','win'],netForce=1) +respPaper2 = ptAttribResponder(111,"Paper3 round win/lose resp", ['lose','win'],netForce=1) +respScissors2=ptAttribResponder(112,"Scissors3 round win/lose resp", ['lose','win'],netForce=1) + +# P4 +respRock3 = ptAttribResponder(130,"Rock4 round win/lose resp", ['lose','win'],netForce=1) +respPaper3 = ptAttribResponder(131,"Paper4 round win/lose resp", ['lose','win'],netForce=1) +respScissors3=ptAttribResponder(132,"Scissors4 round win/lose resp", ['lose','win'],netForce=1) + +# P5 +respRock4 = ptAttribResponder(150,"Rock5 round win/lose resp", ['lose','win'],netForce=1) +respPaper4 = ptAttribResponder(151,"Paper5 round win/lose resp", ['lose','win'],netForce=1) +respScissors4=ptAttribResponder(152,"Scissors5 round win/lose resp", ['lose','win'],netForce=1) + +# Standing cam responder +respStandCam = ptAttribResponder(170,"Standing cam resp", ['1','2','3','4','5'],netForce=1) + +respCountdown = ptAttribResponder(180,"Countdown Responder",['countdown','stop','attractmode'],netForce=1) + +lightAnimsOn = ptAttribAnimation(200,"lights",1,netForce=1) +clamshellAnim = ptAttribAnimation(201,"clamshells",1,netForce=1) + +#init +initTable = ptAttribResponder(202,"Init table responder") + +# cameras +camera1 = ptAttribSceneobject(203,"seat 1 camera") +camera2 = ptAttribSceneobject(204,"seat 2 camera") +camera3 = ptAttribSceneobject(205,"seat 3 camera") +camera4 = ptAttribSceneobject(206,"seat 4 camera") +camera5 = ptAttribSceneobject(207,"seat 5 camera") + +# seat clickables (so we can disable them while someone is sitting on them) +seatButton1 = ptAttribActivator(210,"Seat 1 clickable") +seatButton2 = ptAttribActivator(211,"Seat 2 clickable") +seatButton3 = ptAttribActivator(212,"Seat 3 clickable") +seatButton4 = ptAttribActivator(213,"Seat 4 clickable") +seatButton5 = ptAttribActivator(214,"Seat 5 clickable") + +# light sounds (for win and turn on animations) +respSeat1Sounds = ptAttribResponder(220,"Seat 1 sound resp", ['on','win'], netForce=1) +respSeat2Sounds = ptAttribResponder(221,"Seat 2 sound resp", ['on','win'], netForce=1) +respSeat3Sounds = ptAttribResponder(222,"Seat 3 sound resp", ['on','win'], netForce=1) +respSeat4Sounds = ptAttribResponder(223,"Seat 4 sound resp", ['on','win'], netForce=1) +respSeat5Sounds = ptAttribResponder(224,"Seat 5 sound resp", ['on','win'], netForce=1) + +VaultOp = xEnum.Enum("AddHeekScoreFolder") + +############################################################## +# nb01RPSGame +############################################################## +class nb01RPSGame(ptResponder): + "The RPS game mgr" + + def __init__(self): + "construction" + ptResponder.__init__(self) + self.id = 20000 + version = 9 + self.version = version + print "__init__nb01RPSGame v.", version + + self.isPlaying = 0 + self.tableId = 0 # for this one it's zero, cause there is only one table, other script will have a max attribute + self.gameId = 0 # DIFFERENT from table id. This is the actual ID number of the game, table ID is simply a way to get a game without knowing its gameID + self.clientId = 0 + self.isOwner = 0 # are we the game owner? (should we send owner-related messages like responders finishing?) + self.joinedToGame = 0 + self.curPosition = -1 + self.buttonsEnabled = 0 # are the interface buttons currently enabled? + self.detectorSitList = [detSitting0,detSitting1,detSitting2,detSitting3,detSitting4] + self.svCurResponders=[] # currently active responders + + # map of responders, tuple is (symbol, playerPos) + self.responderDict = { (kNone,0): respGame0, + (kRock,0): respRock0, + (kPaper,0): respPaper0, + (kScissors,0): respScissors0, + + #(kNone,1): respGame1, + (kRock,1): respRock1, + (kPaper,1): respPaper1, + (kScissors,1): respScissors1, + + #(kNone,2): respGame2, + (kRock,2): respRock2, + (kPaper,2): respPaper2, + (kScissors,2): respScissors2, + + #(kNone,3): respGame3, + (kRock,3): respRock3, + (kPaper,3): respPaper3, + (kScissors,3): respScissors3, + + #(kNone,4): respGame4, + (kRock,4): respRock4, + (kPaper,4): respPaper4, + (kScissors,4): respScissors4 + } + self.responderList = [respRock0,respPaper0,respScissors0,respRock1,respPaper1,respScissors1,respRock2,respPaper2,respScissors2, + respRock3,respPaper3,respScissors3,respRock4,respPaper4,respScissors4] + + def IGetHeekGameCli(self): + if not self.joinedToGame: + PtDebugPrint("nb01RPSGame::IGetHeekGameCli(): Requesting game client before we have become an observer... returning None") + return None + + gameCli = PtGetGameCli(self.gameId) + if (type(gameCli) != type(None)) and (PtIsHeekGame(gameCli.gameTypeID())): + return gameCli.upcastToHeekGame() + return None + + # returns index or -1 of id in list of sit detectors + def ICheckDetectorSitID(self,id): + det = [d for d in self.detectorSitList if d.id==id] + PtAssert(len(det)==0 or len(det)==1, "invalid # of sit dets matching") + if (len(det)==1): + return self.detectorSitList.index(det[0]) + return -1 + + def IEnableButtons(self,enable=true,posDes=-1,fastforward=0): + # posDes is the position to enable/disable (in case someone dies and we need to reset their panel), -1 means to adjust yourself + if posDes == -1: + pos = self.curPosition + else: + pos = posDes + + if pos == self.curPosition: + if enable == self.buttonsEnabled: + return # nothing to do, our state matches the requested state + self.buttonsEnabled = enable # otherwise, save our new state + + shutter1 = "buttonshutter%s1" % (pos+1) + shutter2 = "buttonshutter%s2" % (pos+1) + shutter3 = "buttonshutter%s3" % (pos+1) + if enable: + detButtonRock.value[pos].enable() + detButtonPaper.value[pos].enable() + detButtonScissors.value[pos].enable() + if not fastforward: + clamshellAnim.byObject[shutter1].playRange(0,.83) # 25 frames open + clamshellAnim.byObject[shutter2].playRange(0,.83) # 25 frames open + clamshellAnim.byObject[shutter3].playRange(0,.83) # 25 frames open + else: + clamshellAnim.byObject[shutter1].skipToTime(.83) # 25 frames open + clamshellAnim.byObject[shutter2].skipToTime(.83) # 25 frames open + clamshellAnim.byObject[shutter3].skipToTime(.83) # 25 frames open + else: + detButtonRock.value[pos].disable() + detButtonPaper.value[pos].disable() + detButtonScissors.value[pos].disable() + clamshellAnim.byObject[shutter1].playRange(.83,2) # 25 frames close + clamshellAnim.byObject[shutter2].playRange(.83,2) # 25 frames close + clamshellAnim.byObject[shutter3].playRange(.83,2) # 25 frames close + + def ISetScoreLights(self,on,lightNum=-1,posDes=-1,flash=0,fastforward=0): + # posDes is the position to enable/disable (in case someone dies and we need to reset their panel), -1 means to adjust yourself + # lightNum=-1 means all lights. The blue lights are 0,1; the green are 2,3; and the red are 4,5 + numTable = [1,2,1,2,1,2] # translates the light num to an offset + colorTable = ['B','B','G','G','R','R'] # translates the light num to a color + if posDes == -1: + pos = self.curPosition + else: + pos = posDes + if lightNum == -1: + for i in range(6): + self.ISetScoreLights(on,i,pos) + light = (pos+1)*10+numTable[lightNum] + if not lightNum == -1: + if flash: + PtDebugPrint("nb01RPSGame::ISetScoreLights(): Flashing the GTdummy%sGlare%d light" % (colorTable[lightNum],light)) + lightAnimsOn.byObject["GTdummy%sGlare%d" % (colorTable[lightNum],light)].playRange(10,25) + if pos == 0: + respSeat1Sounds.run(self.key, 'win') + elif pos == 1: + respSeat2Sounds.run(self.key, 'win') + elif pos == 2: + respSeat3Sounds.run(self.key, 'win') + elif pos == 3: + respSeat4Sounds.run(self.key, 'win') + elif pos == 4: + respSeat5Sounds.run(self.key, 'win') + return + if on: + PtDebugPrint("nb01RPSGame::ISetScoreLights(): Turning the GTdummy%sGlare%d light on" % (colorTable[lightNum],light)) + if not fastforward: + lightAnimsOn.byObject["GTdummy%sGlare%d" % (colorTable[lightNum],light)].playRange(0,10) + if pos == 0: + respSeat1Sounds.run(self.key, 'on') + elif pos == 1: + respSeat2Sounds.run(self.key, 'on') + elif pos == 2: + respSeat3Sounds.run(self.key, 'on') + elif pos == 3: + respSeat4Sounds.run(self.key, 'on') + elif pos == 4: + respSeat5Sounds.run(self.key, 'on') + else: + #lightAnimsOn.byObject["GTdummy%sGlare%d" % (colorTable[lightNum],light)].skipToTime(10) + lightAnimsOn.byObject["GTdummy%sGlare%d" % (colorTable[lightNum],light)].playRange(10,10) + else: + PtDebugPrint("nb01RPSGame::ISetScoreLights(): Turning the GTdummy%sGlare%d light off" % (colorTable[lightNum],light)) + # The flash light playRange function seems to make the animation "forget" it has a time 0, so we fake it for now + #lightAnimsOn.byObject["GTdummy%sGlare%d" % (colorTable[lightNum],light)].stop() + #lightAnimsOn.byObject["GTdummy%sGlare%d" % (colorTable[lightNum],light)].skipToTime(0) + lightAnimsOn.byObject["GTdummy%sGlare%d" % (colorTable[lightNum],light)].playRange(0,0) + + def IRunResponder(self, result, tup): + "Run a responder, designated by the tuple of values passed in, and the result 'win'/'lose'" + resp = self.responderDict[tup] + self.svCurResponders.append(resp) # store currently executing responder + PtDebugPrint("nb01RPSGame::IRunResponder(): Adding resp="+resp.name+" "+result+", id="+`resp.id` + + " #curResps="+`len(self.svCurResponders)`) + if result != 'none': + resp.run(self.key, result) + else: + resp.run(self.key) + + def IEnableSeatClickable(self,pos): + if pos == 0: + PtDebugPrint("nb01RPSGame::IEnableSeatClickable(): Enabling seat button 1") + seatButton1.enable() + elif pos == 1: + PtDebugPrint("nb01RPSGame::IEnableSeatClickable(): Enabling seat button 2") + seatButton2.enable() + elif pos == 2: + PtDebugPrint("nb01RPSGame::IEnableSeatClickable(): Enabling seat button 3") + seatButton3.enable() + elif pos == 3: + PtDebugPrint("nb01RPSGame::IEnableSeatClickable(): Enabling seat button 4") + seatButton4.enable() + elif pos == 4: + PtDebugPrint("nb01RPSGame::IEnableSeatClickable(): Enabling seat button 5") + seatButton5.enable() + + def IGetRankPoints(self): + vault = ptVault() + entry = vault.findChronicleEntry("HeekPoints") + if type(entry) != type(None): + return int(entry.chronicleGetValue()) + else: + return 100 + + def ISetRankPoints(self,points): + vault = ptVault() + entry = vault.findChronicleEntry("HeekPoints") + if type(entry) != type(None): + entry.chronicleSetValue(str(points)) + entry.save() + else: + vault.addChronicleEntry("HeekPoints",1,str(points)) + + # return true if player was added + def IHandleSit(self, id, down, hitter): + "Player has sat down or got up from the playing area" + playerSo = hitter + pos = self.ICheckDetectorSitID(id) + + # camera + if down==true: + if pos == 1: + camera1.value.pushCutsceneCamera(1,playerSo.getKey()) + elif pos == 2: + camera2.value.pushCutsceneCamera(1,playerSo.getKey()) + elif pos == 3: + camera3.value.pushCutsceneCamera(1,playerSo.getKey()) + elif pos == 4: + camera4.value.pushCutsceneCamera(1,playerSo.getKey()) + elif pos == 0: + camera5.value.pushCutsceneCamera(1,playerSo.getKey()) + else: # gettng up + if pos == 1: + camera1.value.popCutsceneCamera(playerSo.getKey()) + elif pos == 2: + camera2.value.popCutsceneCamera(playerSo.getKey()) + elif pos == 3: + camera3.value.popCutsceneCamera(playerSo.getKey()) + elif pos == 4: + camera4.value.popCutsceneCamera(playerSo.getKey()) + elif pos == 0: + camera5.value.popCutsceneCamera(playerSo.getKey()) + self.IEnableSeatClickable(pos) + # end camera + + if (hitter.isAvatar()): + heekCli = self.IGetHeekGameCli() + if type(heekCli) == type(None): + PtDebugPrint("nb01RPSGame::IHandleSit(): Unable to get heek game client") + return + + if down==true: + if (pos>=0): + if (PtDetermineKILevel() >= 2): # make sure we have a KI + self.ICheckForImagerLink() + self.curPosition = pos + PtDebugPrint("nb01RPSGame::IHandleSit(): We are trying to join in position "+str(self.curPosition)) + heekCli.playGame(self.curPosition, self.IGetRankPoints(), PtGetClientName()) + return true + else: + PtDebugPrint("nb01RPSGame::IHandleSit(): We don't have a KI, so don't join the game. Notifying player...") + PtSendKIMessage(kKILocalChatStatusMsg,PtGetLocalizedString("Heek.Messages.NoKI", [])) + else: + PtDebugPrint("nb01RPSGame::IHandleSit(): We are trying to leave") + pos = self.curPosition + if (pos>=0): + if (PtDetermineKILevel() >= 2): # make sure we have a KI + PtDebugPrint("nb01RPSGame::IHandleSit(): Getting up/disabling position "+str(pos)) + heekCli.leaveGame() + else: + PtDebugPrint("nb01RPSGame::IHandleSit(): Not sending a leave message to the server because we have no KI") + else: + PtDebugPrint("nb01RPSGame::IHandleSit(): Hitter " + PtGetObjectName(hitter) + " is not an avatar or already paged out") + + def IHandlePickedEvent(self,id,pickFlag,picker,pickee,state): + pos = self.ICheckDetectorSitID(id) + if (pos >= 0): + # First check if player [un]clicked on the chair + if pickFlag==true and self.IHandleSit(id, state, picker): + return # player joined + if (state==false): # player left + if picker.isLocallyOwned(): + PtDebugPrint("nb01RPSGame::IHandlePickedEvent(): Player Left. Change cams") + respStandCam.run(self.key, '%d' % ((pos+1))) # revert cam if its your player + return + + # handle button clicks + if (picker.isAvatar()): + if pickFlag==true: + heekCli = self.IGetHeekGameCli() + if type(heekCli) == type(None): + PtDebugPrint("nb01RPSGame::IHandlePickedEvent(): Unable to get heek game client") + return + + PtDebugPrint("nb01RPSGame::IHandlePickedEvent(): " + PtGetObjectName(picker) + " picked " + PtGetObjectName(pickee)) + if (id == detButtonRock.id): + heekCli.choose(PtHeekGameChoice.kHeekGameChoiceRock) + elif (id == detButtonPaper.id): + heekCli.choose(PtHeekGameChoice.kHeekGameChoicePaper) + elif (id == detButtonScissors.id): + heekCli.choose(PtHeekGameChoice.kHeekGameChoiceScissors) + + def IHandleCallback(self, id): + "Handle a callback notification msg from a responder" + # Find currently execing responders with matching id + respFound = [resp for resp in self.svCurResponders if resp.id==id] + if len(respFound)<1: + PtDebugPrint("nb01RPSGame::IHandleCallback(): ! Unknown CB from id="+`id`+" numRespFound="+`len(respFound)` + + " len curResps="+`len(self.svCurResponders)`) + else: + # remove one of them + resp=respFound[0] + self.svCurResponders.remove(resp) # clear currently executing responder + + heekCli = self.IGetHeekGameCli() + if type(heekCli) == type(None): + PtDebugPrint("nb01RPSGame::IHandleCallback(): Unable to get heek game client") + return + + if id==respCountdown.id: # Countdown is finished - play (resolve) the round + PtDebugPrint("nb01RPSGame::IHandleCallback(): Countdown has finished") + if not self.isOwner: + PtDebugPrint("nb01RPSGame::IHandleCallback(): We are not the game owner, ignoring") + return + heekCli.sequenceFinished(PtHeekGameSeq.kHeekGameSeqCountdown) + return + + if id==respGame0.id: #end of game win anim + PtDebugPrint("nb01RPSGame::IHandleCallback(): End of game animation finished") + lightAnimsOn.animation.stop() + lightAnimsOn.animation.skipToTime(0) + if self.isOwner: + heekCli.sequenceFinished(PtHeekGameSeq.kHeekGameSeqGameWinAnim) + else: + PtDebugPrint("nb01RPSGame::IHandleCallback(): We are not the game owner, ignoring") + # kill all the lights + self.ISetScoreLights(false,-1,0) + self.ISetScoreLights(false,-1,1) + self.ISetScoreLights(false,-1,2) + self.ISetScoreLights(false,-1,3) + self.ISetScoreLights(false,-1,4) + return + + temp = [responder for responder in self.responderList if responder.id == id] + if len(temp) != 0: + PtDebugPrint("nb01RPSGame::IHandleCallback(): Choice animation has finished") + if not self.isOwner: + PtDebugPrint("nb01RPSGame::IHandleCallback(): We are not the game owner, ignoring") + return + heekCli.sequenceFinished(PtHeekGameSeq.kHeekGameSeqChoiceAnim) + + def OnNotify(self,state,id,events): + "Notify msg handler" + PtDebugPrint("nb01RPSGame::OnNotify(): numEvents=" + `len(events)`+ ", state=" + `state` + ", id=" + `id`) + + if id==seatButton1.id: + PtDebugPrint("nb01RPSGame::OnNotify(): Disabling seat button 1") + seatButton1.disable() + elif id==seatButton2.id: + PtDebugPrint("nb01RPSGame::OnNotify(): Disabling seat button 2") + seatButton2.disable() + elif id==seatButton3.id: + PtDebugPrint("nb01RPSGame::OnNotify(): Disabling seat button 3") + seatButton3.disable() + elif id==seatButton4.id: + PtDebugPrint("nb01RPSGame::OnNotify(): Disabling seat button 4") + seatButton4.disable() + elif id==seatButton5.id: + PtDebugPrint("nb01RPSGame::OnNotify(): Disabling seat button 5") + seatButton5.disable() + + for event in events: + if event[0] == kPickedEvent: + pos = self.ICheckDetectorSitID(id) + if pos >= 0: + if state==false: # someone got up, so re-enable clickable + self.IEnableSeatClickable(pos) + + if not PtWasLocallyNotified(self.key): + PtDebugPrint("nb01RPSGame::OnNotify(): This message didn't come from our player...ignoring") + return + + for event in events: + if event[0] == kPickedEvent: + PtDebugPrint("nb01RPSGame::OnNotify(): Handling kPickedEvent") + self.IHandlePickedEvent(id,event[1],event[2],event[3],state) + elif event[0]==kCallbackEvent: + PtDebugPrint("nb01RPSGame::OnNotify(): Handling kCallbackEvent") + self.IHandleCallback(id) + else: + PtDebugPrint("nb01RPSGame::OnNotify(): Unhandled event, type: " + str(event[0])) + + def OnGameCliMsg(self,msg): + if (msg.getType() == PtGameCliMsgTypes.kGameCliPlayerJoinedMsg): + joinMsg = msg.upcastToFinalGameCliMsg() + if (joinMsg.playerID() == self.clientId): + self.gameId = msg.getGameCli().gameID() + self.joinedToGame = 1 + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Got join reply from the heek game, we are now an observer for game id " + str(self.gameId)) + elif (msg.getType() == PtGameCliMsgTypes.kGameCliOwnerChangeMsg): + ownerChangeMsg = msg.upcastToFinalGameCliMsg() + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Got owner change msg, ownerID = " + str(ownerChangeMsg.ownerID()) + ", clientId = " + str(self.clientId)) + if (ownerChangeMsg.ownerID() == self.clientId): + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): We are now the game owner") + self.isOwner = 1 + self.UpdateImager() + elif (msg.getType() == PtGameCliMsgTypes.kGameCliHeekMsg): + heekMsg = msg.upcastToGameMsg() + msgType = heekMsg.getHeekMsgType() + finalMsg = heekMsg.upcastToFinalHeekMsg() + if (msgType == PtHeekMsgTypes.kHeekPlayGame): + if finalMsg.isPlaying(): + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Got a response from the server, we ARE playing") + self.isPlaying = true + if finalMsg.isSinglePlayer(): + msg = PtGetLocalizedString("Heek.Messages.SinglePlayerWarn", []) + PtSendKIMessage(kKILocalChatStatusMsg,msg) + if finalMsg.enableButtons(): + self.IEnableButtons() # server tells us whether to enable our buttons or not + else: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Got a response from the server, we ARE NOT playing") + elif (msgType == PtHeekMsgTypes.kHeekGoodbye): + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Got goodbye message from server, cleaning up") + if self.buttonsEnabled: + self.IEnableButtons(false) + self.ISetScoreLights(false) + self.IEnableSeatClickable(self.curPosition) + self.isPlaying = false + elif (msgType == PtHeekMsgTypes.kHeekWelcome): + if int(finalMsg.points()) == 1: + statusMsg = PtGetLocalizedString("Heek.Messages.Welcome", [finalMsg.name(), unicode(finalMsg.rank()), unicode(finalMsg.points())]) + else: + statusMsg = PtGetLocalizedString("Heek.Messages.WelcomePlural", [finalMsg.name(), unicode(finalMsg.rank()), unicode(finalMsg.points())]) + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Sending welcome message to the KI: "+str(statusMsg)) + PtSendKIMessage(kKILocalChatStatusMsg,statusMsg) + elif (msgType == PtHeekMsgTypes.kHeekDrop): + # this message should only be sent to the game owner, so we don't need to check to see if we are the owner + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): We have been asked to cleanup position "+str(finalMsg.position())) + self.IEnableButtons(false,finalMsg.position()) + self.ISetScoreLights(false,-1,finalMsg.position()) + self.IEnableSeatClickable(finalMsg.position()) + elif (msgType == PtHeekMsgTypes.kHeekSetup): + if finalMsg.buttonState(): + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): We received a button setup message for position "+str(finalMsg.position())) + self.IEnableButtons(true,finalMsg.position(),true) # fast forward the button open + lights = finalMsg.lightOn() # array of 6 booleans + for curLight in range(len(lights)): + if lights[curLight]: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Light " + str(curLight) + " in position " + str(finalMsg.position()) + " is ON") + self.ISetScoreLights(true,curLight,finalMsg.position(),false,true) # fast forward the light on + else: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Light " + str(curLight) + " in position " + str(finalMsg.position()) + " is OFF") + elif (msgType == PtHeekMsgTypes.kHeekLightState): + if finalMsg.state() == PtHeekLightStates.kHeekLightOn: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Turning light number "+str(finalMsg.lightNum())+" on.") + self.ISetScoreLights(true,finalMsg.lightNum()) + elif finalMsg.state() == PtHeekLightStates.kHeekLightOff: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Turning light number "+str(finalMsg.lightNum())+" off.") + self.ISetScoreLights(false,finalMsg.lightNum()) + elif finalMsg.state() == PtHeekLightStates.kHeekLightFlash: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Flashing light number "+str(finalMsg.lightNum())) + self.ISetScoreLights(false,finalMsg.lightNum(),-1,true) + elif (msgType == PtHeekMsgTypes.kHeekInterfaceState): + if finalMsg.buttonsEnabled(): + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Enabling interface") + self.IEnableButtons() + else: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Disabling interface") + self.IEnableButtons(false) + elif (msgType == PtHeekMsgTypes.kHeekCountdownState): + # this message should only be sent to the game owner, so we don't need to check to see if we are the owner + if finalMsg.state() == PtHeekCountdownStates.kHeekCountdownStart: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Starting countdown") + respCountdown.run(self.key,'countdown') + if finalMsg.state() == PtHeekCountdownStates.kHeekCountdownStop: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Stopping countdown") + respGame0.run(self.key,'stop') + # manually send the CountdownFinished message since the countdown responder is really bad at telling us + # when it actually finishes. + heekCli = self.IGetHeekGameCli() + if type(heekCli) == type(None): + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Unable to get heek game client") + return + heekCli.sequenceFinished(PtHeekGameSeq.kHeekGameSeqCountdown) + if finalMsg.state() == PtHeekCountdownStates.kHeekCountdownIdle: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Showing idle animation") + respCountdown.run(self.key,'attractmode') + elif (msgType == PtHeekMsgTypes.kHeekWinLose): + selection = kNone + if finalMsg.choice() == PtHeekGameChoice.kHeekGameChoiceRock: + selection = kRock + elif finalMsg.choice() == PtHeekGameChoice.kHeekGameChoicePaper: + selection = kPaper + elif finalMsg.choice() == PtHeekGameChoice.kHeekGameChoiceScissors: + selection = kScissors + else: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): selection was kNone or unknown, aborting handling of kHeekWinLose msg (position "+str(self.curPosition)+", choice "+str(finalMsg.choice())+")") + return + + if finalMsg.win(): + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Showing win animation for selection "+str(selection)) + self.IRunResponder('win',(selection,self.curPosition)) + else: + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Showing lose animation for selection "+str(selection)) + self.IRunResponder('lose',(selection,self.curPosition)) + elif (msgType == PtHeekMsgTypes.kHeekGameWin): + # this message should only be sent to the game owner, so we don't need to check to see if we are the owner + selection = kNone + if finalMsg.choice() == PtHeekGameChoice.kHeekGameChoiceRock: + selection = "rock" + elif finalMsg.choice() == PtHeekGameChoice.kHeekGameChoicePaper: + selection = "paper" + elif finalMsg.choice() == PtHeekGameChoice.kHeekGameChoiceScissors: + selection = "scissors" + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Showing game win animation for winner "+selection) + self.IRunResponder(selection,(kNone,0)) + elif (msgType == PtHeekMsgTypes.kHeekPointUpdate): + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Setting our current points to "+str(finalMsg.points())) + self.ISetRankPoints(finalMsg.points()) + if self.isOwner: + self.UpdateImager() + if finalMsg.displayUpdate(): + if int(finalMsg.points()) == 1: + statusMsg = PtGetLocalizedString("Heek.Messages.Rank", [unicode(finalMsg.rank()), unicode(finalMsg.points())]) + else: + statusMsg = PtGetLocalizedString("Heek.Messages.RankPlural", [unicode(finalMsg.rank()), unicode(finalMsg.points())]) + PtDebugPrint("nb01RPSGame::OnGameCliMsg(): Sending point message to the KI: "+str(statusMsg)) + PtSendKIMessage(kKILocalChatStatusMsg,statusMsg) + + def OnFirstUpdate(self): + PtDebugPrint("nb01RPSGame::OnFirstUpdate(): "+PtGetClientName()) + initTable.run(self.key) + self.clientId = PtGetLocalClientID() + # join the common heek game + PtJoinCommonHeekGame(self.key,self.tableId) + + def OnServerInitComplete(self): + if len(PtGetPlayerList()) == 0: + self.UpdateImager() + + def ICheckForImagerLink(self): + vault = ptVault() + if not vault.inMyNeighborhoodAge(): + PtDebugPrint("nb01RPSGame::ICheckForImagerLink(): leaving because this isn't my neighborhood") + return + + myhschron = vault.findChronicleEntry("HeekPoints") + + if not myhschron: + PtDebugPrint("nb01RPSGame::ICheckForImagerLink(): leaving because I don't have a heek score") + return + + ageVault = ptAgeVault() + dinbox = ageVault.getDeviceInbox("D'ni Imager Right") + + heekScores = None + + if dinbox: + childreflist = dinbox.getChildNodeRefList() + for childref in childreflist: + folder = childref.getChild().upcastToFolderNode() + if folder and folder.getFolderName() == "HeekScoreChrons": + heekScores = folder + break + + print "heekScores:", heekScores + if heekScores: + if not heekScores.hasNode(myhschron.getID()): + print "nb01RPSGame::ICheckForImagerLink(): add my chron to the imager" + # our chronicle wasn't found so we better add it + heekScores.addNode(myhschron) + else: + heekScores = ptVaultFolderNode(0) + heekScores.setFolderName("HeekScoreChrons") + dinbox.addNode(heekScores, self, VaultOp.AddHeekScoreFolder) + + + def vaultOperationComplete(self, context, args, resultCode): + if context == VaultOp.AddHeekScoreFolder: + vault = ptVault() + myhschron = vault.findChronicleEntry("HeekPoints") + + hschronsf = args[1].getChild() + hschronsf and hschronsf.addNode(myhschron) + + def UpdateImager(self): + print "nb01RPSGame::UpdateImager(): attempting to update the imager with heek scores" + ageVault = ptAgeVault() + dinbox = ageVault.getDeviceInbox("D'ni Imager Right") + + heekScores = None + scorelist = [] + + if dinbox: + childreflist = dinbox.getChildNodeRefList() + for childref in childreflist: + folder = childref.getChild().upcastToFolderNode() + if folder and folder.getFolderName() == "HeekScoreChrons": + heekScores = folder + break + + print "nb01RPSGame::UpdateImager(): heekscores:", heekScores + if heekScores: +# ------------- Clean up the chron list and gather the score list ---------------------------------- + ageOwnerList = ageVault.getAgeInfo().getAgeOwnersFolder() + + childreflist = heekScores.getChildNodeRefList() + for childref in childreflist: + chron = childref.getChild().upcastToChronicleNode() + print "nb01RPSGame::UpdateImager(): chron:", chron + if chron: + ownerNode = chron.getOwnerNode() + if ownerNode: # apparently a chronicle node doesn't have a parent sometimes? + ownerNode = ownerNode.upcastToPlayerInfoNode() + if ownerNode: + if ageOwnerList.playerlistHasPlayer(ownerNode.playerGetID()): + ownerNode = ownerNode.upcastToPlayerInfoNode() + print "nb01RPSGame::UpdateImager(): owner node:", ownerNode + if ownerNode: + scorelist.append( (int(chron.chronicleGetValue()), ownerNode.playerGetName()) ) + print scorelist + else: + print "nb01RPSGame::UpdateImager(): removing chronicle node" + heekScores.removeNode(chron) + +# ------------- Update the imager text note ---------------------------------- + nbscorestxt = "Top 10 Heek Players:\n" + scorelist.sort( lambda t1, t2: cmp(t1[0], t2[0]) ) + scorelist.reverse() + count = 1 + for score in scorelist: + if count > 10: + break + nbscorestxt += (" %d - %s has %d points\n" % (count, score[1], score[0]) ) + count += 1 + + neighborhoodScoreNote = None + items = dinbox.getChildNodeRefList() + for item in items: + item = item.getChild() + itemtn = item.upcastToTextNoteNode() + if itemtn: + if itemtn.getTitle() == "Neighborhood Heek Scores": + neighborhoodScoreNote = itemtn + + # if we have the text note then update it, otherwise create it + if neighborhoodScoreNote: + neighborhoodScoreNote.setText(nbscorestxt) + neighborhoodScoreNote.save() + else: + neighborhoodScoreNote = ptVaultTextNoteNode(0) + neighborhoodScoreNote.setTitle("Neighborhood Heek Scores") + neighborhoodScoreNote.setText(nbscorestxt) + dinbox.addNode(neighborhoodScoreNote) diff --git a/Python/nb01RegisterNexusLink.py b/Python/nb01RegisterNexusLink.py new file mode 100644 index 0000000000..f70d11ffd2 --- /dev/null +++ b/Python/nb01RegisterNexusLink.py @@ -0,0 +1,156 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: nb01RegisterNexusLink +Age: Neighborhood +Date: October, 2002 +Author: Bill Slease +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +#~ from PlasmaVaultConstants import * +#~ from PlasmaNetConstants import * + + +# define the attributes that will be entered in max +actClick = ptAttribActivator(1,"Actvtr: click me") +respOneshot = ptAttribResponder(2,"Rspndr: one shot") +respKIGlow = ptAttribResponder(3,"Rspndr: ki glow",netForce=1) + +# globals +boolClickerIsMe = false +myID = 0 +hoodID = 0 +hoodMgr = None +kInviteTitle = "" +kInviteMsg = "" + +class nb01RegisterNexusLink(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5020 + version = 1 + self.version = version + print "__init__nb01RegisterNexusLink v.", version + + def OnNotify(self,state,id,events): + global boolClickerIsMe + global myID + global hoodID + global hoodMgr + + ####################### + ## + ## stick your hand in the slot + ## + ####################### + + if id==actClick.id: + if not state: + return + respOneshot.run(self.key,events=events) + if PtWasLocallyNotified(self.key): + boolClickerIsMe = true + objAvatar = PtFindAvatar(events) + myID = PtGetClientIDFromAvatarKey(objAvatar.getKey()) + return + + ################################## + ## + ## figure out what to do with the hand in the slot + ## + ################################## + # Udpated to do nothing. -eap. + + if id == respOneshot.id and boolClickerIsMe: + if not state: + return + boolClickerIsMe = false # done with this var, reset it + + kiLevel = PtDetermineKILevel() + print "nb01RegisterNexusLink.OnNotify:\tplayer ki level is",kiLevel + + # case 1: player has no KI + # ki slot doesn't respond, just return + + if kiLevel < kNormalKI: + return +# else: +# respKIGlow.run(self.key) +# +# # case 2: player is in their own hood +# # take no further action +# +# linkMgr = ptNetLinkingMgr() +# if ( linkMgr.inMyNeighborhoodAge() ): +# PtDebugPrint("nb01RegisterNexusLink:\tYou are already a member of this Neighborhood.") +# return +# +# # case 3: player not a member, has a KI, but has not been invited to join +# # player should become registered visitor of this hood +# +# hoodMgr = ptNeighborhoodMgr() +# if type(hoodMgr) == type(None): +# PtDebugPrint("nb01RegisterNexusLink:\thood manager type is None") +# return +# ageVault = ptAgeVault() +# if type(ageVault) == type(None): +# PtDebugPrint("nb01RegisterNexusLink:\tage vault type is None") +# return +# hoodNode = ageVault.getNeighborhood() +# if type(hoodNode) == type(None): +# PtDebugPrint("nb01RegisterNexusLink:\thood node type is None") +# return +# hoodID = hoodNode.getID() +# if not hoodMgr.canJoin(hoodID): +# hoodMgr.invitePlayer(myID,kInviteTypeHoodVisitInvitation,kInviteTitle,kInviteMsg) +# PtDebugPrint("nb01RegisterNexusLink:\tYou are now a registered visitor of this Neighborhood.") +# return +# +# # case 3: player has KI and has been invited to become a member of this hood +# # player can choose to join or if declines, becomes visitor as well as prosepective member +# joinString = "You have been invited to join our neighborhood. Would you like to become a member?" +# ageVault = ptAgeVault() +# if type(ageVault) != type(None): +# hoodNode = ageVault.getNeighborhood() +# hoodName = hoodNode.hoodGetTitle() +# joinString = "You have been invited to join our neighborhood. Would you like to become a member of %s?" % hoodName +# PtYesNoDialog(self.key,joinString) +# return +# +# # callback from "do you want to join?" yes/no dialog (hopefully) +# if id==(-1): +# if state: # user answered yes, they join +# hoodMgr.joinNeighborhood(hoodID) +# PtDebugPrint("nb01RegisterNexusLink:\tYou are now a member of this Neighborhood!") +# else: # user answered no, the get added to visitor list +# hoodMgr.invitePlayer(myID,kInviteTypeHoodVisitInvitation,kInviteTitle,kInviteMsg) +# PtDebugPrint("nb01RegisterNexusLink:\tYou are now a registered visitor of this Neighborhood.") +# return +# +# diff --git a/Python/nb01UpdateHoodInfoImager.py b/Python/nb01UpdateHoodInfoImager.py new file mode 100644 index 0000000000..c66d86e2bd --- /dev/null +++ b/Python/nb01UpdateHoodInfoImager.py @@ -0,0 +1,262 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: nb01UpdateImagerPlayerList.py +Age: Neighborhood +Date: October 2007 +Script to manage updating the player list on the hood info imager +""" + +from Plasma import * +from PlasmaTypes import * +import time + +HoodInfoImagerScript = ptAttribActivator(1, "Hood Info imager script") + +class nb01UpdateHoodInfoImager(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 5262 + + self.version = 2 + print "__init__nb01UpdateHoodInfoImager v.", self.version + + def IGetDeviceInbox(self): + deviceNode = None + deviceInbox = None + + # find the device + avault = ptAgeVault() + adevicesfolder = avault.getAgeDevicesFolder() + adevices = adevicesfolder.getChildNodeRefList() + for device in adevices: + device = device.getChild() + devicetn = device.upcastToTextNoteNode() + if devicetn and devicetn.getTitle() == "D'ni Imager Right" or devicetn.getTitle() == "D'ni Imager Right

": + deviceNode = devicetn + break + + # if we have the device then find the inbox + if deviceNode: + inboxes = deviceNode.getChildNodeRefList() + for inbox in inboxes: + inbox = inbox.getChild() + inboxfolder = inbox.upcastToFolderNode() + if inboxfolder: + deviceInbox = inboxfolder + break + return deviceInbox + + def IUpdatePlayerList(self, playername): + deviceInbox = self.IGetDeviceInbox() + playerlist = None + + # if we have the inbox then look for the heek score note + if deviceInbox: + items = deviceInbox.getChildNodeRefList() + for item in items: + item = item.getChild() + itemtn = item.upcastToTextNoteNode() + if itemtn: + if itemtn.getTitle() == "Visitors, Visiteurs, Besucher": + playerlist = itemtn + break + elif itemtn.getTitle() == "Most Recent Visitors": + itemtn.setTitle("Visitors, Visiteurs, Besucher") + playerlist = itemtn + break + + # if we have the text note then update it, otherwise create it + if playerlist: + currenttime = time.gmtime(PtGetDniTime()) + currenttimestr = time.strftime("%m/%d/%Y %I:%M %p", currenttime) + thetext = playerlist.getText() + if (thetext.count("\n") + 1) > 15: + thetext = thetext[:thetext.rfind("\n")] + thetext = currenttimestr + (" " * (30 - len(currenttimestr))) + playername + "\n" + thetext + + playerlist.setText(thetext) + playerlist.forceSave() + else: + currenttime = time.gmtime(PtGetDniTime()) + currenttimestr = time.strftime("%m/%d/%Y %I:%M %p", currenttime) + playername = PtGetLocalPlayer().getPlayerName() + thetext = currenttimestr + (" " * (30 - len(currenttimestr))) + playername + + playerlist = ptVaultTextNoteNode(0) + playerlist.setTitle("Visitors, Visiteurs, Besucher") + playerlist.setText(thetext) + deviceInbox.addNode(playerlist) + + if playerlist and playerlist.getID() > 0: + sname = "Update=%d" % (playerlist.getID()) + self.ISendNotify(HoodInfoImagerScript.value, sname, 1.0) + + def IFixupScoreLine(self, scorerow): + retVal = (None, None) + + scorestring = scorerow.strip() + splitindex = scorestring.rfind("\t") + + if splitindex != -1: + name = scorestring[:splitindex].strip() + score = scorestring[splitindex + 1:].strip() + + if len(name) > 0 and score.isdigit(): + retVal = (name, score) + + return retVal + + def IFormatScoreLine(self, name, score): + scorestr = str(score) + return name + "\t" + scorestr + "\n" + + def IUpdateHoodImager(self): + hoodScoreList = ptScoreMgr().getCurrentAgeScores("PelletDrop") + if hoodScoreList: + hoodpoints = hoodScoreList[0].getValue() + hoodpelletscore = 0 + deviceInbox = self.IGetDeviceInbox() + if type(deviceInbox) != type(None): + items = deviceInbox.getChildNodeRefList() + for item in items: + item = item.getChild() + itemtn = item.upcastToTextNoteNode() + if itemtn: + if itemtn.getTitle() == "Neighborhood Pellet Score": + hoodpelletscore = itemtn + break + if hoodpelletscore: + newText = str(hoodpoints) + hoodpelletscore.setText(newText) + hoodpelletscore.forceSave() + else: + hoodpelletscore = ptVaultTextNoteNode(0) + hoodpelletscore.setTitle("Neighborhood Pellet Score") + newText = str(hoodpoints) + hoodpelletscore.setText(newText) + deviceInbox.addNode(hoodpelletscore) + + if hoodpelletscore and hoodpelletscore.getID() > 0: + sname = "Update=%d" % (hoodpelletscore.getID()) + self.ISendNotify(HoodInfoImagerScript.value, sname, 1.0) + + def IUpdatePelletScores(self, newplayername, pelletscore): + deviceInbox = self.IGetDeviceInbox() + if type(deviceInbox) != type(None): + pelletscores = None + items = deviceInbox.getChildNodeRefList() + for item in items: + item = item.getChild() + itemtn = item.upcastToTextNoteNode() + if itemtn: + if itemtn.getTitle() == "Pellet Scores": + pelletscores = itemtn + break + if pelletscores: + current = pelletscores.getText() + curscorelist = current.split("\n") + formattedList = [] + for scorerow in curscorelist: + if scorerow != "": + (playername, score) = self.IFixupScoreLine(scorerow) + if playername and score: + formattedList.append([int(score), playername]) + + formattedList.append([pelletscore, newplayername]) + formattedList.sort() + formattedList.reverse() + + curindex = 0 + newText = "" + for score in formattedList: + newText = newText + self.IFormatScoreLine(score[1], score[0]) + + curindex += 1 + if curindex > 20: + break + + pelletscores.setText(newText) + pelletscores.forceSave() + else: + playername = PtGetLocalPlayer().getPlayerName() + thetext = str(playername) + "\t" + str(pelletscore) + "\n" + pelletscores = ptVaultTextNoteNode(0) + pelletscores.setTitle("Pellet Scores") + pelletscores.setText(thetext) + deviceInbox.addNode(pelletscores) + + if pelletscores and pelletscores.getID() > 0: + sname = "Update=%d" % (pelletscores.getID()) + print "Sending notify to update node: ", pelletscores.getID() + self.ISendNotify(HoodInfoImagerScript.value, sname, 1.0) + else: + print "Not sending notify because we don't have a valid pelletscore node" + + self.IUpdateHoodImager() + + def ISendNotify(self, receiver, name, value): + notify = ptNotify(self.key) + notify.clearReceivers() + if type(receiver) == type([]): + for key in receiver: + notify.addReceiver(key) + else: + notify.addReceiver(receiver) + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + notify.addVarNumber(name, value) + notify.send() + + def OnServerInitComplete(self): + print "nb01UpdateHoodInfoImager.OnServerInitComplete()" + + try: + AmCCR = ptCCRMgr().getLevel() + except: + AmCCR = 0 + + if not AmCCR: + sname = "Join=%s" % (PtGetLocalPlayer().getPlayerName()) + self.ISendNotify(self.key, sname, 1.0) + + print "nb01UpdateHoodInfoImager.OnServerInitComplete: Sent player join update notify" + + def OnNotify(self,state,id,events): + for event in events: + if event[0] == kVariableEvent: + if self.sceneobject.isLocallyOwned(): + print "nb01UpdateHoodInfoImager.OnNotify: I am owner so I'll update the imager" + if event[1][:5] == "Join=": + playername = event[1][5:] + self.IUpdatePlayerList(playername) + print "nb01UpdateHoodInfoImager.OnNotify: Updated player list" + elif event[1][:6] == "Score=": + playername = event[1][6:] + score = int(event[3]) + self.IUpdatePelletScores(playername, score) + print "nb01UpdateHoodInfoImager.OnNotify: Updated pellet scores" diff --git a/Python/nglnFogTweener.py b/Python/nglnFogTweener.py new file mode 100644 index 0000000000..a5ea577358 --- /dev/null +++ b/Python/nglnFogTweener.py @@ -0,0 +1,330 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: nglnFogTweener +Age: Negilahn +Date: December 2003 +Author: Doug McBride +Animates the Fog RGB and Density troughout the Negilahn Day cycle +""" + +from Plasma import * +from PlasmaTypes import * +import string + +stringVarName = ptAttribString(1,"Battery Updated SDL") + +SunriseRGB = ptAttribString(2,"Sunrise: (Red,Green,Blue)") +SunriseDensity = ptAttribString(3,"Sunrise: (Start,End,Density)") + +NoonRGB = ptAttribString(4,"Noon: (Red,Green,Blue)") +NoonDensity = ptAttribString(5,"Noon: (Start,End,Density)") + +SunsetRGB = ptAttribString(6,"Sunset: (Red,Green,Blue)") +SunsetDensity = ptAttribString(7,"Sunset: (Start,End,Density)") + +MidnightRGB = ptAttribString(8,"Midnight: (Red,Green,Blue)") +MidnightDensity = ptAttribString(9,"Midnight: (Start,End,Density)") + +#globals +kSunrisePct = 0 +kNoonPct = .25 +kSunsetPct = .50 +kMidnightPct = .75 + +SunriseR = 0 +SunriseG = 0 +SunriseB = 0 +SunriseS = 0 +SunriseE = 0 +SunriseD = 0 + +NoonR = 0 +NoonG = 0 +NoonB = 0 +NoonS = 0 +NoonE = 0 +NoonD = 0 + +SunsetR = 0 +SunsetG = 0 +SunsetB = 0 +SunsetS = 0 +SunsetE = 0 +SunsetD = 0 + +MidnightR = 0 +MidnightG = 0 +MidnightB = 0 +MidnightS = 0 +MidnightE = 0 +MidnightD = 0 + +# Reset start and end values used for iinterpolating +StartR = 0 +StartG = 0 +StartB = 0 +EndR = 0 +EndG = 0 +EndB = 0 +StartS = 0 +EndS = 0 +StartE = 0 +EndE = 0 +StartD = 0 +EndD = 0 + + +class nglnFogTweener(ptMultiModifier): + + def __init__(self): + ptMultiModifier.__init__(self) + self.id = 5243 + version = 3 + self.version = version + print "__init__nglnFogTweener v.", version + + self.SunriseRGBList = [] + self.SunriseDensityList = [] + self.NoonRGBList = [] + self.NoonDensityList = [] + self.SunsetRGBList = [] + self.SunsetDensityList = [] + self.MidnightRGBList = [] + self.MidnightDensityList = [] + + def OnFirstUpdate(self): + global SunriseR + global SunriseG + global SunriseB + global SunriseS + global SunriseE + global SunriseD + global NoonR + global NoonG + global NoonB + global NoonS + global NoonE + global NoonD + global SunsetR + global SunsetG + global SunsetB + global SunsetS + global SunsetE + global SunsetD + global MidnightR + global MidnightG + global MidnightB + global MidnightS + global MidnightE + global MidnightD + + + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(stringVarName.value,1,1) + ageSDL.sendToClients(stringVarName.value) + + self.SunriseRGBList = SunriseRGB.value.split(",") + SunriseR = string.atof(self.SunriseRGBList[0]) + SunriseG = string.atof(self.SunriseRGBList[1]) + SunriseB = string.atof(self.SunriseRGBList[2]) + + self.SunriseDensityList = SunriseDensity.value.split(",") + SunriseS = string.atof(self.SunriseDensityList[0]) + SunriseE = string.atof(self.SunriseDensityList[1]) + SunriseD = string.atof(self.SunriseDensityList[2]) + + self.NoonRGBList = NoonRGB.value.split(",") + NoonR = string.atof(self.NoonRGBList[0]) + NoonG = string.atof(self.NoonRGBList[1]) + NoonB = string.atof(self.NoonRGBList[2]) + + self.NoonDensityList = NoonDensity.value.split(",") + NoonS = string.atof(self.NoonDensityList[0]) + NoonE = string.atof(self.NoonDensityList[1]) + NoonD = string.atof(self.NoonDensityList[2]) + + self.SunsetRGBList = SunsetRGB.value.split(",") + SunsetR = string.atof(self.SunsetRGBList[0]) + SunsetG = string.atof(self.SunsetRGBList[1]) + SunsetB = string.atof(self.SunsetRGBList[2]) + + self.SunsetDensityList = SunsetDensity.value.split(",") + SunsetS = string.atof(self.SunsetDensityList[0]) + SunsetE = string.atof(self.SunsetDensityList[1]) + SunsetD = string.atof(self.SunsetDensityList[2]) + + + self.MidnightRGBList = MidnightRGB.value.split(",") + MidnightR = string.atof(self.MidnightRGBList[0]) + MidnightG = string.atof(self.MidnightRGBList[1]) + MidnightB = string.atof(self.MidnightRGBList[2]) + + self.MidnightDensityList = MidnightDensity.value.split(",") + MidnightS = string.atof(self.MidnightDensityList[0]) + MidnightE = string.atof(self.MidnightDensityList[1]) + MidnightD = string.atof(self.MidnightDensityList[2]) + + print "nglnFogTweener.OnFirstUpdate: SunriseRGB=(%s,%s,%s), NoonRGB=(%s,%s,%s), SunsetRGB=(%s,%s,%s), MidnightRGB=(%s,%s,%s) " % (SunriseR, SunriseG, SunriseB, NoonR, NoonG, NoonB, SunsetR, SunsetG, SunsetB, MidnightR, MidnightG, MidnightB) + print "nglnFogTweener.OnFirstUpdate: SunriseDensity=(%s,%s,%s), NoonDensity=(%s,%s,%s), SunsetDensity=(%s,%s,%s), MidnightDensity=(%s,%s,%s) " % (SunriseS, SunriseE, SunriseD, NoonS, NoonE, NoonD, SunsetS, SunsetE, SunsetD, MidnightS, MidnightE, MidnightD) + + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + ageSDL.setNotify(self.key,stringVarName.value,0.0) + + self.CalculateNewFogValues() + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname != stringVarName.value: + return + else: + self.CalculateNewFogValues() + + + def CalculateNewFogValues(self): + global StartR + global EndR + global StartG + global EndG + global StartB + global EndB + + global StartS + global EndS + global StartE + global EndE + global StartD + global EndD + + + #~ print "nglnFogTweener.CalculateNewFogValues: The battery was updated. Time to update the Fog." + + AgeTimeOfDayPercent = PtGetAgeTimeOfDayPercent() + + print "nglnFogTweener: The day is %.2f%% through its complete cycle." % (AgeTimeOfDayPercent*100) + if AgeTimeOfDayPercent > kSunrisePct and AgeTimeOfDayPercent < kNoonPct: + StartR = SunriseR + EndR = NoonR + StartG = SunriseG + EndG = NoonG + StartB = SunriseB + EndB = NoonB + StartS = SunriseS + EndS = NoonS + StartE = SunriseE + EndE = NoonE + StartD = SunriseD + EndD = NoonD + + TweenPct = (AgeTimeOfDayPercent - kSunrisePct) / (kNoonPct - kSunrisePct) + + print "\tIt's after Sunrise and before Noon. (%.2f%% through this quadrant)" % (TweenPct*100) + + + elif AgeTimeOfDayPercent > kNoonPct and AgeTimeOfDayPercent < kSunsetPct: + StartR = NoonR + EndR = SunsetR + StartG = NoonG + EndG = SunsetG + StartB = NoonB + EndB = SunsetB + + StartS = NoonS + EndS = SunsetS + StartE = NoonE + EndE = SunsetE + StartD = NoonD + EndD = SunsetD + + TweenPct = (AgeTimeOfDayPercent - kNoonPct) / (kSunsetPct - kNoonPct) + print "\tIt's after Noon and before Sunset. (%.2f%% this quadrant)" % (TweenPct*100) + + elif AgeTimeOfDayPercent > kSunsetPct and AgeTimeOfDayPercent < kMidnightPct: + StartR = SunsetR + EndR = MidnightR + StartG = SunsetG + EndG = MidnightG + StartB = SunsetB + EndB = MidnightB + + StartS = SunsetS + EndS = MidnightS + StartE = SunsetE + EndE = MidnightE + StartD = SunsetD + EndD = MidnightD + + TweenPct = (AgeTimeOfDayPercent - kSunsetPct) / (kMidnightPct - kSunsetPct) + print "\tIt's after Sunset and before Midnight. (%.2f%% this quadrant)" % (TweenPct*100) + + elif AgeTimeOfDayPercent > kMidnightPct and AgeTimeOfDayPercent < 1: + StartR = MidnightR + EndR = SunriseR + StartG = MidnightG + EndG = SunriseG + StartB = MidnightB + EndB = SunriseB + + StartS = MidnightS + EndS = SunriseS + StartE = MidnightE + EndE = SunriseE + StartD = MidnightD + EndD = SunriseD + + TweenPct = (AgeTimeOfDayPercent - kMidnightPct) / (1 - kMidnightPct) + print "\tIt's after Midnight and before Sunrise. (%.2f%% this quadrant)" % (TweenPct*100) + + else: + print "ERROR: I can't tell what time it is." + + #~ print "OnSDLNotify: StartR=%s, EndR=%s, StartG=%s, EndG==%s, StartB=%s, EndB=%s" % (StartR, EndR, StartG, EndG, StartB, EndB) + + self.UpdateFog(StartR, EndR, StartG, EndG, StartB, EndB, StartS, EndS, StartE, EndE, StartD, EndD, TweenPct) + + def UpdateFog(self, StartR, EndR, StartG, EndG, StartB, EndB, StartS, EndS, StartE, EndE, StartD, EndD, TweenPct): + #~ print "TweenPct = ", TweenPct + print "UpdateFog: StartR=%s, EndR=%s, StartG=%s, EndG=%s, StartB=%s, EndB=%s" % (StartR, EndR, StartG, EndG, StartB, EndB) + print "UpdateFog: StartS=%s, EndS=%s, StartE=%s, EndE=%s, StartD=%s, EndD=%s" % (StartS, EndS, StartE, EndE, StartD, EndD) + + + NewR = StartR + ((EndR - StartR) * TweenPct) + NewG = StartG + ((EndG - StartG) * TweenPct) + NewB = StartB + ((EndB - StartB) * TweenPct) + + NewS = StartS + ((EndS - StartS) * TweenPct) + NewE = StartE + ((EndE - StartE) * TweenPct) + NewD = StartD + ((EndD - StartD) * TweenPct) + + print "UpdateFog: The new fog RGB is (%.3f, %.3f, %.3f)" % (NewR, NewG, NewB) + print "UpdateFog: The new fog Density is (%.3f, %.3f, %.3f)" % (NewS, NewE, NewD) + + newfogcolor = ptColor(red=NewR, green=NewG, blue=NewB) + + PtFogSetDefColor(newfogcolor) + PtFogSetDefLinear(NewS, NewE, NewD) diff --git a/Python/nglnTreeMonkey.py b/Python/nglnTreeMonkey.py new file mode 100644 index 0000000000..26f6052a7c --- /dev/null +++ b/Python/nglnTreeMonkey.py @@ -0,0 +1,271 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: nglnTreeMonkey +Age: Negilahn +Date: December 2003 +Author: Doug McBride +HaX0r3d: Derek Odell +Controls the appearance and behavior of the Negilahn Tree Monkey +""" + +from Plasma import * +from PlasmaTypes import * +import whrandom + +# define the attributes that will be entered in max +respSpawnPt = ptAttribResponder(1, "resp: Spawn Point", ['0','1','2'], netForce=1) +respMonkeyAct = ptAttribResponder(2, "resp: Monkey Actions", ['Alarmed','Up','Eat','Idle', 'Vocalize']) +respMonkeySfx = ptAttribNamedResponder(3, "resp: Monkey SFX", ['Alarmed','Up','Eat','Idle','Off','Vocalize'], netForce=1) +respMonkeyOff = ptAttribResponder(4, "resp: Monkey Off") + +# define globals +kDayLengthInSeconds = 56585 # Length of a Negilahn day in seconds Must match value in Negilahn.age file +kMinimumTimeBetweenSpawns = 300 # 5 minutes +kMaximumTimeBetweenSpawns = 18000 # 5 hours + +# Chance in 100 that monkey will: +IdlePct = 30 +EatPct = 20 +VocalizePct = 20 +AlarmedPct = 10 +OffPct = 20 +stackList = [] + +#==================================== + +class nglnTreeMonkey(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 5241 + version = 3 + self.version = version + print "__init__nglnTreeMonkey v.", version,".0" + + ########################### + def OnFirstUpdate(self): + whrandom.seed() + + ########################### + def OnServerInitComplete(self): + try: + ageSDL = PtGetAgeSDL() + except: + print "nglnTreeMonkey:\tERROR---Cannot find the Negilahn Age SDL" + self.InitNewSDLVars() + + ageSDL.sendToClients("MonkeyLastUpdated") + ageSDL.sendToClients("MonkeySpawnTimes") + ageSDL.setFlags("MonkeyLastUpdated", 1, 1) + ageSDL.setFlags("MonkeySpawnTimes", 1, 1) + ageSDL.setNotify(self.key, "MonkeyLastUpdated", 0.0) + ageSDL.setNotify(self.key, "MonkeySpawnTimes", 0.0) + + thisDay = int(PtGetDniTime() / kDayLengthInSeconds) + lastDay = int(ageSDL["MonkeyLastUpdated"][0] / kDayLengthInSeconds) + + if (thisDay - lastDay) > 0: + print "nglnTreeMonkey: It's been at least a day since the last update, running new numbers now." + self.InitNewSDLVars() + else: + print "nglnTreeMonkey: It's been less than a day since the last update, doing nothing" + self.SetMonkeyTimers() + + if not len(PtGetPlayerList()): + respMonkeyOff.run(self.key, fastforward=1) + + ########################### + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname == "MonkeySpawnTimes": + self.SetMonkeyTimers() + + ########################### + def OnNotify(self,state,id,events): + global stackList + print "nglnTreeMonkey.OnNotify: state=%f id=%d events=" % (state,id),events + + if id == (-1): + print "Need to store event: %s" % (events[0][1]) + stackList.append(events[0][1]) + print "New list is: %s" % (str(stackList)) + if len(stackList) == 1: + print "List is only one command long, so I'm playing it" + code = stackList[0] + print "Playing command: %s" % (code) + exec code + + elif id == respMonkeyAct.id and self.sceneobject.isLocallyOwned(): + print "Callback was from responder, and I own the age, so Logic Time" + old = stackList.pop(0) + print "Popping off: %s" % (old) + self.RandomBehavior() + + elif id == respMonkeyOff.id and self.sceneobject.isLocallyOwned(): + print "Callback was from 'Off' responder" + old = stackList.pop(0) + print "Popping off: %s" % (old) + + elif (id == respMonkeyAct.id or id == respMonkeyOff.id) and not self.sceneobject.isLocallyOwned(): + print "Callback was from responder, and I DON'T own the age, so I'll try playing the next item in list" + old = stackList.pop(0) + print "Popping off: %s" % (old) + if len(stackList): + print "List has at least one item ready to play" + code = stackList[0] + print "Playing command: %s" % (code) + exec code + + else: + print "Callback from something else?" + + ########################### + def RandomBehavior(self): + ageSDL = PtGetAgeSDL() + PickABehavior = whrandom.randint(1,100) + #~ print "PickABehavior = ",PickABehavior + LightsOn = ageSDL["nglnPodLights"][0] + posMonkeyStates = ['Idle','Eat','Alarmed','Vocalize','Off'] + Cumulative = 0 + + for MonkeyState in posMonkeyStates: + NewCumulative = eval( "Cumulative + " + MonkeyState + "Pct" ) + if PickABehavior > Cumulative and PickABehavior <= NewCumulative: + if MonkeyState == "Off": + self.SendNote("respMonkeyOff.run(self.key)") + else: + respString = "respMonkeyAct.run(self.key, state='" + str(MonkeyState) + "')" + self.SendNote(respString) + print "nglnTreeMonkey: Attempting Tree Monkey Anim: %s" % (MonkeyState) + if LightsOn: + respMonkeySfx.run(self.key, state=str(MonkeyState)) + print "nglnTreeMonkey: Attempting Tree Monkey SFX: %s" % (MonkeyState) + return + Cumulative = eval("Cumulative + " + MonkeyState +"Pct") + + ########################### + def SendNote(self, ExtraInfo): + #pythonBox = PtFindSceneobject("Dummy04", "Negilahn") + #pmlist = pythonBox.getPythonMods() + #for pm in pmlist: + notify = ptNotify(self.key) + notify.clearReceivers() + + #notify.addReceiver(pm) + notify.addReceiver(self.key) + + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + + notify.addVarNumber(str(ExtraInfo),1.0) + + notify.send() + + ########################### + def MonkeyAppears(self): + whichtree = whrandom.randint(0,2) + respSpawnPt.run(self.key, state=str(whichtree)) + self.SendNote("respMonkeyAct.run(self.key, state='Up')") + print "nglnTreeMonkey: Tree Monkey is climbing Tree: %d" % (whichtree) + + ########################### + def OnTimer(self,TimerID): + print "nglnTreeMonkey.OnTimer: callback id=%d" % (TimerID) + if self.sceneobject.isLocallyOwned(): + if TimerID == 1: + self.MonkeyAppears() + elif TimerID == 2: + self.InitNewSDLVars() + + ########################### + def InitNewSDLVars(self): + ageSDL = PtGetAgeSDL() + + ageSDL["MonkeyLastUpdated"] = (PtGetDniTime(),) + + beginningOfToday = PtGetDniTime() - int(PtGetAgeTimeOfDayPercent() * kDayLengthInSeconds) + endOfToday = int(kDayLengthInSeconds / 2) + beginningOfToday + #print "Dawn: %d Dusk: %d" % (beginningOfToday, endOfToday) + + # We need a random times in the first 5 hours of the day + # which is in the first 31.8 percent of the day. So we're + # generating a number from 0 to 318 and dividing by 1000 to get + # something roughly in that timeframe. + randnum = float(whrandom.randint(0,318)) + firstTime = int((randnum / 1000.0) * kDayLengthInSeconds) + beginningOfToday + print "nglnTreeMonkey: Generated a valid spawn time: %d" % (firstTime) + spawnTimes = [firstTime] + + while type(spawnTimes[-1]) == type(long(1)): + randnum = whrandom.randint(kMinimumTimeBetweenSpawns, kMaximumTimeBetweenSpawns) + newTime = spawnTimes[-1] + randnum + if newTime < endOfToday: + print "nglnTreeMonkey: Generated a valid spawn time: %d" % (newTime) + spawnTimes.append(newTime) + else: + print "nglnTreeMonkey: Generated a spawn time after dusk, exiting loop: %d" % (newTime) + break + else: + print "nglnTreeMonkey:ERROR---Tried to add a spawn time that's not a number: " , spawnTimes + spawnTimes = [0] + + while len(spawnTimes) < 20: + spawnTimes.append(0) + + ageSDL["MonkeySpawnTimes"] = tuple(spawnTimes) + + ########################### + def SetMonkeyTimers(self): + PtClearTimerCallbacks(self.key) + ageSDL = PtGetAgeSDL() + if ageSDL["MonkeySpawnTimes"][0]: + for timer in ageSDL["MonkeySpawnTimes"]: + if timer: + timeTillSpawn = timer - PtGetDniTime() + print "timer: %d time: %d timeTillSpawn: %d" % (timer,PtGetDniTime(),timeTillSpawn) + if timeTillSpawn > 0: + print "nglnTreeMonkey: Setting timer for %d seconds" % (timeTillSpawn) + PtAtTimeCallback(self.key, timeTillSpawn, 1) + + # precision error FTW! + timeLeftToday = kDayLengthInSeconds - int(PtGetAgeTimeOfDayPercent() * kDayLengthInSeconds) + timeLeftToday += 1 # because we want it to go off right AFTER the day flips + print "nglnTreeMonkey: Setting EndOfDay timer for %d seconds" % (timeLeftToday) + PtAtTimeCallback(self.key, timeLeftToday, 2) + else: + print "nglnTreeMonkey: Timer array was empty!" + + ########################### + def OnBackdoorMsg(self, target, param): + if target == "monkey": + if self.sceneobject.isLocallyOwned(): + print "nglnTreeMonkey.OnBackdoorMsg: Work!" + if param == "up": + self.SendNote("respMonkeyAct.run(self.key, state='Up')") + elif param == "tree": + self.MonkeyAppears() + diff --git a/Python/nglnUrwinBrain.py b/Python/nglnUrwinBrain.py new file mode 100644 index 0000000000..ed48ef0708 --- /dev/null +++ b/Python/nglnUrwinBrain.py @@ -0,0 +1,382 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: nglnUrwinBrain +Age: Negilahn +Date: January 2004 +Author: Doug McBride +HaX0r3d: Derek Odell +Controls the appearance and behavior of the Negilahn Urwin Bird +""" + +from Plasma import * +from PlasmaTypes import * +import whrandom + +# define the attributes that will be entered in max +UrwinMasterAnim = ptAttribAnimation(1, "Urwin Master Anim", netForce=1) + +respUrwinVocalize = ptAttribResponder(2, "resp: Urwin Vocalize") +respUrwinIdle = ptAttribResponder(3, "resp: Urwin Idles") +respUrwinIdleToWalk = ptAttribResponder(4, "resp: Urwin Idle To Walk") +respUrwinWalkLoop = ptAttribResponder(5, "resp: Urwin Walk Loop") +respUrwinWalkToIdle = ptAttribResponder(6, "resp: Urwin Walk To Idle") +respUrwinEat = ptAttribResponder(7, "resp: Urwin Eats") + +respUrwinSfx = ptAttribNamedResponder(8, "resp: Urwin SFX", ['Eat','Idle','IdleToWalk','WalkLoop','WalkToIdle','Vocalize','Distance','Appear'], netForce=1) + +actUrwinPathEnd = ptAttribActivator(9, "act: Urwin Path End") + +# define globals +kDayLengthInSeconds = 56585 # Length of a Negilahn day in seconds Must match value in Negilahn.age file +kMinimumTimeBetweenSpawns = 3600 # 1 hour +kMaximumTimeBetweenSpawns = 25200 # 7 hours +# We need the first random spawn time in the first 5 hours of the day +# which is in the first 44.5 percent of the day. So we're +# generating a number from 0 to 445 and later we divide by 1000 to get +# something roughly in that timeframe. +kFirstMorningSpawn = 445 + +minsteps = 3 +maxsteps = 10 + +StepsToTake = 0 +stackList = [] + +class nglnUrwinBrain(ptResponder): + ############################ + def __init__(self): + ptResponder.__init__(self) + self.id = 5244 + version = 4 + self.version = version + print "__init__nglnUrwinBrain v.", version,".0" + + ############################ + def OnFirstUpdate(self): + whrandom.seed() + + ############################ + def OnServerInitComplete(self): + try: + ageSDL = PtGetAgeSDL() + except: + print "nglnUrwinBrain:\tERROR---Cannot find the Negilahn Age SDL" + self.InitNewSDLVars() + + ageSDL.sendToClients("UrwinLastUpdated") + ageSDL.sendToClients("UrwinSpawnTimes") + ageSDL.sendToClients("UrwinOnTheProwl") + ageSDL.setFlags("UrwinLastUpdated", 1, 1) + ageSDL.setFlags("UrwinSpawnTimes", 1, 1) + ageSDL.setFlags("UrwinOnTheProwl", 1, 1) + ageSDL.setFlags("nglnPodLights", 1, 1) + ageSDL.setNotify(self.key, "UrwinLastUpdated", 0.0) + ageSDL.setNotify(self.key, "UrwinSpawnTimes", 0.0) + ageSDL.setNotify(self.key, "UrwinOnTheProwl", 0.0) + ageSDL.setNotify(self.key, "nglnPodLights", 0.0) + + thisDay = int(PtGetDniTime() / kDayLengthInSeconds) + lastDay = int(ageSDL["UrwinLastUpdated"][0] / kDayLengthInSeconds) + + if (thisDay - lastDay) > 0: + print "nglnUrwinBrain: It's been at least a day since the last update, running new numbers now." + self.InitNewSDLVars() + else: + print "nglnUrwinBrain: It's been less than a day since the last update, doing nothing" + self.SetUrwinTimers() + + if not len(PtGetPlayerList()): + UrwinMasterAnim.animation.skipToBegin() + + ########################### + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname == "UrwinSpawnTimes": + self.SetUrwinTimers() + + #Had to wire this to stop SFX if the lights go off.... + elif VARname == "nglnPodLights": + ageSDL = PtGetAgeSDL() + if not ageSDL[VARname][0] and ageSDL["UrwinOnTheProwl"][0]: + respUrwinSfx.run(self.key, state="Idle") + + ############################ + def OnNotify(self,state,id,events): + global StepsToTake + global stackList + + ageSDL = PtGetAgeSDL() + print "nglnUrwinBrain.OnNotify: state=%f id=%d owned=%s prowl=%s events=" % (state,id,str(self.sceneobject.isLocallyOwned()),str(ageSDL["UrwinOnTheProwl"][0])),events + + if id == (-1): + print "Need to store event: %s" % (events[0][1]) + stackList.append(events[0][1]) + print "New list is: %s" % (str(stackList)) + if len(stackList) == 1: + print "List is only one command long, so I'm playing it" + code = stackList[0] + print "Playing command: %s" % (code) + exec code + + elif state and self.sceneobject.isLocallyOwned() and ageSDL["UrwinOnTheProwl"][0]: + if id == respUrwinSfx.id: + print "Callback was from Appearance SFX, and I own the age, so start walking" + self.StartToWalk() + + else: + print "Callback was from responder, and I own the age, so Logic Time" + old = stackList.pop(0) + print "Popping off: %s" % (old) + boolBatteryChargedAndOn = ageSDL["nglnPodLights"][0] + + if id == respUrwinIdleToWalk.id: + self.StartToWalk() + + elif id == respUrwinWalkLoop.id: + StepsToTake = StepsToTake - 1 + if StepsToTake: + # 90% chance of continuing walk loop + if whrandom.randint(0,9): + print "Urwin will take %d more steps..." % (StepsToTake) + self.SendNote("respUrwinWalkLoop.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="WalkLoop") + # 10% to eat + else: + print "Urwin is hungry and decides to eat" + self.SendNote("respUrwinEat.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat") + else: + print "Urwin is tired and stops walking" + PtAtTimeCallback(self.key, 0.666, 3) + self.SendNote("respUrwinWalkToIdle.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="WalkToIdle") + + elif id == respUrwinEat.id: + print "Urwin is done eating and continues walking" + self.SendNote("respUrwinWalkLoop.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="WalkLoop") + + elif id == respUrwinWalkToIdle.id: + self.RandomBehavior() + + elif id == respUrwinIdle.id or id == respUrwinVocalize.id: + # 66% chance of picking another random behaviour + if whrandom.randint(0,2): + self.RandomBehavior() + # 33% to go back to walking + else: + print "Urwin is rested and goes back to walking" + self.SendNote("respUrwinIdleToWalk.run(self.key)") + UrwinMasterAnim.animation.resume() + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="IdleToWalk") + + elif id == actUrwinPathEnd.id: + print "End of the line, Urwin!" + UrwinMasterAnim.animation.stop() + UrwinMasterAnim.animation.skipToTime(0) + ageSDL["UrwinOnTheProwl"] = (0,) + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Distance") + + elif id in range(2,8) and not self.sceneobject.isLocallyOwned(): + print "Callback was from responder, and I DON'T own the age, so I'll try playing the next item in list" + old = stackList.pop(0) + print "Popping off: %s" % (old) + if len(stackList): + print "List has at least one item ready to play" + code = stackList[0] + print "Playing command: %s" % (code) + exec code + + else: + print "Callback from something else?" + + ############################ + def RandomBehavior(self): + ageSDL = PtGetAgeSDL() + + boolBatteryChargedAndOn = ageSDL["nglnPodLights"][0] + + # 66% chance of idling + if whrandom.randint(0,2): + print "Urwin is being lazy and just idling" + self.SendNote("respUrwinIdle.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle") + # 33% to vocalize + else: + print "Urwin is calling home." + self.SendNote("respUrwinVocalize.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Vocalize") + + ############################ + def StartToWalk(self): + global StepsToTake + + ageSDL = PtGetAgeSDL() + boolBatteryChargedAndOn = ageSDL["nglnPodLights"][0] + + StepsToTake = whrandom.randint(minsteps, maxsteps) + print "Urwin has decided to take %d steps." % (StepsToTake) + + self.SendNote("respUrwinWalkLoop.run(self.key)") + UrwinMasterAnim.animation.resume() + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="WalkLoop") + + ############################ + def OnTimer(self,TimerID): + global UrwinOnTheProwl + + ageSDL = PtGetAgeSDL() + boolBatteryChargedAndOn = ageSDL["nglnPodLights"][0] + if self.sceneobject.isLocallyOwned(): + if TimerID == 1: + print "UrwinBrain.OnTimer: Time for the Urwin to return." + ageSDL["UrwinOnTheProwl"] = (1,) + if ageSDL["nglnPodLights"][0]: + respUrwinSfx.run(self.key, state="Appear") + else: + self.StartToWalk() + elif TimerID == 2: + print "UrwinBrain.OnTimer: New day, let's renew the timers." + self.InitNewSDLVars() + elif TimerID == 3: + UrwinMasterAnim.animation.stop() + + ########################### + def SendNote(self, ExtraInfo): + #pythonBox = PtFindSceneobject("Dummy04", "Negilahn") + #pmlist = pythonBox.getPythonMods() + #for pm in pmlist: + notify = ptNotify(self.key) + notify.clearReceivers() + + #notify.addReceiver(pm) + notify.addReceiver(self.key) + + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + + notify.addVarNumber(str(ExtraInfo),1.0) + + notify.send() + + ########################### + def InitNewSDLVars(self): + ageSDL = PtGetAgeSDL() + + ageSDL["UrwinLastUpdated"] = (PtGetDniTime(),) + + beginningOfToday = PtGetDniTime() - int(PtGetAgeTimeOfDayPercent() * kDayLengthInSeconds) + endOfToday = int(kDayLengthInSeconds / 2) + beginningOfToday + #print "Dawn: %d Dusk: %d" % (beginningOfToday, endOfToday) + + # We need a random times in the first 5 hours of the day + # which is in the first 44.5 percent of the day. So we're + # generating a number from 0 to 445 and dividing by 1000 to get + # something roughly in that timeframe. + randnum = float(whrandom.randint(0,kFirstMorningSpawn)) + firstTime = int((randnum / 1000.0) * kDayLengthInSeconds) + beginningOfToday + print "nglnUrwinBrain: Generated a valid spawn time: %d" % (firstTime) + spawnTimes = [firstTime] + + while type(spawnTimes[-1]) == type(long(1)): + randnum = whrandom.randint(kMinimumTimeBetweenSpawns, kMaximumTimeBetweenSpawns) + newTime = spawnTimes[-1] + randnum + if newTime < endOfToday: + print "nglnUrwinBrain: Generated a valid spawn time: %d" % (newTime) + spawnTimes.append(newTime) + else: + print "nglnUrwinBrain: Generated a spawn time after dusk, exiting loop: %d" % (newTime) + break + else: + print "nglnUrwinBrain:ERROR---Tried to add a spawn time that's not a number: " , spawnTimes + spawnTimes = [0] + + while len(spawnTimes) < 20: + spawnTimes.append(0) + + ageSDL["UrwinSpawnTimes"] = tuple(spawnTimes) + + ########################### + def SetUrwinTimers(self): + PtClearTimerCallbacks(self.key) + ageSDL = PtGetAgeSDL() + if ageSDL["UrwinSpawnTimes"][0]: + for timer in ageSDL["UrwinSpawnTimes"]: + if timer: + timeTillSpawn = timer - PtGetDniTime() + print "timer: %d time: %d timeTillSpawn: %d" % (timer,PtGetDniTime(),timeTillSpawn) + if timeTillSpawn > 0: + print "nglnUrwinBrain: Setting timer for %d seconds" % (timeTillSpawn) + PtAtTimeCallback(self.key, timeTillSpawn, 1) + + # precision error FTW! + timeLeftToday = kDayLengthInSeconds - int(PtGetAgeTimeOfDayPercent() * kDayLengthInSeconds) + timeLeftToday += 1 # because we want it to go off right AFTER the day flips + print "nglnUrwinBrain: Setting EndOfDay timer for %d seconds" % (timeLeftToday) + PtAtTimeCallback(self.key, timeLeftToday, 2) + else: + print "nglnUrwinBrain: Timer array was empty!" + + ########################### + def OnBackdoorMsg(self, target, param): + global kMinimumTimeBetweenSpawns + global kMaximumTimeBetweenSpawns + global kFirstMorningSpawn + + ageSDL = PtGetAgeSDL() + if target == "urwin": + if self.sceneobject.isLocallyOwned(): + print "nglnUrwinBrain.OnBackdoorMsg: Backdoor!" + if param == "walk": + ageSDL["UrwinOnTheProwl"] = (1,) + if ageSDL["nglnPodLights"][0]: + PtAtTimeCallback(self.key, 1, 1) + else: + self.StartToWalk() + + elif param == "restore": + kMinimumTimeBetweenSpawns = 3600 # 1 hour + kMaximumTimeBetweenSpawns = 25200 # 7 hours + kFirstMorningSpawn = 445 + self.InitNewSDLVars() + + elif type(param) == type(""): + newTimes = param.split(";") + kMinimumTimeBetweenSpawns = int(newTimes[0]) + kMaximumTimeBetweenSpawns = int(newTimes[1]) + kFirstMorningSpawn = 1 + self.InitNewSDLVars() + diff --git a/Python/nxusBookMachine.py b/Python/nxusBookMachine.py new file mode 100644 index 0000000000..49827b14b2 --- /dev/null +++ b/Python/nxusBookMachine.py @@ -0,0 +1,2728 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: nxusBookMachine +Age: nexus +Date: September, 2002 +Author: Bill Slease +Handler for the nexus book machine. +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from PlasmaVaultConstants import * +from PlasmaNetConstants import * +import PlasmaControlKeys +from xPsnlVaultSDL import * +import time + +import xLocTools + +import string +import whrandom + +import xVisitorUtils + +# define the attributes that will be entered in max +NexusGUI = ptAttribGUIDialog(1,"The Nexus GUI") +actKISlot = ptAttribActivator(2,"Actvtr: KI Slot") +respKISlot = ptAttribResponder(3,"Rspndr: KI Slot") +camMachineOps = ptAttribSceneobject(4,"Camera: machine ops") +behMachineOps = ptAttribBehavior(5, "Behavior: machine ops") +respKISlotReturn = ptAttribResponder(6,"Rspndr: KI Slot Return") # onInit +respGUIOn = ptAttribResponder(7,"Rspndr: GUI On") +respGUIOff = ptAttribResponder(8,"Rspndr: GUI Off") +respBookSelect = ptAttribResponder(9,"Rspndr: Enable GetBook Btn") +#respBookGet = ptAttribResponder(10,"Rspndr: Get Book") +actLink = ptAttribActivator(11,"Actvtr: Link") +respLink = ptAttribResponder(12,"Rspndr: Link") +respBookRetract = ptAttribResponder(13,"Rspndr: Retract Book") # onInit +actGetBook = ptAttribActivator(14,"Actvtr: Get Book") +respGetBook = ptAttribResponder(15,"Rspndr: Get Book") +respButtonPress = ptAttribResponder(16,"Rspndr: GetBook Btn Press") # onInit +objlistLinkPanels = ptAttribSceneobjectList(17,"Objct: Link Panels") +respKISlotGlow = ptAttribResponder(18,"Rspndr: KI Slot Glow") + + + +# globals +#============== + +kHiddenPersonalAges = ["Personal","Nexus","Neighborhood","city","AvatarCustomization","Cleft","BaronCityOffice","BahroCave","PelletBahroCave","Kveer","Myst","LiveBahroCaves","LiveBahroCave"] +kHiddenAgesIfVisitor = ["Kadish","Gira","Garrison","Teledahn"] +kHiddenCityLinks = ["islmPalaceBalcony03","KadishGallery","islmPalaceBalcony02","islmDakotahRoof"] +kHiddenAgesIfInvited = ["BahroCave","PelletBahroCave","Pellet Cave","LiveBahroCave","LiveBahroCaves","Myst"] + +#------nexus machine GUI tags +kNexusDialogName="NexusAgeDialog" + +kIDBtnLinkCategory01 = 100 +kIDTxtLinkCategory01 = 101 +kIDBtnLinkCategory02 = 110 +kIDTxtLinkCategory02 = 111 +kIDBtnLinkCategory03 = 120 +kIDTxtLinkCategory03 = 121 +kIDBtnLinkCategory04 = 130 +kIDTxtLinkCategory04 = 131 + +kIDBtnNeighborhoodCreate = 400 +kIDBtnNeighborhoodSelect = 401 +kIDTxtNeighborhoodName = 402 +kIDTxtNeighborhoodInfo = 403 + +kIDBtnNeighborhoodPublic = 404 +kIDTxtNeighborhoodPublic = 405 + +kIDBtnScrollUp = 500 +kIDBtnScrollDn = 501 + +kIDTxtLinkDescription = 200 + +kIDBtnLinkSelect01 = 210 +kIDBtnLinkSelect02 = 220 +kIDBtnLinkSelect03 = 230 +kIDBtnLinkSelect04 = 240 +kIDBtnLinkSelect05 = 250 +kIDBtnLinkSelect06 = 260 +kIDBtnLinkSelect07 = 270 +kIDBtnLinkSelect08 = 280 +kIDTxtLinkName01 = 211 +kIDTxtLinkName02 = 221 +kIDTxtLinkName03 = 231 +kIDTxtLinkName04 = 241 +kIDTxtLinkName05 = 251 +kIDTxtLinkName06 = 261 +kIDTxtLinkName07 = 271 +kIDTxtLinkName08 = 281 +kIDTxtLinkInfo01 = 212 +kIDTxtLinkInfo02 = 222 +kIDTxtLinkInfo03 = 232 +kIDTxtLinkInfo04 = 242 +kIDTxtLinkInfo05 = 252 +kIDTxtLinkInfo06 = 262 +kIDTxtLinkInfo07 = 272 +kIDTxtLinkInfo08 = 282 + +kIDBtnDeleteLink01 = 310 +kIDBtnDeleteLink02 = 320 +kIDBtnDeleteLink03 = 330 +kIDBtnDeleteLink04 = 340 +kIDBtnDeleteLink05 = 350 +kIDBtnDeleteLink06 = 360 +kIDBtnDeleteLink07 = 370 +kIDBtnDeleteLink08 = 380 + +kIDNameHeaderText = 600 +kIDPopHeaderText = 601 +kIDNameHeaderBtn = 610 +kIDPopHeaderBtn = 611 +kIDNameAscArrow = 620 +kIDPopAscArrow = 621 +kIDNameDescArrow = 630 +kIDPopDescArrow = 631 + +kIDEngCheckBox = 700 +kIDFreCheckBox = 701 +kIDGerCheckBox = 702 +kIDEngCheck = 710 +kIDFreCheck = 711 +kIDGerCheck = 712 +kIDEngText = 720 +kIDFreText = 721 +kIDGerText = 722 + +#------colors +AgenGoldDk = ptColor(0.925,0.84,0.365,1.0) +AgenGoldLt = ptColor(0.97,0.937,0.745,1.0) +AgenGoldDkSoft = ptColor(0.925,0.84,0.365,0.25) +AgenGoldLtSoft = ptColor(0.97,0.937,0.745,0.25) + +colorNormal = AgenGoldDk +colorSelected = AgenGoldLt +colorPresented = AgenGoldLt +colorDisabled = AgenGoldDkSoft + +#-------misc +avatar = None +waitingOnGUIAnim = false +idLinkSelected = 0 +idBookPresented = 0 +boolGetBookBtnUp = false +boolGetBookAfterBtnPress = false +boolBookPresented = false +boolGetBookAfterBookRetract = false +idDeleteCandidateName = 0 +idCategorySelected = kIDBtnLinkCategory01 +boolLinking = false +boolGettingBook = false +indexDisplayStart = 0 +dialogLoaded = 0 +kNumDisplayFields = 8 +kEmptyGuid = '0000000000000000' +kMaxDisplayableChars = 24 # the avg number of chars to display before tacking on an ellipsis: "..." + +# the vars that can be randomized to any valid value for their type +kRandomizeVars = ["nb01ClockVis","nb01GardenFungusVis", + "nb01DestructionCracksVis","nb01LanternsVis","nb01LampOption01Vis","nb01OldImager01Vis", + "nb01OldImager02Vis","nb01WaterfallTorchesVis","nb01ResidenceAdditionsVis"] + +# these vars have a specific set of values +# "name" : (0,1,2) <-- range of values +kVarRestrictions = { + "nb01StainedWindowOption": (0,1,2) + } + +cityInstances = [] +cityPopulations = [] +curCityInstance = -1 # use the first one as default + +pubInstance = None +pubPopulation = 0 + +kirelInstance = None +kirelPopulation = 0 + +#guildPubInstance = None +guildPubPopulation = 0 +guildPubs = ["Cartographers","Greeters","Maintainers","Messengers","Writers"] +guildPubGUIDs = [ "35624301-841e-4a07-8db6-b735cf8f1f53","381fb1ba-20a0-45fd-9bcb-fd5922439d05",\ + "e8306311-56d3-4954-a32d-3da01712e9b5","9420324e-11f8-41f9-b30b-c896171a8712",\ + "5cf4f457-d546-47dc-80eb-a07cdfefa95d"] +kveerPublicPopulation = 0 +#kveerPublicInstance = None +kveerPublicGUID = "68e219e0-ee25-4df0-b855-0435584e29e2" +publicHoods = [] +publicHoodsPop = [] +sortedHoods = [] +sortedHoodsPop = [] + +kChronicleVarType = 0 # not currently used + +boolNewHoodDlg = 0 +boolGUIActivated = 0 + +fullNeighborhoodName = U"" # the full name for our neighborhood (because we truncate long names) +fullLinkName = [] # the full text for each of our displayed links (because we truncate long names) +untranslatedNeighborhoodName = U"" +untranslatedName = [] # the untranslated form of the title (needed in some cases to find a linking panel or link node) + +oldStatusBarText = U"" # when we mouse over and display the expanded text, we want to know what we had here last + +maxCityPopulation = -1 # what is the maximum city population? +maxPubPopulation = -1 # what is the maximum pub population? +maxKirelPopulation = -1 # what is the maximum kirel population? +maxGuildPubPopulation = -1 # what is the maximum GuildPub population? +maxKveerPublicPopulation = -1 # what is the maximum public Kveer population? +showCityLinks = 1 # do we show city links other then the Ferry Terminal? +showGreatZero = 0 # do we show the great zero under our city links? +showPub = 0 # do we show the watcher's pub under our city links? +showKirel = 0 # do we show kirel under our city links? +showGuildPub = 0 # do we show one of the guild-pubs under our city links? +showKveerPublic = 0 # do we show the public Kveer under our city links? + +# hood sorting vars +kSortNone = 0 +kSortNameAsc = 1 +kSortNameDesc = 2 +kSortPopAsc = 3 +kSortPopDesc = 4 +publicHoodSort = kSortNone +showEnglishHoods = 1 # we default to showing all languages +showFrenchHoods = 1 +showGermanHoods = 1 + +# these vars help us know what "city" links go to the city, the pub, or a child age (order is city->pub->children in the list) +numCityLinks = 0 # the number of links in the city we have +numPubLinks = 0 # the number of links to the pub we have +numKirelLinks = 0 # the number of links to kirel we have +numGuildPubLinks = 0 # the number of links to the GuildPubs we have +numKveerPublicLinks = 0 # the number of links to the public Kveer we have + +childAgeLinkNodes = [] # the array of link nodes to the hood child ages + +# this var helps us know what "personal" links go to the GZ, or your personal ages (order is GZ->personal in the list) +numGZLinks = 0 # the number of links to the great zero that we have +GZLinkNode = None # the link node to the Great Zero (if we have one) +GZSpawnpoints = [] # the GZ spawnpoints that are displayed + +IsVisitorPlayer = true #whether or not the player is a visitor + +def Uni(string): + "Converts a string to unicode, using latin-1 encoding if necessary" + try: + retVal = unicode(string) + return retVal + except: + retVal = unicode(string,"latin-1") + return retVal + +class nxusBookMachine(ptModifier): + "The Nexus python code" + def __init__(self): + global IsVisitorPlayer + ptModifier.__init__(self) + self.id = 5017 + version = 5 + self.version = version + print "__init__nxusBookMachine v.", version + + #Init visitor support + IsVisitorPlayer = not PtIsSubscriptionActive() + PtLoadDialog(xVisitorUtils.kVisitorNagDialog) + + + def OnFirstUpdate(self): + "First update, load GUI dialog, give player PAL to Nexus" + PtLoadDialog(kNexusDialogName, self.key, "Nexus") + + # move objects to correct starting position just in case + respKISlotReturn.run(self.key,fastforward=1) + respBookRetract.run(self.key,fastforward=1) + respButtonPress.run(self.key,fastforward=1) + + # hide all the linking panels in the machine - will draw appropriate when selected + for objPanel in objlistLinkPanels.value: + #print "hiding link panel: ",objPanel.getName() + objPanel.draw.disable() + + + def OnServerInitComplete(self): + global maxCityPopulation + global maxPubPopulation + global maxKirelPopulation + global maxGuildPubPopulation + global maxKveerPublicPopulation + global showCityLinks + global showGreatZero + global showPub + global showKirel + global showGuildPub + #global guildPubInstance + global guildPubPopulation + global showKveerPublic + #global kveerPublicInstance + global kveerPublicPopulation + + + ageSDL = PtGetAgeSDL() + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing max city population") + try: + maxCityPopulation = ageSDL["MaxCityPop"][0] + except: + PtDebugPrint("Unable to get max city population from SDL, defaulting to 20") + maxCityPopulation = 20 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing max pub population") + try: + maxPubPopulation = ageSDL["MaxPubPop"][0] + except: + PtDebugPrint("Unable to get max pub population from SDL, defaulting to 100") + maxPubPopulation = 100 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing max kirel population") + try: + maxKirelPopulation = ageSDL["MaxKirelPop"][0] + except: + PtDebugPrint("Unable to get max kirel population from SDL, defaulting to 100") + maxKirelPopulation = 100 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing max GuildPub population") + try: + maxGuildPubPopulation = ageSDL["MaxGuildPubPop"][0] + except: + PtDebugPrint("Unable to get max GuildPub population from SDL, defaulting to 100") + maxGuildPubPopulation = 100 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing max public Kveer population") + try: + maxKveerPublicPopulation = ageSDL["MaxKveerPublicPop"][0] + except: + PtDebugPrint("Unable to get max public Kveer population from SDL, defaulting to 100") + maxKveerPublicPopulation = 100 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing the show city links toggle") + try: + showCityLinks = ageSDL["nxusCityLinksVis"][0] + except: + PtDebugPrint("Unable to get show city links toggle from SDL, defaulting to true") + showCityLinks = 1 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing the show great zero toggle") + try: + showGreatZero = ageSDL["nxusShowGZ"][0] + except: + PtDebugPrint("Unable to get show great zero toggle from SDL, defaulting to false") + showGreatZero = 0 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing the show pub toggle") + try: + showPub = ageSDL["nxusShowPub"][0] + except: + PtDebugPrint("Unable to get show pub toggle from SDL, defaulting to false") + showPub = 0 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing the show Kirel toggle") + try: + showKirel = ageSDL["nxusShowKirel"][0] + except: + PtDebugPrint("Unable to get show kirel toggle from SDL, defaulting to false") + showKirel = 0 + + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing the show GuildPub var") + try: + psnlSDL = xPsnlVaultSDL() + showGuildPub = psnlSDL["guildAlliance"][0] + PtDebugPrint("'guildAlliance' SDL = %d" % (showGuildPub)) + except: + PtDebugPrint("Unable to get show GuildPub toggle from SDL, defaulting to false") + showGuildPub = 0 + if showGuildPub: + guild = guildPubs[showGuildPub-1] + PtDebugPrint("nxusBookMachine.OnServerInitComplete() - member of guild: %s" % (guild)) + + vault = ptVault() + entry = vault.findChronicleEntry("GotLinkToKveerPublic") + if type(entry) != type(None): + entryValue = entry.chronicleGetValue() + if entryValue == "yes": + print "nxusBookMachine.OnServerInitComplete(): chron says you have the link to public Kveer, woo hoo" + showKveerPublic = 1 + else: + print "nxusBookMachine.OnServerInitComplete(): chron says no link to public Kveer yet, so sorry" + + + def __del__(self): + "destructor - get rid of any dialogs that we might have loaded" + PtUnloadDialog(kNexusDialogName) + PtUnloadDialog(xVisitorUtils.kVisitorNagDialog) + + def ICanCreateHood(self): + hoodLink = self.IGetHoodLinkNode() + if not hoodLink.getVolatile(): + return 0 # only let the player create a new hood if their book is volatile + if PtIsInternalRelease(): + return 1 # we don't have the 1 day limitation on internal clients + vault = ptVault() + entry = vault.findChronicleEntry("LastHoodCreationTime") + if type(entry) == type(None): + return 1 # we haven't created a hood before, so let them! + + temp = float(entry.chronicleGetValue()) + lastTime = time.gmtime(temp) + temp = PtGetDniTime() + curTime = time.gmtime(temp) + + # compare years + if lastTime[0] < curTime[0]: + return 1 + if lastTime[0] == curTime[0]: # same year + # compare months + if lastTime[1] < curTime[1]: + return 1 + if lastTime[1] == curTime[1]: # same month + # compare days + if lastTime[2] < curTime[2]: + return 1 + # less then a day has passed (or we went backwards in time), so don't let them create a new hood! + return 0 + + def gotPublicAgeList(self,ages): + global cityInstances + global cityPopulations + global curCityInstance + global publicHoods + global publicHoodsPop + global pubInstance + global pubPopulation + global kirelInstance + global kirelPopulation + + if len(ages) == 0: + PtDebugPrint("nxusBookMachine.gotPublicAgeList() - got an empty list, which we assume are hoods, clearing hood list") + # there should always be city instances, so if we "get" an empty list, assume we wanted a hood list + publicHoods = [] + publicHoodsPop = [] + self.IUpdateLinks() + return + + if ages[0][0].getAgeFilename() == "city": + PtDebugPrint("nxusBookMachine.gotPublicAgeList() - got the list of cities") + cityInstances = [] + cityPopulations = [] + for age in ages: + cityInstances.append(age[0]) + cityPopulations.append(age[1]) + # we're going to sort by sequence number so we always have the same order + for i in range(0,len(cityInstances)-1): + for j in range(i+1,len(cityInstances)): + if cityInstances[i].getAgeSequenceNumber() > cityInstances[j].getAgeSequenceNumber(): + temp = cityInstances[i] + cityInstances[i] = cityInstances[j] + cityInstances[j] = temp + temp = cityPopulations[i] + cityPopulations[i] = cityPopulations[j] + cityPopulations[j] = temp + # now we should have a list of city instances sorted by age sequence number in ascending order + elif ages[0][0].getAgeFilename() == "Neighborhood": + PtDebugPrint("nxusBookMachine.gotPublicAgeList() - got the list of hoods") + publicHoods = [] + publicHoodsPop = [] + for age in ages: + # if the current population and number of owners is zero then don't display it + if age[2] == 0 and age[1] == 0: + continue + publicHoods.append(age[0]) + publicHoodsPop.append(age[1]) + self.ISortPublicHoods() + elif ages[0][0].getAgeFilename() == "GreatTreePub": + PtDebugPrint("nxusBookMachine.gotPublicAgeList() - got the pub") + # we only have one pub instance + pubInstance = ages[0][0] + pubPopulation = ages[0][1] + + elif ages[0][0].getAgeFilename() == "Neighborhood02": + PtDebugPrint("nxusBookMachine.gotPublicAgeList() - got kirel") + # we only have one kirel instance + kirelInstance = ages[0][0] + kirelPopulation = ages[0][1] + + if curCityInstance == -1: + self.ISyncCurCityInstanceAndVault() + + self.IUpdateLinks() + + def publicAgeCreated(self,ageName): + PtDebugPrint("publicAgeCreated: " + ageName); + PtGetPublicAgeList(ageName, self); + + def publicAgeRemoved(self,ageName): + PtDebugPrint("publicAgeRemoved: " + ageName); + PtGetPublicAgeList(ageName, self); + + def ISwapPublicHoods(self,index1,index2): + global publicHoods + global publicHoodsPop + + hoodTemp = publicHoods[index1] + popTemp = publicHoodsPop[index1] + publicHoods[index1] = publicHoods[index2] + publicHoodsPop[index1] = publicHoodsPop[index2] + publicHoods[index2] = hoodTemp + publicHoodsPop[index2] = popTemp + + def ISortPublicHoods(self): + global publicHoods + global publicHoodsPop + global sortedHoods + global sortedHoodsPop + + sortedHoods = [] + sortedHoodsPop = [] + + if publicHoodSort == kSortNone and showEnglishHoods and showFrenchHoods and showGermanHoods: + sortedHoods = publicHoods + sortedHoodsPop = publicHoodsPop + return + if publicHoodSort == kSortNameAsc or publicHoodSort == kSortNameDesc: + for i in range(len(publicHoods)-1): + for j in range(i+1,len(publicHoods)): + if publicHoodSort == kSortNameAsc and publicHoods[i].getDisplayName() > publicHoods[j].getDisplayName(): + self.ISwapPublicHoods(i,j) + elif publicHoodSort == kSortNameDesc and publicHoods[i].getDisplayName() < publicHoods[j].getDisplayName(): + self.ISwapPublicHoods(i,j) + elif publicHoodSort == kSortPopAsc or publicHoodSort == kSortPopDesc: + for i in range(len(publicHoods)-1): + for j in range(i+1,len(publicHoods)): + if publicHoodSort == kSortPopAsc and publicHoodsPop[i] > publicHoodsPop[j]: + self.ISwapPublicHoods(i,j) + elif publicHoodSort == kSortPopDesc and publicHoodsPop[i] < publicHoodsPop[j]: + self.ISwapPublicHoods(i,j) + # now to copy the hoods in the languages we want to the sorted list + # if the language is not English, French, or German, we assume it is English and treat it as such + for i in range(len(publicHoods)): + hoodLanguage = publicHoods[i].getAgeLanguage() + if hoodLanguage == PtLanguage.kFrench and showFrenchHoods: + sortedHoods.append(publicHoods[i]) + sortedHoodsPop.append(publicHoodsPop[i]) + elif hoodLanguage == PtLanguage.kGerman and showGermanHoods: + sortedHoods.append(publicHoods[i]) + sortedHoodsPop.append(publicHoodsPop[i]) + elif not (hoodLanguage == PtLanguage.kFrench or hoodLanguage == PtLanguage.kGerman) and showEnglishHoods: + sortedHoods.append(publicHoods[i]) + sortedHoodsPop.append(publicHoodsPop[i]) + + def IGetHoodLinkNode(self): + vault = ptVault() + folder = vault.getAgesIOwnFolder() + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if type(link) != type(None): + info = link.getAgeInfo() + if not info: continue + ageName = info.getAgeFilename() + if ageName == "Neighborhood": + return link + return None + + def IGetHoodInfoNode(self): + link = self.IGetHoodLinkNode() + if type(link) == type(None): + return None + info = link.getAgeInfo() + return info + + def IGetGZLinkNode(self): + childAgeFolder = self.IGetHoodInfoNode().getChildAgesFolder() + contents = childAgeFolder.getChildNodeRefList() + childAgeLinkNodes = [] + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + name = link.getAgeInfo().getAgeFilename() + if name.lower() == "greatzero": + return link + return None # not found + + def IGetGZInfoNode(self): + link = self.IGetGZLinkNode() + if type(link) == type(None): + return None + info = link.getAgeInfo() + return info + + def IIsMyHoodPublic(self): + global publicHoods + infoNode = self.IGetHoodInfoNode() + return infoNode.isPublic() + + def IMakeHoodPublic(self): + hoodInfo = self.IGetHoodInfoNode() + if type(hoodInfo) != type(None): + infoStruct = hoodInfo.asAgeInfoStruct() + PtCreatePublicAge(infoStruct,self) + + def IMakeHoodPrivate(self): + hoodInfo = self.IGetHoodInfoNode() + if type(hoodInfo) != type(None): + guid = hoodInfo.getAgeInstanceGuid() + PtRemovePublicAge(guid,self) + + def OnVaultNotify(self,event,tupdata): + global boolBookPresented + global boolGetBookAfterBookRetract + global idCategorySelected + global idBookPresented + global actLink + global respBookRetract + global boolGetBookBtnUp + + if event==PtVaultNotifyTypes.kRegisteredOwnedAge: + ageLinkNode = tupdata[0] # should be a ptVaultAgeLinkNode + ageInfo = ageLinkNode.getAgeInfo() # ptAgeInfoNode + ageFilename = ageInfo.getAgeFilename() + if (ageFilename == "Neighborhood"): + PtDebugPrint( "OnVaultNotify: A new neighborhood was created! Time to scramble...I mean randomize the SDL!" ) + self.IRandomizeNeighborhood(ageInfo) + PtDebugPrint( "OnVaultNotify: Setting the new hood's language to "+str(PtGetLanguage()) ) + ageInfo.setAgeLanguage(PtGetLanguage()) + # save our creation time to the vault to prevent people from making too many hoods + vault = ptVault() + entry = vault.findChronicleEntry("LastHoodCreationTime") + if type(entry) == type(None): + # not found... add current level chronicle + vault.addChronicleEntry("LastHoodCreationTime",kChronicleVarType,str(PtGetDniTime())) + else: + entry.chronicleSetValue(str(PtGetDniTime())) + entry.save() + + elif event==PtVaultNotifyTypes.kUnRegisteredOwnedAge or event==PtVaultNotifyTypes.kUnRegisteredVisitAge: + self.IUpdateLinks() + PtDebugPrint( "OnVaultNotify: A link was deleted, checking if we need to retract the book" ) + try: + clickedLinkName = ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag( idBookPresented+1 )).getString() + except: + clickedLinkName = None + + if boolBookPresented and not clickedLinkName: # retract book if the book we were showing was the one deleted + PtDebugPrint( "OnVaultNotify: The currently displayed link was deleted, retracting book" ) + actLink.disable() + idBookPresented = 0 + respBookRetract.run(self.key) + boolBookPresented = false + boolGetBookAfterBookRetract = false + + if boolGetBookBtnUp: + respButtonPress.run(self.key) + boolGetBookBtnUp = false + self.IDisableGUIButtons() # reenable when button is done animating + + elif event == PtVaultNotifyTypes.kPublicAgeCreated: + ageName = tupdata[0]; + self.publicAgeCreated(ageName); + + elif event == PtVaultNotifyTypes.kPublicAgeRemoved: + ageName = tupdata[0]; + self.publicAgeRemoved(ageName); + + def OnVaultEvent(self,event,tupdata): + if event == PtVaultCallbackTypes.kVaultNodeSaved: + PtDebugPrint("nxuxBookMachine: kVaultNodeSaved event (id=%d,type=%d)" % (tupdata[0].getID(),tupdata[0].getType()),level=kDebugDumpLevel) + # tupdata is ( ptVaultNode ) + if tupdata[0].getType() == PtVaultNodeTypes.kAgeInfoNode: + if self.IGetHoodInfoNode().getID() == tupdata[0].getID(): + self.IUpdateLinks() + + def IRandomizeNeighborhood(self,ageInfoNode): + childRefList = ageInfoNode.getChildNodeRefList() + for childRef in childRefList: + child = childRef.getChild() + if child.getType() == PtVaultNodeTypes.kSDLNode: + sdl = child.upcastToSDLNode() + dataRecord = sdl.getStateDataRecord() + nameList = dataRecord.getVarList() + for name in nameList: + # are we supposed to randomize this var? + if (name in kRandomizeVars): + var = dataRecord.findVar(name) + if var.getType() == PtSDLVarType.kBool: # there are only bool values right now + if whrandom.random() >= 0.5: + PtDebugPrint( 'IRandomizeNeighborhood: Setting var "' + name + '" to true' ) + var.setBool(1) + else: + PtDebugPrint( 'IRandomizeNeighborhood: Setting var "' + name + '" to false' ) + var.setBool(0) + else: + PtDebugPrint( 'IRandomizeNeighborhood: Var "' + name + '" has an unknown type! Not randomizing' ) + elif (name in kVarRestrictions): + var = dataRecord.findVar(name) + value = int(whrandom.random() * len(kVarRestrictions[name])) + if (var.getType() == PtSDLVarType.kInt) or (var.getType() == PtSDLVarType.kByte): + PtDebugPrint( 'IRandomizeNeighborhood: Setting var "' + name + '" to ' + str(kVarRestrictions[name][value]) ) + var.setInt(kVarRestrictions[name][value]) + else: + PtDebugPrint( 'IRandomizeNeighborhood: Var "' + name + '" has an unknown type: '+str(var.getType())+' Not randomizing' ) + sdl.setStateDataRecord(dataRecord) + sdl.saveAll() + return; + + def OnTimer(self, id): + if id == 99: + PtFadeLocalAvatar(1) + + def OnNotify(self,state,id,events): + "main non-GUI message handler" + global avatar + global waitingOnGUIAnim + global idLinkSelected + global idBookPresented + global boolGetBookBtnUp + global boolGetBookAfterBtnPress + global boolBookPresented + global boolGetBookAfterBookRetract + global boolLinking + global boolGettingBook + global boolNewHoodDlg + global boolGUIActivated + + if type(avatar) == type(None): + PtDebugPrint("OnNotify: Initing avatar with PtGetLocalAvatar()") + avatar = PtGetLocalAvatar() + + if id==(-1): + # callback from delete yes/no dialog (hopefully) + if boolNewHoodDlg: # user wants to create a new hood + boolNewHoodDlg = 0 + if state: # user answered yes + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodCreate)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodCreate)).disable() + link = self.IGetHoodLinkNode() + if link: + link.setVolatile(1) # mark it volatile, but DON'T SAVE (we don't want the server to know, just the client) + ptVault().createNeighborhood() + else: # user wants to delete a link + if state: + self.IDeleteLink() + return + + # in no other cases do we want to take action on state = 0 events + if not state: + return + + ################## + # Engage Machine Interface # + ################## + + # click on KI Slot...insert hand, light slot, remove hand, notify triggerer and move KI slot + if id==actKISlot.id: + avatar = PtFindAvatar(events) + kiLevel = PtDetermineKILevel() + print "nxusBookMachine.OnNotify:\tplayer ki level is",kiLevel + if kiLevel < kNormalKI: + respKISlot.run(self.key,events=events) + else: + PtGetPublicAgeList('city',self) + PtGetPublicAgeList('GreatTreePub',self) + PtGetPublicAgeList('Neighborhood02',self) + PtGetPublicAgeList('Neighborhood',self) + + # set up the camera so when the one shot returns it gets set up right (one shot was fighting with python for camera control) + virtCam = ptCamera() + virtCam.undoFirstPerson() + virtCam.disableFirstPersonOverride() + respKISlotGlow.run(self.key,events=events) + return + # KI slot activated...switch to machine ops cam, fix player in idle behavior, show GUI + if id==respKISlotGlow.id: + behMachineOps.run(avatar) + virtCam = ptCamera() + virtCam.save(camMachineOps.sceneobject.getKey()) + avatar.draw.disable() + #PtFadeLocalAvatar(1) + #PtAtTimeCallback(self.key, 1, 99) + if ( PtIsDialogLoaded(kNexusDialogName) ): + NexusGUI.dialog.show() + respGUIOn.run(self.key) + waitingOnGUIAnim = true + PtEnableControlKeyEvents(self.key) + PtSendKIMessage(kDisableKIandBB,0) + if id==respGUIOn.id: + waitingOnGUIAnim = false + boolGUIActivated = 1 + + ################## + # Exit Machine Interface # + ################## + + # catch callback from shut down GUI anim responder run by OnControlKeyEvent() + if id==respGUIOff.id: + boolGUIActivated = 0 + NexusGUI.dialog.hide() + virtCam = ptCamera() + virtCam.restore(camMachineOps.sceneobject.getKey()) + virtCam.enableFirstPersonOverride() + avatar.draw.enable() + #PtFadeLocalAvatar(0) + behMachineOps.gotoStage(avatar,-1) # exit behavior + PtDisableControlKeyEvents(self.key) + PtSendKIMessage(kEnableKIandBB,0) + respKISlotReturn.run(self.key) + if boolBookPresented: + respBookRetract.run(self.key) + actLink.disable() + boolBookPresented = false + boolGetBookAfterBookRetract = false + if boolGetBookBtnUp: + boolGetBookAfterBtnPress = false + respButtonPress.run(self.key) + boolGetBookBtnUp = false + if idLinkSelected: + idLinkSelected = 0 + self.IUpdateLinks() + if idBookPresented: + idBookPresented = 0 + self.IUpdateLinks() + return + + ################## + # Machine Operations # + ################## + + if id==actGetBook.id: + boolGettingBook = true + + #depress the button + respButtonPress.run(self.key) + boolGetBookBtnUp = false + + linkName = self.IGetUntranslatedName(idLinkSelected+1) + if linkName == "": # this shouldn't happen, but just in case, we won't grab the book + boolGetBookAfterBtnPress = false + boolGetBookAfterBookRetract = false + idLinkSelected = 0 + idBookPresented = 0 + self.IUpdateLinks() + self.IDisableGUIButtons() + return + + # determine next action + if idBookPresented: + boolGetBookAfterBtnPress = false + boolGetBookAfterBookRetract = true + else: + boolGetBookAfterBtnPress = true + boolGetBookAfterBookRetract = false + + idBookPresented = idLinkSelected + print "idBookPresented = ",idBookPresented + idLinkSelected = 0 + self.IUpdateLinks() + + # disable GUI Ops until Get Book Operations completed + self.IDisableGUIButtons() + return + if id==respButtonPress.id: + if boolGetBookAfterBtnPress: + respGetBook.run(self.key) + self.IDrawLinkPanel() + boolBookPresented = true + elif boolGetBookAfterBookRetract: + respBookRetract.run(self.key) + actLink.disable() + else: + self.IUpdateLinks() # reenable GUI buttons now that button is done animating + return + if id==respBookRetract.id and boolGetBookAfterBookRetract: + respGetBook.run(self.key) + self.IDrawLinkPanel() + boolBookPresented = true + return + if id==respGetBook.id: + # reenable GUI buttons + self.IUpdateLinks() + actLink.enable() + boolGettingBook = false + return + + if id==respBookSelect.id: + self.IUpdateLinks() # reenable GUI buttons now that getBookBtn is done animating + + ################## + # Link Me # + ################## + + if id==actLink.id: + if idBookPresented == 0: + PtDebugPrint("Ignoring link clickable since no book is shown") + return + respGUIOff.run(self.key) + boolLinking = true + actGetBook.disable() + self.IDisableGUIButtons() + respGUIOff.run(self.key) + self.ILink() + return + if id==respLink.id: + return + + + ################## + # Exit Machine Interface # + ################## + + def OnControlKeyEvent(self,controlKey,activeFlag): + "exit machine op mode" + global boolGUIActivated + if controlKey == PlasmaControlKeys.kKeyExitMode: + if not boolGettingBook and boolGUIActivated: + actGetBook.disable() + self.IDisableGUIButtons() + respGUIOff.run(self.key) + return + elif controlKey == PlasmaControlKeys.kKeyMoveBackward or controlKey == PlasmaControlKeys.kKeyRotateLeft or controlKey == PlasmaControlKeys.kKeyRotateRight: + if not boolGettingBook and boolGUIActivated: + actGetBook.disable() + self.IDisableGUIButtons() + respGUIOff.run(self.key) + return + + ############## + # Handle GUI Clicks # + ############## + + def OnGUINotify(self,id,control,event): + "Events from the Nexus GUI.." + global idLinkSelected + global boolGetBookBtnUp + global idDeleteCandidateName + global boolBookPresented + global boolGetBookAfterBookRetract + global idBookPresented + global idCategorySelected + global boolGetBookAfterBtnPress + global indexDisplayStart + global dialogLoaded + global curCityInstance + global boolNewHoodDlg + global oldStatusBarText + global publicHoodSort + global showEnglishHoods + global showFrenchHoods + global showGermanHoods + global IsVisitorPlayer + + if id!=NexusGUI.id: + print "nxusBookMachine.OnGUINotify():\tunexpected message id" + return + + ################## + # Init Machine GUI # + ################## + + if event == kDialogLoaded: + dialogLoaded = 1 + return + + if event == kShowHide: + #print "dialog loaded...initializing with player's KI info" + dialogLoaded = 1 + self.IUpdateLinks() + return + + + if event == kAction: + ctrlID = control.getTagID() + print "you clicked on control ID:",ctrlID + print "Pre Category: %i, Pre link: %i" %(idCategorySelected,idLinkSelected) + + ################## + # Link Select Buttons # + ################## + + if ( ctrlID >= kIDBtnLinkSelect01 and ctrlID <= kIDBtnLinkSelect08 ) or ( ctrlID == kIDBtnNeighborhoodSelect ): + #Prevent visitors from visiting the city... + if IsVisitorPlayer and idCategorySelected == kIDBtnLinkCategory01 and ctrlID != kIDBtnNeighborhoodSelect: + PtDebugPrint ("nxusBookMachine.OnGUINotify()-->Visitors do not have access to the city") + PtShowDialog(xVisitorUtils.kVisitorNagDialog) + return + + + if idBookPresented: + actLink.disable() + idBookPresented = 0 + respBookRetract.run(self.key) + boolBookPresented = false + boolGetBookAfterBookRetract = false + + idLinkSelected = ctrlID + self.IUpdateLinks() + + if not boolGetBookBtnUp: + respBookSelect.run(self.key) + boolGetBookBtnUp = true + self.IDisableGUIButtons() # reenable when button is done animating + return + + + ################## + # Delete Link Buttons # + ################## + + if ctrlID >= kIDBtnDeleteLink01 and ctrlID <= kIDBtnDeleteLink08: + idDeleteCandidateName = ctrlID - 99 + ageName = self.IGetFullName(idDeleteCandidateName) + stringConfirm = PtGetLocalizedString("Nexus.Messages.LinkDelete", [ageName]) + boolNewHoodDlg = 0 + PtYesNoDialog(self.key,stringConfirm) + return + + ################## + # Category Select Buttons # + ################## + + if ctrlID >= kIDBtnLinkCategory01 and ctrlID <= kIDBtnLinkCategory04: + #Visitors do not have access to private ages, make sure to show the nag dialog + if IsVisitorPlayer and ctrlID == kIDBtnLinkCategory02: + PtDebugPrint ("nxusBookMachine.OnGUINotify()-->Visitors do not have access to private ages") + PtShowDialog(xVisitorUtils.kVisitorNagDialog) + return + + + # defensive coding vs. button mashers + if idLinkSelected != kIDBtnNeighborhoodSelect: + actLink.disable() + + indexDisplayStart = 0 # reset scrolling + + idCategorySelected = ctrlID + idLinkSelected = 0 + if boolGetBookBtnUp and idLinkSelected != kIDBtnNeighborhoodSelect: + respButtonPress.run(self.key) + self.IDisableGUIButtons() # disable while button animates + boolGetBookBtnUp = false + boolGetBookAfterBtnPress = false + return # update links (enable GUI) after button animates + if idBookPresented and idBookPresented != kIDBtnNeighborhoodSelect: + respBookRetract.run(self.key) + boolBookPresented = false + boolGetBookAfterBookRetract = false + idBookPresented = 0 + self.IUpdateLinks() + return + + ############# + # Scroll Buttons # + ############# + + if ctrlID == kIDBtnScrollUp and indexDisplayStart > 0: + indexDisplayStart = indexDisplayStart - 1 + if idLinkSelected >= kIDBtnLinkSelect01 and idLinkSelected <= kIDBtnLinkSelect08: + idLinkSelected = idLinkSelected + 10 + if idLinkSelected > ( kIDBtnLinkSelect01 + ( kNumDisplayFields - 1 ) * 10 ): # selected link scrolled off screen + idLinkSelected = 0 + if boolGetBookBtnUp: + respButtonPress.run(self.key) + self.IDisableGUIButtons() # disable while button animates + boolGetBookBtnUp = false + boolGetBookAfterBtnPress = false + if idBookPresented >= kIDBtnLinkSelect01 and idBookPresented <= kIDBtnLinkSelect08: + idBookPresented = idBookPresented + 10 + if idBookPresented > ( kIDBtnLinkSelect01 + ( kNumDisplayFields - 1 ) * 10 ): # presented book scrolled off screen + boolBookPresented = false + boolGetBookAfterBookRetract = false + idBookPresented = 0 + respBookRetract.run(self.key) + self.IUpdateLinks() + return + + if ctrlID == kIDBtnScrollDn: + indexDisplayStart = indexDisplayStart + 1 + if idLinkSelected >= kIDBtnLinkSelect01 and idLinkSelected <= kIDBtnLinkSelect08: + idLinkSelected = idLinkSelected - 10 + if idLinkSelected < kIDBtnLinkSelect01: # selected link scrolled off screen + idLinkSelected = 0 + if boolGetBookBtnUp: + respButtonPress.run(self.key) + self.IDisableGUIButtons() # disable while button animates + boolGetBookBtnUp = false + boolGetBookAfterBtnPress = false + if idBookPresented >= kIDBtnLinkSelect01 and idBookPresented <= kIDBtnLinkSelect08: + idBookPresented = idBookPresented - 10 + print idBookPresented + if idBookPresented < kIDBtnLinkSelect01: # presented book scrolled off screen + boolBookPresented = false + boolGetBookAfterBookRetract = false + idBookPresented = 0 + respBookRetract.run(self.key) + self.IUpdateLinks() + return + + ############# + # Create a Hood # + ############# + + if ctrlID == kIDBtnNeighborhoodCreate: + #Only Explorers can create Neighborhoods + if not PtIsSubscriptionActive(): + PtShowDialog(xVisitorUtils.kVisitorNagDialog) + return + + boolNewHoodDlg = 1 + PtYesNoDialog(self.key,PtGetLocalizedString("Nexus.Messages.HoodCreate")) + return + + if ctrlID == kIDBtnNeighborhoodPublic: + if self.IIsMyHoodPublic(): + self.IMakeHoodPrivate() + else: + self.IMakeHoodPublic() + # IUpdateLinks should be called automatically when the public age list updates + return + + ############# + # Header sort buttons # + ############# + + if ctrlID == kIDNameHeaderBtn or ctrlID == kIDNameAscArrow or ctrlID == kIDNameDescArrow: + if publicHoodSort == kSortNameAsc: + publicHoodSort = kSortNameDesc + else: + publicHoodSort = kSortNameAsc + self.ISortPublicHoods() + self.IUpdateLinks() + + if ctrlID == kIDPopHeaderBtn or ctrlID == kIDPopAscArrow or ctrlID == kIDPopDescArrow: + if publicHoodSort == kSortPopAsc: + publicHoodSort = kSortPopDesc + else: + publicHoodSort = kSortPopAsc + self.ISortPublicHoods() + self.IUpdateLinks() + + ############# + # Language checkboxes # + ############# + + if ctrlID == kIDEngCheckBox or ctrlID == kIDEngCheck: + showEnglishHoods = not showEnglishHoods + self.ISortPublicHoods() + self.IUpdateLinks() + + if ctrlID == kIDFreCheckBox or ctrlID == kIDFreCheck: + showFrenchHoods = not showFrenchHoods + self.ISortPublicHoods() + self.IUpdateLinks() + + if ctrlID == kIDGerCheckBox or ctrlID == kIDGerCheck: + showGermanHoods = not showGermanHoods + self.ISortPublicHoods() + self.IUpdateLinks() + + if event == kInterestingEvent: + if type(control) != type(None): + if control.isInteresting(): + oldStatusBarText = ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).getStringW() + if self.IGetFullName(control.getTagID()) == "Garrison": + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW("Gahreesen") + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW(self.IGetFullName(control.getTagID())) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW(oldStatusBarText) + oldStatusBarText = U"" + + def IUpdateLinks(self): + global fullNeighborhoodName + global fullLinkName + global untranslatedNeighborhoodName + global untranslatedName + global numGZLinks + global GZLinkNode + global GZSpawnpoints + + ###################### + ## + ## initialize the GUI + ## + ###################### + + if not dialogLoaded: + return + + fullLinkName = [] + untranslatedName = [] + self.IDisableGUIButtons() + + # set category names + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkCategory01)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkCategory02)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkCategory03)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkCategory04)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idCategorySelected+1)).setForeColor(colorSelected) + + # clear header titles and disable their buttons + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDNameHeaderText)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDPopHeaderText)).setString("") + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameHeaderBtn)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopHeaderBtn)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameAscArrow)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameDescArrow)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopAscArrow)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopDescArrow)).hide() + + # hide the checkboxes + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDEngText)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDFreText)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDGerText)).setString("") + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDEngCheckBox)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDFreCheckBox)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDGerCheckBox)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDEngCheck)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDFreCheck)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDGerCheck)).hide() + + # enable/disable category selection buttons + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkCategory01)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkCategory02)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkCategory03)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkCategory04)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idCategorySelected)).disable() + # clear link names - fill in below + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkName01)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkName02)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkName03)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkName04)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkName05)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkName06)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkName07)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkName08)).setString("") + # clear link info - fill in below + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo01)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo02)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo03)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo04)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo05)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo06)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo07)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo08)).setString("") + + # disable interesting notify if we are showing city links or instances + if idCategorySelected == kIDBtnLinkCategory01: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect01)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect02)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect03)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect04)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect05)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect06)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect07)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect08)).setNotifyOnInteresting(0) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect01)).setNotifyOnInteresting(1) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect02)).setNotifyOnInteresting(1) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect03)).setNotifyOnInteresting(1) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect04)).setNotifyOnInteresting(1) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect05)).setNotifyOnInteresting(1) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect06)).setNotifyOnInteresting(1) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect07)).setNotifyOnInteresting(1) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect08)).setNotifyOnInteresting(1) + + # hide delete buttons - show/enable below + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink01)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink02)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink03)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink04)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink05)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink06)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink07)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink08)).hide() + # hide scroll buttons - show/enable below + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollDn)).hide() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollUp)).hide() + # hide create hood button + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodCreate)).hide() + + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodPublic)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodPublic)).hide() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodPublic)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodSelect)).setNotifyOnInteresting(1) + + + ###################### + ## + ## my neighborhood button + ## + ###################### + + # set color of name and info + if idBookPresented == kIDBtnNeighborhoodSelect: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodName)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodInfo)).setForeColor(colorPresented) + else: + if idLinkSelected == kIDBtnNeighborhoodSelect: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodName)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodInfo)).setForeColor(colorSelected) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodName)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodInfo)).setForeColor(colorNormal) + + # write my hood name, info (coords) and description...enable/disable selection button + vault = ptVault() + if type(vault) == type(None): + PtDebugPrint("nxusBookMachine.IUpdateLinks:\tplayer vault type None") + return + hoodFound = 0 + PAL = vault.getAgesIOwnFolder() + PtAssert( PAL, "vault.getAgesIOwnFolder return bad" ) + contents = PAL.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if type(link) != type(None): + info = link.getAgeInfo() + else: + link = content.getChild() + info = link.upcastToAgeInfoNode() + if not info: continue + ageName = info.getAgeFilename() + if ageName == "Neighborhood": + hoodFound = 1 + if self.ICanCreateHood(): + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodCreate)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodCreate)).enable() + + hoodLink = self.IGetHoodLinkNode() + if not hoodLink.getVolatile(): + # if the hood link is not volatile, then they can go + untranslatedNeighborhoodName = Uni(info.getDisplayName()) + stringHoodName = xLocTools.LocalizeAgeName(info.getDisplayName()) + fullNeighborhoodName = stringHoodName + if len(stringHoodName) > kMaxDisplayableChars: + stringHoodName = stringHoodName[:kMaxDisplayableChars] + U"..." + dniCoords = link.getCreateAgeCoords() + try: + stringHoodInfo = U"%05d% 04d% 04d" %(dniCoords.GetTorans(),dniCoords.getHSpans(),dniCoords.getVSpans()) + except: + stringHoodInfo = U"%05d% 04d% 04d" %(0,0,0) + stringHoodDesc = Uni(info.getAgeDescription()) + if idBookPresented == kIDBtnNeighborhoodSelect: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodSelect)).disable() + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodSelect)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodPublic)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodPublic)).show() + if self.IIsMyHoodPublic(): + stringHoodPubPriv = PtGetLocalizedString("Nexus.Neighborhood.MakePrivate") + else: + stringHoodPubPriv = PtGetLocalizedString("Nexus.Neighborhood.MakePublic") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodName)).setStringW(stringHoodName) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodInfo)).setStringW(stringHoodInfo) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW(stringHoodDesc) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodPublic)).setStringW(stringHoodPubPriv) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodName)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodInfo)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setString("") + + if not hoodFound: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodCreate)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodCreate)).enable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodName)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodInfo)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setString("") + + if not ( idLinkSelected == kIDBtnNeighborhoodSelect or idBookPresented == kIDBtnNeighborhoodSelect ): + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setString("") + + ###################### + ## + ## category specific links + ## + ###################### + + # city links have become to different to handle here...giving them their own function + if idCategorySelected == kIDBtnLinkCategory01: # city links + self.IUpdateCityLinks() + return + # get appropriate list of links depending on category selected + folder = None + if idCategorySelected == kIDBtnLinkCategory02: # private links + folder = vault.getAgesICanVisitFolder() + elif idCategorySelected == kIDBtnLinkCategory03: # public links + self.IUpdatePublicHoods() + return + elif idCategorySelected == kIDBtnLinkCategory04: # personal links + folder = vault.getAgesIOwnFolder() + if type(folder) == type(None): + PtDebugPrint("nxusBookMachine.IUpdateLinks:\tlink folder type None") + return + contents = folder.getChildNodeRefList() + + GZLinkNode = None + GZSpawnpoints = [] + + # enable/disable scrolling + if indexDisplayStart > 0: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollUp)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollUp)).enable() + numLinks = len(contents) + + if idCategorySelected == kIDBtnLinkCategory02: + for content in contents[:]: # [:] makes a copy of the list, so we can modify the original + link = content.getChild() + link = link.upcastToAgeLinkNode() + name = link.getAgeInfo().getAgeFilename() + if name in kHiddenAgesIfInvited: + PtDebugPrint("Removing link for " + name + " since it can't be used as an invite") + contents.remove(content) + numLinks -= 1 + continue + + if idCategorySelected == kIDBtnLinkCategory04: # filter out links that we don't have the default spawn point for + for content in contents[:]: # [:] makes a copy of the list, so we can modify the original + link = content.getChild() + link = link.upcastToAgeLinkNode() + name = link.getAgeInfo().getAgeFilename() + if (name in kHiddenPersonalAges) or (name in kHiddenAgesIfVisitor and IsVisitorPlayer): + PtDebugPrint("Removing link for " + name + " since it's in our hidden list") + contents.remove(content) + numLinks -= 1 + continue + + spawnPoints = link.getSpawnPoints() + defaultFound = false + for spawnPoint in spawnPoints: + if spawnPoint.getName().lower() == "linkinpointdefault": + defaultFound = true + break + if not defaultFound and name.lower() != "greatzero": + info = link.getAgeInfo() + PtDebugPrint("Removing link for " + name + " since you don't have the default link-in point") + contents.remove(content) # if it doesn't have the default link-in point, don't let it show + numLinks -= 1 + + # GZ is in our personal links, so update our globals + numGZLinks = 0 # reset the numGZLinks var until we can go through the spawnpoint list + GZLinkNode = self.IGetGZLinkNode() + if type(GZLinkNode) == type(None): + PtDebugPrint("nxusBookMachine.IUpdateLinks:\tCouldn't find GZ link node, preventing it from showing") + elif showGreatZero: # even if the link exists, don't show it if the vault says no + GZSpawnpoints = GZLinkNode.getSpawnPoints() + + for spawnpoint in GZSpawnpoints[:]: # [:] makes a copy of the list, so we can modify the original + title = spawnpoint.getTitle().lower() + name = spawnpoint.getName().lower() + if (title.find("default") != -1) or (name.find("default") != -1): + GZSpawnpoints.remove(spawnpoint) # we hide the default spawn point, since they don't want it showing in our list + elif PtDetermineKIMarkerLevel() <= kKIMarkerFirstLevel: + # if our KI level is too low (we didn't grab markers), don't show anything + PtDebugPrint("nxusBookMachine.IUpdateLinks:\tHiding all GZ spawn points because you haven't found the markers yet") + GZSpawnpoints.remove(spawnpoint) + else: + numGZLinks += 1 + numLinks += 1 + + # write link names, info, set appropriate text color, enable/show related delete buttons + idTextbox = kIDTxtLinkName01 + index = -1 + + # if we are showing personal links, tack the GZ on first + if (idCategorySelected == kIDBtnLinkCategory04) and (numGZLinks > 0): # only show GZ links in the personal category + for spawnpoint in GZSpawnpoints: # already cleaned out for us, depending on a lot of state + index = index + 1 + if index < indexDisplayStart: + continue + if index > ( indexDisplayStart + kNumDisplayFields - 1 ): + break + + # setup color and clickability of the link + if idBookPresented == (idTextbox - 1): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox - 1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox + 1)).setForeColor(colorPresented) + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox - 1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox + 1)).setForeColor(colorSelected) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox + 1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(spawnpoint.getTitle())) + displayName = xLocTools.LocalizeAgeName(spawnpoint.getTitle()) + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + dniCoords = GZLinkNode.getCreateAgeCoords() + try: + stringLinkInfo = U"%05d% 04d% 04d" %(dniCoords.GetTorans(),dniCoords.getHSpans(),dniCoords.getVSpans()) + except: + stringLinkInfo = U"%05d% 04d% 04d" %(0,0,0) + + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setStringW(stringLinkInfo) + + idTextbox = idTextbox + 10 + + # now go through all the "normal" link nodes and add them to the list + for content in contents: + linkNode = content.getChild() + linkNode = linkNode.upcastToAgeLinkNode() + if type(linkNode) != type(None): + info = linkNode.getAgeInfo() + else: + # it muight be an AgeInfoNode + linkNode = content.getChild() + info = linkNode.upcastToAgeInfoNode() + if type(info) == type(None): + PtDebugPrint("nxusBookMachine: Can't find ageInfo from link",level = kErrorLevel) + numLinks -= 1 + continue + # don't display links that are set volatile + if isinstance(linkNode, ptVaultAgeLinkNode) and linkNode.getVolatile(): + numLinks -= 1 + continue + + index = index + 1 + templink = content.getChild() + templink = templink.upcastToAgeLinkNode() + tempname = templink.getAgeInfo().getAgeFilename() + + if index < indexDisplayStart: + continue + if index > ( indexDisplayStart + kNumDisplayFields - 1 ): + break + + if idBookPresented == ( idTextbox-1 ): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorPresented) + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorSelected) + if idCategorySelected == kIDBtnLinkCategory02 or idCategorySelected == kIDBtnLinkCategory03: # neighborhood links + # write hood description + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW(Uni(info.getAgeDescription())) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(info.getDisplayName())) + displayName = xLocTools.LocalizeAgeName(info.getDisplayName()) + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + + if displayName == "Garrison": + displayName = "Gahreesen" + + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + dniCoords = linkNode.getCreateAgeCoords() + try: + stringLinkInfo = U"%05d% 04d% 04d" %(dniCoords.GetTorans(),dniCoords.getHSpans(),dniCoords.getVSpans()) + except: + stringLinkInfo = U"%05d% 04d% 04d" %(0,0,0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setStringW(stringLinkInfo) + + # show/enable associated delete button + if ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).getStringW() == xLocTools.LocalizeAgeName("Ferry Terminal"): + idTextbox = idTextbox + 10 + elif idCategorySelected == kIDBtnLinkCategory03 or idCategorySelected == kIDBtnLinkCategory04: # can't delete public hoods or personal links + idTextbox = idTextbox + 10 + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox+99)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox+99)).enable() + idTextbox = idTextbox + 10 + + # update the scroll down button + print "NUMLINKS: %d" % (numLinks) + + if numLinks > ( kNumDisplayFields + indexDisplayStart ): + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollDn)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollDn)).enable() + + def IUpdatePublicHoods(self): + global publicHoods + global publicHoodsPop + global sortedHoods + global sortedHoodsPop + + # show our header sorting buttons + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDNameHeaderText)).setStringW(PtGetLocalizedString("Nexus.Headers.Name")) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDPopHeaderText)).setStringW(PtGetLocalizedString("Nexus.Headers.Population")) + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameHeaderBtn)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopHeaderBtn)).enable() + + # show the language filter checkboxes + # Disabling all language filters since we are not localizing for now + """ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDEngText)).setString("English") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDFreText)).setString("Francais") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDGerText)).setString("Deutsch") + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDEngCheckBox)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDEngCheckBox)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDFreCheckBox)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDFreCheckBox)).enable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDGerCheckBox)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDGerCheckBox)).enable() + # show the checks depending on the status + if showEnglishHoods: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDEngCheck)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDEngCheck)).enable() + if showFrenchHoods: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDFreCheck)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDFreCheck)).enable() + if showGermanHoods: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDGerCheck)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDGerCheck)).enable()""" + + # show the correct arrow depending on our sort method + if publicHoodSort == kSortNameAsc: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameAscArrow)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameAscArrow)).enable() + elif publicHoodSort == kSortNameDesc: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameDescArrow)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameDescArrow)).enable() + elif publicHoodSort == kSortPopAsc: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopAscArrow)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopAscArrow)).enable() + elif publicHoodSort == kSortPopDesc: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopDescArrow)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopDescArrow)).enable() + + # enable/disable scrolling + if indexDisplayStart > 0: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollUp)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollUp)).enable() + numLinks = len(sortedHoods) + print "NUMLINKS: %d" % (numLinks) + if numLinks > ( kNumDisplayFields + indexDisplayStart ): + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollDn)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollDn)).enable() + + # write link names, info, set appropriate text color, enable/show related delete buttons + idTextbox = kIDTxtLinkName01 + index = 0 + for hood in sortedHoods: + if index < indexDisplayStart: + index = index + 1 + continue + if index > ( indexDisplayStart + kNumDisplayFields - 1 ): + break + + if idBookPresented == ( idTextbox-1 ): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorPresented) + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorSelected) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(hood.getDisplayName())) + displayName = xLocTools.LocalizeAgeName(hood.getDisplayName()) + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + stringLinkInfo = str(sortedHoodsPop[index]) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setString(stringLinkInfo) + idTextbox = idTextbox + 10 + index = index + 1 + + def IUpdateCityLinks(self): + global curCityInstance + global numCityLinks + global numGZLinks + global GZLinkNode + global childAgeLinkNodes + global numPubLinks + global numKirelLinks + global numGuildPubLinks + global numKveerPublicLinks + + if len(cityPopulations) == 0: + return + + self.ISyncCurCityInstanceAndVault() + + # find my city link and its associated spawn points + vault = ptVault() + if type(vault) == type(None): + PtDebugPrint("nxusBookMachine.IUpdateCityLinks:\tWARNING player vault type None") + return + cityLink = vault.getLinkToCity() + spawnpoints = cityLink.getSpawnPoints() + + # Don't display spawn points that shouldn't be shown + for sp in spawnpoints[:]: + t = sp.getTitle() + if t in kHiddenCityLinks or t == "Default": + spawnpoints.remove(sp) + + numCityLinks = len(spawnpoints) + + cityDisabled = (cityPopulations[curCityInstance] >= maxCityPopulation) + pubDisabled = (pubPopulation >= maxPubPopulation) + kirelDisabled = (kirelPopulation >= maxKirelPopulation) + guildPubDisabled = (guildPubPopulation >= maxGuildPubPopulation) + kveerPublicDisabled = (kveerPublicPopulation >= maxKveerPublicPopulation) + + # write link names, info, set appropriate text color, enable/show related delete buttons + idTextbox = kIDTxtLinkName01 + index = -1 + for spawnpoint in spawnpoints: + index = index + 1 + if index < indexDisplayStart: + continue + if index > ( indexDisplayStart + kNumDisplayFields - 1 ): + break + + # setup color and clickability of the link + if idBookPresented == ( idTextbox-1 ): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorPresented) + else: + if cityDisabled: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorSelected) + else: + if cityDisabled: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorDisabled) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorDisabled) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(spawnpoint.getTitle())) + displayName = xLocTools.LocalizeAgeName(spawnpoint.getTitle()) + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + dniCoords = cityLink.getCreateAgeCoords() + try: + stringLinkInfo = U"%05d% 04d% 04d" %(dniCoords.GetTorans(),dniCoords.getHSpans(),dniCoords.getVSpans()) + except: + stringLinkInfo = U"%05d% 04d% 04d" %(0,0,0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setStringW(stringLinkInfo) + + # show/enable associated delete button + if not showCityLinks: # we aren't showing city links, so reset this box + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setString("") + # we don't increment the textbox id since we will be re-using this box for the next link (if there is one) + # and we decrement the index because it will be incremented at the beginning of the loop + index = index - 1 + numCityLinks -= 1 # we didn't show this link, decrement + else: + if ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).getStringW() == xLocTools.LocalizeAgeName("Ferry Terminal"): + idTextbox = idTextbox + 10 + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox+99)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox+99)).enable() + idTextbox = idTextbox + 10 + + # var so we know if they have selected the pub link, and therefore need to display the pub population + pubIsSelected = 0 + numPubLinks = 0 + + # now handle the pub link + if showPub and not (type(pubInstance) == type(None)): + numPubLinks = 1 + index = index + 1 + print "idLinkSelected: ", idLinkSelected, " idTextbox-1: ", idTextbox-1 + if (index >= indexDisplayStart) and (index <= (indexDisplayStart + kNumDisplayFields - 1)): + # in range + # setup color and clickability of the link + if idBookPresented == ( idTextbox-1 ): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorPresented) + pubIsSelected = 1 + else: + if pubDisabled: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorSelected) + pubIsSelected = 1 + else: + if pubDisabled: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorDisabled) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorDisabled) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(pubInstance.getDisplayName())) + displayName = xLocTools.LocalizeAgeName(pubInstance.getDisplayName()) + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setStringW("") + + # do NOT show or enable the delete button, but go to the next textbox + idTextbox = idTextbox + 10 + + # var so we know if they have selected the kirel link, and therefore need to display the kirel population + kirelIsSelected = 0 + numKirelLinks = 0 + + # now handle the kirel link + if showKirel and not (type(kirelInstance) == type(None)): + numKirelLinks = 1 + index = index + 1 + print "idLinkSelected: ", idLinkSelected, " idTextbox-1: ", idTextbox-1 + if (index >= indexDisplayStart) and (index <= (indexDisplayStart + kNumDisplayFields - 1)): + # in range + # setup color and clickability of the link + if idBookPresented == ( idTextbox-1 ): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorPresented) + kirelIsSelected = 1 + else: + if kirelDisabled: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorSelected) + kirelIsSelected = 1 + else: + if kirelDisabled: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorDisabled) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorDisabled) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(kirelInstance.getDisplayName())) + displayName = xLocTools.LocalizeAgeName(kirelInstance.getDisplayName()) + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setStringW("") + + # do NOT show or enable the delete button, but go to the next textbox + idTextbox = idTextbox + 10 + + # var so we know if they have selected the guild-pub link, and therefore need to display the kirel population - tho we can't + guildPubIsSelected = 0 + numGuildPubLinks = 0 + + # now handle the GuildPub link + gp = None + if showGuildPub: + gp = self.IGetAgeInfo("guildPub") + if (type(gp) != type(None)) and maxGuildPubPopulation: + numGuildPubLinks = 1 + index = index + 1 + print "idLinkSelected: ", idLinkSelected, " idTextbox-1: ", idTextbox-1 + if (index >= indexDisplayStart) and (index <= (indexDisplayStart + kNumDisplayFields - 1)): + # in range + # setup color and clickability of the link + if idBookPresented == ( idTextbox-1 ): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorPresented) + guildPubIsSelected = 1 + else: + if guildPubDisabled: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorSelected) + guildPubIsSelected = 1 + else: + if guildPubDisabled: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorDisabled) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorDisabled) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(gp.getDisplayName())) + displayName = xLocTools.LocalizeAgeName(gp.getDisplayName()) + guild = guildPubs[showGuildPub-1] + displayName = "The %s' Pub" % (guild) + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + #displayName = "GuildPub-" + guildPubs[showGuildPub-1] + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setStringW("") + + # do NOT show or enable the delete button, but go to the next textbox + idTextbox = idTextbox + 10 + + # var so we know if they have selected the public Kveer link, and therefore need to display the public Kveer population - tho we can't + kveerPublicIsSelected = 0 + numKveerPublicLinks = 0 + + # now handle the public Kveer link + kv = None + if showKveerPublic: + kv = self.IGetAgeInfo("kveerPublic") + if (type(kv) != type(None)) and maxKveerPublicPopulation: + numKveerPublicLinks = 1 + index = index + 1 + print "idLinkSelected: ", idLinkSelected, " idTextbox-1: ", idTextbox-1 + if (index >= indexDisplayStart) and (index <= (indexDisplayStart + kNumDisplayFields - 1)): + # in range + # setup color and clickability of the link + if idBookPresented == ( idTextbox-1 ): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorPresented) + kveerPublicIsSelected = 1 + else: + if kveerPublicDisabled: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorSelected) + kveerPublicIsSelected = 1 + else: + if kveerPublicDisabled: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorDisabled) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorDisabled) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(kv.getDisplayName())) + displayName = xLocTools.LocalizeAgeName(kv.getDisplayName()) + if displayName == "Kveer": + displayName = "K'veer" + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + #displayName = "GuildPub-" + guildPubs[showGuildPub-1] + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setStringW("") + + # do NOT show or enable the delete button, but go to the next textbox + idTextbox = idTextbox + 10 + + # now we handle any leftover children + for linkNode in childAgeLinkNodes: + index = index + 1 + if index < indexDisplayStart: + continue + if index > ( indexDisplayStart + kNumDisplayFields - 1 ): + break + + # setup color and clickability of the link + if idBookPresented == ( idTextbox-1 ): + # make presented book unselectable + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorPresented) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorPresented) + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox-1)).enable() + if idLinkSelected == idTextbox-1: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorSelected) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorSelected) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setForeColor(colorNormal) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setForeColor(colorNormal) + + untranslatedName.append(Uni(linkNode.getAgeInfo().getDisplayName())) + displayName = xLocTools.LocalizeAgeName(linkNode.getAgeInfo().getDisplayName()) + fullLinkName.append(displayName) + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox)).setStringW(displayName) + + dniCoords = linkNode.getCreateAgeCoords() + try: + stringLinkInfo = U"%05d% 04d% 04d" %(dniCoords.GetTorans(),dniCoords.getHSpans(),dniCoords.getVSpans()) + except: + stringLinkInfo = U"%05d% 04d% 04d" %(0,0,0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTextbox+1)).setStringW(stringLinkInfo) + + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox+99)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idTextbox+99)).enable() + idTextbox = idTextbox + 10 + + # update the "status bar" text + if pubIsSelected: + if pubDisabled: + pubPopString = PtGetLocalizedString("Nexus.Messages.PubFull") + else: + pubPopString = PtGetLocalizedString("Nexus.Messages.PubPopulation", [str(pubPopulation), str(maxPubPopulation)]) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW(pubPopString) + elif kirelIsSelected: + if kirelDisabled: + kirelPopString = PtGetLocalizedString("Nexus.Messages.KirelFull") + else: + kirelPopString = PtGetLocalizedString("Nexus.Messages.KirelPopulation", [str(kirelPopulation), str(maxKirelPopulation)]) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW(kirelPopString) + elif guildPubIsSelected: + print "guildPub is selected, but no pop data available" + pass +# if guildPubDisabled: +# gp = "GuildPub-" + guildPubs[showGuildPub-1] +# guildPubPopString = PtGetLocalizedString("Nexus.Messages.GuildPubFull", [gp]) +# else: +# #guildPubPopString = PtGetLocalizedString("Nexus.Messages.GuildPubPopulation", [str(guildPubPopulation), str(maxGuildPubPopulation)]) +# guildPubPopString = PtGetLocalizedString("Nexus.Messages.GuildPubPopulation", ["*", "*"]) +# ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW(guildPubPopString) + elif kveerPublicIsSelected: + print "kveerPublic is selected, but no pop data available" + pass + else: + if cityDisabled: + cityPopString = PtGetLocalizedString("Nexus.Messages.CityFull") + else: + cityPopString = PtGetLocalizedString("Nexus.Messages.CityPopulation", [str(cityPopulations[curCityInstance]), str(maxCityPopulation)]) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)).setStringW(cityPopString) + + # update scroll buttons + numLinks = numCityLinks + len(childAgeLinkNodes) + numPubLinks + numKirelLinks + numGuildPubLinks + numKveerPublicLinks + print "NUMLINKS: %d" % (numLinks) + + if indexDisplayStart > 0: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollUp)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollUp)).enable() + if numLinks > ( kNumDisplayFields + indexDisplayStart ): + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollDn)).show() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollDn)).enable() + + def IGetFullName(self,controlID): + "Get the full link name, because the one displayed may be truncated" + global fullLinkName + global fullNeighborhoodName + + if controlID == kIDTxtNeighborhoodName or controlID == kIDBtnNeighborhoodSelect: + return fullNeighborhoodName + + # the id #s range from 211 to 281 (for text boxes) or 210 to 280 (for buttons), incrementing in 10s + # we take advantage of integer division so that (211-210)/10 == (210-210)/10 + # indexDisplayStart contains the offset in case we are scrolling, with 0 being at the very top of the list (so no offset) + index = controlID - 210 + # now index is from 00 to 70 (or 01 to 71 if text box) + index /= 10 + # now index is from 0 to 7 + if index < len(fullLinkName): + return fullLinkName[index] + else: + return U"" + + def IGetUntranslatedName(self,controlID): + global untranslatedName + global untranslatedNeighborhoodName + + if controlID == kIDTxtNeighborhoodName or controlID == kIDBtnNeighborhoodSelect: + return untranslatedNeighborhoodName + + # the id #s range from 211 to 281 (for text boxes) or 210 to 280 (for buttons), incrementing in 10s + # we take advantage of integer division so that (211-210)/10 == (210-210)/10 + # indexDisplayStart contains the offset in case we are scrolling, with 0 being at the very top of the list (so no offset) + index = controlID - 210 + # now index is from 00 to 70 (or 01 to 71 if text box) + index /= 10 + # now index is from 0 to 7 + try: + return untranslatedName[index] + except IndexError: + return U"" + + def ILink(self): + global curCityInstance + global cityInstances + global GZLinkNode + global GZSpawnpoints + + vault = ptVault() + if type(vault) == type(None): + PtDebugPrint("nxusBookMachine.ILink:\tplayer vault type None") + return + + if idBookPresented == 0: + PtDebugPrint("Ignoring link request since idBookPresented is 0 (which is invalid)") + return + + # my neighborhood link + if idBookPresented == kIDBtnNeighborhoodSelect: + folder = vault.getAgesIOwnFolder() + PtAssert( folder, "vault.getAgesIOwnFolder return bad" ) + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if type(link) != type(None): + info = link.getAgeInfo() + else: + link = content.getChild() + info = link.upcastToAgeInfoNode() + if type(info) == type(None): continue + if info.getAgeFilename() == "Neighborhood": + als = link.asAgeLinkStruct() + als.setLinkingRules( PtLinkingRules.kOwnedBook ) + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + print "nxusBookMachine.ILink:\tERROR--couldn't find link to player's neighborhood in player's Vault" + return + + # get appropriate list of links depending on category selected + folder = None + if idCategorySelected == kIDBtnLinkCategory01: # city links + self.ILinkToCity() + return + elif idCategorySelected == kIDBtnLinkCategory02: # private links + folder = vault.getAgesICanVisitFolder() + elif idCategorySelected == kIDBtnLinkCategory03: # public links + self.ILinkToPublicHood() + return + elif idCategorySelected == kIDBtnLinkCategory04: # personal links + folder = vault.getAgesIOwnFolder() + if type(folder) == type(None): + PtDebugPrint("nxusBookMachine.ILink:\tWARNING link folder type None") + return + contents = folder.getChildNodeRefList() + + # see if they want to go to the GZ + if (idCategorySelected == kIDBtnLinkCategory04): + index = idBookPresented + 1 + index = index - 210 + index /= 10 # index is now from 0 to 7 + index += indexDisplayStart + PtDebugPrint("nxusBookMachine.ILink():\tindex: "+str(index)+" numGZLinks: "+str(numGZLinks)) + + if (index < numGZLinks): + # going to the GZ! + info = self.IGetGZInfoNode() + if type(info) == type(None): + PtDebugPrint("nxusBookMachine.ILink():\tWARNING--unable to find GZ info node, aborting link") + return + + if type(GZLinkNode) == type(None): + PtDebugPrint("nxusBookMachine.ILink():\tWARNING--GZ link node is bad, aborting link") + return + if index >= len(GZSpawnpoints): + PtDebugPrint("nxusBookMachine.ILink():\tWARNING--GZ spawnpoint index out of range, aborting link") + return + + als = GZLinkNode.asAgeLinkStruct() + als.setSpawnPoint(GZSpawnpoints[index]) + als.setLinkingRules(PtLinkingRules.kChildAgeBook) + als.setParentAgeFilename("Neighborhood") + + print "-- linking --" + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + + # do the link + clickedLinkName = self.IGetUntranslatedName(idBookPresented + 1) + PtDebugPrint( "nxusBookMachine.ILink():\tattempting link to %s" % (clickedLinkName)) + if not clickedLinkName: + PtDebugPrint("nxusBookMachine.ILink():\tWARNING--Link name is empty, aborting link") + return + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if type(link) != type(None): + info = link.getAgeInfo() + else: + link = content.getChild() + info = link.upcastToAgeInfoNode() + if type(info) == type(None): continue + if idCategorySelected == kIDBtnLinkCategory01: # city links + thisLinkName = info.getAgeFilename() + else: + thisLinkName = info.getDisplayName() + if thisLinkName == clickedLinkName: + print "-- found link node --" + thisAge = info.getAgeFilename() + if (thisAge == "Ercana" or thisAge == "AhnonayCathedral" or thisAge == "Ahnonay") and (idCategorySelected != kIDBtnLinkCategory02): # check to make sure it's a non-private link + self.DoErcanaAndAhnonayStuff(thisAge) + if isinstance(link,ptVaultAgeLinkNode): + als = link.asAgeLinkStruct() + else: + als = ptAgeLinkStruct() + als.setAgeInfo(info.asAgeInfoStruct()) + if idCategorySelected == kIDBtnLinkCategory02: # private links + als.setLinkingRules( PtLinkingRules.kVisitBook ) + elif idCategorySelected == kIDBtnLinkCategory04: # personal links + als.setLinkingRules( PtLinkingRules.kOwnedBook ) + else: + als.setLinkingRules( PtLinkingRules.kBasicLink ) # public hood links + print "-- linking --" + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + + PtDebugPrint( "nxusBookMachine.ILink():\tWARNING--couldn't find link to %s in player's Vault" % (clickedLinkName)) + return + + def ILinkToCity(self): + vault = ptVault() + if type(vault) == type(None): + PtDebugPrint("nxusBookMachine.ILinkToCity:\tplayer vault type None") + return + index = idBookPresented + 1 + index = index - 210 + index /= 10 # index is now from 0 to 7, but... + index += indexDisplayStart # we need to account for scrolling down, as Kveer (and any additional links) requires it + PtDebugPrint("nxusBookMachine.ILinkToCity:\tindex: "+str(index)+" numCityLinks: "+str(numCityLinks)+" numPubLinks: "+str(numPubLinks)+" numKirelLinks: "+str(numKirelLinks)+" numGuildPubLinks: "+str(numGuildPubLinks)+" numKveerPublicLinks: "+str(numKveerPublicLinks)) + + if index < numCityLinks: # it's a city link + spawnpointtitle = self.IGetUntranslatedName(idBookPresented + 1) + PtDebugPrint("nxusBookMachine.ILinkToCity():\tattempting link to city's %s" % (spawnpointtitle)) + folder = vault.getAgesIOwnFolder() + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if type(link) != type(None): + info = link.getAgeInfo() + else: + link = content.getChild() + info = link.upcastToAgeInfoNode() + if type(info) == type(None): continue + thisLinkName = info.getAgeFilename() + if thisLinkName == U"city": + print "-- found link node --" + if isinstance(link,ptVaultAgeLinkNode): + als = link.asAgeLinkStruct() + else: + als = ptAgeLinkStruct() + als.setAgeInfo(info.asAgeInfoStruct()) + if not curCityInstance == -1: # we aren't using the default city + als.getAgeInfo().copyFrom(cityInstances[curCityInstance]) + als.setLinkingRules( PtLinkingRules.kBasicLink ) + spawnpoints = link.getSpawnPoints() + foundspawnpoint = false + for spawnpoint in spawnpoints: + if spawnpoint.getTitle() == spawnpointtitle: + print "-- found spawn point --" + als.setSpawnPoint( spawnpoint ) + foundspawnpoint = true + if not foundspawnpoint: + PtDebugPrint("nxusBookMachine.ILinkToCity():\tWARNING couldn't find city spawn point for %s" % (spawnpointtitle)) + return + print "-- linking --" + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + elif index < numCityLinks + numPubLinks: # it's a pub link + ageName = self.IGetUntranslatedName(idBookPresented + 1) + PtDebugPrint("nxusBookMachine.ILinkToCity():\tattempting link to %s" % (ageName)) + if not ageName: + PtDebugPrint("Link name is empty, aborting link") + return + if type(pubInstance) == type(None): + PtDebugPrint("Pub instance is none, aborting link") + return; + info = ptAgeInfoStruct() + info.copyFrom(pubInstance) + als = ptAgeLinkStruct() + als.setAgeInfo(info) + als.setLinkingRules(PtLinkingRules.kBasicLink) + print "-- linking --" + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + elif index < numCityLinks + numPubLinks + numKirelLinks: # it's a kirel link + ageName = self.IGetUntranslatedName(idBookPresented + 1) + PtDebugPrint("nxusBookMachine.ILinkToCity():\tattempting link to %s" % (ageName)) + if not ageName: + PtDebugPrint("Link name is empty, aborting link") + return + if type(kirelInstance) == type(None): + PtDebugPrint("Kirel instance is none, aborting link") + return; + info = ptAgeInfoStruct() + info.copyFrom(kirelInstance) + als = ptAgeLinkStruct() + als.setAgeInfo(info) + als.setLinkingRules(PtLinkingRules.kBasicLink) + print "-- linking --" + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + elif index < numCityLinks + numPubLinks + numKirelLinks + numGuildPubLinks: # it's a GuildPub link + ageName = self.IGetUntranslatedName(idBookPresented + 1) + if ageName[:1] == " ": + ageName = ageName[1:] #remove the stupid blank first space + PtDebugPrint("nxusBookMachine.ILinkToCity():\tattempting link to %s" % (ageName)) + if not ageName: + PtDebugPrint("Link name is empty, aborting link") + return + gp = self.IGetAgeInfo("guildPub") + if type(gp) == type(None): + PtDebugPrint("GuildPub instance is none, aborting link") + return; + info = ptAgeInfoStruct() + info.copyFrom(gp) + als = ptAgeLinkStruct() + als.setAgeInfo(info) + als.setLinkingRules(PtLinkingRules.kBasicLink) + print "-- linking --" + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + elif index < numCityLinks + numPubLinks + numKirelLinks + numGuildPubLinks + numKveerPublicLinks: # it's a public Kveer link + ageName = self.IGetUntranslatedName(idBookPresented + 1) + if ageName[:1] == " ": + ageName = ageName[1:] #remove the stupid blank first space + PtDebugPrint("nxusBookMachine.ILinkToCity():\tattempting link to %s" % (ageName)) + if not ageName: + PtDebugPrint("Link name is empty, aborting link") + return + kv = self.IGetAgeInfo("kveerPublic") + if type(kv) == type(None): + PtDebugPrint("public Kveer instance is none, aborting link") + return; + info = ptAgeInfoStruct() + info.copyFrom(kv) + als = ptAgeLinkStruct() + als.setAgeInfo(info) + als.setLinkingRules(PtLinkingRules.kBasicLink) + print "-- linking --" + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + else: # it's a child age link + ageName = self.IGetUntranslatedName(idBookPresented + 1) + PtDebugPrint("nxusBookMachine.ILinkToCity():\tattempting link to %s" % (ageName)) + if not ageName: + PtDebugPrint("Link name is empty, aborting link") + return + for linkNode in childAgeLinkNodes: + info = linkNode.getAgeInfo() + if ageName == info.getDisplayName(): + als = linkNode.asAgeLinkStruct() + als.setLinkingRules( PtLinkingRules.kChildAgeBook ) + als.setParentAgeFilename("Neighborhood") + print "-- linking --" + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + return + PtDebugPrint("nxusBookMachine.ILinkToCity():\tWARNING--couldn't find link in player's Vault") + return + + def ILinkToPublicHood(self): + global publicHoods + + clickedLinkName = self.IGetUntranslatedName(idBookPresented+1) + PtDebugPrint("nxusBookMachine.ILinkToPublicHood():\tattempting link to %s" % (clickedLinkName)) + if not clickedLinkName: + PtDebugPrint("Link name is empty, aborting link") + return + + for hood in publicHoods: + thisLinkName = hood.getDisplayName() + if thisLinkName == clickedLinkName: + als = ptAgeLinkStruct() + als.setAgeInfo(hood) + als.setLinkingRules(PtLinkingRules.kBasicLink) + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + break + + def IDisableGUIButtons(self): + # disable delete buttons + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink01)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink02)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink03)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink04)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink05)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink06)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink07)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnDeleteLink08)).disable() + # disable link select buttons buttons + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect01)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect02)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect03)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect04)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect05)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect06)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect07)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkSelect08)).disable() + # disable hood buttons + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodCreate)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodSelect)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnNeighborhoodPublic)).disable() + # disable category buttons + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkCategory01)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkCategory02)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkCategory03)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnLinkCategory04)).disable() + # disable scroll buttons + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollDn)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDBtnScrollUp)).disable() + # disable header buttons + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameHeaderBtn)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopHeaderBtn)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameAscArrow)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDNameDescArrow)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopAscArrow)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDPopDescArrow)).disable() + # disable checkboxes + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDEngCheckBox)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDFreCheckBox)).disable() + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(kIDGerCheckBox)).disable() + + # disable interesting notifys + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo01)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo02)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo03)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo04)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo05)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo06)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo07)).setNotifyOnInteresting(0) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkInfo08)).setNotifyOnInteresting(0) + return + + def IDeleteLink(self): + global boolGetBookAfterBookRetract + global idLinkSelected + global idBookPresented + global boolBookPresented + global boolGetBookBtnUp + global boolGetBookAfterBtnPress + + actLink.disable() + + # determine who we're trying to delete + stringDeleteCandidateName = self.IGetUntranslatedName(idDeleteCandidateName) + vault = ptVault() + if type(vault) == type(None): + PtDebugPrint("nxusBookMachine.IDeleteLink:\tplayer vault type None") + return + + # do the deletion + vault = ptVault() + if idCategorySelected == kIDBtnLinkCategory01: # city links + cityLink = vault.getLinkToCity() + spawnPoints = cityLink.getSpawnPoints() + deletionCompleted = 0 + for spawnPoint in spawnPoints: + if spawnPoint.getTitle()==stringDeleteCandidateName: + PtDebugPrint("Deleting link to "+stringDeleteCandidateName) + cityLink.removeSpawnPoint(spawnPoint) + cityLink.save() + deletionCompleted = 1 + break + if not deletionCompleted: # this must be a child age link + for linkNode in childAgeLinkNodes: + info = linkNode.getAgeInfo() + if stringDeleteCandidateName == info.getDisplayName(): + PtDebugPrint("Deleting link to "+stringDeleteCandidateName) + guid = info.getAgeInstanceGuid() + vault.unRegisterVisitAge(guid) + break + elif idCategorySelected == kIDBtnLinkCategory02: # private links + folder = vault.getAgesICanVisitFolder() + contents = folder.getChildNodeRefList() + for content in contents: + linkNode = content.getChild() + linkNode = linkNode.upcastToAgeLinkNode() + if type(linkNode) == type(None): + linkNode = content.getChild() + info = linkNode.upcastToAgeInfoNode() + else: + info = linkNode.getAgeInfo() + if type(info) == type(None): continue + if stringDeleteCandidateName == info.getDisplayName(): + PtDebugPrint("Deleting link to "+stringDeleteCandidateName) + guid = info.getAgeInstanceGuid() + vault.unRegisterVisitAge(guid) + break + else: + PtDebugPrint("nxusBookMachine.IDeleteLink:\tdeletion of this link type not supported") + + # update GUI data and machine state + if ( idDeleteCandidateName-1 ) == idBookPresented: + respBookRetract.run(self.key) + boolGetBookAfterBookRetract = false + boolBookPresented = false + idBookPresented = 0 + if ( idDeleteCandidateName-1 ) == idLinkSelected: + respButtonPress.run(self.key) + boolGetBookBtnUp = false + boolGetBookAfterBtnPress = false + idLinkSelected = 0 + return # update links (enable GUI) after button animates + if ( idDeleteCandidateName-1) < idLinkSelected: + idLinkSelected = idLinkSelected - 10 + if ( idDeleteCandidateName-1) < idBookPresented: + idBookPresented = idBookPresented - 10 + + self.IUpdateLinks() + return + + def IDrawLinkPanel(self): + # first hide them all + for objPanel in objlistLinkPanels.value: + #print "hiding link panel: ",objPanel.getName() + objPanel.draw.disable() + + # now draw correct panel + if ( idBookPresented == kIDBtnNeighborhoodSelect ) or ( idCategorySelected == kIDBtnLinkCategory03 ): # Neighborhoods + panelName = U"LinkPanel_Neighborhood" + elif idCategorySelected == kIDBtnLinkCategory01: # City links + temp = self.IGetUntranslatedName(idBookPresented+1) + if temp == "Tokotah Alley": # some genius had this thing misspelled as dakota for a LONG time, so we hack it in here + panelName = U"LinkPanel_Dakotah Alley" + elif temp == " The Watcher's Pub": # apparently this name has a space preceeding it, AND isn't named the same as the linking panel... go figure + panelName = U"LinkPanel_" + "GreatTreePub" + elif temp == " Kirel": # apparently this name has a space preceeding it, AND isn't named the same as the linking panel... go figure + panelName = U"LinkPanel_" + "Kirel" + elif temp[:10] == " GuildPub-": + panelName = U"LinkPanel_GuildPub-" + guildPubs[showGuildPub-1] + elif temp == " Kveer" or temp == " K'veer": + panelName = U"LinkPanel_" + "Kveer" + else: + panelName = U"LinkPanel_" + self.IGetUntranslatedName(idBookPresented+1) + else: + # gonna have to dig... + clickedName = self.IGetUntranslatedName(idBookPresented+1) + panelName = clickedName + vault = ptVault() + if idCategorySelected == kIDBtnLinkCategory02: # private links + folder = vault.getAgesICanVisitFolder() + else: # personal links + folder = vault.getAgesIOwnFolder() + contents = folder.getChildNodeRefList() + for content in contents: + linkNode = content.getChild() + linkNode = linkNode.upcastToAgeLinkNode() + if type(linkNode) != type(None): + info = linkNode.getAgeInfo() + else: + linkNode = content.getChild() + info = linkNode.upcastToAgeInfoNode() + if type(info) == type(None): continue + if clickedName == "Great Zero": #super hack to the rescue! + panelName = U"LinkPanel_" + "GreatZero" + break + if clickedName == info.getDisplayName(): + panelName = U"LinkPanel_" + Uni(info.getAgeFilename()) + break + + PtDebugPrint( "drawing link panel: %s" % (panelName) ) + for objPanel in objlistLinkPanels.value: + PtDebugPrint("name: "+objPanel.getName()) + if objPanel.getName() == panelName: + objPanel.draw.enable() + return + PtDebugPrint( "nxusBookMachine.IDrawLinkPanel():\tERROR: couldn't find link panel: %s" % (panelName) ) + return + + def ISyncCurCityInstanceAndVault(self): + global curCityInstance + + if len(cityInstances): + minCityGUID = cityInstances[0].getAgeInstanceGuid() + curCityInstance = 0 + for i in range(0,len(cityInstances)): + if cityInstances[i].getAgeInstanceGuid() < minCityGUID: + minCityGUID = cityInstances[i].getAgeInstanceGuid() + curCityInstance = i + PtDebugPrint("ISyncCurCityInstanceAndVault(): Picked guid: "+str(minCityGUID)) + + + def IGetAgeInfo(self,age): + if age == "guildPub": + #global guildPubInstance + #global guildPubPopulation + gpubGUID = guildPubGUIDs[showGuildPub-1] + gpInfo = ptAgeInfoStruct() + guild = guildPubs[showGuildPub-1] + gp = "GuildPub-" + guild + gpInfo.setAgeFilename(gp) + gpInfo.setAgeInstanceName(gp) + gpInfo.setAgeInstanceGuid(gpubGUID) + gpLink = ptAgeLinkStruct() + gpLink.setAgeInfo(gpInfo) + gpInfo = gpLink.getAgeInfo() + guildPubInstance = gpInfo + #guildPubPopulation = ??? #no current way to get that data + return guildPubInstance + elif age == "kveerPublic": + #global kveerPublicInstance + #global kveerPublicPopulation + kveerInfo = ptAgeInfoStruct() + kveerInfo.setAgeFilename("Kveer") + kveerInfo.setAgeInstanceName("K'veer") + kveerInfo.setAgeInstanceGuid(kveerPublicGUID) + kveerLink = ptAgeLinkStruct() + kveerLink.setAgeInfo(kveerInfo) + kveerInfo = kveerLink.getAgeInfo() + kveerPublicInstance = kveerInfo + #kveerPublicPopulation = ??? #no current way to get that data + return kveerPublicInstance + else: + print "nxusBookMachine.IGetAgeInfo(): ERROR! Don't recognize age: ",age + + + def DoErcanaAndAhnonayStuff(self,panel): + print "nxusBookMachine.DoErcanaAndAhnonayStuff(): this age panel = ",panel + if panel == "Ercana": + ageFileName = "Ercana" + ageInstanceName = "Er'cana" + elif panel == "AhnonayCathedral" or panel == "Ahnonay": + ageFileName = "AhnonayCathedral" + ageInstanceName = "Ahnonay Cathedral" + self.FindOrCreateGUIDChron(ageFileName) + + + def FindOrCreateGUIDChron(self,ageFileName): + print "FindOrCreateGUIDChron for: ",ageFileName + GUIDChronFound = 0 + ageDataFolder = None + + vault = ptVault() + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename(ageFileName) + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "PelletCaveGUID": + GUIDChronFound = 1 + print "found pellet cave GUID: ", chron.getValue() + return + #return + + pelletCaveGUID = "" + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("PelletBahroCave") + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + pelletCaveGUID = ageInfoNode.getAgeInstanceGuid() + print "found pelletCaveGUID age chron, = ",pelletCaveGUID + + if not ageDataFolder: + print "no ageDataFolder..." + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename(ageFileName) + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + print "got ageLinkNode, created AgeData folder" + ageInfoNode = ageLinkNode.getAgeInfo() + ageDataFolder = ptVaultFolderNode(0) + ageDataFolder.folderSetName("AgeData") + ageInfoNode.addNode(ageDataFolder) + + if not GUIDChronFound: + print "creating PelletCave GUID chron" + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("PelletCaveGUID") + newNode.chronicleSetValue(pelletCaveGUID) + ageDataFolder.addNode(newNode) + print "created pelletCaveGUID age chron, = ",pelletCaveGUID + diff --git a/Python/payiBahroSymbol.py b/Python/payiBahroSymbol.py new file mode 100644 index 0000000000..c91a84ed7c --- /dev/null +++ b/Python/payiBahroSymbol.py @@ -0,0 +1,84 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: payiBahroSymbol +Age: Global +Date: January 2007 +Author: Derek Odell +""" + +from Plasma import * +from PlasmaTypes import * + +# define the attributes that will be entered in max +SymbolAppears = ptAttribInt(1, "Frame the Symbol Appears", 226, (0,5000)) +DayFrameSize = ptAttribInt(2, "Frames in One Day", 2000, (0,5000)) + +animSkyDome = ptAttribMaterialAnimation(3, "Sky Dome Mat Anim") +animLightBoards = ptAttribMaterialAnimation(5, "Light BillBoard Mat Anim") +animBahroStones = ptAttribMaterialAnimation(6, "Bahro Stones Mat Anim") +animLightFlares = ptAttribMaterialAnimation(7, "Window Glow Mat Anim") + +# define globals +kDayLengthInSeconds = 56585.0 + +# The max file "full day" animation in Payiferen is 2000 frames +# or 66.666 (2000 / 30) seconds long. We need it to last 56585 +# seconds which means the animation needs to be played back at +# 0.035345 (2000 / 56585) frames per second. Which means animation +# speed needs to be set to 0.0011781666 ((2000 / 56585) / 30) +kDayAnimationSpeed = (DayFrameSize.value / kDayLengthInSeconds) / 30.0 + +#==================================== + +class payiBahroSymbol(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 5251 + version = 1 + self.version = version + print "__init__payiBahroSymbol v.", version,".0" + + ########################### + def OnServerInitComplete(self): + timeIntoMasterAnim = PtGetAgeTimeOfDayPercent() * (DayFrameSize.value / 30.0) + print "payiBahroSymbol.OnServerInitComplete: Anims skipping to %f seconds and playing at %f speed" % (timeIntoMasterAnim, kDayAnimationSpeed) + + animSkyDome.animation.skipToTime(timeIntoMasterAnim) + animLightBoards.animation.skipToTime(timeIntoMasterAnim) + animBahroStones.animation.skipToTime(timeIntoMasterAnim) + animLightFlares.animation.skipToTime(timeIntoMasterAnim) + + animSkyDome.animation.speed(kDayAnimationSpeed) + animLightBoards.animation.speed(kDayAnimationSpeed) + animBahroStones.animation.speed(kDayAnimationSpeed) + animLightFlares.animation.speed(kDayAnimationSpeed) + + animSkyDome.animation.resume() + animLightBoards.animation.resume() + animBahroStones.animation.resume() + animLightFlares.animation.resume() diff --git a/Python/payiUrwinBrain.py b/Python/payiUrwinBrain.py new file mode 100644 index 0000000000..415cc5b68d --- /dev/null +++ b/Python/payiUrwinBrain.py @@ -0,0 +1,484 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: payiUrwinBrain +Age: Payiferen +Date: March 2007 +Author: Doug McBride +HaX0r3d: Derek Odell +Controls the appearance and behavior of the Payiferen Urwin Bird +""" + +from Plasma import * +from PlasmaTypes import * +import whrandom + +# define the attributes that will be entered in max +UrwinFlipSide_A = ptAttribAnimation(1, "Urwin Flip Anim A", netForce=1) +UrwinFlipSide_B = ptAttribAnimation(2, "Urwin Flip Anim B", netForce=1) +UrwinMasterAnim = ptAttribAnimation(3, "Urwin Master Anim", netForce=1) + +respUrwin_Eat_ToIdle = ptAttribResponder(4, "resp: Eat To Idle") +respUrwin_Eat_ToWalkSniff = ptAttribResponder(5, "resp: Eat To WalkSniff") +respUrwin_Eat_Scoop = ptAttribResponder(6, "resp: Eat Scoop") +respUrwin_Eat_Shake = ptAttribResponder(7, "resp: Eat Shake") +respUrwin_Eat_Swallow = ptAttribResponder(8, "resp: Eat Swallow") + +respUrwin_Idle_01 = ptAttribResponder(9, "resp: Idle01") +respUrwin_Idle_02 = ptAttribResponder(10, "resp: Idle02") +respUrwin_Idle_ToEat = ptAttribResponder(11, "resp: Idle To Eat") +respUrwin_Idle_ToWalk = ptAttribResponder(12, "resp: Idle To Walk") +respUrwin_Idle_Vocalize = ptAttribResponder(13, "resp: Idle Vocalize") + +respUrwin_Walk_ToIdle = ptAttribResponder(14, "resp: Walk To Idle") +respUrwin_Walk_ToWalkSniff = ptAttribResponder(15, "resp: Walk To WalkSniff") +respUrwin_Walk_Loop01 = ptAttribResponder(16, "resp: Walk01") +respUrwin_Walk_Loop02 = ptAttribResponder(17, "resp: Walk02") + +respUrwin_WalkSniff_ToEat = ptAttribResponder(18, "resp: WalkSniff To Eat") +respUrwin_WalkSniff_ToWalk = ptAttribResponder(19, "resp: WalkSniff To Walk") +respUrwin_WalkSniff = ptAttribResponder(20, "resp: WalkSniff") + +respUrwinSfx = ptAttribResponder(21, "resp: Urwin SFX", ["Eat2Idle", "Eat2Sniff", "Scoop", "Shake", "Swallow", "Idle01", "Idle02", "Idle2Eat", "Idle2Walk", "Vocalize", "Walk2Idle", "Walk2Sniff", "Walk01", "Walk02", "Sniff2Eat", "Sniff2Walk", "Sniff", "appear", "disappear"], netForce=1) + +actUrwinPathEnd = ptAttribActivator(22, "act: Urwin Path End") + +# define globals +kDayLengthInSeconds = 56585 # Length of a Payiferen day in seconds Must match value in Payiferen.age file +kMinimumTimeBetweenSpawns = 3600 # 1 hour +kMaximumTimeBetweenSpawns = 25200 # 7 hours +# We need the first random spawn time in the first 5 hours of the day +# which is in the first 44.5 percent of the day. So we're +# generating a number from 0 to 445 and later we divide by 1000 to get +# something roughly in that timeframe. +kFirstMorningSpawn = 445 + +minsteps = 3 +maxsteps = 10 + +StepsToTake = 0 +stackList = [] + +class payiUrwinBrain(ptResponder): + ############################ + def __init__(self): + ptResponder.__init__(self) + self.id = 5253 + version = 1 + self.version = version + print "__init__payiUrwinBrain v.", version,".0" + + ############################ + def OnFirstUpdate(self): + whrandom.seed() + + ############################ + def OnServerInitComplete(self): + try: + ageSDL = PtGetAgeSDL() + except: + print "payiUrwinBrain:\tERROR---Cannot find the Payiferen Age SDL" + self.InitNewSDLVars() + + ageSDL.sendToClients("UrwinLastUpdated") + ageSDL.sendToClients("UrwinSpawnTimes") + ageSDL.sendToClients("UrwinOnTheProwl") + ageSDL.setFlags("UrwinLastUpdated", 1, 1) + ageSDL.setFlags("UrwinSpawnTimes", 1, 1) + ageSDL.setFlags("UrwinOnTheProwl", 1, 1) + ageSDL.setFlags("payiPodLights", 1, 1) + ageSDL.setNotify(self.key, "UrwinLastUpdated", 0.0) + ageSDL.setNotify(self.key, "UrwinSpawnTimes", 0.0) + ageSDL.setNotify(self.key, "UrwinOnTheProwl", 0.0) + ageSDL.setNotify(self.key, "payiPodLights", 0.0) + + thisDay = int(PtGetDniTime() / kDayLengthInSeconds) + lastDay = int(ageSDL["UrwinLastUpdated"][0] / kDayLengthInSeconds) + + if (thisDay - lastDay) > 0: + print "payiUrwinBrain: It's been at least a day since the last update, running new numbers now." + self.InitNewSDLVars() + else: + print "payiUrwinBrain: It's been less than a day since the last update, doing nothing" + self.SetUrwinTimers() + + if not len(PtGetPlayerList()): + UrwinMasterAnim.animation.skipToBegin() + + ########################### + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname == "UrwinSpawnTimes": + self.SetUrwinTimers() + + #Had to wire this to stop SFX if the lights go off.... + elif VARname == "payiPodLights": + ageSDL = PtGetAgeSDL() + if not ageSDL[VARname][0] and ageSDL["UrwinOnTheProwl"][0]: + respUrwinSfx.run(self.key, state="Idle01") + + ############################ + def OnNotify(self,state,id,events): + global StepsToTake + global stackList + + ageSDL = PtGetAgeSDL() + print "payiUrwinBrain.OnNotify: state=%f id=%d owned=%s prowl=%s events=" % (state,id,str(self.sceneobject.isLocallyOwned()),str(ageSDL["UrwinOnTheProwl"][0])),events + + if id == (-1): + print "Need to store event: %s" % (events[0][1]) + stackList.append(events[0][1]) + print "New list is: %s" % (str(stackList)) + if len(stackList) == 1: + print "List is only one command long, so I'm playing it" + code = stackList[0] + print "Playing command: %s" % (code) + exec code + + elif state and self.sceneobject.isLocallyOwned() and ageSDL["UrwinOnTheProwl"][0]: + if id == respUrwinSfx.id: + print "Callback was from Appearance SFX, and I own the age, so start walking" + self.StartToWalk() + + else: + print "Callback was from responder, and I own the age, so Logic Time" + old = stackList.pop(0) + print "Popping off: %s" % (old) + boolBatteryChargedAndOn = ageSDL["payiPodLights"][0] + + if id == respUrwin_Walk_Loop01.id or id == respUrwin_Walk_Loop02.id or id == respUrwin_WalkSniff_ToWalk.id or id == respUrwin_Idle_ToWalk.id: + UrwinMasterAnim.animation.resume() + if StepsToTake == 0: + StepsToTake = whrandom.randint(minsteps, maxsteps) + print "We should have steps, so Urwin has decided to take %d steps." % (StepsToTake) + + StepsToTake = StepsToTake - 1 + if StepsToTake: + if whrandom.randint(0,9): # 90% chance of continuing walk loop + print "Urwin will take %d more steps..." % (StepsToTake) + if whrandom.randint(0,2): + print "Urwin walks one way." + self.SendNote("respUrwin_Walk_Loop01.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk01") + else: + print "Urwin walks the other way." + self.SendNote("respUrwin_Walk_Loop02.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk02") + + else: # 10% to Sniff + print "Urwin smells something..." + self.SendNote("respUrwin_Walk_ToWalkSniff.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk2Sniff") + + else: + print "Urwin is tired and stops walking" + self.SendNote("respUrwin_Walk_ToIdle.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk2Idle") + + elif id == respUrwin_Walk_ToWalkSniff.id or id == respUrwin_WalkSniff.id or id == respUrwin_Eat_ToWalkSniff.id: + UrwinMasterAnim.animation.resume() + pct = whrandom.randint(0,2) + if pct == 2: + print "Urwin smells something good!" + self.SendNote("respUrwin_WalkSniff.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Sniff") + + elif pct == 1: + print "Urwin found food!" + self.SendNote("respUrwin_WalkSniff_ToEat.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Sniff2Eat") + + else: + print "Urwin says nevermind, back to walking." + self.SendNote("respUrwin_WalkSniff_ToWalk.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Sniff2Walk") + + elif id == respUrwin_WalkSniff_ToEat.id or id == respUrwin_Idle_ToEat.id: + UrwinMasterAnim.animation.stop() + pct = whrandom.randint(0,2) + if pct == 2: + print "Urwin lost interest in the food." + self.SendNote("respUrwin_Eat_ToIdle.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat2Idle") + + elif pct == 1: + print "Urwin is still searching for the food." + self.SendNote("respUrwin_Eat_ToWalkSniff.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat2Sniff") + + else: + print "Urwin scoops up the food!" + self.SendNote("respUrwin_Eat_Scoop.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Scoop") + + elif id == respUrwin_Eat_Scoop.id or id == respUrwin_Eat_Shake.id or id == respUrwin_Eat_Swallow.id: + pct = whrandom.randint(0,4) + if pct == 4: + print "Urwin scoops up the food!" + self.SendNote("respUrwin_Eat_Scoop.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Scoop") + + elif pct == 3: + print "Urwin shakes the food!" + self.SendNote("respUrwin_Eat_Shake.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Shake") + + elif pct == 2: + print "Urwin swallows the food!" + self.SendNote("respUrwin_Eat_Swallow.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Swallow") + + elif pct == 1: + print "Urwin lost interest in the food." + self.SendNote("respUrwin_Eat_ToIdle.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat2Idle") + + else: + print "Urwin is still searching for the food." + self.SendNote("respUrwin_Eat_ToWalkSniff.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat2Sniff") + + elif id == respUrwin_Idle_01.id or id == respUrwin_Idle_02.id or id == respUrwin_Eat_ToIdle.id or id == respUrwin_Walk_ToIdle.id or id == respUrwin_Idle_Vocalize.id: + UrwinMasterAnim.animation.stop() + pct = whrandom.randint(0,4) + if pct == 4: + print "Urwin idles one way." + self.SendNote("respUrwin_Idle_01.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle01") + + elif pct == 3: + print "Urwin idles the other way." + self.SendNote("respUrwin_Idle_02.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle02") + + elif pct == 2: + print "Urwin calls home!" + self.SendNote("respUrwin_Idle_Vocalize.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Vocalize") + + elif pct == 1: + print "Urwin gets hungry." + self.SendNote("respUrwin_Idle_ToEat.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle2Eat") + + else: + print "Urwin is done resting, back to walking." + self.SendNote("respUrwin_Idle_ToWalk.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle2Walk") + + elif id == actUrwinPathEnd.id: + print "End of the line, Urwin!" + UrwinMasterAnim.animation.stop() + UrwinMasterAnim.animation.skipToTime(0) + ageSDL["UrwinOnTheProwl"] = (0,) + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="disappear") + + elif id in range(3,20) and not self.sceneobject.isLocallyOwned(): + print "Callback was from responder, and I DON'T own the age, so I'll try playing the next item in list" + old = stackList.pop(0) + print "Popping off: %s" % (old) + if len(stackList): + print "List has at least one item ready to play" + code = stackList[0] + print "Playing command: %s" % (code) + exec code + + else: + print "Callback from something else?" + + ############################ + def StartToWalk(self): + global StepsToTake + + ageSDL = PtGetAgeSDL() + boolBatteryChargedAndOn = ageSDL["payiPodLights"][0] + + StepsToTake = whrandom.randint(minsteps, maxsteps) + print "Urwin has decided to take %d steps." % (StepsToTake) + + if whrandom.randint(0,1): + self.SendNote("respUrwin_Walk_Loop01.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk01") + else: + self.SendNote("respUrwin_Walk_Loop02.run(self.key)") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk02") + UrwinMasterAnim.animation.resume() + + ############################ + def OnTimer(self,TimerID): + global UrwinOnTheProwl + + ageSDL = PtGetAgeSDL() + boolBatteryChargedAndOn = ageSDL["payiPodLights"][0] + if self.sceneobject.isLocallyOwned(): + if TimerID == 1: + print "UrwinBrain.OnTimer: Time for the Urwin to return." + ageSDL["UrwinOnTheProwl"] = (1,) + + if whrandom.randint(0,1): + UrwinFlipSide_A.animation.play() + else: + UrwinFlipSide_B.animation.play() + + if ageSDL["payiPodLights"][0]: + respUrwinSfx.run(self.key, state="appear") + else: + self.StartToWalk() + elif TimerID == 2: + print "UrwinBrain.OnTimer: New day, let's renew the timers." + self.InitNewSDLVars() + elif TimerID == 3: + UrwinMasterAnim.animation.stop() + + ########################### + def SendNote(self, ExtraInfo): + #pythonBox = PtFindSceneobject("Dummy04", "Payiferen") # <-- point to new object!! + #pmlist = pythonBox.getPythonMods() + #for pm in pmlist: + notify = ptNotify(self.key) + notify.clearReceivers() + + #notify.addReceiver(pm) + notify.addReceiver(self.key) + + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + + notify.addVarNumber(str(ExtraInfo),1.0) + + notify.send() + + ########################### + def InitNewSDLVars(self): + ageSDL = PtGetAgeSDL() + + ageSDL["UrwinLastUpdated"] = (PtGetDniTime(),) + + beginningOfToday = PtGetDniTime() - int(PtGetAgeTimeOfDayPercent() * kDayLengthInSeconds) + endOfToday = int(kDayLengthInSeconds / 2) + beginningOfToday + #print "Dawn: %d Dusk: %d" % (beginningOfToday, endOfToday) + + # We need a random times in the first 5 hours of the day + # which is in the first 44.5 percent of the day. So we're + # generating a number from 0 to 445 and dividing by 1000 to get + # something roughly in that timeframe. + randnum = float(whrandom.randint(0,kFirstMorningSpawn)) + firstTime = int((randnum / 1000.0) * kDayLengthInSeconds) + beginningOfToday + print "payiUrwinBrain: Generated a valid spawn time: %d" % (firstTime) + spawnTimes = [firstTime] + + while type(spawnTimes[-1]) == type(long(1)): + randnum = whrandom.randint(kMinimumTimeBetweenSpawns, kMaximumTimeBetweenSpawns) + newTime = spawnTimes[-1] + randnum + if newTime < endOfToday: + print "payiUrwinBrain: Generated a valid spawn time: %d" % (newTime) + spawnTimes.append(newTime) + else: + print "payiUrwinBrain: Generated a spawn time after dusk, exiting loop: %d" % (newTime) + break + else: + print "payiUrwinBrain:ERROR---Tried to add a spawn time that's not a number: " , spawnTimes + spawnTimes = [0] + + while len(spawnTimes) < 20: + spawnTimes.append(0) + + ageSDL["UrwinSpawnTimes"] = tuple(spawnTimes) + + ########################### + def SetUrwinTimers(self): + PtClearTimerCallbacks(self.key) + ageSDL = PtGetAgeSDL() + if ageSDL["UrwinSpawnTimes"][0]: + for timer in ageSDL["UrwinSpawnTimes"]: + if timer: + timeTillSpawn = timer - PtGetDniTime() + print "timer: %d time: %d timeTillSpawn: %d" % (timer,PtGetDniTime(),timeTillSpawn) + if timeTillSpawn > 0: + print "payiUrwinBrain: Setting timer for %d seconds" % (timeTillSpawn) + PtAtTimeCallback(self.key, timeTillSpawn, 1) + + # precision error FTW! + timeLeftToday = kDayLengthInSeconds - int(PtGetAgeTimeOfDayPercent() * kDayLengthInSeconds) + timeLeftToday += 1 # because we want it to go off right AFTER the day flips + print "payiUrwinBrain: Setting EndOfDay timer for %d seconds" % (timeLeftToday) + PtAtTimeCallback(self.key, timeLeftToday, 2) + else: + print "payiUrwinBrain: Timer array was empty!" + + ########################### + def OnBackdoorMsg(self, target, param): + global kMinimumTimeBetweenSpawns + global kMaximumTimeBetweenSpawns + global kFirstMorningSpawn + + ageSDL = PtGetAgeSDL() + if target == "urwin": + if self.sceneobject.isLocallyOwned(): + print "payiUrwinBrain.OnBackdoorMsg: Backdoor!" + if param == "walk": + ageSDL["UrwinOnTheProwl"] = (1,) + if ageSDL["payiPodLights"][0]: + PtAtTimeCallback(self.key, 1, 1) + else: + self.StartToWalk() + + elif param == "restore": + kMinimumTimeBetweenSpawns = 3600 # 1 hour + kMaximumTimeBetweenSpawns = 25200 # 7 hours + kFirstMorningSpawn = 445 + self.InitNewSDLVars() + + elif type(param) == type(""): + newTimes = param.split(";") + kMinimumTimeBetweenSpawns = int(newTimes[0]) + kMaximumTimeBetweenSpawns = int(newTimes[1]) + kFirstMorningSpawn = 1 + self.InitNewSDLVars() + diff --git a/Python/philBookshelf.py b/Python/philBookshelf.py new file mode 100644 index 0000000000..61407277eb --- /dev/null +++ b/Python/philBookshelf.py @@ -0,0 +1,184 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: philBookshelf +Age: PhilRelto +Date: January 2004 +Author: Adam Van Ornum +This handles the bookshelf in phil's personal age...only the neighborhood book does anything +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +import PlasmaControlKeys + +actBookshelf = ptAttribActivator(1, "Actvtr:Bookshelf") + +actBook = ptAttribActivator(2,"Actvtr:Book") +respPresentBook = ptAttribResponder(3,"Rspndr:PresentBook") +respShelveBook = ptAttribResponder(4,"Rspndr:ShelveBook") + +SeekBehavior = ptAttribBehavior(5, "Smart seek before GUI") # used to make user walk in front of shelf before using it +ShelfCamera = ptAttribSceneobject(6,"Bookshelf camera") # the camera used when engaging the shelf +HutCamera = ptAttribSceneobject(7,"Hut circle camera") # the camera which was used before engaging the shelf +actBookshelfExit = ptAttribActivator(8, "Actvr: Exit bookshelf") +respLinkOut = ptAttribResponder(9, "Resp: link out") +respMoveShelf = ptAttribResponder(10, "Resp: move shelf", ["raise", "lower"]) + +theBook = None +LocalAvatar = None + + +class philBookshelf(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5327 + self.version = 1 + print "__init__philBookshelf v.", self.version + + + def OnServerInitComplete(self): + global LocalAvatar + + respMoveShelf.run(self.key, state = "lower", fastforward = 1) + actBookshelfExit.disable() + + LocalAvatar = PtGetLocalAvatar() + + + def OnNotify(self,state,id,events): + print "notified: state = %d, id = %d" % (state,id) + + if id == actBookshelfExit.id: + self.IDisengageShelf() + return + + if id == SeekBehavior.id: + for event in events: + avatar = PtFindAvatar(events) + if event[0] == kMultiStageEvent and event[1] == 0 and LocalAvatar == avatar: # Smart seek completed. Exit multistage, and show GUI. + SeekBehavior.gotoStage(avatar, -1) + print "philBookshelf.OnNotify():\tengaging bookshelf" + avatar.draw.disable() + # set camera to Shelf Camera + virtCam = ptCamera() + virtCam.save(ShelfCamera.sceneobject.getKey()) + + PtAtTimeCallback(self.key, .1, 1) + + if id == actBookshelf.id and state: + respMoveShelf.run(self.key, state = "raise", fastforward = 1) + avatar = PtFindAvatar(events) + if LocalAvatar == avatar: + # disable blackbar so people can't bring up other + PtSendKIMessage(kDisableKIandBB,0) + # Disable First Person Camera + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + PtRecenterCamera() + SeekBehavior.run(avatar) + PtDisableMovementKeys() + + elif id == actBook.id and state: + actBook.disable() + respPresentBook.run(self.key) + + elif id == respPresentBook.id: + global theBook + + # book is finished presenting - now link + bookcode = '' + + theBook = ptBook(bookcode, self.key) + theBook.setGUI("BkBook") + theBook.setSize(1.0, 1.0) + theBook.show(1) + + elif id == respShelveBook.id: + actBook.enable() + + else: + for event in events: + if event[0] == PtEventType.kBook: + PtDebugPrint("philBookshelf: BookNotify event=%d, id=%d" % (event[1],event[2])) + if event[1] == PtBookEventTypes.kNotifyImageLink: + if event[2] >= 0: + PtDebugPrint("philBookshelf:Book: hit linking panel %s" % (event[2])) + theBook.hide() + #respShelveBook.run(self.key) + self.IDisengageShelf() + respLinkOut.run(self.key) + + elif event[1] == PtBookEventTypes.kNotifyHide: + PtDebugPrint("philBookshelf:Book: NotifyHide") + + respShelveBook.run(self.key) + + + def IDisengageShelf(self): + LocalAvatar.draw.enable() + #reeneable first person + cam = ptCamera() + cam.enableFirstPersonOverride() + # go back to the Hut Circle Cam + virtCam = ptCamera() + virtCam.save(HutCamera.sceneobject.getKey()) + PtEnableMovementKeys() + actBookshelfExit.disable() + PtGetControlEvents(false,self.key) + + PtSendKIMessage(kEnableKIandBB,0) + respMoveShelf.run(self.key, state = "lower", fastforward = 1) + + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode or controlKey == PlasmaControlKeys.kKeyMoveBackward: + self.IDisengageShelf() + + + def OnTimer(self, id): + if id == 1: + PtGetControlEvents(true,self.key) + actBookshelfExit.enable() + + + def OnBackdoorMsg(self, target, param): + if target == 'book': + if param == 'enable': + actBook.enable() + elif param == 'disable': + actBook.disable() + + elif target == 'shelf': + if param == 'enable': + actBookshelf.enable() + actBookshelf.value[0].getSceneObject().physics.suppress(0) + elif param == 'disable': + actBookshelf.disable() + actBookshelf.value[0].getSceneObject().physics.suppress(1) + diff --git a/Python/plasma/Plasma.py b/Python/plasma/Plasma.py new file mode 100644 index 0000000000..65bced2523 --- /dev/null +++ b/Python/plasma/Plasma.py @@ -0,0 +1,9803 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +def PtAcceptInviteInGame(friendName,inviteKey): + """Sends a VaultTask to the server to perform the invite""" + pass + +def PtAmCCR(): + """Returns true if local player is a CCR""" + pass + +def PtAtTimeCallback(selfkey,time,id): + """This will create a timer callback that will call OnTimer when complete +- 'selfkey' is the ptKey of the PythonFile component +- 'time' is how much time from now (in seconds) to call back +- 'id' is an integer id that will be returned in the OnTimer call""" + pass + +def PtAttachObject(child,parent): + """Attach child to parent based on ptKey or ptSceneobject +- childKey is the ptKey or ptSceneobject of the one being attached +- parentKey is the ptKey or ptSceneobject of the one being attached to +(both arguments must be ptKeys or ptSceneobjects, you cannot mix types)""" + pass + +def PtAvatarEnterAFK(): + """Tells the local avatar to enter AwayFromKeyboard idle loop (netpropagated)""" + pass + +def PtAvatarEnterLookingAtKI(): + """Tells the local avatar to enter looking at KI idle loop (netpropagated)""" + pass + +def PtAvatarEnterUsePersBook(): + """Tells the local avatar to enter using their personal book idle loop (netpropagated)""" + pass + +def PtAvatarExitAFK(): + """Tells the local avatar to exit AwayFromKeyboard idle loop (netpropagated)""" + pass + +def PtAvatarExitLookingAtKI(): + """Tells the local avatar to exit looking at KI idle loop (netpropagated)""" + pass + +def PtAvatarExitUsePersBook(): + """Tells the local avatar to exit using their personal book idle loop (netpropagated)""" + pass + +def PtAvatarSitOnGround(): + """Tells the local avatar to sit on ground and enter sit idle loop (netpropagated)""" + pass + +def PtAvatarSpawnNext(): + """Send the avatar to the next spawn point""" + pass + +def PtCanShadowCast(): + """Can we cast shadows?""" + pass + +def PtChangeAvatar(gender): + """Change the local avatar's gender (or clothing type)""" + pass + +def PtChangePassword(password): + """Changes the current account's password""" + pass + +def PtChangePlayerName(name): + """Change the local avatar's name""" + pass + +def PtCheckVisLOS(startPoint,endPoint): + """Does LOS check from start to end""" + pass + +def PtCheckVisLOSFromCursor(): + """Does LOS check from where the mouse cursor is, into the screen""" + pass + +def PtClearCameraStack(): + """clears all cameras""" + pass + +def PtClearOfferBookMode(): + """Cancel the offer book interface""" + pass + +def PtClearPrivateChatList(memberKey): + """Remove the local avatar from private vox messaging, and / or clear members from his chat list""" + pass + +def PtClearTimerCallbacks(key): + """This will remove timer callbacks to the specified key""" + pass + +def PtConsole(command): + """This will execute 'command' as if it were typed into the Plasma console.""" + pass + +def PtConsoleNet(command,netForce): + """This will execute 'command' on the console, over the network, on all clients. +If 'netForce' is true then force command to be sent over the network.""" + pass + +def PtCreateDir(directory): + """Creates the directory and all parent folders. Returns false on failure""" + pass + +def PtCreatePlayer(playerName, avatarShape, invitation): + """Creates a new player""" + pass + +def PtCreatePlayerW(playerName, avatarShape, invitation): + """Unicode version of PtCreatePlayer""" + pass + +def PtCreatePublicAge(ageInfo, cbObject=None): + """Create a public instance of the given age. +cbObject, if supplied should have a member called publicAgeCreated(self,ageInfo)""" + pass + +def PtDebugAssert(cond, msg): + """Debug only: Assert if condition is false.""" + pass + +def PtDeletePlayer(playerInt): + """Deletes a player associated with the current account""" + pass + +def PtDetachObject(child,parent): + """Detach child from parent based on ptKey or ptSceneobject +- child is the ptKey or ptSceneobject of the one being detached +- parent is the ptKey or ptSceneobject of the one being detached from +(both arguments must be ptKeys or ptSceneobjects, you cannot mix types)""" + pass + +def PtDirtySynchClients(selfKey,SDLStateName,flags): + """DO NOT USE - handled by ptSDL""" + pass + +def PtDirtySynchState(selfKey,SDLStateName,flags): + """DO NOT USE - handled by ptSDL""" + pass + +def PtDisableAvatarCursorFade(): + """Disable the avatar cursor fade""" + pass + +def PtDisableAvatarJump(): + """Disable the ability of the avatar to jump""" + pass + +def PtDisableControlKeyEvents(selfKey): + """Disable the control key events from calling OnControlKeyEvent""" + pass + +def PtDisableForwardMovement(): + """Disable the ability of the avatar to move forward""" + pass + +def PtDisableMouseMovement(): + """Disable avatar mouse movement input""" + pass + +def PtDisableMovementKeys(): + """Disable avatar movement input""" + pass + +def PtDisableRenderScene(): + """UNKNOWN""" + pass + +def PtDisableShadows(): + """Turns shadows off""" + pass + +def PtDumpLogs(folder): + """Dumps all current log files to the specified folder (a sub-folder to the log folder)""" + pass + +def PtEmoteAvatar(emote): + """Play an emote on the local avatar (netpropagated)""" + pass + +def PtEnableAvatarCursorFade(): + """Enable the avatar cursor fade""" + pass + +def PtEnableAvatarJump(): + """Enable the ability of the avatar to jump""" + pass + +def PtEnableControlKeyEvents(selfKey): + """Enable control key events to call OnControlKeyEvent(controlKey,activateFlag)""" + pass + +def PtEnableForwardMovement(): + """Enable the ability of the avatar to move forward""" + pass + +def PtEnableMouseMovement(): + """Enable avatar mouse movement input""" + pass + +def PtEnableMovementKeys(): + """Enable avatar movement input""" + pass + +def PtEnablePlanarReflections(on): + """Enables/disables planar reflections""" + pass + +def PtEnableRenderScene(): + """UNKNOWN""" + pass + +def PtEnableShadows(): + """Turns shadows on""" + pass + +def PtExcludeRegionSet(senderKey,regionKey,state): + """This will set the state of an exclude region +- 'senderKey' is a ptKey of the PythonFile component +- 'regionKey' is a ptKey of the exclude region +- 'state' is either kExRegRelease or kExRegClear""" + pass + +def PtExcludeRegionSetNow(senderKey,regionKey,state): + """This will set the state of an exclude region immediately on the server +- 'senderKey' is a ptKey of the PythonFile component +- 'regionKey' is a ptKey of the exclude region +- 'state' is either kExRegRelease or kExRegClear""" + pass + +def PtFadeIn(lenTime, holdFlag, noSound=0): + """Fades screen in for lenTime seconds""" + pass + +def PtFadeLocalAvatar(fade): + """Fade (or unfade) the local avatar""" + pass + +def PtFadeOut(lenTime, holdFlag, noSound=0): + """Fades screen out for lenTime seconds""" + pass + +def PtFakeLinkAvatarToObject(avatar,object): + """Pseudo-links avatar to object within the same age +""" + pass + +def PtFileExists(filename): + """Returns true if the specified file exists""" + pass + +def PtFindSceneobject(name,ageName): + """This will try to find a sceneobject based on its name and what age its in +- it will return a ptSceneObject if found- if not found then a NameError exception will happen""" + pass + +def PtFirstPerson(): + """is the local avatar in first person mode""" + pass + +def PtFogSetDefColor(color): + """Sets default fog color""" + pass + +def PtFogSetDefExp(end,density): + """Set exp fog values""" + pass + +def PtFogSetDefExp2(end,density): + """Set exp2 fog values""" + pass + +def PtFogSetDefLinear(start,end,density): + """Set linear fog values""" + pass + +def PtForceCursorHidden(): + """Forces the cursor to hide, overriding everything. +Only call if other methods won't work. The only way to show the cursor after this call is PtForceMouseShown()""" + pass + +def PtForceCursorShown(): + """Forces the cursor to show, overriding everything. +Only call if other methods won't work. This is the only way to show the cursor after a call to PtForceMouseHidden()""" + pass + +def PtGMTtoDniTime(gtime): + """Converts GMT time (passed in) to D'Ni time""" + pass + +def PtGUICursorDimmed(): + """Dimms the GUI cursor""" + pass + +def PtGUICursorOff(): + """Turns the GUI cursor off""" + pass + +def PtGUICursorOn(): + """Turns the GUI cursor on""" + pass + +def PtGetAccountName(): + """Returns the account name for the current account""" + pass + +def PtGetAccountPlayerList(): + """Returns list of players associated with the current account""" + pass + +def PtGetAgeInfo(): + """Returns ptAgeInfoStruct of the current Age""" + pass + +def PtGetAgeName(): + """DEPRECIATED - use ptDniInfoSource instead""" + pass + +def PtGetAgeSDL(): + """Returns the global ptSDL for the current Age""" + pass + +def PtGetAgeTime(): + """DEPRECIATED - use ptDniInfoSource instead""" + pass + +def PtGetAgeTimeOfDayPercent(): + """Returns the current age time of day as a percent (0 to 1)""" + pass + +def PtGetAvatarKeyFromClientID(clientID): + """From an integer that is the clientID, find the avatar and return its ptKey""" + pass + +def PtGetCameraNumber(x): + """Returns camera x's name from stack""" + pass + +def PtGetClientIDFromAvatarKey(avatarKey): + """From a ptKey that points at an avatar, return the players clientID (integer)""" + pass + +def PtGetClientName(avatarKey=None): + """This will return the name of the client that is owned by the avatar +- avatarKey is the ptKey of the avatar to get the client name of. +If avatarKey is omitted then the local avatar is used""" + pass + +def PtGetControlEvents(on, key): + """Registers or unregisters for control event messages""" + pass + +def PtGetDefaultDisplayParams(): + """Returns the default resolution and display settings""" + pass + +def PtGetDefaultSpawnPoint(): + """Returns the default spawnpoint definition (as a ptSpawnPointInfo)""" + pass + +def PtGetDesktopColorDepth(): + """Returns desktop ColorDepth""" + pass + +def PtGetDesktopHeight(): + """Returns desktop height""" + pass + +def PtGetDesktopWidth(): + """Returns desktop width""" + pass + +def PtGetDialogFromString(dialogName): + """Get a ptGUIDialog from its name""" + pass + +def PtGetDialogFromTagID(tagID): + """Returns the dialog associated with the tagID""" + pass + +def PtGetDniTime(): + """Returns current D'Ni time""" + pass + +def PtGetFrameDeltaTime(): + """Returns the amount of time that has elapsed since last frame.""" + pass + +def PtGetGameTime(): + """Returns the system game time (frame based) in seconds.""" + pass + +def PtGetInitPath(): + """Returns the unicode path to the client's init directory. Do NOT convert to a standard string.""" + pass + +def PtGetLanguage(): + """Returns the current language as a PtLanguage enum""" + pass + +def PtGetLocalAvatar(): + """This will return a ptSceneobject of the local avatar +- if there is no local avatar a NameError exception will happen.""" + pass + +def PtGetLocalClientID(): + """Returns our local client ID number""" + pass + +def PtGetLocalKILevel(): + """returns local player's ki level""" + pass + +def PtGetLocalPlayer(): + """Returns a ptPlayer object of the local player""" + pass + +def PtGetLocalizedString(name, arguments=None): + """Returns the localized string specified by name (format is Age.Set.Name) and substitutes the arguments in the list of strings passed in as arguments.""" + pass + +def PtGetMouseTurnSensitivity(): + """Returns the sensitivity""" + pass + +def PtGetNumCameras(): + """returns camera stack size""" + pass + +def PtGetNumParticles(key): + """Key is the key of scene object host to particle system""" + pass + +def PtGetNumRemotePlayers(): + """Returns the number of remote players in this Age with you.""" + pass + +def PtGetPlayerList(): + """Returns a list of ptPlayer objects of all the remote players""" + pass + +def PtGetPlayerListDistanceSorted(): + """Returns a list of ptPlayers, sorted by distance""" + pass + +def PtGetPrevAgeInfo(): + """Returns ptAgeInfoStruct of previous age visited""" + pass + +def PtGetPrevAgeName(): + """Returns filename of previous age visited""" + pass + +def PtGetPublicAgeList(ageName, cbObject=None): + """Get list of public ages for the given age name. +cbObject, if supplied should have a method called gotPublicAgeList(self,ageList). ageList is a list of tuple(ptAgeInfoStruct,nPlayersInAge)""" + pass + +def PtGetPythonLoggingLevel(): + """Returns the current level of python logging""" + pass + +def PtGetServerTime(): + """Returns the current time on the server (which is GMT)""" + pass + +def PtGetShadowVisDistance(): + """Returns the maximum shadow visibility distance""" + pass + +def PtGetSupportedDisplayModes(): + """Returns a list of supported resolutions""" + pass + +def PtGetTime(): + """Returns the number of seconds since the game was started.""" + pass + +def PtGetUserPath(): + """Returns the unicode path to the client's root user directory. Do NOT convert to a standard string.""" + pass + +def PtHideDialog(dialogName): + """Hide a GUI dialog by name (does not unload dialog)""" + pass + +def PtIsActivePlayerSet(): + """Returns whether or not an active player is set""" + pass + +def PtIsCCRAway(): + """Returns current status of CCR dept""" + pass + +def PtIsClickToTurn(): + """Is click-to-turn on?""" + pass + +def PtIsCurrentBrainHuman(): + """Returns whether the local avatar current brain is the human brain""" + pass + +def PtIsDemoMode(): + """Returns whether the game is in Demo mode or not""" + pass + +def PtIsDialogLoaded(dialogName): + """Test to see if a GUI dialog is loaded, by name""" + pass + +def PtIsEnterChatModeKeyBound(): + """Returns whether the EnterChatMode is bound to a key""" + pass + +def PtIsGUIModal(): + """Returns true if the GUI is displaying a modal dialog and blocking input""" + pass + +def PtIsInternalRelease(): + """Returns whether the client is an internal build or not""" + pass + +def PtIsMouseInverted(): + """Is the mouse currently inverted?""" + pass + +def PtIsShadowsEnabled(): + """Returns whether shadows are currently turned on""" + pass + +def PtIsSinglePlayerMode(): + """Returns whether the game is in single player mode or not""" + pass + +def PtIsSubscriptionActive(): + """Returns true if the current player is a paying subscriber""" + pass + +def PtKillParticles(timeRemaining,pctToKill,particleSystem): + """Tells particleSystem to kill pctToKill percent of its particles""" + pass + +def PtLimitAvatarLOD(LODlimit): + """Sets avatar's LOD limit""" + pass + +def PtLoadAvatarModel(modelName, spawnPoint, userStr = ""): + """Loads an avatar model at the given spawn point. Assigns the user specified string to it.""" + pass + +def PtLoadBookGUI(guiName): + """Loads the gui specified, a gui must be loaded before it can be used. If the gui is already loaded, doesn't do anything""" + pass + +def PtLoadDialog(dialogName,selfKey=None,ageName=""): + """Loads a GUI dialog by name and optionally set the Notify proc key +If the dialog is already loaded then it won't load it again""" + pass + +def PtLoadJPEGFromDisk(filename,width,height): + """The image will be resized to fit the width and height arguments. Set to 0 if resizing is not desired. +Returns a pyImage of the specified file.""" + pass + +def PtLocalAvatarIsMoving(): + """Returns true if the local avatar is moving (a movement key is held down)""" + pass + +def PtLocalAvatarRunKeyDown(): + """Returns true if the run key is being held down for the local avatar""" + pass + +def PtMaxListenDistSq(): + """Returns the maximum distance (squared) of the listen range""" + pass + +def PtMaxListenListSize(): + """Returns the maximum listen number of players""" + pass + +def PtNotifyOffererLinkAccepted(offerer): + """Tell the offerer that we accepted the link offer""" + pass + +def PtNotifyOffererLinkCompleted(offerer): + """Tell the offerer that we completed the link""" + pass + +def PtNotifyOffererLinkRejected(offerer): + """Tell the offerer that we rejected the link offer""" + pass + +def PtPageInNode(nodeName, ageName=""): + """Pages in node, or a list of nodes""" + pass + +def PtPageOutNode(nodeName): + """Pages out a node""" + pass + +def PtPrintToScreen(message): + """Prints 'message' to the status log, for debug only.""" + pass + +def PtRateIt(chronicleName,dialogPrompt,onceFlag): + """Shows a dialog with dialogPrompt and stores user input rating into chronicleName""" + pass + +def PtRebuildCameraStack(name,ageName): + """Push camera with this name on the stack""" + pass + +def PtRecenterCamera(): + """re-centers the camera""" + pass + +def PtRemovePublicAge(ageInstanceGuid, cbObject=None): + """Remove a public instance of the given age. +cbObject, if supplied should have a member called publicAgeRemoved(self,ageInstanceGuid)""" + pass + +def PtRequestLOSScreen(selfKey,ID,xPos,yPos,distance,what,reportType): + """Request a LOS check from a point on the screen""" + pass + +def PtSaveScreenShot(fileName,width=640,height=480,quality=75): + """Takes a screenshot with the specified filename, size, and quality""" + pass + +def PtSendChatToCCR(message,CCRPlayerID): + """Sends a chat message to a CCR that has contacted this player""" + pass + +def PtSendKIGZMarkerMsg(markerNumber,sender): + """Same as PtSendKIMessageInt except 'sender' could get a notify message back +""" + pass + +def PtSendKIMessage(command,value): + """Sends a command message to the KI frontend. +See PlasmaKITypes.py for list of commands""" + pass + +def PtSendKIMessageInt(command,value): + """Same as PtSendKIMessage except the value is guaranteed to be a UInt32 +(for things like player IDs)""" + pass + +def PtSendPetitionToCCR(message,reason=0,title=""): + """Sends a petition with a message to the CCR group""" + pass + +def PtSendPrivateChatList(chatList): + """Lock the local avatar into private vox messaging, and / or add new members to his chat list""" + pass + +def PtSendRTChat(fromPlayer,toPlayerList,message,flags): + """Sends a realtime chat message to the list of ptPlayers +If toPlayerList is an empty list, it is a broadcast message""" + pass + +def PtSetActivePlayer(playerInt): + """Sets the active player associated with the current account""" + pass + +def PtSetAlarm(secs, cbObject, cbContext): + """secs is the amount of time before your alarm goes off. +cbObject is a python object with the method onAlarm(int context) +cbContext is an integer.""" + pass + +def PtSetBehaviorLoopCount(behaviorKey,stage,loopCount,netForce): + """This will set the loop count for a particular stage in a multistage behavior""" + pass + +def PtSetBehaviorNetFlags(behKey, netForce, netProp): + """Sets net flags on the associated behavior""" + pass + +def PtSetClearColor(red,green,blue): + """Set the clear color""" + pass + +def PtSetClickToTurn(state): + """Turns on click-to-turn""" + pass + +def PtSetGamma2(gamma): + """Set the gamma with gamma2 rules""" + pass + +def PtSetGlobalClickability(enable): + """Enable or disable all clickables on the local client""" + pass + +def PtSetGraphicsOptions(width, height, colordepth, windowed, numAAsamples, numAnisoSamples, VSync): + """Set the graphics options""" + pass + +def PtSetLightAnimStart(key,name,start): + """ Key is the key of scene object host to light, start is a bool. Name is the name of the light to manipulate""" + pass + +def PtSetLightValue(key,name,r,g,b,a): + """ Key is the key of scene object host to light. Name is the name of the light to manipulate""" + pass + +def PtSetMouseInverted(): + """Inverts the mouse""" + pass + +def PtSetMouseTurnSensitivity(sensitivity): + """Set the mouse sensitivity""" + pass + +def PtSetMouseUninverted(): + """Uninverts the mouse""" + pass + +def PtSetOfferBookMode(selfkey,ageFilename,ageInstanceName): + """Put us into the offer book interface""" + pass + +def PtSetParticleDissentPoint(x, y, z, particlesys): + """Sets the dissent point of the particlesys to x,y,z""" + pass + +def PtSetParticleOffset(x,y,z,particlesys): + """Sets the particlesys particle system's offset""" + pass + +def PtSetPythonLoggingLevel(level): + """Sets the current level of python logging""" + pass + +def PtSetShadowVisDistance(distance): + """Set the maximum shadow visibility distance""" + pass + +def PtSetShareSpawnPoint(spawnPoint): + """This sets the desired spawn point for the receiver to link to""" + pass + +def PtShootBulletFromObject(selfkey, gunObj, radius, range): + """Shoots a bullet from an object""" + pass + +def PtShootBulletFromScreen(selfkey, xPos, yPos, radius, range): + """Shoots a bullet from a position on the screen""" + pass + +def PtShowDialog(dialogName): + """Show a GUI dialog by name (does not load dialog)""" + pass + +def PtStartScreenCapture(selfKey,width=800,height=600): + """Starts a capture of the screen""" + pass + +def PtToggleAvatarClickability(on): + """Turns on and off our avatar's clickability""" + pass + +def PtTransferParticlesToObject(objFrom, objTo, num): + """Transfers num particles from objFrom to objTo""" + pass + +def PtUnLoadAvatarModel(avatarKey): + """Unloads the specified avatar model""" + pass + +def PtUnloadAllBookGUIs(): + """Unloads all loaded guis except for the default one""" + pass + +def PtUnloadBookGUI(guiName): + """Unloads the gui specified. If the gui isn't loaded, doesn't do anything""" + pass + +def PtUnloadDialog(dialogName): + """This will unload the GUI dialog by name. If not loaded then nothing will happen""" + pass + +def PtUpgradeVisitorToExplorer(playerInt): + """Upgrades the player to explorer status""" + pass + +def PtUsingUnicode(): + """Returns true if the current language is a unicode language (like Japanese)""" + pass + +def PtValidateKey(key): + """Returns true(1) if 'key' is valid and loaded, +otherwise returns false(0)""" + pass + +def PtWasLocallyNotified(selfKey): + """Returns 1 if the last notify was local or 0 if the notify originated on the network""" + pass + +def PtWearDefaultClothing(key): + """Forces the avatar to wear the default clothing set""" + pass + +def PtWearDefaultClothingType(key,type): + """Forces the avatar to wear the default clothing of the specified type""" + pass + +def PtWearMaintainerSuit(key,wearOrNot): + """Wears or removes the maintainer suit of clothes""" + pass + +def PtWhatGUIControlType(guiKey): + """Returns the control type of the key passed in""" + pass + +def PtYesNoDialog(selfkey,dialogMessage): + """This will display a Yes/No dialog to the user with the text dialogMessage +This dialog _has_ to be answered by the user. +And their answer will be returned in a Notify message.""" + pass + +class ptAgeInfoStruct: + """Class to hold AgeInfo struct data""" + def __init__(self): + """None""" + pass + + def copyFrom(self,other): + """Copies data from one ptAgeInfoStruct or ptAgeInfoStructRef to this one""" + pass + + def getAgeFilename(self): + """Gets the Age's filename""" + pass + + def getAgeInstanceGuid(self): + """Get the Age's instance GUID""" + pass + + def getAgeInstanceName(self): + """Get the instance name of the Age""" + pass + + def getAgeLanguage(self): + """Gets the age's language (integer)""" + pass + + def getAgeSequenceNumber(self): + """Gets the unique sequence number""" + pass + + def getAgeUserDefinedName(self): + """Gets the user defined part of the Age name""" + pass + + def getDisplayName(self): + """Returns a string that is the displayable name of the age instance""" + pass + + def setAgeFilename(self,filename): + """Sets the filename of the Age""" + pass + + def setAgeInstanceGuid(self,guid): + """Sets the Age instance's GUID""" + pass + + def setAgeInstanceName(self,instanceName): + """Sets the instance name of the Age""" + pass + + def setAgeLanguage(self,lang): + """Sets the age's language (integer)""" + pass + + def setAgeSequenceNumber(self,seqNumber): + """Sets the unique sequence number""" + pass + + def setAgeUserDefinedName(self,udName): + """Sets the user defined part of the Age""" + pass + +class ptAgeInfoStructRef: + """Class to hold AgeInfo struct data""" + def __init__(self): + """None""" + pass + + def copyFrom(self,other): + """Copies data from one ptAgeInfoStruct or ptAgeInfoStructRef to this one""" + pass + + def getAgeFilename(self): + """Gets the Age's filename""" + pass + + def getAgeInstanceGuid(self): + """Get the Age's instance GUID""" + pass + + def getAgeInstanceName(self): + """Get the instance name of the Age""" + pass + + def getAgeSequenceNumber(self): + """Gets the unique sequence number""" + pass + + def getAgeUserDefinedName(self): + """Gets the user defined part of the Age name""" + pass + + def getDisplayName(self): + """Returns a string that is the displayable name of the age instance""" + pass + + def setAgeFilename(self,filename): + """Sets the filename of the Age""" + pass + + def setAgeInstanceGuid(self,guid): + """Sets the Age instance's GUID""" + pass + + def setAgeInstanceName(self,instanceName): + """Sets the instance name of the Age""" + pass + + def setAgeSequenceNumber(self,seqNumber): + """Sets the unique sequence number""" + pass + + def setAgeUserDefinedName(self,udName): + """Sets the user defined part of the Age""" + pass + +class ptAgeLinkStruct: + """Class to hold the data of the AgeLink structure""" + def __init__(self): + """None""" + pass + + def copyFrom(self,other): + """Copies data from one ptAgeLinkStruct or ptAgeLinkStructRef to this one""" + pass + + def getAgeInfo(self): + """Returns a ptAgeInfoStructRef of the AgeInfo for this link""" + pass + + def getLinkingRules(self): + """Returns the linking rules of this link""" + pass + + def getParentAgeFilename(self): + """Returns a string of the parent age filename""" + pass + + def getSpawnPoint(self): + """Gets the spawn point ptSpawnPointInfoRef of this link""" + pass + + def setAgeInfo(self,ageInfo): + """Sets the AgeInfoStruct from the data in ageInfo (a ptAgeInfoStruct)""" + pass + + def setLinkingRules(self,rule): + """Sets the linking rules for this link""" + pass + + def setParentAgeFilename(self,filename): + """Sets the parent age filename for child age links""" + pass + + def setSpawnPoint(self,spawnPtInfo): + """Sets the spawn point of this link (a ptSpawnPointInfo or ptSpawnPointInfoRef)""" + pass + +class ptAgeLinkStructRef: + """Class to hold the data of the AgeLink structure""" + def __init__(self): + """None""" + pass + + def copyFrom(self,other): + """Copies data from one ptAgeLinkStruct or ptAgeLinkStructRef to this one""" + pass + + def getAgeInfo(self): + """Returns a ptAgeInfoStructRef of the AgeInfo for this link""" + pass + + def getLinkingRules(self): + """Returns the linking rules of this link""" + pass + + def getSpawnPoint(self): + """Gets the spawn point ptSpawnPointInfoRef of this link""" + pass + + def setAgeInfo(self,ageInfo): + """Sets the AgeInfoStruct from the data in ageInfo (a ptAgeInfoStruct)""" + pass + + def setLinkingRules(self,rule): + """Sets the linking rules for this link""" + pass + + def setSpawnPoint(self,spawnPtInfo): + """Sets the spawn point of this link (a ptSpawnPointInfo or ptSpawnPointInfoRef)""" + pass + +class ptAgeVault: + """Accessor class to the Age's vault""" + def __init__(self): + """None""" + pass + + def addChronicleEntry(self,name,type,value): + """Adds a chronicle entry with the specified type and value""" + pass + + def addDevice(self,deviceName,cb=None,cbContext=0): + """Adds a device to the age""" + pass + + def findChronicleEntry(self,entryName): + """Returns the named ptVaultChronicleNode""" + pass + + def getAgeDevicesFolder(self): + """Returns a ptVaultFolderNode of the inboxes for the devices in this Age.""" + pass + + def getAgeGuid(self): + """Returns the current Age's guid as a string.""" + pass + + def getAgeInfo(self): + """Returns a ptVaultAgeInfoNode of the this Age""" + pass + + def getAgeSDL(self): + """Returns the age's SDL (ptSDLStateDataRecord)""" + pass + + def getAgesIOwnFolder(self): + """(depreciated, use getBookshelfFolder) Returns a ptVaultFolderNode that contain the Ages I own""" + pass + + def getBookshelfFolder(self): + """Personal age only: Returns a ptVaultFolderNode that contains the owning player's AgesIOwn age list""" + pass + + def getChronicleFolder(self): + """Returns a ptVaultFolderNode""" + pass + + def getDevice(self,deviceName): + """Returns the specified device (ptVaultTextNoteNode)""" + pass + + def getDeviceInbox(self,deviceName): + """Returns a ptVaultFolderNode of the inbox for the named device in this age.""" + pass + + def getPeopleIKnowAboutFolder(self): + """Returns a ptVaultPlayerInfoListNode of the players the Age knows about(?).""" + pass + + def getPublicAgesFolder(self): + """Returns a ptVaultFolderNode that contains all the public Ages""" + pass + + def getSubAgeLink(self,ageInfo): + """Returns a ptVaultAgeLinkNode to 'ageInfo' (a ptAgeInfoStruct) for this Age.""" + pass + + def getSubAgesFolder(self): + """Returns a ptVaultFolderNode of sub Age's folder.""" + pass + + def hasDevice(self,deviceName): + """Does a device with this name exist?""" + pass + + def removeDevice(self,deviceName): + """Removes a device from the age""" + pass + + def setDeviceInbox(self,deviceName,inboxName,cb=None,cbContext=0): + """Set's the device's inbox""" + pass + + def updateAgeSDL(self,pyrec): + """Updates the age's SDL""" + pass + +class ptAnimation: + """Plasma animation class""" + def __init__(self,key=None): + """None""" + pass + + def addKey(self,key): + """Adds an animation modifier to the list of receiver keys""" + pass + + def backwards(self,backwardsFlag): + """Turn on and off playing the animation backwards""" + pass + + def getFirstKey(self): + """This will return a ptKey object that is the first receiver (target) +However, if the parent is not a modifier or not loaded, then None is returned.""" + pass + + def incrementBackward(self): + """Step the animation backward a frame""" + pass + + def incrementForward(self): + """Step the animation forward a frame""" + pass + + def looped(self,loopedFlag): + """Turn on and off looping of the animation""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object""" + pass + + def play(self): + """Plays the animation""" + pass + + def playRange(self,start,end): + """Play the animation from start to end""" + pass + + def playToPercentage(self,zeroToOne): + """Play the animation to the specified percentage (0 to 1)""" + pass + + def playToTime(self,time): + """Play the animation to the specified time""" + pass + + def resume(self): + """Resumes the animation from where it was stopped last""" + pass + + def sender(self,selfKey): + """Sets the sender of the messages being sent to the animation modifier""" + pass + + def setAnimName(self,name): + """Sets the animation notetrack name (or (Entire Animation))""" + pass + + def setLoopEnd(self,loopEnd): + """Sets the loop ending position +- 'loopEnd' is the number of seconds from the absolute beginning of the animation""" + pass + + def setLoopStart(self,loopStart): + """Sets the loop starting position +- 'loopStart' is the number of seconds from the absolute beginning of the animation""" + pass + + def skipToBegin(self): + """Skip to the beginning of the animation (don't play)""" + pass + + def skipToEnd(self): + """Skip to the end of the animation (don't play)""" + pass + + def skipToLoopBegin(self): + """Skip to the beginning of the animation loop (don't play)""" + pass + + def skipToLoopEnd(self): + """Skip to the end of the animation loop (don't play)""" + pass + + def skipToTime(self,time): + """Skip the animation to time (don't play)""" + pass + + def speed(self,speed): + """Sets the animation playback speed""" + pass + + def stop(self): + """Stops the animation""" + pass + +class ptAudioControl: + """Accessor class to the Audio controls""" + def __init__(self): + """None""" + pass + + def canSetMicLevel(self): + """Can the microphone level be set? Returns 1 if true otherwise returns 0.""" + pass + + def disable(self): + """Disabled audio""" + pass + + def enable(self): + """Enables audio""" + pass + + def enableVoiceChat(self,state): + """Enables or disables voice chat.""" + pass + + def enableVoiceCompression(self,state): + """Enables or disables voice compression.""" + pass + + def enableVoiceNetBroadcast(self,state): + """Enables or disables voice over network broadcast.""" + pass + + def enableVoiceRecording(self,state): + """Enables or disables voice recording.""" + pass + + def getAmbienceVolume(self): + """Returns the volume (0.0 to 1.0) for the Ambiance.""" + pass + + def getAudioDeviceName(self,index): + """Gets the name of audio device for the given index""" + pass + + def getDeviceName(self): + """Gets the name for the device being used by the audio system""" + pass + + def getGUIVolume(self): + """Returns the volume (0.0 to 1.0) for the GUI dialogs.""" + pass + + def getHighestMode(self): + """Gets the highest possible audio system mode""" + pass + + def getMicLevel(self): + """Returns the microphone recording level (0.0 to 1.0).""" + pass + + def getMode(self): + """Gets the audio system mode""" + pass + + def getMusicVolume(self): + """Returns the volume (0.0 to 1.0) for the Music.""" + pass + + def getNPCVoiceVolume(self): + """Returns the volume (0.0 to 1.0) for the NPC's voice.""" + pass + + def getNumAudioDevices(self): + """Returns the number of available audio devices.""" + pass + + def getPriorityCutoff(self): + """Returns current sound priority""" + pass + + def getSoundFXVolume(self): + """Returns the volume (0.0 to 1.0) for the Sound FX.""" + pass + + def getVoiceVolume(self): + """Returns the volume (0.0 to 1.0) for the Voices.""" + pass + + def hideIcons(self): + """Hides (disables) the voice recording icons.""" + pass + + def isEnabled(self): + """Is the audio enabled? Returns 1 if true otherwise returns 0.""" + pass + + def isHardwareAccelerated(self): + """Is audio hardware acceleration enabled? Returns 1 if true otherwise returns 0.""" + pass + + def isMuted(self): + """Are all sounds muted? Returns 1 if true otherwise returns 0.""" + pass + + def isUsingEAXAcceleration(self): + """Is EAX sound acceleration enabled? Returns 1 if true otherwise returns 0.""" + pass + + def isVoiceCompressionEnabled(self): + """Is voice compression enabled? Returns 1 if true otherwise returns 0.""" + pass + + def isVoiceNetBroadcastEnabled(self): + """Is voice over net enabled? Returns 1 if true otherwise returns 0.""" + pass + + def isVoiceRecordingEnabled(self): + """Is voice recording enabled? Returns 1 if true otherwise returns 0.""" + pass + + def muteAll(self): + """Mutes all sounds.""" + pass + + def pushToTalk(self,state): + """Enables or disables 'push-to-talk'.""" + pass + + def recordFrame(self,size): + """Sets the voice packet frame size.""" + pass + + def recordSampleRate(self,sampleRate): + """Sets the recording sample rate.""" + pass + + def setAmbienceVolume(self,volume): + """Sets the Ambience volume (0.0 to 1.0) for the game. +This only sets the volume for this game session.""" + pass + + def setDeviceName(self,devicename,restart): + """Sets the device name for the audio system, and optionally restarts it""" + pass + + def setGUIVolume(self,volume): + """Sets the GUI dialog volume (0.0 to 1.0) for the game. +This only sets the volume for this game session.""" + pass + + def setLoadOnDemand(self,state): + """Enables or disables the load on demand for sounds.""" + pass + + def setMicLevel(self,level): + """Sets the microphone recording level (0.0 to 1.0).""" + pass + + def setMode(self,mode): + """Sets the audio system mode""" + pass + + def setMusicVolume(self,volume): + """Sets the Music volume (0.0 to 1.0) for the game. +This only sets the volume for this game session.""" + pass + + def setNPCVoiceVolume(self,volume): + """Sets the NPC's voice volume (0.0 to 1.0) for the game. +This only sets the volume for this game session.""" + pass + + def setPriorityCutoff(self,priority): + """Sets the sound priority""" + pass + + def setSoundFXVolume(self,volume): + """Sets the SoundFX volume (0.0 to 1.0) for the game. +This only sets the volume for this game session.""" + pass + + def setTwoStageLOD(self,state): + """Enables or disables two-stage LOD, where sounds can be loaded into RAM but not into sound buffers. +...Less of a performance hit, harder on memory.""" + pass + + def setVoiceVolume(self,volume): + """Sets the Voice volume (0.0 to 1.0) for the game. +This only sets the volume for this game session.""" + pass + + def showIcons(self): + """Shows (enables) the voice recording icons.""" + pass + + def squelchLevel(self,level): + """Sets the squelch level.""" + pass + + def supportsEAX(self): + """Returns true or false based on whether or not a the device specified supports EAX""" + pass + + def unmuteAll(self): + """Unmutes all sounds.""" + pass + + def useEAXAcceleration(self,state): + """Enables or disables EAX sound acceleration (requires hardware acceleration).""" + pass + + def useHardwareAcceleration(self,state): + """Enables or disables audio hardware acceleration.""" + pass + +class ptAvatar: + """Plasma avatar class""" + def __init__(self): + """None""" + pass + + def addWardrobeClothingItem(self,clothing_name,tint1,tint2): + """To add a clothing item to the avatar's wardrobe (closet)""" + pass + + def enterSubWorld(self,sceneobject): + """Places the avatar into the subworld of the ptSceneObject specified""" + pass + + def exitSubWorld(self): + """Exits the avatar from the subWorld where it was""" + pass + + def getAllWithSameMesh(self,clothing_name): + """Returns a lilst of all clothing items that use the same mesh as the specified one""" + pass + + def getAvatarClothingGroup(self): + """Returns what clothing group the avatar belongs to. +It is also a means to determine if avatar is male or female""" + pass + + def getAvatarClothingList(self): + """Returns a list of clothes that the avatar is currently wearing.""" + pass + + def getClosetClothingList(self,clothing_type): + """Returns a list of clothes for the avatar that are in specified clothing group.""" + pass + + def getCurrentMode(self): + """Returns current brain mode for avatar""" + pass + + def getEntireClothingList(self,clothing_type): + """Gets the entire list of clothing available. 'clothing_type' not used +NOTE: should use getClosetClothingList""" + pass + + def getMatchingClothingItem(self,clothingName): + """Finds the matching clothing item that goes with 'clothingName' +Used to find matching left and right gloves and shoes.""" + pass + + def getMorph(self,clothing_name,layer): + """Get the current morph value""" + pass + + def getSkinBlend(self,layer): + """Get the current skin blend value""" + pass + + def getTintClothingItem(self,clothing_name,layer=1): + """Returns a ptColor of a particular item of clothing that the avatar is wearing. +The color will be a ptColor object.""" + pass + + def getTintSkin(self): + """Returns a ptColor of the current skin tint for the avatar""" + pass + + def getUniqueMeshList(self,clothing_type): + """Returns a list of unique clothing items of the desired type (different meshes)""" + pass + + def getWardrobeClothingList(self): + """Return a list of items that are in the avatars closet""" + pass + + def gotoStage(self,behaviorKey,stage,transitionTime,setTimeFlag,newTime,SetDirectionFlag,isForward,netForce): + """Tells a multistage behavior to go to a particular stage""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object""" + pass + + def nextStage(self,behaviorKey,transitionTime,setTimeFlag,newTime,SetDirectionFlag,isForward,netForce): + """Tells a multistage behavior to go to the next stage (Why does Matt like so many parameters?)""" + pass + + def oneShot(self,seekKey,duration,usePhysicsFlag,animationName,drivableFlag,reversibleFlag): + """Plays a one-shot animation on the avatar""" + pass + + def playSimpleAnimation(self,animName): + """Play simple animation on avatar""" + pass + + def previousStage(self,behaviorKey,transitionTime,setTimeFlag,newTime,SetDirectionFlag,isForward,netForce): + """Tells a multistage behavior to go to the previous stage""" + pass + + def registerForBehaviorNotify(self,selfKey): + """This will register for behavior notifies from the avatar""" + pass + + def removeClothingItem(self,clothing_name,update=1): + """Tells the avatar to remove a particular item of clothing.""" + pass + + def runBehavior(self,behaviorKey,netForceFlag): + """Runs a behavior on the avatar. Can be a single or multi-stage behavior.""" + pass + + def runBehaviorSetNotify(self,behaviorKey,replyKey,netForceFlag): + """Same as runBehavior, except send notifications to specified keyed object""" + pass + + def saveClothing(self): + """Saves the current clothing options (including morphs) to the vault""" + pass + + def setMorph(self,clothing_name,layer,value): + """Set the morph value (clipped between -1 and 1)""" + pass + + def setReplyKey(self,key): + """Sets the sender's key""" + pass + + def setSkinBlend(self,layer,value): + """Set the skin blend (value between 0 and 1)""" + pass + + def tintClothingItem(self,clothing_name,tint,update=1): + """Tells the avatar to tint(color) a particular item of clothing that they are already wearing. +'tint' is a ptColor object""" + pass + + def tintClothingItemLayer(self,clothing_name,tint,layer,update=1): + """Tells the avatar to tint(color) a particular layer of a particular item of clothing.""" + pass + + def tintSkin(self,tint,update=1): + """Tints all of the skin on the avatar, with the ptColor tint""" + pass + + def unRegisterForBehaviorNotify(self,selfKey): + """This will unregister behavior notifications""" + pass + + def wearClothingItem(self,clothing_name,update=1): + """Tells the avatar to wear a particular item of clothing. +And optionally hold update until later (for applying tinting before wearing).""" + pass + +class ptBook: + """Creates a new book""" + def __init__(self,esHTMLSource,coverImage=None,callbackKey=None,guiName=''): + """None""" + pass + + def allowPageTurning(self,allow): + """Turns on and off the ability to flip the pages in a book""" + pass + + def close(self): + """Closes the book""" + pass + + def closeAndHide(self): + """Closes the book and hides it once it finishes animating""" + pass + + def getCurrentPage(self): + """Returns the currently shown page""" + pass + + def getEditableText(self): + """Returns the editable text currently contained in the book.""" + pass + + def getMovie(self,index): + """Grabs a ptAnimation object representing the movie indexed by index. The index is the index of the movie in the source code""" + pass + + def goToPage(self,page): + """Flips the book to the specified page""" + pass + + def hide(self): + """Hides the book""" + pass + + def nextPage(self): + """Flips the book to the next page""" + pass + + def open(self,startingPage): + """Opens the book to the specified page""" + pass + + def previousPage(self): + """Flips the book to the previous page""" + pass + + def setEditable(self,editable): + """Turn book editing on or off. If the book GUI does not support editing, nothing will happen""" + pass + + def setEditableText(self,text): + """Sets the book's editable text.""" + pass + + def setGUI(self,guiName): + """Sets the gui to be used by the book, if the requested gui is not loaded, it will use the default +Do not call while the book is open!""" + pass + + def setPageMargin(self,margin): + """Sets the text margin for the book""" + pass + + def setSize(self,width,height): + """Sets the size of the book (width and height are floats from 0 to 1)""" + pass + + def show(self,startOpened): + """Shows the book closed, or open if the the startOpened flag is true""" + pass + +class ptCCRAge: + """CCR only: CCR age info struct""" + def __init__(self): + """None""" + pass + +class ptCCRMgr: + """CCR only: accessor class to the CCR manager""" + def __init__(self): + """None""" + pass + + def banLinking(self,pid, banFlag): + """Set the ban linking flag for a player""" + pass + + def beginCommunication(self,pid, message): + """Begin a CCR communication with a player""" + pass + + def clippingOff(self): + """Disables clipping for this player""" + pass + + def clippingOn(self): + """Enables clipping for this player""" + pass + + def endCommunication(self,pid): + """End CCR communications with a player""" + pass + + def getClipping(self): + """Is clipping on for this player? Returns 1 if true otherwise returns 0""" + pass + + def getErrorString(self,errorNumber): + """Returns the error string that corresponds to 'errorNumber'""" + pass + + def getLevel(self): + """Returns the current CCR level for this player""" + pass + + def getPlayerInfo(self,player, cbObject, cbContext): + """Finds a player that matches 'player' (which is an id or name).""" + pass + + def linkPlayerHere(self,pid): + """Links player to where I am""" + pass + + def linkPlayerToAge(self,ageInfoStruct,pid): + """Links player to a specified age""" + pass + + def linkToAge(self,age,pid): + """Links to player's version of age""" + pass + + def linkToMyNeighborhoodAge(self,pid): + """Links this player to their neighborhood""" + pass + + def linkToMyPersonalAge(self,pid): + """Links this player to their personal Age.""" + pass + + def linkToPlayersAge(self,pid): + """Link to where the player is""" + pass + + def logMessage(self,message): + """Logs 'message' somewhere...?""" + pass + + def makeInvisible(self,level): + """Makes this player invisible to 'level'""" + pass + + def sendCommunication(self,pid, message): + """Send a CCR communication to a player""" + pass + + def setAwayStatus(self,awayFlag): + """Set the away flag for CCRs""" + pass + + def silencePlayer(self,pid, silenceFlag): + """Set the silence player flag for a player""" + pass + + def systemMessage(self): + """Params message +Send a system wide CCR message""" + pass + + def toggleClipping(self): + """Toggles clipping for this player""" + pass + + def warpPlayerHere(self,pid): + """warp the player to here""" + pass + + def warpToPlayer(self,pid): + """warp to where the player is""" + pass + +class ptCCRPlayerInfo: + """CCR only: CCR player info struct""" + def __init__(self): + """None""" + pass + +class ptCamera: + """Plasma camera class""" + def __init__(self): + """None""" + pass + + def controlKey(self,controlKey,activateFlag): + """Send a control key to the camera as if it was hit by the user. +This is for sending things like pan-up, pan-down, zoom-in, etc.""" + pass + + def disableFirstPersonOverride(self): + """Does _not_ allow the user to override the camera to go to first person camera.""" + pass + + def enableFirstPersonOverride(self): + """Allows the user to override the camera and go to a first person camera.""" + pass + + def getFOV(self): + """Returns the current camera's FOV(h)""" + pass + + def isSmootherCam(self): + """Returns true if we are using the faster cams thing""" + pass + + def isStayInFirstPerson(self): + """Are we staying in first person?""" + pass + + def isWalkAndVerticalPan(self): + """Returns true if we are walking and chewing gum""" + pass + + def restore(self,cameraKey): + """Restores camera to saved one""" + pass + + def save(self,cameraKey): + """Saves the current camera and sets the camera to cameraKey""" + pass + + def set(self,cameraKey,time,save): + """DO NOT USE""" + pass + + def setFOV(self,fov, time): + """Sets the current cameras FOV (based on h)""" + pass + + def setSmootherCam(self,state): + """Set the faster cams thing""" + pass + + def setStayInFirstPerson(self,state): + """Set Stay In First Person Always""" + pass + + def setWalkAndVerticalPan(self,state): + """Set Walk and chew gum""" + pass + + def undoFirstPerson(self): + """If the user has overridden the camera to be in first person, this will take them out of first person. +If the user didn't override the camera, then this will do nothing.""" + pass + +class ptCluster: + """Creates a new ptCluster""" + def __init__(self,ey): + """None""" + pass + + def setVisible(self,isible): + """Shows or hides the cluster object""" + pass + +class ptColor: + """Plasma color class""" + def __init__(self,red=0, green=0, blue=0, alpha=0): + """None""" + pass + + def black(self): + """Sets the color to be black +Example: black = ptColor().black()""" + pass + + def blue(self): + """Sets the color to be blue +Example: blue = ptColor().blue()""" + pass + + def brown(self): + """Sets the color to be brown +Example: brown = ptColor().brown()""" + pass + + def cyan(self): + """Sets the color to be cyan +Example: cyan = ptColor.cyan()""" + pass + + def darkbrown(self): + """Sets the color to be darkbrown +Example: darkbrown = ptColor().darkbrown()""" + pass + + def darkgreen(self): + """Sets the color to be darkgreen +Example: darkgreen = ptColor().darkgreen()""" + pass + + def darkpurple(self): + """Sets the color to be darkpurple +Example: darkpurple = ptColor().darkpurple()""" + pass + + def getAlpha(self): + """Get the alpha blend component of the color""" + pass + + def getBlue(self): + """Get the blue component of the color""" + pass + + def getGreen(self): + """Get the green component of the color""" + pass + + def getRed(self): + """Get the red component of the color""" + pass + + def gray(self): + """Sets the color to be gray +Example: gray = ptColor().gray()""" + pass + + def green(self): + """Sets the color to be green +Example: green = ptColor().green()""" + pass + + def magenta(self): + """Sets the color to be magenta +Example: magenta = ptColor().magenta()""" + pass + + def maroon(self): + """Sets the color to be maroon +Example: maroon = ptColor().maroon()""" + pass + + def navyblue(self): + """Sets the color to be navyblue +Example: navyblue = ptColor().navyblue()""" + pass + + def orange(self): + """Sets the color to be orange +Example: orange = ptColor().orange()""" + pass + + def pink(self): + """Sets the color to be pink +Example: pink = ptColor().pink()""" + pass + + def red(self): + """Sets the color to be red +Example: red = ptColor().red()""" + pass + + def setAlpha(self,alpha): + """Set the alpha blend component of the color. 0.0 to 1.0""" + pass + + def setBlue(self,blue): + """Set the blue component of the color. 0.0 to 1.0""" + pass + + def setGreen(self,green): + """Set the green component of the color. 0.0 to 1.0""" + pass + + def setRed(self,red): + """Set the red component of the color. 0.0 to 1.0""" + pass + + def slateblue(self): + """Sets the color to be slateblue +Example: slateblue = ptColor().slateblue()""" + pass + + def steelblue(self): + """Sets the color to be steelblue +Example: steelblue = ptColor().steelblue()""" + pass + + def tan(self): + """Sets the color to be tan +Example: tan = ptColor().tan()""" + pass + + def white(self): + """Sets the color to be white +Example: white = ptColor().white()""" + pass + + def yellow(self): + """Sets the color to be yellow +Example: yellow = ptColor().yellow()""" + pass + +class ptCritterBrain: + """Object to manipulate critter brains""" + def __init__(self): + """None""" + pass + + def addBehavior(self,animName, behaviorName, loop = 1, randomStartPos = 1, fadeInLen = 2.0, fadeOutLen = 2.0): + """Adds a new animation to the brain as a behavior with the specified name and parameters. If multiple animations are assigned to the same behavior, they will be randomly picked from when started.""" + pass + + def addReceiver(self,key): + """Tells the brain that the specified key wants AI messages""" + pass + + def animationName(self,behavior): + """Returns the animation name associated with the specified integral behavior.""" + pass + + def atGoal(self): + """Are we currently are our final destination?""" + pass + + def avoidingAvatars(self): + """Are we currently avoiding avatars while pathfinding?""" + pass + + def behaviorName(self,behavior): + """Returns the behavior name associated with the specified integral behavior.""" + pass + + def canHearAvatar(self,avatarID): + """Returns whether this brain can hear the avatar with the specified id.""" + pass + + def canSeeAvatar(self,avatarID): + """Returns whether this brain can see the avatar with the specified id.""" + pass + + def curBehavior(self): + """Returns the current integral behavior the brain is running.""" + pass + + def currentGoal(self): + """Returns the current ptPoint that the brain is running towards.""" + pass + + def getHearingDistance(self): + """Returns how far away the brain can hear.""" + pass + + def getLocallyControlled(self): + """Are we the one making AI decisions? NOTE: Not set automatically, some python script needs to tell the brain this using setLocallyControlled().""" + pass + + def getSightCone(self): + """Returns the width of the brain's field of view in radians.""" + pass + + def getSightDistance(self): + """Returns how far the brain can see.""" + pass + + def getStopDistance(self): + """Returns how far away from the goal we could be and still be considered there.""" + pass + + def goToGoal(self,newGoal, avoidingAvatars = 0): + """Tells the brain to start running towards the specified location, avoiding avatars it can see or hear if told to.""" + pass + + def idleBehaviorName(self): + """Returns the name of the brain's idle behavior.""" + pass + + def nextBehavior(self): + """Returns the behavior the brain will be switching to next frame. (-1 if no change)""" + pass + + def playersICanHear(self): + """Returns a list of player ids which this brain can hear.""" + pass + + def playersICanSee(self): + """Returns a list of player ids which this brain can see.""" + pass + + def removeReceiver(self,key): + """Tells the brain that the specified key no longer wants AI messages""" + pass + + def runBehaviorName(self): + """Returns the name of the brain's run behavior.""" + pass + + def runningBehavior(self,behaviorName): + """Returns true if the named behavior is running.""" + pass + + def setHearingDistance(self,dist): + """Set how far away the brain can hear (360 degree field of hearing).""" + pass + + def setLocallyControlled(self,local): + """Tells the brain that we are the ones making all the AI decisions, and to prop location and other information to the server.""" + pass + + def setSightCone(self,radians): + """Set how wide the brain's field of view is in radians. Note that it is the total angle of the cone, half on one side of the brain's line of sight, half on the other.""" + pass + + def setSightDistance(self,dist): + """Set how far away the brain can see.""" + pass + + def setStopDistance(self,dist): + """Set how far away from the goal we should be when we are considered there and stop running.""" + pass + + def startBehavior(self,behaviorName, fade = 1): + """Starts playing the named behavior. If fade is true, it will fade out the previous behavior and fade in the new one. If false, they will immediately switch.""" + pass + + def vectorToPlayer(self,avatarID): + """Returns the vector between us and the specified player.""" + pass + +class ptDniCoordinates: + """Constructor for a D'Ni coordinate""" + def __init__(self): + """None""" + pass + + def fromPoint(self,pt): + """Update these coordinates with the specified ptPoint3""" + pass + + def getHSpans(self): + """Returns the HSpans component of the coordinate""" + pass + + def getTorans(self): + """Returns the Torans component of the coordinate""" + pass + + def getVSpans(self): + """Returns the VSpans component of the coordinate""" + pass + + def update(self): + """Update these coordinates with the players current position""" + pass + +class ptDniInfoSource: + """DO NOT USE""" + def __init__(self): + """None""" + pass + + def getAgeCoords(self): + """Current coords of the player in current age as a ptDniCoordinates""" + pass + + def getAgeGuid(self): + """Unique identifier for this age instance""" + pass + + def getAgeName(self): + """Name of current age""" + pass + + def getAgeTime(self): + """Current time in current age (tbd)""" + pass + +class ptDraw: + """Plasma Draw class""" + def __init__(self): + """None""" + pass + + def disable(self): + """Disables the draw on the sceneobject attached +In other words, makes it invisible""" + pass + + def enable(self,state=1): + """Sets the draw enable for the sceneobject attached""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object""" + pass + +class ptDynamicMap: + """Creates a ptDynamicMap object""" + def __init__(self,key=None): + """None""" + pass + + def addKey(self,key): + """Add a receiver... in other words a DynamicMap""" + pass + + def calcTextExtents(self,text): + """Calculates the extent of the specified text, returns it as a (width, height) tuple""" + pass + + def clearKeys(self): + """Clears the receiver list""" + pass + + def clearToColor(self,color): + """Clear the DynamicMap to the specified color +- 'color' is a ptColor object""" + pass + + def drawImage(self,x,y,image,respectAlphaFlag): + """Draws a ptImage object on the dynamicTextmap starting at the location x,y""" + pass + + def drawImageClipped(self,x,y,image,cx,cy,cw,ch,respectAlphaFlag): + """Draws a ptImage object clipped to cx,cy with cw(width),ch(height)""" + pass + + def drawText(self,x,y,text): + """Draw text at a specified location +- x,y is the point to start drawing the text +- 'text' is a string of the text to be drawn""" + pass + + def drawTextW(self,x,y,text): + """Unicode version of drawText""" + pass + + def fillRect(self,left,top,right,bottom,color): + """Fill in the specified rectangle with a color +- left,top,right,bottom define the rectangle +- 'color' is a ptColor object""" + pass + + def flush(self): + """Flush all the commands that were issued since the last flush()""" + pass + + def frameRect(self,left,top,right,bottom,color): + """Frame a rectangle with a specified color +- left,top,right,bottom define the rectangle +- 'color' is a ptColor object""" + pass + + def getHeight(self): + """Returns the height of the dynamicTextmap""" + pass + + def getImage(self): + """Returns a pyImage associated with the dynamicTextmap""" + pass + + def getWidth(self): + """Returns the width of the dynamicTextmap""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object +This only applies when NetPropagate is set to true""" + pass + + def netPropagate(self,propagateFlag): + """Specify whether this object needs to use messages that are sent on the network +- The default is for this to be false.""" + pass + + def purgeImage(self): + """Purge the DynamicTextMap images""" + pass + + def sender(self,sender): + """Set the sender of the message being sent to the DynamicMap""" + pass + + def setClipping(self,clipLeft,clipTop,clipRight,clipBottom): + """Sets the clipping rectangle +- All drawtext will be clipped to this until the +unsetClipping() is called""" + pass + + def setFont(self,facename,size): + """Set the font of the text to be written +- 'facename' is a string with the name of the font +- 'size' is the point size of the font to use""" + pass + + def setJustify(self,justify): + """Sets the justification of the text. (justify is a PtJustify)""" + pass + + def setLineSpacing(self,spacing): + """Sets the line spacing (in pixels)""" + pass + + def setTextColor(self,color, blockRGB=0): + """Set the color of the text to be written +- 'color' is a ptColor object +- 'blockRGB' must be true if you're trying to render onto a transparent or semi-transparent color""" + pass + + def setWrapping(self,wrapWidth,wrapHeight): + """Set where text will be wrapped horizontally and vertically +- All drawtext commands will be wrapped until the +unsetWrapping() is called""" + pass + + def unsetClipping(self): + """Stop the clipping of text""" + pass + + def unsetWrapping(self): + """Stop text wrapping""" + pass + +class ptGUIControl: + """Base class for all GUI controls""" + def __init__(self,controlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlButton(ptGUIControl): + """Plasma GUI Control Button class""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getNotifyType(self): + """Returns this button's notify type. See PtButtonNotifyTypes""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isButtonDown(self): + """Is the button down? Returns 1 for true otherwise returns 0""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setNotifyType(self,kind): + """Sets this button's notify type. See PtButtonNotifyTypes""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlCheckBox(ptGUIControl): + """Plasma GUI Control Checkbox class""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isChecked(self): + """Is this checkbox checked? Returns 1 for true otherwise returns 0""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setChecked(self,checkedState): + """Sets this checkbox to the 'checkedState'""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlClickMap(ptGUIControl): + """Plasma GUI control Click Map""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getLastMouseDragPoint(self): + """Returns the last point the mouse was dragged to""" + pass + + def getLastMousePoint(self): + """Returns the last point the mouse was at""" + pass + + def getLastMouseUpPoint(self): + """Returns the last point the mouse was released at""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlDragBar(ptGUIControl): + """Plasma GUI Control DragBar class""" + def __init__(self,ctrlKey): + """None""" + pass + + def anchor(self): + """Don't allow this dragbar object to be moved by the user. +Drop anchor!""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isAnchored(self): + """Is this dragbar control anchored? Returns 1 if true otherwise returns 0""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + + def unanchor(self): + """Allow the user to drag this control around the screen. +Raise anchor.""" + pass + +class ptGUIControlDraggable(ptGUIControl): + """Plasma GUI control for something draggable""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getLastMousePoint(self): + """Returns the last point we were dragged to""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def stopDragging(self,cancelFlag): + """UNKNOWN""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlDynamicText(ptGUIControl): + """Plasma GUI Control DynamicText class""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getMap(self,index): + """Returns a specific ptDynamicText attached to this contol +If there is no map at 'index' then a KeyError exception will be raised""" + pass + + def getNumMaps(self): + """Returns the number of ptDynamicText maps attached""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlEditBox(ptGUIControl): + """Plasma GUI Control Editbox class""" + def __init__(self,ctrlKey): + """None""" + pass + + def clearString(self): + """Clears the editbox.""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def end(self): + """Sets the cursor in the editbox to the after the last character.""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getLastKeyCaptured(self): + """Gets the last capture key""" + pass + + def getLastModifiersCaptured(self): + """Gets the last modifiers flags captured""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getString(self): + """Returns the sting that the user typed in.""" + pass + + def getStringW(self): + """Unicode version of getString.""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def home(self): + """Sets the cursor in the editbox to before the first character.""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setChatMode(self,state): + """Set the Chat mode on this control""" + pass + + def setColor(self,foreColor,backColor): + """Sets the fore and back color of the editbox.""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setLastKeyCapture(self,key, modifiers): + """Set last key captured""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setSelectionColor(self,foreColor,backColor): + """Sets the selection color of the editbox.""" + pass + + def setSpecialCaptureKeyMode(self,state): + """Set the Capture mode on this control""" + pass + + def setString(self,text): + """Pre-sets the editbox to a atring.""" + pass + + def setStringSize(self,size): + """Sets the maximum size of the string that can be inputted by the user.""" + pass + + def setStringW(self,text): + """Unicode version of setString.""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + + def wasEscaped(self): + """If the editbox was escaped then return 1 else return 0""" + pass + +class ptGUIControlValue(ptGUIControl): + """Plasma GUI Control Value class - knobs, spinners""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getMax(self): + """Returns the maximum of the control.""" + pass + + def getMin(self): + """Returns the minimum of the control.""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getStep(self): + """Returns the step increment of the control.""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def getValue(self): + """Returns the current value of the control.""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setRange(self,minimum,maximum): + """Sets the minimum and maximum range of the control.""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setStep(self,step): + """Sets the step increment of the control.""" + pass + + def setValue(self,value): + """Sets the current value of the control.""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlKnob(ptGUIControlValue): + """Plasma GUI control for knob""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getMax(self): + """Returns the maximum of the control.""" + pass + + def getMin(self): + """Returns the minimum of the control.""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getStep(self): + """Returns the step increment of the control.""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def getValue(self): + """Returns the current value of the control.""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setRange(self,minimum,maximum): + """Sets the minimum and maximum range of the control.""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setStep(self,step): + """Sets the step increment of the control.""" + pass + + def setValue(self,value): + """Sets the current value of the control.""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlListBox(ptGUIControl): + """Plasma GUI Control List Box class""" + def __init__(self,ctrlKey): + """None""" + pass + + def add2StringsWithColors(self,text1,color1,text2,color2,respectAlpha): + """Doesn't work right - DONT USE""" + pass + + def addBranch(self,name,initiallyOpen): + """UNKNOWN""" + pass + + def addBranchW(self,name,initiallyOpen): + """Unicode version of addBranch""" + pass + + def addImage(self,image,respectAlphaFlag): + """Appends an image item to the listbox""" + pass + + def addImageAndSwatchesInBox(self,image,x,y,width,height,respectAlpha,primary,secondary): + """Add the image and color swatches to the list""" + pass + + def addImageInBox(self,image,x,y,width,height,respectAlpha): + """Appends an image item to the listbox, centering within the box dimension.""" + pass + + def addSelection(self,item): + """Adds item to selection list""" + pass + + def addString(self,text): + """Appends a list item 'text' to the listbox.""" + pass + + def addStringInBox(self,text,min_width,min_height): + """Adds a text list item that has a minimum width and height""" + pass + + def addStringW(self,text): + """Unicode version of addString.""" + pass + + def addStringWithColor(self,text,color,inheritAlpha): + """Adds a colored string to the list box""" + pass + + def addStringWithColorWithSize(self,text,color,inheritAlpha,fontsize): + """Adds a text list item with a color and different font size""" + pass + + def allowNoSelect(self): + """Allows the listbox to have no selection""" + pass + + def clearAllElements(self): + """Removes all the items from the listbox, making it empty.""" + pass + + def clickable(self): + """Sets this listbox to be clickable by the user.""" + pass + + def closeBranch(self): + """UNKNOWN""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def disallowNoSelect(self): + """The listbox must always have a selection""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def findString(self,text): + """Finds and returns the index of the item that matches 'text' in the listbox.""" + pass + + def findStringW(self,text): + """Unicode version of findString.""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getBranchList(self): + """get a list of branches in this list (index,isShowingChildren)""" + pass + + def getElement(self,index): + """Get the string of the item at 'index' in the listbox.""" + pass + + def getElementW(self,index): + """Unicode version of getElement.""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getNumElements(self): + """Return the number of items in the listbox.""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getScrollPos(self): + """Returns the current scroll position in the listbox.""" + pass + + def getScrollRange(self): + """Returns the max scroll position""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getSelection(self): + """Returns the currently selected list item in the listbox.""" + pass + + def getSelectionList(self): + """Returns the current selection list""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def lock(self): + """Locks the updates to a listbox, so a number of operations can be performed +NOTE: an unlock() call must be made before the next lock() can be.""" + pass + + def refresh(self): + """Refresh the display of the listbox (after updating contents).""" + pass + + def removeElement(self,index): + """Removes element at 'index' in the listbox.""" + pass + + def removeSelection(self,item): + """Removes item from selection list""" + pass + + def scrollToBegin(self): + """Scrolls the listbox to the beginning of the list""" + pass + + def scrollToEnd(self): + """Scrolls the listbox to the end of the list""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setElement(self,index,text): + """Set a particular item in the listbox to a string.""" + pass + + def setElementW(self,index,text): + """Unicode version of setElement.""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setGlobalSwatchEdgeOffset(self,offset): + """Sets the edge offset of the color swatches""" + pass + + def setGlobalSwatchSize(self,size): + """Sets the size of the color swatches""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setScrollPos(self,pos): + """Sets the scroll position of the listbox to 'pos'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setSelection(self,selectionIndex): + """Sets the current selection in the listbox.""" + pass + + def setStringJustify(self,index,justify): + """Sets the text justification""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + + def unclickable(self): + """Makes this listbox not clickable by the user. +Useful when just displaying a list that is not really selectable.""" + pass + + def unlock(self): + """Unlocks updates to a listbox and does any saved up changes""" + pass + +class ptGUIControlMultiLineEdit(ptGUIControl): + """Plasma GUI Control Multi-line edit class""" + def __init__(self,ctrlKey): + """None""" + pass + + def clearBuffer(self): + """Clears all text from the multi-line edit control.""" + pass + + def clickable(self): + """Sets this listbox to be clickable by the user.""" + pass + + def deleteChar(self): + """Deletes a character at the current cursor position.""" + pass + + def deleteLinesFromTop(self,numLines): + """Deletes the specified number of lines from the top of the text buffer""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def disableScrollControl(self): + """Disables the scroll control if there is one""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def enableScrollControl(self): + """Enables the scroll control if there is one""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getBufferLimit(self): + """Returns the current buffer limit""" + pass + + def getBufferSize(self): + """Returns the size of the buffer""" + pass + + def getEncodedBuffer(self): + """Returns the encoded buffer in a python buffer object. Do NOT use result with setEncodedBufferW.""" + pass + + def getEncodedBufferW(self): + """Unicode version of getEncodedBuffer. Do NOT use result with setEncodedBuffer.""" + pass + + def getFontSize(self): + """Returns the current default font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getString(self): + """Gets the string of the edit control.""" + pass + + def getStringW(self): + """Unicode version of getString.""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def insertChar(self,c): + """Inserts a character at the current cursor position.""" + pass + + def insertCharW(self,c): + """Unicode version of insertChar.""" + pass + + def insertColor(self,color): + """Inserts an encoded color object at the current cursor position. +'color' is a ptColor object.""" + pass + + def insertString(self,string): + """Inserts a string at the current cursor position.""" + pass + + def insertStringW(self,string): + """Unicode version of insertString""" + pass + + def insertStyle(self,style): + """Inserts an encoded font style at the current cursor position.""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isLocked(self): + """Is the multi-line edit control locked? Returns 1 if true otherwise returns 0""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def lock(self): + """Locks the multi-line edit control so the user cannot make changes.""" + pass + + def moveCursor(self,direction): + """Move the cursor in the specified direction (see PtGUIMultiLineDirection)""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setBufferLimit(self,bufferLimit): + """Sets the buffer max for the editbox""" + pass + + def setEncodedBuffer(self,bufferObject): + """Sets the edit control to the encoded buffer in the python buffer object. Do NOT use with a result from getEncodedBufferW.""" + pass + + def setEncodedBufferW(self,bufferObject): + """Unicode version of setEncodedBuffer. Do NOT use with a result from getEncodedBuffer.""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the default font size for the edit control""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setScrollPosition(self,topLine): + """Sets the what line is the top line.""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setString(self,asciiText): + """Sets the multi-line edit control string.""" + pass + + def setStringW(self,unicodeText): + """Unicode version of setString.""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + + def unclickable(self): + """Makes this listbox not clickable by the user. +Useful when just displaying a list that is not really selectable.""" + pass + + def unlock(self): + """Unlocks the multi-line edit control so that the user can make changes.""" + pass + +class ptGUIControlProgress(ptGUIControlValue): + """Plasma GUI control for progress bar""" + def __init__(self,ctrlKey): + """None""" + pass + + def animateToPercent(self,percent): + """Sets the value of the control and animates to that point.""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getMax(self): + """Returns the maximum of the control.""" + pass + + def getMin(self): + """Returns the minimum of the control.""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getStep(self): + """Returns the step increment of the control.""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def getValue(self): + """Returns the current value of the control.""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setRange(self,minimum,maximum): + """Sets the minimum and maximum range of the control.""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setStep(self,step): + """Sets the step increment of the control.""" + pass + + def setValue(self,value): + """Sets the current value of the control.""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlRadioGroup(ptGUIControl): + """Plasma GUI Control Radio Group class""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def getValue(self): + """Returns the current selection of the radio group.""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setValue(self,value): + """Sets the current selection to 'value'""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlTextBox(ptGUIControl): + """Plasma GUI Control Textbox class""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the current forecolor""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getString(self): + """Returns the string that the TextBox is set to (in case you forgot)""" + pass + + def getStringJustify(self): + """Returns current justify""" + pass + + def getStringW(self): + """Unicode version of getString""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,color): + """Sets the text backcolor to 'color', which is a ptColor object.""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,size): + """Don't use""" + pass + + def setForeColor(self,color): + """Sets the text forecolor to 'color', which is a ptColor object.""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setString(self,text): + """Sets the textbox string to 'text'""" + pass + + def setStringJustify(self,justify): + """Sets current justify""" + pass + + def setStringW(self,text): + """Unicode version of setString""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIControlUpDownPair(ptGUIControlValue): + """Plasma GUI control for up/down pair""" + def __init__(self,ctrlKey): + """None""" + pass + + def disable(self): + """Disables this GUI control""" + pass + + def enable(self,flag=1): + """Enables this GUI control""" + pass + + def focus(self): + """Gets focus for this GUI control""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns the ptKey for this GUI control""" + pass + + def getMax(self): + """Returns the maximum of the control.""" + pass + + def getMin(self): + """Returns the minimum of the control.""" + pass + + def getObjectCenter(self): + """Returns ptPoint3 of the center of the GUI control object""" + pass + + def getOwnerDialog(self): + """Returns a ptGUIDialog of the dialog that owns this GUI control""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getStep(self): + """Returns the step increment of the control.""" + pass + + def getTagID(self): + """Returns the Tag ID for this GUI control""" + pass + + def getValue(self): + """Returns the current value of the control.""" + pass + + def hide(self): + """Hides this GUI control""" + pass + + def isEnabled(self): + """Returns whether this GUI control is enabled""" + pass + + def isFocused(self): + """Returns whether this GUI control has focus""" + pass + + def isInteresting(self): + """Returns whether this GUI control is interesting at the moment""" + pass + + def isVisible(self): + """Returns whether this GUI control is visible""" + pass + + def refresh(self): + """UNKNOWN""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setFocus(self,state): + """Sets the state of the focus of this GUI control""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setNotifyOnInteresting(self,state): + """Sets whether this control should send interesting events or not""" + pass + + def setObjectCenter(self,point): + """Sets the GUI controls object center to 'point'""" + pass + + def setRange(self,minimum,maximum): + """Sets the minimum and maximum range of the control.""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def setStep(self,step): + """Sets the step increment of the control.""" + pass + + def setValue(self,value): + """Sets the current value of the control.""" + pass + + def setVisible(self,state): + """Sets the state of visibility of this GUI control""" + pass + + def show(self): + """Shows this GUI control""" + pass + + def unFocus(self): + """Releases focus for this GUI control""" + pass + +class ptGUIDialog: + """Plasma GUI dialog class""" + def __init__(self,dialogKey): + """None""" + pass + + def disable(self): + """Disables this dialog""" + pass + + def enable(self,enableFlag=1): + """Enable this dialog""" + pass + + def getBackColor(self): + """Returns the back color as a ptColor object""" + pass + + def getBackSelectColor(self): + """Returns the select back color as a ptColor object""" + pass + + def getControlFromIndex(self,index): + """Returns the ptKey of the control with the specified index (not tag ID!)""" + pass + + def getControlFromTag(self,tagID): + """Returns the ptKey of the control with the specified tag ID""" + pass + + def getFontSize(self): + """Returns the font size""" + pass + + def getForeColor(self): + """Returns the fore color as a ptColor object""" + pass + + def getKey(self): + """Returns this dialog's ptKey""" + pass + + def getName(self): + """Returns the dialog's name""" + pass + + def getNumControls(self): + """Returns the number of controls in this dialog""" + pass + + def getSelectColor(self): + """Returns the select color as a ptColor object""" + pass + + def getTagID(self): + """Returns this dialog's tag ID""" + pass + + def getVersion(self): + """UNKNOWN""" + pass + + def hide(self): + """Hides the dialog""" + pass + + def isEnabled(self): + """Is this dialog currently enabled?""" + pass + + def noFocus(self): + """Makes sure no control has input focus""" + pass + + def refreshAllControls(self): + """Tells the dialog to redraw all its controls""" + pass + + def setBackColor(self,red,green,blue,alpha): + """Sets the back color, -1 means don't change""" + pass + + def setBackSelectColor(self,red,green,blue,alpha): + """Sets the select back color, -1 means don't change""" + pass + + def setFocus(self,ctrlKey): + """Sets the control that has input focus""" + pass + + def setFontSize(self,fontSize): + """Sets the font size""" + pass + + def setForeColor(self,red,green,blue,alpha): + """Sets the fore color, -1 means don't change""" + pass + + def setSelectColor(self,red,green,blue,alpha): + """Sets the select color, -1 means don't change""" + pass + + def show(self): + """Shows the dialog""" + pass + + def showNoReset(self): + """Show dialog without resetting clickables""" + pass + + def updateAllBounds(self): + """Tells the dialog to recompute all the bounds for its controls""" + pass + +class ptGUIPopUpMenu: + """Takes three diferent argument lists: +gckey +name,screenOriginX,screenOriginY +name,parent,screenOriginX,screenOriginY""" + def __init__(self,arg1,arg2=None,arg3=None,arg4=None): + """None""" + pass + + def addConsoleCmdItem(self,name,consoleCmd): + """Adds a new item to the menu that fires a console command""" + pass + + def addConsoleCmdItemW(self,name,consoleCmd): + """Unicode version of addConsoleCmdItem""" + pass + + def addNotifyItem(self,name): + """Adds a new item ot the mneu""" + pass + + def addNotifyItemW(self,name): + """Unicode version of addNotifyItem""" + pass + + def addSubMenuItem(self,name,subMenu): + """Adds a submenu to this menu""" + pass + + def addSubMenuItemW(self,name,subMenu): + """Unicode version of addSubMenuItem""" + pass + + def disable(self): + """Disables this menu""" + pass + + def enable(self,state=1): + """Enables/disables this menu""" + pass + + def getBackColor(self): + """Returns the background color""" + pass + + def getBackSelectColor(self): + """Returns the background selection color""" + pass + + def getForeColor(self): + """Returns the foreground color""" + pass + + def getKey(self): + """Returns this menu's key""" + pass + + def getName(self): + """Returns this menu's name""" + pass + + def getSelectColor(self): + """Returns the selection color""" + pass + + def getTagID(self): + """Returns this menu's tag id""" + pass + + def getVersion(self): + """UNKNOWN""" + pass + + def hide(self): + """Hides this menu""" + pass + + def isEnabled(self): + """Returns whether this menu is enabled or not""" + pass + + def setBackColor(self,r,g,b,a): + """Sets the background color""" + pass + + def setBackSelectColor(self,r,g,b,a): + """Sets the selection background color""" + pass + + def setForeColor(self,r,g,b,a): + """Sets the foreground color""" + pass + + def setSelectColor(self,r,g,b,a): + """Sets the selection color""" + pass + + def show(self): + """Shows this menu""" + pass + +class ptGUISkin: + """Plasma GUI Skin object""" + def __init__(self,key): + """None""" + pass + + def getKey(self): + """Returns this object's ptKey""" + pass + +class ptGameScore: + """Game score manager""" + def __init__(self): + """None""" + pass + + def addPoints(self,numPoints): + """Adds points to the score""" + pass + + def getCreatedTime(self): + """Returns a the score creation time.""" + pass + + def getGameName(self): + """Returns a the score game name.""" + pass + + def getGameType(self): + """Returns a the score game type.""" + pass + + def getOwnerID(self): + """Returns a the score owner id.""" + pass + + def getScoreID(self): + """Returns the score id.""" + pass + + def getValue(self): + """Returns a the score owner value.""" + pass + + def setPoints(self,numPoints): + """Sets the number of points in the score +Don't use to add/remove points, use only to reset values!""" + pass + + def transferPoints(self,dest, numPoints): + """Transfers points from one score to another""" + pass + +class ptGrassShader: + """Plasma Grass Shader class""" + def __init__(self,key): + """None""" + pass + + def getWaveDirection(self,waveNum): + """Gets the wave waveNum's direction as a tuple of x,y. waveNum must be between 0 and plGrassShaderMod::kNumWaves-1 (currently 3) inclusive""" + pass + + def getWaveDistortion(self,waveNum): + """Gets the wave waveNum's distortion as a tuple of x,y,z. waveNum must be between 0 and plGrassShaderMod::kNumWaves-1 (currently 3) inclusive""" + pass + + def getWaveSpeed(self,waveNum): + """Gets the wave waveNum's speed as a float. waveNum must be between 0 and plGrassShaderMod::kNumWaves-1 (currently 3) inclusive""" + pass + + def resetWaves(self): + """Resets wave data to 0""" + pass + + def setWaveDirection(self,waveNum, direction): + """Sets the wave waveNum's direction as a tuple of x,y. waveNum must be between 0 and plGrassShaderMod::kNumWaves-1 (currently 3) inclusive""" + pass + + def setWaveDistortion(self,waveNum, distortion): + """Sets the wave waveNum's distortion as a tuple of x,y,z. waveNum must be between 0 and plGrassShaderMod::kNumWaves-1 (currently 3) inclusive""" + pass + + def setWaveSpeed(self,waveNum, speed): + """Sets the wave waveNum's speed as a float. waveNum must be between 0 and plGrassShaderMod::kNumWaves-1 (currently 3) inclusive""" + pass + +class ptImage: + """Plasma image class""" + def __init__(self,imgKey): + """None""" + pass + + def getColorLoc(self,color): + """Returns the ptPoint3 where the specified color is located""" + pass + + def getHeight(self): + """Returns the height of the image""" + pass + + def getPixelColor(self,x,y): + """Returns the ptColor at the specified location (float from 0 to 1)""" + pass + + def getWidth(self): + """Returns the width of the image""" + pass + + def saveAsJPEG(self,filename,quality=75): + """Saves this image to disk as a JPEG file""" + pass + +class ptInputInterface: + """Plasma input interface class""" + def __init__(self): + """None""" + pass + + def popTelescope(self): + """pops off the telescope interface and gos back to previous interface""" + pass + + def pushTelescope(self): + """pushes on the telescope interface""" + pass + +class ptKey: + """Plasma Key class""" + def __init__(self): + """None""" + pass + + def disable(self): + """Sends a disable message to whatever this ptKey is pointing to""" + pass + + def enable(self): + """Sends an enable message to whatever this ptKey is pointing to""" + pass + + def getName(self): + """Get the name of the object that this ptKey is pointing to""" + pass + + def getParentKey(self): + """This will return a ptKey object that is the parent of this modifer +However, if the parent is not a modifier or not loaded, then None is returned.""" + pass + + def getSceneObject(self): + """This will return a ptSceneobject object that is associated with this ptKey +However, if this ptKey is _not_ a sceneobject, then unpredicatable results will ensue""" + pass + + def isAttachedToClone(self): + """Returns whether the python file mod is attached to a clone""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object""" + pass + +class ptKeyMap: + """Accessor class to the Key Mapping functions""" + def __init__(self): + """None""" + pass + + def bindKey(self): + """Params key1,key2,action +Bind keys to an action""" + pass + + def bindKeyToConsoleCommand(self,keyStr1, command): + """Binds key to console command""" + pass + + def convertCharToControlCode(self,controlCodeString): + """Convert string version of control code to number""" + pass + + def convertCharToFlags(self,charString): + """Convert char string to flags""" + pass + + def convertCharToVKey(self,charString): + """Convert char string to virtual key""" + pass + + def convertControlCodeToString(self): + """Params controlCode +Convert control code to character string""" + pass + + def convertVKeyToChar(self,virtualKey,flags): + """Convert virtual key and shift flags to string""" + pass + + def getBindingFlags1(self): + """Params controlCode +Returns modifier flags for controlCode""" + pass + + def getBindingFlags2(self): + """Params controlCode +Returns modifier flags for controlCode""" + pass + + def getBindingFlagsConsole(self,command): + """Returns modifier flags for the console command mapping""" + pass + + def getBindingKey1(self): + """Params controlCode +Returns key code for controlCode""" + pass + + def getBindingKey2(self): + """Params controlCode +Returns key code for controlCode""" + pass + + def getBindingKeyConsole(self,command): + """Returns key for console command mapping""" + pass + + def writeKeyMap(self): + """Forces write of the keymap file""" + pass + +class ptMarkerMgr: + """Marker manager accessor class""" + def __init__(self): + """None""" + pass + + def addMarker(self,x, y, z, id, justCreated): + """Add a marker in the specified location with the specified id""" + pass + + def areLocalMarkersShowing(self): + """Returns true if we are showing the markers on this local machine""" + pass + + def captureQuestMarker(self,id, captured): + """Sets a marker as captured or not""" + pass + + def captureTeamMarker(self,id, team): + """Sets a marker as captured by the specified team (0 = not captured)""" + pass + + def clearSelectedMarker(self): + """Unselects the selected marker""" + pass + + def getMarkersRespawn(self): + """Returns whether markers respawn after being captured, or not""" + pass + + def getSelectedMarker(self): + """Returns the id of the selected marker""" + pass + + def hideMarkersLocal(self): + """Hides the markers on your machine, so you can no longer see where they are""" + pass + + def removeAllMarkers(self): + """Removes all markers""" + pass + + def removeMarker(self,id): + """Removes the specified marker from the game""" + pass + + def setMarkersRespawn(self,respawn): + """Sets whether markers respawn after being captured, or not""" + pass + + def setSelectedMarker(self,id): + """Sets the selected marker to the one with the specified id""" + pass + + def showMarkersLocal(self): + """Shows the markers on your machine, so you can see where they are""" + pass + +class ptMatrix44: + """Plasma Matrix44 class""" + def __init__(self): + """None""" + pass + + def copy(self): + """Copies the matrix and returns the copy""" + pass + + def getAdjoint(self,adjointMat): + """Returns the adjoint of the matrix""" + pass + + def getData(self): + """Returns the matrix in tuple form""" + pass + + def getDeterminant(self): + """Get the matrix's determinant""" + pass + + def getInverse(self,inverseMat): + """Returns the inverse of the matrix""" + pass + + def getParity(self): + """Get the parity of the matrix""" + pass + + def getTranslate(self,vector): + """Returns the translate vector of the matrix (and sets vector to it as well)""" + pass + + def getTranspose(self,transposeMat): + """Returns the transpose of the matrix""" + pass + + def make(self,fromPt, atPt, upVec): + """Creates the matrix from from and at points, and the up vector""" + pass + + def makeRotateMat(self,axis,radians): + """Makes the matrix a rotation matrix""" + pass + + def makeScaleMat(self,scale): + """Makes the matrix a scaling matrix""" + pass + + def makeTranslateMat(self,trans): + """Makes the matrix a translation matrix""" + pass + + def makeUpPreserving(self,fromPt, atPt, upVec): + """Creates the matrix from from and at points, and the up vector (perserving the up vector)""" + pass + + def reset(self): + """Reset the matrix to identity""" + pass + + def right(self): + """Returns the right vector of the matrix""" + pass + + def rotate(self,axis,radians): + """Rotates the matrix by radians around the axis""" + pass + + def scale(self,scale): + """Scales the matrix by the vector""" + pass + + def setData(self,mat): + """Sets the matrix using tuples""" + pass + + def translate(self,vector): + """Translates the matrix by the vector""" + pass + + def up(self): + """Returns the up vector of the matrix""" + pass + + def view(self): + """Returns the view vector of the matrix""" + pass + +class ptMoviePlayer: + """Accessor class to play in the MoviePlayer""" + def __init__(self,movieName,selfKey): + """None""" + pass + + def pause(self): + """Pauses the movie""" + pass + + def play(self): + """Plays the movie""" + pass + + def playPaused(self): + """Plays movie, but pauses at first frame""" + pass + + def resume(self): + """Resumes movie after pausing""" + pass + + def setCenter(self,x,y): + """Sets the center of the movie""" + pass + + def setColor(self,color): + """Sets the color of the movie""" + pass + + def setOpacity(self,opacity): + """Sets the opacity of the movie""" + pass + + def setScale(self,width,height): + """Sets the width and height scale of the movie""" + pass + + def setVolume(self,volume): + """Set the volume of the movie""" + pass + + def stop(self): + """Stops the movie""" + pass + +class ptNetLinkingMgr: + """Constructor to get access to the net link manager""" + def __init__(self): + """None""" + pass + + def getCurrAgeLink(self): + """Get the ptAgeLinkStruct for the current age""" + pass + + def getPrevAgeLink(self): + """Get the ptAgeLinkStruct for the previous age""" + pass + + def isEnabled(self): + """True if linking is enabled.""" + pass + + def linkPlayerHere(self,pid): + """link player(pid) to where I am""" + pass + + def linkPlayerToAge(self,ageLink,pid): + """Link player(pid) to ageLink""" + pass + + def linkToAge(self,ageLink): + """Links to ageLink (ptAgeLinkStruct)""" + pass + + def linkToMyNeighborhoodAge(self): + """Link to my Neighborhood Age""" + pass + + def linkToMyPersonalAge(self): + """Link to my Personal Age""" + pass + + def linkToMyPersonalAgeWithYeeshaBook(self): + """Link to my Personal Age with the YeeshaBook""" + pass + + def linkToPlayersAge(self,pid): + """Link me to where player(pid) is""" + pass + + def setEnabled(self,enable): + """Enable/Disable linking.""" + pass + +class ptNotify: + """Creates a Notify message +- selfKey is ptKey of your PythonFile modifier""" + def __init__(self,selfKey): + """None""" + pass + + def addActivateEvent(self,activeFlag,activateFlag): + """Add an activate event record to the notify message""" + pass + + def addCallbackEvent(self,eventNumber): + """Add a callback event record to the notify message""" + pass + + def addCollisionEvent(self,enterFlag,hitterKey,hitteeKey): + """Add a collision event record to the Notify message""" + pass + + def addContainerEvent(self,enteringFlag,containerKey,containedKey): + """Add a container event record to the notify message""" + pass + + def addControlKeyEvent(self,keynumber,downFlag): + """Add a keyboard event record to the Notify message""" + pass + + def addFacingEvent(self,enabledFlag,facerKey, faceeKey, dotProduct): + """Add a facing event record to the Notify message""" + pass + + def addPickEvent(self,enabledFlag,pickerKey,pickeeKey,hitPoint): + """Add a pick event record to the Notify message""" + pass + + def addReceiver(self,key): + """Add a receivers key to receive this Notify message""" + pass + + def addResponderState(self,state): + """Add a responder state event record to the notify message""" + pass + + def addVarKey(self,name,key): + """Add a ptKey variable event record to the Notify message +This event record is used to pass a ptKey variable to another python program""" + pass + + def addVarNumber(self,name,number): + """Add a number variable event record to the Notify message +This event record is used to pass a number variable to another python program""" + pass + + def clearReceivers(self): + """Remove all the receivers that this Notify message has +- receivers are automatically added if from a ptAttribActivator""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object""" + pass + + def netPropagate(self,netFlag): + """Sets the net propagate flag - default to set""" + pass + + def send(self): + """Send the notify message""" + pass + + def setActivate(self,state): + """Set the activate state to true(1.0) or false(0.0)""" + pass + + def setType(self,type): + """Sets the message type""" + pass + +class ptParticle: + """Plasma particle system class""" + def __init__(self): + """None""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object""" + pass + + def setGeneratorLife(self,value): + """NEEDS DOCSTRING""" + pass + + def setHeightSize(self,value): + """NEEDS DOCSTRING""" + pass + + def setInitPitchRange(self,value): + """NEEDS DOCSTRING""" + pass + + def setInitYawRange(self,value): + """NEEDS DOCSTRING""" + pass + + def setParticleLifeMaximum(self,value): + """NEEDS DOCSTRING""" + pass + + def setParticleLifeMinimum(self,value): + """NEEDS DOCSTRING""" + pass + + def setParticlesPerSecond(self,value): + """NEEDS DOCSTRING""" + pass + + def setScaleMaximum(self,value): + """NEEDS DOCSTRING""" + pass + + def setScaleMinimum(self,value): + """NEEDS DOCSTRING""" + pass + + def setVelocityMaximum(self,value): + """NEEDS DOCSTRING""" + pass + + def setVelocityMinimum(self,value): + """NEEDS DOCSTRING""" + pass + + def setWidthSize(self,value): + """NEEDS DOCSTRING""" + pass + +class ptPhysics: + """Plasma physics class""" + def __init__(self): + """None""" + pass + + def angularImpulse(self,impulseVector): + """Add the given vector (representing a rotation axis and magnitude) to +the attached sceneobject's velocity""" + pass + + def damp(self,damp): + """Reduce all velocities on the object (0 = all stop, 1 = no effect)""" + pass + + def disable(self): + """Disables physics on the sceneobject attached""" + pass + + def disableCollision(self): + """Disables collision detection on the attached sceneobject""" + pass + + def enable(self,state=1): + """Sets the physics enable state for the sceneobject attached""" + pass + + def enableCollision(self): + """Enables collision detection on the attached sceneobject""" + pass + + def force(self,forceVector): + """Applies the specified force to the attached sceneobject""" + pass + + def forceWithOffset(self,forceVector,offsetPt): + """Applies the specified offsetted force to the attached sceneobject""" + pass + + def impulse(self,impulseVector): + """Adds the given vector to the attached sceneobject's velocity""" + pass + + def impulseWithOffset(self,impulseVector,offsetPt): + """Adds the given vector to the attached sceneobject's velocity +with the specified offset""" + pass + + def move(self,direction,distance): + """Moves the attached sceneobject the specified distance in the specified direction""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object""" + pass + + def rotate(self,radians,axis): + """Rotates the attached sceneobject the specified radians around the specified axis""" + pass + + def shiftMass(self,offsetVector): + """Shifts the attached sceneobject's center to mass in the specified direction and distance""" + pass + + def suppress(self,doSuppress): + """Completely remove the physical, but keep it around so it +can be added back later.""" + pass + + def torque(self,torqueVector): + """Applies the specified torque to the attached sceneobject""" + pass + + def warp(self,position): + """Warps the sceneobject to a specified location. +'position' can be a ptPoint3 or a ptMatrix44""" + pass + + def warpObj(self,objkey): + """Warps the sceneobject to match the location and orientation of the specified object""" + pass + +class ptPlayer: + """And optionally __init__(name,playerID)""" + def __init__(self,avkey,name,playerID,distanceSq): + """None""" + pass + + def getDistanceSq(self): + """Returns the distance to remote player from local player""" + pass + + def getPlayerID(self): + """Returns the unique player ID""" + pass + + def getPlayerName(self): + """Returns the name of the player""" + pass + + def isCCR(self): + """Is this player a CCR?""" + pass + + def isServer(self): + """Is this player a server?""" + pass + +class ptPoint3: + """Plasma Point class""" + def __init__(self,x=0, y=0, z=0): + """None""" + pass + + def copy(self): + """Returns a copy of the point in another ptPoint3 object""" + pass + + def distance(self,other): + """Computes the distance from this point to 'other' point""" + pass + + def distanceSq(self,other): + """Computes the distance squared from this point to 'other' point +- this function is faster than distance(other)""" + pass + + def getX(self): + """Returns the 'x' component of the point""" + pass + + def getY(self): + """Returns the 'y' component of the point""" + pass + + def getZ(self): + """Returns the 'z' component of the point""" + pass + + def setX(self,x): + """Sets the 'x' component of the point""" + pass + + def setY(self,y): + """Sets the 'y' component of the point""" + pass + + def setZ(self,z): + """Sets the 'z' component of the point""" + pass + + def zero(self): + """Sets the 'x','y' and the 'z' component to zero""" + pass + +class ptSDL: + """SDL accessor""" + def __init__(self): + """None""" + pass + + def sendToClients(self,key): + """Sets it so changes to this key are sent to the +server AND the clients. (Normally it just goes +to the server.)""" + pass + + def setDefault(self,key,value): + """Like setitem, but doesn't broadcast over the net. +Only use for setting defaults that everyone will +already know (from reading it off disk)""" + pass + + def setFlags(self,name,sendImmediate,skipOwnershipCheck): + """Sets the flags for a variable in this SDL""" + pass + + def setIndex(self,key,idx,value): + """Sets the value at a specific index in the tuple, +so you don't have to pass the whole thing in""" + pass + + def setIndexNow(self,key,idx,value): + """Same as setIndex but sends immediately""" + pass + + def setNotify(self,selfkey,key,tolerance): + """Sets the OnSDLNotify to be called when 'key' +SDL variable changes by 'tolerance' (if number)""" + pass + + def setTagString(self,name,tag): + """Sets the tag string for a variable""" + pass + +class ptSDLStateDataRecord: + """Basic SDL state data record class""" + def __init__(self): + """None""" + pass + + def findVar(self,name): + """Finds and returns the specified ptSimpleStateVariable""" + pass + + def getName(self): + """Returns our record's name""" + pass + + def getVarList(self): + """Returns the names of the vars we hold as a list of strings""" + pass + + def setFromDefaults(self,timeStampNow): + """Sets all our vars to their defaults""" + pass + +class ptSceneobject: + """Plasma Sceneobject class""" + def __init__(self,objKey, selfKey): + """None""" + pass + + def addKey(self,key): + """Mostly used internally. +Add another sceneobject ptKey""" + pass + + def animate(self): + """If we can animate, start animating""" + pass + + def avatarVelocity(self): + """Returns the velocity of the first attached avatar scene object""" + pass + + def fastForwardAttachedResponder(self,state): + """Fast forward the attached responder to the specified state""" + pass + + def findObject(self,name): + """Find a particular object in just the sceneobjects that are attached""" + pass + + def getKey(self): + """Get the ptKey of this sceneobject +If there are more then one attached, get the first one""" + pass + + def getLocalToParent(self): + """Returns ptMatrix44 of the local to parent transform for this sceneobject +- If there is more than one sceneobject attached, returns just the first one""" + pass + + def getLocalToWorld(self): + """Returns ptMatrix44 of the local to world transform for this sceneobject +- If there is more than one sceneobject attached, returns just the first one""" + pass + + def getName(self): + """Returns the name of the sceneobject (Max name) +- If there are more than one sceneobject attached, return just the first one""" + pass + + def getParentToLocal(self): + """Returns ptMatrix44 of the parent to local transform for this sceneobject +- If there is more than one sceneobject attached, returns just the first one""" + pass + + def getPythonMods(self): + """Returns list of ptKeys of the python modifiers attached to this sceneobject""" + pass + + def getResponderState(self): + """Return the responder state (if we are a responder)""" + pass + + def getResponders(self): + """Returns list of ptKeys of the responders attached to this sceneobject""" + pass + + def getSoundIndex(self,sndComponentName): + """Get the index of the requested sound component""" + pass + + def getWorldToLocal(self): + """Returns ptMatrix44 of the world to local transform for this sceneobject +- If there is more than one sceneobject attached, returns just the first one""" + pass + + def isAvatar(self): + """Returns true if the scene object is an avatar""" + pass + + def isHuman(self): + """Returns true if the scene object is a human avatar""" + pass + + def isLocallyOwned(self): + """Returns true(1) if this object is locally owned by this client +or returns false(0) if it is not or don't know""" + pass + + def netForce(self,forceFlag): + """Specify whether this object needs to use messages that are forced to the network +- This is to be used if your Python program is running on only one client +Such as a game master, only running on the client that owns a particular object +- Setting the netForce flag on a sceneobject will also set the netForce flag on +its draw, physics, avatar, particle objects""" + pass + + def playAnimNamed(self,animName): + """Play the attached named animation""" + pass + + def popCamera(self,avKey): + """Pop the camera stack and go back to the previous camera""" + pass + + def popCutsceneCamera(self,avKey): + """Pop the camera stack and go back to previous camera.""" + pass + + def position(self): + """Returns the scene object's current position""" + pass + + def pushCamera(self,avKey): + """Switch to this object (if it is a camera)""" + pass + + def pushCameraCut(self,avKey): + """Switch to this object, cutting the view (if it is a camera)""" + pass + + def pushCutsceneCamera(self,cutFlag,avKey): + """Switch to this object (assuming that it is actually a camera)""" + pass + + def rewindAnimNamed(self,animName): + """Rewind the attached named animation""" + pass + + def right(self): + """Returns the scene object's current right vector""" + pass + + def runAttachedResponder(self,state): + """Run the attached responder to the specified state""" + pass + + def setSoundFilename(self,index, filename, isCompressed): + """Sets the sound attached to this sceneobject to use the specified sound file.""" + pass + + def setTransform(self,local2world,world2local): + """Set our current transforms""" + pass + + def stopAnimNamed(self,animName): + """Stop the attached named animation""" + pass + + def up(self): + """Returns the scene object's current up vector""" + pass + + def view(self): + """Returns the scene object's current view vector""" + pass + + def volumeSensorIgnoreExtraEnters(self,ignore): + """Tells the volume sensor attached to this object to ignore extra enters (default), or not (hack for garrison).""" + pass + +class ptScoreMgr: + """Game score manager""" + def __init__(self): + """None""" + pass + + def createGlobalScore(self,gameName, gameType, value): + """Creates a score and returns it""" + pass + + def createNeighborhoodScore(self,gameName, gameType, value): + """Creates a score and returns it""" + pass + + def createPlayerScore(self,gameName, gameType, value): + """Creates a score and returns it""" + pass + + def deleteScore(self,scoreId): + """Deletes the specified score""" + pass + + def getGlobalScores(self,gameName): + """Returns a list of scores associated with the specified game.""" + pass + + def getNeighborhoodScores(self,gameName): + """Returns a list of scores associated with the specified game.""" + pass + + def getPlayerScores(self,gameName): + """Returns a list of scores associated with the specified game.""" + pass + + def getRankList(self,ownerInfoId, scoreGroup, parentFolderId, gameName, timePeriod, numResults, pageNumber, sortDesc): + """Returns a list of scores and rank""" + pass + +class ptSimpleStateVariable: + """Basic SDL state data record class""" + def __init__(self): + """None""" + pass + + def getBool(self,idx=0): + """Returns a boolean variable's value""" + pass + + def getByte(self,idx=0): + """Returns a byte variable's value""" + pass + + def getDefault(self): + """Returns the variable's default""" + pass + + def getDisplayOptions(self): + """Returns the variable's display options""" + pass + + def getDouble(self,idx=0): + """Returns a double variable's value""" + pass + + def getFloat(self,idx=0): + """Returns a float variable's value""" + pass + + def getInt(self,idx=0): + """Returns an int variable's value""" + pass + + def getShort(self,idx=0): + """Returns a short variable's value""" + pass + + def getString(self,idx=0): + """Returns a string variable's value""" + pass + + def getType(self): + """Returns the variable's type""" + pass + + def isAlwaysNew(self): + """Is this variable always new?""" + pass + + def isInternal(self): + """Is this an internal variable?""" + pass + + def setBool(self,val,idx=0): + """Sets a boolean variable's value""" + pass + + def setByte(self,val,idx=0): + """Sets a byte variable's value""" + pass + + def setDouble(self,val,idx=0): + """Sets a double variable's value""" + pass + + def setFloat(self,val,idx=0): + """Sets a float variable's value""" + pass + + def setInt(self,val,idx=0): + """Sets an int variable's value""" + pass + + def setShort(self,val,idx=0): + """Sets a short variable's value""" + pass + + def setString(self,val,idx=0): + """Sets a string variable's value""" + pass + +class ptSpawnPointInfo: + """Class to hold spawn point data""" + def __init__(self,title=None,spawnPt=None): + """None""" + pass + + def getCameraStack(self): + """Returns the camera stack for this spawnpoint as a string""" + pass + + def getName(self): + """Returns the spawnpoint's name""" + pass + + def getTitle(self): + """Returns the spawnpoint's title""" + pass + + def setCameraStack(self,stack): + """Sets the spawnpoint's camera stack (as a string)""" + pass + + def setName(self,name): + """Sets the spawnpoint's name""" + pass + + def setTitle(self,title): + """Sets the spawnpoint's title""" + pass + +class ptSpawnPointInfoRef: + """Class to hold spawn point data""" + def __init__(self): + """None""" + pass + + def getCameraStack(self): + """Returns the camera stack for this spawnpoint as a string""" + pass + + def getName(self): + """Returns the spawnpoint's name""" + pass + + def getTitle(self): + """Returns the spawnpoint's title""" + pass + + def setCameraStack(self,stack): + """Sets the spawnpoint's camera stack (as a string)""" + pass + + def setName(self,name): + """Sets the spawnpoint's name""" + pass + + def setTitle(self,title): + """Sets the spawnpoint's title""" + pass + +class ptStatusLog: + """A status log class""" + def __init__(self): + """None""" + pass + + def close(self): + """Close the status log file""" + pass + + def isOpen(self): + """Returns whether the status log is currently opened""" + pass + + def open(self,logName,numLines,flags): + """Open a status log for writing to +'logname' is the name of the log file (example: special.log) +'numLines' is the number of lines to display on debug screen +'flags' is a PlasmaConstants.PtStatusLogFlags""" + pass + + def write(self,text,color=None): + """If the status log is open, write 'text' to log +'color' is the display color in debug screen""" + pass + +class ptStream: + """A basic stream class""" + def __init__(self): + """None""" + pass + + def close(self): + """Close the status log file""" + pass + + def isOpen(self): + """Returns whether the stream file is currently opened""" + pass + + def open(self,fileName,flags): + """Open a stream file for reading or writing""" + pass + + def readlines(self): + """Reads a list of strings from the file""" + pass + + def writelines(self,lines): + """Write a list of strings to the file""" + pass + +class ptSwimCurrentInterface: + """Creates a new ptSwimCurrentInterface""" + def __init__(self,key): + """None""" + pass + + def disable(self): + """UNKNOWN""" + pass + + def enable(self): + """UNKNOWN""" + pass + +class ptVault: + """Accessor class to the player's vault""" + def __init__(self): + """None""" + pass + + def addChronicleEntry(self,entryName,type,string): + """Adds an entry to the player's chronicle with a value of 'string'.""" + pass + + def amAgeCzar(self,ageInfo): + """Are we the czar (WTH is this?) of the specified age?""" + pass + + def amAgeOwner(self,ageInfo): + """Are we the owner of the specified age?""" + pass + + def amCzarOfCurrentAge(self): + """Are we the czar (WTH is this?) of the current age?""" + pass + + def amOwnerOfCurrentAge(self): + """Are we the owner of the current age?""" + pass + + def createNeighborhood(self): + """Creates a new neighborhood""" + pass + + def findChronicleEntry(self,entryName): + """Returns a ptVaultNode of type kNodeTypeChronicle of the current player's chronicle entry by entryName.""" + pass + + def findNode(self,templateNode): + """Find the node matching the template""" + pass + + def getAgeJournalsFolder(self): + """Returns a ptVaultFolderNode of the current player's age journals folder.""" + pass + + def getAgesICanVisitFolder(self): + """Returns a ptVaultFolderNode of ages I can visit""" + pass + + def getAgesIOwnFolder(self): + """Returns a ptVaultFolderNode of ages that I own""" + pass + + def getAvatarClosetFolder(self): + """Do not use. +Returns a ptVaultFolderNode of the avatars outfit in their closet.""" + pass + + def getAvatarOutfitFolder(self): + """Do not use. +Returns a ptVaultFolderNode of the avatars outfit.""" + pass + + def getBuddyListFolder(self): + """Returns a ptVaultPlayerInfoListNode of the current player's buddy list folder.""" + pass + + def getChronicleFolder(self): + """Returns a ptVaultFolderNode of the current player's chronicle folder.""" + pass + + def getGlobalInbox(self): + """Returns a ptVaultFolderNode of the global inbox folder.""" + pass + + def getIgnoreListFolder(self): + """Returns a ptVaultPlayerInfoListNode of the current player's ignore list folder.""" + pass + + def getInbox(self): + """Returns a ptVaultFolderNode of the current player's inbox folder.""" + pass + + def getInviteFolder(self): + """Returns a ptVaultFolderNode of invites""" + pass + + def getKIUsage(self): + """Returns a tuple with usage statistics of the KI (# of pics, # of text notes, # of marker games)""" + pass + + def getLinkToCity(self): + """Returns a ptVaultAgeLinkNode that will go to the city""" + pass + + def getLinkToMyNeighborhood(self): + """Returns a ptVaultAgeLinkNode that will go to my neighborhood""" + pass + + def getOwnedAgeLink(self,ageInfo): + """Returns a ptVaultAgeLinkNode to my owned age(ageInfo)""" + pass + + def getPeopleIKnowAboutFolder(self): + """Returns a ptVaultPlayerInfoListNode of the current player's people I know about (Recent) list folder.""" + pass + + def getPlayerInfo(self): + """Returns a ptVaultNode of type kNodeTypePlayerInfo of the current player""" + pass + + def getPsnlAgeSDL(self): + """Returns the personal age SDL""" + pass + + def getVisitAgeLink(self,ageInfo): + """Returns a ptVaultAgeLinkNode for a visitor to age(ageInfo)""" + pass + + def inMyNeighborhoodAge(self): + """Are we in the player's neighborhood age?""" + pass + + def inMyPersonalAge(self): + """Are we in the player's personal age?""" + pass + + def invitePlayerToAge(self,link,playerID): + """Sends an invitation to visit the age to the specified player""" + pass + + def offerLinkToPlayer(self,link,playerID): + """Offer a one-time link to the specified player""" + pass + + def registerMTStation(self,stationName,mtSpawnPoint): + """Registers this player at the specified mass-transit point""" + pass + + def registerOwnedAge(self,link): + """Registers the specified age as owned by the player""" + pass + + def registerVisitAge(self,link): + """Register this age as visitable by this player""" + pass + + def sendToDevice(self,node,deviceName): + """Sends a ptVaultNode object to an Age's device by deviceName.""" + pass + + def setAgePublic(self,ageInfo,makePublic): + """Makes the specified age public or private""" + pass + + def unInvitePlayerToAge(self,guid,playerID): + """Revokes the invitation to visit the age""" + pass + + def unRegisterOwnedAge(self,ageFilename): + """Unregisters the specified age so it's no longer owned by this player""" + pass + + def unRegisterVisitAge(self,guid): + """Unregisters the specified age so it can no longer be visited by this player""" + pass + + def updatePsnlAgeSDL(self,pyrec): + """Updates the personal age SDL to the specified data""" + pass + +class ptVaultNode: + """Vault node class""" + def __init__(self): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultFolderNode(ptVaultNode): + """Plasma vault folder node""" + def __init__(self,n=0): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def folderGetName(self): + """LEGACY +Returns the folder's name""" + pass + + def folderGetType(self): + """LEGACY +Returns the folder type (of the standard folder types)""" + pass + + def folderSetName(self,name): + """LEGACY +Set the folder name""" + pass + + def folderSetType(self,type): + """LEGACY +Set the folder type""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getFolderName(self): + """Returns the folder's name""" + pass + + def getFolderNameW(self): + """Unicode version of getFolerName""" + pass + + def getFolderType(self): + """Returns the folder type (of the standard folder types)""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setFolderName(self,name): + """Set the folder name""" + pass + + def setFolderNameW(self,name): + """Unicode version of setFolderName""" + pass + + def setFolderType(self,type): + """Set the folder type""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultAgeInfoListNode(ptVaultFolderNode): + """Plasma vault age info list node""" + def __init__(self,n=0): + """None""" + pass + + def addAge(self,ageID): + """Adds ageID to list of ages""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def folderGetName(self): + """LEGACY +Returns the folder's name""" + pass + + def folderGetType(self): + """LEGACY +Returns the folder type (of the standard folder types)""" + pass + + def folderSetName(self,name): + """LEGACY +Set the folder name""" + pass + + def folderSetType(self,type): + """LEGACY +Set the folder type""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getFolderName(self): + """Returns the folder's name""" + pass + + def getFolderNameW(self): + """Unicode version of getFolerName""" + pass + + def getFolderType(self): + """Returns the folder type (of the standard folder types)""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasAge(self,ageID): + """Returns whether ageID is in the list of ages""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAge(self,ageID): + """Removes ageID from list of ages""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setFolderName(self,name): + """Set the folder name""" + pass + + def setFolderNameW(self,name): + """Unicode version of setFolderName""" + pass + + def setFolderType(self,type): + """Set the folder type""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultAgeInfoNode(ptVaultNode): + """Plasma vault age info node""" + def __init__(self,n=0): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def asAgeInfoStruct(self): + """Returns this ptVaultAgeInfoNode as a ptAgeInfoStruct""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getAgeDescription(self): + """Returns the description of the age""" + pass + + def getAgeFilename(self): + """Returns the age filename""" + pass + + def getAgeID(self): + """Returns the age ID""" + pass + + def getAgeInstanceGuid(self): + """Returns the age instance guid""" + pass + + def getAgeInstanceName(self): + """Returns the instance name of the age""" + pass + + def getAgeLanguage(self): + """Returns the age's language (integer)""" + pass + + def getAgeOwnersFolder(self): + """Returns a ptVaultPlayerInfoList of the players that own this age""" + pass + + def getAgeSDL(self): + """Returns a ptVaultSDLNode of the age's SDL""" + pass + + def getAgeSequenceNumber(self): + """Returns the sequence number of this instance of the age""" + pass + + def getAgeUserDefinedName(self): + """Returns the user define part of the age name""" + pass + + def getCanVisitFolder(self): + """Returns a ptVaultPlayerInfoList of the players that can visit this age""" + pass + + def getChildAgesFolder(self): + """Returns a ptVaultFolderNode of the child ages of this age""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getCzar(self): + """Returns ptVaultPlayerInfoNode of the player that is the Czar""" + pass + + def getCzarID(self): + """Returns the ID of the age's czar""" + pass + + def getDisplayName(self): + """Returns the displayable version of the age name""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getParentAgeLink(self): + """Returns ptVaultAgeLinkNode of the age's parent age, or None if not a child age""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def isPublic(self): + """Returns whether the age is Public or Not""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setAgeDescription(self,description): + """Sets the description of the age""" + pass + + def setAgeFilename(self,fileName): + """Sets the filename""" + pass + + def setAgeID(self,ageID): + """Sets the age ID""" + pass + + def setAgeInstanceGuid(self,guid): + """Sets the age instance GUID""" + pass + + def setAgeInstanceName(self,instanceName): + """Sets the instance name""" + pass + + def setAgeLanguage(self,lang): + """Sets the age's language (integer)""" + pass + + def setAgeSequenceNumber(self,seqNumber): + """Sets the sequence number""" + pass + + def setAgeUserDefinedName(self,udname): + """Sets the user defined part of the name""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultAgeLinkNode(ptVaultNode): + """Plasma vault age link node""" + def __init__(self,n=0): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def addSpawnPoint(self,point): + """Adds the specified ptSpawnPointInfo or ptSpawnPointInfoRef""" + pass + + def asAgeLinkStruct(self): + """Returns this ptVaultAgeLinkNode as a ptAgeLinkStruct""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getAgeInfo(self): + """Returns the ageInfo as a ptAgeInfoStruct""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getLocked(self): + """Returns whether the link is locked or not""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getSpawnPoints(self): + """Returns a list of ptSpawnPointInfo objects""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def getVolatile(self): + """Returns whether the link is volatile or not""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def hasSpawnPoint(self,spawnPtName): + """Returns true if this link has the specified spawn point""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def removeSpawnPoint(self,point): + """Removes the specified spawn point based on a ptSpawnPointInfo, ptSpawnPointInfoRef, or string""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setLocked(self,state): + """Sets whether the link is locked or not""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def setVolatile(self,state): + """Sets the state of the volitility of the link""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultChronicleNode(ptVaultNode): + """Plasma vault chronicle node""" + def __init__(self,n=0): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def chronicleGetName(self): + """LEGACY: Returns the name of the chronicle node.""" + pass + + def chronicleGetType(self): + """LEGACY: Returns the user defined type of the chronicle node.""" + pass + + def chronicleGetValue(self): + """LEGACY: Returns the value as a string of this chronicle node.""" + pass + + def chronicleSetName(self,name): + """LEGACY: Sets the name of the chronicle node.""" + pass + + def chronicleSetType(self,type): + """LEGACY: Sets this chronicle node to a user defined type.""" + pass + + def chronicleSetValue(self,value): + """LEGACY: Sets the chronicle to a value that is a string""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getEntryType(self): + """Returns the user defined type of the chronicle node.""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getName(self): + """Returns the name of the chronicle node.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def getValue(self): + """Returns the value as a string of this chronicle node.""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setEntryType(self,type): + """Sets this chronicle node to a user defined type.""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setName(self,name): + """Sets the name of the chronicle node.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def setValue(self,value): + """Sets the chronicle to a value that is a string""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultImageNode(ptVaultNode): + """Plasma vault image node""" + def __init__(self,n=0): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getImage(self): + """Returns the image(ptImage) of this image node""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getTitle(self): + """Returns the title (caption) of this image node""" + pass + + def getTitleW(self): + """Unicode version of getTitle""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def imageGetImage(self): + """LEGACY +Returns the image(ptImage) of this image node""" + pass + + def imageGetTitle(self): + """LEGACY +Returns the title (caption) of this image node""" + pass + + def imageSetImage(self,image): + """LEGACY +Sets the image(ptImage) of this image node""" + pass + + def imageSetTitle(self,title): + """LEGACY +Sets the title (caption) of this image node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setImage(self,image): + """Sets the image(ptImage) of this image node""" + pass + + def setImageFromBuf(self,buf): + """Sets our image from a buffer""" + pass + + def setImageFromScrShot(self): + """Grabs a screenshot and stuffs it into this node""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setTitle(self,title): + """Sets the title (caption) of this image node""" + pass + + def setTitleW(self,title): + """Unicode version of setTitle""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultMarkerGameNode(ptVaultNode): + """Plasma vault age info node""" + def __init__(self,n=0): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getGameGuid(self): + """Returns the marker game's guid""" + pass + + def getGameName(self): + """Returns the marker game's name""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setGameGuid(self,guid): + """Sets the marker game's guid""" + pass + + def setGameName(self,name): + """Sets marker game's name""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultNodeRef: + """Vault node relationship pseudo class""" + def __init__(self): + """None""" + pass + + def beenSeen(self): + """Returns true until we reimplement this""" + pass + + def getChild(self): + """Returns a ptVaultNode that is the child of this reference""" + pass + + def getChildID(self): + """Returns id of the child node""" + pass + + def getParent(self): + """Returns a ptVaultNode that is the parent of the reference""" + pass + + def getParentID(self): + """Returns id of the parent node""" + pass + + def getSaver(self): + """Returns a ptVaultPlayerInfoNode of player that created this relationship""" + pass + + def getSaverID(self): + """Returns id of player that created this relationship""" + pass + + def setSeen(self): + """Does nothing until we reimplement this""" + pass + +class ptVaultPlayerInfoListNode(ptVaultFolderNode): + """Plasma vault player info list node""" + def __init__(self,n=0): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def addPlayer(self,playerID): + """Adds playerID player to this player info list node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def folderGetName(self): + """LEGACY +Returns the folder's name""" + pass + + def folderGetType(self): + """LEGACY +Returns the folder type (of the standard folder types)""" + pass + + def folderSetName(self,name): + """LEGACY +Set the folder name""" + pass + + def folderSetType(self,type): + """LEGACY +Set the folder type""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getFolderName(self): + """Returns the folder's name""" + pass + + def getFolderNameW(self): + """Unicode version of getFolerName""" + pass + + def getFolderType(self): + """Returns the folder type (of the standard folder types)""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getPlayer(self,playerID): + """Gets the player info node for the specified player.""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def hasPlayer(self,playerID): + """Returns whether the 'playerID' is a member of this player info list node.""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def playerlistAddPlayer(self,playerID): + """LEGACY: Adds playerID player to this player info list node.""" + pass + + def playerlistGetPlayer(self,playerID): + """LEGACY: Gets the player info node for the specified player.""" + pass + + def playerlistHasPlayer(self,playerID): + """LEGACY: Returns whether the 'playerID' is a member of this player info list node.""" + pass + + def playerlistRemovePlayer(self,playerID): + """LEGACY: Removes playerID player from this player info list node.""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def removePlayer(self,playerID): + """Removes playerID player from this player info list node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setFolderName(self,name): + """Set the folder name""" + pass + + def setFolderNameW(self,name): + """Unicode version of setFolderName""" + pass + + def setFolderType(self,type): + """Set the folder type""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def sort(self): + """Sorts the player list by some means...?""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultPlayerInfoNode(ptVaultNode): + """Plasma vault folder node""" + def __init__(self): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def playerGetAgeGuid(self): + """Returns the guid as a string of where the player is for this player info node.""" + pass + + def playerGetAgeInstanceName(self): + """Returns the name of the Age where the player is for this player info node.""" + pass + + def playerGetCCRLevel(self): + """Returns the ccr level of the player for this player info node.""" + pass + + def playerGetID(self): + """Returns the player ID for this player info node.""" + pass + + def playerGetName(self): + """Returns the player name of this player info node.""" + pass + + def playerIsOnline(self): + """Returns the online status of the player for this player info node.""" + pass + + def playerSetAgeGuid(self,guidString): + """Not sure this should be used. Sets the guid for this player info node.""" + pass + + def playerSetAgeInstanceName(self,name): + """Not sure this should be used. Sets the name of the age where the player is for this player info node.""" + pass + + def playerSetID(self,playerID): + """Not sure this should be used. Sets the playerID for this player info node.""" + pass + + def playerSetName(self,name): + """Not sure this should be used. Sets the player name of this player info node.""" + pass + + def playerSetOnline(self,state): + """Not sure this should be used. Sets the state of the player online status for this player info node.""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultSDLNode(ptVaultNode): + """Plasma vault SDL node""" + def __init__(self): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getIdent(self): + """UNKNOWN""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getStateDataRecord(self): + """Returns the ptSDLStateDataRecord associated with this node""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def initStateDataRecord(self,filename,flags): + """Read the SDL Rec from File if needed""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setIdent(self,v): + """UNKNOWN""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setStateDataRecord(self,rec,writeOptions=0): + """Sets the ptSDLStateDataRecord""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultSystemNode(ptVaultNode): + """Plasma vault system node""" + def __init__(self): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getType(self): + """Returns the type of ptVaultNode this is. +See PlasmaVaultTypes.py""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setType(self,type): + """Set the type of ptVaultNode this is.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVaultTextNoteNode(ptVaultNode): + """Plasma vault text note node""" + def __init__(self): + """None""" + pass + + def addNode(self,node,cb=None,cbContext=0): + """Adds 'node'(ptVaultNode) as a child to this node.""" + pass + + def findNode(self,templateNode): + """Returns ptVaultNode if child node found matching template, or None""" + pass + + def getChildNodeCount(self): + """Returns how many children this node has.""" + pass + + def getChildNodeRefList(self): + """Returns a list of ptVaultNodeRef that are the children of this node.""" + pass + + def getClientID(self): + """Returns the client's ID.""" + pass + + def getCreateAgeCoords(self): + """Returns the location in the Age where this node was created.""" + pass + + def getCreateAgeGuid(self): + """Returns the guid as a string of the Age where this node was created.""" + pass + + def getCreateAgeName(self): + """Returns the name of the Age where this node was created.""" + pass + + def getCreateAgeTime(self): + """Returns the time in the Age that the node was created...(?)""" + pass + + def getCreateTime(self): + """Returns the when this node was created, that is useable by python's time library.""" + pass + + def getCreatorNode(self): + """Returns the creator's node""" + pass + + def getCreatorNodeID(self): + """Returns the creator's node ID""" + pass + + def getDeviceInbox(self): + """Returns a ptVaultFolderNode""" + pass + + def getID(self): + """Returns the unique ID of this ptVaultNode.""" + pass + + def getModifyTime(self): + """Returns the modified time of this node, that is useable by python's time library.""" + pass + + def getNode(self,id): + """Returns ptVaultNodeRef if is a child node, or None""" + pass + + def getOwnerNode(self): + """Returns a ptVaultNode of the owner of this node""" + pass + + def getOwnerNodeID(self): + """Returns the node ID of the owner of this node""" + pass + + def getSubType(self): + """Returns the subtype of this text note node.""" + pass + + def getText(self): + """Returns the text of this text note node.""" + pass + + def getTextW(self): + """Unicode version of getText.""" + pass + + def getTitle(self): + """Returns the title of this text note node.""" + pass + + def getTitleW(self): + """Unicode version of getTitle""" + pass + + def getType(self): + """Returns the type of text note for this text note node.""" + pass + + def hasNode(self,id): + """Returns true if node if a child node""" + pass + + def linkToNode(self,nodeID,cb=None,cbContext=0): + """Adds a link to the node designated by nodeID""" + pass + + def noteGetSubType(self): + """LEGACY +Returns the subtype of this text note node.""" + pass + + def noteGetText(self): + """LEGACY +Returns the text of this text note node.""" + pass + + def noteGetTitle(self): + """LEGACY +Returns the title of this text note node.""" + pass + + def noteGetType(self): + """LEGACY +Returns the type of text note for this text note node.""" + pass + + def noteSetSubType(self,subType): + """LEGACY +Sets the subtype of the this text note node.""" + pass + + def noteSetText(self,text): + """LEGACY +Sets text of the this text note node.""" + pass + + def noteSetTitle(self,title): + """LEGACY +Sets the title of this text note node.""" + pass + + def noteSetType(self,type): + """LEGACY +Sets the type of text note for this text note node.""" + pass + + def removeAllNodes(self): + """Removes all the child nodes on this node.""" + pass + + def removeNode(self,node,cb=None,cbContext=0): + """Removes the child 'node'(ptVaultNode) from this node.""" + pass + + def save(self,cb=None,cbContext=0): + """Save the changes made to this node.""" + pass + + def saveAll(self,cb=None,cbContext=0): + """Saves this node and all its children nodes.""" + pass + + def sendTo(self,destID,cb=None,cbContext=0): + """Send this node to inbox at 'destID'""" + pass + + def setCreateAgeGuid(self,guid): + """Set guid as a string of the Age where this node was created.""" + pass + + def setCreateAgeName(self,name): + """Set name of the Age where this node was created.""" + pass + + def setCreatorNodeID(self,id): + """Set creator's node ID""" + pass + + def setDeviceInbox(self,inboxName,cb=None,cbContext=0): + """Sets the device inbox""" + pass + + def setID(self,id): + """Sets ID of this ptVaultNode.""" + pass + + def setOwnerNodeID(self,id): + """Set node ID of the owner of this node""" + pass + + def setSubType(self,subType): + """Sets the subtype of the this text note node.""" + pass + + def setText(self,text): + """Sets text of the this text note node.""" + pass + + def setTextW(self,text): + """Unicode version of setText""" + pass + + def setTitle(self,title): + """Sets the title of this text note node.""" + pass + + def setTitleW(self,title): + """Unicode version of setTitle""" + pass + + def setType(self,type): + """Sets the type of text note for this text note node.""" + pass + + def upcastToAgeInfoListNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoListNode""" + pass + + def upcastToAgeInfoNode(self): + """Returns this ptVaultNode as ptVaultAgeInfoNode""" + pass + + def upcastToAgeLinkNode(self): + """Returns this ptVaultNode as ptVaultAgeLinkNode""" + pass + + def upcastToChronicleNode(self): + """Returns this ptVaultNode as ptVaultChronicleNode""" + pass + + def upcastToFolderNode(self): + """Returns this ptVaultNode as ptVaultFolderNode""" + pass + + def upcastToImageNode(self): + """Returns this ptVaultNode as ptVaultImageNode""" + pass + + def upcastToMarkerGameNode(self): + """Returns this ptVaultNode as ptVaultMarkerNode""" + pass + + def upcastToPlayerInfoListNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoListNode""" + pass + + def upcastToPlayerInfoNode(self): + """Returns this ptVaultNode as ptVaultPlayerInfoNode""" + pass + + def upcastToPlayerNode(self): + """Returns this ptVaultNode as a ptVaultPlayerNode""" + pass + + def upcastToSDLNode(self): + """Returns this ptVaultNode as a ptVaultSDLNode""" + pass + + def upcastToSystemNode(self): + """Returns this ptVaultNode as a ptVaultSystemNode""" + pass + + def upcastToTextNoteNode(self): + """Returns this ptVaultNode as ptVaultTextNoteNode""" + pass + +class ptVector3: + """Plasma Point class""" + def __init__(self,x=0, y=0, z=0): + """None""" + pass + + def add(self,other): + """Adds other to the current vector""" + pass + + def copy(self): + """Copies the vector into another one (which it returns)""" + pass + + def crossProduct(self,other): + """Finds the cross product between other and this vector""" + pass + + def dotProduct(self,other): + """Finds the dot product between other and this vector""" + pass + + def getX(self): + """Returns the 'x' component of the vector""" + pass + + def getY(self): + """Returns the 'y' component of the vector""" + pass + + def getZ(self): + """Returns the 'z' component of the vector""" + pass + + def length(self): + """Returns the length of the vector""" + pass + + def lengthSq(self): + """Returns the length of the vector, squared +- this function is faster then length(other)""" + pass + + def normalize(self): + """Normalizes the vector to length 1""" + pass + + def scale(self,scale): + """Scale the vector by scale""" + pass + + def setX(self,x): + """Sets the 'x' component of the vector""" + pass + + def setY(self,y): + """Sets the 'y' component of the vector""" + pass + + def setZ(self,z): + """Sets the 'z' component of the vector""" + pass + + def subtract(self,other): + """Subtracts other from the current vector""" + pass + + def zero(self): + """Zeros the vector's components""" + pass + +class ptWaveSet: + """Creates a new ptWaveSet""" + def __init__(self,ey): + """None""" + pass + + def getDepthFalloff(self): + """Returns the attribute's value""" + pass + + def getEnvCenter(self): + """Returns the attribute's value""" + pass + + def getEnvRadius(self): + """Returns the attribute's value""" + pass + + def getGeoAmpOverLen(self): + """Returns the attribute's value""" + pass + + def getGeoAngleDev(self): + """Returns the attribute's value""" + pass + + def getGeoChop(self): + """Returns the attribute's value""" + pass + + def getGeoMaxLength(self): + """Returns the attribute's value""" + pass + + def getGeoMinLength(self): + """Returns the attribute's value""" + pass + + def getMaxAtten(self): + """Returns the attribute's value""" + pass + + def getMinAtten(self): + """Returns the attribute's value""" + pass + + def getOpacFalloff(self): + """Returns the attribute's value""" + pass + + def getOpacOffset(self): + """Returns the attribute's value""" + pass + + def getReflFalloff(self): + """Returns the attribute's value""" + pass + + def getReflOffset(self): + """Returns the attribute's value""" + pass + + def getRippleScale(self): + """Returns the attribute's value""" + pass + + def getSpecularEnd(self): + """Returns the attribute's value""" + pass + + def getSpecularMute(self): + """Returns the attribute's value""" + pass + + def getSpecularNoise(self): + """Returns the attribute's value""" + pass + + def getSpecularStart(self): + """Returns the attribute's value""" + pass + + def getSpecularTint(self): + """Returns the attribute's value""" + pass + + def getTexAmpOverLen(self): + """Returns the attribute's value""" + pass + + def getTexAngleDev(self): + """Returns the attribute's value""" + pass + + def getTexChop(self): + """Returns the attribute's value""" + pass + + def getTexMaxLength(self): + """Returns the attribute's value""" + pass + + def getTexMinLength(self): + """Returns the attribute's value""" + pass + + def getWaterHeight(self): + """Returns the attribute's value""" + pass + + def getWaterOffset(self): + """Returns the attribute's value""" + pass + + def getWaterOpacity(self): + """Returns the attribute's value""" + pass + + def getWaterTint(self): + """Returns the attribute's value""" + pass + + def getWaveFalloff(self): + """Returns the attribute's value""" + pass + + def getWaveOffset(self): + """Returns the attribute's value""" + pass + + def getWindDir(self): + """Returns the attribute's value""" + pass + + def setDepthFalloff(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setEnvCenter(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setEnvRadius(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setGeoAmpOverLen(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setGeoAngleDev(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setGeoChop(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setGeoMaxLength(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setGeoMinLength(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setMaxAtten(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setMinAtten(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setOpacFalloff(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setOpacOffset(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setReflFalloff(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setReflOffset(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setRippleScale(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setSpecularEnd(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setSpecularMute(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setSpecularNoise(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setSpecularStart(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setSpecularTint(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setTexAmpOverLen(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setTexAngleDev(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setTexChop(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setTexMaxLength(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setTexMinLength(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setWaterHeight(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setWaterOffset(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setWaterOpacity(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setWaterTint(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setWaveFalloff(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setWaveOffset(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + + def setWindDir(self,s, secs = 0): + """Sets the attribute to s over secs time""" + pass + diff --git a/Python/plasma/PlasmaConstants.py b/Python/plasma/PlasmaConstants.py new file mode 100644 index 0000000000..4e2ec11a2d --- /dev/null +++ b/Python/plasma/PlasmaConstants.py @@ -0,0 +1,256 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +class Enum: + """Enum base class""" + def __init__(self): + """None""" + pass + +class EnumValue: + """A basic enumeration value""" + def __init__(self): + """None""" + pass + +class PtAIMsgType: + """(none)""" + kUnknown = 0 + kBrainCreated = 1 + kArrivedAtGoal = 2 + +class PtAccountUpdateType: + """(none)""" + kCreatePlayer = 1 + kDeletePlayer = 2 + kUpgradePlayer = 3 + kActivePlayer = 4 + kChangePassword = 5 + +class PtBehaviorTypes: + """(none)""" + kBehaviorTypeFall = 8192 + kBehaviorTypeIdle = 32 + kBehaviorTypeWalkingJump = 2 + kBehaviorTypeSidestepRight = 4096 + kBehaviorTypeRunningJump = 4 + kBehaviorTypeLinkIn = 65536 + kBehaviorTypeAnyJump = 7 + kBehaviorTypeRunningImpact = 8 + kBehaviorTypeWalk = 64 + kBehaviorTypeRun = 128 + kBehaviorTypeTurnRight = 1024 + kBehaviorTypeWalkBack = 256 + kBehaviorTypeMovingTurnLeft = 16384 + kBehaviorTypeGroundImpact = 16 + kBehaviorTypeStandingJump = 1 + kBehaviorTypeTurnLeft = 512 + kBehaviorTypeAnyImpact = 24 + kBehaviorTypeSidestepLeft = 2048 + kBehaviorTypeMovingTurnRight = 32768 + kBehaviorTypeLinkOut = 131072 + +class PtBookEventTypes: + """(none)""" + kNotifyImageLink = 0 + kNotifyShow = 1 + kNotifyHide = 2 + kNotifyNextPage = 3 + kNotifyPreviousPage = 4 + kNotifyCheckUnchecked = 5 + kNotifyClose = 6 + +class PtBrainModes: + """(none)""" + kGeneric = 0 + kLadder = 1 + kSit = 2 + kEmote = 3 + kAFK = 4 + kNonGeneric = 5 + +class PtButtonNotifyTypes: + """(none)""" + kNotifyOnUp = 0 + kNotifyOnDown = 1 + kNotifyOnUpAndDown = 2 + +class PtCCRPetitionType: + """(none)""" + kGeneralHelp = 0 + kBug = 1 + kFeedback = 2 + kExploit = 3 + kHarass = 4 + kStuck = 5 + kTechnical = 6 + +class PtEventType: + """(none)""" + kCollision = 1 + kPicked = 2 + kControlKey = 3 + kVariable = 4 + kFacing = 5 + kContained = 6 + kActivate = 7 + kCallback = 8 + kResponderState = 9 + kMultiStage = 10 + kSpawned = 11 + kClickDrag = 12 + kOfferLinkingBook = 14 + kBook = 15 + +class PtGUIMultiLineDirection: + """(none)""" + kLineStart = 1 + kLineEnd = 2 + kBufferStart = 3 + kBufferEnd = 4 + kOneBack = 5 + kOneForward = 6 + kOneWordBack = 7 + kOneWordForward = 8 + kOneLineUp = 9 + kOneLineDown = 10 + kPageUp = 11 + kPageDown = 12 + +class PtGameScoreTypes: + """(none)""" + kFixed = 0 + kAccumulative = 1 + kAccumAllowNegative = 2 + +class PtJustify: + """(none)""" + kLeftJustify = 0 + kCenter = 1 + kRightJustify = 2 + +class PtLOSObjectType: + """(none)""" + kClickables = 0 + kCameraBlockers = 1 + kCustom = 2 + kShootable = 3 + +class PtLOSReportType: + """(none)""" + kReportHit = 0 + kReportMiss = 1 + kReportHitOrMiss = 2 + +class PtLanguage: + """(none)""" + kEnglish = 0 + kFrench = 1 + kGerman = 2 + kSpanish = 3 + kItalian = 4 + kJapanese = 5 + kNumLanguages = 6 + +class PtMarkerMsgType: + """(none)""" + kMarkerCaptured = 0 + +class PtMovieEventReason: + """(none)""" + kMovieDone = 0 + +class PtMultiStageEventType: + """(none)""" + kEnterStage = 1 + kBeginingOfLoop = 2 + kAdvanceNextStage = 3 + kRegressPrevStage = 4 + +class PtNotificationType: + """(none)""" + kActivator = 0 + kVarNotification = 1 + kNotifySelf = 2 + kResponderFF = 3 + kResponderChangeState = 4 + +class PtNotifyDataType: + """(none)""" + kNumber = 1 + kKey = 2 + +class PtSDLReadWriteOptions: + """(none)""" + kTimeStampOnRead = 16 + kDirtyOnly = 1 + kSkipNotificationInfo = 2 + kBroadcast = 4 + +class PtSDLVarType: + """(none)""" + kInt = 0 + kFloat = 1 + kBool = 2 + kString32 = 3 + kKey = 4 + kStateDescriptor = 5 + kCreatable = 6 + kDouble = 7 + kTime = 8 + kByte = 9 + kShort = 10 + kVector3 = 50 + kPoint3 = 51 + kRGB = 52 + kRGBA = 53 + kQuaternion = 54 + kNone = -1 + +class PtScoreRankGroups: + """(none)""" + kIndividual = 0 + kNeighborhood = 1 + +class PtScoreTimePeriods: + """(none)""" + kOverall = 0 + kYear = 1 + kMonth = 2 + kDay = 3 + +class PtStatusLogFlags: + """(none)""" + kDebugOutput = 32 + kFilledBackground = 1 + kAppendToLast = 2 + kDontWriteFile = 4 + kDeleteForMe = 8 + kTimestamp = 64 + kStdout = 128 + kTimeInSeconds = 256 + kAlignToTop = 16 + kTimeAsDouble = 512 + diff --git a/Python/plasma/PlasmaControlKeys.py b/Python/plasma/PlasmaControlKeys.py new file mode 100644 index 0000000000..11b56e6917 --- /dev/null +++ b/Python/plasma/PlasmaControlKeys.py @@ -0,0 +1,108 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +This module is the constants for the controlKeys that are is a parameter in the OnKeyEvent callback +""" + +# OnControlKeyEvent controlKey types +kKeyAction=0 +kKeyActionMouse=1 +kKeyJump=2 +kKeyMoveForward=3 +kKeyMoveBackward=4 +kKeyStrafeLeft=5 +kKeyStrafeRight=6 +kKeyMoveUp=7 +kKeyMoveDown=8 +kKeyRotateLeft=9 +kKeyRotateRight=10 +kKeyRotateUp=11 +kKeyRotateDown=12 +kKeyModFast=13 +kKeyAlwaysRun=14 +kKeyEquip=15 +kKeyDrop=16 +kKeyTurnTo=17 +kKeyDriveMode=18 +kKeyCamMoveForward=19 +kKeyCamMoveBackward=20 +kKeyCamMoveUp=21 +kKeyCamMoveDown=22 +kKeyCamMoveLeft=23 +kKeyCamMoveRight=24 +kKeyCamPanUp=25 +kKeyCamPanDown=26 +kKeyCamPanLeft=27 +kKeyCamPanRight=28 +kKeyCamMoveFast=29 +kKeyCamRotateRight=30 +kKeyCamRotateLeft=31 +kKeyCamRotateUp=32 +kKeyCamRotateDown=33 +kKeyCamRecenter=34 +kKeyCamSpeedUp=35 +kKeyCamSpeedDown=36 +kKeyCamZoomIn=37 +kKeyCamZoomOut=38 +kKeyCamConsoleMode=39 +kKeyConsoleCommand=40 +kKeyTogglePhysical=41 +kKeyPick=42 +# axis controls +kKeyMove=43 +kKeyTurn=44 +kKeyMouseX=45 +kKeyMouseY=46 +# special controls +kKeySetCursorUp=47 +kKeySetCursorDown=48 +kKeySetCursorRight=49 +kKeySetCursorLeft=50 +kKeySetCursorPoised=51 +kKeySetCursorHidden=52 +kKeySetCursorUnhidden=53 +kKeySetCursorArrow=54 +kKeySearchForPickable=55 +kKeyIncreaseMicVol=56 +kKeyDecreaseMicVol=57 +kKeyPushToTalk=58 +kKeySetThirdPersonMode=59 +kKeySetFirstPersonMode=60 +kKeySetWalkMode=61 +kKeySetFreeLook=62 +kKeySetConsoleSingle=63 +kKeySetConsoleHidden=64 +# Inventory controls +dead__kKeySetEquipedState=65 +dead__kKeyScrollUpList=66 +dead__kKeyScrollDownList=67 +dead__kKeySetInventoryActive=68 +dead__kKeySetInventoryDisActive=69 +dead__kKeyRemoveInventoryObject=70 +dead__kKeyEnableObject=71 +# Avatar emote controls +kKeyEmote=72 +kKeyExitMode=73 diff --git a/Python/plasma/PlasmaGame.py b/Python/plasma/PlasmaGame.py new file mode 100644 index 0000000000..8a709a95e1 --- /dev/null +++ b/Python/plasma/PlasmaGame.py @@ -0,0 +1,2615 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +def PtCreateMarkerGame(callbackKey, gameType, gameName = "", timeLimit = 0, templateId = ""): + """Creates a new Marker game with the specified callback key, game type (from PtMarkerGameTypes), time limit (in ms), and template id (guid string)""" + pass + +def PtCreateTTTGame(callbackKey, numPlayers): + """Creates a new TicTacToe game with the specified callback key and number of players (1 or 2)""" + pass + +def PtGetGameCli(gameID): + """Returns a ptGameCli associated with the specified id""" + pass + +def PtGetGameIDs(): + """Returns a list of game IDs that the player is currently joined to""" + pass + +def PtGetGameNameByTypeID(guid): + """Returns the name of the game represented by guid passed in as a string""" + pass + +def PtIsBlueSpiralGame(typeID): + """Returns true if the specifed typeID (guid as a string) is a BlueSpiral game""" + pass + +def PtIsClimbingWallGame(typeID): + """Returns true if the specifed typeID (guid as a string) is a ClimbingWall game""" + pass + +def PtIsHeekGame(typeID): + """Returns true if the specifed typeID (guid as a string) is a Heek game""" + pass + +def PtIsMarkerGame(typeID): + """Returns true if the specifed typeID (guid as a string) is a Marker game""" + pass + +def PtIsTTTGame(typeID): + """Returns true if the specifed typeID (guid as a string) is a TicTacToe game""" + pass + +def PtIsVarSyncGame(typeID): + """Returns true if the specifed typeID (guid as a string) is a VarSync game""" + pass + +def PtJoinCommonBlueSpiralGame(callbackKey, gameID): + """Joins a common BlueSpiral game with the specified ID. If one doesn't exist, it creates it""" + pass + +def PtJoinCommonClimbingWallGame(callbackKey, gameID): + """Joins a common ClimbingWall game with the specified ID. If one doesn't exist, it creates it""" + pass + +def PtJoinCommonHeekGame(callbackKey, gameID): + """Joins a common Heek game with the specified ID. If one doesn't exist, it creates it""" + pass + +def PtJoinCommonTTTGame(callbackKey, gameID, numPlayers): + """Joins a common TicTacToe game with the specified ID. If one doesn't exist, it creates it with the specified number of players""" + pass + +def PtJoinCommonVarSyncGame(callbackKey): + """Joins the common VarSync game. If one doesn't exist, it creates it""" + pass + +def PtJoinGame(callbackKey, gameID): + """Sends a join request to the specified game. Messages are sent to the callback key""" + pass + +class ptGameCliMsg: + """Message from the game server from a game""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptBlueSpiralMsg(ptGameCliMsg): + """Base class for BlueSpiral game messages""" + def __init__(self): + """None""" + pass + + def getBlueSpiralMsgType(self): + """Returns the type of the BlueSpiral message (see PtBlueSpiralMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalBlueSpiralMsg(self): + """Returns this message as the BlueSpiral message it really is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptBlueSpiralClothOrderMsg(ptBlueSpiralMsg): + """BlueSpiral message received when the game is started and the cloth order is set""" + def __init__(self): + """None""" + pass + + def getBlueSpiralMsgType(self): + """Returns the type of the BlueSpiral message (see PtBlueSpiralMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def order(self): + """Returns a list of numbers indicating the correct order to hit the clothes in""" + pass + + def upcastToFinalBlueSpiralMsg(self): + """Returns this message as the BlueSpiral message it really is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptGameCli: + """Base class for all game client interfaces""" + def __init__(self): + """None""" + pass + + def gameID(self): + """Returns the ID number for this game""" + pass + + def gameTypeID(self): + """Returns the game type ID for this game (as a guid string)""" + pass + + def invitePlayer(self,playerID): + """Invites the specified player to join the game""" + pass + + def leaveGame(self): + """Leaves this game""" + pass + + def name(self): + """Returns the name of the game""" + pass + + def playerCount(self): + """Returns the current number of players""" + pass + + def uninvitePlayer(self,playerID): + """Revokes the invitation for the specified player""" + pass + + def upcastToBlueSpiralGame(self): + """Returns this game client as a ptBlueSpiralGame""" + pass + + def upcastToClimbingWallGame(self): + """Returns this game client as a ptClimbingWallGame""" + pass + + def upcastToHeekGame(self): + """Returns this game client as a ptHeekGame""" + pass + + def upcastToMarkerGame(self): + """Returns this game client as a ptMarkerGame""" + pass + + def upcastToTTTGame(self): + """Returns this game client as a ptTTTGame""" + pass + + def upcastToVarSyncGame(self): + """Returns this game client as a ptVarSyncGame""" + pass + +class ptBlueSpiralGame(ptGameCli): + """Game client for the BlueSpiral game""" + def __init__(self): + """None""" + pass + + def gameID(self): + """Returns the ID number for this game""" + pass + + def gameTypeID(self): + """Returns the game type ID for this game (as a guid string)""" + pass + + def hitCloth(self,clothNum): + """Tells the server you hit the specified cloth""" + pass + + def invitePlayer(self,playerID): + """Invites the specified player to join the game""" + pass + + def leaveGame(self): + """Leaves this game""" + pass + + def name(self): + """Returns the name of the game""" + pass + + def playerCount(self): + """Returns the current number of players""" + pass + + def startGame(self): + """Starts a new game""" + pass + + def uninvitePlayer(self,playerID): + """Revokes the invitation for the specified player""" + pass + + def upcastToBlueSpiralGame(self): + """Returns this game client as a ptBlueSpiralGame""" + pass + + def upcastToClimbingWallGame(self): + """Returns this game client as a ptClimbingWallGame""" + pass + + def upcastToHeekGame(self): + """Returns this game client as a ptHeekGame""" + pass + + def upcastToMarkerGame(self): + """Returns this game client as a ptMarkerGame""" + pass + + def upcastToTTTGame(self): + """Returns this game client as a ptTTTGame""" + pass + + def upcastToVarSyncGame(self): + """Returns this game client as a ptVarSyncGame""" + pass + +class ptBlueSpiralGameOverMsg(ptBlueSpiralMsg): + """BlueSpiral message received when the timer runs out, someone hits the wrong cloth, or the game is restarted (before a game start msg in that last case)""" + def __init__(self): + """None""" + pass + + def getBlueSpiralMsgType(self): + """Returns the type of the BlueSpiral message (see PtBlueSpiralMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalBlueSpiralMsg(self): + """Returns this message as the BlueSpiral message it really is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptBlueSpiralGameStartedMsg(ptBlueSpiralMsg): + """BlueSpiral message received when someone starts the game (or when you join a game that is running)""" + def __init__(self): + """None""" + pass + + def getBlueSpiralMsgType(self): + """Returns the type of the BlueSpiral message (see PtBlueSpiralMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def startSpin(self): + """Returns true if you are supposed to start spinning the door thingy""" + pass + + def upcastToFinalBlueSpiralMsg(self): + """Returns this message as the BlueSpiral message it really is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptBlueSpiralGameWonMsg(ptBlueSpiralMsg): + """BlueSpiral message received when the last cloth is successfully hit""" + def __init__(self): + """None""" + pass + + def getBlueSpiralMsgType(self): + """Returns the type of the BlueSpiral message (see PtBlueSpiralMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalBlueSpiralMsg(self): + """Returns this message as the BlueSpiral message it really is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptBlueSpiralSuccessfulHitMsg(ptBlueSpiralMsg): + """BlueSpiral message received when a cloth is hit in the correct order""" + def __init__(self): + """None""" + pass + + def getBlueSpiralMsgType(self): + """Returns the type of the BlueSpiral message (see PtBlueSpiralMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalBlueSpiralMsg(self): + """Returns this message as the BlueSpiral message it really is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptClimbingWallMsg(ptGameCliMsg): + """Base class for ClimbingWall game messages""" + def __init__(self): + """None""" + pass + + def getClimbingWallMsgType(self): + """Returns the type of the ClimbingWall message (see PtClimbingWallMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalClimbingWallMsg(self): + """Returns this message as the ClimbingWall msg it is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptClimbingWallBlockersChangedMsg(ptClimbingWallMsg): + """ClimbingWall message received when the blocker state changes""" + def __init__(self): + """None""" + pass + + def blockersSet(self): + """Returns an array of blocker indicies denoting which blockers are set""" + pass + + def getClimbingWallMsgType(self): + """Returns the type of the ClimbingWall message (see PtClimbingWallMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def localOnly(self): + """Returns true if we are only supposed to adjust our stuff locally, and not net-prop it""" + pass + + def teamNumber(self): + """The team that this message is for""" + pass + + def upcastToFinalClimbingWallMsg(self): + """Returns this message as the ClimbingWall msg it is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptClimbingWallGame(ptGameCli): + """Game client for the ClimbingWall game""" + def __init__(self): + """None""" + pass + + def changeBlocker(self,teamNumber, blockerNumber, added): + """Changes the specified marker's state for the specified team""" + pass + + def changeNumBlockers(self,amountToAdjust): + """Adjusts the number of blockers we are playing with""" + pass + + def finishedGame(self): + """Tells the server you reached the top of the wall""" + pass + + def gameID(self): + """Returns the ID number for this game""" + pass + + def gameTypeID(self): + """Returns the game type ID for this game (as a guid string)""" + pass + + def invitePlayer(self,playerID): + """Invites the specified player to join the game""" + pass + + def leaveGame(self): + """Leaves this game""" + pass + + def name(self): + """Returns the name of the game""" + pass + + def panic(self): + """Tells the server you are panicking and want your blockers reset""" + pass + + def playerCount(self): + """Returns the current number of players""" + pass + + def playerEntered(self,teamNumber): + """Tells the server that you are trying to play the game for the specified team""" + pass + + def ready(self,readyType, teamNumber): + """Marks the specified team as ready for the specified type (See PtClimbingWallReadyTypes)""" + pass + + def reset(self): + """Attempts to reset the game's control panel""" + pass + + def uninvitePlayer(self,playerID): + """Revokes the invitation for the specified player""" + pass + + def upcastToBlueSpiralGame(self): + """Returns this game client as a ptBlueSpiralGame""" + pass + + def upcastToClimbingWallGame(self): + """Returns this game client as a ptClimbingWallGame""" + pass + + def upcastToHeekGame(self): + """Returns this game client as a ptHeekGame""" + pass + + def upcastToMarkerGame(self): + """Returns this game client as a ptMarkerGame""" + pass + + def upcastToTTTGame(self): + """Returns this game client as a ptTTTGame""" + pass + + def upcastToVarSyncGame(self): + """Returns this game client as a ptVarSyncGame""" + pass + +class ptClimbingWallGameOverMsg(ptClimbingWallMsg): + """ClimbingWall message received when the game is over""" + def __init__(self): + """None""" + pass + + def getClimbingWallMsgType(self): + """Returns the type of the ClimbingWall message (see PtClimbingWallMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def localOnly(self): + """Returns true if we are only supposed to adjust our stuff locally, and not net-prop it""" + pass + + def team1Blockers(self): + """Returns an array of blocker indicies denoting which blockers team 1 set""" + pass + + def team2Blockers(self): + """Returns an array of blocker indicies denoting which blockers team 2 set""" + pass + + def teamWon(self): + """The team that won the game""" + pass + + def upcastToFinalClimbingWallMsg(self): + """Returns this message as the ClimbingWall msg it is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptClimbingWallNumBlockersChangedMsg(ptClimbingWallMsg): + """ClimbingWall message received when the number of blockers is changed""" + def __init__(self): + """None""" + pass + + def getClimbingWallMsgType(self): + """Returns the type of the ClimbingWall message (see PtClimbingWallMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def localOnly(self): + """Returns true if we are only supposed to adjust our stuff locally, and not net-prop it""" + pass + + def newBlockerCount(self): + """Returns the number of blockers this game is current running with""" + pass + + def upcastToFinalClimbingWallMsg(self): + """Returns this message as the ClimbingWall msg it is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptClimbingWallPlayerEnteredMsg(ptClimbingWallMsg): + """ClimbingWall message received when you successfully enter the suit machine""" + def __init__(self): + """None""" + pass + + def getClimbingWallMsgType(self): + """Returns the type of the ClimbingWall message (see PtClimbingWallMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalClimbingWallMsg(self): + """Returns this message as the ClimbingWall msg it is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptClimbingWallReadyMsg(ptClimbingWallMsg): + """ClimbingWall message received when the ready state of the teams is changed""" + def __init__(self): + """None""" + pass + + def getClimbingWallMsgType(self): + """Returns the type of the ClimbingWall message (see PtClimbingWallMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def localOnly(self): + """Returns true if we are only supposed to adjust our stuff locally, and not net-prop it""" + pass + + def readyType(self): + """The type of ready message this represents (see PtClimbingWallReadyTypes)""" + pass + + def team1Ready(self): + """Whether team 1 is ready or not""" + pass + + def team2Ready(self): + """Whether team 2 is ready or not""" + pass + + def upcastToFinalClimbingWallMsg(self): + """Returns this message as the ClimbingWall msg it is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptClimbingWallSuitMachineLockedMsg(ptClimbingWallMsg): + """ClimbingWall message received when the locked state of the suit machines is changed""" + def __init__(self): + """None""" + pass + + def getClimbingWallMsgType(self): + """Returns the type of the ClimbingWall message (see PtClimbingWallMsgTypes)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def localOnly(self): + """Returns true if we are only supposed to adjust our stuff locally, and not net-prop it""" + pass + + def team1MachineLocked(self): + """Whether team 1's suit machine is locked or not""" + pass + + def team2MachineLocked(self): + """Whether team 2's suit machine is locked or not""" + pass + + def upcastToFinalClimbingWallMsg(self): + """Returns this message as the ClimbingWall msg it is""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptGameCliInviteFailedMsg(ptGameCliMsg): + """Game client message when an invite failed message is received""" + def __init__(self): + """None""" + pass + + def error(self): + """Returns the error value (See PtGameCliInviteErrors)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def inviteeID(self): + """Returns the invitee's ID number""" + pass + + def operationID(self): + """Returns the operation's ID number""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptGameCliOwnerChangeMsg(ptGameCliMsg): + """Game client message when a owner change message is received""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def ownerID(self): + """Returns the owner's ID number""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptGameCliPlayerJoinedMsg(ptGameCliMsg): + """Game client message when a player joined message is received""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def playerID(self): + """Returns the player's ID number""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptGameCliPlayerLeftMsg(ptGameCliMsg): + """Game client message when a player left message is received""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def playerID(self): + """Returns the player's ID number""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptGameMgrMsg: + """Message from the game manager""" + def __init__(self): + """None""" + pass + + def getType(self): + """Returns the type of the message (see PtGameMgrMsgTypes)""" + pass + + def upcastToInviteReceivedMsg(self): + """Returns this message as a ptGameMgrInviteReceivedMsg""" + pass + + def upcastToInviteRevokedMsg(self): + """Returns this message as a ptGameMgrInviteRevokedMsg""" + pass + +class ptGameMgrInviteReceivedMsg(ptGameMgrMsg): + """Game manager message when an invite is received""" + def __init__(self): + """None""" + pass + + def gameTypeID(self): + """Returns the game type ID (as a guid string)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameMgrMsgTypes)""" + pass + + def inviterID(self): + """Returns the inviter's ID number""" + pass + + def newGameID(self): + """Returns the new game's ID number""" + pass + + def upcastToInviteReceivedMsg(self): + """Returns this message as a ptGameMgrInviteReceivedMsg""" + pass + + def upcastToInviteRevokedMsg(self): + """Returns this message as a ptGameMgrInviteRevokedMsg""" + pass + +class ptGameMgrInviteRevokedMsg(ptGameMgrMsg): + """Game manager message when an invite is received""" + def __init__(self): + """None""" + pass + + def gameTypeID(self): + """Returns the game type ID (as a guid string)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameMgrMsgTypes)""" + pass + + def inviterID(self): + """Returns the inviter's ID number""" + pass + + def newGameID(self): + """Returns the new game's ID number""" + pass + + def upcastToInviteReceivedMsg(self): + """Returns this message as a ptGameMgrInviteReceivedMsg""" + pass + + def upcastToInviteRevokedMsg(self): + """Returns this message as a ptGameMgrInviteRevokedMsg""" + pass + +class ptHeekMsg(ptGameCliMsg): + """Base class for Heek game messages""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekCountdownStateMsg(ptHeekMsg): + """Heek message received by game admin when the countdown state needs to change""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def state(self): + """Returns state the countdown should be switched to (see PtHeekCountdownStates)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekDropMsg(ptHeekMsg): + """Heek message received when another player's position needs to be reset/modified""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def position(self): + """Returns player position to cleanup and dump""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekGame(ptGameCli): + """Game client for the Heek game""" + def __init__(self): + """None""" + pass + + def choose(self,choice): + """Makes the specified move (see PtHeekGameChoice)""" + pass + + def gameID(self): + """Returns the ID number for this game""" + pass + + def gameTypeID(self): + """Returns the game type ID for this game (as a guid string)""" + pass + + def invitePlayer(self,playerID): + """Invites the specified player to join the game""" + pass + + def leaveGame(self): + """Leaves this game (puts us into "observer" mode""" + pass + + def name(self): + """Returns the name of the game""" + pass + + def playGame(self,position, points, name): + """Requests to start playing the game in the specified position""" + pass + + def playerCount(self): + """Returns the current number of players""" + pass + + def sequenceFinished(self,sequence): + """Tells the server that the specified animation finished (see PtHeekGameSeq)""" + pass + + def uninvitePlayer(self,playerID): + """Revokes the invitation for the specified player""" + pass + + def upcastToBlueSpiralGame(self): + """Returns this game client as a ptBlueSpiralGame""" + pass + + def upcastToClimbingWallGame(self): + """Returns this game client as a ptClimbingWallGame""" + pass + + def upcastToHeekGame(self): + """Returns this game client as a ptHeekGame""" + pass + + def upcastToMarkerGame(self): + """Returns this game client as a ptMarkerGame""" + pass + + def upcastToTTTGame(self): + """Returns this game client as a ptTTTGame""" + pass + + def upcastToVarSyncGame(self): + """Returns this game client as a ptVarSyncGame""" + pass + +class ptHeekGameWinMsg(ptHeekMsg): + """Heek message received by game admin when a game is won""" + def __init__(self): + """None""" + pass + + def choice(self): + """Returns the choice that won (see PtHeekGameChoice)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekGoodbyeMsg(ptHeekMsg): + """Heek message received when the server processes leave request""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekInterfaceStateMsg(ptHeekMsg): + """Heek message received when your interface buttons need to enable or disable""" + def __init__(self): + """None""" + pass + + def buttonsEnabled(self): + """Returns whether your buttons should be enabled""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekLightStateMsg(ptHeekMsg): + """Heek message received when one of your local lights needs to change state""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def lightNum(self): + """Returns the index of the light this refers to""" + pass + + def state(self): + """Returns state the light should be switched to (see PtHeekLightStates)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekPlayGameMsg(ptHeekMsg): + """Heek message received when the server processes your play game request""" + def __init__(self): + """None""" + pass + + def enableButtons(self): + """Returns true if we should enable the buttons at the place we sat down""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def isPlaying(self): + """Returns true if the server accepted the play game request""" + pass + + def isSinglePlayer(self): + """Returns true if you are the only player at the table""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekPointUpdateMsg(ptHeekMsg): + """Heek message received when the number of points you have needs to be changed""" + def __init__(self): + """None""" + pass + + def displayUpdate(self): + """Returns whether you should display a message to the user""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def points(self): + """Returns your new amount of points""" + pass + + def rank(self): + """Returns your new rank""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekSetupMsg(ptHeekMsg): + """Heek message for setting up each position's state""" + def __init__(self): + """None""" + pass + + def buttonState(self): + """Returns whether the buttons are enabled or not""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def lightOn(self): + """Returns a list of bools representing lights on or off""" + pass + + def position(self): + """Returns the position this message is for""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekWelcomeMsg(ptHeekMsg): + """Heek message received when a new player sits down""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def name(self): + """Returns the new player's name""" + pass + + def points(self): + """Returns the new player's points""" + pass + + def rank(self): + """Returns the new player's rank""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptHeekWinLoseMsg(ptHeekMsg): + """Heek message received when the round is over and you won or lost""" + def __init__(self): + """None""" + pass + + def choice(self): + """Returns the choice that won or lost (see PtHeekGameChoice)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getHeekMsgType(self): + """Returns the type of the Heek message (see PtHeekMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalHeekMsg(self): + """Returns this message as the Heek message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + + def win(self): + """Returns true if you won""" + pass + +class ptMarkerGame(ptGameCli): + """Game client for the Marker game""" + def __init__(self): + """None""" + pass + + def addMarker(self,x, y, z, name = "", age = ""): + """Adds a marker to the game. Age is ignored in a non-quest game. Won't work if you're not the owner/creator""" + pass + + def captureMarker(self,markerId): + """Captures the specified marker""" + pass + + def changeGameName(self,newName): + """Changes the name of the game. Won't work if you're not the game owner/creator""" + pass + + def changeMarkerName(self,markerId, newName): + """Changes the name of the specified marker. Won't work if you're not the game owner/creator""" + pass + + def changeTimeLimit(self,newTimeLimit): + """Changes the time limit on the game (in ms). Won't work if you're not the game owner/creator, or if it's a quest game""" + pass + + def deleteGame(self): + """Tells the server to delete the game. Won't work if you're not the game owner/creator""" + pass + + def deleteMarker(self,markerId): + """Deletes the specified marker from the game. Won't work if you're not the game owner/creator""" + pass + + def gameID(self): + """Returns the ID number for this game""" + pass + + def gameTypeID(self): + """Returns the game type ID for this game (as a guid string)""" + pass + + def invitePlayer(self,playerID): + """Invites the specified player to join the game""" + pass + + def leaveGame(self): + """Leaves this game""" + pass + + def name(self): + """Returns the name of the game""" + pass + + def pauseGame(self): + """Pauses the game. Won't work on MP games if you're not the owner/creator""" + pass + + def playerCount(self): + """Returns the current number of players""" + pass + + def resetGame(self): + """Resets the game. Won't work on MP games if you're not the owner/creator""" + pass + + def startGame(self): + """Starts the game. Won't work on MP games if you're not the owner/creator""" + pass + + def uninvitePlayer(self,playerID): + """Revokes the invitation for the specified player""" + pass + + def upcastToBlueSpiralGame(self): + """Returns this game client as a ptBlueSpiralGame""" + pass + + def upcastToClimbingWallGame(self): + """Returns this game client as a ptClimbingWallGame""" + pass + + def upcastToHeekGame(self): + """Returns this game client as a ptHeekGame""" + pass + + def upcastToMarkerGame(self): + """Returns this game client as a ptMarkerGame""" + pass + + def upcastToTTTGame(self): + """Returns this game client as a ptTTTGame""" + pass + + def upcastToVarSyncGame(self): + """Returns this game client as a ptVarSyncGame""" + pass + +class ptMarkerMsg(ptGameCliMsg): + """Base class for Marker game messages""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerGameDeletedMsg(ptMarkerMsg): + """Marker message received when the game is deleted""" + def __init__(self): + """None""" + pass + + def failed(self): + """Returns whether the delete succeeded or not""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerGameNameChangedMsg(ptMarkerMsg): + """Marker message received when the game name is changed""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def name(self): + """Returns the new game name""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerGameOverMsg(ptMarkerMsg): + """Marker message received when the server determines the game is over (usually via timeout)""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerGamePausedMsg(ptMarkerMsg): + """Marker message received when the game is paused by the owner""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def timeLeft(self): + """Returns the amount of time left on the server clock""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerGameResetMsg(ptMarkerMsg): + """Marker message received when the game is reset by the owner""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerGameStartedMsg(ptMarkerMsg): + """Marker message received when the game is started by the owner""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerGameTypeMsg(ptMarkerMsg): + """Marker message received when you are assigned a team number""" + def __init__(self): + """None""" + pass + + def gameType(self): + """Returns the type of the game you just joined""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerMarkerAddedMsg(ptMarkerMsg): + """Marker message received when a marker is added to the game""" + def __init__(self): + """None""" + pass + + def age(self): + """Returns the age the marker was created in""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def markerId(self): + """Returns the id number of the marker""" + pass + + def name(self): + """Returns the name of the marker""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + + def x(self): + """Returns x coord of the marker""" + pass + + def y(self): + """Returns y coord of the marker""" + pass + + def z(self): + """Returns z coord of the marker""" + pass + +class ptMarkerMarkerCapturedMsg(ptMarkerMsg): + """Marker message received when a marker is captured""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def markerId(self): + """Returns id of the marker which was captured""" + pass + + def team(self): + """Returns the team number of the team that captured it (0 for no team, or a quest game)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerMarkerDeletedMsg(ptMarkerMsg): + """Marker message received when a marker is deleted""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def markerId(self): + """Returns id of the marker that was deleted""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerMarkerNameChangedMsg(ptMarkerMsg): + """Marker message received when the name of a marker is changed""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def markerId(self): + """Returns id of the marker who's name was changed""" + pass + + def name(self): + """Returns the new name""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerTeamAssignedMsg(ptMarkerMsg): + """Marker message received when you are assigned a team number""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def teamNumber(self): + """Returns the number of the team you were assigned to""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerTemplateCreatedMsg(ptMarkerMsg): + """Marker message received when a quest game template is created""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def templateID(self): + """Returns the ID number of the template that was created""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptMarkerTimeLimitChangedMsg(ptMarkerMsg): + """Marker message received when the game name is changed""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getMarkerMsgType(self): + """Returns the type of the Marker message (see PtMarkerMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def timeLimit(self): + """Returns the new time limit (in ms)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalMarkerMsg(self): + """Returns this message as the Marker message it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptTTTGame(ptGameCli): + """Game client for the TicTacToe game""" + def __init__(self): + """None""" + pass + + def gameID(self): + """Returns the ID number for this game""" + pass + + def gameTypeID(self): + """Returns the game type ID for this game (as a guid string)""" + pass + + def invitePlayer(self,playerID): + """Invites the specified player to join the game""" + pass + + def leaveGame(self): + """Leaves this game""" + pass + + def makeMove(self,row, col): + """Makes a move in the specified spot""" + pass + + def name(self): + """Returns the name of the game""" + pass + + def playerCount(self): + """Returns the current number of players""" + pass + + def showBoard(self): + """Prints the current board layout to the console""" + pass + + def uninvitePlayer(self,playerID): + """Revokes the invitation for the specified player""" + pass + + def upcastToBlueSpiralGame(self): + """Returns this game client as a ptBlueSpiralGame""" + pass + + def upcastToClimbingWallGame(self): + """Returns this game client as a ptClimbingWallGame""" + pass + + def upcastToHeekGame(self): + """Returns this game client as a ptHeekGame""" + pass + + def upcastToMarkerGame(self): + """Returns this game client as a ptMarkerGame""" + pass + + def upcastToTTTGame(self): + """Returns this game client as a ptTTTGame""" + pass + + def upcastToVarSyncGame(self): + """Returns this game client as a ptVarSyncGame""" + pass + +class ptTTTMsg(ptGameCliMsg): + """Base class for TicTacToe game messages""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getTTTMsgType(self): + """Returns the type of the TTT message (see PtTTTMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalTTTMsg(self): + """Returns this message as the TTT msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptTTTGameOverMsg(ptTTTMsg): + """TicTacToe message received when the game is over""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getTTTMsgType(self): + """Returns the type of the TTT message (see PtTTTMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def result(self): + """Returns the result of the game (see PtTTTGameResult)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalTTTMsg(self): + """Returns this message as the TTT msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + + def winnerID(self): + """Returns the winner's ID""" + pass + +class ptTTTGameStartedMsg(ptTTTMsg): + """TicTacToe message received when the game is started""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getTTTMsgType(self): + """Returns the type of the TTT message (see PtTTTMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalTTTMsg(self): + """Returns this message as the TTT msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + + def yourTurn(self): + """Returns true if you are the first player (and therefore it's your turn)""" + pass + +class ptTTTMoveMadeMsg(ptTTTMsg): + """TicTacToe message received when someone makes a move""" + def __init__(self): + """None""" + pass + + def col(self): + """Returns the col index of the move (1..3)""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getTTTMsgType(self): + """Returns the type of the TTT message (see PtTTTMsgTypes)""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def playerID(self): + """Returns the the ID of the player that just moved""" + pass + + def row(self): + """Returns the row index of the move (1..3)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalTTTMsg(self): + """Returns this message as the TTT msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptVarSyncMsg(ptGameCliMsg): + """Base class for VarSync game messages""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def getVarSyncMsgType(self): + """Returns the type of the VarSync message (see PtVarSyncMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalVarSyncMsg(self): + """Returns this message as the VarSync msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptVarSyncAllVarsSentMsg(ptVarSyncMsg): + """VarSync message received after the last var is sent to you when you join the game, or request a list of vars""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def getVarSyncMsgType(self): + """Returns the type of the VarSync message (see PtVarSyncMsgTypes)""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalVarSyncMsg(self): + """Returns this message as the VarSync msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + +class ptVarSyncGame(ptGameCli): + """Game client for the VarSync game""" + def __init__(self): + """None""" + pass + + def createNumericVar(self,varName, value): + """Attempts to create a new numeric variable and set it to the specified number (clipped to double)""" + pass + + def createStringVar(self,varName, value): + """Attempts to create a new string variable and set it to the specified string (clipped to 255 chars)""" + pass + + def gameID(self): + """Returns the ID number for this game""" + pass + + def gameTypeID(self): + """Returns the game type ID for this game (as a guid string)""" + pass + + def invitePlayer(self,playerID): + """Invites the specified player to join the game""" + pass + + def leaveGame(self): + """Leaves this game""" + pass + + def name(self): + """Returns the name of the game""" + pass + + def playerCount(self): + """Returns the current number of players""" + pass + + def requestAllVars(self): + """Requests all the vars the server knows about""" + pass + + def setNumericVar(self,varID, value): + """Attempts to set a numeric variable to the specified number (clipped to double)""" + pass + + def setStringVar(self,varID, value): + """Attempts to set a string variable to the specified string (clipped to 255 chars)""" + pass + + def uninvitePlayer(self,playerID): + """Revokes the invitation for the specified player""" + pass + + def upcastToBlueSpiralGame(self): + """Returns this game client as a ptBlueSpiralGame""" + pass + + def upcastToClimbingWallGame(self): + """Returns this game client as a ptClimbingWallGame""" + pass + + def upcastToHeekGame(self): + """Returns this game client as a ptHeekGame""" + pass + + def upcastToMarkerGame(self): + """Returns this game client as a ptMarkerGame""" + pass + + def upcastToTTTGame(self): + """Returns this game client as a ptTTTGame""" + pass + + def upcastToVarSyncGame(self): + """Returns this game client as a ptVarSyncGame""" + pass + +class ptVarSyncNumericVarChangedMsg(ptVarSyncMsg): + """VarSync message received when a numeric variable's value changes""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def getVarSyncMsgType(self): + """Returns the type of the VarSync message (see PtVarSyncMsgTypes)""" + pass + + def id(self): + """Returns the id of the var that changed""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalVarSyncMsg(self): + """Returns this message as the VarSync msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + + def value(self): + """Returns the variable's new value""" + pass + +class ptVarSyncNumericVarCreatedMsg(ptVarSyncMsg): + """VarSync message received when a numeric variable is created and assigned an id""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def getVarSyncMsgType(self): + """Returns the type of the VarSync message (see PtVarSyncMsgTypes)""" + pass + + def id(self): + """Returns the id assigned to this variable""" + pass + + def name(self): + """Returns the name of the var that was created""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalVarSyncMsg(self): + """Returns this message as the VarSync msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + + def value(self): + """Returns the variable's new value""" + pass + +class ptVarSyncStringVarChangedMsg(ptVarSyncMsg): + """VarSync message received when a string variable's value changes""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def getVarSyncMsgType(self): + """Returns the type of the VarSync message (see PtVarSyncMsgTypes)""" + pass + + def id(self): + """Returns the id of the var that changed""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalVarSyncMsg(self): + """Returns this message as the VarSync msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + + def value(self): + """Returns the variable's new value""" + pass + +class ptVarSyncStringVarCreatedMsg(ptVarSyncMsg): + """VarSync message received when a string variable is created and assigned an id""" + def __init__(self): + """None""" + pass + + def getGameCli(self): + """Returns the game client associated with this message""" + pass + + def getType(self): + """Returns the type of the message (see PtGameCliMsgTypes)""" + pass + + def getVarSyncMsgType(self): + """Returns the type of the VarSync message (see PtVarSyncMsgTypes)""" + pass + + def id(self): + """Returns the id that was assigned to this variable""" + pass + + def name(self): + """Returns the name of the var that was created""" + pass + + def upcastToFinalGameCliMsg(self): + """Returns this message as the game client message it is (player joined, player left, invite failed, or owner change)""" + pass + + def upcastToFinalVarSyncMsg(self): + """Returns this message as the VarSync msg it is""" + pass + + def upcastToGameMsg(self): + """Returns this message as the base class of message for the game it is associated with (ttt, heek, marker, etc)""" + pass + + def value(self): + """Returns the variable's new value""" + pass + diff --git a/Python/plasma/PlasmaGameConstants.py b/Python/plasma/PlasmaGameConstants.py new file mode 100644 index 0000000000..064a60430d --- /dev/null +++ b/Python/plasma/PlasmaGameConstants.py @@ -0,0 +1,159 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +class PtBlueSpiralMsgTypes: + """(none)""" + kBlueSpiralGameStarted = 8 + kBlueSpiralClothOrder = 4 + kBlueSpiralSuccessfulHit = 5 + kBlueSpiralGameWon = 6 + kBlueSpiralGameOver = 7 + +class PtClimbingWallMsgTypes: + """(none)""" + kClimbingWallNumBlockersChanged = 4 + kClimbingWallReadyMsg = 5 + kClimbingWallBlockersChanged = 6 + kClimbingWallPlayerEntered = 7 + kClimbingWallSuitMachineLocked = 8 + kClimbingWallGameOver = 9 + +class PtClimbingWallReadyTypes: + """(none)""" + kClimbingWallReadyNumBlockers = 0 + kClimbingWallReadyBlockers = 1 + +class PtGameCliInviteErrors: + """(none)""" + kGameInviteSuccess = 0 + kGameInviteErrNotOwner = 1 + kGameInviteErrAlreadyInvited = 2 + kGameInviteErrAlreadyJoined = 3 + kGameInviteErrGameStarted = 4 + kGameInviteErrGameOver = 5 + kGameInviteErrGameFull = 6 + kGameInviteErrNoJoin = 7 + +class PtGameCliMsgTypes: + """(none)""" + kGameCliPlayerJoinedMsg = 0 + kGameCliPlayerLeftMsg = 1 + kGameCliInviteFailedMsg = 2 + kGameCliOwnerChangeMsg = 3 + kGameCliTTTMsg = 4 + kGameCliHeekMsg = 5 + kGameCliMarkerMsg = 6 + kGameCliBlueSpiralMsg = 7 + kGameCliClimbingWallMsg = 8 + kGameCliVarSyncMsg = 9 + +class PtGameMgrMsgTypes: + """(none)""" + kGameMgrInviteReceivedMsg = 1 + kGameMgrInviteRevokedMsg = 2 + +class PtHeekCountdownStates: + """(none)""" + kHeekCountdownStart = 0 + kHeekCountdownStop = 1 + kHeekCountdownIdle = 2 + +class PtHeekGameChoice: + """(none)""" + kHeekGameChoiceRock = 0 + kHeekGameChoicePaper = 1 + kHeekGameChoiceScissors = 2 + +class PtHeekGameSeq: + """(none)""" + kHeekGameSeqCountdown = 0 + kHeekGameSeqChoiceAnim = 1 + kHeekGameSeqGameWinAnim = 2 + +class PtHeekLightStates: + """(none)""" + kHeekLightOn = 0 + kHeekLightOff = 1 + kHeekLightFlash = 2 + +class PtHeekMsgTypes: + """(none)""" + kHeekPlayGame = 4 + kHeekGoodbye = 5 + kHeekWelcome = 6 + kHeekDrop = 7 + kHeekSetup = 8 + kHeekLightState = 9 + kHeekInterfaceState = 10 + kHeekCountdownState = 11 + kHeekWinLose = 12 + kHeekGameWin = 13 + kHeekPointUpdate = 14 + +class PtMarkerGameTypes: + """(none)""" + kMarkerGameQuest = 0 + kMarkerGameCGZ = 1 + kMarkerGameCapture = 2 + kMarkerGameCaptureAndHold = 3 + +class PtMarkerMsgTypes: + """(none)""" + kMarkerTemplateCreated = 4 + kMarkerTeamAssigned = 5 + kMarkerGameType = 6 + kMarkerGameStarted = 7 + kMarkerGamePaused = 8 + kMarkerGameReset = 9 + kMarkerGameOver = 10 + kMarkerGameNameChanged = 11 + kMarkerTimeLimitChanged = 12 + kMarkerGameDeleted = 13 + kMarkerMarkerAdded = 14 + kMarkerMarkerDeleted = 15 + kMarkerMarkerNameChanged = 16 + kMarkerMarkerCaptured = 17 + +class PtTTTGameResult: + """(none)""" + kTTTGameResultWinner = 0 + kTTTGameResultTied = 1 + kTTTGameResultGave = 2 + kTTTGameResultError = 3 + +class PtTTTMsgTypes: + """(none)""" + kTTTGameStarted = 4 + kTTTGameOver = 5 + kTTTMoveMade = 6 + +class PtVarSyncMsgTypes: + """(none)""" + kVarSyncNumericVarCreated = 8 + kVarSyncStringVarChanged = 4 + kVarSyncNumericVarChanged = 5 + kVarSyncAllVarsSent = 6 + kVarSyncStringVarCreated = 7 + diff --git a/Python/plasma/PlasmaKITypes.py b/Python/plasma/PlasmaKITypes.py new file mode 100644 index 0000000000..44f82e6dfd --- /dev/null +++ b/Python/plasma/PlasmaKITypes.py @@ -0,0 +1,469 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +This module is contains the datatypes and constants for +interfacing with the KI subsytem +""" + +# OnKIMsg and PtSendKIMessage command types +kEnterChatMode=1 # start chat mode on KI, 'value' doesn't matter +kSetChatFadeDelay=2 # set the chat fade time, 'value' is the delay in seconds +kSetTextChatAdminMode=3 # set self to be admin mode, 'value' is 1 to go into Admin mode, 0 remove +kDisableKIandBB=4 # disable the KI and the blackbar, 'value' doesn't matter +kEnableKIandBB=5 # enable the KI and the blackbar, 'value' doesn't matter +kYesNoDialog=6 # request that the KI put up a yes/no dialog for someone else +kAddPlayerDevice=7 # add player interactive device to list of devices, 'value' is device name +kRemovePlayerDevice=8 # remove player interactive device from list, 'value' is device name +kUpgradeKILevel=9 # upgrade new level of KI (if already at that level, nevermind), 'value' is the new level +kDowngradeKILevel=10 # remove (drop) the KI level (if not at that level, nevermind), 'value' is the level to remove +kRateIt=11 # request for the KI to ask the user to Rate something +kSetPrivateChatChannel=12 # sets the private chat channel to number, for private rooms +kUnsetPrivateChatChannel=13 # undoes the the private chat channel. +kStartBookAlert=14 # start the book alert +kMiniBigKIToggle=15 # shortcut to toggling the miniKI/bigKI +kKIPutAway=16 # shortcut to hiding all of the KI +kChatAreaPageUp=17 # shortcut to paging up the chat area +kChatAreaPageDown=18 # shortcut to paging down the chat area +kChatAreaGoToBegin=19 # shortcut to going to the beginning of the chat area +kChatAreaGoToEnd=20 # shortcut to going to the end of the chat area +kKITakePicture=21 # shortcut to taking a picture in the KI +kKICreateJournalNote=22 # shortcut to creating a journal note in the KI +kKIToggleFade=23 # shortcut to toggle fade mode in the miniKI (only if miniKI only) +kKIToggleFadeEnable=24 # shortcut to toggling the enable flag for fading chat +kKIChatStatusMsg=25 # display a status message (net propagated) in the chat window +kKILocalChatStatusMsg=26 # display a status message (local only) in the chat window +kKIUpSizeFont=27 # up size the font in the KI (chatarea) +kKIDownSizeFont=28 # down size the font in the KI (chatarea) +kKIOpenYeehsaBook=29 # open the Yeehsa book, if not already open +kKIOpenKI=30 # open the KI a little at a time +kKIShowCCRHelp=31 # show the CCR help dialog +kKICreateMarker=32 # create a marker +kKICreateMarkerFolder=33 # create a marker folder(node) game in the current Age's journal folder +kKILocalChatErrorMsg=34 # display an error message (local only) in the chat window +kKIPhasedAllOn=35 # turn on all the phased KI functionality +kKIPhasedAllOff=36 # turn off all the phased KI functionality +kKIOKDialog=37 # display an OK dialog box (localized) +kDisableYeeshaBook=38 # don't allow linking with the Yeesha book (gameplay) +kEnableYeeshaBook=39 # re-allow linking with the Yeesha book +kQuitDialog=40 # put up Quit dialog +kTempDisableKIandBB=41 # temp disable KI and blackbar (done by av system) +kTempEnableKIandBB=42 # temp re-enable the KI and blackbar (done by av system) +kDisableEntireYeeshaBook=43 # disable the entire Yeeshabook, not for gameplay, but prevent linking +kEnableEntireYeeshaBook=44 # enable the entire Yeeshabook, not for gameplay +kKIOKDialogNoQuit=45 # display OK dialog in the KI without quiting afterwards +kGZUpdated=46 # the GZ game was updated +kGZInRange=47 # a GZ marker is in range +kGZOutRange=48 # GZ markers are out of range +kUpgradeKIMarkerLevel=49 # upgrade the KI marker level +kKIShowMiniKI=50 # force the miniKI up +kGZFlashUpdate=51 # flash update to the GZ display on the miniKI (without saving) +kStartJournalAlert = 52 # start the journal alert +kAddJournalBook = 53 # add the journal book to the BB +kRemoveJournalBook = 54 # remove the journal book from the BB +kKIOpenJournalBook = 55 # show the journal book +kMGStartCGZGame = 56 # Start CGZ Marker Game +kMGStopCGZGame = 57 # Stop CGZ Marker Game +kKICreateMarkerNode = 58 #Creates the marker game vault Node +kStartKIAlert = 59 # start the KI alert +kUpdatePelletScore = 60 # Updates the pellet score +kFriendInviteSent = 61 # Result of friend invite received +kRegisterImager = 62 # Imagers send to register themselves with the KI + +# kUpgradeKILevel and kDowngradeKILevel levels +kNanoKI=0 +kMicroKI=1 +kNormalKI=2 +kLowestKILevel = kNanoKI +kHighestKILevel = kNormalKI + +# Upgrade levels for the KI marker +kKIMarkerNotUpgraded = 0 +kKIMarkerFirstLevel = 1 # can play marker tag, but no GPS, can play first set of GZMarkers +kKIMarkerSecondLevel = 2 # can get to back room in GreatZero and play second set of GZmarkers +kKIMarkerNormalLevel = 3 # complete both GZmarker trials - has GPS + +# GZ Marker and Calibration GZ Marker status +kGZMarkerInactive = "0" +kGZMarkerAvailable = "1" +kGZMarkerCaptured = "2" +kGZMarkerUploaded = "3" + +# Calibration GZ Marker Games +kCGZMarkerInactive = "0" +kCGZMarkerAvailable = "1" +kCGZMarkerCaptured = "2" +kCGZMarkerUploaded = "3" +gCGZAllStates = [ kCGZMarkerInactive, kCGZMarkerAvailable, kCGZMarkerCaptured, kCGZMarkerUploaded ] +kCGZFirstGame = 0 +kCGZFinalGame = 3 +kCGZToransGame = 0 +kCGZHSpansGame = 1 +kCGZVSpansGame = 2 +kCGZActivateGZ = 3 + + +# -- chronicle names and types +kChronicleKILevel = "PlayerKILevel" +kChronicleKILevelType = 2 +kChronicleCensorLevel = "PlayerCensorLevel" +kChronicleCensorLevelType = 2 +kChronicleKIMarkerLevel = "KIMarkerLevel" +kChronicleKIMarkerLevelType = 2 +kChronicleGZGames = "GZGames" +kChronicleGZGamesType = 1 +kChronicleGZMarkersAquired = "GZMarkersAquired" +kChronicleGZMarkersAquiredType = 1 +kChronicleCalGZMarkersAquired = "CalGZMarkers" +kChronicleCalGZMarkersAquiredType = 1 + + +def PtDetermineKILevel(): + "Get the KILevel" + # assume that they have none... + import Plasma + import string + vault = Plasma.ptVault() + entry = vault.findChronicleEntry(kChronicleKILevel) + if type(entry) != type(None): + level = string.atoi(entry.chronicleGetValue()) + # make sure it is a valid level + if level >= kLowestKILevel and level <= kHighestKILevel: + return level + # if couldn't be determine... just assume lowest form + return kNanoKI + +def PtDetermineCensorLevel(): + "Get the KILevel" + # assume that they have none... + import Plasma + import string + vault = Plasma.ptVault() + entry = vault.findChronicleEntry(kChronicleCensorLevel) + if type(entry) != type(None): + level = string.atoi(entry.chronicleGetValue()) + return level + # if couldn't be determine... just assume lowest form + return 0 + +def PtDetermineKIMarkerLevel(): + "Get the KIMarkerLevel" + # assume that they have none... + import Plasma + import string + vault = Plasma.ptVault() + entry = vault.findChronicleEntry(kChronicleKIMarkerLevel) + if type(entry) != type(None): + level = string.atoi(entry.chronicleGetValue()) + return level + # if couldn't be determine... just assume lowest form + return kKIMarkerNotUpgraded + +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 + +def PtSetCGZGameState(whichGame,state): + "Get the CGZ Game level" + # assume that they have none... + import Plasma + import PlasmaTypes + if whichGame >= kCGZFirstGame and whichGame <= kCGZFinalGame: + if type(state) == type("") and state in gCGZAllStates: + PlasmaTypes.PtDebugPrint("PlasmaKITypes:PtSetCGZGameLevel - setting game %d to %s"%(whichGame,state),level=PlasmaTypes.kDebugDumpLevel) + vault = Plasma.ptVault() + entry = vault.findChronicleEntry(kChronicleCalGZMarkersAquired) + if type(entry) != type(None): + allStates = entry.chronicleGetValue() + newStates = "" + for idx in range(kCGZFinalGame+1): + if idx == whichGame: + newStates += state + else: + try: + newStates += allStates[idx] + except LookupError: + newStates += kCGZMarkerInactive + # make sure we get whatever is beyond this + newStates += allStates[kCGZFinalGame+1:] + entry.chronicleSetValue(newStates) + entry.save() + else: + # create a new one + newStates = "" + for idx in range(kCGZFinalGame+1): + if idx == whichGame: + newStates += state + else: + newStates += kCGZMarkerInactive + vault.addChronicleEntry(kChronicleCalGZMarkersAquired,kChronicleCalGZMarkersAquiredType,newStates) + else: + PlasmaTypes.PtDebugPrint("PlasmaKITypes:PtSetCGZGameLevel - invalid CGZ game state of:",state,level=PlasmaTypes.kErrorLevel) + pass + else: + PlasmaTypes.PtDebugPrint("PlasmaKITypes:PtSetCGZGameLevel - invalid CGZ game of %d"%(whichGame),level=PlasmaTypes.kErrorLevel) + pass + +def PtWhichCGZPlaying(): + "Has the player completed the CGZ stuff" + import Plasma + whichGame = -1 + state = kCGZMarkerInactive + vault = Plasma.ptVault() + entry = vault.findChronicleEntry(kChronicleCalGZMarkersAquired) + if type(entry) != type(None): + allStates = entry.chronicleGetValue() + if len(allStates) > kCGZFinalGame: + state = kCGZMarkerUploaded + for i in range(kCGZFinalGame+1): + if allStates[i] == kCGZMarkerAvailable or allStates[i] == kCGZMarkerCaptured: + whichGame = i + state = allStates[i] + break + if allStates[i] != kCGZMarkerUploaded: + state = kCGZMarkerInactive + return (whichGame,state) + +def PtIsCGZDone(): + "Has the player completed the CGZ stuff" + import Plasma + isDone = 0 + vault = Plasma.ptVault() + entry = vault.findChronicleEntry(kChronicleCalGZMarkersAquired) + if type(entry) != type(None): + allStates = entry.chronicleGetValue() + if len(allStates) > kCGZFinalGame: + # assume that we are going to find them all + isDone = 1 + for i in range(kCGZFinalGame+1): + if allStates[i] != kCGZMarkerUploaded: + isDone = 0 + break + return isDone + +def PtDetermineGZ(): + "Get the current GZ states" + import Plasma + import PlasmaTypes + import string + GZPlaying = 0 + MarkerToGetColor = 'off' + MarkerGottenColor = 'off' + MarkerToGetNumber = 0 + MarkerGottenNumber = 0 + KIMarkerLevel = PtDetermineKIMarkerLevel() + if KIMarkerLevel > kKIMarkerNotUpgraded: + # see if they are playing a CGZ game + (whichGame,state) = PtWhichCGZPlaying() + if KIMarkerLevel < kKIMarkerNormalLevel or (KIMarkerLevel == kKIMarkerNormalLevel and whichGame != -1): + vault = Plasma.ptVault() + # is there a chronicle for the GZ games? + entry = vault.findChronicleEntry(kChronicleGZGames) + if type(entry) != type(None): + gameString = entry.chronicleGetValue() + PlasmaTypes.PtDebugPrint("PtDetermineGZ: - game string is %s" % (gameString),level=PlasmaTypes.kDebugDumpLevel) + args = gameString.split() + if len(args) == 3: + try: + GZPlaying = string.atoi(args[0]) + colors = args[1].split(':') + MarkerGottenColor = colors[0] + MarkerToGetColor = colors[1] + outof = args[2].split(':') + MarkerGottenNumber = string.atoi(outof[0]) + MarkerToGetNumber = string.atoi(outof[1]) + except ValueError: + PlasmaTypes.PtDebugPrint("xKI:GZ - error trying to read GZGames Chronicle",level=PlasmaTypes.kErrorLevel) + # we don't know which one it errored on, so just reset them all + GZPlaying = 0 + MarkerToGetColor = 'off' + MarkerGottenColor = 'off' + MarkerToGetNumber = 0 + MarkerGottenNumber = 0 + else: + PlasmaTypes.PtDebugPrint("xKI:GZ - error GZGames string formation error",level=PlasmaTypes.kErrorLevel) + pass + else: + # can't be playing a GZGame! + # ...might be a MarkerTag game... let the KI determine that. + pass + PlasmaTypes.PtDebugPrint("PtDetermineGZ: - returning game=%d colors=%s:%s markers=%d:%d" % (GZPlaying, MarkerGottenColor, MarkerToGetColor ,MarkerGottenNumber, MarkerToGetNumber),level=PlasmaTypes.kDebugDumpLevel) + return (GZPlaying,MarkerGottenColor,MarkerToGetColor,MarkerGottenNumber,MarkerToGetNumber) + +def PtCaptureGZMarker(GZMarkerInRange): + 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 and MarkerToGetNumber > MarkerGottenNumber: + # 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() + markerIdx = GZMarkerInRange - 1 + if markerIdx >= 0 and markerIdx < len(markers): + # Set the marker to "captured" + PlasmaTypes.PtDebugPrint("PtCaptureGZMarker: starting with '%s' changing %d to '%s'" % (markers,GZMarkerInRange,kGZMarkerCaptured),level=PlasmaTypes.kDebugDumpLevel) + if len(markers)-(markerIdx+1) != 0: + markers = markers[:markerIdx] + kGZMarkerCaptured + markers[-(len(markers)-(markerIdx+1)):] + else: + markers = markers[:markerIdx] + kGZMarkerCaptured + #PlasmaTypes.PtDebugPrint("xKI: out string is '%s'" % (markers),level=PlasmaTypes.kDebugDumpLevel) + entry.chronicleSetValue(markers) + entry.save() + # update the marker Gotten count + 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 + MarkerGottenNumber = totalGotten + # save update to chronicle + PtUpdateGZGamesChonicles(GZPlaying,MarkerGottenColor,MarkerToGetColor,MarkerGottenNumber,MarkerToGetNumber) + else: + PlasmaTypes.PtDebugPrint("PtCaptureGZMarker: invalid marker serial number of %d" % (gGZMarkerInRange),level=PlasmaTypes.kErrorLevel ) + pass + else: + PlasmaTypes.PtDebugPrint("PtCaptureGZMarker: no chronicle entry found",level=PlasmaTypes.kErrorLevel ) + pass + else: + PlasmaTypes.PtDebugPrint("PtCaptureGZMarker: no game or this game is complete",level=PlasmaTypes.kErrorLevel ) + pass + +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 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 + + +# OnRTChat flags +# NOTE: kRTChatInterAge = 8 is being used in cyMisc.cpp SendRTChat (hard coded) so don't change here unless you change that too +kRTChatPrivate=1 +kRTChatAdmin=2 +kRTChatPrivateAdmin=3 +kRTChatInterAge=8 +kRTChatStatusMsg=16 +kRTChatNeighborsMsg=32 + +# flags channel mask +kRTChatFlagMask = 65535 +kRTChatChannelMask = 65280 +kRTChatNoChannel = 255 + +# OnCCRMsg flags +kCCRBeginCommunication=1 +kCCRChat=2 +kCCREndCommunication=3 +kCCRReturnChatMsg=4 diff --git a/Python/plasma/PlasmaNetConstants.py b/Python/plasma/PlasmaNetConstants.py new file mode 100644 index 0000000000..18136ee6fe --- /dev/null +++ b/Python/plasma/PlasmaNetConstants.py @@ -0,0 +1,34 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +class PtLinkingRules: + """(none)""" + kBasicLink = 0 + kOriginalBook = 1 + kSubAgeBook = 2 + kOwnedBook = 3 + kVisitBook = 4 + kChildAgeBook = 5 + diff --git a/Python/plasma/PlasmaTypes.py b/Python/plasma/PlasmaTypes.py new file mode 100644 index 0000000000..c62638a6cd --- /dev/null +++ b/Python/plasma/PlasmaTypes.py @@ -0,0 +1,820 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +This module is contains the datatypes and constants for +interfacing with the Plasma 2.0 engine. +""" +from Plasma import * +from PlasmaConstants import * + +#################################### +# Utility functions +#################################### +false=0 +true=1 + +# OnNotify Event enums +kCollisionEvent=PtEventType.kCollision # [1]=enter flag, [2]=hitter(probably avatar), [3]=hittee +kPickedEvent=PtEventType.kPicked # [1]=enter flag, [2]=picker(probably avatar), [3]=pickee, [4]=hitpoint(world) [5]=hitpoint(local) +kControlKeyEvent=PtEventType.kControlKey # [1]=key id, [2]=down flag +kVariableEvent=PtEventType.kVariable # [1]=name, [2]=data type, [3]=data +kFacingEvent=PtEventType.kFacing # [1]=enabled flag, [2]=facer(probably avatar), [3]=facee, [4]=dot product +kContainedEvent=PtEventType.kContained # [1]=entering flag, [2]=contained(probably avatar), [3]=container +kActivateEvent=PtEventType.kActivate # [1]=active flag, [2]=activate flag +kCallbackEvent=PtEventType.kCallback # [1]=callback id +kResponderStateEvent=PtEventType.kResponderState # [1]=state id +kMultiStageEvent=PtEventType.kMultiStage # [1]=what stage, [2]=event(see below), [3]=avatar +kSpawnedEvent=PtEventType.kSpawned # [1]=spawner, [2]=spawnee (usually avatar) +kClickDragEvent=PtEventType.kClickDrag # not used yet +kOfferLinkingBook=PtEventType.kOfferLinkingBook # [1]=offerer, [2]=link panel ID of age offered + + +# OnNotify Var Event Data Types +kVarNumberType=PtNotifyDataType.kNumber +kVarKeyType=PtNotifyDataType.kKey +# OnNotify MultiStageEvent - what event types +kEnterStage=PtMultiStageEventType.kEnterStage +kBeginingOfLoop=PtMultiStageEventType.kBeginingOfLoop +kAdvanceNextStage=PtMultiStageEventType.kAdvanceNextStage +kRegressPrevStage=PtMultiStageEventType.kRegressPrevStage +# Behavior - gotoStage +kStageExitBrain=-1 # sending ptAttribBehavior to stage -1 will exit brain + +# OnGUINotify Control Types +kDialog=1 +kButton=2 +kDraggable=3 +kListBox=4 +kTextBox=5 +kEditBox=6 +kUpDownPair=7 +kKnob=8 +kDragBar=9 +kCheckBox=10 +kRadioGroup=11 +kDynamicTextControl=12 +kMultiLineEdit=13 +# GUIControlListBox String Justify Types +kLeftJustify=1 +kRightJustify=2 +# GUIControlListBox String inherit flag +kNoInherit=0 +kInheritFromNormal=1 +kInheritFromSelect=2 +kSelectDetermined=3 +kSelectUseGUIColor=4 +# GUIControlMultiLineEdit style flags (additive) +kFontBold=1 +kFontItalic=2 +kFontShadowed=4 + +# OnGUINotify Event Types +kShowHide=1 # show or hide change (only on kDialog) +kAction=2 # kButton clicked, kListBox item clicked on, kEditBox hit enter +kValueChanged=3 # value changed in control (could be from kUpDownPair,kKnob,kCheckBox,kRadioGroup +kDialogLoaded=4 # the dialog has just been loaded +kFocusChange=5 # the focus changed from one control to another, or none, within the dialog +kExitMode = 6 # Modal dialog received an exit mode command +kInterestingEvent = 7 # an interesting event happened + +# OnRoomLoad 'what' types +kLoaded=1 +kUnloaded=2 + +# Clothing group Types and clothing types +kMaleClothingGroup=0 +kFemaleClothingGroup=1 +kAnyClothingItem=-1 +kPantsClothingItem=0 +kShirtClothingItem=1 +kLeftHandClothingItem=2 +kRightHandClothingItem=3 +kFaceClothingItem=4 +kHairClothingItem=5 +kLeftFootClothingItem=6 +kRightFootClothingItem=7 +kAccessoryClothingItem=8 + +#Debug print levels +kDebugDumpLevel = 1 +kWarningLevel = 2 +kErrorLevel = 3 +kAssertLevel = 4 + + +def PtAssert(cond, msg): + "Plasma assert. Just like the Python one but we can set it to NOP in release" + assert cond,msg + +def PtDebugPrint(*msgs,**keywords): + "Plasma debug print. Will be NOP'd when released" + try: + level = keywords['level'] + except LookupError: + level = kErrorLevel + if level >= PtGetPythonLoggingLevel(): + if level == 4: + PtAssert(0,msgs[0]) + else: + for msg in msgs: + print msg + +def PtGetObjectName(obj): + "Given a ptSceneobject, return its name" + if isinstance(obj,ptSceneobject): + if type(obj.getKey()) != type(None): + return obj.getKey().getName() + return "nil" + +# add an event that is in the form of a list +# ...to a notify message +def PtAddEvent(notify,event): + "Add an event of any type to a ptNotify message object" + if type(event) != type([]): + print "Unrecognized event record structure" + return + if event[0] == kCollisionEvent: + notify.addCollisionEvent(event[1],event[2].getKey(),event[3].getKey()) + elif event[0] == kPickedEvent: + notify.addPickEvent(event[1],event[2].getKey(),event[3].getKey(),event[4]) + elif event[0] == kControlKeyEvent: + notify.addControlKeyEvent(event[1],event[2]) + elif event[0] == kVariableEvent: + if event[2] == kVarNumberType: + notify.addVarNumber(event[1],event[3]) + elif event[2] == kVarKeyType: + notify.addVarKey(event[1],event[3]) + elif event[0] == kFacingEvent: + notify.addFacingEvent(event[1],event[2].getKey(),event[3].getKey(),event[4]) + elif event[0] == kContainedEvent: + notify.addContainerEvent(event[1],event[2].getKey(),event[3].getKey()) + elif event[0] == kActivateEvent: + notify.addActivateEvent(event[1],event[2]) + elif event[0] == kCallbackEvent: + notify.addCallbackEvent(event[1]) + elif event[0] == kResponderStateEvent: + notify.addResponderState(event[1]) + else: + print "Unrecognized event type %d" % (event[0]) + +# add a list of events into a ptNotify message +def PtAddEvents(notify, events): + "Add a list of events to a ptNotify message object" + if type(events) == type([]): + for event in events: + PtAddEvent(notify,event) + +# find the avatar in event record list +def PtFindAvatar(events): + "Find the avatar in one of the event records" + for event in events: + if event[0]==kCollisionEvent or event[0]==kPickedEvent or event[0]==kFacingEvent or event[0]==kContainedEvent or event[0]==kSpawnedEvent: + return event[2] + if event[0] == kMultiStageEvent: + return event[3] + # didn't find one + return None + +#################################### +# Exceptions +#################################### +import exceptions +class ptResponderStateError(exceptions.Exception): + def __init__(self,args=None): + self.args = args + +# +# Attributes that will be exposed in Max to be filled in by + +#################################### +# base class for all attributes +#################################### +# (This makes it easy to find all the attributes in a module) +class ptAttribute: + def __init__(self,id,name, vislistid = -1, visliststates = []): + self.id = id + self.name = name + self.vis_id = vislistid + self.vis_states = visliststates + + def setVisInfo(self, id, stateslist): + self.vis_id = id + self.vis_states = stateslist + + def getVisInfo(self): + return (self.vis_id, self.vis_states) + +# base class for all list attributes +# (This makes it easy to find all the attributes that are a list) +class ptAttributeList(ptAttribute): + def __init__(self,id,name): + ptAttribute.__init__(self,id,name) + +# Boolean attribute (Checkbox) +class ptAttribBoolean(ptAttribute): + def __init__(self,id,name=None, default=0): + ptAttribute.__init__(self,id,name) + self.value = default + def getdef(self): + return (self.id,self.name,1,self.value) + +# Integer attribute (Spinner) +class ptAttribInt(ptAttribute): + def __init__(self,id,name=None,default=0,rang=None): + ptAttribute.__init__(self,id,name) + self.value = default + self.rang = rang + def getdef(self): + return (self.id,self.name,2,self.value,self.rang) + +# Floating point number attribute (Spinner) +class ptAttribFloat(ptAttribute): + def __init__(self,id,name=None,default=0.0,rang=None): + ptAttribute.__init__(self,id,name) + self.value = default + self.rang = rang + def getdef(self): + return (self.id,self.name,3,self.value,self.rang) + +# String attribute (Edit box) +class ptAttribString(ptAttribute): + def __init__(self,id,name=None,default=""): + ptAttribute.__init__(self,id,name) + self.value = default + def getdef(self): + return (self.id,self.name,4,self.value) + +# Drop-down list attribute (Drop-down list combo box) +class ptAttribDropDownList(ptAttribute): + def __init__(self,id,name=None,options=None): + ptAttribute.__init__(self,id,name) + self.options = options + def getdef(self): + return (self.id,self.name,20,self.options) + +# Sceneobject attribute (pick single sceneobject box) +class ptAttribSceneobject(ptAttribute): + def __init__(self,id,name=None,netForce=0): + ptAttribute.__init__(self,id,name) + self.value = None + self.sceneobject = None + self.netForce = netForce + def getdef(self): + return (self.id,self.name,5) + def __setvalue__(self,value): + if self.netForce: + value.netForce(1) + self.value = value + self.sceneobject = self.value + +# Sceneobject list attribute (pick multiple sceneobjects box) +class ptAttribSceneobjectList(ptAttributeList): + def __init__(self,id,name=None,byObject=0,netForce=0): + ptAttributeList.__init__(self,id,name) + self.value = [] # start as an empty list + self.sceneobject = self.value + self.netForce = netForce + if byObject: + self.byObject = {} + else: + self.byObject = None + def getdef(self): + return (self.id,self.name,6) + def __setvalue__(self,value): + if self.netForce: + value.netForce(1) + self.value.append(value) + if type(self.byObject) == type({}): + name = value.getName() + self.byObject[name] = value + +# attribute list of keys +class ptAttributeKeyList(ptAttributeList): + def __init__(self,id,name=None,byObject=0,netForce=0): + ptAttributeList.__init__(self,id,name) + self.value = [] + self.netForce = netForce + if byObject: + self.byObject = {} + else: + self.byObject = None + def enable(self,objectName=None): + if self.value != None: + if type(objectName) != type(None) and type(self.byObject) != type(None): + pkey = self.byObject[objectName] + if self.netForce: + pkey.netForce(1) + pkey.enable() + elif type(self.value)==type([]): + for pkey in self.value: + if self.netForce: + pkey.netForce(1) + pkey.enable() + else: + if self.netForce: + self.value.netForce(1) + self.value.enable() + def disable(self,objectName=None): + if self.value != None: + if type(objectName) != type(None) and type(self.byObject) != type(None): + pkey = self.byObject[objectName] + if self.netForce: + pkey.netForce(1) + pkey.disable() + elif type(self.value)==type([]): + for pkey in self.value: + if self.netForce: + pkey.netForce(1) + pkey.disable() + else: + if self.netForce: + self.value.netForce(1) + self.value.disable() + def __setvalue__(self,value): + if self.netForce: + value.netForce(1) + self.value.append(value) + if type(self.byObject) == type({}): + name = value.getName() + self.byObject[name] = value + +# Activator attribute (pick activator types box) +class ptAttribActivator(ptAttributeKeyList): + def getdef(self): + return (self.id,self.name,8) + def enableActivator(self): + for key in self.value: + key.getSceneObject().physics.enable() + def disableActivator(self): + for key in self.value: + key.getSceneObject().physics.disable() + def volumeSensorIgnoreExtraEnters(self,state): + for key in self.value: + key.getSceneObject().volumeSensorIgnoreExtraEnters(state) + +# Activator attribute (pick activator types box) +class ptAttribActivatorList(ptAttributeKeyList): + def getdef(self): + return (self.id,self.name,7) + +# Responder attribute (pick responder types box) +class ptAttribResponder(ptAttributeKeyList): + def __init__(self,id,name=None,statelist=None,byObject=0,netForce=0): + ptAttributeKeyList.__init__(self,id,name,byObject,netForce) + self.state_list = statelist + def getdef(self): + return (self.id,self.name,9) + def run(self,key,state=None,events=None,avatar=None,objectName=None,netForce=0,netPropagate=1,fastforward=0): + # has the value been set? + if type(self.value) != type(None): + nt = ptNotify(key) + nt.clearReceivers() + # see if the value is a list or byObject or a single + if type(objectName) != type(None) and type(self.byObject) != type(None): + nt.addReceiver(self.byObject[objectName]) + elif type(self.value)==type([]): + for resp in self.value: + nt.addReceiver(resp) + else: + nt.addReceiver(self.value) + if not netPropagate: + nt.netPropagate(0) + # ptNotify defaults to netPropagate=1 + if netForce or self.netForce: + nt.netForce(1) + # see if the state is specified + if type(state) == type(0): + raise ptResponderStateError,"Specifying state as a number is no longer supported" + elif type(state) == type(''): + if type(self.state_list) != type(None): + try: + idx = self.state_list.index(state) + nt.addResponderState(idx) + except ValueError: + raise ptResponderStateError, "There is no state called '%s'"%(state) + else: + raise ptResponderStateError,"There is no state list provided" + # see if there are events to pass on + if type(events) != type(None): + PtAddEvents(nt,events) + if type(avatar) != type(None): + nt.addCollisionEvent(1,avatar.getKey(),avatar.getKey()) + if fastforward: + nt.setType(PtNotificationType.kResponderFF) + # if fast forwarding, then only do it on the local client + nt.netPropagate(0) + nt.netForce(0) + nt.setActivate(1.0) + nt.send() + def setState(self,key,state,objectName=None,netForce=0,netPropagate=1): + # has the value been set? + if type(self.value) != type(None): + nt = ptNotify(key) + nt.clearReceivers() + # see if the value is a list or byObject or a single + if type(objectName) != type(None) and type(self.byObject) != type(None): + nt.addReceiver(self.byObject[objectName]) + elif type(self.value)==type([]): + for resp in self.value: + nt.addReceiver(resp) + else: + nt.addReceiver(self.value) + if not netPropagate: + nt.netPropagate(0) + # ptNotify defaults to netPropagate=1 + if netForce or self.netForce: + nt.netForce(1) + # see if the state is specified + if type(state) == type(0): + raise ptResponderStateError,"Specifying state as a number is no longer supported" + elif type(state) == type(''): + if type(self.state_list) != type(None): + try: + idx = self.state_list.index(state) + nt.addResponderState(idx) + except ValueError: + raise ptResponderStateError, "There is no state called '%s'"%(state) + else: + raise ptResponderStateError,"There is no state list provided" + # see if there are events to pass on + nt.setType(PtNotificationType.kResponderChangeState) + nt.setActivate(1.0) + nt.send() + + def getState(self): + if (type(self.value) != type(None)): + if type(self.value)==type([]): + for resp in self.value: + obj = resp.getSceneObject() + idx = obj.getResponderState() + curState = self.state_list[idx] + return curState + else: + obj = self.value.getSceneObject() + idx = obj.getResponderState() + curState = self.state_list[idx] + return curState + + +# Responder attribute List +class ptAttribResponderList(ptAttribResponder): + def getdef(self): + return (self.id,self.name,10) + +# Activator attribute (pick activator types box) +class ptAttribNamedActivator(ptAttribActivator): + def getdef(self): + # get attribute as a string, then we will turn it into an activator later + return (self.id,self.name,4,self.value) + +# Responder attribute (pick responder types box) +class ptAttribNamedResponder(ptAttribResponder): + def getdef(self): + # get attribute as a string, then we will turn it into an responder later + return (self.id,self.name,4,self.value) + +# DynamicText attribute pick button +class ptAttribDynamicMap(ptAttribute): + def __init__(self,id,name=None,netForce=0): + ptAttribute.__init__(self,id,name) + self.value = None + self.textmap = None + self.netForce = netForce + # this is to set the value via method (only called if defined) + def __setvalue__(self,value): + # has a ptDynamicText already been made + try: + self.textmap.addKey(value) + except AttributeError: + self.textmap = ptDynamicMap(value) + if self.netForce: + self.textmap.netForce(1) + self.value = self.textmap + def getdef(self): + return (self.id,self.name,11) + +# a GUI Dialogbox attribute +class ptAttribGUIDialog(ptAttribute): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.dialog = None + self.value = None + def getdef(self): + return (self.id,self.name,12) + def __setvalue__(self,value): + self.dialog = ptGUIDialog(value) + self.value = self.dialog + +# a Exclude region attribute +kExRegRelease = 0 +kExRegClear = 1 +class ptAttribExcludeRegion(ptAttribute): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.value = None + def getdef(self): + return (self.id,self.name,13) + def clear(self,sender): + if type(self.value) != type(None): + PtExcludeRegionSet(sender,self.value,kExRegClear) + def release(self,sender): + if type(self.value) != type(None): + PtExcludeRegionSet(sender,self.value,kExRegRelease) + def enable(self): + self.sceneobject.physics.enable() + def disable(self): + self.sceneobject.physics.disable() + def clearNow(self,sender): + if type(self.value) != type(None): + PtExcludeRegionSetNow(sender,self.value,kExRegClear) + def releaseNow(self,sender): + if type(self.value) != type(None): + PtExcludeRegionSetNow(sender,self.value,kExRegRelease) + +class ptAttribWaveSet(ptAttribute): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.value = None + def getdef(self): + return (self.id,self.name,19) + def __setvalue__(self,value): + self.waveset = ptWaveSet(value) + self.value = self.waveset + +class ptAttribSwimCurrent(ptAttribute): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.value = None + self.current = None + def getdef(self): + return (self.id,self.name,21) + def __setvalue__(self,value): + self.current = ptSwimCurrentInterface(value) + self.value = self.current + +class ptAttribClusterList(ptAttributeList): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.value = [] + def getdef(self): + return (self.id,self.name,22) + def __setvalue__(self,value): + self.value.append(ptCluster(value)) + +# special class for byObject that gets the parents name of the values when someone first asks for them +class ptByAnimObject(dict): + def __init__(self): + dict.__init__(self) + self.gotParentKeys = 0 + def getParentKeys(self): + # if we haven't got the parent keys yet, then add them to the dict + if not self.gotParentKeys: + for anim in dict.values(self): + # get the animation target key + aKey = anim.getFirstKey() + if aKey: + # get its parent key + pKey = aKey.getParentKey() + if pKey: + # only add this key once + if not pKey.getName() in self: + dict.__setitem__(self,pKey.getName(),anim) + self.gotParentKeys = 1 + def __getitem__(self,key): + self.getParentKeys() + return dict.__getitem__(self,key) + def keys(self): + self.getParentKeys() + return dict.keys(self) + def get(self, key, *args): + self.getParentKeys() + return dict.get(self, key, *args) + +# an Animation attribute +kAnimEaseNoEase = 0 +kAnimEaseConstAccel = 1 +kAnimEaseSpline = 2 +class ptAttribAnimation(ptAttribute): + def __init__(self,id,name=None,byObject=0,netForce=0): + ptAttribute.__init__(self,id,name) + self.value = None + self.animName = "" + self.netForce = netForce + if byObject: + self.byObject = ptByAnimObject() + else: + self.byObject = None + # this is to set the value via method (only called if defined) + def __setvalue__(self,value): + # has a ptAnimation already been made + if type(value) == type(""): + self.animName = value + try: + self.animation.setAnimName(value) + # then if there are animations by object then set those, too + if isinstance(self.byObject,ptByAnimObject): + for anim in self.byObject.values(): + anim.setAnimName(value) + except AttributeError: + self.animation = ptAnimation() + self.animation.setAnimName(value) + if self.netForce: + self.animation.netForce(1) + self.value = self.animation + elif isinstance(value,ptKey): + try: + self.animation.addKey(value) + except AttributeError: + self.animation = ptAnimation() + self.animation.addKey(value) + if self.netForce: + self.animation.netForce(1) + self.value = self.animation + if isinstance(self.byObject,ptByAnimObject): + singleAnim = ptAnimation() + singleAnim.addKey(value) + if self.netForce: + singleAnim.netForce(1) + # set name if known + if self.animName != "": + singleAnim.setAnimName(self.animName) + name = value.getName() + self.byObject[name] = singleAnim + def getdef(self): + return (self.id,self.name,14) + +# a Behavior attribute +class ptAttribBehavior(ptAttribute): + "Attribute for specifying behaviors, including multistage Behaviors" + def __init__(self,id,name=None,netForce=1,netProp=1): + ptAttribute.__init__(self,id,name) + self.value = None + self.netForce = netForce + self.netProp = netProp + def __setvalue__(self,value): + self.value = value + PtSetBehaviorNetFlags(self.value, self.netForce, self.netProp) + def getdef(self): + return (self.id,self.name,15) + def run(self,avatar): + "This will run the behavior on said avatar" + if type(self.value) != type(None): + if self.netForce: + self.value.netForce(1) + avatar.avatar.netForce(1) + avatar.avatar.runBehavior(self.value,self.netForce,self.netProp) + def nextStage(self,avatar,transitionTime=1.0,setTimeFlag=1,newTime=0.0,dirFlag=0,isForward=1): + "This will go to the next stage in a multi-stage behavior" + if type(self.value) != type(None): + if self.netForce: + self.value.netForce(1) + avatar.avatar.netForce(1) + avatar.avatar.nextStage(self.value,transitionTime,setTimeFlag,newTime,dirFlag,isForward,self.netForce) + def previousStage(self,avatar,transitionTime=1.0,setTimeFlag=1,newTime=0.0,dirFlag=0,isForward=1): + "This will go to the next stage in a multi-stage behavior" + if type(self.value) != type(None): + if self.netForce: + self.value.netForce(1) + avatar.avatar.netForce(1) + avatar.avatar.previousStage(self.value,transitionTime,setTimeFlag,newTime,dirFlag,isForward,self.netForce) + def gotoStage(self,avatar,stage,transitionTime=1.0,setTimeFlag=1,newTime=0.0,dirFlag=0,isForward=1): + "This will go to the next stage in a multi-stage behavior" + if type(self.value) != type(None): + if self.netForce: + self.value.netForce(1) + avatar.avatar.netForce(1) + avatar.avatar.gotoStage(self.value,stage,transitionTime,setTimeFlag,newTime,dirFlag,isForward,self.netForce) + def setLoopCount(self,stage,loopCount): + "This will set the loop count for a stage" + if type(self.value) != type(None): + PtSetBehaviorLoopCount(self.value,stage,loopCount,self.netForce) + +# Material texture attribute pick button +class ptAttribMaterial(ptAttribute): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.value = None + self.map = None + # this is to set the value via method (only called if defined) + def __setvalue__(self,value): + self.map = ptImage(value) + self.value = self.map + def getdef(self): + return (self.id,self.name,16) + +class ptAttribMaterialAnimation(ptAttribute): + def __init__(self, id, name = None): + ptAttribute.__init__(self, id, name) + self.value = None + self.animation = None + + def __setvalue__(self, value): + if type(self.animation) == type(None): + self.animation = ptAnimation() + self.animation.addKey(value) + self.value = self.animation + else: + self.animation.addKey(value) + + def getdef(self): + return (self.id, self.name, 23) + + +# Sceneobject list attribute (pick multiple sceneobjects box) +class ptAttribMaterialList(ptAttributeList): + def __init__(self,id,name=None,byObject=0,netForce=0): + ptAttributeList.__init__(self,id,name) + self.value = [] # start as an empty list + self.map = self.value + self.netForce = netForce + if byObject: + self.byObject = {} + else: + self.byObject = None + def getdef(self): + return (self.id,self.name,6) + def __setvalue__(self,value): + if self.netForce: + value.netForce(1) + self.value.append(value) + if type(self.byObject) == type({}): + name = value.getName() + self.byObject[name] = value + +# a GUI PopUpMenu attribute +class ptAttribGUIPopUpMenu(ptAttribute): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.value = None + def getdef(self): + return (self.id,self.name,17) + def __setvalue__(self,value): + self.menu = ptGUIPopUpMenu(value) + self.value = self.menu + +# a GUI Skin attribute +class ptAttribGUISkin(ptAttribute): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.value = None + def getdef(self): + return (self.id,self.name,18) + def __setvalue__(self,value): + self.skin = ptGUISkin(value) + self.value = self.skin + +# a Grass Shader attribute +class ptAttribGrassShader(ptAttribute): + def __init__(self,id,name=None): + ptAttribute.__init__(self,id,name) + self.value = None + def getdef(self): + return (self.id,self.name,24) + def __setvalue__(self,value): + self.shader = ptGrassShader(value) + self.value = self.shader + + +# +# ptModifier - class for creating a Plasma modifier, such as a responder + +# base class +class ptModifier: + def __init__(self): + self.key = None + self.SDL = None + self.version = 0 + +class ptResponder(ptModifier): + # this modifier will get a plNotifyMsg as an OnNotify + def __init__(self): + ptModifier.__init__(self) + self.sceneobject = None + +class ptMultiModifier(ptModifier): + # this modifier can be attached to multiple object, but only one module + def __init__(self): + ptModifier.__init__(self) diff --git a/Python/plasma/PlasmaVaultConstants.py b/Python/plasma/PlasmaVaultConstants.py new file mode 100644 index 0000000000..22e8edd0c8 --- /dev/null +++ b/Python/plasma/PlasmaVaultConstants.py @@ -0,0 +1,98 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +class PtVaultCallbackTypes: + """(none)""" + kVaultConnected = 1 + kVaultNodeSaved = 2 + kVaultNodeRefAdded = 3 + kVaultRemovingNodeRef = 4 + kVaultNodeRefRemoved = 5 + kVaultNodeInitialized = 6 + kVaultOperationFailed = 7 + kVaultNodeAdded = 8 + kVaultDisconnected = 9 + +class PtVaultNodeTypes: + """(none)""" + kInvalidNode = 0 + kAgeInfoNode = 33 + kAgeInfoListNode = 34 + kMarkerGameNode = 35 + kVNodeMgrPlayerNode = 2 + kVNodeMgrAgeNode = 3 + kFolderNode = 22 + kPlayerInfoNode = 23 + kImageNode = 25 + kTextNoteNode = 26 + kSDLNode = 27 + kAgeLinkNode = 28 + kChronicleNode = 29 + kPlayerInfoListNode = 30 + +class PtVaultNotifyTypes: + """(none)""" + kRegisteredOwnedAge = 9 + kUnRegisteredOwnedAge = 10 + kRegisteredVisitAge = 11 + kUnRegisteredVisitAge = 12 + kPublicAgeCreated = 13 + kPublicAgeRemoved = 14 + +class PtVaultStandardNodes: + """(none)""" + kUserDefinedNode = 0 + kInboxFolder = 1 + kBuddyListFolder = 2 + kIgnoreListFolder = 3 + kPeopleIKnowAboutFolder = 4 + kChronicleFolder = 6 + kAvatarOutfitFolder = 7 + kAgeTypeJournalFolder = 8 + kSubAgesFolder = 9 + kHoodMembersFolder = 11 + kAllPlayersFolder = 12 + kAgeMembersFolder = 13 + kAgeJournalsFolder = 14 + kAgeInstanceSDLNode = 16 + kCanVisitFolder = 18 + kAgeOwnersFolder = 19 + kAllAgeGlobalSDLNodesFolder = 20 + kPlayerInfoNode = 21 + kPublicAgesFolder = 22 + kAgesIOwnFolder = 23 + kAgesICanVisitFolder = 24 + kAvatarClosetFolder = 25 + kGlobalInboxFolder = 30 + +class PtVaultTextNoteSubTypes: + """(none)""" + kGeneric = 0 + +class PtVaultTextNoteTypes: + """(none)""" + kGeneric = 0 + kCCRPetition = 1 + diff --git a/Python/plasma/glue.py b/Python/plasma/glue.py new file mode 100644 index 0000000000..f9aa14cb73 --- /dev/null +++ b/Python/plasma/glue.py @@ -0,0 +1,208 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +# glue code in python for the glue code in C++ +# This assumes that this will be loaded into the module that we are trying to do +# with an execfile('.\\python\\system\\glue.py') at the end of the module (after everything is defined) +# SPECIAL WARNING(1): This glue code returns the attributes in reverse ID order! +glue_cl = None # the class of the modifier +glue_inst = None # instance of the class modifier +glue_params = None # parameters dictionary: mapped id to instance +glue_paramKeys = None # this is the parameter ID list, that should be sorted +try: + x = glue_verbose +except NameError: + glue_verbose = 0 +def glue_getClass(): + global glue_cl + if glue_cl == None: + try: + cl = eval(glue_name) + if issubclass(cl,ptModifier): + glue_cl = cl + else: + if glue_verbose: + print "Class %s is not derived from modifier" % (cl.__name__) + except NameError: + if glue_verbose: + try: + print "Could not find class %s" % (glue_name) + except NameError: + print "Filename/classname not set!" + return glue_cl +def glue_getInst(): + global glue_inst + if type(glue_inst) == type(None): + cl = glue_getClass() + if cl != None: + glue_inst = cl() + return glue_inst +def glue_delInst(): + global glue_inst + global glue_cl + global glue_params + global glue_paramKeys + if type(glue_inst) != type(None): + del glue_inst + # remove our references + glue_cl = None + glue_params = None + glue_paramKeys = None +def glue_getVersion(): + inst = glue_getInst() + ver = inst.version + glue_delInst() + return ver +def glue_findAndAddAttribs(obj, glue_params): + if isinstance(obj,ptAttribute): + if glue_params.has_key(obj.id): + if glue_verbose: + print "WARNING: Duplicate attribute ids!" + print "%s has id %d which is already defined in %s" % (obj.name, obj.id, glue_params[obj.id].name) + else: + glue_params[obj.id] = obj + elif type(obj) == type([]): + for o in obj: + glue_findAndAddAttribs(o, glue_params) + elif type(obj) == type({}): + for o in obj.values(): + glue_findAndAddAttribs(o, glue_params) + elif type(obj) == type( () ): + for o in obj: + glue_findAndAddAttribs(o, glue_params) + +def glue_getParamDict(): + global glue_params + global glue_paramKeys + if type(glue_params) == type(None): + glue_params = {} + gd = globals() + for obj in gd.values(): + glue_findAndAddAttribs(obj, glue_params) + # rebuild the parameter sorted key list + glue_paramKeys = glue_params.keys() + glue_paramKeys.sort() + glue_paramKeys.reverse() # reserve the order because PlasmaMax will ask for them in reverse order + return glue_params +def glue_getClassName(): + cl = glue_getClass() + if cl != None: + return cl.__name__ + if glue_verbose: + print "Class not found in %s.py" % (glue_name) + return None +def glue_getBlockID(): + inst = glue_getInst() + if inst != None: + return inst.id + if glue_verbose: + print "Instance could not be created in %s.py" % (glue_name) + return None +def glue_getNumParams(): + pd = glue_getParamDict() + if pd != None: + return len(pd) + if glue_verbose: + print "No attributes found in %s.py" % (glue_name) + return 0 +def glue_getParam(number): + global glue_paramKeys + pd = glue_getParamDict() + if pd != None: + # see if there is a paramKey list + if type(glue_paramKeys) == type([]): + if number >= 0 and number < len(glue_paramKeys): + return pd[glue_paramKeys[number]].getdef() + else: + print "glue_getParam: Error! %d out of range of attribute list" % (number) + else: + pl = pd.values() + if number >= 0 and number < len(pl): + return pl[number].getdef() + else: + if glue_verbose: + print "glue_getParam: Error! %d out of range of attribute list" % (number) + if glue_verbose: + print "GLUE: Attribute list error" + return None +def glue_setParam(id,value): + pd = glue_getParamDict() + if pd != None: + if pd.has_key(id): + # first try to set the attribute via function call (if there is one) + try: + pd[id].__setvalue__(value) + except AttributeError: + if isinstance(pd[id],ptAttributeList): + try: + if type(pd[id].value) != type([]): + pd[id].value = [] # make sure that the value starts as an empty list + except AttributeError: + pd[id].value = [] # or if value hasn't been defined yet, then do it now + pd[id].value.append(value) # add in new value to list + else: + pd[id].value = value + else: + if glue_verbose: + print "setParam: can't find id=",id + else: + print "setParma: Something terribly has gone wrong. Head for the cover." +def glue_isNamedAttribute(id): + pd = glue_getParamDict() + if pd != None: + try: + if isinstance(pd[id],ptAttribNamedActivator): + return 1 + if isinstance(pd[id],ptAttribNamedResponder): + return 2 + except KeyError: + if glue_verbose: + print "Could not find id=%d attribute" % (id) + return 0 +def glue_isMultiModifier(): + inst = glue_getInst() + if isinstance(inst,ptMultiModifier): + return 1 + return 0 +def glue_getVisInfo(number): + global glue_paramKeys + pd = glue_getParamDict() + if pd != None: + # see if there is a paramKey list + if type(glue_paramKeys) == type([]): + if number >= 0 and number < len(glue_paramKeys): + return pd[glue_paramKeys[number]].getVisInfo() + else: + print "glue_getVisInfo: Error! %d out of range of attribute list" % (number) + else: + pl = pd.values() + if number >= 0 and number < len(pl): + return pl[number].getVisInfo() + else: + if glue_verbose: + print "glue_getVisInfo: Error! %d out of range of attribute list" % (number) + if glue_verbose: + print "GLUE: Attribute list error" + return None diff --git a/Python/plasma/pch.py b/Python/plasma/pch.py new file mode 100644 index 0000000000..b113f64548 --- /dev/null +++ b/Python/plasma/pch.py @@ -0,0 +1,286 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" pch - Plasma Console Helper +This module aids in the using the plasma console to debug PythonFileComponents. +""" +# plasma console helper +import Plasma +import PlasmaTypes +import sys + +# globals for the outside and inside to grab +__pmods = [] +__sel = 0 +__selattr = 0 + +# help! +def help(): + "display help" + print "functions:" + print " getmods() - gets all the modules available" + print " showmods() - show the modules (and the current selected module)" + print " selmod(i) - selects module 'i'; returns module object" + print " showmod() - shows detail of the module selected" + print " showdoc() - shows the doc field of the module selected" + print " showattribs() - shows all the plasma attributes of the module selected" + print " selattrib(id) - selects attribute 'id' in the selected module;" + print " returns attribute object" + print " setattrib(value) - sets the selected attribute to 'value'" + print " showglobals() - shows the globals for the selected module" + print " setglobal(name,value) - set global 'name' to 'value' in selected module" + print " getglobal(name) - returns global object" + print " showinst() - shows the instance of the ptModifier class for the selected" + print " module" + print " getinst() - returns the instance object" + print " showvars(inst) - shows the instance variables of the ptModifier class of" + print " the selected module" + print " showmethods(inst) - shows the methods of the ptModifier class of the" + print " selected module" + print " showfunc(method) - decompiles a method or function and shows source" + print " setvar(name,value) - sets instance variable 'name' to 'value' in the" + print " selected module" + print " getvar(name) - returns the instance variable object (in selected module)" +# modules +def getmods(): + "get all the PythonFileComponent modules" + global __pmods,__sel + __pmods = [] # wipe the module list clean + print "Plasma modules:" + for modname in sys.modules.keys(): + mod = sys.modules[modname] + if hasattr(mod,"glue_inst"): + if __sel == len(__pmods): + print "*%d. %s" % (len(__pmods),modname[:-13]) + else: + print " %d. %s" % (len(__pmods),modname[:-13]) + __pmods.append([modname,mod]) +def showmods(): + "show all the PythonFileComponent modules" + global __pmods + global __sel + idx = 0 + print "Plasma modules:" + for mod in __pmods: + if idx == __sel: + print "*%d. %s" % (idx,mod[0][:-13]) + else: + print " %d. %s" % (idx,mod[0][:-13]) + idx += 1 +def selmod(idx=None): + "select a module from the list" + global __pmods + global __sel + if type(idx) == type(None): + idx = __sel + elif type(idx) == type(""): + # its a string, then find it by module name + i = 0 + for mod in __pmods: + if mod[0][:-13] == idx: + break + i += 1 + # if we didn't find the module + if i == len(__pmods): + print "Module %s not found" % idx + return + idx = i + if idx < len(__pmods): + __sel = idx + print "%s selected" % (__pmods[idx][0][:-13]) + return __pmods[__sel][1] + else: + print "Error: index not valid. There are %d modules" % (len(__pmods)) +# find attributes +def showmod(): + "show details of the selected module" + global __pmods + global __sel + print "Module: %s" % (__pmods[__sel][0][:-13]) + showdoc() + showattribs() + showglobals() + showinst() +def showdoc(): + "show the doc of the module selected" + global __pmods + global __sel + print "Doc:" + print __pmods[__sel][1].__doc__ +def showattribs(): + "show the plasma attributes of the module selected" + global __pmods + global __sel + global __selattr + print "Attributes in %s:" % (__pmods[__sel][0][:-13]) + for name in __pmods[__sel][1].__dict__.keys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptAttribute): + if __selattr == ist.id: + print "*(%d) %s(%s) =" % (ist.id,name,ist.__class__.__name__),ist.value + else: + print " (%d) %s(%s) =" % (ist.id,name,ist.__class__.__name__),ist.value +def selattrib(id=None): + "select a plasma attribute by id in the selected module" + global __pmods + global __sel + global __selattr + if type(id) == type(None): + id = __selattr + for name in __pmods[__sel][1].__dict__.keys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptAttribute): + if id == ist.id: + __selattr = ist.id + print "%s(%s) =" % (name,ist.__class__.__name__),ist.value + return ist + print "Error: Attribute ID %d not found" % (id) +def setattrib(value): + "set the value of the selected plasma attribute in the selected module" + global __pmods + global __sel + global __selattr + for name in __pmods[__sel][1].__dict__.keys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptAttribute): + if __selattr == ist.id: + if type(ist.value) == type(None) or type(ist.value) == type(value): + # see if there is a __setvalue__ method + try: + ist.__setvalue__(value) + except AttributeError: + ist.value = value + else: + print "Error: value is not same type as attribute" + return + print "Error: Attribute ID %d not found" % (id) +# find globals +def showglobals(): + "show the global variables of the selected module" + global __pmods + global __sel + print "Globals:" + for name in __pmods[__sel][1].__dict__.keys(): + ist = __pmods[__sel][1].__dict__[name] + # make sure that its not something we already know about + if not hasattr(Plasma,name) and not hasattr(PlasmaTypes,name): + if not isinstance(ist,PlasmaTypes.ptAttribute) and not isinstance(ist,PlasmaTypes.ptModifier): + if name[:2] != '__' and name[:4] != 'glue': + if type(ist) != type(sys) and type(ist) != type(PlasmaTypes.ptAttribute): + print " %s =" % (name),ist +def setglobal(name,value): + "set a global variable to a value with in the selected module" + global __pmods + global __sel + # first see if there is already a glabal by that name + if not __pmods[__sel][1].__dict__.has_key(name): + print "Warning: creating new global!" + __pmods[__sel][1].__dict__[name] = value + print "%s = " % (name),__pmods[__sel][1].__dict__[name] +def getglobal(name): + "get a global variable with in the selected module" + global __pmods + global __sel + return __pmods[__sel][1].__dict__[name] +# find instance +def showinst(): + "show details of the instance of the ptModifier class in the selected module" + global __pmods + global __sel + for name in __pmods[__sel][1].__dict__.keys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptModifier): + print "Instance of %s in module %s:" % (ist.__class__.__name__,__pmods[__sel][1].__name__[:-13]) + print " Doc: ",ist.__doc__ + showvars(ist) + showmethods(ist) +def getinst(): + "gets the instance of the ptModifier class in the selected module" + global __pmods + global __sel + for name in __pmods[__sel][1].__dict__.keys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptModifier): + return ist +def showvars(instance): + "shows the variables of the instance" + print " Variables:" + if len(instance.__dict__) > 0: + for vname in instance.__dict__.keys(): + print " %s =" % (vname),instance.__dict__[vname] + else: + print " (none)" +def showmethods(instance): + "shows the methods of the instance" + print " Methods:" + for mname in instance.__class__.__dict__.keys(): + mist = instance.__class__.__dict__[mname] + # is it a function... see if it has code + if hasattr(mist,'func_code'): + # gather arguments + args = "(" + for i in range(mist.func_code.co_argcount): + args += mist.func_code.co_varnames[i] + if i+1 < mist.func_code.co_argcount: + args += "," + args += ")" + print " %s%s" % (mist.__name__,args) + print " Doc:", mist.__doc__ +def showfunc(f): + "decompiles function" + import decompyle + if hasattr(f,'func_code'): + # create the argument list + argstr = "(" + argcount = 0 + for arg in f.func_code.co_varnames[:f.func_code.co_argcount]: + argstr += arg + argcount += 1 + if argcount < f.func_code.co_argcount: + argstr += "," + argstr += ")" + print "%s%s" % (f.func_name,argstr) + print " Doc:",f.__doc__ + decompyle.decompyle(f.func_code) +def setvar(vname,value): + "set a variable within the instance of the ptModifier class in the selected module" + global __pmods + global __sel + for name in __pmods[__sel][1].__dict__.keys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptModifier): + # first see if there is already a glabal by that name + if not ist.__dict__.has_key(vname): + print "Warning: creating new class variable!" + ist.__dict__[vname] = value + print "%s = " % (vname),ist.__dict__[vname] +def getvar(vname): + "get the variable in the instance of the ptModifier class in the selected module" + global __pmods + global __sel + for name in __pmods[__sel][1].__dict__.keys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptModifier): + return ist.__dict__[vname] diff --git a/Python/plasma/ptWordFilter.py b/Python/plasma/ptWordFilter.py new file mode 100644 index 0000000000..4fa59cfca6 --- /dev/null +++ b/Python/plasma/ptWordFilter.py @@ -0,0 +1,140 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +This module is the word filter to be used... +""" +import string +import re + +# Rating levels +xRatedG = 0 +xRatedPG = 1 +xRatedPG13 = 2 +xRatedR = 3 +xRatedX = 4 + +class LanguageFilter: + def __init__(self): + pass + def test(self,sentence): + "returns censored sentence" + return xRatedG + def censor(self,sentence,censorLevel): + "returns censored sentence" + return sentence + +class ExactMatchListFilter(LanguageFilter): + def __init__(self,wordlist): + self.wordlist = wordlist + def test(self,sentence): + "return the rating of sentence in question" + rated = xRatedG # assume rated lowest level + startidx = 0 + for endidx in range(len(sentence)): + if sentence[endidx] in string.whitespace or sentence[endidx] in string.punctuation: + if startidx != endidx: + try: + # find and get rating and substitute + rating = self.wordlist[string.lower(sentence[startidx:endidx])] + except LookupError: + # couldn't find word + rating = None + if rating != None and rating.rating > rated: + # substitute into string + rated = rating.rating + startidx = endidx + 1 + if startidx < len(sentence): + try: + # find and get rating and substitute + rating = self.wordlist[string.lower(sentence[startidx:])] + except LookupError: + # couldn't find word + rating = None + if rating != None and rating.rating > rated: + # substitute into string + rated = rating.rating + return rated + + def censor(self,sentence,censorLevel): + "censors a sentence to a rating" + # break into words, but perserve original punctuation + censored = "" + startidx = 0 + for endidx in range(len(sentence)): + if sentence[endidx] in string.whitespace or sentence[endidx] in string.punctuation: + if startidx != endidx: + try: + # find and get rating and substitute + rating = self.wordlist[string.lower(sentence[startidx:endidx])] + except LookupError: + # couldn't find word + rating = None + if rating != None and rating.rating > censorLevel: + # substitute into string + censored += rating.substitute + sentence[endidx] + else: + censored += sentence[startidx:endidx] + sentence[endidx] + else: + censored += sentence[startidx] + startidx = endidx + 1 + if startidx < len(sentence): + # Special after loop processing! + try: + # find and get rating and substitute + rating = self.wordlist[string.lower(sentence[startidx:])] + except LookupError: + # couldn't find word + rating = None + if rating != None and rating.rating > censorLevel: + # substitute into string + censored += rating.substitute + else: + censored += sentence[startidx:] + return censored + +class REFilter(LanguageFilter): + def __init__(self,regexp,rating): + self.compiledRE = re.compile(regexp, re.IGNORECASE | re.MULTILINE ) + if not isinstance(rating,Rating): + PtDebugPrint("ptWordFilter: rating for %s not of type Rating" % (regexp)) + self.rating = rating + def test(self,sentence): + "return the rating of sentence in question" + if self.compiledRE.search(sentence) != None: + return self.rating.rating + return xRatedG + def censor(self,sentence,censorLevel): + "censors a sentence to a rating" + if self.rating.rating > censorLevel: + if self.compiledRE.search(sentence) != None: + return self.compiledRE.sub(self.rating.substitute,sentence) + return sentence + +class Rating: + "substitute can be string for exact substitute or number of splat replacement" + def __init__(self,rating,subtitute="*****"): + self.rating = rating + self.substitute = subtitute diff --git a/Python/psnlBahroPoles.py b/Python/psnlBahroPoles.py new file mode 100644 index 0000000000..fa858a0821 --- /dev/null +++ b/Python/psnlBahroPoles.py @@ -0,0 +1,1258 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: psnlBahroPoles +Age: Personal Age +Date: May 2003 +Author: Adam Van Ornum +Controls the state of the bahro poles +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaVaultConstants import * +import xEnum +import xRandom +import copy +from xPsnlVaultSDL import * +import string + + +# Max attributes +clickTeledahnPole = ptAttribActivator(1, "Teledahn clickable") +clickGarrisonPole = ptAttribActivator(2, "Garrison clickable") +clickGardenPole = ptAttribActivator(3, "Garden clickable") +clickKadishPole = ptAttribActivator(4, "Kadish clickable") + +respTeledahnPole = ptAttribResponder(5, "Teledahn responder", ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]) +respGarrisonPole = ptAttribResponder(6, "Garrison responder", ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]) +respGardenPole = ptAttribResponder(7, "Garden responder", ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]) +respKadishPole = ptAttribResponder(8, "Kadish responder", ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]) + +respTeledahnHandGlow = ptAttribResponder(9, "Teledahn hand glow", ["1", "2", "3", "4", "5", "6", "7", "DropSheath", "ResetSheath"],netForce=1) +respGarrisonHandGlow = ptAttribResponder(10, "Garrison hand glow", ["1", "2", "3", "4", "5", "6", "7", "DropSheath", "ResetSheath"],netForce=1) +respGardenHandGlow = ptAttribResponder(11, "Garden hand glow", ["1", "2", "3", "4", "5", "6", "7", "DropSheath", "ResetSheath"],netForce=1) +respKadishHandGlow = ptAttribResponder(12, "Kadish hand glow", ["1", "2", "3", "4", "5", "6", "7", "DropSheath", "ResetSheath"],netForce=1) + +strTeledahnEnabled = ptAttribString(17, "Tldn enabled SDL var") +strGarrisonEnabled = ptAttribString(18, "Grsn enabled SDL var") +strGardenEnabled = ptAttribString(19, "Grdn enabled SDL var") +strKadishEnabled = ptAttribString(20, "Kdsh enabled SDL var") + +clickTeledahnBook = ptAttribActivator(21, "Teledahn book clickable") +clickGarrisonBook = ptAttribActivator(22, "Garrison book clickable") +clickGardenBook = ptAttribActivator(23, "Garden book clickable") +clickKadishBook = ptAttribActivator(24, "Kadish book clickable") + +respTeledahnOneShot = ptAttribResponder(25, "Teledahn one shot",netForce=1) +respGarrisonOneShot = ptAttribResponder(26, "Garrison one shot",netForce=1) +respGardenOneShot = ptAttribResponder(27, "Garden one shot",netForce=1) +respKadishOneShot = ptAttribResponder(28, "Kadish one shot",netForce=1) + +respFissureStage1 = ptAttribResponder(29, "Fissure stage 1") +respFissureStage2 = ptAttribResponder(30, "Fissure stage 2") +respFissureStage3 = ptAttribResponder(31, "Fissure stage 3") +respFissureStage4 = ptAttribResponder(32, "Fissure stage 4") + +respFissureLinkOut = ptAttribResponder(34, "Fissure link out resp", ["cleft", "personal"]) +rgnFissureLink = ptAttribActivator(35, "Fissure link region") + +respTeledahnLinkOut = ptAttribResponder(36, "Teledahn link out",netForce=1) +respGarrisonLinkOut = ptAttribResponder(37, "Garrison link out",netForce=1) +respGardenLinkOut = ptAttribResponder(38, "Garden link out",netForce=1) +respKadishLinkOut = ptAttribResponder(39, "Kadish link out",netForce=1) + +actBookshelf = ptAttribActivator(40, "Bookshelf script") + +soTeledahnSmoker = ptAttribSceneobject(41, "Teledahn smoker") +soGarrisonSmoker = ptAttribSceneobject(42, "Garrison smoker") +soGardenSmoker = ptAttribSceneobject(43, "Garden smoker") +soKadishSmoker = ptAttribSceneobject(44, "Kadish smoker") + +rgnFissureForceCamera = ptAttribActivator(45, "Fissure force cam rgn") + +respBahroScream = ptAttribResponder(46, "Bahro Screams", ["start", "stop"]) + +rgnFissureCam = ptAttribActivator(47, "Fissure cam region") + +actCleftTotem = ptAttribActivator(48, "clk: Cleft totem") +respTouchCleftTotem = ptAttribResponder(49, "resp: touch Cleft totem",netForce=1) +respChangeCleftTotem = ptAttribResponder(50, "resp: change Cleft totem", ["open", "close"]) +sdlCleftTotem = ptAttribString(51, "sdl: Cleft totem") +respCleftHandGlow = ptAttribResponder(52, "resp: Cleft hand glow", ["1", "2", "3", "4", "5", "6", "7"],netForce=1) +clickCleftBook = ptAttribActivator(53, "Cleft book clickable") +respCleftLinkOut = ptAttribResponder(54, "Cleft link out",netForce=1) + +#globals +boolCleftTotem = 0 +kTimerCleftTotemClk = 42 +#GotCleftBook = 0 +boolCleftSolved = 0 +kWriteTimestamps = 8 +BahroPoles = xEnum.Enum("Teledahn = 1, Garrison, Garden, Kadish") +HidingPoles = 0 +IsVisitorPlayer = true #whether or not the player is a visitor + +# Bahro pole SDL variable states +# 0: Initial state, no pole, hydrant up, sheath up, clicking hand changes to state 1 +# Anim sheath down +# 1: No pole, hydrant up, sheath down, clicking hand causes full glow +# 2: After book has been used, No pole, hydrant up, sheath up, clicking hand causes progress glow +# 3: Animate the hydrant down and proceed to state 4 +# 4: All cloths have been found and pole was sent to psnl age, pole is there, hydrant down, clicking hand does nothing +# 5: Anim all hydrants up and proceed to state 6 +# 6: All poles in psnl age, pole is there, hydrant up, clicking hand plays full glow +# 7: Anim fissure stuff +# 8: Pole returned, no pole, hydrant up, clicking hand plays full glow +# 9: Selfish person unreturned pole, no pole, hydrant up, clicking hand plays full glow + + +class psnlBahroPoles(ptModifier): + "Bahro pole state control script" + def __init__(self): + ptModifier.__init__(self) + self.id = 5313 + self.version = 16 + PtDebugPrint("__init__psnlBahroPoles v. %d" % (self.version)) + #self.Stage5TimerSet = 0 + self.State5Running = 0 + self.FissureInited = 0 + self.DroppingSheath = 0 + self.PoleCurrentState = {'Teledahn': "", 'Garrison': "", 'Garden': "", 'Kadish': ""} + self.PoleFinalState = {'Teledahn': "", 'Garrison': "", 'Garden': "", 'Kadish': ""} + self.VolatileBookList = [] + + def OnFirstUpdate(self): + PtDebugPrint("DEBUG: psnlBahroPoles.OnFirstUpdate():\tEverything ok so far") + self.Poles = { + 'Teledahn': {'PoleResponder': respTeledahnPole, 'HandGlow': respTeledahnHandGlow, 'OneShot': respTeledahnOneShot, 'HandClick': clickTeledahnPole, 'LinkOut': respTeledahnLinkOut, 'Smoker': soTeledahnSmoker, 'Enabled': 1, 'State': 0}, + 'Garrison': {'PoleResponder': respGarrisonPole, 'HandGlow': respGarrisonHandGlow, 'OneShot': respGarrisonOneShot, 'HandClick': clickGarrisonPole, 'LinkOut': respGarrisonLinkOut, 'Smoker': soGarrisonSmoker, 'Enabled': 1, 'State': 0}, + 'Garden' : {'PoleResponder': respGardenPole, 'HandGlow': respGardenHandGlow, 'OneShot': respGardenOneShot, 'HandClick': clickGardenPole, 'LinkOut': respGardenLinkOut, 'Smoker': soGardenSmoker, 'Enabled': 1, 'State': 0}, + 'Kadish' : {'PoleResponder': respKadishPole, 'HandGlow': respKadishHandGlow, 'OneShot': respKadishOneShot, 'HandClick': clickKadishPole, 'LinkOut': respKadishLinkOut, 'Smoker': soKadishSmoker, 'Enabled': 1, 'State': 0} + } + self.PoleIDMap = { + BahroPoles.Teledahn: "Teledahn", + BahroPoles.Garrison: "Garrison", + BahroPoles.Garden: "Garden", + BahroPoles.Kadish: "Kadish", + "Teledahn": BahroPoles.Teledahn, + "Garrison": BahroPoles.Garrison, + "Garden": BahroPoles.Garden, + "Kadish": BahroPoles.Kadish + } + + self.initComplete = 0 + self.sdlBroken = 0 + + rgnFissureLink.disable() + + #rgnFissureCam.disable() + + + def OnServerInitComplete(self): + global boolCleftTotem + #global GotCleftBook + global boolCleftSolved + global HidingPoles + global IsVisitorPlayer + + #Init visitor support + IsVisitorPlayer = not PtIsSubscriptionActive() + + PtDebugPrint("DEBUG: psnlBahroPoles.OnServerInitComplete():\tEverything ok so far") + + ageVault = ptAgeVault() + if type(ageVault) != type(None): #is the Vault online? + ageSDL = ageVault.getAgeSDL() + if ageSDL: + try: + SDLVar = ageSDL.findVar("YeeshaPage25") + CurrentValue = SDLVar.getInt() + except: + PtDebugPrint("psnlBahroPoles.RunState():\tERROR reading age SDLVar for YeeshaPage25. Assuming CurrentValue = 0") + CurrentValue = 0 + if CurrentValue in [0, 2, 4]: + PtDebugPrint("psnlBahroPoles.RunState():\tPoles are active but YeeshaPage25 is off, so we're gonna hide 'em") + HidingPoles = 1 + + ageSDL = PtGetAgeSDL() + + if sdlCleftTotem.value != "": + ageSDL.setFlags(sdlCleftTotem.value,1,1) + ageSDL.sendToClients(sdlCleftTotem.value) + ageSDL.setNotify(self.key,sdlCleftTotem.value,0.0) + + try: + boolCleftTotem = ageSDL[sdlCleftTotem.value][0] + except: + PtDebugPrint("ERROR: psnlBahroPoles.OnServerInitComplete():\tERROR reading SDL name for Cleft totem") + boolCleftTotem = 0 + + ageSDL.setFlags("psnlCleftSolved",1,1) + ageSDL.sendToClients("psnlCleftSolved") + ageSDL.setNotify(self.key,"psnlCleftSolved",0.0) + + try: + boolCleftSolved = ageSDL["psnlCleftSolved"][0] + print "psnlBahroPoles.OnServerInitComplete(): boolCleftSolved = ",boolCleftSolved + except: + print "ERROR: psnlBahroPoles.OnServerInitComplete():\tNo SDL for boolCleftSolved, using 0" + + if not boolCleftSolved: + vault = ptVault() + if ptVault().amOwnerOfCurrentAge(): + entry = vault.findChronicleEntry("CleftSolved") + if type(entry) != type(None): + if entry.chronicleGetValue() == "yes": + boolCleftSolved = 1 + ageSDL["psnlCleftSolved"] = (1,) + + if boolCleftTotem: + if boolCleftSolved: + ageSDL[sdlCleftTotem.value] = (0,) + print "psnlBahroPoles.OnServerInitComplete(): Cleft totem was open but Cleft is solved, setting SDL to closed" + else: + print "psnlBahroPoles.OnServerInitComplete(): Cleft not solved yet, will open the Cleft totem" + respChangeCleftTotem.run(self.key,state="open",fastforward=1) + else: + respChangeCleftTotem.run(self.key,state="close",fastforward=1) + + if strTeledahnEnabled.value != "": + ageSDL.setNotify(self.key, strTeledahnEnabled.value, 0.0) + if strGarrisonEnabled.value != "": + ageSDL.setNotify(self.key, strGarrisonEnabled.value, 0.0) + if strGardenEnabled.value != "": + ageSDL.setNotify(self.key, strGardenEnabled.value, 0.0) + if strKadishEnabled.value != "": + ageSDL.setNotify(self.key, strKadishEnabled.value, 0.0) + + for age in ["Teledahn", "Garrison", "Garden", "Kadish"]: + self.Poles[age]['Smoker'].value.particle.setParticlesPerSecond(0) + + sdlVar = age + "PoleState" + ageSDL.setFlags(sdlVar,1,1) + ageSDL.sendToClients(sdlVar) + ageSDL.setNotify(self.key, sdlVar, 0.0) + + # in case we've come here because of linking through the fissure + cam = ptCamera() + #cam.undoFirstPerson() + cam.enableFirstPersonOverride() + + avatar = PtGetLocalAvatar() + avatar.physics.suppress(false) + + + self.UpdatePoleStates() + self.ValidityCheck() + + # check if a cleft yeesha imager solution has already been created, otherwise create it + if not self.CheckBahroCaveSolution(): + PtDebugPrint("no BahroCave solution found, attempting to create") + self.CreateBahroCaveSolution() + else: + print "found BahroCave solution: ",self.GetBahroCaveSolution() + + interestingVarList = [("TeledahnPoleState", BahroPoles.Teledahn), ("KadishPoleState", BahroPoles.Kadish), ("GardenPoleState", BahroPoles.Garden), ("GarrisonPoleState", BahroPoles.Garrison)] + #ageSDL = PtGetAgeSDL() + ageSDL = xPsnlVaultSDL(1) + + self.screamStarted = 0 + state9 = 0 + + for VARname in interestingVarList: + try: + sdlVal = ageSDL[VARname[0]][0] + except: + PtDebugPrint("ERROR: psnlBahroPoles.OnServerInitComplete:\tproblem getting sdl, assuming state 0") + self.sdlBroken = 1 + sdlVal = 0 + + ageName = VARname[0][0:VARname[0].find("PoleState")] + + if sdlVal in [3, 5, 7, 8]: + if sdlVal == 5: + self.RunState(ageName, 4, 1) + + elif sdlVal == 7 or sdlVal == 8: + self.RunState(ageName, sdlVal, 1) + if not self.FissureInited: + self.ShowFissure(1) + self.FissureInited = 1 + if sdlVal == 7: + PtAtTimeCallback(self.key, 2, (VARname[1]*10) + sdlVal) + self.SetCurrentState(ageName, 8) + else: + PtAtTimeCallback(self.key, 3, (VARname[1]*10) + sdlVal) + self.SetCurrentState(ageName, 4) + else: + self.RunState(ageName, sdlVal, 1) + + # start smoke if in appropriate state + if sdlVal in [3,4,5,6,9]: + PtDebugPrint("DEBUG:psnlBahroPoles.OnServerInitComplete:\tStarting smoke, pole = %s" % ageName) + #self.Poles[ageName]['Smoker'].value.particle.setParticlesPerSecond(6) + PtAtTimeCallback(self.key, 0.1, self.PoleIDMap[ageName] * -1) + + if sdlVal == 9: + state9 += 1 + if state9 == 4: + print "scream started on init" + respBahroScream.run(self.key, state = "start") + self.screamStarted = 1 + + self.FissureInited = 0 + ageSDL = PtGetAgeSDL() + + if strTeledahnEnabled.value != "": + if ageSDL[strTeledahnEnabled.value][0] == 1: + self.Poles["Teledahn"]["Enabled"] = 1 + else: + self.Poles["Teledahn"]["Enabled"] = 0 + + if strGarrisonEnabled.value != "": + if ageSDL[strGarrisonEnabled.value][0] == 1: + self.Poles["Garrison"]["Enabled"] = 1 + else: + self.Poles["Garrison"]["Enabled"] = 0 + + if strGardenEnabled.value != "": + if ageSDL[strGardenEnabled.value][0] == 1: + self.Poles["Garden"]["Enabled"] = 1 + else: + self.Poles["Garden"]["Enabled"] = 0 + + if strKadishEnabled.value != "": + if ageSDL[strKadishEnabled.value][0] == 1: + self.Poles["Kadish"]["Enabled"] = 1 + else: + self.Poles["Kadish"]["Enabled"] = 0 + + for age in ("Teledahn", "Garrison", "Gira", "Kadish"): + isvolatile = self.IsVolatile(age) + if isvolatile or self.BookLost(age): + if isvolatile: + self.VolatileBookList.append(age) + self.OpenSheath(age) + + self.initComplete = 1 + self.UpdatePoleStates() + + # register pellet cave + vault = ptVault() + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("PelletBahroCave") + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if not ageLinkNode: + info = ptAgeInfoStruct() + info.setAgeFilename("PelletBahroCave") + info.setAgeInstanceName("Pellet Cave") + + playerName = PtGetClientName() + ageGuid = PtGuidGenerate() + userDefName = "" + desc = "" + + if playerName[-1] == "s" or playerName[-1] == "S": + userDefName = "%s'" % playerName + desc = "%s' %s" % (playerName, info.getAgeInstanceName()) + else: + userDefName = "%s's" % playerName + desc = "%s's %s" % (playerName, info.getAgeInstanceName()) + + info.setAgeInstanceGuid(ageGuid) + info.setAgeUserDefinedName(userDefName) + info.setAgeDescription(desc) + + link = ptAgeLinkStruct() + link.setAgeInfo(info) + + ptVault().registerOwnedAge(link) + print "Registered pellet bahro cave" + + self.CheckPelletCaveSolution() + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global boolCleftTotem + #global boolCleftSolved + + PtDebugPrint("DEBUG: psnlBahroPoles.OnSDLNotify():\tEverything ok so far") + + if not self.initComplete: + return + + if VARname == sdlCleftTotem.value: + ageSDL = PtGetAgeSDL() + boolCleftTotem = ageSDL[sdlCleftTotem.value][0] + if boolCleftTotem: + print "psnlBahroPoles.OnSDLNotify(): now opening Cleft totem..." + respChangeCleftTotem.run(self.key,state="open") + #PtAtTimeCallback(self.key,10.7,kTimerCleftTotemClk) + else: + print "psnlBahroPoles.OnSDLNotify(): now closing Cleft totem..." + if HidingPoles: + respChangeCleftTotem.run(self.key,state="close") + else: + respChangeCleftTotem.run(self.key,state="close",fastforward=1) + return + + # we only really care about SDL notifies if they are one of the few that are triggered from previous states + interestingVarList = ["TeledahnPoleState", "KadishPoleState", "GardenPoleState", "GarrisonPoleState"] + + age = VARname[0:VARname.find("PoleState")] + + if VARname in interestingVarList: + ageSDL = PtGetAgeSDL() #xPsnlVaultSDL(1) + sdlVal = ageSDL[VARname][0] + if sdlVal == 1 and self.initComplete: + self.RunState(age, sdlVal, 0) + elif sdlVal != 4 and sdlVal != 5 and sdlVal > 1: + if sdlVal != 7 and sdlVal != 8 and sdlVal > 2: + if not HidingPoles: + self.Poles[age]['Smoker'].value.particle.setParticlesPerSecond(6) + else: + self.Poles[age]['Smoker'].value.particle.setParticlesPerSecond(0) + if sdlVal == 3: + self.RunState(age, 9, 0) + elif sdlVal == 2: + if self.Poles[age]['State'] == 1: + self.ResetSheath(age) + self.RunState(age, sdlVal, 0) + else: + self.RunState(age, sdlVal, 0) + + self.UpdatePoleStates() + + if self.initComplete: + if sdlVal == 8: + if self.screamStarted: + respBahroScream.run(self.key, state = "stop") + self.screamStarted = 0 + elif sdlVal == 9 and not self.screamStarted: + if self.Poles["Teledahn"]["State"] == 9 and self.Poles["Garrison"]["State"] == 9 and self.Poles["Garden"]["State"] == 9 and self.Poles["Kadish"]["State"] == 9: + print "Starting bahro scream responder" + respBahroScream.run(self.key, state = "start") + self.screamStarted = 1 + + elif VARname == strTeledahnEnabled.value: + ageSDL = PtGetAgeSDL() + if ageSDL[VARname][0] == 1: + self.Poles["Teledahn"]["Enabled"] = 1 + else: + self.Poles["Teledahn"]["Enabled"] = 0 + + elif VARname == strGarrisonEnabled.value: + ageSDL = PtGetAgeSDL() + if ageSDL[VARname][0] == 1: + self.Poles["Garrison"]["Enabled"] = 1 + else: + self.Poles["Garrison"]["Enabled"] = 0 + + elif VARname == strGardenEnabled.value: + ageSDL = PtGetAgeSDL() + if ageSDL[VARname][0] == 1: + self.Poles["Garden"]["Enabled"] = 1 + else: + self.Poles["Garden"]["Enabled"] = 0 + + elif VARname == strKadishEnabled.value: + ageSDL = PtGetAgeSDL() + if ageSDL[VARname][0] == 1: + self.Poles["Kadish"]["Enabled"] = 1 + else: + self.Poles["Kadish"]["Enabled"] = 0 + + + def OnNotify(self,state,id,events): + PtDebugPrint("DEBUG: psnlBahroPoles.OnNotify():\tid = %d" % id) + + if not state: + return + + if id == actCleftTotem.id: + if ptVault().amOwnerOfCurrentAge(): + respTouchCleftTotem.run(self.key,events=events) + else: + PtDebugPrint("DEBUG: psnlBahroPoles.OnNotify():\tI'm not the owner of this age...don't respond to Cleft totem click") + + elif id == respTouchCleftTotem.id: + if not ptVault().amOwnerOfCurrentAge(): + return + if not boolCleftSolved: + if boolCleftTotem: + progress = self.GetJCProgress("Cleft") + if progress > 0 and progress < 8: + respCleftHandGlow.run(self.key, state=str(progress) ) + print "psnlBahroPoles.OnNotify(): touch responder done, have %s JCs and will play correct hand glow" % (str(progress)) + PtAtTimeCallback(self.key,10.7,kTimerCleftTotemClk) + elif progress == 0: + print "psnlBahroPoles.OnNotify(): touch responder done, but have no JCs so no glow" + PtAtTimeCallback(self.key,1,kTimerCleftTotemClk) + else: + print "psnlBahroPoles.OnNotify(): touch responder done, will now open Cleft totem" + respCleftHandGlow.run(self.key, state="7") + PtAtTimeCallback(self.key,10.7,kTimerCleftTotemClk) + ageSDL = PtGetAgeSDL() + ageSDL[sdlCleftTotem.value] = (1,) + else: + respCleftHandGlow.run(self.key, state="7") + PtAtTimeCallback(self.key,10.7,kTimerCleftTotemClk) + print "psnlBahroPoles.OnNotify(): touch responder done, and Cleft is done, so play entire hand glow" + + + elif id == clickTeledahnPole.id: + self.ClickHandle("Teledahn", events) + + elif id == clickGarrisonPole.id: + self.ClickHandle("Garrison", events) + + elif id == clickGardenPole.id: + self.ClickHandle("Garden", events) + + elif id == clickKadishPole.id: + self.ClickHandle("Kadish", events) + + elif id == clickTeledahnBook.id: + for event in events: + if event[0] == kVariableEvent: + if event[1] == "LinkOut": + self.BookClickHandle("Teledahn") + break + + elif id == clickGarrisonBook.id: + for event in events: + if event[0] == kVariableEvent: + if event[1] == "LinkOut": + self.BookClickHandle("Garrison") + break + + elif id == clickGardenBook.id: + for event in events: + if event[0] == kVariableEvent: + if event[1] == "LinkOut": + self.BookClickHandle("Garden") + break + + elif id == clickKadishBook.id: + for event in events: + if event[0] == kVariableEvent: + if event[1] == "LinkOut": + self.BookClickHandle("Kadish") + break + + elif id == clickCleftBook.id: + for event in events: + if event[0] == kVariableEvent: + if event[1] == "LinkOut" and PtWasLocallyNotified(self.key): + respCleftLinkOut.run(self.key, avatar=PtGetLocalAvatar()) + break + + elif id == respTeledahnOneShot.id: + if PtWasLocallyNotified(self.key): + self.PostOneShot("Teledahn") + + elif id == respGarrisonOneShot.id: + if PtWasLocallyNotified(self.key): + self.PostOneShot("Garrison") + + elif id == respGardenOneShot.id: + if PtWasLocallyNotified(self.key): + self.PostOneShot("Garden") + + elif id == respKadishOneShot.id: + if PtWasLocallyNotified(self.key): + self.PostOneShot("Kadish") + + elif id == respTeledahnPole.id: + self.PoleHandle("Teledahn") + + elif id == respGarrisonPole.id: + self.PoleHandle("Garrison") + + elif id == respGardenPole.id: + self.PoleHandle("Garden") + + elif id == respKadishPole.id: + self.PoleHandle("Kadish") + + elif id == respTeledahnHandGlow.id: + self.PostHandGlowResp("Teledahn") + + elif id == respGarrisonHandGlow.id: + self.PostHandGlowResp("Garrison") + + elif id == respGardenHandGlow.id: + self.PostHandGlowResp("Garden") + + elif id == respKadishHandGlow.id: + self.PostHandGlowResp("Kadish") + + elif id == respFissureStage4.id: + PtEnableMovementKeys() + + elif id == rgnFissureLink.id: + self.FissureLinkRegionHandle( PtFindAvatar(events) ) + + elif id == rgnFissureForceCamera.id: + self.FissureForceCamRgnHandle() + + elif id == actBookshelf.id: + for event in events: + if event[0] == kVariableEvent: + PtDebugPrint("DEBUG: psnlBahroPoles.OnNotify: received variable event from bookshelf - " + event[1]) + if HidingPoles: + ff = 1 + else: + ff = 0 + if event[1][:8] == "Volatile" and event[1][8:] in ("Teledahn", "Garrison", "Gira", "Kadish"): + self.VolatileBookList.append(event[1][8:]) + self.OpenSheath(event[1][8:], ff) + elif event[1][:11] == "NotVolatile" and event[1][11:] in ("Teledahn", "Garrison", "Gira", "Kadish"): + self.VolatileBookList.remove(event[1][11:]) + self.ResetSheath(event[1][11:], ff) + + + def OnAgeVaultEvent(self,event,tupdata): + if event == PtVaultCallbackTypes.kVaultNodeRefAdded: + agelink = tupdata[0].getChild().upcastToAgeLinkNode() + if agelink: + agename = agelink.getAgeInfo().getAgeFilename() + + if agename in self.VolatileBookList: + self.VolatileBookList.remove(agename) + self.ResetSheath(agename) + + + def OnTimer(self, id): + if id == kTimerCleftTotemClk: + actCleftTotem.enableActivator() + return + + if id < 0: + id *= -1 + if not HidingPoles: + self.Poles[self.PoleIDMap[id]]["Smoker"].value.particle.setParticlesPerSecond(6) + elif id >= 0 and id < 10: + self.Poles[self.PoleIDMap[id]]["HandClick"].enable() + else: + ageID, state = divmod(id, 10) + + if state == 7: + self.ShowFissure(0) + else: + self.RunState(self.PoleIDMap[ageID], state, 0) + + + def UpdatePoleStates(self): + print "psnlBahroPoles.UpdatePoleStates()" + try: + #ageSDL = PtGetAgeSDL() + ageSDL = xPsnlVaultSDL(1) + + if type(ageSDL) != type(None): + sdllist = ageSDL.BatchGet( ["TeledahnPoleState", "GardenPoleState", "GarrisonPoleState", "KadishPoleState"] ) + self.Poles["Teledahn"]["State"] = sdllist["TeledahnPoleState"] + self.Poles["Garden"]["State"] = sdllist["GardenPoleState"] + self.Poles["Garrison"]["State"] = sdllist["GarrisonPoleState"] + self.Poles["Kadish"]["State"] = sdllist["KadishPoleState"] + else: + PtDebugPrint("ERROR: psnlBahroPoles.UpdatePoleStates():\tProblem trying to access age SDL") + pass + + except: + PtDebugPrint("ERROR: psnlBahroPoles.UpdatePoleStates():\tException occurred trying to access age SDL") + + + def RunState(self, age, state, fforward): + PtDebugPrint("DEBUG: psnlBahroPoles.RunState():\tRunning state %d on age %s; ff = %d" % (state, age, fforward)) + + if HidingPoles: + self.Poles[age]["PoleResponder"].run(self.key, state="0", fastforward=fforward) + else: + self.Poles[age]["PoleResponder"].run(self.key, state=str(state), fastforward=fforward) + + + def SetCurrentState(self, age, state): + print "psnlBahroPoles.SetCurrentState()" + #ageSDL = PtGetAgeSDL() + ageSDL = xPsnlVaultSDL(1) + + ageSDL[age + "PoleState"] = (state, ) + + + def GetJCProgress(self, age): + if age == "Garden": + age = "Eder" + + vault = ptVault() + + if type(vault) != type(None): + chron = vault.findChronicleEntry("JourneyClothProgress") + + if type(chron) != type(None): + ageChronRefList = chron.getChildNodeRefList() + + for ageChron in ageChronRefList: + ageChild = ageChron.getChild() + + ageChild = ageChild.upcastToChronicleNode() + + if ageChild.chronicleGetName() == age: + return len(ageChild.chronicleGetValue() ) + + return 0 + + + def PoleHandle(self, age): + print "psnlBahroPoles.PoleHandle()" + if age == "Gira": + age = "Garden" + + if self.PoleCurrentState[age] == "Open": + self.Poles[age]["HandGlow"].run(self.key, state="DropSheath", fastforward = 0) + return + elif self.PoleCurrentState[age] == "Reset": + self.PoleCurrentState[age] = "" + if self.PoleFinalState[age] == "Reset": + self.PoleFinalState[age] = "" + elif self.PoleFinalState[age] == "Open": + self.PoleFinalState[age] == "" + self.OpenSheath(age, 0) + return + + self.UpdatePoleStates() + + if self.Poles[age]["State"] == 4: + freq = self.GetStateFrequencyList() + if freq[5] > 0 or freq[4] == 4: + #self.SetCurrentState(age, 5) + + if not self.State5Running: + self.State5Running = 1 + self.RunState("Teledahn", 5, 0) + self.RunState("Garrison", 5, 0) + self.RunState("Garden", 5, 0) + self.RunState("Kadish", 5, 0) + + sdl = xPsnlVaultSDL(1) + sdl.BatchSet( [("TeledahnPoleState", (6,)), ("KadishPoleState", (6,)), ("GarrisonPoleState", (6,)), ("GardenPoleState", (6,))]) + + elif self.Poles[age]["State"] == 5: + self.State5Running = 0 + #self.SetCurrentState(age, 6) + + + def ClickHandle(self, age, events): + print "psnlBahroPoles.ClickHandle()" + vault = ptAgeVault() + + avatar = PtFindAvatar(events) + playerid = PtGetClientIDFromAvatarKey(avatar.getKey()) + localClient = PtGetLocalClientID() + + if playerid == localClient: +# if ptVault().amOwnerOfCurrentAge() and (PtFindAvatar(events) == PtGetLocalAvatar()): + if PtFindAvatar(events) == PtGetLocalAvatar(): + self.Poles[age]["OneShot"].run(self.key, events = events) + else: + PtDebugPrint("DEBUG: psnlBahroPoles.OnNotify():\tI'm not the owner of this age...don't respond to button clicks") + + + def BookClickHandle(self, age): + print "psnlBahroPoles.BookClickHandle()" + # this has been changed so that the state gets updated either when linking back into the personal age + # or when linking into the bahro cave + if PtWasLocallyNotified(self.key): + self.UpdatePoleStates() + +## if self.Poles[age]["State"] == 1: +## self.SetCurrentState(age, 2) + + self.Poles[age]["LinkOut"].run(self.key, avatar=PtGetLocalAvatar()) + + + def PostOneShot(self, age): + print "psnlBahroPoles.PostOneShot()" + vault = ptVault() + IamOwner = vault.amOwnerOfCurrentAge() + + PtDebugPrint("Oneshot finished on age %s" % age) + + if IsVisitorPlayer or not IamOwner: + return + + self.UpdatePoleStates() + + if self.Poles[age]["State"] == 0 and self.Poles[age]["Enabled"] and IamOwner: + PtDebugPrint("Setting current state to 1") + if self.sdlBroken: + self.RunState(age, 0, 0) + else: + self.SetCurrentState(age, 1) + + if self.Poles[age]["State"] == 2: + progress = self.GetJCProgress(age) + if progress > 0 and progress < 8: + self.Poles[age]["HandClick"].disable() + self.Poles[age]["HandGlow"].run(self.key, state=str(progress) ) + PtAtTimeCallback(self.key, 11, self.PoleIDMap[age]) + else: + self.Poles[age]["HandClick"].disable() + self.Poles[age]["HandGlow"].run(self.key, state="7") + PtAtTimeCallback(self.key, 11, self.PoleIDMap[age]) + + + def ShowFissure(self, init = 0): + PtDebugPrint("DEBUG: psnlBahroPoles.ShowFissure():\tinit = %d" % init) + + if self.IsJCProgressComplete(): + PtDebugPrint("DEBUG: psnlBahroPoles.ShowFissure():\tJC progress has already been completed, no fissure") + return + + self.UpdatePoleStates() + + state8 = 0 + state7 = 0 + + for var in self.Poles.keys(): + val = self.Poles[var]["State"] + print val + + if val == 7: + state7 = state7 + 1 + + elif val == 8: + state8 = state8 + 1 + + PtDebugPrint("DEBUG: psnlBahroPoles.ShowFissure():\tstate7 = %d, state8 = %d" % (state7, state8)) + + if init: + if state8 == 1: + respFissureStage1.run(self.key, fastforward=1) + elif state8 == 2: + respFissureStage2.run(self.key, fastforward=1) + elif state8 == 3: + respFissureStage3.run(self.key, fastforward=1) + if state7 == 1: + PtDisableMovementKeys() + elif state8 == 4: + rgnFissureLink.enable() + respFissureStage4.run(self.key, fastforward=1) + + else: + polesRet = state7 + state8 + + if polesRet == 1: + respFissureStage1.run(self.key, fastforward=0) + elif polesRet == 2: + respFissureStage2.run(self.key, fastforward=0) + elif polesRet == 3: + respFissureStage3.run(self.key, fastforward=0) + elif polesRet == 4: + rgnFissureLink.enable() + respFissureStage4.run(self.key, fastforward=0) + + + def IsJCProgressComplete(self): + sdl = xPsnlVaultSDL(1) + val = sdl["CleftVisited"][0] + + if val: + return 1 + else: + return 0 + + + def SetJCProgressComplete(self): + vault = ptVault() + + if type(vault) != type(None): + chron = vault.findChronicleEntry("JourneyClothProgress") + + if type(chron) != type(None): + chron.chronicleSetValue("Z") + chron.save() + + #sdl = xPsnlVaultSDL(1) + #sdl["CleftVisited"] = (1,) + + + def FissureLinkRegionHandle(self, avatar): + + if PtWasLocallyNotified(self.key): + avatar.physics.suppress(true) + + vault = ptVault() + + if vault.amOwnerOfCurrentAge(): + PtDebugPrint("DEBUG: psnlBahroPoles.FissureLinkRegionHandle():\tAm owner of age, linking to cleft") + self.SetJCProgressComplete() + respFissureLinkOut.run(self.key, state="cleft") + else: + PtDebugPrint("DEBUG: psnlBahroPoles.FissureLinkRegionHandle():\tAm not owner of age, linking to personal") + respFissureLinkOut.run(self.key, state="personal") + + + def FissureForceCamRgnHandle(self): + if PtWasLocallyNotified(self.key): + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + + def IsVolatile(self, age): + ageVault = ptAgeVault() + PAL = ageVault.getAgesIOwnFolder() + contents = PAL.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if info and info.getAgeFilename() == age: + if link.getVolatile(): + return 1 + else: + return 0 + + + def BookLost(self, age): + self.UpdatePoleStates() + if age == "Gira": + currentState = self.Poles["Garden"]["State"] + else: + currentState = self.Poles[age]["State"] + + if currentState < 2: + PtDebugPrint("book hasn't been found yet for age %s" % age) + return 0 + + ageVault = ptAgeVault() + PAL = ageVault.getAgesIOwnFolder() + contents = PAL.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + + if info.getAgeFilename() == age: + spawnPoints = link.getSpawnPoints() + for spawnPoint in spawnPoints: + if spawnPoint.getName().lower() == "linkinpointdefault": + PtDebugPrint("book is there for age %s" % age) + return 0 + PtDebugPrint("oops, book somehow is gone but state is 2 or larger for age %s" % age) + return 1 + + + def ResetSheath(self, age, fforward = 1): + print "psnlBahroPoles.ResetSheath()" + if age == "Gira": + age = "Garden" + + if self.PoleCurrentState[age] == "": + self.PoleCurrentState[age] = "Reset" + self.Poles[age]["HandGlow"].run(self.key, state="ResetSheath", fastforward = fforward) + else: + self.PoleFinalState[age] = "Reset" + + + def PostHandGlowResp(self, age): + print "psnlBahroPoles.PostHandGlowResp()" + if age == "Gira": + age = "Garden" + + if self.PoleCurrentState[age] == "Open": + self.PoleCurrentState[age] = "" + if self.PoleFinalState[age] == "Open": + self.PoleFinalState[age] = "" + elif self.PoleFinalState[age] == "Reset": + self.PoleFinalState[age] = "" + self.ResetSheath(age) + return + + self.UpdatePoleStates() + + curState = str(self.Poles[age]["State"]) + self.Poles[age]["PoleResponder"].run(self.key, state=curState, fastforward=0) + + + def OpenSheath(self, age, fforward = 1): + print "psnlBahroPoles.OpenSheath()" + if age == "Gira": + age = "Garden" + + if self.PoleCurrentState[age] == "": + self.UpdatePoleStates() + + if fforward: + if self.Poles[age]["State"] in (3,4): + self.Poles[age]["PoleResponder"].run(self.key, state="5",fastforward = fforward) + self.Poles[age]["HandGlow"].run(self.key, state="DropSheath", fastforward = fforward) + else: + self.Poles[age]["HandGlow"].run(self.key, state="DropSheath", fastforward = fforward) + else: + self.PoleCurrentState[age] = "Open" + if self.Poles[age]["State"] in (3,4): + self.Poles[age]["PoleResponder"].run(self.key, state="5",fastforward = 0) + else: + self.Poles[age]["HandGlow"].run(self.key, state="DropSheath", fastforward = 0) + else: + self.PoleFinalState[age] = "Open" + + + def GetStateFrequencyList(self): + print "psnlBahroPoles.GetStateFrequencyList()" + statefreq = [0,0,0,0,0,0,0,0,0,0] + + for age in ["Teledahn", "Garrison", "Garden", "Kadish"]: + index = self.Poles[age]["State"] + statefreq[index] += 1 + + return statefreq + + + def ValidityCheck(self): + print "psnlBahroPoles.ValidityCheck()" + self.UpdateToState2() + freq = self.GetStateFrequencyList() + + # handle if someone left while poles going up or while last pole is going down + if (freq[5] == 3 and freq[4] == 1) or (freq[5] > 0 and (freq[6] > 0 or freq[7] > 0 or freq[8] > 0 or freq[9] > 0)): + if self.Poles["Teledahn"]["State"] < 6: + self.SetCurrentState("Teledahn", 6) + PtDebugPrint("DEBUG:psnlBahroPoles.ValidityCheck: fixed bad teledahn state") + + if self.Poles["Garrison"]["State"] < 6: + self.SetCurrentState("Garrison", 6) + PtDebugPrint("DEBUG:psnlBahroPoles.ValidityCheck: fixed bad garrison state") + + if self.Poles["Garden"]["State"] < 6: + self.SetCurrentState("Garden", 6) + PtDebugPrint("DEBUG:psnlBahroPoles.ValidityCheck: fixed bad garden state") + + if self.Poles["Kadish"]["State"] < 6: + self.SetCurrentState("Kadish", 6) + PtDebugPrint("DEBUG:psnlBahroPoles.ValidityCheck: fixed bad kadish state") + elif freq[4] == 4 or freq[5] == 4: + sdl = xPsnlVaultSDL(1) + sdl.BatchSet( [("TeledahnPoleState", (6,)), ("KadishPoleState", (6,)), ("GarrisonPoleState", (6,)), ("GardenPoleState", (6,))] ) + + + def UpdateToState2(self): + vault = ptAgeVault() + myAges = vault.getAgesIOwnFolder() + myAges = myAges.getChildNodeRefList() + for ageInfo in myAges: + link = ageInfo.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + spawnPoints = link.getSpawnPoints() + + if ageName == "Gira": + ageName = "Garden" + + if ageName == "Teledahn" or ageName == "Garrison" or ageName == "Garden" or ageName == "Kadish": + for spawnPoint in spawnPoints: + if spawnPoint.getName() == "LinkInPointDefault": + if self.Poles[ageName]["State"] < 2: + print "psnlBahroPoles.UpdateToState2(): updating ",ageName," to state 2" + self.SetCurrentState(ageName, 2) + self.UpdatePoleStates() + break + + +### SECTION ADDED (from bhroBahroYeeshaCave.py) TO CREATE BAHROCAVE SOLUTION HERE IN PERSONAL AGE + + def CheckBahroCaveSolution(self): + vault = ptVault() + entry = vault.findChronicleEntry("BahroCave") + if type(entry) == type(None): + return 0 + else: + var = self.GetAgeVariable("Teledahn", "SolutionSymbol") + if var != None: + return 1 + else: + return 0 + + + def CreateBahroCaveSolution(self): + bahroSolList = [3,2,5,0] + cleftSolList = [3,2,5,0] + + while self.AreListsEquiv(bahroSolList, cleftSolList): + bahroSolList = [] + while len(bahroSolList) < 4: + newint = xRandom.randint(0,6) + if not newint in bahroSolList: + bahroSolList.append(newint) + + vault = ptVault() + entry = vault.findChronicleEntry("BahroCave") + if type(entry) == type(None): + #PtDebugPrint("DEBUG: psnlBahroPoles.OnServerInitComplete: Did not find BahroCave chronicle...creating") + vault.addChronicleEntry("BahroCave",0,"0") + + agelist = ["Teledahn", "Garden", "Garrison", "Kadish"] + print "creating BahroCave solution in the chronicle..." + for v in range(len(agelist)): + newnode = ptVaultChronicleNode(0) + newnode.chronicleSetName(agelist[v]) + newnode.chronicleSetValue("0," + str(bahroSolList[v]) + ",0") + entry = vault.findChronicleEntry("BahroCave") + entry.addNode(newnode) + print "new bahro cave solution = ",self.GetBahroCaveSolution() + + + def AreListsEquiv(self, list1, list2): + if list1[0] in list2 and len(list1) == len(list2): + # rearrange list + list2Copy = copy.copy(list2) + while list2Copy[0] != list1[0]: + list2Copy.append(list2Copy.pop(0)) + + # check if all values match up now + for i in range(4): + if list2Copy[i] != list1[i]: + return false + return true + return false + + + def GetAgeNode(self, age): + vault = ptVault() + chron = vault.findChronicleEntry("BahroCave") + ageChronRefList = chron.getChildNodeRefList() + for ageChron in ageChronRefList: + ageChild = ageChron.getChild() + ageChild = ageChild.upcastToChronicleNode() + if ageChild.chronicleGetName() == age: + return ageChild + return None + + + def GetAgeVariable(self, age, variable): + node = self.GetAgeNode(age) + if node != None: + varlist = node.chronicleGetValue().split(",") + self.varMap = {'YeeshaSymbolTouched': 0, 'SolutionSymbol': 1, 'YeeshaSpeech': 2} + return varlist[ self.varMap[variable] ] + else: + return None + + + def CheckPelletCaveSolution(self): + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("PelletBahroCave") + + pelletSolution = None + solutionChron = None + ageDataFolder = None + + vault = ptVault() + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "PelletCaveSolution": + solutionChron = chron + chronString = chron.getValue() + chronString = chronString.split(",") + pelletSolution = [] + for sol in chronString: + pelletSolution.append(string.atoi(sol)) + print "found pellet cave solution: ", chron.getValue() + break + break + + if pelletSolution: + bahroSol = self.GetBahroCaveSolution() + if not self.AreListsEquiv(pelletSolution, bahroSol): + return + + ## create pellet cave solution + solutionList = self.CreatePelletCaveSolution() + solution = "" + for sol in solutionList: + solution = solution + "," + str(sol) + solution = solution[1:] + + if not ageDataFolder: + ageDataFolder = ptVaultFolderNode(0) + ageDataFolder.folderSetName("AgeData") + ageInfoNode.addNode(ageDataFolder) + + if pelletSolution: + solutionChron.chronicleSetValue(solution) + else: + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("PelletCaveSolution") + newNode.chronicleSetValue(solution) + ageDataFolder.addNode(newNode) + + + def CreatePelletCaveSolution(self): + print "psnlBahroPoles.CreatePelletCaveSolution(): creating pellet cave solution..." + bahroSolList = self.GetBahroCaveSolution() + cleftSolList = [3,2,5,0] + pelletSolList = [3,2,5,0] + + while self.AreListsEquiv(pelletSolList, cleftSolList) or self.AreListsEquiv(pelletSolList, bahroSolList): + pelletSolList = [] + while len(pelletSolList) < 4: + newint = xRandom.randint(0,6) + if not newint in pelletSolList: + pelletSolList.append(newint) + + print "pellet cave solution = ",pelletSolList + return pelletSolList + + + def GetBahroCaveSolution(self): + #vault = ptVault() + #entry = vault.findChronicleEntry("BahroCave") + agelist = ["Teledahn", "Garden", "Garrison", "Kadish"] + solution = [] + for age in agelist: + ageSol = string.atoi(self.GetAgeVariable(age, "SolutionSymbol")) + solution.append(ageSol) + return solution + + + diff --git a/Python/psnlBookshelf.py b/Python/psnlBookshelf.py new file mode 100644 index 0000000000..14cf0b7cdd --- /dev/null +++ b/Python/psnlBookshelf.py @@ -0,0 +1,1956 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: psnlBookshelf +Age: Personal Age +Date: August 2002 +Author: Bill Slease +This is the handler for the standard personal age bookshelf +Interfaces with xLinkingBookGUIPopup.py +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaVaultConstants import * +from PlasmaNetConstants import * +import PlasmaControlKeys +import xLinkingBookDefs +from xPsnlVaultSDL import * + +import xVisitorUtils #For non-subscription based players + +# define the attributes that will be entered in max +#PALGUI = ptAttribGUIDialog(2,"The PAL GUI") +actBookshelf = ptAttribActivator(3, "Actvtr:Bookshelf") + +actBook = ptAttribActivator(4,"Actvtr:Book",byObject=1) +respPresentBook = ptAttribResponder(5,"Rspndr:PresentBook",byObject=1) +respShelveBook = ptAttribResponder(6,"Rspndr:ShelveBook",byObject=1) +objLibrary = ptAttribSceneobjectList(7,"Objct:Books") + +objTrays = ptAttribSceneobjectList(8,"Objct:Trays") +respDeleteBook = ptAttribResponder(9,"Rspndr:DeleteBook",byObject=1) +respReturnTray = ptAttribResponder(10,"Rspndr:ReturnTray",byObject=1) +actTray = ptAttribActivator(11,"Actvtr:Tray",byObject=1) + +objLocks = ptAttribSceneobjectList(12,"Objct:Locks") +respOpenLock = ptAttribResponder(13,"Rspndr:OpenLock",byObject=1) +respCloseLock = ptAttribResponder(14,"Rspndr:CloseLock",byObject=1) +actLock = ptAttribActivator(15,"Actvtr:Lock",byObject=1) + +animLockOpen = ptAttribAnimation(16,"open clasp anim",byObject=1) +animLockClose = ptAttribAnimation(17,"close clasp anim",byObject=1) + +SeekBehavior = ptAttribBehavior(18, "Smart seek before GUI") # used to make user walk in front of shelf before using it +ShelfCamera = ptAttribSceneobject(19,"Bookshelf camera") # the camera used when engaging the shelf +respRaiseShelfClickable = ptAttribResponder(20,"Rspndr:Raise Clickable (LocalOnly)", netForce=0) # Bill's sneaky way to: 1) engage the bookshelf, and 2) keep others from using a shelf already in use by making it's movement "LocalOnly" in Maxs user properties +respLowerShelfClickable = ptAttribResponder(21,"Rspndr:Lower Clickable") #undoes the damage in previous step +actDisengageShelf = ptAttribActivator(22,"Actvtr: Disengage Shelf") # region detector around the SeekBehavior node (#18 above) which detects when a player walks away from the shelf. Only disengages if "exiter" is the current user +HutCamera = ptAttribSceneobject(23,"Hut circle camera") # the camera which was used before engaging the shelf + +actLinkingBookGUIPopup = ptAttribNamedActivator(24, "Actvr: LinkingBook GUI") # incoming notifies from the open Linking Book GUI + +actBookshelfExit = ptAttribActivator(25, "Actvr: Exit bookshelf") + +# globals +#============== + +# this array defines which age books are on this shelf and where on the shelf they appear +# to add a book, replace an element with the name of the age, for instance: change Link11 to BillsSuperCoolAge +# to change where a book appears on the shelf, change it's position in the array +linkLibrary = ["Neighborhood","Nexus","city","Link03","Link04","Cleft","Garrison","Teledahn","Kadish","Gira","Garden","Negilahn","Dereno","Payiferen","Tetsonot","Ercana","AhnonayCathedral","Ahnonay","Minkata","Jalak","Link21","Link22","Link23","Link24","Link25","Link26","Link27","Link28","Link29","Link30","Link31","Link32","Link33","Link34","Link35","Myst"] + +objBookPicked = None +objLockPicked = None +boolLinkerIsMe = false +boolPresentAfterLockOpen = false +boolShelfBusy = false +SpawnPointName = None +SpawnPointTitle = None +LocalAvatar = None +ShelfAUserID = -1 +ShelfABoolOperated = 0 +miniKIrestore = 0 +boolShelfInUse = 0 +AgeStartedIn = None +IsChildLink = 0 + +stupidHackForLock = None + +kPublicBooks = ("Nexus", "Cleft", "City") #These books cannot be linked to by guests, and cannot be deleted by the owner + +# list of ages that show up in the city book +CityBookAges = { "BaronCityOffice": ["BaronCityOffice", "Default"], "Descent": ["dsntShaftFall"], "GreatZero": ["grtzGrtZeroLinkRm"], "spyroom": ["Spyroom", "Default"], "Kveer": ["Kveer", "Default"]} + + +class psnlBookshelf(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5012 + + version = 10 + self.version = version + print "__init__psnlBookshelf v.", version + PtLoadDialog(xVisitorUtils.kVisitorNagDialog) + + + def __del__(self): + PtUnloadDialog(xVisitorUtils.kVisitorNagDialog) + + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + self.initComplete = 0 + self.UsingBook = 0 + + + global boolShelfBusy + + # hide tray clickables + for tray in objTrays.value: + tray.draw.disable() + + #make all books invisible (tagged unclickable by default) then IUpdate to draw/enable appropriate books + for book in objLibrary.value: + book.draw.disable() + boolShelfBusy = false + + # this section moved to OnServerInitComplete + ##### + #self.IUpdateLocksAndTrays() + ##self.IUpdateLinks() + + ## if I'm a visitor to this personal age, don't let me mess with book locks or delete books + #vault = ptVault() + #if not ( vault.inMyPersonalAge() ): + # actLock.disable() + # actTray.disable() + ##### + + return + + + def OnServerInitComplete(self): + global stupidHackForLock + + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + locked = 1 + + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLocked": + locked = bool(int(chron.getValue())) + break + + vault = ptVault() + if not vault.inMyPersonalAge(): + if stupidHackForLock == None: + stupidHackForLock = locked + + self.IUpdateLocksAndTrays() + #self.IUpdateLinks() + + # if I'm a visitor to this personal age, don't let me mess with book locks or delete books + if not ( vault.inMyPersonalAge() ): + actLock.disable() + actTray.disable() + + solo = true + if len(PtGetPlayerList()): + solo = false + + self.IUpdateLinks() + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + ageSDL.setNotify(self.key, "ShelfAUserID", 0.0) + + ageSDL.setFlags("ShelfABoolOperated",1,1) + ageSDL.setFlags("ShelfAUserID",1,1) + + ageSDL.sendToClients("ShelfABoolOperated") + ageSDL.sendToClients("ShelfAUserID") + + ageSDL.setFlags("CurrentPage", 1,1) + ageSDL.sendToClients("CurrentPage") + + ShelfABoolOperated = ageSDL["ShelfABoolOperated"][0] + if not solo and ShelfABoolOperated: + actBookshelf.disable() + print "psnlBookshelf.Load():\tShelfABoolOperated=%d, disabling shelf clickable" % ShelfABoolOperated + else: + print "psnlBookshelf.Load():\tShelfABoolOperated=%d but no one else here...correcting" % ShelfABoolOperated + self.IResetShelf() + + self.initComplete = 1 + + + def AvatarPage(self, avObj, pageIn, lastOut): + "reset Shelf A accessibility if Shelf A user quits or crashes" + global boolScopeOperated + + if pageIn: + return + + avID = PtGetClientIDFromAvatarKey(avObj.getKey()) + + if AgeStartedIn == PtGetAgeName(): + try: + ageSDL = PtGetAgeSDL() + if avID == ageSDL["ShelfAUserID"][0]: + print "psnlBookshelf.AvatarPage(): Bookshelf A operator paged out, reenabled Bookshelf." + self.IResetShelf() + else: + return + except: + # probably couldn't find the age SDL yet.. + pass + + + def OnAgeVaultEvent(self,event,tupdata): + PtDebugPrint("psnlBookshelf.OnAgeVaultEvent()\t:OnAgeKIEvent recvd. Event=%d and data= " % (event),tupdata) + if event == PtVaultCallbackTypes.kVaultConnected: + print "psnlBookshelf: kVaultConnected event" + # tupdata is () + #~ pass + elif event == PtVaultCallbackTypes.kVaultNodeSaved: + print "psnlBookshelf.OnAgeVaultEvent()\t: kVaultNodeSaved event (id=%d,type=%d)" % (tupdata[0].getID(),tupdata[0].getType()) + # tupdata is ( ptVaultNode ) + #~ pass + elif event == PtVaultCallbackTypes.kVaultNodeRefAdded: + print "psnlBookshelf.OnAgeVaultEvent()\t: kVaultNodeRefAdded event (childID=%d,parentID=%d)" % (tupdata[0].getChildID(),tupdata[0].getParentID()) + # tupdata is ( ptVaultNodeRef ) + if self.initComplete: + self.IUpdateLinks() + self.IUpdateLocksAndTrays() + elif event == PtVaultCallbackTypes.kVaultRemovingNodeRef: + print "psnlBookshelf.OnAgeVaultEvent()\t: kVaultRemovingNodeRef event (childID=%d,parentID=%d)" % (tupdata[0].getChildID(),tupdata[0].getParentID()) + # tupdata is ( ptVaultNodeRef ) + #~ pass + elif event == PtVaultCallbackTypes.kVaultNodeRefRemoved: + print "psnlBookshelf.OnAgeVaultEvent()\t: kVaultNodeRefRemoved event (childID,parentID) ",tupdata + # tupdata is ( childID, parentID ) + #~ pass + elif event == PtVaultCallbackTypes.kVaultNodeInitialized: + print "psnlBookshelf.OnAgeVaultEvent()\t: kVaultNodeInitialized event (id=%d,type=%d)", (tupdata[0].getID(),tupdata[0].getType()) + # tupdata is ( ptVaultNode ) + #~ pass + elif event == PtVaultCallbackTypes.kVaultOperationFailed: + print "psnlBookshelf.OnAgeVaultEvent()\t: kVaultOperationFailed event (operation,resultCode) ",tupdata + #tupdata is ( operation, resultCode ) + #~ pass + else: + PtDebugPrint("psnlBookshelf: OnAgeVaultEvent - unknown event!") + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname == "ShelfAUserID": + ageSDL = PtGetAgeSDL() + if type(ageSDL) != type(None): + if ageSDL["ShelfAUserID"][0] == -1: + actBookshelf.enable() + + def OnNotify(self,state,id,events): + global objBookPicked + global boolLinkerIsMe + global objLockPicked + global boolPresentAfterLockOpen + global boolShelfBusy + global ShelfAUserID + global ShelfABoolOperated + global SpawnPointName + global SpawnPointTitle + global miniKIrestore + global boolShelfInUse + global stupidHackForLock + + #~ print "state:",state," id:",id," events:",events + + if id == actBookshelfExit.id: + self.IDisengageShelf() + return + + vault = ptVault() + + if id == SeekBehavior.id and PtGetLocalAvatar() == PtFindAvatar(events): + for event in events: + if event[0] == kMultiStageEvent and event[1] == 0: # Smart seek completed. Exit multistage, and show GUI. + LocalAvatar = PtFindAvatar(events) + SeekBehavior.gotoStage(LocalAvatar, -1) + print "psnlBookshelf.OnNotify():\tengaging bookshelf" + + #PtFadeLocalAvatar(1) + LocalAvatar.draw.disable() + # set camera to Shelf Camera + virtCam = ptCamera() + virtCam.save(ShelfCamera.sceneobject.getKey()) + + if PtIsDialogLoaded("KIMini"): + miniKI = PtGetDialogFromString("KIMini") + if miniKI.isEnabled(): + miniKIrestore = 1 + PtHideDialog("KIMini") + + PtAtTimeCallback(self.key, .5, 1) + #PtGetControlEvents(true,self.key) + +## # We don't care about this any more, it is being handled using control key events +## if id == actDisengageShelf.id: +## theavatar = PtFindAvatar(events) +## AvatarWhoWalkedAway = PtGetClientIDFromAvatarKey(theavatar.getKey()) +## #~ print "psnlBookshelf.OnNotify: Avatar %s walked away from the shelf." % (AvatarWhoWalkedAway) +## +## if AgeStartedIn == PtGetAgeName(): +## ageSDL = PtGetAgeSDL() +## CurrentBookshelfUser = ageSDL["ShelfAUserID"][0] +## #~ print "psnlBookshelf.OnNotify: Player %s was previously using the shelf." % (CurrentBookshelfUser) +## +## if AvatarWhoWalkedAway == CurrentBookshelfUser: +## PtDebugPrint ("psnlBookshelf.OnNotify: Player %s is done with the bookshelf." % (CurrentBookshelfUser)) +## self.IResetShelf() +## +## avatar = PtGetLocalAvatar() +## myID = PtGetClientIDFromAvatarKey(avatar.getKey()) +## +## #~ print "I think my ID is: ", myID +## +## if myID == AvatarWhoWalkedAway: +## print "I was the Shelf User, and I'm done with the Shelf now." +## +## PtFadeLocalAvatar(0) +## #reeneable first person +## cam = ptCamera() +## cam.enableFirstPersonOverride() +## # go back to the Hut Circle Cam +## virtCam = ptCamera() +## virtCam.save(HutCamera.sceneobject.getKey()) + + + if id == actLinkingBookGUIPopup.id: + + for event in events: + if event[0] == kVariableEvent: + print "psnlBookshelf: Received a message from the Book GUI: ", event[1] + if event[1] == "IShelveBook" and type(objBookPicked) != type(None): + self.IShelveBook() + + + if event[1].split(",")[0] == "ILink": # parse the spawn point info off the entire note (which comes through as "ILink, SpawnPointName,SpawnPointTitle") + + LinkerID = event[3] + #~ print "LinkerID = ", LinkerID + avatar = PtGetLocalAvatar() + myID = PtGetClientIDFromAvatarKey(avatar.getKey()) + #~ print "myID = ", myID + self.IShelveBook() + if LinkerID == myID: + + #reenable First person before linking out + cam = ptCamera() + cam.enableFirstPersonOverride() + + #Un-fade local avatar + #PtFadeLocalAvatar(0) + avatar.draw.enable() + + #Go back to the hut circle cam to avoid re-fade out nastiness + virtCam = ptCamera() + virtCam.save(HutCamera.sceneobject.getKey()) + + # don't re-eable the movement keys when we are linking out... + ##PtEnableMovementKeys() + PtGetControlEvents(false,self.key) + + SpawnPointName = event[1].split(",")[1] + SpawnPointTitle = event[1].split(",")[2] + + print "psnlBookshelf: SpawnPointName = ", SpawnPointName," SpawnPointTitle = ", SpawnPointTitle + + self.IResetShelf() + self.SendNote(0) + self.ILink() + + #~ stringAgeRequested = event[1] + #~ idRequestor = event[3] + #~ PtDebugPrint("xLinkingBookGUI.OnNotify():\tpsnlBookshelf user id %d selected book %s from the shelf" % (idRequestor, stringAgeRequested)) + + #~ self.IShelveBook() + + if id == (-1): + if events[0][1] == 'BookShelfBusy': + print "psnlBookShelf: Notified about bookshelf use." + boolShelfInUse = events[0][3] + else: + for event in events: + if event[0] == kVariableEvent: + print event[1], event[3] + if event[1] == "YesNo" and event[3] == 1: + link = self.IGetLinkFromBook() + + bookAge = self.IGetAgeFromBook() + if bookAge == "Ahnonay" or bookAge == "AhnonayCathedral": + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayVolatile": + if ( vault.inMyPersonalAge() ): + chron.setValue("1") + break + + PtDebugPrint("DEBUG: psnlBookshelf.OnNotify:\tSending volatile notify (hopefully)") + note = ptNotify(self.key) + note.setActivate(1.0) + note.addVarNumber("VolatileAhnonay", 1) + note.send() + + note = ptNotify(self.key) + note.setActivate(1.0) + note.addVarNumber("VolatileAhnonayCathedral", 1) + note.send() + + ageVault = ptAgeVault() + PAL = ageVault.getAgesIOwnFolder() + contents = PAL.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if info and info.getAgeFilename() == "AhnonayCathedral": + # found our link + print "psnlBookshelf.IGetLinkFromBook():\tfound Owned link", info.getAgeFilename() + link.setVolatile(True) + link.save() + + #bookName = objBookPicked.getName() + for bookName in ["ShelfA_book17","ShelfA_book18"]: + for rkey,rvalue in respDeleteBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respDeleteBook.run(self.key,objectName=rkey) + BookNumber = linkLibrary.index(bookAge) + ageSDL = PtGetAgeSDL() + ageSDL.setIndex("CurrentPage",BookNumber,1) + print "Setting CurrentPage var of book %s to 1" % BookNumber + break + objBookPicked = None + return + else: + # volatile it + link.setVolatile(True) + link.save() + + PtDebugPrint("DEBUG: psnlBookshelf.OnNotify:\tSending volatile notify (hopefully)") + note = ptNotify(self.key) + note.setActivate(1.0) + note.addVarNumber("Volatile" + bookAge, 1) + note.send() + bookName = objBookPicked.getName() + for rkey,rvalue in respDeleteBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respDeleteBook.run(self.key,objectName=rkey) + BookNumber = linkLibrary.index(bookAge) + ageSDL = PtGetAgeSDL() + ageSDL.setIndex("CurrentPage",BookNumber,1) + print "Setting CurrentPage var of book %s to 1" % BookNumber + break + objBookPicked = None + return + boolShelfBusy = false + self.IUpdateLinks() + + + # in no other cases do we want to take action on state = 0 events + if not state: + return + + if id==actBookshelf.id: + if PtFindAvatar(events) == PtGetLocalAvatar() and PtWasLocallyNotified(self.key) and not boolShelfInUse: + actBookshelf.disable() # want the Shelf clickable to be disabled for all clients + print "psnlBookshelf: disabling clickable" + print "psnlBookshelf: Firing clickable responder" + respRaiseShelfClickable.run(self.key,netPropagate=0) + self.SendNote(1) + self.IUpdateLinks() + for event in events: + if event[0] == kPickedEvent: + if event[1]: #entry event + # Disable First Person Camera + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + PtRecenterCamera() + LocalAvatar = PtFindAvatar(events) + SeekBehavior.run(LocalAvatar) + #~ PtDebugPrint ("Bookshelf clicked. Disable it and smartseek.") + + ShelfABoolOperated = 1 # me! I'm the operator + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + ageSDL["ShelfABoolOperated"] = (1,) + avID = PtGetClientIDFromAvatarKey(LocalAvatar.getKey()) + ageSDL["ShelfAUserID"] = (avID,) + ShelfAUserID = avID + print "psnlBookshelf.OnNotify:\twrote SDL - Bookshelf A user id = ", avID + PtDisableMovementKeys() + #self.IUpdateLinks() + #PtShowDialog(kPALDialogName) + #elif event[1] == 0: #exit event + #PtHideDialog(kPALDialogName) + break + + if id==actBook.id: + if PtWasLocallyNotified(self.key): + boolLinkerIsMe = true + + ageSDL = PtGetAgeSDL() + CurrentUser = ageSDL["ShelfAUserID"][0] + avatar = PtGetLocalAvatar() + myID = PtGetClientIDFromAvatarKey(avatar.getKey()) + + #if myID != CurrentUser and boolLinkerIsMe: + # PtDebugPrint("DEBUG: psnlBookshelf.OnNotify: actBook notify, I'm not current user so I can't click books") + # return + + boolShelfBusy = true + + actTray.disable() + actBook.disable() + actLock.disable() + + # kPickedEvent looks like [ 2, pickflag, picker, picked ] where picker and picked are SceneObject instances + for event in events: + if event[0]==kPickedEvent: + objBookPicked = event[3] + bookName = objBookPicked.getName() + print "psnlBookshelf.OnNotify():\tplayer picked book named ", bookName + try: + index = objLibrary.value.index(objBookPicked) + except: + print "psnlBookshelf.OnNotify():\tERROR -- couldn't find ", objBookPicked, " in objLibrary" + return + + if self.IGetAgeFromBook() == "city" and PtIsSinglePlayerMode(): + ageVault = ptAgeVault() + citylink = self.GetOwnedAgeLink(ageVault, "city") + bcolink = self.GetOwnedAgeLink(ageVault, "BaronCityOffice") + + citylinklocked = citylink and citylink.getLocked() + bcolinklocked = bcolink and bcolink.getLocked() + + index = linkLibrary.index("city") + objLock = objLocks.value[index] + lockName = objLock.getName() + + # show as locked if both are locked, or one is locked and the other doesn't exist + if ( type(citylinklocked) == type(None) or citylinklocked) and ( type(bcolinklocked) == type(None) or bcolinklocked): + # find lock associated with this book + objLockPicked = objLocks.value[index] + lockName = objLockPicked.getName() + # find the corresponding lock open responder modifier + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey) + break + boolPresentAfterLockOpen = true + break + else: + bookName = objBookPicked.getName() + # find the corresponding responder modifier and present the book to the player + for rkey,rvalue in respPresentBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respPresentBook.run(self.key,objectName=rkey) + break + self.UsingBook = 1 + actBookshelfExit.disable() + return + + elif self.IGetAgeFromBook() == "Ahnonay": + locked = 0 + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLocked": + locked = bool(int(chron.getValue())) + + if not vault.inMyPersonalAge(): + if stupidHackForLock != None: + locked = stupidHackForLock + + if locked: + # find lock associated with this book + objLockPicked = objLocks.value[index] + lockName = objLockPicked.getName() + # find the corresponding lock open responder modifier + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey) + break + boolPresentAfterLockOpen = true + break + else: + bookName = objBookPicked.getName() + # find the corresponding responder modifier and present the book to the player + for rkey,rvalue in respPresentBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respPresentBook.run(self.key,objectName=rkey) + break + + self.UsingBook = 1 + actBookshelfExit.disable() + return + + link = self.IGetLinkFromBook() + if type(link) == type(None): + return + if type(link) != type(ptVaultAgeLinkNode()) or link.getLocked(): + # find lock associated with this book + + objLockPicked = objLocks.value[index] + lockName = objLockPicked.getName() + # find the corresponding lock open responder modifier + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey) + break + boolPresentAfterLockOpen = true + break + else: + bookName = objBookPicked.getName() + # find the corresponding responder modifier and present the book to the player + for rkey,rvalue in respPresentBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respPresentBook.run(self.key,objectName=rkey) + break + self.UsingBook = 1 + actBookshelfExit.disable() + return + + if id==respPresentBook.id and type(objBookPicked) != type(None): + # book is finished presenting - now link + if boolLinkerIsMe: + #~ self.ILink() + # tell linking book GUI which age to present + stringShowMeAge = self.IGetAgeFromBook() + PtDebugPrint("psnlBookshelf.OnNotify():\tsend message - show client %d age %s" % (ShelfAUserID,stringShowMeAge) ) + + note = ptNotify(self.key) + note.setActivate(1.0) + note.addVarNumber(stringShowMeAge + "," + str(objLibrary.value.index(objBookPicked)),ShelfAUserID) + note.send() + + # for now, just shelve the book again + #~ self.IShelveBook() + return + + if id==respShelveBook.id: + if self.IGetAgeFromBook() == "city" and PtIsSinglePlayerMode(): + ageVault = ptAgeVault() + citylink = self.GetOwnedAgeLink(ageVault, "city") + bcolink = self.GetOwnedAgeLink(ageVault, "BaronCityOffice") + + citylinklocked = citylink and citylink.getLocked() + bcolinklocked = bcolink and bcolink.getLocked() + + index = linkLibrary.index("city") + objLock = objLocks.value[index] + lockName = objLock.getName() + + # show as locked if both are locked, or one is locked and the other doesn't exist + if ( type(citylinklocked) == type(None) or citylinklocked) and ( type(bcolinklocked) == type(None) or bcolinklocked): + lockName = objLockPicked.getName() + # find the corresponding responder modifier + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey) + objLockPicked = None + break + + #~ elif not boolLinkerIsMe: + else: + boolShelfBusy = false + self.IUpdateLinks() + return + link = self.IGetLinkFromBook() + if type(link) == type(None): + return + + if type(link) == type("") and link == "Ahnonay": + locked = 0 + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLocked": + locked = bool(int(chron.getValue())) + break + + if not vault.inMyPersonalAge(): + if stupidHackForLock != None: + locked = stupidHackForLock + + if locked: + lockName = objLockPicked.getName() + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to locked: ",lockName + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey) + objLockPicked = None + return + else: + boolShelfBusy = false + self.IUpdateLinks() + return + + if type(link) == type(ptAgeLinkStruct()) or link.getLocked(): #close the clasp + lockName = objLockPicked.getName() + # find the corresponding responder modifier + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey) + objLockPicked = None + break + + #~ elif not boolLinkerIsMe: + else: + boolShelfBusy = false + self.IUpdateLinks() + return + + if id==actLock.id: + boolShelfBusy = true + + actTray.disable() + actBook.disable() + actLock.disable() + + # kPickedEvent looks like [ 2, pickflag, picker, picked ] where picker and picked are SceneObject instances + for event in events: + if event[0]==kPickedEvent: + objLockPicked = event[3] + + try: + index = objLocks.value.index(objLockPicked) + except: + print "psnlBookshelf.OnNotify():\tERROR -- couldn't find ", objLockPicked, " in objLocks" + return + objBookPicked = objLibrary.value[index] + lockName = objLockPicked.getName() + agename = self.IGetAgeFromBook() + + if agename == "city" and PtIsSinglePlayerMode(): + agevault = ptAgeVault() + citylink = self.GetOwnedAgeLink(agevault, "city") + bcolink = self.GetOwnedAgeLink(agevault, "BaronCityOffice") + + citylinklocked = citylink and citylink.getLocked() + bcolinklocked = bcolink and bcolink.getLocked() + + if ( type(citylinklocked) == type(None) or citylinklocked) and ( type(bcolinklocked) == type(None) or bcolinklocked): + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey) + break + + citylink and citylink.setLocked(0) + bcolink and bcolink.setLocked(0) + else: + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey) + break + + citylink and citylink.setLocked(1) + bcolink and bcolink.setLocked(1) + + if ( vault.inMyPersonalAge() ): + citylink and citylink.save() + bcolink and bcolink.save() + + return + + link = self.IGetLinkFromBook() + if type(link) == type(None): + return + lockName = objLockPicked.getName() + + if type(link) == type("") and link == "Ahnonay": + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLocked": + locked = bool(int(chron.getValue())) + break + + if not vault.inMyPersonalAge(): + if stupidHackForLock != None: + locked = stupidHackForLock + + print locked + if locked: + # find the corresponding open clasp responder modifier + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey) + break + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLocked": + if ( vault.inMyPersonalAge() ): + print "setting lock to 0" + chron.setValue("0") + else: + # find the corresponding close clasp responder modifier + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey) + break + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLocked": + if ( vault.inMyPersonalAge() ): + print "setting lock to 1" + chron.setValue("1") + + if not vault.inMyPersonalAge(): + stupidHackForLock = not stupidHackForLock + + return + + if type(link) != type(ptVaultAgeLinkNode()): + self.IUpdateLinks() + return + if link.getLocked(): + # find the corresponding open clasp responder modifier + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey) + break + link.setLocked(False) + if ( vault.inMyPersonalAge() ): + link.save() + else: + # find the corresponding close clasp responder modifier + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey) + break + link.setLocked(True) + if ( vault.inMyPersonalAge() ): + link.save() + break + return + + if id==respOpenLock.id: + if boolPresentAfterLockOpen: + bookName = objBookPicked.getName() + # find the corresponding responder modifier and present the book to the player + for rkey,rvalue in respPresentBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respPresentBook.run(self.key,objectName=rkey) + break + boolPresentAfterLockOpen = false + else: + boolShelfBusy=false + self.IUpdateLinks() + return + + if id==respCloseLock.id: + #~ if not boolLinkerIsMe: + boolShelfBusy = false + self.IUpdateLinks() # after someone links, need to run this to reenable clickables + return + +# +# +# Feb 2003 converted delete functionality to mark volatilenessticity +# +# + if id==actTray.id: + boolShelfBusy = true + actTray.disable() + actBook.disable() + actLock.disable() + + # kPickedEvent looks like [ 2, pickflag, picker, picked ] where picker and picked are SceneObject instances + for event in events: + if event[0]==kPickedEvent: + objTrayPicked = event[3] + break + + # find the corresponding responder modifier and begin deletion + # responders and animations are on books who are parents of the trays... + try: + index = objTrays.value.index(objTrayPicked) + except: + print "psnlBookshelf.OnNotify():\tERROR -- couldn't find ", objTrayPicked, " in objTrays" + return + + objBookPicked = objLibrary.value[index] + objLockPicked = objLocks.value[index] + + link = self.IGetLinkFromBook() + if not link: + return + + bookAge = self.IGetAgeFromBook() + + if bookAge == "Ahnonay" or bookAge == "AhnonayCathedral": + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataFolder = folder + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayVolatile": + volatile = chron.getValue() + break + + if int(volatile): + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayVolatile": + if ( vault.inMyPersonalAge() ): + chron.setValue("0") + break + + PtDebugPrint("DEBUG: psnlBookshelf.OnNotify:\tSending notvolatile notify (hopefully)") + note = ptNotify(self.key) + note.setActivate(1.0) + note.addVarNumber("NotVolatileAhnonay", 1) + note.send() + + note = ptNotify(self.key) + note.setActivate(1.0) + note.addVarNumber("NotVolatileAhnonayCathedral", 1) + note.send() + + ageVault = ptAgeVault() + PAL = ageVault.getAgesIOwnFolder() + contents = PAL.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if info and info.getAgeFilename() == "AhnonayCathedral": + # found our link + print "psnlBookshelf.IGetLinkFromBook():\tfound Owned link", info.getAgeFilename() + link.setVolatile(False) + link.save() + + #bookName = objBookPicked.getName() + for bookName in ["ShelfA_book17","ShelfA_book18"]: + for rkey,rvalue in respReturnTray.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respReturnTray.run(self.key,objectName=rkey) + break + objBookPicked = None + elif vault.inMyPersonalAge(): + PtYesNoDialog(self.key, PtGetLocalizedString("Personal.Bookshelf.DeleteBook")) + + return + + if link.getVolatile(): + # unvolatile it + link.setVolatile(False) + link.save() + + PtDebugPrint("DEBUG: psnlBookshelf.OnNotify:\tSending notvolatile notify (hopefully)") + note = ptNotify(self.key) + note.setActivate(1.0) + note.addVarNumber("NotVolatile" + bookAge, 1) + note.send() + + bookName = objBookPicked.getName() + for rkey,rvalue in respReturnTray.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respReturnTray.run(self.key,objectName=rkey) + break + objBookPicked = None + elif vault.inMyPersonalAge(): + if bookAge == "Neighborhood": + #Don't allow visitors (i.e. non-subscribers) to delete their neighborhood + if not PtIsSubscriptionActive(): + PtShowDialog(xVisitorUtils.kVisitorNagDialog) + actTray.enable() + actBook.enable() + actLock.enable() + return + + PtYesNoDialog(self.key, PtGetLocalizedString("Personal.Bookshelf.DeleteNeighborhoodBook")) + else: + PtYesNoDialog(self.key, PtGetLocalizedString("Personal.Bookshelf.DeleteBook")) +## # volatile it +## link.setVolatile(True) +## link.save() +## +## bookAge = self.IGetAgeFromBook() +## +## PtDebugPrint("DEBUG: psnlBookshelf.OnNotify:\tSending volatile notify (hopefully)") +## note = ptNotify(self.key) +## note.setActivate(1.0) +## note.addVarNumber("Volatile" + bookAge, 1) +## note.send() +## +## bookName = objBookPicked.getName() +## for rkey,rvalue in respDeleteBook.byObject.items(): +## parent = rvalue.getParentKey() +## if parent: +## if bookName == parent.getName(): +## respDeleteBook.run(self.key,objectName=rkey) +## break + + if id==respReturnTray.id or id==respDeleteBook.id: + boolShelfBusy = false + self.IUpdateLinks() + return + + + def IGetLinkFromBook(self, spTitle = None): + "returns link element associated with global objBookPicked or None" + global CityBookAges + global IsChildLink + + ageName = self.IGetAgeFromBook() + print "psnlBookshelf.IGetLinkFromBook(): before city lookup, ageName = ",ageName + + isCityLink = 0 + if ageName == "city": + isCityLink = 1 + for age, splist in CityBookAges.items(): + if spTitle in splist: + ageName = age + break + print "psnlBookshelf.IGetLinkFromBook(): after city lookup, ageName = ",ageName + + if type(ageName) == type(None): + print "psnlBookshelf.IGetLinkFromBook():\tERROR -- conversion from book to link element failed" + return None + + if ageName == "Ahnonay": + print "psnlBookshelf.IGetLinkFromBook(): Going to Ahnonay... special case." + return "Ahnonay" + + hoodInfo = self.IGetHoodInfoNode() + if hoodInfo: + childAgeFolder = hoodInfo.getChildAgesFolder() + contents = childAgeFolder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if info and info.getAgeFilename() == ageName: + if ageName == "Garrison": + continue + else: + # found our link + print "psnlBookshelf.IGetLinkFromBook():\tfound Child link", info.getAgeFilename() + IsChildLink = 1 + return link + + if isCityLink: + # if we got here then we're a city link but we couldn't find the child age + # so we're going to hack it a little bit and force it + IsChildLink = 1 + + ageInfo = ptAgeInfoStruct() + ageInfo.setAgeFilename(ageName) + ageInfo.setAgeInstanceName("Ae'gura") + + ageLink = ptAgeLinkStruct() + ageLink.setAgeInfo(ageInfo) + + return ageLink + + ageVault = ptAgeVault() + PAL = ageVault.getAgesIOwnFolder() + contents = PAL.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if info and info.getAgeFilename() == ageName: + # found our link + print "psnlBookshelf.IGetLinkFromBook():\tfound Owned link", info.getAgeFilename() + IsChildLink = 0 + return link + + print "psnlBookshelf.IGetLinkFromBook():\tERROR -- couldn't find link to", ageName + print "info = ",info + print "info.getAgeFilename() = ",info.getAgeFilename() + print "spTitle = ",spTitle + return None + + def SendNote(self, bool): + notify = ptNotify(self.key) + notify.clearReceivers() + notify.addReceiver(self.key) + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + notify.addVarNumber('BookShelfBusy',bool) + notify.send() + + def IUpdateLocksAndTrays(self): + global CityBookAges + + ageVault = ptAgeVault() + PAL = ageVault.getAgesIOwnFolder() + contents = PAL.getChildNodeRefList() + + # check for the dang city book and do stuff + if self.HasCityBook(): + citylink = self.GetOwnedAgeLink(ageVault, "city") + #bcolink = self.GetOwnedAgeLink(ageVault, "BaronCityOffice") + bcolink = self.IGetHoodChildLink("BaronCityOffice") + + citylinklocked = citylink and citylink.getLocked() + bcolinklocked = bcolink and bcolink.getLocked() + + index = linkLibrary.index("city") + objLock = objLocks.value[index] + lockName = objLock.getName() + + # show as locked if both are locked, or one is locked and the other doesn't exist + if ( type(citylinklocked) == type(None) or citylinklocked) and ( type(bcolinklocked) == type(None) or bcolinklocked): + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to locked: ",lockName + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey,fastforward=1) + else: + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to unlocked: ",lockName + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey,fastforward=1) + + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + try: + index = linkLibrary.index(ageName) + except: + print "psnlBookshelf.IUpdateLocksAndTrays():\tno matching book for KI's link to:", ageName, "...skipping to next" + continue + + if ((ageName == "city" or ageName == "BaronCityOffice") and PtIsSinglePlayerMode()) or (ageName in CityBookAges.keys()): + continue + + if ageName == "Cleft": + if not link.getLocked(): + link.setLocked(True) + vault = ptVault() + if vault.inMyPersonalAge(): + link.save() + continue + + + objLock = objLocks.value[index] + lockName = objLock.getName() + if link.getLocked(): + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to locked: ",lockName + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey,fastforward=1) + else: + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to unlocked: ",lockName + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey,fastforward=1) + + # trays are children of the books...so to manipulate the trays we manipulate the books + objBook = objLibrary.value[index] + bookName = objBook.getName() + if link.getVolatile(): + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting booktray to VOLATILE: ",bookName + for rkey,rvalue in respDeleteBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + #~ print trayName,"==",rkey#[:len(trayName)] + if bookName == parent.getName(): + respDeleteBook.run(self.key,objectName=rkey,fastforward=1) + #~ print "got here" + else: + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting booktray to NOT volatile: ",bookName + for rkey,rvalue in respReturnTray.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respReturnTray.run(self.key,objectName=rkey,fastforward=1) + + ## Ahnonay Hackage! + guid = None + locked = 0 + volatile = 0 + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLink": + guid = chron.getValue() + elif chron and chron.getName() == "AhnonayLocked": + locked = chron.getValue() + elif chron and chron.getName() == "AhnonayVolatile": + volatile = chron.getValue() + + if guid != None: + try: + index = linkLibrary.index("Ahnonay") + except: + print "psnlBookshelf.IUpdateLocksAndTrays():\tno matching book for KI's link to: Ahnonay... skipping to next" + return + + objLock = objLocks.value[index] + lockName = objLock.getName() + if int(locked): + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to locked: ",lockName + for rkey,rvalue in respCloseLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey,fastforward=1) + else: + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to unlocked: ",lockName + for rkey,rvalue in respOpenLock.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respOpenLock.run(self.key,objectName=rkey,fastforward=1) + + # trays are children of the books...so to manipulate the trays we manipulate the books + objBook = objLibrary.value[index] + bookName = objBook.getName() + if int(volatile): + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting booktray to VOLATILE: ",bookName + for rkey,rvalue in respDeleteBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + #~ print trayName,"==",rkey#[:len(trayName)] + if bookName == parent.getName(): + respDeleteBook.run(self.key,objectName=rkey,fastforward=1) + #~ print "got here" + else: + print "psnlBookshelf.IUpdateLocksAndTrays():\tsetting booktray to NOT volatile: ",bookName + for rkey,rvalue in respReturnTray.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respReturnTray.run(self.key,objectName=rkey,fastforward=1) + + return + + + def IUpdateLinks(self): + global stupidHackForLock + global CityBookAges + + # ensure all books and trays are not clickable + # we're going to display books player has links to and enable clickables on books and associated trays + actTray.disable() + actBook.disable() + actLock.disable() + + vault = ptVault() + boolInMyAge = vault.inMyPersonalAge() + + # check for the dang city book and do stuff + if self.HasCityBook(): + ageVault = ptAgeVault() + citylink = self.GetOwnedAgeLink(ageVault, "city") + #bcolink = self.GetOwnedAgeLink(ageVault, "BaronCityOffice") + bcolink = self.IGetHoodChildLink("BaronCityOffice") + + citylinklocked = citylink and citylink.getLocked() + bcolinklocked = bcolink and bcolink.getLocked() + + index = linkLibrary.index("city") + objBook = objLibrary.value[index] + objBook.draw.enable() + + bookName = objBook.getName() + for key,value in actBook.byObject.items(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + actBook.enable(objectName=key) + break + + # find and enable the corresponding clickable modifier for the book's tray and lock if owner + objTray = objTrays.value[index] + trayName = objTray.getName() + objLock = objLocks.value[index] + lockName = objLock.getName() + if ( boolInMyAge ): + for key,value in actLock.byObject.items(): + parent = value.getParentKey() + if parent: + if lockName == parent.getName(): + actLock.enable(objectName=key) + break + + ageVault = ptAgeVault() + PAL = ageVault.getAgesIOwnFolder() + if type(PAL) != type(None): + contents = PAL.getChildNodeRefList() + + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + + if (ageName == "city" or ageName == "BaronCityOffice") or (ageName in CityBookAges.keys()): + continue + +# if (ageName == "Garrison"): +# parent = info.getParentAgeLink() +# parentinfo = parent.getAgeInfo() +# parentname = parentinfo.getAgeFilename() +# if parentname == "Neighborhood": +# print "psnlBookshelf.IUpdateLinks(): link found for public Garrison, ignoring..." +# continue + + try: + index = linkLibrary.index(ageName) + except: + print "psnlBookshelf.IUpdateLinks():\tno matching book for KI's link to:", ageName, "...skipping to next" + continue + + if ageName == "Cleft": + ageSDL = PtGetAgeSDL() + boolCleftVisited = ageSDL["CleftVisited"][0] + if not boolCleftVisited: + continue + + # show the book + objBook = objLibrary.value[index] + objBook.draw.enable() + + if boolShelfBusy: + # not safe to enable clickables + return + + # find and enable the corresponding clickable modifier for the book + print "psnlBookshelf.IUpdateLinks():\tageName: ",ageName," boolInMyAge: ",boolInMyAge," getLocked(): ",link.getLocked()," getVolatile(): ",link.getVolatile() + if link.getVolatile() or ((not boolInMyAge) and (link.getLocked() or ageName == "Cleft")): + bookName = objBook.getName() + for key,value in actBook.byObject.items(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + print "%s book: DISABLED" % (bookName) + actBook.disable(objectName=key) + break + if (not boolInMyAge) and (link.getLocked() or ageName == "Cleft"): + # owner of book has locked this one -- go on to next link element + continue + + if not link.getVolatile(): + bookName = objBook.getName() + for key,value in actBook.byObject.items(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + print "%s book: ENABLED" % (bookName) + actBook.enable(objectName=key) + break + + # find and enable the corresponding clickable modifier for the book's tray and lock if owner + objTray = objTrays.value[index] + trayName = objTray.getName() + objLock = objLocks.value[index] + lockName = objLock.getName() + + if ( boolInMyAge ): + #First make sure that we disable locks (i.e sharing) and trays (i.e. deletion) on all public books + if ageName in kPublicBooks: + continue + + + for key,value in actLock.byObject.items(): + parent = value.getParentKey() + if parent: + if lockName == parent.getName(): + actLock.enable(objectName=key) + break + + for key,value in actTray.byObject.items(): + parent = value.getParentKey() + if parent: + if trayName == parent.getName(): + actTray.enable(objectName=key) + break + + else: + print "psnlBookshelf: The PAL folder is missing" + + + ## Ahnonay Hackage! + guid = None + locked = 0 + volatile = 0 + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLink": + guid = chron.getValue() + elif chron and chron.getName() == "AhnonayLocked": + locked = bool(int(chron.getValue())) + elif chron and chron.getName() == "AhnonayVolatile": + volatile = chron.getValue() + + if guid != None: + ageName = "Ahnonay" + + try: + index = linkLibrary.index("Ahnonay") + except: + print "psnlBookshelf.IUpdateLocksAndTrays():\tno matching book for KI's link to: Ahnonay... skipping to next" + return + + # show the book + objBook = objLibrary.value[index] + objBook.draw.enable() + + if boolShelfBusy: + # not safe to enable clickables + return + + if not vault.inMyPersonalAge(): + if stupidHackForLock != None: + locked = stupidHackForLock + + # find and enable the corresponding clickable modifier for the book + if int(volatile) or ((not boolInMyAge) and locked): + bookName = objBook.getName() + for key,value in actBook.byObject.items(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + print "%s book: DISABLED" % (bookName) + actBook.disable(objectName=key) + break + if (not boolInMyAge) and int(locked): + # owner of book has locked this one -- go on to next link element + return + + if not int(volatile): + bookName = objBook.getName() + for key,value in actBook.byObject.items(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + print "%s book: ENABLED" % (bookName) + actBook.enable(objectName=key) + break + + # find and enable the corresponding clickable modifier for the book's tray and lock if owner + objTray = objTrays.value[index] + trayName = objTray.getName() + objLock = objLocks.value[index] + lockName = objLock.getName() + + if boolInMyAge: + #First make sure that we disable locks (i.e sharing) and trays (i.e. deletion) on all public books + if ageName in kPublicBooks: + return + + + for key,value in actLock.byObject.items(): + parent = value.getParentKey() + if parent: + if lockName == parent.getName(): + actLock.enable(objectName=key) + break + + for key,value in actTray.byObject.items(): + parent = value.getParentKey() + if parent: + if trayName == parent.getName(): + actTray.enable(objectName=key) + break + + def CheckForCityBookSpawnPoint(self, agefilename, sptitle): + global CityBookAges + + if agefilename in CityBookAges.keys(): + splist = CityBookAges[agefilename] + if sptitle in splist: + return 1 + return 0 + + + def ILink(self): + global SpawnPointName + global SpawnPointTitle + + link = self.IGetLinkFromBook(SpawnPointTitle) + if type(link) == type(None): + print "psnlBookshelf.ILink():\tERROR -- conversion from book to link failed -- aborting" + return + elif type(link) == type("") and link == "Ahnonay": + info = ptAgeInfoStruct() + info.setAgeFilename("Ahnonay") + info.setAgeInstanceName("Ahnonay") + guid = None + ageVault = ptAgeVault() + ageInfoNode = ageVault.getAgeInfo() + + ageInfoChildren = ageInfoNode.getChildNodeRefList() + for ageInfoChildRef in ageInfoChildren: + ageInfoChild = ageInfoChildRef.getChild() + folder = ageInfoChild.upcastToFolderNode() + if folder and folder.folderGetName() == "AgeData": + ageDataChildren = folder.getChildNodeRefList() + for ageDataChildRef in ageDataChildren: + ageDataChild = ageDataChildRef.getChild() + chron = ageDataChild.upcastToChronicleNode() + if chron and chron.getName() == "AhnonayLink": + guid = chron.getValue() + print guid + break + break + info.setAgeInstanceGuid(guid) + + link = ptAgeLinkStruct() + link.setAgeInfo(info) + + elif link.getAgeInfo().getAgeFilename() == "Neighborhood" and not PtIsSubscriptionActive(): + info = ptAgeInfoStruct() + info.setAgeFilename("Neighborhood") + info.setAgeInstanceGuid("366f9aa1-c4c9-4c4c-a23a-cbe6896cc3b9") + link = ptAgeLinkStruct() + link.setAgeInfo(info) + + info = link.getAgeInfo() + ageName = info.getAgeFilename() + + # do the link + print "psnlBookshelf.ILink():\tattempting link to %s(%s)" % (info.getAgeFilename(),info.getAgeInstanceName()) + + print "Ilink: SpawnPointTitle = ", SpawnPointTitle, "; SpawnPointName = ", SpawnPointName + spnpnt = None + + if type(link) == type(ptAgeLinkStruct()): + als = link + else: + als = link.asAgeLinkStruct() + + spawnPoints = link.getSpawnPoints() + for sp in spawnPoints: + if (sp.getTitle() == SpawnPointTitle and sp.getName() == SpawnPointName) or self.CheckForCityBookSpawnPoint(ageName, SpawnPointTitle): + print "found spawn point: %s, %s" % (sp.getTitle(), sp.getName()) + if sp.getName() == "BigRoomLinkInPoint": + print "oops, found spawnpt for GZ BigRoom, we don't want to link there via city book, so we'll ignore it" + break + spnpnt = sp + break + + if not spnpnt: + spnpnt = ptSpawnPointInfo(SpawnPointTitle, SpawnPointName) + + print "spnpnt.getTitle() = ",spnpnt.getTitle() + print "spnpnt.getName() = ",spnpnt.getName() + + als.setSpawnPoint(spnpnt) + + vault = ptVault() + + # If in my personal age, link with kOwnedBook rules. + # This will startup a new, private age instance for me. + if (vault.inMyPersonalAge()): + if ageName == "Ahnonay" or (ageName == "Neighborhood" and not PtIsSubscriptionActive()): + als.setLinkingRules( PtLinkingRules.kBasicLink ) + elif IsChildLink: + print "psnlBookshelf.ILink(): using kChildAgeBook rules for link to: ",ageName + als.setLinkingRules( PtLinkingRules.kChildAgeBook ) + als.setParentAgeFilename("Neighborhood") + else: + print "psnlBookshelf.ILink(): using kOwnedBook rules for link to: ",ageName + als.setLinkingRules( PtLinkingRules.kOwnedBook ) + # Otherwise, always use kOriginalBook rules. + # The engine will handle whether player becomes co-owner or not. + else: + #als.setLinkingRules( PtLinkingRules.kOriginalBook ) + # not using co-ownership right now so visitors use visit books unless going to neighborhood + if ageName == "Neighborhood": + als.setLinkingRules( PtLinkingRules.kOriginalBook ) + else: + als.setLinkingRules( PtLinkingRules.kBasicLink ) + + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(als) + print "ILink Done" + + + def IShelveBook(self): + "returns a picked book to the shelf" + global objBookPicked + bookName = objBookPicked.getName() + for rkey,rvalue in respShelveBook.byObject.items(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respShelveBook.run(self.key,objectName=rkey) + break + + self.UsingBook = 0 + actBookshelfExit.enable() + + + def IGetAgeFromBook(self): + "returns age name associated with global objBookPicked or None" + global objBookPicked + + # find where book object is in object library + try: + index = objLibrary.value.index(objBookPicked) + except: + print "psnlBookshelf.IUpdateLinks():\tERROR -- couldn't find ", objBookPicked, " in objLibrary" + return None + print "psnlBookshelf.IGetAgeFromBook():\tpicked book goes to ", linkLibrary[index] + return linkLibrary[index] + + + def IResetShelf(self): + global ShelfABoolOperated + global ShelfAUserID + + PtDebugPrint ("psnlBookshelf.IResetShelf:\tResetting shelf") + ShelfABoolOperated = 0 + ShelfAUserID = -1 + respLowerShelfClickable.run(self.key) + actBookshelf.enable() + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + ageSDL["ShelfABoolOperated"] = (0,) + ageSDL["ShelfAUserID"] = (-1,) + + + def IDisengageShelf(self): + global miniKIrestore + + self.SendNote(0) + if AgeStartedIn == PtGetAgeName() and not self.UsingBook: + ageSDL = PtGetAgeSDL() + CurrentBookshelfUser = ageSDL["ShelfAUserID"][0] + #~ print "psnlBookshelf.OnNotify: Player %s was previously using the shelf." % (CurrentBookshelfUser) + + PtDebugPrint ("psnlBookshelf.OnNotify: Player %s is done with the bookshelf." % (CurrentBookshelfUser)) + self.IResetShelf() + + avatar = PtGetLocalAvatar() + myID = PtGetClientIDFromAvatarKey(avatar.getKey()) + + #~ print "I think my ID is: ", myID + + if myID == CurrentBookshelfUser: + print "I was the Shelf User, and I'm done with the Shelf now." + + #PtFadeLocalAvatar(0) + avatar.draw.enable() + #reeneable first person + cam = ptCamera() + cam.enableFirstPersonOverride() + # go back to the Hut Circle Cam + virtCam = ptCamera() + virtCam.save(HutCamera.sceneobject.getKey()) + PtEnableMovementKeys() + actBookshelfExit.disable() + PtGetControlEvents(false,self.key) + + if miniKIrestore: + miniKIrestore = 0 + PtShowDialog("KIMini") + + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode or controlKey == PlasmaControlKeys.kKeyMoveBackward: + self.IDisengageShelf() + + + def OnTimer(self, id): + if id == 1: + PtGetControlEvents(true,self.key) + actBookshelfExit.enable() + + + def IGetHoodLinkNode(self): + vault = ptVault() + folder = vault.getAgesIOwnFolder() + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if type(link) != type(None): + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + if ageName == "Neighborhood": + return link + return None + + + def IGetHoodInfoNode(self): + link = self.IGetHoodLinkNode() + if type(link) == type(None): + return None + info = link.getAgeInfo() + return info + + + def IGetHoodChildLink(self, age): + hoodInfo = self.IGetHoodInfoNode() + if hoodInfo: + childAgeFolder = hoodInfo.getChildAgesFolder() + if type(childAgeFolder) != type(None): + contents = childAgeFolder.getChildNodeRefList() + #childAgeLinkNodes = [] + #GZLinkNode = None + for content in contents: + link = content.getChild().upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + #print "name = ",name + if ageName == age: + return link + return None + + + def HasCityBook(self): + ##### + # COMMENT OUT THIS LINE TO RESTORE THE CITY BOOK: + #return 0 + ##### + global CityBookAges + + vault = ptVault() + if not vault.amOwnerOfCurrentAge(): + ageSDL = PtGetAgeSDL() + GotBook = ageSDL["psnlGotCityBook"][0] + if GotBook: + print "psnlBookshelf.HasCityBook(): owner has the city book" + return 1 + else: + print "psnlBookshelf.HasCityBook(): owner does NOT have city book" + return 0 + + CityLinks = [] + vault = ptVault() + entryCityLinks = vault.findChronicleEntry("CityBookLinks") + if type(entryCityLinks) != type(None): + valCityLinks = entryCityLinks.chronicleGetValue() + print "valCityLinks = ",valCityLinks + CityLinks = valCityLinks.split(",") + print "CityLinks = ",CityLinks + for tmpLink in CityLinks: + if tmpLink in xLinkingBookDefs.CityBookLinks: + return 1 + else: + print "can't find CityBookLinks chron entry" + return 0 + + vault = ptAgeVault() + # look for city book age links + for age, splist in CityBookAges.items(): + #agelink = self.GetOwnedAgeLink(vault, age) + agelink = self.IGetHoodChildLink(age) + print "age = ",age + print "agelink = ",agelink + + if type(agelink) != type(None): + spawnPoints = agelink.getSpawnPoints() + + for sp in spawnPoints: + print "sp = ",sp + print "sp.getTitle = ",sp.getTitle() + print "sp.getName = ",sp.getName() + if sp.getTitle() in splist: + print "found a city book link:", age, sp.getTitle() + return 1 + + # look for a city treasure link, but it's a Hood childage now + #agelink = self.GetOwnedAgeLink(vault, "city") + agelink = self.IGetHoodChildLink(age) + print "age = the city" + print "agelink = ",agelink + + if type(agelink) != type(None): + spawnPoints = agelink.getSpawnPoints() + + for sp in spawnPoints: + print "sp = ",sp + print "sp.getTitle = ",sp.getTitle() + print "sp.getName = ",sp.getName() + if sp.getTitle() in xLinkingBookDefs.CityBookLinks: + print "found a city book link: city", sp.getTitle() + return 1 + + # no BCO or city treasure link + print "found no city book links" + return 0 + + + def GetOwnedAgeLink(self, vault, age): + PAL = vault.getAgesIOwnFolder() + if type(PAL) != type(None): + contents = PAL.getChildNodeRefList() + for content in contents: + link = content.getChild().upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + print "found %s, looking for %s" % (ageName, age) + if ageName == age: + return link + + return None + diff --git a/Python/psnlBugs.py b/Python/psnlBugs.py new file mode 100644 index 0000000000..37faf7679b --- /dev/null +++ b/Python/psnlBugs.py @@ -0,0 +1,117 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: psnlBugs.py +Age: Relto +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaConstants import * +from xPsnlVaultSDL import * + +bugEmitter = ptAttribSceneobject(1,"bug emitter obj") + +chronicleEntryName = "BugsOnAvatar" +bugLightObjectName = "RTOmni-BugLightTest" + +class psnlBugs(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 53427 + self.version = 2 + self.bugCount = 0 + + def ISaveBugCount(self, count): + vault = ptVault() + if type(vault) != type(None): + entry = vault.findChronicleEntry(chronicleEntryName) + if type(entry) == type(None): + # not found... add chronicle + vault.addChronicleEntry(chronicleEntryName,0,str(count)) + else: + entry.chronicleSetValue(str(count)) + entry.save() + + def IGetBugCount(self): + vault = ptVault() + if type(vault) != type(None): + entry = vault.findChronicleEntry(chronicleEntryName) + if type(entry) != type(None): + return int(entry.chronicleGetValue()) + return 0 # no vault or no chronicle var + + def OnServerInitComplete(self): + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + print"failed to get local avatar" + return + + self.bugCount = self.IGetBugCount() + print"psnl Bugs: ", self.bugCount + + thisAge = PtGetAgeName() + #print "psnlBugs.OnServerInitComplete(): thisAge = ",thisAge + + if (self.bugCount != 0): + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + PtKillParticles(10.0,1,avatar.getKey()) + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) + print "kill all bugs in age: ",thisAge + self.ISaveBugCount(0) + + if thisAge != "Personal": + return + + psdl = xPsnlVaultSDL(1) + rainState = psdl["YeeshaPage8"][0] + + # check for all the cases where it would be raining, and if its not then turn on bugs + sdl = PtGetAgeSDL() + bugState = sdl["psnlBugsVis"] + if rainState == 1 or (rainState == 4 and len(PtGetPlayerList()) == 0) or (rainState == 3 and len(PtGetPlayerList()) > 0): + print "turning off bugs" + if bugState != 0: + sdl["psnlBugsVis"] = (0,) + else: + if self.bugCount > 0: + print "turning on bugs" + if bugState != 1: + sdl["psnlBugsVis"] = (1,) + +## def AvatarPage(self, avatar, pageIn, lastOut): +## print "in avatar page" +## self.bugCount = PtGetNumParticles(avatar.getKey()) +## print "number of bugs:", self.bugCount +## if (self.bugCount > 0): +## PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) +## PtKillParticles(10.0,1,avatar.getKey()) +## PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, false) +## print "kill all bugs in psnl age" +## self.ISaveBugCount(0) diff --git a/Python/psnlCalendarStones.py b/Python/psnlCalendarStones.py new file mode 100644 index 0000000000..23ac20056c --- /dev/null +++ b/Python/psnlCalendarStones.py @@ -0,0 +1,210 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: psnlCalendarStones.py +Age: Personal +Date: October 2007 +stuff for the calendar stones from the Yeesha page +""" + +from Plasma import * +from PlasmaTypes import * +import string +import xRandom + + +respCalStoneFire = ptAttribResponder(1,"resp: cal stones active",['on','off']) +respFireworksLaunch1 = ptAttribResponder(2,"resp: fireworks launch 1",netForce=1) +respFireworksExplode1 = ptAttribResponder(3,"resp: fireworks explode 1",netForce=1) +respFireworksLaunch2 = ptAttribResponder(4,"resp: fireworks launch 2",netForce=1) +respFireworksExplode2 = ptAttribResponder(5,"resp: fireworks explode 2",netForce=1) +respFireworksLaunch3 = ptAttribResponder(6,"resp: fireworks launch 3",netForce=1) +respFireworksExplode3 = ptAttribResponder(7,"resp: fireworks explode 3",netForce=1) + + +sdlCalStone01 = "psnlCalendarStone01" +sdlCalStone02 = "psnlCalendarStone02" +sdlCalStone03 = "psnlCalendarStone03" +sdlCalStone04 = "psnlCalendarStone04" +sdlCalStone05 = "psnlCalendarStone05" +sdlCalStone06 = "psnlCalendarStone06" +sdlCalStone07 = "psnlCalendarStone07" +sdlCalStone08 = "psnlCalendarStone08" +sdlCalStone09 = "psnlCalendarStone09" +sdlCalStone10 = "psnlCalendarStone10" +sdlCalStone11 = "psnlCalendarStone11" +sdlCalStone12 = "psnlCalendarStone12" +sdlCalStones = [ "psnlCalendarStone01","psnlCalendarStone02","psnlCalendarStone03","psnlCalendarStone04",\ + "psnlCalendarStone05","psnlCalendarStone06","psnlCalendarStone07","psnlCalendarStone08",\ + "psnlCalendarStone09","psnlCalendarStone10","psnlCalendarStone11","psnlCalendarStone12"] +kMinLaunchTime = 15 +kMaxLaunchTime = 25 +kMinExplodeTime = 10 +kMaxExplodeTime = 20 +fireworksTestMode = 0 +fireworks = 0 + + +class psnlCalendarStones(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5082 + self.version = 1 + PtDebugPrint("__init__psnlCalendarStones v. %d" % (self.version)) + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + global fireworks + ageSDL = PtGetAgeSDL() + + # FIRE for completion of the Calendar Stones... + fire = 1 + for sdl in sdlCalStones: + #ageSDL.setFlags(sdl,1,1) + #ageSDL.sendToClients(sdl) + #ageSDL.setNotify(self.key,sdl,0.0) + val = ageSDL[sdl][0] + if not val: + fire = 0 + break + if fire: + ageVault = ptAgeVault() + if type(ageVault) != type(None): #is the Vault online? + ageSDL = ageVault.getAgeSDL() + if ageSDL: + try: + SDLVar = ageSDL.findVar("YeeshaPage20") + CurrentValue = SDLVar.getInt() + except: + PtDebugPrint("psnlCalendarStones.OnServerInitComplete():\tERROR reading age SDLVar for YeeshaPage20. Assuming value = 0") + CurrentValue = 0 + if CurrentValue in [0, 2, 4]: + print "psnlCalendarStones.OnServerInitComplete(): don't have YeeshaPage20 on, no FIRE for you!" + respCalStoneFire.run(self.key,state="off",fastforward=1) + else: + print "psnlCalendarStones.OnServerInitComplete(): have all 12 calendar stones AND YeeshaPage20 is on, will give you FIRE!" + fireworks = 1 + respCalStoneFire.run(self.key,state="on",fastforward=1) + if not self.sceneobject.isLocallyOwned(): + return + if not fireworksTestMode: + self.DoFireworks(1,1) + self.DoFireworks(3,1) + self.DoFireworks(5,1) + else: + print "psnlCalendarStones.OnServerInitComplete(): don't have all 12 calendar stones, no FIRE for you!" + respCalStoneFire.run(self.key,state="off",fastforward=1) + + + def OnNotify(self,state,id,events): + pass + + + def OnTimer(self,id): + if not fireworks and not fireworksTestMode: + return + if not self.sceneobject.isLocallyOwned(): + return + if id == 1: + respFireworksLaunch1.run(self.key) + #print "launch rocket 1" + self.DoFireworks(1,2) + elif id == 2: + respFireworksExplode1.run(self.key) + #print "explode rocket 1" + if not fireworksTestMode: + self.DoFireworks(1,1) + elif id == 3: + respFireworksLaunch2.run(self.key) + #print "launch rocket 2" + self.DoFireworks(3,2) + elif id == 4: + respFireworksExplode2.run(self.key) + #print "explode rocket 2" + if not fireworksTestMode: + self.DoFireworks(3,1) + elif id == 5: + respFireworksLaunch3.run(self.key) + #print "launch rocket 3" + self.DoFireworks(5,2) + elif id == 6: + respFireworksExplode3.run(self.key) + #print "explode rocket 3" + if not fireworksTestMode: + self.DoFireworks(5,1) + + + def DoFireworks(self,rocket,stage): + if stage == 1: + timer = self.GetLaunchTime() + elif stage == 2: + timer = self.GetExplodeTime() + rocket += 1 + PtAtTimeCallback(self.key,timer,rocket) + + + def GetLaunchTime(self): + timeLaunch = xRandom.randint(kMinLaunchTime,kMaxLaunchTime) + return timeLaunch + + + def GetExplodeTime(self): + timeExplode = xRandom.randint(kMinExplodeTime,kMaxExplodeTime) + timeExplode = (float(timeExplode))/10 + return timeExplode + + + def OnBackdoorMsg(self, target, param): + timer = float(param) + if target == "fireworks1": + respFireworksLaunch1.run(self.key) + print "launch rocket 1" + PtAtTimeCallback(self.key,timer,2) + elif target == "fireworks2": + respFireworksLaunch2.run(self.key) + print "launch rocket 2" + PtAtTimeCallback(self.key,timer,4) + elif target == "fireworks3": + respFireworksLaunch3.run(self.key) + print "launch rocket 3" + PtAtTimeCallback(self.key,timer,6) + elif target == "fireworksall": + respFireworksLaunch1.run(self.key) + print "launch rocket 1" + PtAtTimeCallback(self.key,timer,2) + respFireworksLaunch2.run(self.key) + print "launch rocket 2" + PtAtTimeCallback(self.key,timer,4) + respFireworksLaunch3.run(self.key) + print "launch rocket 3" + PtAtTimeCallback(self.key,timer,6) + + diff --git a/Python/psnlMyCloset.py b/Python/psnlMyCloset.py new file mode 100644 index 0000000000..4238658e17 --- /dev/null +++ b/Python/psnlMyCloset.py @@ -0,0 +1,197 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: psnlMyCloset +Age: Personal Age +Date: March 2003 +Author: Bill Slease + +Updated in July 03 to link to ACA instead of showing GUI +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from PlasmaNetConstants import * +import PlasmaControlKeys +import string + +# --------- +# max wiring +# --------- + +actClosetOpen = ptAttribActivator(1, "Open Activator") +respClosetOpen = ptAttribResponder(2, "Open Responder", netForce=1) +actClosetClose = ptAttribActivator(3, "Close Activator") +respClosetClose = ptAttribResponder(4, "Close Responder", netForce=1) +objOpenClosetBlockers = ptAttribSceneobjectList(9,"Door Blockers") + +# --------- +# globals +# --------- + +kSDLClosetClosed = "psnlClosetClosed" +boolAmOwner = false + +AgeStartedIn = None + +kCloseClosetTimer = 99 +kVisitorDisableTimer = 100 + +class psnlMyCloset(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 5016 + self.version = 6 + + def __del__(self): + pass + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + global boolAmOwner + + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(kSDLClosetClosed,1,1) + ageSDL.sendToClients(kSDLClosetClosed) + + # register for notification of ClosetClosed SDL var changes + ageSDL.setNotify(self.key,kSDLClosetClosed,0.0) + + ################## + # Initialize the scene... # + ################## + + # if the owner is linking in: animate the closet closed if it's open, if we come from ACA, it will look right + # if we come from logging in, we link in at the dock and won't see the animation anyway + vault = ptVault() + if vault.amOwnerOfCurrentAge(): + boolAmOwner = true + PtDebugPrint("psnlCloset.OnServerInitComplete():\tWelcome Home!") + try: + closetClosed = ageSDL[kSDLClosetClosed][0] + except: + PtDebugPrint("psnlCloset.OnServerInitComplete():\tERROR reading SDL from vault, defaulting to closed (fastforward)") + self.ICloseCloset(1) + if not closetClosed: + # just close the door for now! + #self.ICloseCloset(1) + PtDebugPrint("psnlCloset.OnServerInitComplete():\tCloset is open, so setting a timer to close it") + self.IOpenCloset(1) # fast forward it open (in case it starts closed for some reason) + PtAtTimeCallback(self.key, 2, kCloseClosetTimer) # we will close it in two seconds + else: + PtDebugPrint("psnlCloset.OnServerInitComplete():\tCloset is closed, making sure the geometry matches") + self.ICloseCloset(1) # make sure the object is actually closed + else: # not the owner: disable clickables, set correct closet door state + PtDebugPrint("psnlCloset.OnServerInitComplete():\tWelcome Visitor") + PtAtTimeCallback(self.key, 1, kVisitorDisableTimer) # we will disable the clickables in a second, since disabling them now doesn't work + try: + closetClosed = ageSDL[kSDLClosetClosed][0] + except: + PtDebugPrint("psnlCloset.OnServerInitComplete():\tERROR reading SDL from vault, defaulting closed") + closetClosed = true + if not closetClosed: # assume closet is in use by owner + self.IOpenCloset(1) # fastforward the closet open + else: # either closet is closed, or I'm alone...if I'm alone we want to force it closed anyway so... + self.ICloseCloset(1) # fastforward the closet closed + return + + def IOpenCloset(self,ff=0,events=None): + vault = ptVault() + respClosetOpen.run(self.key,fastforward=ff,events=events) + if vault.amOwnerOfCurrentAge(): + ageSDL = PtGetAgeSDL() + ageSDL.setTagString(kSDLClosetClosed,"ignore") + ageSDL[kSDLClosetClosed] = (0,) + actClosetOpen.disable() + + def ICloseCloset(self,ff=0,events=None): + vault = ptVault() + respClosetClose.run(self.key,fastforward=ff,events=events) + if vault.amOwnerOfCurrentAge(): + ageSDL = PtGetAgeSDL() + ageSDL.setTagString(kSDLClosetClosed,"ignore") + ageSDL[kSDLClosetClosed] = (1,) + actClosetOpen.enable() + for obj in objOpenClosetBlockers.value: + obj.physics.suppress(true) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + # the closet doesn't really need to respond to SDL events...but in case I change my mind... + if VARname == kSDLClosetClosed: + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + PtDebugPrint("psnlClosetDoor.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d, playerID:%d" % (VARname,SDLname,tag,ageSDL[VARname][0],playerID)) + if tag == "ignore": + return + else: + PtDebugPrint("psnlClosetDoor.OnSDLNotify():\ttag not ignore, ignoring anyway :P") + return + + def OnNotify(self,state,id,events): + # open the closet + if id==actClosetOpen.id and state: + if AgeStartedIn == PtGetAgeName(): + self.IOpenCloset(events=events) + # closet has finished opening, handle the setup, and link out (if we were locally notified) + elif id==respClosetOpen.id and state: + for obj in objOpenClosetBlockers.value: + obj.physics.suppress(false) + if PtWasLocallyNotified(self.key): + self.ILinkToACA() # link to the ACA + + def OnTimer(self, id): + # are we trying to close the closet on link in? + if id == kCloseClosetTimer: + self.ICloseCloset() + elif id == kVisitorDisableTimer: + actClosetOpen.disable() + actClosetClose.disable() + + def OnControlKeyEvent(self,controlKey,activeFlag): + "exit closet" + if controlKey == PlasmaControlKeys.kKeyExitMode: + self.IExitCloset(false) + return + + def ILinkToACA(self): + PtDisableControlKeyEvents(self.key) + PtSendKIMessage(kDisableKIandBB,0) + PtDisableMovementKeys() + ageLink = ptAgeLinkStruct() + ageInfo = ageLink.getAgeInfo() + temp = ptAgeInfoStruct() + temp.copyFrom(ageInfo) + ageInfo = temp + ageInfo.setAgeFilename("AvatarCustomization") + ageLink.setAgeInfo(ageInfo) + ageLink.setLinkingRules(PtLinkingRules.kOriginalBook) + linkmgr = ptNetLinkingMgr() + linkmgr.linkToAge(ageLink) diff --git a/Python/psnlVaultSDLBoolRespond.py b/Python/psnlVaultSDLBoolRespond.py new file mode 100644 index 0000000000..a3e4e8f81e --- /dev/null +++ b/Python/psnlVaultSDLBoolRespond.py @@ -0,0 +1,125 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: psnlVaultSDLBoolRespond +Age: global +Date: August 2007 +Author: Adam Van Ornum (based on xAgeSDLBoolRespond.py) +Detects Psnl vault SDL bool type variable change and runs +one of two responders depending on new state +Use only in the Personal age +""" + +from Plasma import * +from PlasmaTypes import * +from xPsnlVaultSDL import * +import string + +# --------- +# max wiring +# --------- + +stringVarName = ptAttribString(1,"Psnl Vault SDL Var Name") +respBoolTrue = ptAttribResponder(2,"Run if bool true:") +respBoolFalse = ptAttribResponder(3,"Run if bool false:") +boolVltMgrFastForward = ptAttribBoolean(4,"F-Forward on VM notify", 1) +boolFFOnInit = ptAttribBoolean(5,"F-Forward on Init",1) +boolDefault = ptAttribBoolean(6,"Default setting",0) +boolFirstUpdate = ptAttribBoolean(7,"Init SDL On First Update?",0) + + + +class psnlVaultSDLBoolRespond(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 5352 + self.version = 1 + + def OnFirstUpdate(self): + PtDebugPrint("psnlVaultSDLBoolRespond.OnFirstUpdate():\t attached to sceneobject: %s" % self.sceneobject.getName()) + if not (type(stringVarName.value) == type("") and stringVarName.value != ""): + PtDebugPrint("ERROR: psnlVaultSDLBoolRespond.OnFirstUpdate():\tERROR: missing SDL var name") + pass + + if boolFirstUpdate.value == 1: + self.IFinishInit() + + def OnServerInitComplete(self): + if boolFirstUpdate.value == 0: + self.IFinishInit() + + def IFinishInit(self): + try: + ageSDL = xPsnlVaultSDL(1) + if type(stringVarName.value) == type("") and stringVarName.value != "": + if ageSDL[stringVarName.value][0]: + PtDebugPrint("DEBUG: psnlVaultSDLBoolRespond.IFinishInit():\tRunning true responder on %s, fastforward=%d" % (self.sceneobject.getName(), boolFFOnInit.value)) + respBoolTrue.run(self.key,fastforward=boolFFOnInit.value) + else: + PtDebugPrint("DEBUG: psnlVaultSDLBoolRespond.IFinishInit():\tRunning false responder on %s, fastforward=%d" % (self.sceneobject.getName(), boolFFOnInit.value)) + respBoolFalse.run(self.key,fastforward=boolFFOnInit.value) + else: + PtDebugPrint("ERROR: psnlVaultSDLBoolRespond.IFinishInit():\tERROR: missing SDL var name") + self.runDefault() + pass + except: + self.runDefault() + + + + def runDefault(self): + PtDebugPrint("psnlVaultSDLBoolRespond: running internal default") + if boolDefault.value: + respBoolTrue.run(self.key,fastforward=boolFFOnInit.value) + else: + respBoolFalse.run(self.key,fastforward=boolFFOnInit.value) + + # in case someone other than me changes my var(s) + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + + # is it a var we care about? + if VARname != stringVarName.value: + return + ageSDL = xPsnlVaultSDL(1) + PtDebugPrint("DEBUG: psnlVaultSDLBoolRespond.OnSDLNotify():\t VARname:%s, SDLname:%s, tag:%s, value:%d" % (VARname,SDLname,tag,ageSDL[stringVarName.value][0])) + + # is state change from player or vault manager? + if playerID: # non-zero means it's a player + objAvatar = ptSceneobject(PtGetAvatarKeyFromClientID(playerID),self.key) + fastforward = 0 + else: # invalid player aka Vault Manager + objAvatar = None + fastforward = boolVltMgrFastForward.value # we need to skip any one-shots + PtDebugPrint("DEBUG: psnlVaultSDLBoolRespond.OnSDLNotify():\tnotification from playerID: %d" % (playerID)) + + # run the appropriate responder! + if ageSDL[stringVarName.value][0]: + PtDebugPrint("DEBUG: psnlVaultSDLBoolRespond.OnSDLNotify:\tRunning true responder on %s, fastforward=%d" % (self.sceneobject.getName(), fastforward)) + respBoolTrue.run(self.key,avatar=objAvatar,fastforward=fastforward) + else: + PtDebugPrint("DEBUG: psnlVaultSDLBoolRespond.OnSDLNotify:\tRunning false responder on %s, fastforward=%d" % (self.sceneobject.getName(), fastforward)) + respBoolFalse.run(self.key,avatar=objAvatar,fastforward=fastforward) diff --git a/Python/psnlVaultSDLBoolShowHide.py b/Python/psnlVaultSDLBoolShowHide.py new file mode 100644 index 0000000000..24fd2feb33 --- /dev/null +++ b/Python/psnlVaultSDLBoolShowHide.py @@ -0,0 +1,126 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: psnlVaultSDLBoolShowHide +Age: global +Date: August 2007 +Author: Adam Van Ornum (based on xAgeSDLBoolShowHide) +Detects Psnl Vault SDL bool type variable change and shows (on true) or hides (on false) the object it's attached to +Use only in the Personal age +""" + +from Plasma import * +from PlasmaTypes import * +from xPsnlVaultSDL import * +import string + +stringVarName = ptAttribString(1,"Psnl SDL Var Name") +boolShowOnTrue = ptAttribBoolean(2,"Show on true",1) +boolDefault = ptAttribBoolean(3,"Default setting",0) +boolFirstUpdate = ptAttribBoolean(4,"Eval On First Update?",0) + +class psnlVaultSDLBoolShowHide(ptMultiModifier): + + def __init__(self): + ptMultiModifier.__init__(self) + self.id = 5351 + self.version = 1 + + def OnFirstUpdate(self): + if not (type(stringVarName.value) == type("") and stringVarName.value != ""): + PtDebugPrint("ERROR: psnlVaultSDLBoolShowHide.OnFirstUpdate():\tERROR: missing SDL var name on %s" % self.sceneobject.getName()) + pass + + if boolFirstUpdate.value: + try: + ageSDL = xPsnlVaultSDL(1) + if type(stringVarName.value) == type("") and stringVarName.value != "": + if not (ageSDL[stringVarName.value][0] ^ boolShowOnTrue.value): + self.EnableObject() + else: + self.DisableObject() + else: + PtDebugPrint("ERROR: psnlVaultSDLBoolShowHide.OnServerInitComplete():\tERROR: missing SDL var name on %s" % self.sceneobject.getName()) + self.runDefault() + except: + self.runDefault() + + def OnServerInitComplete(self): + if not boolFirstUpdate.value: + try: + ageSDL = xPsnlVaultSDL(1) + if type(stringVarName.value) == type("") and stringVarName.value != "": + if not (ageSDL[stringVarName.value][0] ^ boolShowOnTrue.value): + self.EnableObject() + else: + self.DisableObject() + else: + PtDebugPrint("ERROR: psnlVaultSDLBoolShowHide.OnServerInitComplete():\tERROR: missing SDL var name on %s" % self.sceneobject.getName()) + self.runDefault() + except: + self.runDefault() + + def runDefault(self): + PtDebugPrint("psnlVaultSDLBoolShowHide: running internal default") + if boolDefault.value: + self.EnableObject() + else: + self.DisableObject() + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + if VARname != stringVarName.value: + return + ageSDL = xPsnlVaultSDL(1) + #PtDebugPrint("Received SDLNotify on %s" % self.sceneobject.getName()) + try: + if not (ageSDL[stringVarName.value][0] ^ boolShowOnTrue.value): + self.EnableObject() + else: + self.DisableObject() + except: + PtDebugPrint("ERROR: psnlVaultSDLBoolShowHide.OnServerInitComplete():\tERROR reading age SDL on %s" % self.sceneobject.getName()) + pass + + def EnableObject(self): + PtDebugPrint("DEBUG: psnlVaultSDLBoolShowHide.EnableObject: Attempting to enable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.enable() + self.sceneobject.physics.suppress(false) + + def DisableObject(self): + PtDebugPrint("DEBUG: psnlVaultSDLBoolShowHide.DisableObject: Attempting to disable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.disable() + self.sceneobject.physics.suppress(true) + + def OnBackdoorMsg(self, target, param): + if type(stringVarName.value) != type(None) and stringVarName.value != "": + if target == stringVarName.value: + if param.lower() in ("on", "1", "true"): + self.EnableObject() + elif param.lower() in ("off", "0", "false"): + self.DisableObject() + else: + PtDebugPrint("DEBUG: psnlVaultSDLBoolShowHide.OnBackDoorMsg: Received unexpected parameter on %s" % self.sceneobject.getName()) + pass diff --git a/Python/psnlYeeshaPageChanges.py b/Python/psnlYeeshaPageChanges.py new file mode 100644 index 0000000000..428b1f1727 --- /dev/null +++ b/Python/psnlYeeshaPageChanges.py @@ -0,0 +1,270 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: psnlYeeshaPageChanges +Age: Personal Age +Date: January 2002 +Author: Doug McBride +Customizes a player's Personal Age based on which Yeesha Pages he's found +""" + +from Plasma import * +from PlasmaTypes import * +from PlasmaVaultConstants import * +from PlasmaNetConstants import * +from xPsnlVaultSDL import * +import string + +PageNumber = ptAttribInt(1, "Yeesha Page Number") +stringShowStates = ptAttribString(2,"States in which shown") +respAudioStart = ptAttribResponder(3,"Audio start responder") +respAudioStop = ptAttribResponder(4,"Audio stop responder") + +respEnable = ptAttribResponder(5, "Enabled resp (if necessary)") +respDisable = ptAttribResponder(6, "Disabled resp (if necessary)") + +#globals +TotalPossibleYeeshaPages = 25 +HideCleftPole = 0 + + +class psnlYeeshaPageChanges(ptMultiModifier): + "The Yeesha Page Customization code" + def __init__(self): + ptMultiModifier.__init__(self) + self.id = 5232 + version = 7 + self.version = version + PtDebugPrint("__init__psnlYeeshaPageChanges v%d.%d" % (version,1),level=kWarningLevel) + +# Yeesha Pages available: +# +#0 (YeeshaPage01) sun and moon addition +#1 (YeeshaPage02) waterfall addition +#2 (YeeshaPage03) hut decal / interior rug addition +#3 (YeeshaPage04a) hut roof modification (swap) +#4 (YeeshaPage05) jumping pinnacles addition (swap) +#5 (YeeshaPage06) man-made dock addition +#6 (YeeshaPage07) kickable physical addition +#7 (YeeshaPage08) imager addition (needs KI wiring) +#8 (YeeshaPage09) music player +#9 (YeeshaPage10a - j) treegate tree (multi-swap) +#11 (YeeshaPage12) weather stuff +#~ psnlZandiVis (all Ypages, plus chair, shirt, books...) +#~ (YeeshaPage20) page the second bookcase (swap) +#~ (YeeshaPage13) butterflies +#~ (YeeshaPage14) fireplace +#~ (YeeshaPage15) bench +#~ (YeeshaPage16) firemarbles +#~ (YeeshaPage17) lush +#~ (YeeshaPage18) clock +#~ (YeeshaPage19) birds +#~ (YeeshaPage20) bridge to calendar pinnacle +#~ (YeeshaPage21) leaf (maple trees) +#~ (YeeshaPage22) grass +#~ (YeeshaPage24) thunderstorm +#~ (YeeshaPage25) Bahro poles/totems + +#Meaning of SDL values for each Yeesha Page: +# +#~ 0 - Page not found +#~ 1 - Page found and active +#~ 2 - Page found and inactive +#~ 3 - Page found, active, and pending inactive when age emptied +#~ 4 - Page found, inactive, and pending active when age emptied + + + def OnFirstUpdate(self): + try: + self.enabledStateList = stringShowStates.value.split(",") + for i in range(len(self.enabledStateList)): + self.enabledStateList[i] = int(self.enabledStateList[i].strip()) + except: + PtDebugPrint("xAgeSDLIntActEnabler.OnFirstUpdate():\tERROR: couldn't process start state list") + + + def OnServerInitComplete(self): + "PlayerBook - determine what Yeesha pages are found" + global TotalPossibleYeeshaPages + global HideCleftPole + FoundYPs = [ ] + CurrentPage = 0 + + AgeVault = ptAgeVault() + if type(AgeVault) != type(None): #is the Vault online? + + self.ageSDL = AgeVault.getAgeSDL() + if self.ageSDL: + try: + SDLVar = self.ageSDL.findVar("YeeshaPage" + str(PageNumber.value)) + CurrentValue = SDLVar.getInt() + #PtDebugPrint("psnlYeeshaPageChanges.OnServerInitComplete:\tYeeshaPage%d = %d" % (PageNumber.value, SDLVar.getInt())) + except: + PtDebugPrint("psnlYeeshaPageChanges:\tERROR reading age SDLVar. Assuming CurrentValue = 0") + CurrentValue = 0 + + + if PageNumber.value == 10: + MAX_SIZE = 10 + size, state = divmod(CurrentValue, 10) + + if len(PtGetPlayerList()) == 0 and state != 0: + growSizes = self.TimeToGrow() + PtDebugPrint("Growsizes: %d" % growSizes) + if growSizes and size < MAX_SIZE: + size = size + growSizes + if size > MAX_SIZE: + size = MAX_SIZE + sizechanged = 1 + elif size > MAX_SIZE: + size = MAX_SIZE + sizechanged = 1 + else: + sizechanged = 0 + + newstate = self.UpdateState(state, size, SDLVar, AgeVault, sizechanged) + else: + newstate = state + + PtDebugPrint("CurrentValue: %d, size: %d, state %d" % (CurrentValue, size, state)) + self.EnableDisable( (size * 10) + newstate ) + + else: + if PageNumber.value == 25: + if self.enabledStateList == [0, 2, 4]: + try: + ageSDL = xPsnlVaultSDL(1) + + if type(ageSDL) != type(None): + sdllist = ageSDL.BatchGet( ["TeledahnPoleState", "GardenPoleState", "GarrisonPoleState", "KadishPoleState"] ) + pole1 = sdllist["TeledahnPoleState"] + pole2 = sdllist["GardenPoleState"] + pole3 = sdllist["GarrisonPoleState"] + pole4 = sdllist["KadishPoleState"] + if (pole1 in [7,8]) and (pole2 in [7,8]) and (pole3 in [7,8]) and (pole4 in [7,8]): + val = ageSDL["CleftVisited"][0] + if not val: + HideCleftPole = 1 + print "psnlYeeshaPageChanges.OnServerInitComplete():\t Fissure is open, so setting HideCleftPole = ",HideCleftPole + else: + PtDebugPrint("ERROR: psnlYeeshaPageChanges.OnServerInitComplete():\tProblem trying to access age SDLs for Bahro poles") + pass + + except: + PtDebugPrint("ERROR: psnlYeeshaPageChanges.OnServerInitComplete():\tException occurred trying to access age SDL") + + if len(PtGetPlayerList()) == 0: + newstate = self.UpdateState(CurrentValue, 0, SDLVar, AgeVault, 0) + else: + newstate = CurrentValue + + self.EnableDisable(newstate) + + #There is only one object in Yeesha Page 5 with a value of 0, so I'm temporarily nestling my print statement here... + if PageNumber.value == 5 and stringShowStates.value == "0": + print "psnlYeeshaPageChanges: You've found the following Yeesha Pages:" + for thispage in range(1,TotalPossibleYeeshaPages+1): + FoundValue = self.ageSDL.findVar("YeeshaPage" + str(thispage)) + PtDebugPrint ("\t The previous value of the SDL variable %s is %s" % ("YeeshaPage" + str(thispage), FoundValue.getInt())) + if type(FoundValue) != type(None) and FoundValue.getInt() != 0: + PtDebugPrint ("psnlYeeshaPageChanges: You have found Yeesha Page # %s." % (thispage)) + + else: + PtDebugPrint("psnlYeeshaPageChanges: Error trying to access the Chronicle self.ageSDL. self.ageSDL = %s" % ( self.ageSDL)) + else: + PtDebugPrint("psnlYeeshaPageChanges: Error trying to access the Vault. Can't access YeeshaPageChanges chronicle.") + + + def EnableDisable(self, val): + if val in self.enabledStateList: + if PageNumber.value == 10: + PtDebugPrint("psnlYeeshaPageChanges: Attempting to enable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.enable() + self.sceneobject.physics.suppress(false) + else: + if HideCleftPole: + PtDebugPrint("psnlYeeshaPageChanges.EnableDisable():\tFissure is open and Totem yeesha page is set 'off', so we gotta get rid of the Cleft pole for now") + self.sceneobject.draw.disable() + self.sceneobject.physics.suppress(true) + else: + #PtDebugPrint("psnlYeeshaPageChanges: Attempting to enable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.enable() + self.sceneobject.physics.suppress(false) + + respAudioStart.run(self.key,avatar=None,fastforward=0) + respEnable.run(self.key,avatar=None,fastforward=0) + else: + if PageNumber.value == 10: + PtDebugPrint("psnlYeeshaPageChanges: Attempting to disable drawing and collision on %s..." % self.sceneobject.getName()) + self.sceneobject.draw.disable() + self.sceneobject.physics.suppress(true) + + respAudioStop.run(self.key,avatar=None,fastforward=0) + respDisable.run(self.key,avatar=None,fastforward=1) + + + def TimeToGrow(self): + dayLength = 86400 # number of seconds in a day + sdl = PtGetAgeSDL() + + currentTime = PtGetDniTime() + lastGrowth = sdl["YP10LastTreeGrowth"][0] + + PtDebugPrint("Dni time: %d, last growth: %d" % (currentTime, lastGrowth)) + + if lastGrowth == 0: + sizes = 1 + else: + timeDelta = currentTime - lastGrowth + # grows every 30 days + #sizes = timeDelta / (dayLength * 30) + + # grows every day + sizes = timeDelta / (dayLength * 15) + + if sizes > 0: + sdl["YP10LastTreeGrowth"] = (currentTime,) + + return sizes + + + def UpdateState(self, state, size, SDLVar, AgeVault, sizechanged): + #~ print "No one else is here. Affecting any YP changes you've queued." + if state == 3: + state = 2 + print "psnlYeeshaPageChanges: Updated value of YeeshaPage %s from 3 to 2." % ("YeeshaPage" + str(PageNumber.value)) + SDLVar.setInt( (size * 10) + state) + AgeVault.updateAgeSDL(self.ageSDL) + + elif state == 4 or state > 4: + state = 1 + print "psnlYeeshaPageChanges: Updated value of YeeshaPage %s from 4 to 1." % ("YeeshaPage" + str(PageNumber.value)) + SDLVar.setInt( (size * 10) + state) + AgeVault.updateAgeSDL(self.ageSDL) + elif sizechanged: + SDLVar.setInt( (size * 10) + state) + AgeVault.updateAgeSDL(self.ageSDL) + return state diff --git a/Python/stupStartUp.py b/Python/stupStartUp.py new file mode 100644 index 0000000000..8c8c991c20 --- /dev/null +++ b/Python/stupStartUp.py @@ -0,0 +1,100 @@ +""" *==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + + *==LICENSE==* """ +""" +Module: stupStartUp +Age: StartUp +Date: March 2006 +Author: Derek Odell +launch start up sequence +""" + +from Plasma import * +from PlasmaTypes import * + +# define the attributes that will be entered in max +Camera = ptAttribSceneobject(1,"Camera") + +#==================================== + +class stupStartUp(ptResponder): + ########################### + def __init__(self): + ptResponder.__init__(self) + self.id = 5339 + self.version = 1 + print "stupStartUp: init version = %d" % self.version + + ########################### + def OnFirstUpdate(self): + PtLoadDialog("GUIDialog04a") + PtLoadDialog("GUIDialog04b") + PtLoadDialog("GUIDialog04c") + PtLoadDialog("GUIDialog04d") + PtLoadDialog("GUIDialog05") + PtLoadDialog("GUIDialog06") + PtLoadDialog("GUIDialog06a") + + + def __del__(self): + PtUnloadDialog("GUIDialog04a") + PtUnloadDialog("GUIDialog04b") + PtUnloadDialog("GUIDialog04c") + PtUnloadDialog("GUIDialog04d") + PtUnloadDialog("GUIDialog05") + PtUnloadDialog("GUIDialog06") + PtUnloadDialog("GUIDialog06a") + + + ########################### + def OnServerInitComplete(self): + if PtIsActivePlayerSet(): + PtSetActivePlayer(0) + + avatar = PtGetLocalAvatar() + avatar.physics.suppress(true) + + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + virtCam = ptCamera() + virtCam.save(Camera.sceneobject.getKey()) + + playerList = PtGetAccountPlayerList() + + if PtIsSubscriptionActive(): + print "stupStartUp: Paying customer" + if playerList[0] or len(playerList) > 1: + PtShowDialog("GUIDialog04b") + else: + PtShowDialog("GUIDialog06") + else: + print "stupStartUp: Visitor" + if playerList[0] or len(playerList) > 1: + PtShowDialog("GUIDialog04a") + else: + PtShowDialog("GUIDialog06") + \ No newline at end of file diff --git a/Python/system/Bastion.py b/Python/system/Bastion.py new file mode 100644 index 0000000000..ae2db74ca3 --- /dev/null +++ b/Python/system/Bastion.py @@ -0,0 +1,177 @@ +"""Bastionification utility. + +A bastion (for another object -- the 'original') is an object that has +the same methods as the original but does not give access to its +instance variables. Bastions have a number of uses, but the most +obvious one is to provide code executing in restricted mode with a +safe interface to an object implemented in unrestricted mode. + +The bastionification routine has an optional second argument which is +a filter function. Only those methods for which the filter method +(called with the method name as argument) returns true are accessible. +The default filter method returns true unless the method name begins +with an underscore. + +There are a number of possible implementations of bastions. We use a +'lazy' approach where the bastion's __getattr__() discipline does all +the work for a particular method the first time it is used. This is +usually fastest, especially if the user doesn't call all available +methods. The retrieved methods are stored as instance variables of +the bastion, so the overhead is only occurred on the first use of each +method. + +Detail: the bastion class has a __repr__() discipline which includes +the repr() of the original object. This is precomputed when the +bastion is created. + +""" + +__all__ = ["BastionClass", "Bastion"] + +from types import MethodType + + +class BastionClass: + + """Helper class used by the Bastion() function. + + You could subclass this and pass the subclass as the bastionclass + argument to the Bastion() function, as long as the constructor has + the same signature (a get() function and a name for the object). + + """ + + def __init__(self, get, name): + """Constructor. + + Arguments: + + get - a function that gets the attribute value (by name) + name - a human-readable name for the original object + (suggestion: use repr(object)) + + """ + self._get_ = get + self._name_ = name + + def __repr__(self): + """Return a representation string. + + This includes the name passed in to the constructor, so that + if you print the bastion during debugging, at least you have + some idea of what it is. + + """ + return "" % self._name_ + + def __getattr__(self, name): + """Get an as-yet undefined attribute value. + + This calls the get() function that was passed to the + constructor. The result is stored as an instance variable so + that the next time the same attribute is requested, + __getattr__() won't be invoked. + + If the get() function raises an exception, this is simply + passed on -- exceptions are not cached. + + """ + attribute = self._get_(name) + self.__dict__[name] = attribute + return attribute + + +def Bastion(object, filter = lambda name: name[:1] != '_', + name=None, bastionclass=BastionClass): + """Create a bastion for an object, using an optional filter. + + See the Bastion module's documentation for background. + + Arguments: + + object - the original object + filter - a predicate that decides whether a function name is OK; + by default all names are OK that don't start with '_' + name - the name of the object; default repr(object) + bastionclass - class used to create the bastion; default BastionClass + + """ + + raise RuntimeError, "This code is not secure in Python 2.2 and 2.3" + + # Note: we define *two* ad-hoc functions here, get1 and get2. + # Both are intended to be called in the same way: get(name). + # It is clear that the real work (getting the attribute + # from the object and calling the filter) is done in get1. + # Why can't we pass get1 to the bastion? Because the user + # would be able to override the filter argument! With get2, + # overriding the default argument is no security loophole: + # all it does is call it. + # Also notice that we can't place the object and filter as + # instance variables on the bastion object itself, since + # the user has full access to all instance variables! + + def get1(name, object=object, filter=filter): + """Internal function for Bastion(). See source comments.""" + if filter(name): + attribute = getattr(object, name) + if type(attribute) == MethodType: + return attribute + raise AttributeError, name + + def get2(name, get1=get1): + """Internal function for Bastion(). See source comments.""" + return get1(name) + + if name is None: + name = `object` + return bastionclass(get2, name) + + +def _test(): + """Test the Bastion() function.""" + class Original: + def __init__(self): + self.sum = 0 + def add(self, n): + self._add(n) + def _add(self, n): + self.sum = self.sum + n + def total(self): + return self.sum + o = Original() + b = Bastion(o) + testcode = """if 1: + b.add(81) + b.add(18) + print "b.total() =", b.total() + try: + print "b.sum =", b.sum, + except: + print "inaccessible" + else: + print "accessible" + try: + print "b._add =", b._add, + except: + print "inaccessible" + else: + print "accessible" + try: + print "b._get_.func_defaults =", map(type, b._get_.func_defaults), + except: + print "inaccessible" + else: + print "accessible" + \n""" + exec testcode + print '='*20, "Using rexec:", '='*20 + import rexec + r = rexec.RExec() + m = r.add_module('__main__') + m.b = b + r.r_exec(testcode) + + +if __name__ == '__main__': + _test() diff --git a/Python/system/ConfigParser.py b/Python/system/ConfigParser.py new file mode 100644 index 0000000000..d98993af33 --- /dev/null +++ b/Python/system/ConfigParser.py @@ -0,0 +1,616 @@ +"""Configuration file parser. + +A setup file consists of sections, lead by a "[section]" header, +and followed by "name: value" entries, with continuations and such in +the style of RFC 822. + +The option values can contain format strings which refer to other values in +the same section, or values in a special [DEFAULT] section. + +For example: + + something: %(dir)s/whatever + +would resolve the "%(dir)s" to the value of dir. All reference +expansions are done late, on demand. + +Intrinsic defaults can be specified by passing them into the +ConfigParser constructor as a dictionary. + +class: + +ConfigParser -- responsible for parsing a list of + configuration files, and managing the parsed database. + + methods: + + __init__(defaults=None) + create the parser and specify a dictionary of intrinsic defaults. The + keys must be strings, the values must be appropriate for %()s string + interpolation. Note that `__name__' is always an intrinsic default; + it's value is the section's name. + + sections() + return all the configuration section names, sans DEFAULT + + has_section(section) + return whether the given section exists + + has_option(section, option) + return whether the given option exists in the given section + + options(section) + return list of configuration options for the named section + + read(filenames) + read and parse the list of named configuration files, given by + name. A single filename is also allowed. Non-existing files + are ignored. + + readfp(fp, filename=None) + read and parse one configuration file, given as a file object. + The filename defaults to fp.name; it is only used in error + messages (if fp has no `name' attribute, the string `' is used). + + get(section, option, raw=False, vars=None) + return a string value for the named option. All % interpolations are + expanded in the return values, based on the defaults passed into the + constructor and the DEFAULT section. Additional substitutions may be + provided using the `vars' argument, which must be a dictionary whose + contents override any pre-existing defaults. + + getint(section, options) + like get(), but convert value to an integer + + getfloat(section, options) + like get(), but convert value to a float + + getboolean(section, options) + like get(), but convert value to a boolean (currently case + insensitively defined as 0, false, no, off for False, and 1, true, + yes, on for True). Returns False or True. + + items(section, raw=False, vars=None) + return a list of tuples with (name, value) for each option + in the section. + + remove_section(section) + remove the given file section and all its options + + remove_option(section, option) + remove the given option from the given section + + set(section, option, value) + set the given option + + write(fp) + write the configuration state in .ini format +""" + +import re + +__all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError", + "InterpolationError", "InterpolationDepthError", + "InterpolationSyntaxError", "ParsingError", + "MissingSectionHeaderError", "ConfigParser", "SafeConfigParser", + "DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"] + +DEFAULTSECT = "DEFAULT" + +MAX_INTERPOLATION_DEPTH = 10 + + + +# exception classes +class Error(Exception): + """Base class for ConfigParser exceptions.""" + + def __init__(self, msg=''): + self.message = msg + Exception.__init__(self, msg) + + def __repr__(self): + return self.message + + __str__ = __repr__ + +class NoSectionError(Error): + """Raised when no section matches a requested option.""" + + def __init__(self, section): + Error.__init__(self, 'No section: ' + `section`) + self.section = section + +class DuplicateSectionError(Error): + """Raised when a section is multiply-created.""" + + def __init__(self, section): + Error.__init__(self, "Section %r already exists" % section) + self.section = section + +class NoOptionError(Error): + """A requested option was not found.""" + + def __init__(self, option, section): + Error.__init__(self, "No option %r in section: %r" % + (option, section)) + self.option = option + self.section = section + +class InterpolationError(Error): + """Base class for interpolation-related exceptions.""" + + def __init__(self, option, section, msg): + Error.__init__(self, msg) + self.option = option + self.section = section + +class InterpolationMissingOptionError(InterpolationError): + """A string substitution required a setting which was not available.""" + + def __init__(self, option, section, rawval, reference): + msg = ("Bad value substitution:\n" + "\tsection: [%s]\n" + "\toption : %s\n" + "\tkey : %s\n" + "\trawval : %s\n" + % (section, option, reference, rawval)) + InterpolationError.__init__(self, option, section, msg) + self.reference = reference + +class InterpolationSyntaxError(InterpolationError): + """Raised when the source text into which substitutions are made + does not conform to the required syntax.""" + +class InterpolationDepthError(InterpolationError): + """Raised when substitutions are nested too deeply.""" + + def __init__(self, option, section, rawval): + msg = ("Value interpolation too deeply recursive:\n" + "\tsection: [%s]\n" + "\toption : %s\n" + "\trawval : %s\n" + % (section, option, rawval)) + InterpolationError.__init__(self, option, section, msg) + +class ParsingError(Error): + """Raised when a configuration file does not follow legal syntax.""" + + def __init__(self, filename): + Error.__init__(self, 'File contains parsing errors: %s' % filename) + self.filename = filename + self.errors = [] + + def append(self, lineno, line): + self.errors.append((lineno, line)) + self.message += '\n\t[line %2d]: %s' % (lineno, line) + +class MissingSectionHeaderError(ParsingError): + """Raised when a key-value pair is found before any section header.""" + + def __init__(self, filename, lineno, line): + Error.__init__( + self, + 'File contains no section headers.\nfile: %s, line: %d\n%s' % + (filename, lineno, line)) + self.filename = filename + self.lineno = lineno + self.line = line + + + +class RawConfigParser: + def __init__(self, defaults=None): + self._sections = {} + if defaults is None: + self._defaults = {} + else: + self._defaults = defaults + + def defaults(self): + return self._defaults + + def sections(self): + """Return a list of section names, excluding [DEFAULT]""" + # self._sections will never have [DEFAULT] in it + return self._sections.keys() + + def add_section(self, section): + """Create a new section in the configuration. + + Raise DuplicateSectionError if a section by the specified name + already exists. + """ + if section in self._sections: + raise DuplicateSectionError(section) + self._sections[section] = {} + + def has_section(self, section): + """Indicate whether the named section is present in the configuration. + + The DEFAULT section is not acknowledged. + """ + return section in self._sections + + def options(self, section): + """Return a list of option names for the given section name.""" + try: + opts = self._sections[section].copy() + except KeyError: + raise NoSectionError(section) + opts.update(self._defaults) + if '__name__' in opts: + del opts['__name__'] + return opts.keys() + + def read(self, filenames): + """Read and parse a filename or a list of filenames. + + Files that cannot be opened are silently ignored; this is + designed so that you can specify a list of potential + configuration file locations (e.g. current directory, user's + home directory, systemwide directory), and all existing + configuration files in the list will be read. A single + filename may also be given. + """ + if isinstance(filenames, basestring): + filenames = [filenames] + for filename in filenames: + try: + fp = open(filename) + except IOError: + continue + self._read(fp, filename) + fp.close() + + def readfp(self, fp, filename=None): + """Like read() but the argument must be a file-like object. + + The `fp' argument must have a `readline' method. Optional + second argument is the `filename', which if not given, is + taken from fp.name. If fp has no `name' attribute, `' is + used. + + """ + if filename is None: + try: + filename = fp.name + except AttributeError: + filename = '' + self._read(fp, filename) + + def get(self, section, option): + opt = self.optionxform(option) + if section not in self._sections: + if section != DEFAULTSECT: + raise NoSectionError(section) + if opt in self._defaults: + return self._defaults[opt] + else: + raise NoOptionError(option, section) + elif opt in self._sections[section]: + return self._sections[section][opt] + elif opt in self._defaults: + return self._defaults[opt] + else: + raise NoOptionError(option, section) + + def items(self, section): + try: + d2 = self._sections[section] + except KeyError: + if section != DEFAULTSECT: + raise NoSectionError(section) + d2 = {} + d = self._defaults.copy() + d.update(d2) + if "__name__" in d: + del d["__name__"] + return d.items() + + def _get(self, section, conv, option): + return conv(self.get(section, option)) + + def getint(self, section, option): + return self._get(section, int, option) + + def getfloat(self, section, option): + return self._get(section, float, option) + + _boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True, + '0': False, 'no': False, 'false': False, 'off': False} + + def getboolean(self, section, option): + v = self.get(section, option) + if v.lower() not in self._boolean_states: + raise ValueError, 'Not a boolean: %s' % v + return self._boolean_states[v.lower()] + + def optionxform(self, optionstr): + return optionstr.lower() + + def has_option(self, section, option): + """Check for the existence of a given option in a given section.""" + if not section or section == DEFAULTSECT: + option = self.optionxform(option) + return option in self._defaults + elif section not in self._sections: + return False + else: + option = self.optionxform(option) + return (option in self._sections[section] + or option in self._defaults) + + def set(self, section, option, value): + """Set an option.""" + if not section or section == DEFAULTSECT: + sectdict = self._defaults + else: + try: + sectdict = self._sections[section] + except KeyError: + raise NoSectionError(section) + sectdict[self.optionxform(option)] = value + + def write(self, fp): + """Write an .ini-format representation of the configuration state.""" + if self._defaults: + fp.write("[%s]\n" % DEFAULTSECT) + for (key, value) in self._defaults.items(): + fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) + fp.write("\n") + for section in self._sections: + fp.write("[%s]\n" % section) + for (key, value) in self._sections[section].items(): + if key != "__name__": + fp.write("%s = %s\n" % + (key, str(value).replace('\n', '\n\t'))) + fp.write("\n") + + def remove_option(self, section, option): + """Remove an option.""" + if not section or section == DEFAULTSECT: + sectdict = self._defaults + else: + try: + sectdict = self._sections[section] + except KeyError: + raise NoSectionError(section) + option = self.optionxform(option) + existed = option in sectdict + if existed: + del sectdict[option] + return existed + + def remove_section(self, section): + """Remove a file section.""" + existed = section in self._sections + if existed: + del self._sections[section] + return existed + + # + # Regular expressions for parsing section headers and options. + # + SECTCRE = re.compile( + r'\[' # [ + r'(?P

[^]]+)' # very permissive! + r'\]' # ] + ) + OPTCRE = re.compile( + r'(?P