2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-13 18:17:49 -04:00

CWE Directory Reorganization

Rearrange directory structure of CWE to be loosely equivalent to
the H'uru Plasma repository.

Part 1: Movement of directories and files.
This commit is contained in:
rarified
2021-05-15 12:49:46 -06:00
parent c3f4a640a3
commit 96903e8dca
4002 changed files with 159 additions and 644 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,274 @@
""" *==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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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)"""
kFloat = 1
kKey = 2
kInt = 3
kNull = 4
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

View File

@ -0,0 +1,124 @@
""" *==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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,175 @@
""" *==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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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

View File

@ -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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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

View File

@ -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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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

View File

@ -0,0 +1,840 @@
""" *==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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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.kFloat
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] == PtNotifyDataType.kFloat:
notify.addVarFloat(event[1],event[3])
elif event[2] == PtNotifyDataType.kInt:
notify.addVarInt(event[1],event[3])
elif event[2] == PtNotifyDataType.kNull:
notify.addVarNull(event[1])
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 <someone>
####################################
# 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)

View File

@ -0,0 +1,114 @@
""" *==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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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

View File

@ -0,0 +1,224 @@
""" *==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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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

View File

@ -0,0 +1,302 @@
""" *==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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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]

View File

@ -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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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