diff --git a/Scripts/.gitignore b/Scripts/.gitignore new file mode 100644 index 0000000000..e47b06b9e8 --- /dev/null +++ b/Scripts/.gitignore @@ -0,0 +1,3 @@ +*.pyc +*.pyo +.*.swp diff --git a/Scripts/Python/Ahnonay.py b/Scripts/Python/Ahnonay.py new file mode 100644 index 0000000000..913bfdd3fa --- /dev/null +++ b/Scripts/Python/Ahnonay.py @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("Ahnonay.OnServerInitComplete(): Link Chron already exists: %s" % (linkid.getValue())) + elif chron and chron.getName() == "AhnonayLocked": + locked = chron + PtDebugPrint("Ahnonay.OnServerInitComplete(): Locked Chron already exists: %s" % (locked.getValue())) + elif chron and chron.getName() == "AhnonayVolatile": + volatile = chron + PtDebugPrint("Ahnonay.OnServerInitComplete(): Volatile Chron already exists: %s" % (volatile.getValue())) + elif chron and chron.getName() == "AhnonaySpawnPoints": + spawn = chron + PtDebugPrint("Ahnonay.OnServerInitComplete(): Spawn Chron already exists: %s" % (spawn.getValue())) + elif chron and chron.getName() == "AhnonayOwner": + owner = chron + break + + if owner == None: + PtDebugPrint("I am not the age owner, and I don't have my own Ahnonay") + elif owner.getValue() == myID: + if linkid == None: + PtDebugPrint("Ahnonay.OnServerInitComplete(): Link Chron not found, creating") + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("AhnonayLink") + newNode.chronicleSetValue(guid) + ageDataFolder.addNode(newNode) + + if locked == None: + PtDebugPrint("Ahnonay.OnServerInitComplete(): Locked Chron not found, creating") + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("AhnonayLocked") + newNode.chronicleSetValue("1") + ageDataFolder.addNode(newNode) + + if volatile == None: + PtDebugPrint("Ahnonay.OnServerInitComplete(): Volatile Chron not found, creating") + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("AhnonayVolatile") + newNode.chronicleSetValue("0") + ageDataFolder.addNode(newNode) + + if spawn == None: + PtDebugPrint("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(): + PtDebugPrint("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: + PtDebugPrint("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": + PtDebugPrint("linking to hub or hut") + newSphere = 4 + else: + offset = str(ageSDL["ahnyCurrentOffset"][0]) + PtDebugPrint("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 + PtDebugPrint(u"Ahnonay.OnPageLoad(): what={} who={}".format(what, who), level=kDebugDumpLevel) + + if what == kLoaded: + if who in spherePages: + ageSDL = PtGetAgeSDL() + sphere = str(ageSDL["ahnyCurrentSphere"][0]) + offset = str(ageSDL["ahnyCurrentOffset"][0]) + PtDebugPrint("Ahnonay.OnPageLoad(): Sphere0{} loaded with offset:{}".format(sphere, offset), level=kWarningLevel) + + linkmgr = ptNetLinkingMgr() + link = linkmgr.getCurrAgeLink() + spawnPoint = link.getSpawnPoint() + + spTitle = spawnPoint.getTitle() + spName = spawnPoint.getName() + + if spTitle == "SCSavePoint": + if spName == "SaveClothPoint7" or spName == "SaveClothPoint8": + PtDebugPrint("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/Scripts/Python/AhnonayCathedral.py b/Scripts/Python/AhnonayCathedral.py new file mode 100644 index 0000000000..3f79690e9a --- /dev/null +++ b/Scripts/Python/AhnonayCathedral.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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(): + PtDebugPrint("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/Scripts/Python/AhnyVogondolaRide.py b/Scripts/Python/AhnyVogondolaRide.py new file mode 100644 index 0000000000..0f5894ca48 --- /dev/null +++ b/Scripts/Python/AhnyVogondolaRide.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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) + PtDebugPrint("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) + PtDebugPrint("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()) + PtDebugPrint("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) + PtDebugPrint("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()) + PtDebugPrint("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()) + PtDebugPrint("ejecting at the hut") + + + \ No newline at end of file diff --git a/Scripts/Python/BahroCave.py b/Scripts/Python/BahroCave.py new file mode 100644 index 0000000000..315569c6af --- /dev/null +++ b/Scripts/Python/BahroCave.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/BaronCityOffice.py b/Scripts/Python/BaronCityOffice.py new file mode 100644 index 0000000000..594a578e50 --- /dev/null +++ b/Scripts/Python/BaronCityOffice.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 vault is not None: + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if entry is 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/Scripts/Python/Cleft.py b/Scripts/Python/Cleft.py new file mode 100644 index 0000000000..f180d718da --- /dev/null +++ b/Scripts/Python/Cleft.py @@ -0,0 +1,280 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 entryCleft is not None: + entryCleftValue = entryCleft.chronicleGetValue() + if entryCleftValue != "yes": + loadZandi = 1 + loadBook = 1 + elif entryCleft is None: + loadZandi = 1 + loadBook = 1 + + vault = ptVault() + entryTomahna = vault.findChronicleEntry("TomahnaLoad") + if entryTomahna is not 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: + PtDebugPrint("Zandi seems to have stepped away from the Airstream. Hmmm...") + if loadBook: + pages += ["clftYeeshaBookVis","FemaleGetPersonalBook","MaleGetPersonalBook"] + else: + PtDebugPrint("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 entry is not 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: + PtDebugPrint("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): + PtDebugPrint("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: + PtDebugPrint("FISSUREDROP.OnBehaviorNotify: fissureDrop = %d" % (fissureDrop)) + if fissureDrop: + PtDebugPrint("Cleft.OnBehaviorNotify(): will run respFissureDropMain now.") + respFissureDropMain.run(self.key,avatar=PtGetLocalAvatar()) diff --git a/Scripts/Python/Dereno.py b/Scripts/Python/Dereno.py new file mode 100644 index 0000000000..418b0094c2 --- /dev/null +++ b/Scripts/Python/Dereno.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Descent.py b/Scripts/Python/Descent.py new file mode 100644 index 0000000000..d0e49891eb --- /dev/null +++ b/Scripts/Python/Descent.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/EderDelin.py b/Scripts/Python/EderDelin.py new file mode 100644 index 0000000000..9621d71dfe --- /dev/null +++ b/Scripts/Python/EderDelin.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/EderTsogal.py b/Scripts/Python/EderTsogal.py new file mode 100644 index 0000000000..95f2eccb34 --- /dev/null +++ b/Scripts/Python/EderTsogal.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Ercana.py b/Scripts/Python/Ercana.py new file mode 100644 index 0000000000..3e79e58e98 --- /dev/null +++ b/Scripts/Python/Ercana.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/ErcanaCitySilo.py b/Scripts/Python/ErcanaCitySilo.py new file mode 100644 index 0000000000..809d31f243 --- /dev/null +++ b/Scripts/Python/ErcanaCitySilo.py @@ -0,0 +1,360 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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) + +kPlayerDropScore = "PelletDrop" +kPlayerTotalScore = "PelletTotal" +kGlobalScore = "LakeScore" + +class ErcanaCitySilo(ptResponder): + + def __init__(self): + ptResponder.__init__(self) + self.id = 208 + self.version = 7 + + self._gotTurd = False + self._pellet = 0 + self._lakeScore = 0 # Ugh + self._kiScore = 0 # Why is this separate? + + + def OnFirstUpdate(self): + pass + + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + ageSDL.setFlags(SDLGotPellet.value,1,1) + ageSDL.sendToClients(SDLGotPellet.value) + + vault = ptVault() + entry = vault.findChronicleEntry("GotPellet") + if entry is not None: + entryValue = entry.chronicleGetValue() + gotPellet = string.atoi(entryValue) + if gotPellet != 0: + self._gotTurd = True + entry.chronicleSetValue("0") + entry.save() + avatar = PtGetLocalAvatar() + avatar.avatar.registerForBehaviorNotify(self.key) + else: + return + else: + return + + try: + ageSDL = PtGetAgeSDL() + except: + PtDebugPrint("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,) + + self._pellet = (gotPellet - 300) + PtDebugPrint("ErcanaCitySilo:OnServerInitComplete: PELLET RECIPE = %d" % (self._pellet)) + + + def OnBehaviorNotify(self,type,id,state): + PtDebugPrint("ErcanaCitySilo.OnBehaviorNotify(): %d" % (type)) + + if type == PtBehaviorTypes.kBehaviorTypeLinkIn and state: + if self._gotTurd: + RespFadeInPellet.run(self.key) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + elif type == PtBehaviorTypes.kBehaviorTypeLinkIn and not state: + if self._gotTurd: + PtDebugPrint("ErcanaCitySilo.OnBehaviorNotify: Will now call IDoMeter.") + self.IDoMeter() + else: + PtDebugPrint("Says we don't have a turd. Shouldn't be possible, I'm in OnBehaviorNotify.") + avatar = PtGetLocalAvatar() + avatar.avatar.unRegisterForBehaviorNotify(self.key) + + + def IDoMeter(self): + levelMeter = self.IEvalPellet() + PtDebugPrint("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 OnGameScoreMsg(self, msg): + """Handles Game Score callbacks from the server""" + + # Note: msg is the final ptGameScoreMsg. + # This is what real python looks like... Take note, Cyan. + if isinstance(msg, ptGameScoreUpdateMsg): + score = msg.getScore() + name = score.getName() + if name == kGlobalScore: + PtDebugPrint("ErcanaCitySilo.OnGameScoreMsg():\tAdded %i lake points" % self._lakePoints, level=kWarningLevel) + else: + PtDebugPrint("ErcanaCitySilo.OnGameScoreMsg():\tAdded %i '%s' points" % (self._kiPoints, name), level=kWarningLevel) + if name == kPlayerDropScore: + PtSendKIMessageInt(kUpdatePelletScore, score.getPoints()) + + elif isinstance(msg, ptGameScoreListMsg): + # Congrats! We (maybe?) found the score! + try: + l = msg.getScores() + score = l[0] + if score.getName() == kGlobalScore: + score.addPoints(self._lakePoints, self.key) + else: + score.addPoints(self._kiPoints, self.key) + except: + # The score doesn't exist, so let's create it... + if msg.getName() == kGlobalScore: + type = PtGameScoreTypes.kAccumAllowNegative + points = self._lakePoints + else: + type = PtGameScoreTypes.kAccumulative + points = self._kiPoints + ptGameScore.createScore(msg.getOwnerID(), msg.getName(), type, points, self.key) + else: + PtDebugPrint("ErcanaCitySilo.OnGameScoreMsg():\tGot unexpected cb '%s'" % msg.__name__) + + + def IDoScores(self): + if self._pellet < 0: + self._kiPoints = 0 + self._lakePoints = (self._pellet/5) + if self._lakePoints < -70: + self._lakePoints = -70 + elif self._pellet > 200: + self._kiPoints = (self._pellet - ((self._pellet-200) * 4)) + self._lakePoints = (self._pellet - ((self._pellet-200) * 4)) + if self._kiPoints < 0: + self._kiPoints = 0 + if self._lakePoints < -200: + self._lakePoints = -200 + else: + self._kiPoints = self._pellet + self._lakePoints = self._pellet + self._kiPoints = int(round(self._kiPoints * ((xRandom.randint(1,25) / 100.0) + 4.75))) + self._lakePoints = int(round(self._lakePoints)) + PtDebugPrint("ErcanaCitySilo.IDoScores(): this pellet drop is worth %d KI points!" % (self._kiPoints)) + PtDebugPrint("ErcanaCitySilo.IDoScores(): and %d lake points!" % (self._lakePoints)) + + # Try to find the needed scores... + # The magic will happen in OnGameScoreMsg() + ptGameScore.findPlayerScores(kPlayerDropScore, self.key) + ptGameScore.findPlayerScores(kPlayerTotalScore, self.key) + ptGameScore.findGlobalScores(kGlobalScore, self.key) + + + def OnNotify(self,state,id,events): + if (id == RespScanMeter.id and self._gotTurd): + PtDebugPrint("ErcanaCitySilo.OnNotify: Received callback from RespScanMeter, will now call IDropPellet.") + self.IDropPellet() + + elif (id == RespDropPellet.id and self._gotTurd): + 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 self._pellet <= 0: + if self._pellet <= -250: + level = 1.0 + elif self._pellet > -250 and self._pellet <= -150: + level = 2.0 + elif self._pellet > -150 and self._pellet <= -50: + level = 3.1 + elif self._pellet > -50 and self._pellet <= 0: + level = 3.2 + elif self._pellet > 0 and self._pellet <= 270: + if self._pellet > 0 and self._pellet <= 74: + level = 4.0 + elif self._pellet > 74 and self._pellet <= 149: + level = 5.0 + elif self._pellet > 149 and self._pellet <= 209: + level = 6.0 + elif self._pellet > 209 and self._pellet <= 270: + level = 7.0 + elif self._pellet > 270: + if self._pellet > 270 and self._pellet <= 295: + level = 8.0 + elif self._pellet > 295 and self._pellet <= 320: + level = 9.0 + elif self._pellet > 320: + level = 10.0 + + return level + + + def IPlayPellet(self,level): + if level > 0.0: + PtDebugPrint("ErcanaCitySilo.IPlayPellet(): and the pellet anim is...") + if level == 1.0: + PtDebugPrint("steam & bubbles - HIGH") + RespPlaySteam.run(self.key,state="Hi") + RespPlayBubbles.run(self.key,state="Hi") + elif level == 2.0: + PtDebugPrint("steam & bubbles - MEDIUM") + RespPlaySteam.run(self.key,state="Med") + RespPlayBubbles.run(self.key,state="Med") + elif level == 3.1: + PtDebugPrint("steam & bubbles - LOW") + RespPlaySteam.run(self.key,state="Low") + RespPlayBubbles.run(self.key,state="Low") + elif level == 3.2: + PtDebugPrint("dud") + RespPlayDud.run(self.key) + elif level == 4.0: + PtDebugPrint("orange glow - LOW") + RespPlayOrangeGlow.run(self.key,state="Low") + elif level == 5.0: + PtDebugPrint("orange glow - MEDIUM") + RespPlayOrangeGlow.run(self.key,state="Med") + elif level == 6.0: + PtDebugPrint("orange glow - HIGH") + RespPlayOrangeGlow.run(self.key,state="Hi") + elif level == 7.0: + PtDebugPrint("white glow") + RespPlayWhiteGlow.run(self.key) + elif level == 8.0: + PtDebugPrint("explosion - LOW") + RespPlayBoom.run(self.key,state="Low") + elif level == 9.0: + PtDebugPrint("explosion - MEDIUM") + RespPlayBoom.run(self.key,state="Med") + elif level == 10.0: + PtDebugPrint("explosion - HIGH") + RespPlayBoom.run(self.key,state="Hi") + else: + PtDebugPrint("ErcanaCitySilo.IPlayPellet(): ERROR. Level must be greater than 0") + + + def OnBackdoorMsg(self,target,param): + if target == "pelletfx": + param = float(param) + #PtDebugPrint("param = ",param) + if param > 0.0 and param <= 10.0: + if param == 3.0: + PtDebugPrint("can't use 3.0, must be either 3.1 or 3.2") + return + else: + self.IPlayPellet(param) + else: + PtDebugPrint("must be between 0.0 and 10.0") + diff --git a/Scripts/Python/Garden.py b/Scripts/Python/Garden.py new file mode 100644 index 0000000000..64f6eaea0e --- /dev/null +++ b/Scripts/Python/Garden.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 vault is not None: + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if entry is 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/Scripts/Python/GardenBugs.py b/Scripts/Python/GardenBugs.py new file mode 100644 index 0000000000..82b38b4074 --- /dev/null +++ b/Scripts/Python/GardenBugs.py @@ -0,0 +1,360 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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() + entry = vault.findChronicleEntry(chronicleEntryName) + if entry is None: + # not found... add chronicle + vault.addChronicleEntry(chronicleEntryName,0,str(count)) + else: + entry.chronicleSetValue(str(count)) + entry.save() + + def IGetBugCount(self): + vault = ptVault() + entry = vault.findChronicleEntry(chronicleEntryName) + if entry is not None: + return int(entry.chronicleGetValue()) + return 0 # no chronicle var + + def OnServerInitComplete(self): + self.ageSDL = PtGetAgeSDL() + self.ageSDL[raining.value]=(0,) + + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + PtDebugPrint("GardenBugs.OnFirstUpdate():\tfailed to get local avatar") + return + + avatar.avatar.registerForBehaviorNotify(self.key) + + self.bugCount = self.IGetBugCount() + PtDebugPrint("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) + PtDebugPrint("GardenBugs.OnFirstUpdate():\tTurning lights on at start") + else: + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, False) + PtDebugPrint("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) + PtDebugPrint("GardenBugs.OnTimer() - Particles to kill: " + str(particlesToKill) + " (" + str(percentToKill * 100) + "%)") + PtKillParticles(0,percentToKill,avatar.getKey()) + elif (particlesToTransfer != 0): + # add some particles + PtDebugPrint("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()) + PtDebugPrint("GardenBugs.OnTimer():\tIt's rain, bug cloud gone") + if (localInTunnel or self.bugCount == 0): + PtDebugPrint("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())): + PtDebugPrint("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): + PtDebugPrint("GardenBugs.OnNotify():\tWrong avatar, notifies run locally") + return + + self.bugCount = PtGetNumParticles(avatar.getKey()) + + if (id == bugRgn.id): + PtDebugPrint("GardenBugs.OnNotify():\tEntered bug cloud region") + + if (self.bugCount > 19): + return + self.ageSDL = PtGetAgeSDL() + rain = self.ageSDL[raining.value][0] + if (rain): + PtDebugPrint("gardenBugs.OnNotify()-->\tnope, it's raining") + return + if running: + PtDebugPrint("gardenBugs.OnNotify()-->\tcan't add bugs as we're still running") + return + if PtLocalAvatarRunKeyDown() and PtLocalAvatarIsMoving(): + PtDebugPrint("gardenBugs.OnNotify()-->\tcan't add bugs as we're still running (but our running flag is False?)") + return + + PtDebugPrint("gardenBugs.OnNotify()-->\ttansferring Bugs!") + avatar = PtFindAvatar(events) + PtTransferParticlesToObject(bugEmitter.value.getKey(),avatar.getKey(),10) + PtSetParticleDissentPoint(0,0,10000,avatar.getKey()) + PtDebugPrint("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): + PtDebugPrint("gardenBugs.OnNotify()-->\tstart rain timer") + PtAtTimeCallback(self.key, 30.0, kRainStarting) + return + + if (id == rainEnd.id): + PtDebugPrint("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) + PtDebugPrint("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 + PtDebugPrint("gardenBugs.OnNotify()-->\tlocal in tunnel") + return + elif event[0]==1 and event[1]==0: + localInTunnel = False + PtDebugPrint("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: + PtDebugPrint("gardenBugs.BeginAgeUnLoad()-->\tfailed to get local avatar") + return + if (local == avObj): + PtDebugPrint("gardenBugs.BeginAgeUnLoad()-->\tavatar page out") + + # update with the number currently on the avatar and save it to the chronicle + self.bugCount = PtGetNumParticles(local.getKey()) + PtDebugPrint("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 not state: + currentBehavior = PtBehaviorTypes.kBehaviorTypeIdle + if (behavior == PtBehaviorTypes.kBehaviorTypeRun): + running = False + if PtLocalAvatarRunKeyDown() and PtLocalAvatarIsMoving(): + PtDebugPrint("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): + PtDebugPrint("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 + PtDebugPrint("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/Scripts/Python/Garrison.py b/Scripts/Python/Garrison.py new file mode 100644 index 0000000000..be2f6ad4cf --- /dev/null +++ b/Scripts/Python/Garrison.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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": + PtDebugPrint("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 + PtDebugPrint("Garrison.OnFirstUpdate(): this Garrison is the public instance, as its parent = ",parentname) + else: + PtDebugPrint("Garrison.OnFirstUpdate(): this Garrison is the regular aka Yeesha version, as its parent = ",parentname) + + + + def OnServerInitComplete(self): + thisComponent = self.key.getName() + if thisComponent != "VeryVerySpecialPythonFileMod": + PtDebugPrint("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/Scripts/Python/Gira.py b/Scripts/Python/Gira.py new file mode 100644 index 0000000000..af461dc9d5 --- /dev/null +++ b/Scripts/Python/Gira.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 vault is not None: + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if entry is 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/Scripts/Python/GiraBugs.py b/Scripts/Python/GiraBugs.py new file mode 100644 index 0000000000..4fb0e29f0a --- /dev/null +++ b/Scripts/Python/GiraBugs.py @@ -0,0 +1,273 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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() + entry = vault.findChronicleEntry(chronicleEntryName) + if entry is None: + # not found... add chronicle + vault.addChronicleEntry(chronicleEntryName,0,str(count)) + else: + entry.chronicleSetValue(str(count)) + entry.save() + + def IGetBugCount(self): + vault = ptVault() + entry = vault.findChronicleEntry(chronicleEntryName) + if entry is not None: + return int(entry.chronicleGetValue()) + return 0 # no chronicle var + + def OnServerInitComplete(self): + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + PtDebugPrint("GiraBugs.OnFirstUpdate():\tfailed to get local avatar") + return + avatar.avatar.registerForBehaviorNotify(self.key) + + self.bugCount = self.IGetBugCount() + PtDebugPrint("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) + PtDebugPrint("GiraBugs.OnFirstUpdate():\tlights on at start") + else: + PtSetLightAnimStart(avatar.getKey(), bugLightObjectName, False) + PtDebugPrint("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: + PtDebugPrint("ERROR: GiraBugs.BeginAgeUnload()-->\tFailed to get local avatar!") + return + if (local == avObj): + PtDebugPrint("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()) + PtDebugPrint("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) + PtDebugPrint("GiraBugs.OnTimer() - Particles to kill: " + str(particlesToKill) + " (" + str(percentToKill * 100) + "%)") + PtKillParticles(0,percentToKill,avatar.getKey()) + elif (particlesToTransfer != 0): + # add some particles + PtDebugPrint("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): + PtDebugPrint("GiraBugs.OnNotify():\tsplashdown! ",id) + if (self.bugCount): + self.bugCount = 0 + PtDebugPrint("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 not state: + 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): + PtDebugPrint("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 + PtDebugPrint("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/Scripts/Python/GiraCave1.py b/Scripts/Python/GiraCave1.py new file mode 100644 index 0000000000..bf7c814f48 --- /dev/null +++ b/Scripts/Python/GiraCave1.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 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/Scripts/Python/GiraDoor.py b/Scripts/Python/GiraDoor.py new file mode 100644 index 0000000000..ce3e3d321e --- /dev/null +++ b/Scripts/Python/GiraDoor.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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): + PtDebugPrint("gira door open") + doorOpenInitResp.run(self.key,avatar = PtGetLocalAvatar()) + else: + PtDebugPrint("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/Scripts/Python/GiraSteam.py b/Scripts/Python/GiraSteam.py new file mode 100644 index 0000000000..777a5bcaa9 --- /dev/null +++ b/Scripts/Python/GiraSteam.py @@ -0,0 +1,737 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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" + PtDebugPrint("GiraSteam.OnServerInitComplete():\tsetting up for SDL var: ",var) + ageSDL.setFlags(var, 1, 1) + ageSDL.sendToClients(var) + + open = ageSDL["giraSteamvent01Open"][0] + PtDebugPrint("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] + PtDebugPrint("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] + PtDebugPrint("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] + PtDebugPrint("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] + PtDebugPrint("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] + PtDebugPrint("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() + PtDebugPrint("GiraSteam.SetRumble():\tnumClosed = ",numClosed) + PtDebugPrint("GiraSteam.SetRumble():\tresponder = ",resp.id) + if (numClosed == 1): + resp.run(self.key,state='MuffledBlastOnly',avatar=theavatar) + elif (numClosed == 2): + ##PtDebugPrint("running rumble 1") + resp.run(self.key,state='Rumble1',avatar=theavatar) + elif(numClosed == 3): + ##PtDebugPrint("running rumble 2") + resp.run(self.key,state='Rumble2',avatar=theavatar) + elif(numClosed == 4): + ##PtDebugPrint("running rumble 3") + resp.run(self.key,state='Rumble3',avatar=theavatar) + elif(numClosed == 5): + ##PtDebugPrint("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() + PtDebugPrint("GiraSteam.SetSteam():\tnumClosed = ",numClosed) + PtDebugPrint("GiraSteam.SetSteam():\tresponder = ",resp.id) + + if (numClosed == 0): + ##PtDebugPrint("running steam blast 2") + resp.run(self.key,state='Blast1',avatar=theavatar) + elif (numClosed == 1): + ##PtDebugPrint("running steam blast 3") + resp.run(self.key,state='Blast2',avatar=theavatar) + elif (numClosed == 2): + ##PtDebugPrint("running steam blast 4") + resp.run(self.key,state='Blast3',avatar=theavatar) + elif (numClosed == 3): + ##PtDebugPrint("running steam blast 5") + resp.run(self.key,state='Blast4',avatar=theavatar) + elif (numClosed == 4): + ##PtDebugPrint("running steam blast 6") + resp.run(self.key,state='Blast5',avatar=theavatar) + elif (numClosed == 5): + ##PtDebugPrint("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() + PtDebugPrint("GiraSteam.JumpAvatar():\tnumClosed = ",numClosed) + PtDebugPrint("GiraSteam.JumpAvatar():\tresponder = ",resp.id) + if (numClosed == 0): + ##PtDebugPrint("blast level 2") + resp.run(self.key,state='Level1',avatar=theavatar) + if (numClosed == 1): + ##PtDebugPrint("blast level 3") + resp.run(self.key,state='Level2',avatar=theavatar) + if (numClosed == 2): + ##PtDebugPrint("blast level 4") + resp.run(self.key,state='Level3',avatar=theavatar) + if (numClosed == 3): + ##PtDebugPrint("blast level 5") + resp.run(self.key,state='Level4',avatar=theavatar) + if (numClosed == 4): + ##PtDebugPrint("blast level 6") + resp.run(self.key,state='Level5',avatar=theavatar) + if (numClosed == 5): + ##PtDebugPrint("blast level 6") + resp.run(self.key,state='Level6',avatar=theavatar) + + def PlayBlastSfx(self,resp, theavatar): + numClosed = self.GetNumClosed() + if (numClosed == 0): + #PtDebugPrint("blast sfx 1") + resp.run(self.key,state='Blast1',avatar=theavatar) + if (numClosed == 1): + #PtDebugPrint("blast sfx 2") + resp.run(self.key,state='Blast2',avatar=theavatar) + if (numClosed == 2): + #PtDebugPrint("blast sfx 3") + resp.run(self.key,state='Blast3',avatar=theavatar) + if (numClosed == 3): + #PtDebugPrint("blast sfx 4") + resp.run(self.key,state='Blast4',avatar=theavatar) + if (numClosed == 4): + #PtDebugPrint("blast sfx 5") + resp.run(self.key,state='Blast5',avatar=theavatar) + if (numClosed == 5): + #PtDebugPrint("blast sfx 6") + resp.run(self.key,state='Blast6',avatar=theavatar) + + + def BeginAgeUnLoad(self, avObj): + pass + + def OnTimer(self,id): + PtDebugPrint("GiraSteam.OnTimer():\tid = ",id) + global onFumerol1 + global onFumerol2 + global onFumerol3 + global onFumerol4 + global onFumerol5 + global onFumerol6 + + if (id == 0): + #trigger failsafe here + ##PtDebugPrint("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() + + #PtDebugPrint("num closed ",numClosed) + return numClosed + + def OnNotify(self,state,id,events): + #PtDebugPrint("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() + ##PtDebugPrint("id ",id) + + entry = False + if avatar == local: + for event in events: + if (event[0] == kCollisionEvent and event[1]): + # 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): + ##PtDebugPrint("responder callback") + if (numClosed == 6): + ##PtDebugPrint("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] + PtDebugPrint("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] + PtDebugPrint("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): + #PtDebugPrint("1 entry ",entry) + inFumerol1 = entry + + elif (id == fumerol2Det.id): + #PtDebugPrint("2 entry ",entry) + inFumerol2 = entry + + elif (id == fumerol3Det.id): + #PtDebugPrint("3 entry ",entry) + inFumerol3 = entry + + elif (id == fumerol4Det.id): + #PtDebugPrint("4 entry ",entry) + inFumerol4 = entry + + elif (id == fumerol5Det.id): + PtDebugPrint("5 entry ",entry) + inFumerol5 = entry + + elif (id == fumerol6Det.id): + PtDebugPrint("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() + #PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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/Scripts/Python/GreatTreePub.py b/Scripts/Python/GreatTreePub.py new file mode 100644 index 0000000000..702232a535 --- /dev/null +++ b/Scripts/Python/GreatTreePub.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/GreatZero.py b/Scripts/Python/GreatZero.py new file mode 100644 index 0000000000..139a8f5c11 --- /dev/null +++ b/Scripts/Python/GreatZero.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Jalak.py b/Scripts/Python/Jalak.py new file mode 100644 index 0000000000..7ac67d79df --- /dev/null +++ b/Scripts/Python/Jalak.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Kadish.py b/Scripts/Python/Kadish.py new file mode 100644 index 0000000000..33c4d78855 --- /dev/null +++ b/Scripts/Python/Kadish.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 vault is not None: + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if entry is 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/Scripts/Python/Kveer.py b/Scripts/Python/Kveer.py new file mode 100644 index 0000000000..b599e0beca --- /dev/null +++ b/Scripts/Python/Kveer.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/LiveBahroCaves.py b/Scripts/Python/LiveBahroCaves.py new file mode 100644 index 0000000000..c3e3a5850a --- /dev/null +++ b/Scripts/Python/LiveBahroCaves.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 = [] + + PtDebugPrint("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: + PtDebugPrint("LiveBahroCaves.__init__(): age not recognized, will page in BlueSpiralCave as default") + pages += ["BlueSpiralCave"] + + PtDebugPrint("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/Scripts/Python/Minkata.py b/Scripts/Python/Minkata.py new file mode 100644 index 0000000000..b8fe903b8c --- /dev/null +++ b/Scripts/Python/Minkata.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Myst.py b/Scripts/Python/Myst.py new file mode 100644 index 0000000000..aebd882b94 --- /dev/null +++ b/Scripts/Python/Myst.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Negilahn.py b/Scripts/Python/Negilahn.py new file mode 100644 index 0000000000..5646937c57 --- /dev/null +++ b/Scripts/Python/Negilahn.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Neighborhood.py b/Scripts/Python/Neighborhood.py new file mode 100644 index 0000000000..7be361990e --- /dev/null +++ b/Scripts/Python/Neighborhood.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 vault is not None: + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if entry is 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/Scripts/Python/Neighborhood02.py b/Scripts/Python/Neighborhood02.py new file mode 100644 index 0000000000..8c5dbc422d --- /dev/null +++ b/Scripts/Python/Neighborhood02.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Nexus.py b/Scripts/Python/Nexus.py new file mode 100644 index 0000000000..5faee3f84a --- /dev/null +++ b/Scripts/Python/Nexus.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/Payiferen.py b/Scripts/Python/Payiferen.py new file mode 100644 index 0000000000..1014c613ba --- /dev/null +++ b/Scripts/Python/Payiferen.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/PelletBahroCave.py b/Scripts/Python/PelletBahroCave.py new file mode 100644 index 0000000000..ca7d9c98a2 --- /dev/null +++ b/Scripts/Python/PelletBahroCave.py @@ -0,0 +1,326 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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() + #PtDebugPrint("found pellet cave solution: ",chronString) + try: + chronString = chronString.split(",") + for sol in chronString: + chronSolutions.append(string.atoi(sol)) + PtDebugPrint("found pellet cave solution: ",chronSolutions) + PtDebugPrint("current sdl values for solution = ",sdlSolutions) + if self.sceneobject.isLocallyOwned(): + self.ShowSymbols() + except: + PtDebugPrint("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: + PtDebugPrint("failed to get local avatar") + return + avatar.avatar.registerForBehaviorNotify(self.key) + else: + lowerCave = 0 + vault = ptVault() + entry = vault.findChronicleEntry("GotPellet") + if entry is not 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: + PtDebugPrint("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] + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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": + PtDebugPrint("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 + PtDebugPrint("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/Scripts/Python/Personal.py b/Scripts/Python/Personal.py new file mode 100644 index 0000000000..2cd1fbb954 --- /dev/null +++ b/Scripts/Python/Personal.py @@ -0,0 +1,223 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 entry is not 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() + + # make sure we have at least the micro-ki (and therefore a Relto book) + # this does not downgrade us if we have a normal KI :) + PtSendKIMessageInt(kUpgradeKILevel, kMicroKI) + + 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 vault is not None: + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if entry is 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") + + + def Load(self): + pass + + + def OnNotify(self,state,id,events): + pass + + + diff --git a/Scripts/Python/PhilRelto.py b/Scripts/Python/PhilRelto.py new file mode 100644 index 0000000000..dcd5b1653c --- /dev/null +++ b/Scripts/Python/PhilRelto.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 * + +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/Scripts/Python/SpyRoom.py b/Scripts/Python/SpyRoom.py new file mode 100644 index 0000000000..addc176f28 --- /dev/null +++ b/Scripts/Python/SpyRoom.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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: + PtDebugPrint("spyroom: did not find the chron var") + vault.addChronicleEntry("sjBevinVisted", 0, str(int( time.time() )) ) + else: + PtDebugPrint("spyroom: found the chron var") + diff --git a/Scripts/Python/Teledahn.py b/Scripts/Python/Teledahn.py new file mode 100644 index 0000000000..3db6c5265c --- /dev/null +++ b/Scripts/Python/Teledahn.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 vault is not None: + #~ entry = vault.findChronicleEntry(kChronicleVarName) + #~ if entry is 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/Scripts/Python/Tetsonot.py b/Scripts/Python/Tetsonot.py new file mode 100644 index 0000000000..8ff6e9c47c --- /dev/null +++ b/Scripts/Python/Tetsonot.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/ahnyIslandHut.py b/Scripts/Python/ahnyIslandHut.py new file mode 100644 index 0000000000..9dcd0526a2 --- /dev/null +++ b/Scripts/Python/ahnyIslandHut.py @@ -0,0 +1,226 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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: + PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("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() + + #~ PtDebugPrint("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: + PtDebugPrint("will now enable current") + WaterCurrent1.current.enable() + WaterCurrent2.current.enable() + WaterCurrent3.current.enable() + WaterCurrent4.current.enable() + else: + PtDebugPrint("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/Scripts/Python/ahnyKadishDoor.py b/Scripts/Python/ahnyKadishDoor.py new file mode 100644 index 0000000000..846a3cb850 --- /dev/null +++ b/Scripts/Python/ahnyKadishDoor.py @@ -0,0 +1,288 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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) + PtDebugPrint("btnList = ",btnList) + for resp in RespButtons.value: + tempResp = resp.getName() + respList.append(tempResp) + PtDebugPrint("respList = ",respList) + for obj in ObjButtons.value: + tempObj = obj.getName() + objList.append(tempObj) + PtDebugPrint("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: + PtDebugPrint("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(): + PtDebugPrint("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: + PtDebugPrint("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 + + PtDebugPrint("btnNum =",btnNum+1) + RespButtons.run(self.key,objectName=respList[btnNum]) + + if id == RespButtons.id and actingAvatar == PtGetLocalAvatar(): + self.ICheckButtons() + + + def ICheckButtons(self): + PtDebugPrint("ahnyKadishDoor.ICheckButtons") + global currentList + + ageSDL = PtGetAgeSDL() + + checkNum = (btnNum + 1) + currentList.append(checkNum) + while len(currentList) > len(solutionList): + del currentList[0] + + PtDebugPrint("solution list: " + str(solutionList)) + PtDebugPrint("current list: " + str(currentList)) + + if self.AreListsEquiv(solutionList, currentList): + PtDebugPrint("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: + #PtDebugPrint("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): + PtDebugPrint("disengage and exit the console") + i = 0 + for btn in ActButtons.value: + #PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("ahnyKadishDoor.onTimer: reenabling 8 button clickables") + ActButtons.value[i].enable() + i += 1 + + elif id == 3: + PtDebugPrint("ahnyKadishDoor.onTimer: reenabling the console's clickable") + ActConsole.enableActivator() + + diff --git a/Scripts/Python/ahnyKadishHut.py b/Scripts/Python/ahnyKadishHut.py new file mode 100644 index 0000000000..c0e632bfa0 --- /dev/null +++ b/Scripts/Python/ahnyKadishHut.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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: + PtDebugPrint("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: + PtDebugPrint("ahnyKadishHut.OnServerInitComplete(): Windows are open") + RespWindows.run(self.key,state="open",fastforward=1) + else: + PtDebugPrint("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: + # PtDebugPrint("ahnyKadishHut.OnServerInitComplete(): Timer is on") + # RespDniTimer.run(self.key,state="on") + # dniSecsLeft = (EndTime - InitTime) + # dniSecsElapsed = (kTimeWarp - dniSecsLeft) + # #realSecsElapsed = (dniSecsElapsed * 1.3928573888441378) + # PtDebugPrint("dniSecsElapsed = ",dniSecsElapsed) + # MatAnimDniTimer.animation.skipToTime(dniSecsElapsed) + # MatAnimDniTimer.animation.resume() + # PtAtTimeCallback(self.key,1,2) + #else: + # PtDebugPrint("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: + PtDebugPrint("ahnyKadishHut.OnSDLNotify(): Windows will now open") + RespWindows.run(self.key,state="open") + else: + PtDebugPrint("ahnyKadishHut.OnSDLNotify(): Windows will now close") + RespWindows.run(self.key,state="close") + + #if VARname == SDLDniTimer.value: + # EndTime = ageSDL[SDLDniTimer.value][0] + # if EndTime: + # PtDebugPrint("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: + # PtDebugPrint("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/Scripts/Python/ahnyLinkBookGUIPopup.py b/Scripts/Python/ahnyLinkBookGUIPopup.py new file mode 100644 index 0000000000..1def936fd5 --- /dev/null +++ b/Scripts/Python/ahnyLinkBookGUIPopup.py @@ -0,0 +1,408 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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(): + PtDebugPrint(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) + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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() + + #PtDebugPrint("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 + PtDebugPrint("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: + PtDebugPrint("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 + + PtDebugPrint(bookdef) + PtSendKIMessage(kDisableKIandBB,0) + gLinkingBook = ptBook(bookdef,self.key) + gLinkingBook.setSize( width, height ) + gLinkingBook.setGUI(gui) + gLinkingBook.show(1) + + except LookupError: + PtDebugPrint("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: + PtDebugPrint("\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/Scripts/Python/ahnyMaintRoom.py b/Scripts/Python/ahnyMaintRoom.py new file mode 100644 index 0000000000..0785f9ed45 --- /dev/null +++ b/Scripts/Python/ahnyMaintRoom.py @@ -0,0 +1,211 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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: + PtDebugPrint("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: + PtDebugPrint("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,) + PtDebugPrint("advanced from sphere %d with maintainence button" % (ageSDL["ahnyCurrentSphere"][0])) + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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 + PtDebugPrint("ahnyMaintRoom.SphereDifference(): Setting sphere difference for Maint Room switch to %d" % (diffsphere)) + \ No newline at end of file diff --git a/Scripts/Python/ahnyPressurePlates.py b/Scripts/Python/ahnyPressurePlates.py new file mode 100644 index 0000000000..0e7210bf09 --- /dev/null +++ b/Scripts/Python/ahnyPressurePlates.py @@ -0,0 +1,388 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__ahnyPressurePlates v%d " % (version)) + + ########################### + def OnFirstUpdate(self): + global respLightList + global objZoneList + global treeToZoneKey + + try: + ageSDL = PtGetAgeSDL() + ageSDL[SDLOccupied.value][0] + except: + PtDebugPrint("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: + PtDebugPrint("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 != []: + PtDebugPrint("ahnyPressurePlates.OnSDLNotify(): playing audio SFX") + respSphereRotate.run(self.key) + + ########################### + def OnNotify(self,state,id,events): + global respLightList + global objZoneList + global LocalAvatar + + #PtDebugPrint("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]) + #PtDebugPrint("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 ) + PtDebugPrint("%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) + PtDebugPrint("%s - exit %s" % (str(occupiedZones), str(index))) + ageSDL[SDLOccupied.value] = tuple(occupiedZones) + #PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("ahnyPressurePlates:Book: hit linking panel %s" % (event[2])) + self.HideBook(1) + + ageSDL = PtGetAgeSDL() + PtDebugPrint(ageSDL[SDLOccupied.value]) + if self.RegionsEmpty(): + PtDebugPrint("Sphere rotating") + ageSDL = PtGetAgeSDL() + currentSphere = ageSDL["ahnyCurrentSphere"][0] + if currentSphere == 3 or currentSphere == 4: + ageSDL["ahnyCurrentSphere"] = (1,) + else: + ageSDL["ahnyCurrentSphere"] = ((currentSphere + 1),) + else: + PtDebugPrint("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: + PtDebugPrint("missing sphere identifier string!") + ahnySDL.setStateDataRecord(ahnyRecord) + ahnySDL.save() + PtDebugPrint("advanced from sphere ",sphere.value) + return + ''' + + elif event[1] == PtBookEventTypes.kNotifyShow: + PtDebugPrint("ahnyLinkBookGUIPopup:Book: NotifyShow") + PtSendKIMessage(kEnableKIandBB,0) + + elif event[1] == PtBookEventTypes.kNotifyHide: + PtDebugPrint("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: + PtDebugPrint("ahnyPressurePlates: not all quabs kicked off") + return False + elif Sphere.value == "Sphere02": + treeList = list(ageSDL[SDLTrees.value]) + for tree in treeList: + if tree: + PtDebugPrint("ahnyPressurePlates: not all trees knocked over") + return False + + for zone in occupantList[1:]: + if zone: + PtDebugPrint("ahnyPressurePlates: some zones still occupied") + return False + + if occupantList[0] == 1: + return True + + PtDebugPrint("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: + PtDebugPrint("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/Scripts/Python/ahnyQuabs.py b/Scripts/Python/ahnyQuabs.py new file mode 100644 index 0000000000..fe59e7beba --- /dev/null +++ b/Scripts/Python/ahnyQuabs.py @@ -0,0 +1,211 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +from Plasma import * +from PlasmaTypes import * +import math +import random + +# 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") + +# How long does it take for more quabs to be born? Eight hours, evidently... +kQuabGestationTime = 8 * 60 * 60 + +# Stupid konstants the stupid Cyan tech artists didn't add in max... +# Did I mention how STUPID this is? +kLastQuabUpdate = "ahnyQuabsLastUpdate" +kMaxNumQuabs = 20 +kQuabAvatarName = "Quab" + +# Silly behavior name constants +kQuabIdleBehNames = ("Idle02", "Idle03",) +kQuabRunBehNames = ("Run02", "Run03",) + +class ahnyQuabs(ptModifier, object): + def __init__(self): + ptModifier.__init__(self) + self.id = 5946 + self.version = 2 + self.brains = [] + random.seed() + PtDebugPrint("__init__ahnyQuabs v%d " % (self.version)) + + def _last_update_get(self): + ageSDL = PtGetAgeSDL() + return ageSDL[kLastQuabUpdate][0] + last_update = property(_last_update_get, doc="Gets the last time a quab was killed/born") + + def _quabs_get(self): + ageSDL = PtGetAgeSDL() + return ageSDL[SDLQuabs.value][0] + def _quabs_set(self, value): + ageSDL = PtGetAgeSDL() + ageSDL[SDLQuabs.value] = (value,) + ageSDL[kLastQuabUpdate] = (PtGetServerTime(),) + quabs = property(_quabs_get, _quabs_set, doc="Gets the number of quabs alive") + + def OnServerInitComplete(self): + PtDebugPrint("ahnyQuabs.OnServerInitComplete():\tWhen I got here...", level=kWarningLevel) + PtDebugPrint("ahnyQuabs.OnServerInitComplete():\t... there were already %i quabs" % self.quabs, level=kWarningLevel) + self.brains = PtGetAIAvatarsByModelName(kQuabAvatarName) + + # Sanity Check: Before we think about doing any processing, make sure there are no quabs + # already loaded. We may have arrived after the last man left but before the + # server shut down. Therefore, we will already have quabs... So we don't want + # to spawn another 20 or so dupe avatar clones. + if len(self.brains) != 0: + PtDebugPrint("ahnyQuabs.OnServerInitComplete():\t... and they were already spawned!", level=kWarningLevel) + for brain in self.brains: + self._PrepCritterBrain(brain[0]) + return + + if self.sceneobject.isLocallyOwned(): + delta = PtGetServerTime() - self.last_update + toSpawn = int(math.floor(delta / kQuabGestationTime)) + if toSpawn: + PtDebugPrint("ahnyQuabs.OnServerInitComplete():\t... and I need to spawn %i more" % toSpawn, level=kWarningLevel) + self.quabs += toSpawn + if self.quabs > kMaxNumQuabs: + PtDebugPrint("ahnyQuabs.OnServerInitComplete():\t... woah, %i quabs?!" % self.quabs, level=kWarningLevel) + self.quabs = kMaxNumQuabs + + # Shuffle the spawn points around so we don't get the same quabs appearing + # every single time. That would be quite boring. + qSpawns = list(quabObjects.value) + random.shuffle(qSpawns) + + # On quab spawning... + # We will load the avatar clones manually if we are the first one in. + # We will obtain the ptCritterBrains in an OnAIMsg callback. + for i in xrange(self.quabs): + PtLoadAvatarModel(kQuabAvatarName, qSpawns[i].getKey(), "Quab %i" % i) + + def OnAIMsg(self, brain, msgType, userStr, args): + if msgType == PtAIMsgType.kBrainCreated: + # Init the brain and push it into our collection + PtDebugPrint("ahnyQuabs.OnAIMsg():\t%s created" % userStr, level=kDebugDumpLevel) + self._PrepCritterBrain(brain) + self.brains.append((brain, userStr,)) + return + + if msgType == PtAIMsgType.kArrivedAtGoal: + # Not really important, but useful for debugging + PtDebugPrint("ahnyQuabs.OnAIMsg():\t%s arrived at goal" % userStr, level=kDebugDumpLevel) + return + + def OnNotify(self, state, id, events): + if id == deadZone.id: + # Make sure this isn't the player jumping into the water for a quick swim + # Musing: Ideally, we would despawn the clone here since it's now useless, + # but removing the brain without causing rampant issues might be problematic... + colso = PtFindAvatar(events) + if colso.isAvatar() and not colso.isHuman(): + self.quabs -= 1 + PtDebugPrint("ahnyQuabs.OnNotify():\tQuabs remaining: %i" % self.quabs, level=kWarningLevel) + return + + def OnUpdate(self, seconds, delta): + for brain, name in self.brains: + # Meh, I'm tired of huge indentation levels + # If you think running this every frame is a bad idea, remember how + # badly the quab AI sucked in MOUL. This won't kill you. + self._Think(brain, name) + + def _Think(self, brain, name): + """Basic quab thought logic (scurry, scurry, scurry)""" + running = self._IsRunningAway(brain) + + # Quabs spook very easily. They are also stupid like dogs--they run + # in a straight line away from whatever is chasing them. Fun fact: alligators + # can catch dogs because they do the same thing. The mammalian adaptation is the + # ability to turn quickly (which the dog does not actually do)... + # This evolutionary biology lesson is thanks to Hoikas, the Mammalogy drop-out + monsters = brain.playersICanHear() + if len(monsters) == 0: + if running: + PtDebugPrint("ahnyQuabs._Think():\t%s is now safe." % name, level=kDebugDumpLevel) + self._RunAway(brain, False) + return + runaway = None + for monster in monsters: + vec = brain.vectorToPlayer(monster) + vec.normalize() + if runaway: + runaway = runaway.add(vec) + else: + runaway = vec + runaway = runaway.scale(100) # so we don't just move a centimeter away + curPos = brain.getSceneObject().position() + endPos = ptPoint3(curPos.getX() + runaway.getX(), curPos.getY() + runaway.getY(), curPos.getZ() + runaway.getZ()) + + # Now, actually make the quab run away + if not running: + # Note: low level brain will make the quab play the run behavior + # no need to court a race condition by playing it here + PtDebugPrint("ahnyQuabs._Think():\tTime for %s to run away!" % name, level=kDebugDumpLevel) + brain.goToGoal(endPos) + + def _PrepCritterBrain(self, brain): + """Attaches quab behaviors to newly initialized/fetched critter brains""" + brain.addReceiver(self.key) + for beh in kQuabIdleBehNames: + brain.addBehavior(beh, brain.idleBehaviorName()) + for beh in kQuabRunBehNames: + brain.addBehavior(beh, brain.runBehaviorName(), randomStartPos=0) + + def _IsRunningAway(self, brain): + if brain.runningBehavior(brain.runBehaviorName()): + return True + if brain.runningBehavior(brain.idleBehaviorName()): + return False + raise RuntimeError("Quab brain running neither the idle nor the run behavior. WTF?") + + def _RunAway(self, brain, runAway=True): + """Quick helper because I'm lazy and the behavior apis are really stupid""" + if runAway: + brain.startBehavior(brain.runBehaviorName()) + else: + brain.startBehavior(brain.idleBehaviorName()) diff --git a/Scripts/Python/ahnySaveCloth.py b/Scripts/Python/ahnySaveCloth.py new file mode 100644 index 0000000000..c0598f9682 --- /dev/null +++ b/Scripts/Python/ahnySaveCloth.py @@ -0,0 +1,279 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("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": + PtDebugPrint("linking to hub or hut") + whereAmI = 4 + else: + offset = str(ageSDL["ahnyCurrentOffset"][0]) + PtDebugPrint("Ahnonay.OnPageLoad(): Sphere0%s loaded with offset:%s" % (sphere, offset)) + whereAmI = (int(sphere) - int(offset)) % 4 + if whereAmI == 0: + whereAmI = 4 + else: + whereAmI = sphere + PtDebugPrint("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] + PtDebugPrint("ahnySaveCloth.OnServerInitComplete():\t found sdl: ",sdlSC,", which = ",gotSC) + except: + PtDebugPrint("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 + + PtDebugPrint("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: + PtDebugPrint("I'm the age owner, setting spawnpoint") + #Activator.enable() + + ageSDL = PtGetAgeSDL() + sphere = ageSDL["ahnyCurrentSphere"][0] + offset = (sphere - whereAmI) % 4 + PtDebugPrint("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) + PtDebugPrint(newSpawn) + chron.setValue(newSpawn) + if not gotSC: + ageSDL = PtGetAgeSDL() + ageSDL[sdlSC] = (1,) + return + + PtDebugPrint("ahnySaveCloth.OnNotify(): ERROR: couldn't find chron node") + + + else: + PtDebugPrint("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]) + PtDebugPrint("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) + PtDebugPrint("current save cloth updated to number", clothOffset, " from cloth value of", clothNumber) + PtDebugPrint("current save position updated to:", currentpos) + else: + PtDebugPrint("missing sphere identifier string!") + ahnySDL.setStateDataRecord(ahnyRecord) + ahnySDL.save() + return + ''' + + else: + PtDebugPrint("ERROR: ahnySaveCloth.OnNotify: Error trying to access the Vault.") + diff --git a/Scripts/Python/ahnyTrees.py b/Scripts/Python/ahnyTrees.py new file mode 100644 index 0000000000..cabecc6de2 --- /dev/null +++ b/Scripts/Python/ahnyTrees.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__ahnyTrees v%d " % (version)) + + ########################### + def OnFirstUpdate(self): + global respTreeAnimsList + global objTreeList + + try: + ageSDL = PtGetAgeSDL() + ageSDL[SDLTrees.value][0] + except: + PtDebugPrint("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 + PtDebugPrint("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) + PtDebugPrint("ahnyTrees.OnNotify: Tree knocked down") + diff --git a/Scripts/Python/ahnyVogondolaRideV2.py b/Scripts/Python/ahnyVogondolaRideV2.py new file mode 100644 index 0000000000..e407779a1b --- /dev/null +++ b/Scripts/Python/ahnyVogondolaRideV2.py @@ -0,0 +1,812 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 isinstance(enabledControlList, list): + for control in enabledControlList: + disableControlList.remove(control) + control.enable() + + for control in disableControlList: + control.disable() + +def VogondolaIsOccupied( occupant ): + if occupant: + PtDebugPrint("ahnyVogondolaRideV2.VogondolaIsOccupied(): Someone got in the Vog, disabling all access points") + + actHubChairClick.disable() + actEngHutChairClick.disable() + actCallbuttonHub.disable() + actCallbuttonEngHut.disable() + else: + PtDebugPrint("ahnyVogondolaRideV2.VogondolaIsOccupied(): Someone got out of the Vog, enabling all access points") + + sdl = PtGetAgeSDL() + vogLoc = sdl["ahnyVogLocation"][0] + if vogLoc == 0: + PtDebugPrint("SDL set to 0, Hub Chair enabled") + actHubChairClick.enable() + elif vogLoc == 2: + PtDebugPrint("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" + + PtDebugPrint("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: + PtDebugPrint("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") + PtDebugPrint(self.name + ": finished smart-seek") + + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + theAvatar = PtGetLocalAvatar() + theAvatar.avatar.enterSubWorld(soVogSubworld.value) + theAvatar.physics.warpObj(soVogDummy.value.getKey()) + PtDebugPrint(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() + PtDebugPrint("SETTING SDL TO 0") + sdl["ahnyVogLocation"] = (0,) + + elif id == actVogEjectRear.id and state: + DisableVogControls( None ) + respVogEjectHub.run(self.parent.key, state = "rotate") + + sdl = PtGetAgeSDL() + PtDebugPrint("SETTING SDL TO 0") + sdl["ahnyVogLocation"] = (0,) + + elif id == actVogThrottleB.id and state: + DisableVogControls( None ) + respVogRideStart.run(self.parent.key) + + elif id == respVogRideStart.id: + PtDebugPrint("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") + theAvatar.avatar.exitSubWorld() + theAvatar.physics.warpObj(soEjectPointHub.value.getKey()) + respVogEjectHub.run(self.parent.key, avatar = theAvatar, state = "oneshot") + + self.parent.currentBrain = None + PtEnableMovementKeys() + PtDebugPrint("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" + + PtDebugPrint("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: + PtDebugPrint("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" + + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("running respSounds: state - sailtohut loc - sail brain vogridestart") + respSounds.run(self.parent.key, state = "sailtohut") + + elif id == respVogRideStartRev.id: + PtDebugPrint("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" + + PtDebugPrint("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: + PtDebugPrint("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" + + PtDebugPrint("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: + PtDebugPrint("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") + PtDebugPrint(self.name + ": finished smart-seek") + + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + theAvatar = PtGetLocalAvatar() + theAvatar.avatar.enterSubWorld(soVogSubworld.value) + theAvatar.physics.warpObj(soVogDummy.value.getKey()) + PtDebugPrint(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() + PtDebugPrint("SETTING SDL TO 2") + sdl["ahnyVogLocation"] = (2,) + + elif id == actVogEjectRear.id and state: + DisableVogControls( None ) + respVogEjectEngHut.run(self.parent.key, state = "rotate") + + sdl = PtGetAgeSDL() + PtDebugPrint("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: + PtDebugPrint("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") + 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() + PtDebugPrint("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 + PtDebugPrint("Init: ahnyVogondolaRideV2") + + def OnFirstUpdate(self): + try: + ageSDL = PtGetAgeSDL() + except: + PtDebugPrint("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) + + PtDebugPrint("First Update, all buttons disabled") + actCallbuttonHub.disable() + actCallbuttonEngHut.disable() + actHubChairClick.disable() + actEngHutChairClick.disable() + + if ageSDL["ahnyVogOccupant"][0]: + PtDebugPrint("%d is in the Vogondola" % (ageSDL["ahnyVogOccupant"][0])) + self.occupant = ageSDL["ahnyVogOccupant"][0] + else: + PtDebugPrint("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: + PtDebugPrint("Timer says SDL set to 0, Hut call and Hub chair enabled") + actCallbuttonEngHut.enable() + actHubChairClick.enable() + + elif vogLoc == 1: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("timer id 2 returned...run responder") + respHubChairLower.run(self.key, state = "raise") + + elif id == 3: + PtDebugPrint("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()): + PtDebugPrint("Vogondola rider left, enabling call buttons.") + actCallbuttonHub.enable() + actCallbuttonEngHut.enable() + sdl = PtGetAgeSDL() + sdl["ahnyVogOccupant"] = (0,) + self.occupant = None + + def OnNotify(self,state,id,events): + PtDebugPrint("-------------------------------------------------") + PtDebugPrint(" notify: id= %d state= %d" % (id,state)) + if PtFindAvatar(events): + PtDebugPrint(" notify: Trigger= %s Self= %s" % (str(PtGetClientIDFromAvatarKey(PtFindAvatar(events).getKey())),str(PtGetClientIDFromAvatarKey(PtGetLocalAvatar().getKey())))) + PtDebugPrint(" notify: events= %s" % (str(events))) + PtDebugPrint(" ") + + if id == actHubChairClick.id and state: + sdl = PtGetAgeSDL() + PtDebugPrint("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() + PtDebugPrint("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: + PtDebugPrint("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") + + PtDebugPrint("SETTING SDL TO 0") + sdl["ahnyVogLocation"] = (0,) + + elif id == respHubCallbutton.id: + PtDebugPrint("call button hub returned") + PtAtTimeCallback(self.key, 5, 2) + + elif id == actCallbuttonEngHut.id and state: + PtDebugPrint("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") + + PtDebugPrint("SETTING SDL TO 2") + sdl["ahnyVogLocation"] = (2,) + + elif id == respEngHutCallbutton.id: + PtDebugPrint("call button hut returned") + PtAtTimeCallback(self.key, 5, 3) + + elif id == respHubChairLower.id and self.currentBrain == None: + if self.occupant == PtGetLocalAvatar(): + PtDebugPrint("Hub Chair came up, Hub chair enabled") + actHubChairClick.enable() + + cam = ptCamera() + cam.enableFirstPersonOverride() + else: + VogondolaIsOccupied(0) + + sdl = PtGetAgeSDL() + sdl["ahnyVogOccupant"] = (0,) + self.occupant = None + PtDebugPrint("Hub Chair came up, Hut call enabled") + actCallbuttonEngHut.enable() + + elif id == respEngHutChairLower.id and self.currentBrain == None: + if self.occupant == PtGetLocalAvatar(): + PtDebugPrint("Hut Chair came up, Hut chair enabled") + actEngHutChairClick.enable() + + cam = ptCamera() + cam.enableFirstPersonOverride() + else: + VogondolaIsOccupied(0) + + sdl = PtGetAgeSDL() + sdl["ahnyVogOccupant"] = (0,) + self.occupant = None + PtDebugPrint("Hut Chair came up, Hub call enabled") + actCallbuttonHub.enable() + + elif (id == actStopVogSoundForward.id or id == actStopVogSoundBackward.id) and state: + #DisableVogControls() + actStopVogSoundForward.disable() + actStopVogSoundBackward.disable() + PtDebugPrint("running respSounds: state - stop loc - anim event det", id, state) + respSounds.run(self.key, state = "stop") + + else: + if self.currentBrain != None: + PtDebugPrint("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: + PtDebugPrint("Vog Current Brain: None") + else: + PtDebugPrint("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/Scripts/Python/airstream.py b/Scripts/Python/airstream.py new file mode 100644 index 0000000000..f6c05e1bd3 --- /dev/null +++ b/Scripts/Python/airstream.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + + +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 + + PtDebugPrint("__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/Scripts/Python/bhroBahroBlueSpiral.py b/Scripts/Python/bhroBahroBlueSpiral.py new file mode 100644 index 0000000000..a0c32de084 --- /dev/null +++ b/Scripts/Python/bhroBahroBlueSpiral.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("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() + PtDebugPrint("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): + #PtDebugPrint("bhroBahroBlueSpiral.OnNotify: state=%s id=%d events=" % (state, id), events) + + if id == clkBSTsogal.id and not state: + PtDebugPrint("bhroBahroBlueSpiral.OnNotify: clicked Tsogal Spiral") + respRings.run(self.key, state="Tsogal", avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge06"][0] + if not sdlVal: + PtDebugPrint("bhroBahroBlueSpiral.OnNotify: Tturning wedge SDL of psnlBahroWedge06 to On") + psnlSDL["psnlBahroWedge06"] = (1,) + + elif id == clkBSDelin.id and not state: + PtDebugPrint("bhroBahroBlueSpiral.OnNotify: clicked Delin Spiral") + respRings.run(self.key, state="Delin", avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge05"][0] + if not sdlVal: + PtDebugPrint("bhroBahroBlueSpiral.OnNotify: Tturning wedge SDL of psnlBahroWedge05 to On") + psnlSDL["psnlBahroWedge05"] = (1,) + diff --git a/Scripts/Python/bhroBahroMink.py b/Scripts/Python/bhroBahroMink.py new file mode 100644 index 0000000000..e71082b822 --- /dev/null +++ b/Scripts/Python/bhroBahroMink.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("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() + PtDebugPrint(psnlSDL["psnlBahroWedge11"][0]) + + if psnlSDL["psnlBahroWedge11"][0]: + PtDebugPrint("bhroBahroMink.OnServerInitComplete: You have the Minkata wedge, no need to display it.") + respRing.run(self.key, fastforward=1) + + ########################### + def OnNotify(self,state,id,events): + #PtDebugPrint("bhroBahroMink.OnNotify: state=%s id=%d events=" % (state, id), events) + + if id == clickable.id and not state: + PtDebugPrint("bhroBahroMink.OnNotify: clicked Minkata Spiral") + respRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge11"][0] + if not sdlVal: + PtDebugPrint("bhroBahroMink.OnNotify: Turning wedge SDL of psnlBahroWedge11 to On") + psnlSDL["psnlBahroWedge11"] = (1,) diff --git a/Scripts/Python/bhroBahroPOTS.py b/Scripts/Python/bhroBahroPOTS.py new file mode 100644 index 0000000000..fbeee02948 --- /dev/null +++ b/Scripts/Python/bhroBahroPOTS.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("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() + PtDebugPrint("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() + PtDebugPrint(psnlSDL["psnlBahroWedge12"][0]) + PtDebugPrint(psnlSDL["psnlBahroWedge13"][0]) + + if psnlSDL["psnlBahroWedge12"][0]: + PtDebugPrint("bhroBahroPOTS.OnServerInitComplete: You have the Ercana wedge, no need to display it.") + respErcanaRing.run(self.key, fastforward=1) + if psnlSDL["psnlBahroWedge13"][0]: + PtDebugPrint("bhroBahroPOTS.OnServerInitComplete: You have the Ahnonay wedge, no need to display it.") + respAhnonayRing.run(self.key, fastforward=1) + + + def OnNotify(self,state,id,events): + #PtDebugPrint("bhroBahroPOTS.OnNotify: state=%s id=%d events=" % (state, id), events) + + if id == clkErcana.id and state: + PtDebugPrint("bhroBahroPOTS.OnNotify: clicked Ercana symbol") + respErcanaRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge12"][0] + if not sdlVal: + PtDebugPrint("bhroBahroPOTS.OnNotify: Turning wedge SDL of psnlBahroWedge12 to On") + psnlSDL["psnlBahroWedge12"] = (1,) + + elif id == clkAhnonay.id and state: + PtDebugPrint("bhroBahroPOTS.OnNotify: clicked Ahnonay symbol") + respAhnonayRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge13"][0] + if not sdlVal: + PtDebugPrint("bhroBahroPOTS.OnNotify: Turning wedge SDL of psnlBahroWedge13 to On") + psnlSDL["psnlBahroWedge13"] = (1,) + + diff --git a/Scripts/Python/bhroBahroPod.py b/Scripts/Python/bhroBahroPod.py new file mode 100644 index 0000000000..3aa1806592 --- /dev/null +++ b/Scripts/Python/bhroBahroPod.py @@ -0,0 +1,173 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("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() + PtDebugPrint("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() + PtDebugPrint(psnlSDL["psnlBahroWedge07"][0]) + PtDebugPrint(psnlSDL["psnlBahroWedge08"][0]) + PtDebugPrint(psnlSDL["psnlBahroWedge09"][0]) + PtDebugPrint(psnlSDL["psnlBahroWedge10"][0]) + + if psnlSDL["psnlBahroWedge07"][0]: + PtDebugPrint("bhroBahroPod.OnServerInitComplete: You have the Negilahn wedge, no need to display it.") + respNegilahnRing.run(self.key, fastforward=1) + if psnlSDL["psnlBahroWedge08"][0]: + PtDebugPrint("bhroBahroPod.OnServerInitComplete: You have the Dereno wedge, no need to display it.") + respDerenoRing.run(self.key, fastforward=1) + if psnlSDL["psnlBahroWedge09"][0]: + PtDebugPrint("bhroBahroPod.OnServerInitComplete: You have the Payiferen wedge, no need to display it.") + respPayiferenRing.run(self.key, fastforward=1) + if psnlSDL["psnlBahroWedge10"][0]: + PtDebugPrint("bhroBahroPod.OnServerInitComplete: You have the Tetsonot wedge, no need to display it.") + respTetsonotRing.run(self.key, fastforward=1) + + ########################### + def OnNotify(self,state,id,events): + #PtDebugPrint("bhroBahroPod.OnNotify: state=%s id=%d events=" % (state, id), events) + + if id == clkNegilahn.id and not state: + PtDebugPrint("bhroBahroPod.OnNotify: clicked Negilahn Spiral") + respNegilahnRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge07"][0] + if not sdlVal: + PtDebugPrint("bhroBahroPod.OnNotify: Turning wedge SDL of psnlBahroWedge07 to On") + psnlSDL["psnlBahroWedge07"] = (1,) + + elif id == clkDereno.id and not state: + PtDebugPrint("bhroBahroPod.OnNotify: clicked Dereno Spiral") + respDerenoRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge08"][0] + if not sdlVal: + PtDebugPrint("bhroBahroPod.OnNotify: Turning wedge SDL of psnlBahroWedge08 to On") + psnlSDL["psnlBahroWedge08"] = (1,) + + elif id == clkPayiferen.id and not state: + PtDebugPrint("bhroBahroPod.OnNotify: clicked Payiferen Spiral") + respPayiferenRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge09"][0] + if not sdlVal: + PtDebugPrint("bhroBahroPod.OnNotify: Turning wedge SDL of psnlBahroWedge09 to On") + psnlSDL["psnlBahroWedge09"] = (1,) + + elif id == clkTetsonot.id and not state: + PtDebugPrint("bhroBahroPod.OnNotify: clicked Tetsonot Spiral") + respTetsonotRing.run(self.key, avatar=PtFindAvatar(events)) + psnlSDL = xPsnlVaultSDL() + sdlVal = psnlSDL["psnlBahroWedge10"][0] + if not sdlVal: + PtDebugPrint("bhroBahroPod.OnNotify: Turning wedge SDL of psnlBahroWedge10 to On") + psnlSDL["psnlBahroWedge10"] = (1,) + diff --git a/Scripts/Python/bhroBahroYeeshaCave.py b/Scripts/Python/bhroBahroYeeshaCave.py new file mode 100644 index 0000000000..2a36c8c313 --- /dev/null +++ b/Scripts/Python/bhroBahroYeeshaCave.py @@ -0,0 +1,852 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 entry is 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: + PtDebugPrint("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() + PtDebugPrint("GetAutoStartLevel = ",self.GetAutoStartLevel()) + else: + PtDebugPrint("bhroBahroYeeshaCave.OnServerInitComplete(): useYeeshaSpeech = None") + + UseYS = self.UseYeeshaSpeech + PtDebugPrint("bhroBahroYeeshaCave.OnServerInitComplete(): useYeeshaSpeech = ",UseYS) + PtDebugPrint("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() + PtDebugPrint("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 isinstance(state, int): + #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 RuntimeError("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() + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + ypageSDL = psnlSDL.findVar("YeeshaPage25") + if ypageSDL: + size, state = divmod(ypageSDL.getInt(), 10) + PtDebugPrint("YeeshaPage25 = ",state) + if state == 1: + PtDebugPrint("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() + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + ypageSDL = psnlSDL.findVar("YeeshaPage25") + if ypageSDL: + size, state = divmod(ypageSDL.getInt(), 10) + PtDebugPrint("YeeshaPage25 = ",state) + if state != 1: + PtDebugPrint("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: + PtDebugPrint("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": + PtDebugPrint("playing 'age' YeeshaSpeech for: ",age) + self.ageDict[age]["YeeshaSpeech"].run(self.key) + self.SpeechRespReset = 0 + elif self.currentYS != "zz": + PtDebugPrint("playing 'sequential' YeeshaSpeech...") + PtDebugPrint("speech = ",speech) + PtDebugPrint("self.currentYS = ",self.currentYS) + state = speech + self.currentYS + PtDebugPrint("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: + PtDebugPrint("bhroBahroYeeshaCave.DoWedge(): ERROR. Didn't recognize previous age name, no wedge will be set") + return + + sdlVal = psnlSDL[sdlName][0] + if not sdlVal: + PtDebugPrint("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): + PtDebugPrint("bhroBahroYeeshaCave.GetAutoStartLevel()") + vault = ptVault() + bc = vault.findChronicleEntry("BahroCave") + if bc is not 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 bc is not None: + val = bc.chronicleGetValue() + if val == "": + val = 0 + else: + val = int(val) + bc.chronicleSetValue(str(val + 1)) + bc.save() + PtDebugPrint("bhroBahroYeeshaCave.IncrementAutoStartLevel(): setting BC chron = ",str(val + 1)) + else: + PtDebugPrint("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: + PtDebugPrint("bhroBahroYeeshaCave.OnBackdoorMsg(): ERROR. Incorrect age specified, no wedge will be set") + return + + sdlVal = psnlSDL[sdlName][0] + if sdlVal: + PtDebugPrint("bhroBahroYeeshaCave.OnBackdoorMsg(): previous age was %s, turning wedge SDL of %s to OFF" % (param,sdlName)) + psnlSDL[sdlName] = (0,) + else: + PtDebugPrint("bhroBahroYeeshaCave.OnBackdoorMsg(): previous age was %s, turning wedge SDL of %s to ON" % (param,sdlName)) + psnlSDL[sdlName] = (1,) + diff --git a/Scripts/Python/bhroStarfieldOrCavern.py b/Scripts/Python/bhroStarfieldOrCavern.py new file mode 100644 index 0000000000..5b02d4509c --- /dev/null +++ b/Scripts/Python/bhroStarfieldOrCavern.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/city.py b/Scripts/Python/city.py new file mode 100644 index 0000000000..66e7d8f2b8 --- /dev/null +++ b/Scripts/Python/city.py @@ -0,0 +1,225 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("city.__init__(): city version = public") + else: + PtDebugPrint("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" + + PtDebugPrint("city.__init__(): spTitle = ",spTitle) + PtDebugPrint("city.__init__(): spName = ",spName) + + ## NOT USING THIS FOR NOW - MAY NEED TO LOAD IN SPECIFIC PAGE(S) FOR FUTURE CITY AREAS... +# if spTitle == "KadishGallery": +# PtDebugPrint("city.__init__(): we're linking into KadishGallery, only that page will be loaded") +# IsKadishGallery = 1 +# else: +# PtDebugPrint("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: + PtDebugPrint("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): + PtDebugPrint("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/Scripts/Python/clftEndingCredits.py b/Scripts/Python/clftEndingCredits.py new file mode 100644 index 0000000000..fc3822269b --- /dev/null +++ b/Scripts/Python/clftEndingCredits.py @@ -0,0 +1,253 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__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: + PtDebugPrint("OnSDL launched the credits.") + boolSceneBahro = ageSDL[SDLVarSceneBahro][0] + if boolSceneBahro == 0: + PtDebugPrint("clftEndingCredits.OnSDLNotify(): we're no longer showing the credits here") + cam = ptCamera() + cam.enableFirstPersonOverride() + PtEnableMovementKeys() + PtSendKIMessage(kEnableKIandBB,0) +# PtDebugPrint("\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: + PtDebugPrint("No credits.") + + pass + + + def OnNotify(self,state,id,events): + global AlreadyClosed + + if (id == RgnSnsrSndLogTracks.id and state): + import xSndLogTracks + if xSndLogTracks.IsLogMode(): + PtDebugPrint("Start of Egg!!! Enable Riven scope clickable") + ClkSndLogTracks.enable() + else: + PtDebugPrint("not this time") + ClkSndLogTracks.disable() + + if (id == ClkSndLogTracks.id and state): + #PtPageInNode("clftSndLogTracks") + RespSndLogTracks.run(self.key,avatar=PtGetLocalAvatar()) + + + if AlreadyClosed: + PtDebugPrint("failed AlreadyClosed check") + return + + for event in events: + if event[0] == PtEventType.kBook: + if event[1] == PtBookEventTypes.kNotifyHide: + AlreadyClosed = True + PtFadeOut(kFadeOutToGameSeconds,1) + PtDebugPrint("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) + PtDebugPrint("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 + PtDebugPrint("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 + PtDebugPrint("clftEndingCredits.OnTimer(): The credits book is now hidden") + gJournalBook.hide() + PtAtTimeCallback(self.key,kFadeOutToGameSeconds,kFadeOutToGameID) + + elif id == kFadeInToGameID: # 6 + PtFadeIn(kFadeInToGameSeconds,1) + PtDebugPrint("clftEndingCredits.OnTimer(): FadeIn over", kFadeInToGameSeconds," seconds") + cam = ptCamera() + cam.enableFirstPersonOverride() + PtEnableMovementKeys() + PtSendKIMessage(kEnableKIandBB,0) + + + def IFadeOutToCredits(self): + PtFadeOut(kFadeOutToCreditsSeconds,1) + PtDebugPrint("clftEndingCredits.IFadeOutToCredits(): FadeOut over", kFadeOutToCreditsSeconds," seconds.") + PtAtTimeCallback(self.key,4,kShowCreditsID) + + + def IShowCredits(self): + global gJournalBook + global AlreadyClosed + + PtDebugPrint("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) + PtDebugPrint("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/Scripts/Python/clftGetPersonalBook.py b/Scripts/Python/clftGetPersonalBook.py new file mode 100644 index 0000000000..d78c051d81 --- /dev/null +++ b/Scripts/Python/clftGetPersonalBook.py @@ -0,0 +1,258 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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.webm" +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 entry is not 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: + #~ PtDebugPrint("Playing female book animation") + BookAnimFemale.animation.play() + elif currentgender == 0: + #~ PtDebugPrint("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) + #~ PtDebugPrint("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) + PtDebugPrint("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 gDemoMovie is not None: + gDemoMovie.resume() + elif id == kTrailerDoneID: + PtDebugPrint("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/Scripts/Python/clftImager.py b/Scripts/Python/clftImager.py new file mode 100644 index 0000000000..2375916e03 --- /dev/null +++ b/Scripts/Python/clftImager.py @@ -0,0 +1,948 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 random +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 + random.seed() + + + def OnFirstUpdate(self): + #self.ageSDL = PtGetAgeSDL() + #self.ageSDL.setFlags(stringSDLVarPanelE.value,1,1) + #self.ageSDL.sendToClients(stringSDLVarPanelE.value) + pass + + + 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: + PtDebugPrint("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 + PtDebugPrint("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() + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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 + PtDebugPrint("play final speech") + elif (self.OpeningSolved()): + PlayFull = 1 + PlayFinal = 0 + PtDebugPrint("play full opening speech") + elif (self.TPOTSolved()): + PlayFull = 0 + PlayFinal = 0 + PlayTPOT = 1 + PtDebugPrint("play TPOT speech") + else: + PlayFull = 0 + PlayFinal = 0 + PtDebugPrint("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): + PtDebugPrint("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() + PtDebugPrint("Now, killing vision") + speechKilled = 1 + self.StopVision() + elif visionplaying == 0: + self.StartVision() + if PlayFinal == 1: + PtDebugPrint("nothing") + # this timer value is approximate right now + #PtAtTimeCallback(self.key, 204.2, kFinished) + elif PlayFinal == 0 and PlayFull == 0 and PlayTPOT == 0: + stopvision = random.randint(minstoptime, maxstoptime) + PtDebugPrint("\tImager will autoshut off in %d seconds" % (stopvision)) + PtAtTimeCallback(self.key, stopvision, kVision) + elif PlayFull == 1: + PtDebugPrint("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: + PtDebugPrint("adding Yeesha reward clothing %s to wardrobe" % (clothingName)) + avatar.avatar.addWardrobeClothingItem(clothingName,ptColor().white(),ptColor().black()) + else: + PtDebugPrint("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: + PtDebugPrint("what's wrong with the door?") + + if (id == YeeshaSceneTimerDone.id and state and PlayScene == 1): + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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())) + + PtDebugPrint("clftImager.OpenSolved(): solution list:", solutionList) + PtDebugPrint("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 chron is not None: + ageChronRefList = chron.getChildNodeRefList() + + if ageChronRefList is not 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 entry is not 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 isinstance(symbol, str): + 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 + + PtDebugPrint("clftImager.EndgameSolved(): solution list: " + str(solutionList)) + PtDebugPrint("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 + + PtDebugPrint("clftImager.TPOTSolved(): solution list:", solutionList) + PtDebugPrint("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)) + PtDebugPrint("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: + PtDebugPrint("\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: + #~ PtDebugPrint("\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: + PtDebugPrint("\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: + PtDebugPrint("\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 + + PtDebugPrint("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 entry is 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 + + PtDebugPrint("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 + PtDebugPrint("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: + PtDebugPrint("clftImager.StopVision: Don't know which vision to kill!") + + PtDebugPrint("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 entryCityLinks is not None: + valCityLinks = entryCityLinks.chronicleGetValue() + PtDebugPrint("valCityLinks = ",valCityLinks) + CityLinks = valCityLinks.split(",") + PtDebugPrint("CityLinks = ",CityLinks) + if agePanel not in CityLinks: + NewLinks = valCityLinks + "," + agePanel + entryCityLinks.chronicleSetValue(NewLinks) + entryCityLinks.save() + PtDebugPrint("xLinkingBookGUIPopup.IDoCityLinksChron(): setting citylinks chron entry to include: ",agePanel) + valCityLinks = entryCityLinks.chronicleGetValue() + CityLinks = valCityLinks.split(",") + PtDebugPrint("xLinkingBookGUIPopup.IDoCityLinksChron(): citylinks now = ",CityLinks) + else: + PtDebugPrint("xLinkingBookGUIPopup.IDoCityLinksChron(): do nothing, citylinks chron already contains: ",agePanel) + else: + vault.addChronicleEntry("CityBookLinks",0,agePanel) + PtDebugPrint("xLinkingBookGUIPopup.IDoCityLinksChron(): creating citylinks chron entry and adding: ",agePanel) + + psnlSDL = xPsnlVaultSDL() + GotBook = psnlSDL["psnlGotCityBook"][0] + if not GotBook: + psnlSDL["psnlGotCityBook"] = (1,) + PtDebugPrint("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/Scripts/Python/clftIntroMusic.py b/Scripts/Python/clftIntroMusic.py new file mode 100644 index 0000000000..a0017bb206 --- /dev/null +++ b/Scripts/Python/clftIntroMusic.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 not state: + return + + + #PtDebugPrint("clftIntroMusic: We've got notification from ID #:%s" %id) + + #-----Activators----- + startMusicActIDs = (actStartMusic01.id, actStartMusic02.id, actStartMusic03.id) + if id in startMusicActIDs: + if musicState == kOff: + PtDebugPrint("clftIntroMusic: ---Starting Music---") + musicState = kInitialPlay + respStartMusic.run(self.key) + return + + elif id == actStopMusic.id: + if musicState == kInitialPlay: + PtDebugPrint("clftIntroMusic: ###Stopping Music###") + respStopInitialMusic.run(self.key) + elif musicState == kRandomPlay: + PtDebugPrint("clftIntroMusic: ###Stopping Music###") + respStopRandomMusic.run(self.key) + musicState = kOff + return + + #-----Responders----- + elif id == respStartMusic.id: + if musicState == kInitialPlay: + PtDebugPrint("clftIntroMusic: ___Randomly Starting Music___") + musicState = kRandomPlay + respStartRandomMusic.run(self.key) + return + + diff --git a/Scripts/Python/clftNpcZandi.py b/Scripts/Python/clftNpcZandi.py new file mode 100644 index 0000000000..636d7c630e --- /dev/null +++ b/Scripts/Python/clftNpcZandi.py @@ -0,0 +1,566 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +Module: clftNpcZandi +Age: Cleft +Date: September 2002 +Author: Doug McBride +Controls Zandi for Phase0 dialog +""" + +from Plasma import * +from PlasmaTypes import * +import random +import time +import PlasmaControlKeys +import xEnum + +# define the attributes that will be entered in max +Activate = ptAttribActivator(1, "Region Sensor") +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 + PtDebugPrint("__init__clftNpcZandi v.", self.version) + self.NpcName = None + self.ZandiFace = None + random.seed() + + 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 + + vault = ptVault() + #~ entry = vault.findChronicleEntry("JourneyClothProgress") + #~ if entry is not None: + #~ FoundJCs = entry.chronicleGetValue() + #~ if "Z" in FoundJCs: + #~ PtPageOutNode("clftZandiVis") + #~ PtDebugPrint("Zandi seems to have stepped away from the Airstream. Hmmm...") + + entry = vault.findChronicleEntry("YeeshaVisionViewed") + if entry is None: + vault.addChronicleEntry("YeeshaVisionViewed", 0, "0") + + PtAtTimeCallback(self.key, PageTurnInterval, TimerID.TurnPage) + + def OnNotify(self,state,id,events): + PtDebugPrint("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: + PtDebugPrint("Zandi was clicked") + if not self.IsTalking: + PtDebugPrint("Zandi will talk") + self.ZandiSpeaks(1) + else: + PtDebugPrint("Zandi is already talking") + + elif id == Activate.id: + # Zandi himself will activate the region when he spawns... + # So, only let the avatar who enters do this. Zandi != local avatar, so win + if PtFindAvatar(events) != PtGetLocalAvatar(): + return + + 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 + #~ PtDebugPrint("Stepped away") + self.NearZandi = 0 + self.PlayWelcome2 = 0 + + elif id == MultiStage01.id: + PtDebugPrint("notified by behavior") + for event in events: + if event[0]==10 and event[2]==3: # A Zandi behavior just finished. Returning to idle animation. + PtDebugPrint("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 ): + PtDebugPrint("zandi finished talking") + if self.PlayOnFinish: + PtDebugPrint("zandi has more to say") + self.PlayOnFinish = 0 + self.ZandiSpeaks() + else: + PtDebugPrint("zandi really is done and is ready to say more") + self.IsTalking = 0 + + def OnTimer(self,id): + #~ global firstpauserange + if id < 10: + PtDebugPrint("attempt behavior ", id) + if not self.DoingBehavior: + PtDebugPrint("doing behavior ", id) + self.DoingBehavior = 1 + MultiStage01.gotoStage(self.NpcName, id,dirFlag=1,isForward=1) + if isinstance(self.ZandiFace, str): + PtDebugPrint("using zandi face anim:", self.ZandiFace) + self.NpcName.avatar.playSimpleAnimation(self.ZandiFace) + + elif id == TimerID.TurnPage: + PtDebugPrint("attempt turn page") + if not self.DoingBehavior: + PtDebugPrint("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: + PtDebugPrint("timer ignorefinished") + if self.NearZandi: + if self.IsTalking: + PtDebugPrint("zandi's talking, play on finish") + self.PlayOnFinish = 1 + else: + "speak zandi speak!" + self.ZandiSpeaks() + else: + PtDebugPrint("zandi's done ignoring") + self.IsIgnoring = 0 + + + def GetJCProgress(self): + vault = ptVault() + chron = vault.findChronicleEntry("JourneyClothProgress") + jcProgress = "" + if not chron is 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): + PtDebugPrint("check for jc") + if jcDict[jc] in progress: + return 1 + else: + return 0 + + def BahroDoorStillClosed(self, sdl): + PtDebugPrint("in bahro door still closed") + if sdl["clftBahroDoorClosed"][0]: + return 1 + else: + return 0 + + def BrakeNotReleased(self, sdl): + PtDebugPrint("in brake not released") + if sdl["clftAgeSDLWindmillLocked"][0]: + return 1 + else: + return 0 + + def WindmillNotTurning(self, sdl): + PtDebugPrint("in windmill not turning") + if sdl["clftAgeSDLWindmillRunning"][0]: + return 0 + else: + return 1 + + def HaventSeenImagerMessage(self): + PtDebugPrint("in haven't seen imager message") + vault = ptVault() + entry = vault.findChronicleEntry("YeeshaVisionViewed") + if entry is 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): + PtDebugPrint("in needs welcome") + if self.LastSpeech < 0 and clicked: + PtDebugPrint("last speech less than 0 and clicked") + return 1 + + vault = ptVault() + entry = vault.findChronicleEntry("ZandiWelcome") + if entry is 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" + + PtDebugPrint("last speech:", self.LastSpeech) + + self.IsTalking = 1 + stage = random.randint(1,5) + sdl = PtGetAgeSDL() + + if self.PlayWelcome2 and clicked: + if self.LastSpeech >= 0: + PtDebugPrint("we've moved past the welcome, so don't play welcome 2") + self.PlayWelcome2 = 0 + else: + PtDebugPrint("let's play welcome2") + self.PlaySecondWelcome() + stage = 4 + + if self.NeedsWelcome(clicked): + PtDebugPrint("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" + + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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" + PtDebugPrint("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 = random.randint(2,6) + useSpeech = sayings[usesaying] + + self.ZandiFace = "ZandiRand0" + str( usesaying - 1) + "Face" + + if useSpeech != "": + PtDebugPrint("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/Scripts/Python/clftRS.py b/Scripts/Python/clftRS.py new file mode 100644 index 0000000000..b4b3718647 --- /dev/null +++ b/Scripts/Python/clftRS.py @@ -0,0 +1,152 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 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 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/Scripts/Python/clftTreeLadder.py b/Scripts/Python/clftTreeLadder.py new file mode 100644 index 0000000000..f5393e685e --- /dev/null +++ b/Scripts/Python/clftTreeLadder.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__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) + PtDebugPrint("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) + PtDebugPrint("Playing sfx for climbing into the tree") + + diff --git a/Scripts/Python/clftWindmill.py b/Scripts/Python/clftWindmill.py new file mode 100644 index 0000000000..49babfd79f --- /dev/null +++ b/Scripts/Python/clftWindmill.py @@ -0,0 +1,261 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 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 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 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() + + #Avatar bugfix + if playerID == 0: + player = None + else: + key = PtGetAvatarKeyFromClientID(playerID) + player = key.getSceneObject() + + 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=player) + 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=player) + #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=player) + 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=player) + + + 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=PtFindAvatar(events)) + respLightsOnOff.run(self.key,state='On',avatar=PtFindAvatar(events)) + respGrinderOn.run(self.key) + if boolTomahnaActive == 0: + respImagerButtonLight.run(self.key,state='On',avatar=PtFindAvatar(events)) + windmillRunning = 1 + self.ageSDL[stringSDLVarRunning.value] = (windmillRunning,) + windmillUnstuck = 1 + self.ageSDL[stringSDLVarUnstuck.value] = (windmillUnstuck,) + elif windmillLocked == 1: + respLockedCCW.run(self.key,avatar=PtFindAvatar(events)) + + if (id == respBrakeOn.id): + if stopGrinder: + respGrinderOff.run(self.key) + stopGrinder = 0 + respStop.run(self.key,state='Stop',avatar=PtFindAvatar(events)) + respLightsOnOff.run(self.key,state='Off',avatar=PtFindAvatar(events)) + respImagerButtonLight.run(self.key,state='Off',avatar=PtFindAvatar(events)) + windmillRunning = 0 + self.ageSDL[stringSDLVarRunning.value] = (windmillRunning,) + + if (id == respBrakeOff.id): + if windmillRunning == 1: + respGrinderOn.run(self.key) + respStartAtLoad.run(self.key,avatar=PtFindAvatar(events)) + respLightsOnOff.run(self.key,state='On',avatar=PtFindAvatar(events)) + self.ageSDL[stringSDLVarRunning.value] = (windmillRunning,) + if boolTomahnaActive == 0: + respImagerButtonLight.run(self.key,state='On',avatar=PtFindAvatar(events)) diff --git a/Scripts/Python/clftYeeshaPage08.py b/Scripts/Python/clftYeeshaPage08.py new file mode 100644 index 0000000000..ed60367cdf --- /dev/null +++ b/Scripts/Python/clftYeeshaPage08.py @@ -0,0 +1,237 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__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() + 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() + 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 + + + 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/Scripts/Python/clftYeeshaPageImager.py b/Scripts/Python/clftYeeshaPageImager.py new file mode 100644 index 0000000000..4fa8776321 --- /dev/null +++ b/Scripts/Python/clftYeeshaPageImager.py @@ -0,0 +1,228 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 random +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 + PtDebugPrint("__init__clftYeeshaPageImager v.", version) + self.ImagerUsable = 1 + random.seed() + + def OnFirstUpdate(self): + global PlayFull + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + PtUnloadDialog("YeeshaPageGUI") + 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] + PtDebugPrint("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") + #PtDebugPrint("starting blinking green light") + else: + GreenLightResp.run(self.key, state = "Solid") + #PtDebugPrint("starting solid green light") + else: + GreenLightResp.run(self.key, state = "Off") + #PtDebugPrint("green light is off") + + if inTomahna: + PtLoadDialog("YeeshaPageGUI") + + + def OnSDLNotify(self,VARname,SDLname,PlayerID,tag): + PtDebugPrint("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") + #PtDebugPrint("starting blinking green light") + else: + GreenLightResp.run(self.key, state = "Solid") + #PtDebugPrint("starting solid green light") + else: + GreenLightResp.run(self.key, state = "Off") + #PtDebugPrint("green light is off") + self.CloseImager() + + + def OnNotify(self,state,id,events): + global PlayFull + global visionplaying + + if not state: + return + + PtDebugPrint("clftYeeshaPageImager.OnNotify()") + PtDebugPrint("ImagerUsable: %d" % self.ImagerUsable) + + for event in events: + #~ PtDebugPrint("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 + PtDebugPrint("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 + PtDebugPrint("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: +# PtDebugPrint("Closing. Playfull = ", PlayFull) + self.CloseImager() + else: + # imager is done opening and it is starting to loop so enable the clickable + ActImager.enable() +# PtDebugPrint("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 + + PtDebugPrint("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 + PtDebugPrint("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/Scripts/Python/dsntKILightMachine.py b/Scripts/Python/dsntKILightMachine.py new file mode 100644 index 0000000000..66b9ad55d5 --- /dev/null +++ b/Scripts/Python/dsntKILightMachine.py @@ -0,0 +1,258 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# 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: + PtDebugPrint("dsntKILightMachine.OnNotify(): you've got your KI, proceeding...") + respGotKI.run(self.key) + else: + PtDebugPrint("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: + PtDebugPrint("light already on, resetting...") + self.SetKILightTime(2) + + + def SetKILightTime(self,on): + global lightStop + global lightOn + PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("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 entry is not None: + entryValue = entry.chronicleGetValue() + oldVal = string.atoi(entryValue) + if remaining == oldVal: + return + PtDebugPrint("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): + #PtDebugPrint("dsntKILightMachine.OnTimer(): id = ",id) + if id == kLightStopID: + curTime = PtGetDniTime() + PtDebugPrint("dsntKILightMachine.OnTimer(): lightStop = ",lightStop,", curTime = ",curTime) + if curTime >= (lightStop - 1): + self.DoKILight(0,0) + else: + PtDebugPrint("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) + PtDebugPrint("dsntKILightMachine.DoKILight(): turning light on for ",remaining," seconds") + lightOn = 1 + else: + PtDebugPrint("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): + PtDebugPrint("dsntKILightMachine.BeginAgeUnLoad()-->\tavatar page out") + curTime = PtGetDniTime() + timeRemaining = (lightStop - curTime) + if timeRemaining > 0: + self.DoKILight(0,1,timeRemaining) + diff --git a/Scripts/Python/ercaBakePellets.py b/Scripts/Python/ercaBakePellets.py new file mode 100644 index 0000000000..8846a9572b --- /dev/null +++ b/Scripts/Python/ercaBakePellets.py @@ -0,0 +1,604 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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: + PtDebugPrint("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: + PtDebugPrint("ONLY CALL GetRecipe ONCE") + fastforward = 0 + self.IGetRecipe(fastforward) + elif byteFinishTime == 0: + PtDebugPrint("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] + + PtDebugPrint("IGetRecipe.Oven1Start = ",Oven1Start) + PtDebugPrint("IGetRecipe.Oven2Start = ",Oven2Start) + PtDebugPrint("IGetRecipe.Oven3Start = ",Oven3Start) + PtDebugPrint("IGetRecipe.Oven4Start = ",Oven4Start) + + self.IUpdateOvens(fastforward) + + + def IUpdateOvens(self,fastforward): + PtDebugPrint("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(): + PtDebugPrint("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: + PtDebugPrint("Start Oven1 bake") + RespOven1.run(self.key,state="on",fastforward=fastforward) + Oven1On = 1 + if CurTime == Oven2Start: + PtDebugPrint("Start Oven2 bake") + RespOven2.run(self.key,state="on",fastforward=fastforward) + Oven2On = 1 + if CurTime == Oven3Start: + PtDebugPrint("Start Oven3 bake") + RespOven3.run(self.key,state="on",fastforward=fastforward) + Oven3On = 1 + if CurTime == Oven4Start: + PtDebugPrint("Start Oven4 bake") + RespOven4.run(self.key,state="on",fastforward=fastforward) + Oven4On = 1 + else: + if CurTime > Oven1Start: + PtDebugPrint("Start Oven1 bake") + RespOven1.run(self.key,state="on",fastforward=fastforward) + Oven1On = 1 + if CurTime > Oven2Start: + PtDebugPrint("Start Oven2 bake") + RespOven2.run(self.key,state="on",fastforward=fastforward) + Oven2On = 1 + if CurTime > Oven3Start: + PtDebugPrint("Start Oven3 bake") + RespOven3.run(self.key,state="on",fastforward=fastforward) + Oven3On = 1 + if CurTime > Oven4Start: + PtDebugPrint("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: + PtDebugPrint("OnTimer callback, but baking was either finished or cancelled. Doing nothing.") + elif id == 2: + if self.sceneobject.isLocallyOwned(): + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("time1_val = ",time1_val) + PtDebugPrint("amt1_val = ",amt1_val) + PtDebugPrint("temp1_val = ",temp1_val,"\n") + PtDebugPrint("time2_val = ",time2_val) + PtDebugPrint("amt2_val = ",amt2_val) + PtDebugPrint("temp2_val = ",temp2_val,"\n") + PtDebugPrint("time3_val = ",time3_val) + PtDebugPrint("amt3_val = ",amt3_val) + PtDebugPrint("temp3_val = ",temp3_val,"\n") + PtDebugPrint("time4_val = ",time4_val) + PtDebugPrint("amt4_val = ",amt4_val) + PtDebugPrint("temp4_val = ",temp4_val,"\n") + PtDebugPrint("z1 = ",z1) + PtDebugPrint("z2 = ",z2) + PtDebugPrint("z3 = ",z3) + PtDebugPrint("z4 = ",z4) + PtDebugPrint("z = ",z,"\n") + recipetest = int(round(100 * z)) + PtDebugPrint("recipe test = ",recipetest) + return + + Recipe = int(round(100 * z)) + +# if Recipe == 0: +# Recipe = 1 + + PtDebugPrint("Pellet recipe = ",Recipe) + + RecipeSDL = Recipe + 300 + + if RecipeSDL < 1: + RecipeSDL = 1 + + PtDebugPrint("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] + PtDebugPrint("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/Scripts/Python/ercaBakeryElev.py b/Scripts/Python/ercaBakeryElev.py new file mode 100644 index 0000000000..b93225ebaf --- /dev/null +++ b/Scripts/Python/ercaBakeryElev.py @@ -0,0 +1,313 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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]) ) + + # Fix for elevator getting stuck permanently if a player has previously linked or crashed while it was busy + if boolElevBusy and self.sceneobject.isLocallyOwned(): + PtDebugPrint("DEBUG: ercaBakeryElev.OnServerInitComplete():\tElevator busy but I am alone! Resetting...") + ageSDL[SDLElevBusy.value] = (0,) + boolElevBusy = 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)): + PtDebugPrint("ActElevBtn callback") + ageSDL[SDLElevBusy.value] = (1,) + + if (id == RespElevClk.id): + PtDebugPrint("RespElevClk callback") + if boolElevPos: + if self.sceneobject.isLocallyOwned(): + PtDebugPrint("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(): + PtDebugPrint("owner") + ageSDL[SDLElevPos.value] = (1,) + + if (id == RespElevOps.id): + PtDebugPrint("RespElevOps callback") + if self.sceneobject.isLocallyOwned(): + PtDebugPrint("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(): + PtDebugPrint("owner") + ageSDL[SDLPower.value] = (0,) + + if (id == RespBkryPwrOn.id) and self.sceneobject.isLocallyOwned(): + PtDebugPrint("owner") + ageSDL[SDLPower.value] = (1,) + diff --git a/Scripts/Python/ercaCallCar.py b/Scripts/Python/ercaCallCar.py new file mode 100644 index 0000000000..feb845fd2b --- /dev/null +++ b/Scripts/Python/ercaCallCar.py @@ -0,0 +1,174 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 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 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/Scripts/Python/ercaControlRoom.py b/Scripts/Python/ercaControlRoom.py new file mode 100644 index 0000000000..75a5aae5d5 --- /dev/null +++ b/Scripts/Python/ercaControlRoom.py @@ -0,0 +1,587 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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(): + PtDebugPrint("setting SDLMixBtn to 0") + ageSDL[SDLMixBtn.value] = (0,) + elif byteOvenBtnNew > 0 and self.sceneobject.isLocallyOwned(): + PtDebugPrint("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)): + PtDebugPrint("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)): + PtDebugPrint("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): + PtDebugPrint("RespScrollX callback") + self.ImgrView(byteImgrNew,"enter") + + elif (id == RespImgrView0.id) or (id == RespImgrView1.id) or (id == RespImgrView2.id) or (id == RespImgrView3.id): + PtDebugPrint("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)): + PtDebugPrint("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)): + PtDebugPrint("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)): + PtDebugPrint("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 + #PtDebugPrint("valveNum = ",valveNum) + tunnel = TunnelsOccupied[valveNum] + #PtDebugPrint("tunnel = ",tunnel) + if tunnel != []: + PtDebugPrint("tried to operate valve %d, but the tunnel is occupied; denied!" % (valveNum)) + PtDebugPrint("players in this tunnel:") + for player in tunnel: + PtDebugPrint(player) + RespWarningLight.run(self.key) + return + else: + PtDebugPrint("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)): + PtDebugPrint("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: + #PtDebugPrint("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 + #PtDebugPrint("enter tunnel ",id) + else: + #PtDebugPrint("exit tunnel ",id) + state = 0 + else: + return + except NameError: + PtDebugPrint("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: +# PtDebugPrint("playerID: %d has ENTERED tunnel: %d" % (playerID,rgn)) +# else: +# PtDebugPrint("playerID: %d has EXITED tunnel: %d" % (playerID,rgn)) + self.SendNote('%d;%d;%d' % (rgn,state,playerID)) + + elif id == (-1): + #PtDebugPrint("incoming event: %s" % (events[0][1])) + code = events[0][1] + #PtDebugPrint("playing command: %s" % (code)) + self.ExecCode(code) + + + def UpdateTunnelRgn(self,rgn,state,playerID): + #PtDebugPrint("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) + PtDebugPrint("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() + + def ExecCode(self, code): + try: + chunks = code.split(';') + ecRgn = int(chunks[0]) + ecState = int(chunks[1]) + ecPlayerID = int(chunks[2]) + self.UpdateTunnelRgn(ecRgn,ecState,ecPlayerID) + except: + PtDebugPrint("ercaControlRoom.ExecCode(): ERROR! Invalid code '%s'." % (code)) diff --git a/Scripts/Python/ercaHrvstr.py b/Scripts/Python/ercaHrvstr.py new file mode 100644 index 0000000000..9848282e4a --- /dev/null +++ b/Scripts/Python/ercaHrvstr.py @@ -0,0 +1,757 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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: + PtDebugPrint("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: + PtDebugPrint("onSDLnotify for drvlev, if callHrvstr true will DriveHrvstr") + self.DriveHrvstr() + else: + PtDebugPrint("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: + PtDebugPrint("I'm getting kicked from top ladder multistage") + MltStgLadderTop.gotoStage(LocalAvatar, -1) + if BtmLadder: + PtDebugPrint("I'm getting kicked from bottom ladder multistage") + MltStgLadderBtm.gotoStage(LocalAvatar, -1) + else: + PtDebugPrint("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): + PtDebugPrint("ActRevKnob callback") + if boolRev: + if boolMoving: + PtDebugPrint("insert stuck/down oneshot here") + else: + PtDebugPrint("DEBUG: ercaHrvstr.OnNotify:\tRev knob moving up.") + RespRevKnobUp.run(self.key,avatar=PtFindAvatar(events)) + else: + if boolMoving: + PtDebugPrint("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(): + PtDebugPrint("RespRevKnobDwn callback") + ageSDL[SDLHrvstrRev.value] = (0,) + + if (id == RespRevKnobDwn.id) and self.sceneobject.isLocallyOwned(): + PtDebugPrint("RespRevKnobDwn callback") + ageSDL[SDLHrvstrRev.value] = (1,) + + if (id == RespRevKnobAutoUp.id) and self.sceneobject.isLocallyOwned(): + if callHrvstr: + PtDebugPrint("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: + PtDebugPrint("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,) + PtDebugPrint("Anim event to set SDLHrvstrPos to 0, is this happening?") + + if (id == ActHrvstrNearStart.id and state) and self.sceneobject.isLocallyOwned(): + PtDebugPrint("blah") + #ageSDL[SDLHrvstrPos.value] = (1,) + + if (id == ActHrvstrNearEnd.id and state) and self.sceneobject.isLocallyOwned(): + PtDebugPrint("blah") + #ageSDL[SDLHrvstrPos.value] = (3,) + + if (id == ActHrvstrAtEnd.id and state) and self.sceneobject.isLocallyOwned(): + if not boolRev: + ageSDL[SDLHrvstrPos.value] = (4,) + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("in RespCallHrvstr, boolRev is true so will run RespRevKnobAutoUp") + RespRevKnobAutoUp.run(self.key) + else: + PtDebugPrint("in RespCallHrvstr, will set drvlev SDL to true") + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrDrvLev.value] = (1,) + + if (id == RespHrvstrStop.id): + PtDebugPrint("resp hrvstr stop, did this happen?") + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLHrvstrMoving.value] = (0,) + if callHrvstr: + PtDebugPrint("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): + #PtDebugPrint("ActLadderTop callback") + if LocalAvatar == PtFindAvatar(events): + PtDebugPrint("TopLadder = 1") + TopLadder = 1 + MltStgLadderTop.run(avatar=PtFindAvatar(events)) + #ageSDL[SDLHrvstrPwr.value] = (0,) + + if (id == ActLadderBtm.id and state): + #PtDebugPrint("ActLadderBtm callback") + if LocalAvatar == PtFindAvatar(events): + PtDebugPrint("BtmLadder = 1") + BtmLadder = 1 + MltStgLadderBtm.run(avatar=PtFindAvatar(events)) + #ageSDL[SDLHrvstrPwr.value] = (0,) + + if (id == MltStgLadderTop.id): + #PtDebugPrint("MltStgLadderTop callback") + if LocalAvatar == PtFindAvatar(events): + PtDebugPrint("TopLadder = 0") + TopLadder = 0 + #ageSDL[SDLHrvstrPwr.value] = (1,) + + if (id == MltStgLadderBtm.id): + #PtDebugPrint("MltStgLadderBtm callback") + if LocalAvatar == PtFindAvatar(events): + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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): + PtDebugPrint("ercaHrvstr.OnTimer") + + + diff --git a/Scripts/Python/ercaLadderHatch.py b/Scripts/Python/ercaLadderHatch.py new file mode 100644 index 0000000000..a5f39a7e40 --- /dev/null +++ b/Scripts/Python/ercaLadderHatch.py @@ -0,0 +1,243 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 LocalAvatar is None: + return + if PtFindAvatar(events) == LocalAvatar: + + if (StrDirection.value) == "up": + if event[2] == kAdvanceNextStage: + stageNum = event[1] + PtDebugPrint("Going up. Got stage advance callback from stage %d" % stageNum) + if stageNum == 1: + PtDebugPrint("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: + PtDebugPrint("Got through hatch: finishing & removing brain.") + MltStgLddr.gotoStage(LocalAvatar, -1) + + elif (StrDirection.value) == "down": + stageNum = event[1] + PtDebugPrint("Going down. Message from multistage %i" % stageNum) + if event[2] == kRegressPrevStage: # and stageNum == 2: + PtDebugPrint("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 + PtDebugPrint("checking drained") + if boolEmpty == 0: + MltStgLddr.gotoStage(LocalAvatar, 7,0,0); + PtDebugPrint("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) + PtDebugPrint("now stage 3/7 again") + elif stageNum == 6: + PtDebugPrint("Got through hatch: finishing & removing brain.") + MltStgLddr.gotoStage(LocalAvatar, -1) + iamclimber = False + #ActStart.enable() + elif stageNum == 3: + PtDebugPrint("done with bottom") + iamclimber = False + MltStgLddr.gotoStage(LocalAvatar, -1) + + if (id == RespHatchLocked.id): + RespHatchOps.run(self.key,state='lockedabove') + + + def INegotiateHatch(self): + global boolHatch + PtDebugPrint("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": + PtDebugPrint("Going up. Hatch is locked; Sending gotoStage(2)") + RespHatchOps.run(self.key,state='lockedbelow') + MltStgLddr.gotoStage(LocalAvatar,2,0,1) + elif (StrDirection.value) == "down": + PtDebugPrint("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": + PtDebugPrint("Going up. Hatch is unlocked; Sending gotoStage(3)") + #RespHatchOps.run(self.key,state='openbelow') + MltStgLddr.gotoStage(LocalAvatar,4,0,0) + elif (StrDirection.value) == "down": + PtDebugPrint("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/Scripts/Python/ercaOvenScope.py b/Scripts/Python/ercaOvenScope.py new file mode 100644 index 0000000000..000ed08150 --- /dev/null +++ b/Scripts/Python/ercaOvenScope.py @@ -0,0 +1,677 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 Vignette.value: + PtLoadDialog(Vignette.value,self.key) + + + def Load(self): + global boolScopeOperated + + solo = not PtGetPlayerList() + + 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: + PtDebugPrint("OnGUINotfiy.ShowHide: will now set timerWheel to: ",byteTime) + PtDebugPrint("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 control is not 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 control is not 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 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 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 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): + PtDebugPrint("in IDoTimerWheel.") + global byteTime + global IsBaking + global timerWheel + global byteTemp + global tempWheel + global setTempWheel + ageSDL = PtGetAgeSDL() + + if not IsBaking: + return + PtDebugPrint("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: + #PtDebugPrint("PreHeat = ",PreHeat) + #PtDebugPrint("CurTime = ",CurTime) + if PreHeat < CurTime: + #PtDebugPrint("PostHeat = ",PostHeat) + if PostHeat < CurTime: + PtDebugPrint("setTempWheel =",setTempWheel) + if not setTempWheel: + tempWheel.setValue(byteTemp) + setTempWheel = 1 + else: + if not setTempWheel: + tempPercent = byteTemp * .01 + tempWheel.animateToPercent(tempPercent) + PtDebugPrint("animating Temp Wheel, byteTemp = ",byteTemp) + PtDebugPrint("animating Temp Wheel, tempPercent = ",tempPercent) + setTempWheel = 1 + #PtDebugPrint("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/Scripts/Python/ercaPelletRoom.py b/Scripts/Python/ercaPelletRoom.py new file mode 100644 index 0000000000..ecb926ce10 --- /dev/null +++ b/Scripts/Python/ercaPelletRoom.py @@ -0,0 +1,793 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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): + PtDebugPrint("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 entry is not 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: + PtDebugPrint("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] + PtDebugPrint("boolMachine = ",boolMachine) + byteChamber = ageSDL[SDLChamber.value][0] + PtDebugPrint("byteChamber = ",byteChamber) + boolFlush = ageSDL[SDLFlush.value][0] + if not boolMachine and byteChamber: + PtDebugPrint("machine is closed, but chamber = ",byteChamber,". Resetting chamber to 0") + ageSDL[SDLChamber.value] = (0,) + byteChamber = 0 + PtDebugPrint("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,) + PtDebugPrint("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,) + PtDebugPrint("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,) + PtDebugPrint("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,) + PtDebugPrint("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,) + PtDebugPrint("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 + PtDebugPrint("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: + PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("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] + PtDebugPrint("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)): + PtDebugPrint("ActUseMachine callback") + #RespUseMachineOneShot.run(self.key,avatar=PtFindAvatar(events)) + ageSDL[SDLMachine.value] = (1,) + + elif (id == RespUseMachine.id): + PtDebugPrint("Got notify from RespUseMachine, will now open machine") + RespMachineEnable.run(self.key,state="IfOpening") + RespMachineMode.run(self.key,state="Open") + + elif (id == RespMachineMode.id): + PtDebugPrint("ercaPelletRoom.OnNotify: Machine has closed.") + if not PelletReady: + RespMachineEnable.run(self.key,state="Disable") + if byteChamber: + ageSDL[SDLChamber.value] = (0,) + + elif (id == RespMachineEnable.id): + PtDebugPrint("RespMachineEnable callback") + MayFlush = 1 + PtDebugPrint("set MayFlush = ",MayFlush) + + elif (id == ActSpitPellet.id and state and LocalAvatar == PtFindAvatar(events)): + if TakePellet: + PtDebugPrint("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 + PtDebugPrint("ActSpitPellet callback") + #ISpit = 1 + ActSpitPellet.disableActivator() + MayFlush = 0 + if byteChamber == 5: + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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 + PtDebugPrint("RespSpitPellet callback") + #TakePellet = 0 + self.SendNote('0') + #ActTakePellet.enableActivator() + PtAtTimeCallback(self.key,10,1) + #ISpit = 0 + + elif (id == ActTakePellet.id and state and LocalAvatar == PtFindAvatar(events)): + PtDebugPrint("ActTakePellet callback") + #ActTakePellet.disableActivator() + #TakePellet = 1 + self.SendNote('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: + PtDebugPrint("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)): + PtDebugPrint("ActPelletToSilo callback") + iLink = 1 + #TakePellet = 2 + self.SendNote('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)): + PtDebugPrint("ActPelletToCave callback") + iLink = 1 + #TakePellet = 2 + self.SendNote('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 + PtDebugPrint("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 entry is not 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): + PtDebugPrint("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)): + PtDebugPrint("ActFlushLever callback") + ageSDL[SDLFlush.value] = (1,) + + elif (id == RespFlushOneShot.id): + PtDebugPrint("RespFlushOneShot callback") + PtDebugPrint("MayFlush = ",MayFlush) + RespFlushLever.run(self.key) + if MayFlush: + ActSpitPellet.disableActivator() + + elif (id == RespFlushLever.id): + PtDebugPrint("RespFlushLever callback") + PtDebugPrint("MayFlush = ",MayFlush) + if MayFlush: + #MayFlush = 0 + self.IFlushPellets() + else: + if self.sceneobject.isLocallyOwned(): + ageSDL[SDLFlush.value] = (0,) + + elif (id == RespFlushAPellet.id): + PtDebugPrint("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): + #PtDebugPrint("incoming event: %s" % (events[0][1])) + code = events[0][1] + #PtDebugPrint("playing command: %s" % (code)) + self.ExecCode(code) + + + def OnControlKeyEvent(self,controlKey,activeFlag): + global TakePellet + global Toucher + if controlKey == PlasmaControlKeys.kKeyExitMode: + if TakePellet == 1: + PtDebugPrint("ercaPelletRoom.OnControlKeyEvent(): hit exit key") + #TakePellet = 0 + self.SendNote('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: + PtDebugPrint("ercaPelletRoom.OnControlKeyEvent(): hit movement key") + #TakePellet = 0 + self.SendNote('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): + PtDebugPrint("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") + #PtDebugPrint("taken") + #TakePellet = 0 + #self.SendNote('0') + PtAtTimeCallback(self.key,10,6) + else: + #ActTakePellet.disableActivator() + RespDropPellet.run(self.key,state="normal") + if TakePellet == 1: + #TakePellet = 0 + self.SendNote('0') + PtDebugPrint("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: + PtDebugPrint("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('0') + + + def IFlushPellets(self): + PtDebugPrint("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 + PtDebugPrint("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": + PtDebugPrint("Found pellet cave guid - ", chron.getValue()) + return chron.getValue() + return "" + + + def LinkToPelletCave(self,spawnPt): + pelletCaveGUID = str(self.OnClickToLinkToPelletCaveFromErcana()) + PtDebugPrint("pelletCaveGUID = ",pelletCaveGUID) + caveInfo = ptAgeInfoStruct() + caveInfo.setAgeFilename("PelletBahroCave") + caveInfo.setAgeInstanceName("PelletBahroCave") + caveInfo.setAgeInstanceGuid(pelletCaveGUID) + caveLink = ptAgeLinkStruct() + caveLink.setAgeInfo(caveInfo) + caveInfo = caveLink.getAgeInfo() + caveInstance = caveInfo + if caveInstance is 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) + PtDebugPrint("-- linking to pellet cave --") + linkMgr = ptNetLinkingMgr() + #linkMgr.linkToAge(als) + linkMgr.linkToAge(als,"TouchPellet") + + + def ExecCode(self,code): + try: + takePellet = int(code) + if takePellet >= 0 and takePellet <= 2: + self.UpdateTakePellet(takePellet); + except: + PtDebugPrint("ercaPelletRoom.ExecCode(): ERROR! Invalid code '%s'." % (code)) \ No newline at end of file diff --git a/Scripts/Python/ercaSDLIntShowHide.py b/Scripts/Python/ercaSDLIntShowHide.py new file mode 100644 index 0000000000..aaa8b5949d --- /dev/null +++ b/Scripts/Python/ercaSDLIntShowHide.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 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 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 stringVarName.value: + if target == stringVarName.value: + if param.lower() in self.enabledStateList: + self.DisableObject() + else: + self.EnableObject() diff --git a/Scripts/Python/giraAgeSDLBoolRespondLightpost.py b/Scripts/Python/giraAgeSDLBoolRespondLightpost.py new file mode 100644 index 0000000000..036dfcb5cd --- /dev/null +++ b/Scripts/Python/giraAgeSDLBoolRespondLightpost.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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): + PtDebugPrint("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 + PtDebugPrint("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/Scripts/Python/grsn1stFloorClimb.py b/Scripts/Python/grsn1stFloorClimb.py new file mode 100644 index 0000000000..1d26d2ffb7 --- /dev/null +++ b/Scripts/Python/grsn1stFloorClimb.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +############################################################## +# 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] " + repr(event[0])) + PtDebugPrint("event[1] " + repr(event[1])) + PtDebugPrint("event[2] " + repr(event[2])) + + climber = PtFindAvatar(events) + climberID = PtGetClientIDFromAvatarKey(climber.getKey()) + PtDebugPrint("climber ID = " + repr(climberID)) + currentClimber = self.SDL["intSDLClimber"][0] + currentDescender = self.SDL["intSDLDescender"][0] + PtDebugPrint("current climber = " + repr(currentClimber)) + PtDebugPrint("current descender = " + repr(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 # "+ repr(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 " + repr(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/Scripts/Python/grsnDownElevator.py b/Scripts/Python/grsnDownElevator.py new file mode 100644 index 0000000000..19b234481d --- /dev/null +++ b/Scripts/Python/grsnDownElevator.py @@ -0,0 +1,305 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + + +############################################################## +# 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 + PtDebugPrint("Initialized: grsnDownElevator") + + 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() + PtDebugPrint("grsnDownElevator: down elevator on at load") + else: + dnElevatorLights.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + downElevTrigger.disable() + PtDebugPrint("grsnDownElevator: down elevator off at load") + + upOn = ageSDL[upElevSDL.value][0] + if (upOn): + upElevatorLights.run(self.key,state='TurnOn',avatar=PtGetLocalAvatar()) + upElevatorBottomTrigger.enable() + PtDebugPrint("grsnDownElevator: up elevator on at load") + else: + upElevatorLights.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + upElevatorBottomTrigger.disable() + PtDebugPrint("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() + PtDebugPrint("grsnDownElevator: turn on down elevator") + else: + dnElevatorLights.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + downElevTrigger.disable() + PtDebugPrint("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() + PtDebugPrint("grsnDownElevator: turn on up elevator") + else: + upElevatorLights.run(self.key,state='TurnOff',avatar=PtGetLocalAvatar()) + upElevatorBottomTrigger.disable() + PtDebugPrint("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 + + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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: + PtDebugPrint("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): + PtDebugPrint("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: + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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: + PtDebugPrint("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): + PtDebugPrint("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: + PtDebugPrint("grsnDownElevator: enable trigger") + upElevatorBottomTrigger.enable() + return + + if state: + 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()) + PtDebugPrint("grsnDownElevator: triggered down elevator") + downBehavior.run(avatarInElevator) + + elif id == upElevatorBottomTrigger.id: + upElevatorBottomTrigger.disable() + avatarInElevator = PtFindAvatar(events) + PtDebugPrint("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/Scripts/Python/grsnElevRespTrigger.py b/Scripts/Python/grsnElevRespTrigger.py new file mode 100644 index 0000000000..fcc4b9db69 --- /dev/null +++ b/Scripts/Python/grsnElevRespTrigger.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# 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/Scripts/Python/grsnEmgrPhase0.py b/Scripts/Python/grsnEmgrPhase0.py new file mode 100644 index 0000000000..bf4a987413 --- /dev/null +++ b/Scripts/Python/grsnEmgrPhase0.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__grsnEmgrPhase0 v.", version) + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + for variable in BooleanVARs: + PtDebugPrint("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: + PtDebugPrint("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? + PtDebugPrint("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/Scripts/Python/grsnGearRide.py b/Scripts/Python/grsnGearRide.py new file mode 100644 index 0000000000..975c835ad4 --- /dev/null +++ b/Scripts/Python/grsnGearRide.py @@ -0,0 +1,251 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +############################################################## +# 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",netForce=True) +gearExitRegion = ptAttribActivator(9,"exit subworld at gear",netForce=True) + +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",netForce=True) + +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") + +class grsnGearRide(ptResponder): + def __init__(self): + ptResponder.__init__(self) + self.id = 50113 + self.version = 4 + PtDebugPrint("grsnGearRide.__init__():\tversion %i" % self.version) + self._canChangeSubworld = False + self._inNiche = False + self._canChangeSubworld = False + + 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 OnServerInitComplete(self): + """Sets up the gear ride's initial state""" + ageSDL = PtGetAgeSDL() + if ageSDL[stringSDLVarPower.value][0]: + keepAwayFromGear.clear(self.key) + else: + keepAwayFromGear.release(self.key) + + # Set some default states + gearEnterRegion.disable() + gearExitRegion.disable() + gearExitCrackRegion.disable() + self._ClearExcludeRegions() + self._inNiche = False + self._canChangeSubworld = False + + # This sets up the regions to continuously fire notifications to us... + # Further, don't wait for server arbitration on these bitches. + # Useful, given the niche only opens up for a few frames. + for i in (gearEnterRegion, gearExitRegion, gearExitCrackRegion): + i.volumeSensorIgnoreExtraEnters(False) + i.volumeSensorNoArbitration() + + # These are subworld enter regions, so, again, don't wait on server arb + for i in (safetyRegion1, safetyRegion2, safetyRegion3): + i.volumeSensorNoArbitration() + + def OnNotify(self, state, id, events): + """Performs basic event processing""" + + # Prevent dupe notifies + if not state: + return + + # Process the crack (2nd floor <-> niche) open/close event + if id == crackOpenEvent.id: + PtDebugPrint("grsnGearRide.OnNotify():\tCrack opened", level=kWarningLevel) + self._ReleaseExcludeRegions() + self._canChangeSubworld = True + gearEnterRegion.enable() + gearExitCrackRegion.enable() + return + if id == crackCloseEvent.id: + PtDebugPrint("grsnGearRide.OnNotify():\tCrack closed", level=kWarningLevel) + self._ClearExcludeRegions() + self._canChangeSubworld = False # You can't change subworlds while the niche is closed + gearEnterRegion.disable() + gearExitCrackRegion.disable() + return + + # Process the exit (power room <-> niche) open/close event + if id == exitOpenEvent.id: + PtDebugPrint("grsnGearRide.OnNotify():\tPower room exit opened", level=kWarningLevel) + if self._inNiche: # bad things happen without this + self._ReleaseExcludeRegions() + self._canChangeSubworld = True + gearEnterRegion.enable() + gearExitRegion.enable() + return + if id == exitCloseEvent.id: + PtDebugPrint("grsnGearRide.OnNotify():\tPower room exit closed", level=kWarningLevel) + self._ClearExcludeRegions() + self._canChangeSubworld = False # You can't change subworlds while the niche is closed + gearExitRegion.disable() + gearEnterRegion.disable() + return + + # KEEP AWAY!!! :D + # No, more like "we're generating power, so don't stand on the gear, asshole" + if id == keepAwayOn.id: + keepAwayFromGear.clear(self.key) + return + if id == keepAwayOff.id: + keepAwayFromGear.release(self.key) + return + + # Only the local avatar should continue past this point... + avatar = PtFindAvatar(events) + if PtFindAvatar(events): + isLocal = PtFindAvatar(events) == avatar + else: + isLocal = PtWasLocallyNotified(self.key) + if not isLocal or not avatar: + return + kiNum = PtGetClientIDFromAvatarKey(avatar.getKey()) + + if id == gearExitCrackRegion.id: + if not self._canChangeSubworld: + PtDebugPrint("grsnGearRide.OnNotify():\tTossing region race condition", level=kDebugDumpLevel) + return + self._canChangeSubworld = False + self._inNiche = False + + PtDebugPrint("grsnGearRide.OnNotify():\t%i exited niche subworld into the 2nd floor hall" % kiNum, level=kWarningLevel) + avatar.avatar.exitSubWorld() + avatar.physics.warpObj(exitSafePoint.value.getKey()) + ptCamera().enableFirstPersonOverride() + crackExitCamera.value.pushCutsceneCamera(1, avatar.getKey()) + return + + if id == gearExitRegion.id: + if not self._canChangeSubworld: + PtDebugPrint("grsnGearRide.OnNotify():\tTossing region race condition", level=kDebugDumpLevel) + return + self._canChangeSubworld = False + self._inNiche = False + + PtDebugPrint("grsnGearRide.OnNotify():\t%i exited niche subworld into the power room" % kiNum, level=kWarningLevel) + ptCamera().enableFirstPersonOverride() + gearExitCamera.value.pushCamera(avatar.getKey()) + rideCamera.value.popCutsceneCamera(avatar.getKey()) + avatar.avatar.exitSubWorld() + avatar.physics.warpObj(gearTeleportSpot.value.getKey()) + return + + # Trying to enter the niche + if id in (safetyRegion1.id, safetyRegion2.id, safetyRegion3.id, gearEnterRegion.id): + if not self._canChangeSubworld: + PtDebugPrint("grsnGearRide.OnNotify():\tTossing region race condition", level=kDebugDumpLevel) + return + self._canChangeSubworld = False + self._inNiche = True + + PtDebugPrint("grsnGearRide.OnNotify():\t%i entered niche subworld" % kiNum, level=kWarningLevel) + avatar.avatar.enterSubWorld(gearSubWorld.value) + avatar.physics.warpObj(enterSafePoint.value.getKey()) + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + rideCamera.value.pushCutsceneCamera(1, avatar.getKey()) + return + + # Happens after the user exits the crack after exiting the niche... + # Convoluted, indeed. + if id == popExitCrackCamera.id: + ptCamera().enableFirstPersonOverride() + crackExitCamera.value.popCutsceneCamera(avatar.getKey()) + return + + # Debug output for anyone who cares (not me) + PtDebugPrint("grsnGearRide.OnNotify():\tid %i unhandled" % id, level=kDebugDumpLevel) diff --git a/Scripts/Python/grsnGetKI.py b/Scripts/Python/grsnGetKI.py new file mode 100644 index 0000000000..40788f4260 --- /dev/null +++ b/Scripts/Python/grsnGetKI.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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") + +#---------- +# constants +#---------- + +#==================================== +class grsnGetKI(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 50130 + self.version = 1 + + def OnNotify(self,state,id,events): + #~PtDebugPrint("grsnGetKI: Notify event state=%f,id=%d,events=" % (state,id),events) + # is this our activator notifying us? + if state and id == clkDispensor.id: + if PtGetLocalAvatar() == PtFindAvatar(events): + rspDispensor.run(self.key, events=events, netForce=1) + if state and id == rspDispensor.id: + if PtWasLocallyNotified(self.key): + PtSendKIMessageInt(kUpgradeKILevel,kNormalKI) diff --git a/Scripts/Python/grsnMainWallPython.py b/Scripts/Python/grsnMainWallPython.py new file mode 100644 index 0000000000..978aacb8bc --- /dev/null +++ b/Scripts/Python/grsnMainWallPython.py @@ -0,0 +1,264 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +## 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") + if PtGetPlayerList(): + ReceiveInit = True + else: + PtDebugPrint("solo in climbing wall") + + def OnClimbingBlockerEvent(self,blocker): + + PtDebugPrint("looking for blocker named ",blocker.getName()) + i = 0 + while i < 171: + if (northBlocker.value[i] == blocker): + northWall.value[i].runAttachedResponder(kTeamLightsBlink) + PtDebugPrint("found matching texture named ",northWall.value[i].getName()) + return + elif (southBlocker.value[i] == blocker): + southWall.value[i].runAttachedResponder(kTeamLightsBlink) + PtDebugPrint("found matching texture named ",southWall.value[i].getName()) + return + i = i + 1 + + + def OnClimbingWallInit(self,type,state,value): + global ReceiveInit + global SouthState + global NorthState + + PtDebugPrint("grsnMainClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value) + if not ReceiveInit: + PtDebugPrint("failed to receive init") + return + if (type == ptClimbingWallMsgType.kEndGameState): + ReceiveInit = False + PtDebugPrint("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) + PtDebugPrint("drawing s wall index",value) + value = NorthBlockers[i] + if (value > -1): + northWall.value[value].runAttachedResponder(kTeamLightsOn) + PtDebugPrint("drawing n wall index",value) + i = i + 1 + + if (type == ptClimbingWallMsgType.kTotalGameState): + SouthState = state + NorthState = value + PtDebugPrint("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 + + PtDebugPrint("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) + PtDebugPrint("drawing s wall index",value) + value = NorthBlockers[i] + if (value > -1): + northWall.value[value].runAttachedResponder(kTeamLightsOn) + PtDebugPrint("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): + PtDebugPrint("yikes - somehow overran the array!") + return + NorthBlockers[i] = index + PtDebugPrint("set north wall index ",index," in slot ",i," to true") + else: + while (SouthBlockers[i] >= 0): + i = i + 1 + if (i == 20): + PtDebugPrint("yikes - somehow overran the array!") + return + SouthBlockers[i] = index + PtDebugPrint("set south wall index ",index," in slot ",i," to true") + else: + if (north): + while (NorthBlockers[i] != index): + i = i + 1 + if (i == 20): + PtDebugPrint("this should not get hit - looked for non-existent NorthWall entry!") + return + NorthBlockers[i] = -1 + PtDebugPrint("removed index ",index," from list slot ",i) + else: + while (SouthBlockers[i] != index): + i = i + 1 + if (i == 20): + PtDebugPrint("this should not get hit - looked for non-existent SouthWall entry!") + return + SouthBlockers[i] = -1 + PtDebugPrint("removed index ",index," from list slot ",i) + + + + """ diff --git a/Scripts/Python/grsnNexusBookMachine.py b/Scripts/Python/grsnNexusBookMachine.py new file mode 100644 index 0000000000..62298e6ee3 --- /dev/null +++ b/Scripts/Python/grsnNexusBookMachine.py @@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + + +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) + PtDebugPrint("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 + + PtDebugPrint("id ",id) + + avatar=PtFindAvatar(events) + local = PtGetLocalAvatar() + + if (avatar != local): + return + + if (id == fakeLinkBehavior.id): + PtDebugPrint("notified of link behavior, yellow book ",yellowLink) + for event in events: + if (event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kEnterStage): + PtDebugPrint("started touching book, set warp out timer") + PtAtTimeCallback(self.key ,1.0 ,0) + return + + if not state: + return + + if (id == bookPurpleInPos.id): + PtDebugPrint("Purple book aligned") + bookPurpleOutResponder.run(self.key) + + if (id == bookYellowInPos.id): + PtDebugPrint("Yellow book aligned") + bookYellowOutResponder.run(self.key) + + if (id == entryTrigger.id): + PtWearMaintainerSuit(avatar.getKey(),False) + + if (id == bookPurpleClickable.id): + PtDebugPrint("touched purple team room book") + yellowLink = False + avatar.avatar.runBehaviorSetNotify(fakeLinkBehavior.value,self.key,fakeLinkBehavior.netForce) + + if (id == bookYellowClickable.id): + PtDebugPrint("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/Scripts/Python/grsnPageMaster.py b/Scripts/Python/grsnPageMaster.py new file mode 100644 index 0000000000..2f97a2ed5e --- /dev/null +++ b/Scripts/Python/grsnPageMaster.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("grsnPageMaster.__init__(): Garrison version = public") + else: + PtDebugPrint("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: + pass + # for non-public version, add all the remaining pages + else: + pages += ["grsnWellOccluders","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/Scripts/Python/grsnPowerOn.py b/Scripts/Python/grsnPowerOn.py new file mode 100644 index 0000000000..4b3956ef38 --- /dev/null +++ b/Scripts/Python/grsnPowerOn.py @@ -0,0 +1,745 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +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 + PtDebugPrint("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] + PtDebugPrint("server says gear on ",gearOn) + except: + gearOn = False + PtDebugPrint("failed to retrieve gear on state from server") + + upElevOn = False + try: + upElevOn = ageSDL[upElevSwitchSDL.value][0] + PtDebugPrint("server says up elevator on ",upElevOn) + except: + upElevOn = False + PtDebugPrint("failed to retrieve elevator switch state from server") + + dnElevOn = False + try: + dnElevOn = ageSDL[dnElevSwitchSDL.value][0] + PtDebugPrint("server says down elevator on ",dnElevOn) + except: + dnElevOn = False + PtDebugPrint("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 + PtDebugPrint("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 + + PtDebugPrint("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 + PtDebugPrint("weight activator") + if (gearOn): + PtDebugPrint("gear on") + import xSndLogTracks + xSndLogTracks.LogTrack("15","27") + weightEngageDisabled = True + return + PtDebugPrint("set weight forward") + reverser.run(self.key,state='Forward',avatar=triggerer) + weightControlResponder.run(self.key,state='High',avatar=triggerer) + weightDirection = kUp + if (weightNearDownEnd): + PtDebugPrint("weight sound looping down") + weightStartSoundResp.run(self.key,state='Loop',avatar=triggerer) + weightNearDownEnd = False + weightSoundLoopingDown = True + + if not generatorPrimed: + generatorPrimed = True + flashingLightsResponder.run(self.key,state='Blink',avatar=PtGetLocalAvatar()) + PtDebugPrint("generator primed") + if (mainOn): + switchGlowResponder.run(self.key,state='On',avatar=triggerer) + + if (id == weightUnTrigger.id and generatorPrimed): + if (weightEngageDisabled): + return + scaleEngaged = False + if not gearOn: + generatorPrimed = True + flashingLightsResponder.run(self.key,state='Blink',avatar=PtGetLocalAvatar()) + PtDebugPrint("generator primed") + if (mainOn): + switchGlowResponder.run(self.key,state='On',avatar=triggerer) + PtDebugPrint("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): + PtDebugPrint("stop all at bottom") + weightSoundLoopingDown = False + weightStartSoundResp.run(self.key,state='StopAll',avatar=triggerer) + else: + PtDebugPrint("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 + PtDebugPrint("weight near down end") + elif (weightDirection == kUp): + weightNearDownEnd = False + weightSoundLoopingDown = False + return + + #weightLevel=0 + #if not brake01On: + # weightLevel = weightLevel + 1 + #if not brake02On: + # weightLevel = weightLevel + 1 + #if (mainOn): + # weightLevel = weightLevel + 1 + #PtDebugPrint("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): + PtDebugPrint("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 not brake01On: + gearBrake01Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake01SDL.value] = (1,) + if not brake02On: + 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 not generatorPrimed: + 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 not generatorPrimed: + gearBrake02Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake02SDL.value] = (1,) + + if (id == gearStopTrigger.id): + PtDebugPrint("gear stop trigger") + if (gearStopping): + PtDebugPrint("gear stop trigger: gear stopped, begin final descent") + gearStopping = False + if (gearStartingDown): + PtDebugPrint("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): + PtDebugPrint("main power responder callback - gear finished initial descent") + #gear is finished moving partway down, okay to start second half + gearStartingDown = False + if not gearStopping: + PtDebugPrint("main power responder callback - gear also stopped, begin final descent") + mainPowerOffResponder.run(self.key,state='GearDown',avatar=PtGetLocalAvatar()) + else: + PtDebugPrint("main power responder callback - gear still turning, wait for it to stop") + return + if not gearStopping and not gearStartingDown: + PtDebugPrint("main power responder callback - reengage locks") + #gear is down, reengage the locks + if not generatorPrimed: + if not brake01On: + gearBrake01Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake01SDL.value] = (1,) + + if not brake02On: + gearBrake02Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake02SDL.value] = (1,) + + if (id == mainSwitchResp.id): + PtDebugPrint("main switch callback") + if (mainOn): + PtDebugPrint("main switch now on") + if (generatorPrimed): + switchGlowResponder.run(self.key,state='On',avatar=triggerer) + else: + PtDebugPrint("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 not brake01On: + if (gearStartingDown): + return + gearBrake01Resp.run(self.key,state='AutoReturn',avatar=triggerer) + ageSDL[gearBrake01SDL.value] = (1,) + + if not brake02On: + 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): + PtDebugPrint("main switch") + if (mainOn): + PtDebugPrint("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() + PtDebugPrint("break main switch") + else: + mainSwitchResp.run(self.key,state='TurnOff',avatar=triggerer) + PtDebugPrint("turn off main switch") + if (generatorPrimed): + switchGlowResponder.run(self.key,state='Off',avatar=triggerer) + + else: + PtDebugPrint("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): + PtDebugPrint("gear switch callback") + if (gearOn): + PtDebugPrint("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 not generatorPrimed: + #lights went out while firing up + switchGlowResponder.run(self.key,state='On',avatar=triggerer) + else: + PtDebugPrint("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 not brake01On and not brake02On): + 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): + PtDebugPrint("brake01") + if (gearOn): + gearBrake01Resp.run(self.key,state='Trip',avatar=triggerer) + return + elif not mainOn: + PtDebugPrint("main off") + gearBrake01Resp.run(self.key,state='Trip',avatar=triggerer) + else: #main on + PtDebugPrint("main on") + if (generatorPrimed): + if (brake01On): + PtDebugPrint("unlock") + gearBrake01Resp.run(self.key,state='Unlock',avatar=triggerer) + ageSDL[gearBrake01SDL.value]=(0,) + else: + PtDebugPrint("lock") + gearBrake01Resp.run(self.key,state='Lock',avatar=triggerer) + ageSDL[gearBrake01SDL.value]=(1,) + else: #generator not primed + PtDebugPrint("trip") + gearBrake01Resp.run(self.key,state='Trip',avatar=triggerer) + return + + if (id == gearBrake02.id): + PtDebugPrint("brake02") + if (gearOn): + gearBrake02Resp.run(self.key,state='Trip',avatar=triggerer) + return + elif not mainOn: + PtDebugPrint("main off") + gearBrake02Resp.run(self.key,state='Trip',avatar=triggerer) + else: #main on + PtDebugPrint("main on") + if (generatorPrimed): + if (brake02On): + PtDebugPrint("unlock") + gearBrake02Resp.run(self.key,state='Unlock',avatar=triggerer) + ageSDL[gearBrake02SDL.value]=(0,) + else: + PtDebugPrint("lock") + gearBrake02Resp.run(self.key,state='Lock',avatar=triggerer) + ageSDL[gearBrake02SDL.value]=(1,) + else: #generator not primed + PtDebugPrint("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/Scripts/Python/grsnPrisonRandomSDLItems.py b/Scripts/Python/grsnPrisonRandomSDLItems.py new file mode 100644 index 0000000000..e807eecce8 --- /dev/null +++ b/Scripts/Python/grsnPrisonRandomSDLItems.py @@ -0,0 +1,177 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +Module: grsnPrisonRandomItems +Age: Garrison Prison +Date: February 2002 +Randomizes contents of the Garrison Prison Cell +""" + +from Plasma import * +from PlasmaTypes import * +import random + +#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 + PtDebugPrint("__init__grsnPrisonRandomItems v.", version) + random.seed() + + def OnServerInitComplete(self): + global AllItems + + return + + ageSDL = PtGetAgeSDL() + + # pick items to display + ItemsToPick = random.randint(kMinNumItems, kMaxNumItems) + AlreadyPicked = [ ] + + while len(AlreadyPicked) < ItemsToPick: + randitem = random.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() + + + entry = vault.findChronicleEntry("VisitedGrsnPrison") + + if entry is 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 = random.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") + + diff --git a/Scripts/Python/grsnTrnCtrBridgeSafety.py b/Scripts/Python/grsnTrnCtrBridgeSafety.py new file mode 100644 index 0000000000..0d3cd66665 --- /dev/null +++ b/Scripts/Python/grsnTrnCtrBridgeSafety.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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): + PtDebugPrint("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): + PtDebugPrint("in both regions - warp up") + PtGetLocalAvatar().physics.warpObj(arrivePt.value.getKey()) + return + \ No newline at end of file diff --git a/Scripts/Python/grsnTrnCtrDoorEnter.py b/Scripts/Python/grsnTrnCtrDoorEnter.py new file mode 100644 index 0000000000..a783738494 --- /dev/null +++ b/Scripts/Python/grsnTrnCtrDoorEnter.py @@ -0,0 +1,161 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +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 + PtDebugPrint(" must have ki") + kiLevel = PtGetLocalKILevel() + if (kiLevel < 2): + return + for event in events: + if (event[0]==1 and event[1]==1): + avatarEntering = PtFindAvatar(events) + PtDebugPrint("entered the region, disable this one and the other door's triggers") + triggerRgn1.disable() + triggerRgn2.disable() + if (avatarEntering == PtGetLocalAvatar()): + PtDebugPrint("stop this avatar") + PtDisableMovementKeys() + PtDebugPrint("take away first person") + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + PtDebugPrint("open the door") + door1OpenResponder.run(self.key,avatar=avatarEntering) + return + + if (id == door1OpenResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + + PtDebugPrint(" 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: + PtDebugPrint(" 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 + + PtDebugPrint("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 + + PtDebugPrint("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: + PtDebugPrint(" 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 + + PtDebugPrint(" 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/Scripts/Python/grsnTrnCtrDoorExit.py b/Scripts/Python/grsnTrnCtrDoorExit.py new file mode 100644 index 0000000000..7a338b219b --- /dev/null +++ b/Scripts/Python/grsnTrnCtrDoorExit.py @@ -0,0 +1,161 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint(" must have ki") + kiLevel = PtGetLocalKILevel() + if (kiLevel < 2): + return + for event in events: + if (event[0]==1 and event[1]==1): + avatarEntering = PtFindAvatar(events) + PtDebugPrint("entered the region, disable this one and the other door's triggers") + triggerRgn1.disable() + triggerRgn2.disable() + PtDebugPrint("stop this avatar") + PtDisableMovementKeys() + PtDebugPrint("take away first person") + cam = ptCamera() + cam.disableFirstPersonOverride() + cam.undoFirstPerson() + PtSendKIMessage(kDisableEntireYeeshaBook,0) + PtDebugPrint("open the door") + door1OpenResponder.run(self.key,avatar=PtGetLocalAvatar()) + PtDebugPrint("switch to the initial camera") + startCamera.value.pushCameraCut(PtGetLocalAvatar().getKey()) + return + + if (id == door1OpenResponder.id): + if (avatarEntering != PtGetLocalAvatar()): + return + PtDebugPrint(" 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: + PtDebugPrint(" 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 + PtDebugPrint("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 + PtDebugPrint("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: + PtDebugPrint(" 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 + PtDebugPrint(" 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/Scripts/Python/grsnTrnCtrDoors.py b/Scripts/Python/grsnTrnCtrDoors.py new file mode 100644 index 0000000000..9c2592ef90 --- /dev/null +++ b/Scripts/Python/grsnTrnCtrDoors.py @@ -0,0 +1,314 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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] + + PtDebugPrint("grsnTrnCtrDoors: self.SDL = %d" % self.grsnDoorState) + PtDebugPrint("grsnTrnCtrDoors: Player List = %d" % len(PtGetPlayerList())) + + if len(PtGetPlayerList()) > 0: + + PtDebugPrint("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) + PtDebugPrint("grsnTrnCtrDoors: Door is open.") + PtDebugPrint("grsnTrnCtrDoors: Door State = %d" % self.grsnDoorState) + + elif self.grsnDoorState == doorSDLstates['closing']: + doorCloseResponder.run(self.key,fastforward=1) + PtDebugPrint("grsnTrnCtrDoors: Door is closed.") + PtDebugPrint("grsnTrnCtrDoors: Door State = %d" % self.grsnDoorState) + + else: + PtDebugPrint("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] + PtDebugPrint("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): + PtDebugPrint("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']) + PtDebugPrint("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']) + PtDebugPrint("grsnTrnCtrDoors: I triggered the region and I'm changing the sdl to closetoopen.") + + elif self.grsnDoorState == doorSDLstates['opentoclose']: + self.UpdateDoorState(doorSDLstates['movingopen']) + PtDebugPrint("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']) + PtDebugPrint("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']) + PtDebugPrint("grsnTrnCtrDoors: I triggered the region and I'm changing the sdl to opentoclose.") + + elif self.grsnDoorState == doorSDLstates['closetoopen']: + self.UpdateDoorState(doorSDLstates['movingclosed']) + PtDebugPrint("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]) + PtDebugPrint("grsnTrnCtrDoors: New list is: %s" % (str(self.grsnDoorStack))) + + if len(self.grsnDoorStack) == 1: + PtDebugPrint("grsnTrnCtrDoors: List is only one command long, so I'm playing it") + code = self.grsnDoorStack[0] + PtDebugPrint("grsnTrnCtrDoors: Playing command: %s" % (code)) + self.ExecCode(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=')) + PtDebugPrint("grsnTrnCtrDoors: Door State Updated to %d" % curState) + PtDebugPrint("grsnTrnCtrDoors: Door State SDL Set to %d" % self.SDL['grsnDoorState'][0]) + + if curState == doorSDLstates['closed']: + PtDebugPrint("grsnTrnCtrDoors: Door is closed and nobody is in the region.") + self.grsnDoorState = doorSDLstates['closed'] + PtDebugPrint("grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState) + + elif curState == doorSDLstates['opening']: + + PtDebugPrint("grsnTrnCtrDoors: Someone entered the region with a KI. Opening up the door.") + + self.grsnDoorState = doorSDLstates['opening'] + PtDebugPrint("grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState) + + if self.sceneobject.isLocallyOwned(): + self.SendNote("doorOpenResponder") + + elif curState == doorSDLstates['open']: + self.grsnDoorState = doorSDLstates['open'] + PtDebugPrint("grsnTrnCtrDoors: Door is open and region is still occupied.") + PtDebugPrint("grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState) + + elif curState == doorSDLstates['closing']: + + PtDebugPrint("grsnTrnCtrDoors: Door is now going to close.") + + self.grsnDoorState = doorSDLstates['closing'] + PtDebugPrint("grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState) + + if self.sceneobject.isLocallyOwned(): + self.SendNote("doorCloseResponder") + + elif curState == doorSDLstates['opentoclose']: + self.grsnDoorState = doorSDLstates['opentoclose'] + PtDebugPrint("grsnTrnCtrDoors: Everyone exited the region while the door was opening.") + PtDebugPrint("grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState) + + elif curState == doorSDLstates['closetoopen']: + self.grsnDoorState = doorSDLstates['closetoopen'] + PtDebugPrint("grsnTrnCtrDoors: Someone with a good KI entered the region while the door was closing.") + PtDebugPrint("grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState) + + elif curState == doorSDLstates['movingopen']: + self.grsnDoorState = doorSDLstates['movingopen'] + PtDebugPrint("grsnTrnCtrDoors: Going back to staying open.") + PtDebugPrint("grsnTrnCtrDoors: Door state is now %d" % self.grsnDoorState) + + elif curState == doorSDLstates['movingclosed']: + self.grsnDoorState = doorSDLstates['movingclosed'] + PtDebugPrint("grsnTrnCtrDoors: Going back to staying closed.") + PtDebugPrint("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 + + PtDebugPrint("grsnTrnCtrDoors: I triggered the region") + + if PtGetLocalKILevel() < 2: + PtDebugPrint("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() + + PtDebugPrint("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() + + PtDebugPrint("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: + PtDebugPrint("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) + PtDebugPrint("grsnTrnCtrDoors: Getting rid of Resp: %s" % (old)) + if len(self.grsnDoorStack): + PtDebugPrint("grsnTrnCtrDoors: There's at lest one more Resp to play.") + code = self.grsnDoorStack[0] + PtDebugPrint("Playing command: %s" % (code)) + self.ExecCode(code) + + def UpdateDoorState (self, StateNum): + self.SDL['grsnDoorState'] = (StateNum,) + self.SendNote('DoorState='+str(StateNum)) + + def ExecCode(self, code): + if code == "doorOpenResponder": + doorOpenResponder.run(self.key,netPropagate=0) + elif code == "doorCloseResponder": + doorCloseResponder.run(self.key,netPropagate=0) + else: + PtDebugPrint("grsnTrnCtrDoors.ExecCode(): ERROR! Invalid code '%s'." % (code)) + self.grsnDoorStack.pop(0) diff --git a/Scripts/Python/grsnWallImagerDisplayN.py b/Scripts/Python/grsnWallImagerDisplayN.py new file mode 100644 index 0000000000..bc9a0c177a --- /dev/null +++ b/Scripts/Python/grsnWallImagerDisplayN.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +## 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") + if PtGetPlayerList(): + ReceiveInit = True + else: + PtDebugPrint("solo in climbing wall") + + + def OnClimbingWallInit(self,type,state,value): + global ReceiveInit + + PtDebugPrint("grsnClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value) + if not ReceiveInit: + PtDebugPrint("failed to receive init") + return + if (type == ptClimbingWallMsgType.kEndGameState): + ReceiveInit = False + PtDebugPrint("finished receiving total game state") + + if (type == ptClimbingWallMsgType.kTotalGameState): + PtDebugPrint("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): #display wall settings + northWall.value[state].runAttachedResponder(kTeamLightsOn) + PtDebugPrint("Imager display N drawing n wall index",state) + + elif (type == ptClimbingWallMsgType.kRemoveBlocker and value): + northWall.value[state].runAttachedResponder(kTeamLightsOff) + PtDebugPrint("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/Scripts/Python/grsnWallImagerDisplayS.py b/Scripts/Python/grsnWallImagerDisplayS.py new file mode 100644 index 0000000000..e8c1d116b6 --- /dev/null +++ b/Scripts/Python/grsnWallImagerDisplayS.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +## 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") + if PtGetPlayerList(): + ReceiveInit = True + else: + PtDebugPrint("solo in climbing wall") + + + def OnClimbingWallInit(self,type,state,value): + global ReceiveInit + + PtDebugPrint("grsnClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value) + if not ReceiveInit: + PtDebugPrint("failed to receive init") + return + if (type == ptClimbingWallMsgType.kEndGameState): + ReceiveInit = False + PtDebugPrint("finished receiving total game state") + + if (type == ptClimbingWallMsgType.kTotalGameState): + PtDebugPrint("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 not value): #display wall settings + southWall.value[state].runAttachedResponder(kTeamLightsOn) + PtDebugPrint("Imager display S drawing wall index",state) + + elif (type == ptClimbingWallMsgType.kRemoveBlocker and not value): + southWall.value[state].runAttachedResponder(kTeamLightsOff) + PtDebugPrint("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/Scripts/Python/grsnWallPython.py b/Scripts/Python/grsnWallPython.py new file mode 100644 index 0000000000..1fc045be98 --- /dev/null +++ b/Scripts/Python/grsnWallPython.py @@ -0,0 +1,1246 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * + +## 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 + PtDebugPrint("looking north ",north) + if (north): + while (i < BlockerCountLimit): + if (NorthWall[i] == index): + PtDebugPrint("index found in north list in slot ",i) + return True + PtDebugPrint("north wall [",i,"] = ",NorthWall[i]) + i = i + 1 + else: + while (i < BlockerCountLimit): + if (SouthWall[i] == index): + PtDebugPrint("index found in south list in slot ",i) + return True + PtDebugPrint("south wall [",i,"] = ",SouthWall[i]) + i = i + 1 + + PtDebugPrint("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): + PtDebugPrint("yikes - somehow overran the array!") + return + NorthWall[i] = index + NorthCount = NorthCount + 1 + PtDebugPrint("set north wall index ",index," in slot ",i," to true") + else: + while (SouthWall[i] >= 0): + i = i + 1 + if (i == 20): + PtDebugPrint("yikes - somehow overran the array!") + return + SouthWall[i] = index + SouthCount = SouthCount + 1 + PtDebugPrint("set south wall index ",index," in slot ",i," to true") + else: + if (north): + while (NorthWall[i] != index): + i = i + 1 + if (i == 20): + PtDebugPrint("this should not get hit - looked for non-existent NorthWall entry!") + return + NorthWall[i] = -1 + NorthCount = NorthCount - 1 + PtDebugPrint("removed index ",index," from list slot ",i) + else: + while (SouthWall[i] != index): + i = i + 1 + if (i == 20): + PtDebugPrint("this should not get hit - looked for non-existent SouthWall entry!") + return + SouthWall[i] = -1 + SouthCount = SouthCount - 1 + PtDebugPrint("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) + PtDebugPrint("tubes open") + + + def SetNPanelMode(self,state): + global NorthState + global SouthState + global NorthCount + global SouthCount + global BlockerCountLimit + global NorthWall + global SouthWall + + PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("tubes open") + + def IAmMaster(self): + return (self.sceneobject.isLocallyOwned()) + + + def ChangeGameState(self,newState): + + PtDebugPrint("sending change game state message with state ",newState) + msg = ptClimbingWallMsg(self.key) + msg.init(ptClimbingWallMsgType.kNewState, newState, 0) + msg.send() + + def ChangeBlockerCount(self, newCount): + PtDebugPrint("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 + + + PtDebugPrint("grsnClimbingWall::OnClimbingWallInit type ",type," state ",state," value ",value) + if not ReceiveInit: + PtDebugPrint("failed to receive init") + return + if (type == ptClimbingWallMsgType.kEndGameState): + ReceiveInit = False + PtDebugPrint("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 + PtDebugPrint("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 + + PtDebugPrint("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 = not PtGetPlayerList() + if not solo: + 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) + PtDebugPrint("requesting game state message from master client") + msg = ptClimbingWallMsg(self.key) + msg.init(ptClimbingWallMsgType.kRequestGameState,0,0) + msg.send() + return + else: + PtDebugPrint("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 + PtDebugPrint("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 + PtDebugPrint("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) + #PtDebugPrint("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) + PtDebugPrint("enabled north wall - this should not happen ") + else: + #ageSDL.setIndex("northWall",i,0) + northWall.value[i].physics.suppress(True) + #PtDebugPrint("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 + + #PtDebugPrint("grsnWall - Notify ",state,id,events) + ageSDL = PtGetAgeSDL() + avatar = PtFindAvatar(events) + + southState = SouthState + northState = NorthState + PtDebugPrint("southState = ",southState) + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("start touching quit jewel, warp out") + if (avatar == PtGetLocalAvatar()): + PtAtTimeCallback(self.key ,0.8 ,kNorthQuit) + return + + if (id == nTubeOpen.id): + PtDebugPrint("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: + PtDebugPrint("Smart seek completed. close tube") + nTubeClose.run(self.key,avatar=avatar) + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + PtDebugPrint("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): + PtDebugPrint("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: + PtDebugPrint("Smart seek completed. close tube") + sTubeClose.run(self.key,avatar=avatar) + elif event[0] == kMultiStageEvent and event[1] == 0 and event[2] == kAdvanceNextStage: + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("clicked south chair") + avID = PtGetClientIDFromAvatarKey(avatar.getKey()) + if state: + occupant = ageSDL["sChairOccupant"][0] + PtDebugPrint("occupant ",occupant) + if (1): + PtDebugPrint("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): + PtDebugPrint("standing up from south chair") + southChair.enable() + ageSDL.setIndex("sChairOccupant",0,-1) + + return + + if (id == northChair.id): + PtDebugPrint("clicked north chair") + avID = PtGetClientIDFromAvatarKey(avatar.getKey()) + if state: + occupant = ageSDL["nChairOccupant"][0] + PtDebugPrint("occupant ",occupant) + if (1): + PtDebugPrint("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): + PtDebugPrint("standing up from north chair") + northChair.enable() + ageSDL.setIndex("nChairOccupant",0,-1) + + return + + + elif not state: + return + if (avatar != PtGetLocalAvatar()): + PtDebugPrint("not activated by me") + return + + if (id == nTubeEntry.id): + trigger = PtFindAvatar(events) + PtDebugPrint("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) + PtDebugPrint("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: + PtDebugPrint("up button south") + if (southState == ptClimbingWallMsgState.kSouthSelect): + PtDebugPrint("correct state, blocker count limit ",BlockerCountLimit) + if (BlockerCountLimit < 20): + self.ChangeBlockerCount(BlockerCountLimit + 1) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + else: + PtDebugPrint("somehow think blocker count limit greater than 20?") + return + elif id == dnButtonS.id: + PtDebugPrint("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: + PtDebugPrint("five button south") + if (southState == ptClimbingWallMsgState.kSouthSelect): + self.ChangeBlockerCount(5) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + return + elif id == tenBtnS.id: + PtDebugPrint("ten button south") + if (southState == ptClimbingWallMsgState.kSouthSelect): + self.ChangeBlockerCount(10) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + return + elif id == fifteenBtnS.id: + PtDebugPrint("fifteen button south") + if (southState == ptClimbingWallMsgState.kSouthSelect): + self.ChangeBlockerCount(15) + sPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='up') + return + + elif id == readyButtonS.id: + PtDebugPrint("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: + PtDebugPrint("picked s go button") + if (southState == ptClimbingWallMsgState.kSouthSit): + PtDebugPrint("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 ): + PtDebugPrint("force north chair to keep up") + self.ChangeGameState(ptClimbingWallMsgState.kNorthSelect) + elif(southState == ptClimbingWallMsgState.kSouthReady): + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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) + PtDebugPrint("force south chair to keep up") + else: + nPanelSound.run(self.key,avatar=PtGetLocalAvatar(),state='denied') + return + elif id == goButtonN.id: + PtDebugPrint("picked n go button") + if (northState == ptClimbingWallMsgState.kNorthSit): + PtDebugPrint("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) + PtDebugPrint("force south chair to keep up") + elif(northState == ptClimbingWallMsgState.kNorthReady): + PtDebugPrint("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() + PtDebugPrint("player picked blocker named ", objName) + north = 0 + try: + index = northPanel.value.index(panelPicked) + north = 1 + except: + try: + index = southPanel.value.index(panelPicked) + except: + PtDebugPrint("no wall blocker found") + return; + if (north): #you picked something on the north panel + if (northState != ptClimbingWallMsgState.kNorthReady): + PtDebugPrint("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) + PtDebugPrint("numSelected = ",numSelected) + #maxSelections = ageSDL["northCountLimit"][0] + maxSelections = BlockerCountLimit + #if (ageSDL["northWall"][index]==0): + if (self.LookupIndex(index,True) == 0): + if (numSelected == maxSelections): + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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) + PtDebugPrint("numSelected = ",numSelected) + #maxSelections = ageSDL["southCountLimit"][0] + maxSelections = BlockerCountLimit + #if (ageSDL["southWall"][index]==0): + if (self.LookupIndex(index,False) == 0): + if (numSelected == maxSelections): + PtDebugPrint("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): + PtDebugPrint("what?!?") + return + #ageSDL.setIndex("southCount",0,numSelected) + #SouthCount = numSelected + #self.SetWallIndex(index,False,False) + self.ChangeBlockerState(False,index,False) +""" diff --git a/Scripts/Python/grsnWellJump.py b/Scripts/Python/grsnWellJump.py new file mode 100644 index 0000000000..cd5f710ee1 --- /dev/null +++ b/Scripts/Python/grsnWellJump.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +# Include Plasma code +from Plasma import * +from PlasmaTypes import * + +############################################################## +# 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/Scripts/Python/grtzAccessDoors.py b/Scripts/Python/grtzAccessDoors.py new file mode 100644 index 0000000000..00a9bd4d3f --- /dev/null +++ b/Scripts/Python/grtzAccessDoors.py @@ -0,0 +1,305 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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] + + PtDebugPrint("grtzAccessDoors: self.SDL = %d" % self.grtzDoorState) + PtDebugPrint("grtzAccessDoors: Player List = %d" % len(PtGetPlayerList())) + + if len(PtGetPlayerList()) > 0: + + PtDebugPrint("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) + PtDebugPrint("grtzAccessDoors: Door is open.") + PtDebugPrint("grtzAccessDoors: Door State = %d" % self.grtzDoorState) + + elif self.grtzDoorState == doorSDLstates['closing']: + doorResponder.run(self.key,state='CloseTheDoor',fastforward=1,netPropagate=0) + PtDebugPrint("grtzAccessDoors: Door is closed.") + PtDebugPrint("grtzAccessDoors: Door State = %d" % self.grtzDoorState) + + else: + PtDebugPrint("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] + PtDebugPrint("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): + PtDebugPrint("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']) + PtDebugPrint("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']) + PtDebugPrint("grtzAccessDoors: I triggered the region and I'm changing the sdl to closetoopen.") + + elif self.grtzDoorState == doorSDLstates['opentoclose']: + self.UpdateDoorState(doorSDLstates['movingopen']) + PtDebugPrint("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']) + PtDebugPrint("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']) + PtDebugPrint("grtzAccessDoors: I triggered the region and I'm changing the sdl to opentoclose.") + + elif self.grtzDoorState == doorSDLstates['closetoopen']: + self.UpdateDoorState(doorSDLstates['movingclosed']) + PtDebugPrint("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]) + PtDebugPrint("grtzAccessDoors: New list is: %s" % (str(self.grtzDoorStack))) + + if len(self.grtzDoorStack) == 1: + PtDebugPrint("grtzAccessDoors: List is only one command long, so I'm playing it") + code = self.grtzDoorStack[0] + PtDebugPrint("grtzAccessDoors: Playing command: %s" % (code)) + self.ExecCode(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=')) + PtDebugPrint("grtzAccessDoors: Door State Updated to %d" % curState) + PtDebugPrint("grtzAccessDoors: Door State SDL Set to %d" % self.SDL['DoorOpen'][0]) + + if curState != self.grtzDoorState: + self.grtzDoorState = curState + PtDebugPrint("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 + + PtDebugPrint("grtzAccessDoors: I triggered the region") + + if PtDetermineKIMarkerLevel() < kKIMarkerNormalLevel: + PtDebugPrint("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: + PtDebugPrint("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) + PtDebugPrint("grtzAccessDoors: Getting rid of Resp: %s" % (old)) + if len(self.grtzDoorStack): + PtDebugPrint("grtzAccessDoors: There's at lest one more Resp to play.") + code = self.grtzDoorStack[0] + PtDebugPrint("Playing command: %s" % (code)) + self.ExecCode(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("doorResponderOpen") + PtDebugPrint("grtzAccessDoors: Notifying Clients to play Open Door Responder") + + elif self.grtzDoorState == doorSDLstates['closing']: + self.SendNote("doorResponderClose") + PtDebugPrint("grtzAccessDoors: Notifying Clients to play Close Door Responder") + + elif self.grtzDoorState == doorSDLstates['closedfail']: + self.SendNote("doorResponderNoAccess") + PtDebugPrint("grtzAccessDoors: Notifying Clients to play Failed Door Responder") + + def ExecCode(self, code): + if code == "doorResponderOpen": + doorResponder.run(self.key,state='OpenTheDoor',netPropagate=0) + elif code == "doorResponderClose": + doorResponder.run(self.key,state='CloseTheDoor',netPropagate=0) + elif code == "doorResponderNoAccess": + doorResponder.run(self.key,state='NoAccess',netPropagate=0) + else: + PtDebugPrint("grtzAccessDoors.ExecCode(): ERROR! Invalid code '%s'." % (code)) + self.grtzDoorStack.pop(0) diff --git a/Scripts/Python/grtzGZMaster.py b/Scripts/Python/grtzGZMaster.py new file mode 100644 index 0000000000..2932c77f54 --- /dev/null +++ b/Scripts/Python/grtzGZMaster.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + #PtDebugPrint("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/Scripts/Python/grtzKIMarkerMachine.py b/Scripts/Python/grtzKIMarkerMachine.py new file mode 100644 index 0000000000..25ea04f83e --- /dev/null +++ b/Scripts/Python/grtzKIMarkerMachine.py @@ -0,0 +1,551 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 entry is not 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 entry is not 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 entry is not 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: + PtDebugPrint("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 entry is 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 entry is not 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 entry is not 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 entry is not 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 link is not 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 link is 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() + #PtDebugPrint("Title: %s\nName: %s" % (title,name)) + if title == "great zero" and name == "bigroomlinkinpoint": + PtDebugPrint("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") + #PtDebugPrint("NewSpawnPointInfo\nName: %s\nTitle: %s" % (outerRoomSP.getName(), outerRoomSP.getTitle())) + link.addSpawnPoint(outerRoomSP) + link.save() + PtDebugPrint("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 entryCityLinks is not None: + valCityLinks = entryCityLinks.chronicleGetValue() + PtDebugPrint("valCityLinks = ",valCityLinks) + CityLinks = valCityLinks.split(",") + PtDebugPrint("CityLinks = ",CityLinks) + if agePanel not in CityLinks: + NewLinks = valCityLinks + "," + agePanel + entryCityLinks.chronicleSetValue(NewLinks) + entryCityLinks.save() + PtDebugPrint("grtzKIMarkerMachine.IDoCityLinksChron(): setting citylinks chron entry to include: ",agePanel) + valCityLinks = entryCityLinks.chronicleGetValue() + CityLinks = valCityLinks.split(",") + PtDebugPrint("grtzKIMarkerMachine.IDoCityLinksChron(): citylinks now = ",CityLinks) + else: + PtDebugPrint("grtzKIMarkerMachine.IDoCityLinksChron(): do nothing, citylinks chron already contains: ",agePanel) + else: + vault.addChronicleEntry("CityBookLinks",0,agePanel) + PtDebugPrint("grtzKIMarkerMachine.IDoCityLinksChron(): creating citylinks chron entry and adding: ",agePanel) + + psnlSDL = xPsnlVaultSDL() + GotBook = psnlSDL["psnlGotCityBook"][0] + if not GotBook: + psnlSDL["psnlGotCityBook"] = (1,) + PtDebugPrint("grtzKIMarkerMachine.IDoCityLinksChron(): setting SDL for city book to 1") \ No newline at end of file diff --git a/Scripts/Python/grtzMarkerGames.py b/Scripts/Python/grtzMarkerGames.py new file mode 100644 index 0000000000..4cdb088804 --- /dev/null +++ b/Scripts/Python/grtzMarkerGames.py @@ -0,0 +1,325 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +from Plasma import * + +MG01 = ( + ("city", ptPoint3(0.113123, -156.593, 221.15), "3, 53, -80"), + ("city", ptPoint3(17.0199, -315.718, 144.806), "62334, 63, -85"), + ("city", ptPoint3(6.97063, -312.509, 131.561), "62432, 63, -86"), + ("city", ptPoint3(40.9337, -437.902, 82.8586), "62143, 71, -89"), + ("city", ptPoint3(-142.135, -634.978, 8.21551), "32257, 84, -93"), + ("city", ptPoint3(97.9118, -555.991, 6.74272), "61728, 78, -93"), + ("city", ptPoint3(146.221, -571.129, 9.02309), "61363, 80, -93"), + ("city", ptPoint3(62.3171, -496.638, 6.83943), "61984, 75, -93"), + ("city", ptPoint3(95.1365, -14.2289, 243.928), "61188, 45, -79"), + ("city", ptPoint3(198.983, 27.1469, 291.171), "59651, 44, -76"), + ("city", ptPoint3(154.969, 4.03381, 290.841), "60329, 44, -76"), + ("city", ptPoint3(-0.621237, -329.797, 135.381), "9, 64, -85"), +) + +MG02 = ( + ("city", ptPoint3(866.687, -645.153, 238.134), "56815, 100, -79"), + ("city", ptPoint3(884.89, -722.404, 232.785), "56972, 104, -79"), + ("city", ptPoint3(840.865, -645.9, 244.26), "56953, 99, -79"), + ("city", ptPoint3(164.1, -408.321, 162.822), "61041, 70, -84"), + ("city", ptPoint3(-130.384, -284.278, 127.039), "32495, 62, -86"), + ("city", ptPoint3(-128.733, -283.422, 127.041), "32479, 62, -86"), + ("city", ptPoint3(-126.874, -283.311, 127.042), "32461, 62, -86"), + ("city", ptPoint3(-125.991, -283.299, 127.043), "32452, 62, -86"), + ("city", ptPoint3(-90.4871, -233.48, 127.11), "32143, 58, -86"), + ("city", ptPoint3(-112.979, -239.741, 127.444), "32372, 59, -86"), + ("city", ptPoint3(-121.025, -244.955, 131.027), "32449, 59, -86"), + ("city", ptPoint3(-147.008, -248.051, 127.11), "32712, 60, -86"), + ("city", ptPoint3(-199.518, 19.7047, 225.826), "33992, 44, -80"), + ("city", ptPoint3(-199.09, 24.6076, 225.826), "34005, 44, -80"), + ("city", ptPoint3(-193.792, 30.2368, 225.826), "33954, 43, -80"), + ("city", ptPoint3(-234.291, 47.5248, 253.739), "34580, 43, -78"), + ("city", ptPoint3(-290.803, 25.9652, 254.499), "35207, 45, -78"), + ("city", ptPoint3(-245.232, 104.78, 254.478), "35030, 40, -78"), + ("city", ptPoint3(173.349, -349.866, 180.313), "60876, 66, -83"), + ("city", ptPoint3(841.677, -644.558, 244.414), "56945, 99, -79"), + ("city", ptPoint3(179.525, -354.162, 180.313), "60826, 66, -83"), + ("city", ptPoint3(169.036, -519.697, 160.798), "61133, 77, -84"), + ("city", ptPoint3(839.212, -648.525, 243.975), "56971, 99, -79"), + ("city", ptPoint3(845.905, -690.159, 209.033), "57070, 101, -81"), +) + +MG03 = ( + ("city", ptPoint3(779.755, -587.08, 259.243), "57090, 94, -78"), + ("city", ptPoint3(454.014, -382.702, 297.221), "58559, 73, -75"), + ("city", ptPoint3(873.06, -808.26, 259.243), "57287, 109, -78"), + ("city", ptPoint3(966.86, -801.529, 259.254), "56817, 111, -78"), + ("city", ptPoint3(885.322, -770.273, 259.243), "57116, 107, -78"), + ("city", ptPoint3(898.188, -768.307, 269.941), "57046, 107, -77"), + ("city", ptPoint3(972.309, -712.254, 269.975), "56510, 107, -77"), + ("city", ptPoint3(867.876, -607.192, 269.983), "56679, 98, -77"), + ("city", ptPoint3(806.465, -662.197, 269.863), "57191, 99, -77"), + ("city", ptPoint3(675.79, -518.872, 256.664), "57473, 87, -78"), + ("city", ptPoint3(491.578, -324.465, 251.259), "58059, 71, -78"), +) + +MG04 = ( + ("city", ptPoint3(262.733, -532.497, 239.805), "60415, 78, -79"), + ("city", ptPoint3(225.478, -513.173, 216.521), "60676, 77, -80"), + ("city", ptPoint3(-135.211, -637.171, 10.4902), "32205, 84, -93"), + ("city", ptPoint3(881.076, -803.77, 259.244), "57235, 109, -78"), + ("city", ptPoint3(877.444, -803.838, 259.244), "57253, 108, -78"), + ("city", ptPoint3(870.754, -803.964, 259.244), "57287, 108, -78"), + ("city", ptPoint3(840.792, -804.53, 246.271), "57438, 107, -79"), + ("city", ptPoint3(-0.0876787, -314.3, 144.145), "5, 63, -85"), + ("city", ptPoint3(13.9271, -154.523, 224.159), "62339, 53, -80"), + ("city", ptPoint3(-59.7848, -110.308, 221.673), "31905, 50, -80"), + ("city", ptPoint3(-118.658, -163.122, 221.597), "32534, 54, -80"), + ("city", ptPoint3(-146.071, -180.047, 218.473), "32813, 55, -80"), + ("city", ptPoint3(-215.992, -225.902, 186.949), "33459, 59, -82"), + ("city", ptPoint3(-197.099, -213.275, 194.361), "33293, 58, -82"), + ("city", ptPoint3(-165.729, -195.325, 220.011), "32998, 57, -80"), + ("city", ptPoint3(75.1814, -125.345, 223.846), "61600, 51, -80"), + ("city", ptPoint3(167.221, -328.274, 178.47), "60901, 65, -83"), + ("city", ptPoint3(238.621, -351.974, 181.112), "60287, 67, -83"), + ("city", ptPoint3(296.351, -428.617, 178.973), "59951, 73, -83"), + ("city", ptPoint3(323.009, -503.966, 244.604), "59898, 78, -79"), +) + +MG05 = ( + ("city", ptPoint3(152.191, 21.0605, 293.854), "60315, 43, -76"), + ("city", ptPoint3(383.555, -111.711, 257.587), "58121, 56, -78"), + ("city", ptPoint3(343.068, 16.5379, 292.971), "57888, 47, -76"), + ("city", ptPoint3(318.848, 41.6997, 291.357), "58029, 45, -76"), + ("city", ptPoint3(40.6364, -152.596, 224.379), "62028, 53, -80"), + ("city", ptPoint3(100.535, -247.86, 193.841), "61452, 59, -82"), + ("city", ptPoint3(782.075, -583.084, 259.243), "57064, 94, -78"), + ("city", ptPoint3(704.187, -510.593, 259.243), "57268, 87, -78"), + ("city", ptPoint3(779.124, -436.175, 296.512), "56531, 86, -75"), + ("city", ptPoint3(798.406, -367.264, 297.593), "56122, 83, -75"), + ("city", ptPoint3(672.346, -335.633, 297.594), "56783, 77, -75"), + ("city", ptPoint3(521.539, -233.122, 294.92), "57442, 66, -75"), + ("city", ptPoint3(431.085, -401.132, 294.896), "58796, 74, -75"), + ("city", ptPoint3(399.419, -467.361, 299.302), "59227, 77, -75"), + ("city", ptPoint3(416.217, -547.247, 277.85), "59302, 82, -77"), + ("city", ptPoint3(370.373, -565.982, 239.353), "59674, 82, -79"), + ("city", ptPoint3(306.196, -485.725, 243.624), "59992, 76, -79"), + ("city", ptPoint3(262.047, -532.807, 237.377), "60421, 78, -79"), + ("city", ptPoint3(234.399, -468.967, 208.197), "60536, 74, -81"), + ("city", ptPoint3(261.147, -452.115, 206.569), "60288, 73, -81"), + ("city", ptPoint3(298.73, -431.849, 178.966), "59939, 73, -83"), + ("city", ptPoint3(230.511, -343.587, 178.72), "60343, 66, -83"), + ("city", ptPoint3(191.976, -327.469, 178.508), "60667, 65, -83"), + ("city", ptPoint3(68.7406, -40.7315, 230.585), "61584, 46, -80"), + ("city", ptPoint3(244.142, 67.786, 291.356), "58848, 42, -76"), + ("city", ptPoint3(332.792, 58.5213, 291.296), "57756, 45, -76"), + ("city", ptPoint3(349.096, -67.2592, 274.02), "58265, 52, -77"), + ("city", ptPoint3(462.965, -72.0451, 297.591), "57142, 56, -75"), +) + +MG06 = ( + ("Neighborhood", ptPoint3(275.215, -713.491, 19.1162), "60283, 1005, -70"), + ("Neighborhood", ptPoint3(261.281, -750.158, 21.5005), "60270, 1003, -70"), + ("Neighborhood", ptPoint3(213.126, -767.487, 9.8439), "60238, 1003, -71"), + ("Neighborhood", ptPoint3(172.793, -775.21, 3.32227), "60213, 1003, -71"), + ("Neighborhood", ptPoint3(280.228, -796.492, 9.01678), "60275, 1000, -71"), + ("Neighborhood", ptPoint3(226.41, -854.221, 1.65846), "60234, 998, -71"), + ("Neighborhood", ptPoint3(123.435, -931.588, -19.6041), "60160, 994, -73"), + ("Neighborhood", ptPoint3(186.016, -792.772, -18.2181), "60218, 1002, -73"), + ("Neighborhood", ptPoint3(160.845, -750.635, -10.8941), "60209, 1005, -72"), + ("Neighborhood", ptPoint3(305.288, -706.162, 21.0971), "60302, 1005, -70"), + ("Neighborhood", ptPoint3(354.996, -742.071, 19.1236), "60327, 1003, -70"), + ("Neighborhood", ptPoint3(324.906, -766.67, 19.1239), "60306, 1002, -70"), + ("Neighborhood", ptPoint3(195.939, -835.297, 5.82845), "60218, 999, -71"), + ("Neighborhood", ptPoint3(135.273, -767.306, 11.7715), "60191, 1004, -71"), +) + + + +MG07 = ( + ("Neighborhood", ptPoint3(0.380994, -771.841, 8.10068), "60109, 1006, -71"), + ("Neighborhood", ptPoint3(59.4292, -782.611, 8.15849), "60143, 1004, -71"), + ("Neighborhood", ptPoint3(-11.4838, -788.725, 8.10068), "60100, 1005, -71"), + ("Neighborhood", ptPoint3(-20.6219, -775.695, 8.10068), "60096, 1006, -71"), + ("Neighborhood", ptPoint3(-25.0077, -763.53, 8.10068), "60095, 1007, -71"), + ("Neighborhood", ptPoint3(84.2148, -804.868, 15.692), "60155, 1003, -71"), + ("Neighborhood", ptPoint3(31.4565, -796.199, 81.4172), "60125, 1004, -66"), + ("Neighborhood", ptPoint3(214.071, -873.879, -18.5609), "60224, 997, -73"), + ("Neighborhood", ptPoint3(240.256, -759.147, 9.85464), "60256, 1003, -71"), + ("Neighborhood", ptPoint3(280.289, -857.252, 5.71199), "60266, 997, -71"), + ("Neighborhood", ptPoint3(55.9215, -780.317, 29.2447), "60142, 1005, -70"), + ("Neighborhood", ptPoint3(107.642, -735.816, 7.56582), "60179, 1006, -71"), + ("Neighborhood", ptPoint3(137.585, -766.796, 12.0827), "60193, 1004, -71"), + ("Neighborhood", ptPoint3(182.913, -774.13, 10.5281), "60219, 1003, -71"), + ("Neighborhood", ptPoint3(250.806, -779.415, 9.80428), "60259, 1002, -71"), + ("Neighborhood", ptPoint3(297.308, -783.464, 9.14582), "60287, 1001, -71"), +) + +MG08 = ( + ("city", ptPoint3(316.219, -514.793, 237.373), "59972, 78, -79"), + ("city", ptPoint3(365.981, -563.018, 237.389), "59700, 82, -79"), + ("city", ptPoint3(415.82, -538.035, 274.685), "59283, 81, -77"), + ("city", ptPoint3(425.815, -416.746, 294.899), "58884, 74, -75"), + ("city", ptPoint3(469.789, -341.995, 294.9), "58296, 71, -75"), + ("city", ptPoint3(467.679, -330.837, 294.91), "58273, 70, -75"), + ("city", ptPoint3(465.28, -318.14, 268.098), "58246, 70, -77"), + ("city", ptPoint3(260.434, -160.43, 260.027), "59585, 56, -78"), + ("city", ptPoint3(214.6, -160.99, 259.761), "60078, 55, -78"), + ("city", ptPoint3(129.821, -176.251, 215.822), "61042, 55, -80"), + ("city", ptPoint3(189.439, -327.706, 178.497), "60692, 65, -83"), + ("city", ptPoint3(180.853, -314.042, 177.981), "60749, 64, -83"), + ("city", ptPoint3(245.511, -333.635, 150.648), "60186, 66, -84"), + ("city", ptPoint3(65.3244, -127.249, 221.673), "61719, 52, -80"), + ("city", ptPoint3(-2.39575, -13.6359, 220.941), "35, 44, -80"), + ("city", ptPoint3(-42.9333, -145.408, 277.339), "31681, 53, -77"), + ("city", ptPoint3(-54.6834, -191.584, 278.654), "31789, 56, -76"), + ("city", ptPoint3(-71.0139, -181.946, 274.244), "31978, 55, -77"), + ("city", ptPoint3(-68.8656, -167.067, 284.985), "31966, 54, -76"), + ("city", ptPoint3(-42.0513, -195.511, 277.165), "467, 56, -77"), +) + +MG09 = ( + ("city", ptPoint3(1.77311, -143.133, 220.935), "62480, 52, -80"), + ("city", ptPoint3(-47.6192, -128.094, 221.671), "31746, 52, -80"), + ("city", ptPoint3(-133.881, -194.159, 221.659), "32656, 56, -80"), + ("city", ptPoint3(-36.892, -77.407, 221.679), "31642, 48, -80"), + ("city", ptPoint3(-182.53, 15.0192, 221.679), "33745, 44, -80"), + ("city", ptPoint3(-11.8993, -39.2203, 220.12), "161, 46, -80"), + ("city", ptPoint3(-13.1011, 35.0907, 220.104), "31354, 41, -80"), + ("city", ptPoint3(32.8043, -51.3977, 221.76), "62068, 47, -80"), + ("city", ptPoint3(50.5303, -118.34, 221.66), "61889, 51, -80"), + ("city", ptPoint3(42.9236, -133.187, 221.661), "61990, 52, -80"), + ("city", ptPoint3(123.175, -9.2883, 261.196), "60797, 45, -78"), + ("city", ptPoint3(82.4942, -144.117, 222.015), "61535, 53, -80"), + ("city", ptPoint3(70.1662, -220.908, 195.87), "61746, 57, -82"), + ("city", ptPoint3(-4.62847, -215.158, 194.066), "51, 57, -82"), + ("city", ptPoint3(7.58955, -205.743, 199.97), "62417, 56, -81"), + ("city", ptPoint3(1.26902, -94.9741, 220.931), "62485, 49, -80"), +) + +MG10 = ( + ("city", ptPoint3(-169.248, -599.338, 8.22528), "32489, 82, -93"), + ("city", ptPoint3(-159.089, -572.478, 8.22528), "32437, 80, -93"), + ("city", ptPoint3(-146.356, -536.789, 8.22528), "32370, 78, -93"), + ("city", ptPoint3(50.8871, -483.389, 62.6932), "62074, 74, -90"), + ("city", ptPoint3(6.66464, -425.883, 92.6597), "62442, 70, -88"), + ("city", ptPoint3(-2.43234, -276.531, 155.824), "26, 61, -84"), + ("city", ptPoint3(2.97976, -148.419, 223.733), "62466, 53, -80"), + ("city", ptPoint3(61.4058, -129.401, 221.671), "61768, 52, -80"), + ("city", ptPoint3(113.078, -162.948, 214.661), "61208, 54, -80"), + ("city", ptPoint3(489.8, -304.099, 294.899), "57996, 69, -75"), + ("city", ptPoint3(549.031, -170.577, 297.581), "56916, 64, -75"), + ("city", ptPoint3(553.686, -196.203, 297.581), "57008, 65, -75"), + ("city", ptPoint3(588.206, -227.224, 297.593), "56889, 68, -75"), + ("city", ptPoint3(603.84, -253.754, 297.593), "56898, 70, -75"), + ("city", ptPoint3(666.27, -332.168, 297.594), "56809, 76, -75"), + ("city", ptPoint3(775.175, -341.96, 297.595), "56149, 81, -75"), + ("city", ptPoint3(801.331, -397.677, 297.595), "56238, 85, -75"), + ("city", ptPoint3(777.84, -421.14, 299.93), "56477, 85, -75"), + ("city", ptPoint3(715.306, -504.603, 256.659), "57179, 87, -78"), + ("city", ptPoint3(765.788, -589.046, 259.234), "57176, 93, -78"), + ("city", ptPoint3(874.804, -556.476, 259.243), "56459, 95, -78"), + ("city", ptPoint3(951.983, -589.045, 259.243), "56182, 100, -78"), + ("city", ptPoint3(968.839, -630.479, 259.243), "56248, 102, -78"), + ("city", ptPoint3(1000.34, -713.188, 259.243), "56381, 108, -78"), + ("city", ptPoint3(1003.1, -748.014, 259.243), "56481, 110, -78"), + ("city", ptPoint3(978.66, -745.66, 259.243), "56588, 109, -78"), + ("city", ptPoint3(893.636, -809.511, 259.243), "57190, 109, -78"), + ("city", ptPoint3(849.176, -824.857, 222.094), "57452, 109, -80"), +) + +MG11 = ( + ("city", ptPoint3(-0.0891117, -155.874, 223.466), "3, 53, -80"), + ("city", ptPoint3(0.0849568, -510.678, 6.83298), "3, 75, -93"), + ("city", ptPoint3(0.046029, -468.112, 30.0315), "3, 73, -92"), + ("city", ptPoint3(0.0126944, -425.414, 90.2389), "3, 70, -88 "), + ("city", ptPoint3(0.0880445, -330.854, 134.733), "3, 64, -85"), + ("city", ptPoint3(-0.0940349, -308.747, 144.135), "3, 63, -85 "), + ("city", ptPoint3(0.107221, -82.8188, 220.945), "3, 49, -80"), + ("city", ptPoint3(0.0100019, 31.4722, 220.945), "3, 41, -80"), + ("GreatZero", ptPoint3(0.000921001, -25.3192, -40.0522), "0, 1, -3"), +) + +MG12 = ( + ("city", ptPoint3(-76.7246, -463.087, 8.21978), "31851, 73, -93"), + ("city", ptPoint3(-10.8075, -413.394, 92.4359), "97, 69, -88"), + ("city", ptPoint3(-11.6655, -320.016, 133.759), "114, 63, -86 "), + ("city", ptPoint3(-3.82988, -312.859, 144.135), "39, 63, -85"), + ("city", ptPoint3(-107.042, -293.259, 130.295), "32254, 62, -86"), + ("city", ptPoint3(-140.033, -212.729, 127.077), "32694, 57, -86"), + ("city", ptPoint3(-140.033, -212.729, 274.241), "32694, 57, -77"), + ("city", ptPoint3(0.388106, -150.975, 220.94), "62496, 53, -80 "), + ("city", ptPoint3(69.3479, -41.5769, 221.68), "61577, 46, -80"), +) + +MG13 = ( + ("GreatZero", ptPoint3(-0.107815, -48.5057, -40.0535), "22, 3, -3"), + ("GreatZero", ptPoint3(-46.3505, 16.0544, -40.0403), "18929, 3, -3 "), + ("GreatZero", ptPoint3(38.3031, 29.4412, -40.04), "40365, 3, -3 "), + ("city", ptPoint3(-146.164, -481.771, 8.22064), "32420, 74, -93"), + ("city", ptPoint3(-76.4565, -492.799, 7.64378), "31834, 74, -93 "), + ("city", ptPoint3(-4.83725, -489.336, 6.84302), "41, 74, -93"), + ("city", ptPoint3(83.4286, -493.755, 60.0126), "61808, 74, -90 "), + ("city", ptPoint3(239.618, -470.852, 208.239), "60496, 74, -81"), +) + +MG14 = ( + ("city", ptPoint3(467.321, -331.116, 294.91), "58277, 70, -75 "), + ("city", ptPoint3(386.313, -177.083, 260.518), "58384, 60, -78 "), + ("city", ptPoint3(338.75, 41.1883, 291.95), "57792, 46, -76 "), + ("city", ptPoint3(282.086, 53.5703, 293.757), "58422, 44, -76 "), + ("city", ptPoint3(243.691, -339.626, 157.405), "60215, 66, -84"), + ("city", ptPoint3(173.38, -315.199, 158.217), "60822, 64, -84"), + ("city", ptPoint3(167.893, -392.185, 181.574), "60987, 69, -83 "), + ("city", ptPoint3(58.2999, -197.159, 209.46), "61857, 56, -81 "), + ("city", ptPoint3(131.894, -172.566, 216.863), "61013, 55, -80"), + ("city", ptPoint3(-41.2759, -146.405, 274.388), "31661, 53, -77 "), + ("city", ptPoint3(128.527, -122.188, 261.352), "60963, 52, -78 "), + ("city", ptPoint3(-3.08397, 12.4945, 223.141), "46, 43, -80 "), + ("city", ptPoint3(-98.4153, -28.1701, 223.632), "32498, 46, -80 "), + ("city", ptPoint3(-182.556, -170.771, 198.891), "33231, 55, -81"), + ("city", ptPoint3(-196.998, -214.11, 196.267), "33290, 58, -82 "), + ("city", ptPoint3(-47.6542, -61.9222, 221.684), "31789, 47, -80 "), + ("city", ptPoint3(-68.2777, -96.0332, 221.684), "32022, 50, -80"), + ("city", ptPoint3(-77.9, -55.3034, 221.684), "32188, 47, -80"), + ("city", ptPoint3(-64.4581, -74.3091, 221.684), "31995, 48, -80"), +) + +mgs = (MG01, MG02, MG03, MG04, MG05, MG06, MG07, MG08, MG09, MG10, MG11, + MG12, MG13, MG14) diff --git a/Scripts/Python/grtzMarkerScopeGUI.py b/Scripts/Python/grtzMarkerScopeGUI.py new file mode 100644 index 0000000000..2edeccf15b --- /dev/null +++ b/Scripts/Python/grtzMarkerScopeGUI.py @@ -0,0 +1,368 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +from Plasma import * +from PlasmaConstants import * +from PlasmaTypes import * +from PlasmaKITypes import * +import time + +import grtzMarkerGames +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=True) +aScope2Act = ptAttribNamedActivator(6, "CGZ Scope2 Python", netForce=True) +aScope3Act = ptAttribNamedActivator(7, "CGZ Scope3 Python", netForce=True) +aScope4Act = ptAttribNamedActivator(8, "CGZ Scope4 Python", netForce=True) + +# TagIDs for the GUI +kRGMarkerGameSelect = 500 +kMarkerGameFieldStart = 200 +kMarkerGameFieldEnd = 340 +kMarkerGameNumFieldOffset = 0 +kMarkerGameNameFieldOffset = 1 + +# Game Score Sctuff +kGameScore = "GreatZeroCalibration_{:02d}" +kScoreType = PtGameScoreTypes.kFixed + +# Timer CBs +kTimerUpdateActiveCB = 0 +kTimerUpdateSecs = 1.0 + +# This should be a ptAttribSceneobject +kTelescopes = {"GZMachineScope01", "GZMachineScope02", "GZMachineScope03", "GZMachineScope04"} + +class grtzMarkerScopeGUI(ptModifier): + def __init__(self): + ptModifier.__init__(self) + self.id = 213 + self.version = 3 + + self._lookingAtGUI = False + self._pendingScoreUpdate = None + + def __del__(self): + if self._pendingScoreUpdate is not None: + PtDebugPrint("grtzMarkerScopeGUI.__del__():\tShutting down with a pending score update :(") + PtUnloadDialog("MarkerGameGUI") + + def OnBackdoorMsg(self, target, param): + target = target.lower() + if target.startswith("cgzm"): + try: + mission = int(target[-2:]) + except: + return + score = self._scores[mission] + if isinstance(score, ptGameScore): + score.setPoints(int(param), self.key) + else: + PtDebugPrint("grtzMarkerScopeGUI.OnBackdoorMsg():\tDon't have the GameScore yet!") + + elif target == "cgztime": + try: + time = int(param) + except: + PtDebugPrint("grtzMarkerScopeGUI.OnBackdoorMsg():\tcgztime wants an integer") + else: + time = PtGetServerTime() - time + PtDebugPrint("grtzMarkerScopeGUI.OnBackdoorMsg():\tUpdating CGZ Start Time to {}".format(time)) + PtUpdateCGZStartTime(time) + + elif target == "gps": + value = True if param in {"enable", "1", "true", "on"} else False + self._GrantGPS(value) + + def _CheckForGPSCalibration(self): + for i, score in enumerate(self._scores): + if not isinstance(score, ptGameScore): + if score == -1: + PtDebugPrint("grtzMarkerScopeGUI._CheckForGPSCalibration():\tMGS #{} is still loading. No GPS.".format(i), level=kDebugDumpLevel) + return + else: + PtDebugPrint("grtzMarkerScopeGUI._CheckForGPSCalibration():\tMGS #{} has no score. No GPS.".format(i), level=kWarningLevel) + return + if score.getPoints() == 0: + PtDebugPrint("grtzMarkerScopeGUI._CheckForGPSCalibration():\tMGS #{} has a score of zero. No GPS.".format(i), level=kWarningLevel) + return + self._GrantGPS() + + def OnControlKeyEvent(self, controlKey, activeFlag): + if controlKey in (PlasmaControlKeys.kKeyExitMode, PlasmaControlKeys.kKeyMoveBackward, + PlasmaControlKeys.kKeyRotateLeft, PlasmaControlKeys.kKeyRotateRight): + self._PopTelescope() + + def OnFirstUpdate(self): + PtLoadDialog("MarkerGameGUI", self.key) + + def OnGameScoreMsg(self, msg): + if isinstance(msg, ptGameScoreListMsg): + try: + mission = int(msg.getName()[-2:]) + except: + PtDebugPrint("grtzMarkerScopeGUI.OnGameScoreMsg():\tTITS! '{}' didn't match.".format(score.getName())) + return + try: + score = msg.getScores()[0] + except: + self._scores[mission] = 0 + else: + self._scores[mission] = score + if self._lookingAtGUI: + self._UpdateGUI(mission) + + # Process pending score op + if self._pendingScoreUpdate is not None: + wantMission, wantScore = self._pendingScoreUpdate + if mission == wantMission: + if isinstance(self._scores[mission], ptGameScore): + if self._scores[mission].getScore() > wantScore: + self._scores[mission].setScore(wantScore, self.key) + else: + ptGameScore.createPlayerScore(msg.getName(), kScoreType, wantScore, self.key) + self._pendingScoreUpdate = None + + elif isinstance(msg, ptGameScoreUpdateMsg): + try: + score = msg.getScore() + except: + return + try: + mission = int(score.getName()[-2:]) + except: + PtDebugPrint("grtzMarkerScopeGUI.OnGameScoreMsg():\tTITS! '{}' didn't match.".format(score.getName())) + return + + points = score.getPoints() + self._scores[mission] = points + PtDebugPrint("grtzMarkerScopeGUI.OnGameScoreMsg():\tUpdated CGZ #{} = {}".format(mission, points)) + + if self._lookingAtGUI: + self._UpdateGUI(mission=mission, score=points, star=True) + + # We did something with a score... Maybe we have GPS nao? + if -1 not in self._scores: + self._CheckForGPSCalibration() + + def _GrantGPS(self, enable=True): + PtDebugPrint("grtzMarkerScopeGUI._GrantGPS():\tYou have GPS...", level=kWarningLevel) + + vault = ptVault() + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + GPSVar = psnlSDL.findVar("GPSEnabled") + if GPSVar.getBool() != enable: + GPSVar.setBool(enable) + vault.updatePsnlAgeSDL(psnlSDL) + act = "Enabled" if enable else "Disabled" + PtDebugPrint("grtzMarkerScopeGUI._GrantGPS():\t{} GPS!".format(act), level=kWarningLevel) + + def OnGUINotify(self, id, control, event): + if id != MarkerGameDlg.id: + return + + if event == kDialogLoaded: + MGAnim.animation.skipToTime(1.5) + elif event == kShowHide: + self._lookingAtGUI = control.isEnabled() + if control.isEnabled(): + self._ShowGUI() + elif event == kValueChanged and self._lookingAtGUI: + rgid = control.getTagID() + if rgid == kRGMarkerGameSelect: + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + mission = gameSelector.getValue() + if mission == -1: + self._StopCGZM(win=False) + elif mission != PtGetCGZM(): + self._PlayCGZM(mission) + + def OnNotify(self, state, id, events): + PtDebugPrint("grtzMarkerScopeGUI:OnNotify():\tstate=%f id=%d events=" % (state, id), events, level=kDebugDumpLevel) + + if id in self._scopes: + if PtDetermineKIMarkerLevel() < kKIMarkerNormalLevel: + MarkerGameDlg.dialog.hide() + else: + MGMachineOffResp.run(self.key, netPropagate=False) + elif id == MGMachineOnResp.id: + PtEnableControlKeyEvents(self.key) + elif id == MGMachineOffResp.id: + MarkerGameDlg.dialog.hide() + PtDisableControlKeyEvents(self.key) + + def OnServerInitComplete(self): + numGames = len(grtzMarkerGames.mgs) + self._scores = [-1] * numGames + for i in xrange(numGames): + ptGameScore.findPlayerScores(kGameScore.format(i), self.key) + self._scopes = (aScope1Act.id, aScope2Act.id, aScope3Act.id, aScope4Act.id) + + def OnTimer(self, id): + if id == kTimerUpdateActiveCB: + if self._lookingAtGUI: + mission = PtGetCGZM() + if mission != -1: + self._UpdateGUI(mission) + PtAtTimeCallback(self.key, kTimerUpdateSecs, kTimerUpdateActiveCB) + + def _PlayCGZM(self, mission): + PtDebugPrint("grtzMarkerScopeGUI._PlayCGZM():\tStarting CGZM #{}".format(mission), level=kWarningLevel) + if self._lookingAtGUI: + self._UpdateGUI(mission, score=0, star=True) + PtAtTimeCallback(self.key, kTimerUpdateSecs, kTimerUpdateActiveCB) + PtSendKIMessageInt(kMGStartCGZGame, mission) + + def _PopTelescope(self): + """Tells the telescope script we're done""" + notify = ptNotify(self.key) + notify.clearReceivers() + for i in kTelescopes: + try: + obj = PtFindSceneobject(i, PtGetAgeName()) + pythonScripts = obj.getPythonMods() + for script in pythonScripts: + notify.addReceiver(script) + except: + PtDebugPrint("grtzMarkerScopeGUI._PopTelescope():\tCould not send quit message to '{}'".format(i)) + notify.netPropagate(False) + notify.setActivate(1.0) + notify.send() + + def _ShowGUI(self): + MGMachineOnResp.run(self.key, netPropagate=False) + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + if PtDetermineKIMarkerLevel() < kKIMarkerNormalLevel: + PtDebugPrint("grtzMarkerScopeGUI._ShowGUI():\tKI Level not high enough, disabling GUI controls", level=kWarningLevel) + gameSelector.setValue(-1) + gameSelector.disable() + else: + self._UpdateGUI() + mission = PtGetCGZM() + gameSelector.setValue(mission) + if mission != -1: + if PtIsCGZMComplete(): + PtDebugPrint("grtzMarkerScopeGUI._ShowGUI():\tCGZM #{}: complete!".format(mission), level=kWarningLevel) + self._StopCGZM(win=True) + else: + PtDebugPrint("grtzMarkerScopeGUI._ShowGUI():\tCGZM #{}: still playing...".format(mission), level=kWarningLevel) + PtAtTimeCallback(self.key, kTimerUpdateSecs, kTimerUpdateActiveCB) + + def _StopCGZM(self, win): + mission = PtGetCGZM() + if win: + time = PtGetTimePlayingCGZ() + + # Update the score. Be aware that we may not actually have the GameScore at all... + score = self._scores[mission] + if isinstance(score, ptGameScore): + bestTime = score.getPoints() > time + if bestTime: + score.setPoints(time, self.key) + self._UpdateGUI(mission, quitting=False, score=time, star=bestTime) + elif score == 0: + ptGameScore.createPlayerScore(kGameScore.format(mission), kScoreType, time, self.key) + else: + self._pendingScoreUpdate = (mission, time) + else: + self._UpdateGUI(mission, quitting=True, star=False) + + # Tear down game brain + PtSendKIMessageInt(kMGStopCGZGame, -1) + + # Update UI + gameSelector = ptGUIControlRadioGroup(MarkerGameDlg.dialog.getControlFromTag(kRGMarkerGameSelect)) + gameSelector.setValue(-1) + + def _UpdateGUI(self, mission=-1, quitting=False, score=None, star=None): + # If mission is -1, this is a total update + if mission == -1: + for i in xrange(len(grtzMarkerGames.mgs)): + self._UpdateGUI(i) + return + + # Update this marker mission + if score is None: + prevScore = self._scores[mission] + prev = prevScore.getPoints() if isinstance(prevScore, ptGameScore) else prevScore + if quitting: + span = prev + else: + span = PtGetTimePlayingCGZ() if PtGetCGZM() == mission else prev + if star is None and span < prev: + star = True + else: + span = score + + # Generate the message + if score is None and span == 0: + if span == -1: + msg = PtGetLocalizedString("KI.MarkerGame.pendingActionLoading") + else: + msg = u"--:--:--" + else: + st = time.gmtime(span) + if st.tm_yday > 1: + # days, hours, minutes, seconds -- you really suck at this + # if you go over a year, you really suck + msg = u"{:02d}:{:02d}:{:02d}:{:02d}".format(st.tm_yday, st.tm_hour, st.tm_min, st.tm_sec) + else: + # hours, minutes, seconds + msg = u"{:02d}:{:02d}:{:02d}".format(st.tm_hour, st.tm_min, st.tm_sec) + + if star: + msg = u"** {}".format(msg) + + # Now do the deed + fieldID = (mission * 10) + kMarkerGameFieldStart + numTB = ptGUIControlTextBox(MarkerGameDlg.dialog.getControlFromTag(fieldID + kMarkerGameNumFieldOffset)) + numTB.setString(str(len(grtzMarkerGames.mgs[mission]))) + timeTB = ptGUIControlTextBox(MarkerGameDlg.dialog.getControlFromTag(fieldID + kMarkerGameNameFieldOffset)) + timeTB.setStringW(msg) + diff --git a/Scripts/Python/grtzMarkerScopes.py b/Scripts/Python/grtzMarkerScopes.py new file mode 100644 index 0000000000..fb1e39e1ae --- /dev/null +++ b/Scripts/Python/grtzMarkerScopes.py @@ -0,0 +1,218 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 = not PtGetPlayerList() + + 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/Scripts/Python/islmEmgrPhase0.py b/Scripts/Python/islmEmgrPhase0.py new file mode 100644 index 0000000000..afbcfe4f01 --- /dev/null +++ b/Scripts/Python/islmEmgrPhase0.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 = 2 + + +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 + PtDebugPrint("__init__islmEmgrPhase0 v.", version) + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + + for variable in BooleanVARs: + PtDebugPrint("tying together", variable) + ageSDL.setNotify(self.key,variable,0.0) + self.IManageBOOLs(variable, "") + + for variable in StateVARs.viewkeys(): + 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: + PtDebugPrint("islmEmgrPhase0.OnSDLNotify : %s is a BOOLEAN Variable" % (VARname)) + self.IManageBOOLs(VARname,SDLname) + + elif VARname in StateVARs.viewkeys(): + 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? + PtDebugPrint("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/Scripts/Python/islmGZBeamBrain.py b/Scripts/Python/islmGZBeamBrain.py new file mode 100644 index 0000000000..128f62fe53 --- /dev/null +++ b/Scripts/Python/islmGZBeamBrain.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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 + PtDebugPrint("__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: + PtDebugPrint("islmGZBeamBrain.OnServerInitComplete: ERROR! Can't find the boolGZBeamVis sdl, doing nothing.") + return + + if boolGZBeamVis: + PtDebugPrint("islmGZBeamBrain.OnServerInitComplete: The Great Zero beam IS active.") + self.TurnBeamOn() + else: + PtDebugPrint("islmGZBeamBrain.OnServerInitComplete: The Great Zero beam is NOT active.") + self.TurnBeamOff() + + + def TurnBeamOn(self): + PtDebugPrint("islmGZBeamBrain.RotateBeam: Trying to turn the beam ON.") + Beamlight.sceneobject.draw.enable() + respRotateBeam.run(self.key) + + + def TurnBeamOff(self): + PtDebugPrint("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 +# #PtDebugPrint("islmGZBeamBrain: The Shell has been seen", shellseen," times.") +# respShowShell.run(self.key) +# +# elif id == actShellJump.id: +# PtDebugPrint("islmGZBeamBrain: The avatar has jumped into the Shell. Stopping the fall.") +# avatar = PtGetLocalAvatar() +# avatar.physics.suppress(1) + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + PtDebugPrint("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/Scripts/Python/islmMemorialImager.py b/Scripts/Python/islmMemorialImager.py new file mode 100644 index 0000000000..e6b14ced42 --- /dev/null +++ b/Scripts/Python/islmMemorialImager.py @@ -0,0 +1,379 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("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(",") + #PtDebugPrint("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] + #PtDebugPrint("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 + #PtDebugPrint("islmMemorialImager: PtGetDniTime: " + str(PtGetDniTime()) + "kLastUpdate: " + str(kLastUpdate)) + movedSince = int(((long(PtGetDniTime()) - long(kLastUpdate)) / kUpdateTime) * kIncAmount) + #PtDebugPrint("islmMemorialImager: Distance to move:" , movedSince) + kLastUpdate = PtGetDniTime() + for x in range(4): + #PtDebugPrint("islmMemorialImager: Imager%d \n kcursorstart:%d \t kcursorend:%d" % (x,kCursorStart[x],kCursorEnd[x])) + self.UpdateMarqueeOffset(x,movedSince) + #PtDebugPrint("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 + + #PtDebugPrint("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 + #PtDebugPrint("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 folderNode is not 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 textNode is not None: + PtDebugPrint("islmMemorialImager: child node is named %s" % (textNode.getTitle()),level=kDebugDumpLevel) + if textNode.getTitle() == "MemorialImager": + if textNode.getText() == "": + if kMessage == "": + self.setTimerCallback(30) + #PtDebugPrint("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) + #PtDebugPrint("islmMemorialImager: Message Node not found.") + + #PtDebugPrint("islmMemorialImager: Message Updated") + #PtDebugPrint("islmMemorialImager: Message Length:", len(kMessage)) + ############################ + + #def SetMemorialSDL(self): + # #PtDebugPrint("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 +# #PtDebugPrint("islmMemorialImager: Synching my imager to the age owners.") +# ageSDL = PtGetAgeSDL() +# updatetime = long(PtGetDniTime()) - long(ageSDL["MemorialImagerStartTime"][0]) +# movedsince = int((updatetime / kUpdateTime) * kIncAmount) +# #PtDebugPrint("islmMemorialImager: UpdateTime: " + str(updatetime) + " \t MovedSince: " + str(movedsince)) +# textWidth = 0 +# cursor = len(kMessage) +# #PtDebugPrint("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): + PtDebugPrint("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/Scripts/Python/islmPassable.py b/Scripts/Python/islmPassable.py new file mode 100644 index 0000000000..f4d213ad06 --- /dev/null +++ b/Scripts/Python/islmPassable.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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: + PtDebugPrint("islmPassable: The Player has started the GZ marker game.") + PtDebugPrint("islmPassable: Disabling baracades at the bottom of the Great Stair.") + respBoolTrue.run(self.key,fastforward=1) + else: + PtDebugPrint("islmPassable: The player has NOT started the GZ marker game.") + PtDebugPrint("islmPassable: Enabling baracades at the bottom of the Great Stair.") + respBoolFalse.run(self.key,fastforward=1) diff --git a/Scripts/Python/islmPodMap.py b/Scripts/Python/islmPodMap.py new file mode 100644 index 0000000000..573763363c --- /dev/null +++ b/Scripts/Python/islmPodMap.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("islmPodMap: init version = %d" % self.version) + + ########################### + def IGetAgeFilename(self): + "returns the .age file name of the age" + ageInfo = PtGetAgeInfo() + if ageInfo is not 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 + #PtDebugPrint("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) + PtDebugPrint("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 Vignette.value: + PtSendKIMessage(kEnableKIandBB,0) + PtHideDialog(Vignette.value) + PtDebugPrint("Dialog: %s goes down" % Vignette.value) + else: + PtDebugPrint("WTH!!!") + #disable the Control key events + PtGetControlEvents(False,self.key) + + diff --git a/Scripts/Python/islmRandomBahroScream.py b/Scripts/Python/islmRandomBahroScream.py new file mode 100644 index 0000000000..b2bbe7d41b --- /dev/null +++ b/Scripts/Python/islmRandomBahroScream.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__islmRandomBahroScream v.", self.version) + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + global ScreamChanceVar + + if AgeStartedIn == PtGetAgeName(): + if strChanceVar.value: + 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) + PtDebugPrint("RandomBahroScream: Chance val - %d, Cur Chance - %d" % (chanceval, cur_chance)) + if cur_chance <= chanceval: + # turn on + PtDebugPrint("RandomBahroScream: turning on") + respScream.run(self.key) + except: + PtDebugPrint("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/Scripts/Python/islmRegisterNexusLink.py b/Scripts/Python/islmRegisterNexusLink.py new file mode 100644 index 0000000000..a3ddc49743 --- /dev/null +++ b/Scripts/Python/islmRegisterNexusLink.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 entry is not 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 cityLink is not 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/Scripts/Python/jlakConstants.py b/Scripts/Python/jlakConstants.py new file mode 100644 index 0000000000..510cb9f825 --- /dev/null +++ b/Scripts/Python/jlakConstants.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +Module: jlakConstants.py +Age: Jalak +Date: March 2011 +Author: Branan Purvine-Riley +Constants shared between xKI.py and jlakField.py +Moved from xKI.py to here +""" + +# Jalak Button IDs +kJalakMiniIconBtn = 1200 +kJalakRandomBtn = 1201 +kJalakExtremeBtn = 1202 +kJalakWallToggleBtn = 1203 +kJalakColumnsLowBtn = 1204 +kJalakColumnsMedBtn = 1205 +kJalakColumnsHighBtn = 1206 +kJalakRampBtn = 1207 +kJalakSphereBtn = 1208 +kJalakBigBoxBtn = 1209 +kJalakLilBoxBtn = 1210 +kJalakRectangleBtn = 1211 +kJalakDestroyBtn = 1212 +JalakBtnStates = [ str(kJalakRandomBtn),str(kJalakExtremeBtn),str(kJalakWallToggleBtn),str(kJalakColumnsLowBtn),\ + str(kJalakColumnsMedBtn),str(kJalakColumnsHighBtn),str(kJalakRampBtn),str(kJalakSphereBtn),\ + str(kJalakBigBoxBtn),str(kJalakLilBoxBtn),str(kJalakRectangleBtn),str(kJalakDestroyBtn)] + +# Jalak GUI constants +kSphere = "Sphere" +kLilBox = "LilBox" +kBigBox = "BigBox" +kRamp = "Ramp" +kRect = "Rect" +kJalakBtnDelaySeconds = 0.4 diff --git a/Scripts/Python/jlakField.py b/Scripts/Python/jlakField.py new file mode 100644 index 0000000000..7a990dd6a4 --- /dev/null +++ b/Scripts/Python/jlakField.py @@ -0,0 +1,894 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + + +# Shared xKI/jlakField constants +from jlakConstants import * + +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 +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] + + PtDebugPrint("jlakField.OnServerInitComplete(): byteStartPt = ",byteStartPt) + PtDebugPrint("jlakField.OnServerInitComplete(): boolWall = ",boolWall) + PtDebugPrint("jlakField.OnServerInitComplete(): byteSphere = ",byteSphere) + PtDebugPrint("jlakField.OnServerInitComplete(): byteLilBox = ",byteLilBox) + PtDebugPrint("jlakField.OnServerInitComplete(): byteBigBox = ",byteBigBox) + PtDebugPrint("jlakField.OnServerInitComplete(): byteRamp = ",byteRamp) + PtDebugPrint("jlakField.OnServerInitComplete(): byteRect = ",byteRect) + PtDebugPrint("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) + PtDebugPrint("jlakField.OnServerInitComplete(): byteColumns = ",byteColumns) + + kZeroed = ptVector3(0,0,0) + + for objCol in objColumns.value: + obj = objCol.getName() + listObjCols.append(obj) + PtDebugPrint("listObjCols = ",listObjCols) + + if len(clkColumnUp.value) != len(listObjCols): + PtDebugPrint("error! not enough up clickables") + elif len(clkColumnDn.value) != len(listObjCols): + PtDebugPrint("error! not enough down clickables") + + for resp in respSfxColumn.value: + aResp = resp.getName() + listSfxCols.append(aResp) + #PtDebugPrint("listSfxCols = ",listSfxCols) + + for warp in warpPlayers.value: + pt = warp.getName() + listWarpPlayers.append(pt) + #PtDebugPrint("listWarpPlayers = ",listWarpPlayers) + + if not len(PtGetPlayerList()): + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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 + PtDebugPrint("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: + PtDebugPrint("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] + PtDebugPrint("jlakField.OnSDLNotify(): byteStartPt = ",byteStartPt) + if VARname == sdlWall: + boolWall = ageSDL[sdlWall][0] + PtDebugPrint("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) + #PtDebugPrint("oldPos = ",oldPos) + #PtDebugPrint("newPos = ",newPos) + #PtDebugPrint("diffPos = ",diffPos) + clkColumnUp.value[id].disable() + clkColumnDn.value[id].disable() + animColumn.byObject[col].playToTime(newPos) + byteColumns[id] = newPos + PtDebugPrint("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] + PtDebugPrint("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) + PtDebugPrint("jlakField.OnSDLNotify(): dropping: ",widgetName) + PtDebugPrint("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) + PtDebugPrint("jlakField.OnSDLNotify(): dropping: ",widgetName) + PtDebugPrint("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) + PtDebugPrint("jlakField.OnSDLNotify(): dropping: ",widgetName) + respCreateWidgetSFX.run(self.key) + PtDebugPrint("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) + PtDebugPrint("jlakField.OnSDLNotify(): dropping: ",widgetName) + PtDebugPrint("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) + PtDebugPrint("jlakField.OnSDLNotify(): dropping: ",widgetName) + PtDebugPrint("jlakField.OnSDLNotify(): byteRect = ",byteRect) + + + def OnNotify(self,state,id,events): + ageSDL = PtGetAgeSDL() + #PtDebugPrint("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() + PtDebugPrint("jlakField.OnNotify(): pressed: ",theClk) + if id == clkColumnUp.id: + direction = 1 + numClk = string.atoi(theClk[6:]) + else: + direction = 0 + numClk = string.atoi(theClk[6:]) + #PtDebugPrint("numClk = ",numClk) + self.CalcPos(numClk,direction) + +# elif id == rgnZeroPhysicals.id: +# PtDebugPrint("rgnZeroPhysicals") +# PtDebugPrint(state) +# for event in events: +# if event[0] == kCollisionEvent: +# PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("incoming event: %s" % (events[0][1])) + code = events[0][1] + PtDebugPrint("playing command: %s" % (code)) + self.ExecCode(code) + + + def CalcPos(self,id,dir): + #PtDebugPrint("jlakField.CalcPos()") + global PendingCol + global PendingPos + global PendingDir + + PtForceCursorHidden() + PtEmoteAvatar("KITap") + PtAtTimeCallback(self.key,kEmoteTimer,kEmoteTimerID) + + oldPos = byteColumns[id] + if dir: + op = "up" + #PtDebugPrint("jlakField.CalcPos(): request for column: ",id,", to go: ",op) + if oldPos < kMaxPos: + newPos = oldPos + 1 + else: + PtDebugPrint("but already at max") + return + else: + op = "down" + #PtDebugPrint("jlakField.CalcPos(): request for column: ",id,", to go: ",op) + if oldPos > kMinPos: + newPos = oldPos - 1 + else: + PtDebugPrint("but already at min") + return + + PendingCol = id + PendingPos = newPos + PendingDir = op + PtAtTimeCallback(self.key,1.0,100) + + + def AutoColumns(self,mode,preset=None): + PtDebugPrint("jlakField.AutoColumns(): requested all columns move using mode: ",mode) + if boolGUILock: + PtDebugPrint("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: + PtDebugPrint("no preset, ignoring") + return + else: + PtDebugPrint("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: + PtDebugPrint("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,) + #PtDebugPrint("jlakField.DropWidget(): dropping widget: ",widgetName) + + + def ResetWidgets(self): + #PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("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) + PtDebugPrint("jlakField.WarpWidgetsHome(): resetting: ",widgetName) + e += 1 + + + def ToggleWall(self): + PtDebugPrint("jlakField.ToggleWall()") + ageSDL = PtGetAgeSDL() + if boolWall: + ageSDL[sdlWall] = (0,) + else: + ageSDL[sdlWall] = (1,) + + + def DoWallSensors(self,state): + PtDebugPrint("jlakField.DoWallSensors()") + for rgn in rgnWallSensors.value: + if state: + #PtDebugPrint("jlakField.DoWallSensors(): ",rgn.getName()," enabled") + rgn.enable() + else: + #PtDebugPrint("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: + #PtDebugPrint("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: + PtDebugPrint("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') + PtDebugPrint("jlakField.SaveColumns(): writing to presets file '%s'" % (fName)) + i = 0 + for pos in byteColumns: + fWrite.write(str(pos)+"\n") + PtDebugPrint("jlakField.SaveColumns(): column: %d at position: %d" % (i,pos)) + i += 1 + fWrite.close() + + + def LoadColumns(self,fName): + try: + fRead = file(fName,'r') + except: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("jlakField.LoadColumns(): ERROR! File contains %d positions, must contain positions for 25 columns, only. Load canceled." % (len(preset))) + else: + PtDebugPrint("jlakField.LoadColumns(): reading preset file '%s'" % (fName)) + PtDebugPrint("this preset's columns = ",preset) + self.AutoColumns(5,preset) + fRead.close() + + + def OnBackdoorMsg(self, target, param): + PtDebugPrint("jlakField.OnBackdoorMsg()") + if target == "height": + param = string.atoi(param) + if param < kMinPos or param > kMaxPos: + PtDebugPrint("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: + PtDebugPrint("invalid reset parameter, can only use 'widgets' for now") + + def ExecCode(self, code): + try: + btnID = int(code) + if btnID == kJalakRandomBtn: + self.AutoColumns(3) + elif btnID == kJalakExtremeBtn: + self.AutoColumns(4) + elif btnID == kJalakWallToggleBtn: + self.ToggleWall() + elif btnID == kJalakColumnsLowBtn: + self.AutoColumns(0) + elif btnID == kJalakColumnsMedBtn: + self.AutoColumns(1) + elif btnID == kJalakColumnsHighBtn: + self.AutoColumns(2) + elif btnID == kJalakRampBtn: + self.DropWidget(kRamp) + elif btnID == kJalakSphereBtn: + self.DropWidget(kSphere) + elif btnID == kJalakBigBoxBtn: + self.DropWidget(kBigBox) + elif btnID == kJalakLilBoxBtn: + self.DropWidget(kLilBox) + elif btnID == kJalakRectangleBtn: + self.DropWidget(kRect) + elif btnID == kJalakDestroyBtn: + self.ResetWidgets() + else: + PtDebugPrint("jlakField.ExecCode(): ERROR! Invalid btnID %d." % (btnID)) + except: + cmd = code.split(';',1) + if len(cmd) != 2: + PtDebugPrint("jlakField.ExecCode(): ERROR! Malformed Command '%s'." % (code)) + return + + if cmd[0] == "SaveColumns": + self.SaveColumns(cmd[1]) + elif cmd[0] == "LoadColumns": + self.LoadColumns(cmd[1]) + else: + PtDebugPrint("jlakField.ExecCode(): ERROR! Invalid code '%s'." % (code)) + +#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/Scripts/Python/kdshGlowInTheDark.py b/Scripts/Python/kdshGlowInTheDark.py new file mode 100644 index 0000000000..8499a79afa --- /dev/null +++ b/Scripts/Python/kdshGlowInTheDark.py @@ -0,0 +1,540 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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 + PtDebugPrint("__init__kdshGlowInTheDark v.", version,".5") + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + if ageSDL == None: + PtDebugPrint("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] + + PtDebugPrint("kdshGlowInTheDark: When I got here:") + + if not RoofClosed: + PtDebugPrint("\tThe roof was open when I got here.") + respFloorLitFromGlow.run(self.key,fastforward=1) + else: + PtDebugPrint("\tThe roof is still closed.") + + if RoofClosed and GlowCharged: + PtDebugPrint("\tThe floor was glowing when I got here.") + PtAtTimeCallback(self.key,1,5) + #~ respFloorGlow.run(self.key,fastforward=1) + else: + PtDebugPrint("\tThe floor is not charged.") + + if solved: + PtDebugPrint("\tThe puzzle was solved.") + PtDebugPrint("\tThere are", len(PtGetPlayerList()), " other players in this Kadish instance.") + if len(PtGetPlayerList()) == 0: + PtDebugPrint("\t I'm alone, so I'm starting the elevator.") + respElevDown.run(self.key) + PtAtTimeCallback(self.key,3,2) # clear xRgn at top + else: + PtDebugPrint("\t Someone else was already in this Kadish instance. Depending on Overriding HighSDL component to synch elevator.") + else: + PtDebugPrint("\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() + + #~ PtDebugPrint("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(): + PtDebugPrint("##") + oldstate = ageSDL["RoofClosed"][0] # 1 is closed, 0 is open + + if oldstate == 1: # roof was previously closed + PtDebugPrint("kdshGlowInTheDark: The roof is now open.") + self.RecordOpenTime() + + GlowCharged = ageSDL["GlowCharged"][0] + PtDebugPrint("kdshGlowInTheDark: GlowCharged = ", GlowCharged) + #~ if GlowCharged: + #~ respFloorLitFromGlow.run(self.key) + #~ else: + #~ respFloorLitFromDark.run(self.key) + + elif oldstate == 0: # roof was previously open + PtDebugPrint("kdshGlowInTheDark: The roof is now closed.") + self.CalculateTimeOpen() + #~ respFloorDark.run(self.key) + + else: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("kdshGlowInTheDark: A second player stepped on floor.") + baton = 0 + elif event[0] == 1: + PtDebugPrint("kdshGlowInTheDark: Floor unoccupied.") + return + + elif id == actResetBtn.id: + PtDebugPrint("kdshGlowInTheDark Reset Button clicked.") + Resetting = 1 + respResetBtn.run(self.key,events=events) + return + + elif id == respResetBtn.id and OnlyOneOwner.sceneobject.isLocallyOwned(): + PtDebugPrint("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 PtGetLocalAvatar() == PtFindAvatar(events): + me = PtGetLocalAvatar() + if id == rgnExitSubTop.id: + PtDebugPrint("kdshGlowInTheDark: You stepped off the elevator at the top. Removing from Subworld") + me.avatar.exitSubWorld() + return + + elif id == rgnExitSubBtm.id: + PtDebugPrint("kdshGlowInTheDark: You stepped off the elevator at the btm. Removing from Subworld") + me.avatar.exitSubWorld() + return + + elif id == rgnEnterSubTop.id: + PtDebugPrint("You stepped on the elevator at the top. Joining subworld.") + #~ rgnExitSubTop.disable() + me.avatar.enterSubWorld(elevatorsubworld.value) + return + + elif id == rgnEnterSubBtm.id: + PtDebugPrint("You stepped on the elevator at the bottom. Joining subworld.") + rgnExitSubBtm.disable() + me.avatar.enterSubWorld(elevatorsubworld.value) + return + + 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]) + #~ PtDebugPrint("\tTimer #", TimerID,"callback came through.") + + if TimerID==1: + PtDebugPrint("kdshGlowInTheDark: Timer 1 Callback. Raising elevator again.") + xRgnBottom.clearNow(self.key) + rgnExitSubBtm.disable() + + if not self.sceneobject.isLocallyOwned(): + PtDebugPrint("\tI'm not the owner, so I'll let another client netforce raise the elevator.") + return + else: + respElevUp.run(self.key) + + if TimerID== 2: + PtDebugPrint("kdshGlowInTheDark: Timer 2 Callback. Clearing top Xrgn") + xRgnTop.clearNow(self.key) + rgnEnterSubTop.disable() + + if TimerID== 3: + PtDebugPrint("kdshGlowInTheDark: Timer 3 Callback.") + ageSDL = PtGetAgeSDL() + solved = ageSDL["GlowInTheDarkSolved"][0] + if solved: + PtDebugPrint("\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(): + PtDebugPrint("\tI'm not the owner, so I'll let another client netforce lower the elevator.") + return + else: + respElevDown.run(self.key) + + else: + PtDebugPrint("\t Puzzle has been reset. Leaving elevator alone at top.") + rgnEnterSubTop.disable() + for region in objExitTop.value: + region.physics.suppress(0) + if TimerID== 4: + PtDebugPrint("kdshGlowInTheDark: Timer 4 Callback.") + PtDebugPrint("\tkdshGlowInTheDark.OnTimer: Running from Lit to Dark.") + respFloorDark.run(self.key) + Resetting = 0 + + + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + global Resetting + ageSDL = PtGetAgeSDL() + + #~ PtDebugPrint("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] + PtDebugPrint("\tkdshGlowInTheDark.OnSDLNotify: GlowCharged now =",GlowCharged) + + PtAtTimeCallback(self.key,6,4) + respFloorLitFromGlow.run(self.key) + + return + + def RecordOpenTime(self): + ageSDL = PtGetAgeSDL() + CurrentTime = PtGetDniTime() + PtDebugPrint("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() + #~ PtDebugPrint("Though it's now closed, the roof was once opened at:", TimeOpened) + #~ PtDebugPrint("The roof was closed at: ", CurrentTime) + + ElaspedTime = CurrentTime - TimeOpened + + #~ PtDebugPrint("The roof was open for:", ElaspedTime) + + if ElaspedTime > SecondsToCharge: + #~ PtDebugPrint("The roof was open for:", ElaspedTime) + PtDebugPrint("kdshGlowInTheDark: The floor is now charged") + ageSDL["GlowCharged"] = (1, ) + else: + pass + #~ PtDebugPrint("Not enough time to charge, because") + #~ PtDebugPrint("ElapsedTime = ", ElaspedTime) + #~ PtDebugPrint("SecondsToCharge = ", SecondsToCharge) + + def BatonPassCheck(self,id,events): + global baton + ageSDL = PtGetAgeSDL() + PtDebugPrint("##") + + 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 + PtDebugPrint("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 + PtDebugPrint(" 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. + PtDebugPrint("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: + PtDebugPrint("GlowInTheDark: Puzzle solved.") + ageSDL["GlowInTheDarkSolved"] = (1,) + baton = 0 + else: + PtDebugPrint("GlowInTheDark: Yes, you completed the path, but I thought the path was already solved.") + return + + if PtWasLocallyNotified(self.key): + PtDebugPrint("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: + PtDebugPrint("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() + + #~ PtDebugPrint("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(): + PtDebugPrint("\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() + + #~ PtDebugPrint("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() + + #~ PtDebugPrint("kdshGlowInTheDark: Timer 3 Callback.") + #~ ageSDL = PtGetAgeSDL() + #~ solved = ageSDL["GlowInTheDarkSolved"][0] + #~ if solved: + #~ PtDebugPrint("\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: + #~ PtDebugPrint("\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() + + #~ PtDebugPrint("kdshGlowInTheDark: Timer 4 Callback.") + #~ PtDebugPrint("\tkdshGlowInTheDark.OnTimer: Running from Lit to Dark.") + #~ respFloorDark.run(self.key) + #~ Resetting = 0 + + if id == 5: + PtDebugPrint("kdshGlowInTheDark: It's been one second. FF'ing floor to glow state.") + respFloorGlow.run(self.key,fastforward=1) diff --git a/Scripts/Python/kdshPillarRoom.py b/Scripts/Python/kdshPillarRoom.py new file mode 100644 index 0000000000..817c1a6350 --- /dev/null +++ b/Scripts/Python/kdshPillarRoom.py @@ -0,0 +1,662 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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 + PtDebugPrint("__init__kdshPillarRoom v.", version,".1") + + def OnServerInitComplete(self): + global PillarRoomSolvedCheck + + ageSDL = PtGetAgeSDL() + if ageSDL == None: + PtDebugPrint("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) + + PtDebugPrint("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] + PtDebugPrint("\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) + + #~ PtDebugPrint("\t\tUpdating ladderboxes because of pillar #", pillar, " initial state") + self.EnableAppropriateLadders(pillar) + + PtDebugPrint("\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,) + + PtDebugPrint("\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() + #~ PtDebugPrint("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: + PtDebugPrint("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 + PtDebugPrint("Counterweight expired.\n") + + elif ageSDL["pheight0" + str(id-5)][0] == 4: # True if that particular pillar has already been raised 4 times + PtDebugPrint("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, ) + PtDebugPrint("%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: + PtDebugPrint("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: + PtDebugPrint("kdshPillar.OnNotify: A reset button was pushed, but Pillar", pillarcheck-4, "can't reset now.") + safetoreset = False + + if safetoreset: + PtDebugPrint("kdshShadowPath Reset Button Pushed.") + self.ResetPuzzle() + return + + if not state: + return + + elif id >= 18 and id <=28 and PtWasLocallyNotified(self.key): + PtDebugPrint("Ladderbox %s entered." % ( id- 17)) + + LocalAvatar = PtFindAvatar(events) + + code = "MultiStage" + str(id-17) + ".run(LocalAvatar)" + #~ PtDebugPrint("code = ", code) + exec(code) + + return + + elif id == SolutionLadderBtm.id and PtWasLocallyNotified(self.key): + PtDebugPrint("Solution Ladder mounted from bottom.") + LocalAvatar = PtFindAvatar(events) + MultiSolutionBtm.run(LocalAvatar) + return + + elif id == SolutionLadderTop.id and PtWasLocallyNotified(self.key): + PtDebugPrint("Solution Ladder mounted from top.") + LocalAvatar = PtFindAvatar(events) + MultiSolutionTop.run(LocalAvatar) + return + + elif id == actResetBtn.id: + PtDebugPrint("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] + PtDebugPrint("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 + PtDebugPrint("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,) + PtDebugPrint("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 + + #~ PtDebugPrint("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: + PtDebugPrint("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]: + PtDebugPrint("PillarIsSafeToMove: Can't do that now. Someone is on a pillar.") + return False + else: + #~ PtDebugPrint("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) + + PtDebugPrint("\n##") + PtDebugPrint("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. + #~ PtDebugPrint("\tCounterweight lowering at speed of ", PullsInProgress,"x") + + rangeend = (8 - ageSDL["budget"][0]) * 10 + #~ PtDebugPrint("\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 + PtDebugPrint("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()) + PtDebugPrint("kdshPillarRoom.CheckSolution: pullerID=", pullerID,"myID=",myID) + if myID == pullerID: + PtDebugPrint("\tI pulled the final lever. Playing solution cam.") + + # Disable First Person Camera + cam = ptCamera() + cam.undoFirstPerson() + cam.disableFirstPersonOverride() + + respSolutionCam.run(self.key) + + else: + PtDebugPrint("\tI did not pull the final lever.") + + + def ResetPuzzle(self): + ageSDL = PtGetAgeSDL() + budget = ageSDL["budget"][0] + PtDebugPrint("kdshPillarRoom.ResetPuzzle: budget = ", budget) + if budget != 8: + + ageSDL["PillarsResetting"] = (1,) + ageSDL["PillarRoomSolved"] = (0,) + PtDebugPrint("\tAt least one pillar has been raised. Resetting Pillar puzzle") + else: + PtDebugPrint("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]: + #~ PtDebugPrint("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: + #~ PtDebugPrint("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] + + #~ PtDebugPrint("DisableAppropriateLadders: pillar = ", pillar,) + #~ PtDebugPrint(" ladderstodisable = ", ladderstodisable) + + for each in ladderstodisable: + code = "Ladderbox" +str(each) + ".disable()" + exec(code) + #~ PtDebugPrint("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 + #PtDebugPrint("Ladder tolerance for proceeding pillar:", tolerance01) + + if difference01 >= 1: # true if this pillar is higher than proceeding pillar + #~ PtDebugPrint("\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 + #~ PtDebugPrint("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) + + #~ PtDebugPrint("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 + #~ PtDebugPrint("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) + + + + #~ PtDebugPrint("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: + #~ PtDebugPrint("\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 + #~ PtDebugPrint("Pillar01 is %d notches higher than ground level" % (ageSDL["pheight01"][0])) + #~ PtDebugPrint("Ascending Ladder box #1 is now enabled with %d rungs." % (ageSDL["pheight01"][0] * 10)) + rungs = 6 * (ageSDL["pheight01"][0]) - 4 + #~ PtDebugPrint("Ladderbox1 rungs = ", rungs) + MultiStage1.setLoopCount(1,rungs) + Ladderbox1.enable() + + + #~ PtDebugPrint("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 + #~ PtDebugPrint("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: + #~ PtDebugPrint("\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 + #~ PtDebugPrint("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) + + #~ PtDebugPrint("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 + #~ PtDebugPrint("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) + + + #~ PtDebugPrint("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: + #~ PtDebugPrint("\nPillar0%d is level with or above the following pillar" % (id)) + pass + + else: #special condition for pillar04 + if ageSDL["pheight04"][0] == 4: + PtDebugPrint("Pillar04 has reached the red herring door") \ No newline at end of file diff --git a/Scripts/Python/kdshShadowPath.py b/Scripts/Python/kdshShadowPath.py new file mode 100644 index 0000000000..c842f50c4d --- /dev/null +++ b/Scripts/Python/kdshShadowPath.py @@ -0,0 +1,344 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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 + PtDebugPrint("__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) + + + + PtDebugPrint("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] + PtDebugPrint("\t ShadowPathLight0%s = %s " % (light, lightstate)) + + if lightstate == 1: + + code = "respSwitch0" + str(light) + ".run(self.key,fastforward=1)" + exec(code) + + PtDebugPrint("\t\tTurning on light #", light) + + solved = ageSDL["ShadowPathSolved"][0] + if solved: + PtDebugPrint("\tThe Shadow Path was already solved. Revealing stairs.") + RevealStairs.run(self.key,fastforward=1) + + + def Load(self): + count = 1 + while count < 5: + PtDebugPrint("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() + + PtDebugPrint("kdshShadowPath:OnNotify state=%f id=%d events=" % (state,id),events) + + + if id == FloorZone.id: + if events[0][1] == 1: + PtDebugPrint("kdshShadowPath.OnNotify: More than one person on the floor!") + regZoneStart.disable() + gameStarted = 0 + elif events[0][1] == 0: + PtDebugPrint("kdshShadowPath.OnNotify: Only one person on the floor!") + regZoneStart.enable() + + elif id == regZoneReset.id: + if events[0][1] == 1: + PtDebugPrint("kdshShadowPath.OnNotify: Someone in the stairwell, reset disabled.") + actResetBtn.disable() + elif events[0][1] == 0: + PtDebugPrint("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 + + PtDebugPrint("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 + + PtDebugPrint("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: + PtDebugPrint("Triggered Bad Region!") + gameStarted = 0 + + elif id == regZoneStart.id: + PtDebugPrint("Triggered Start Region!") + gameStarted = 1 + + elif id == regZoneFinish.id: + if gameStarted: + gameStarted = 0 + PtDebugPrint("kdshShadowPath: Puzzle solved.") + ageSDL["ShadowPathSolved"] = (1, ) # write new state value to SDL + + elif state and id == actResetBtn.id: + PtDebugPrint("kdshShadowPath Reset Button clicked.") + resetBtnByAvatar = PtFindAvatar(events) + respResetBtn.run(self.key,events=events) + + elif id == respResetBtn.id: + if resetBtnByAvatar != localAvatar: + resetBtnByAvatar = None + return + + PtDebugPrint("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,)' + PtDebugPrint("resetcode = ", code) + exec(code) + + PtDebugPrint("\tTurning off light #", light) + + #...and close the floor + ageSDL["ShadowPathSolved"] = (0,) + + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + ageSDL = PtGetAgeSDL() + #~ PtDebugPrint("OnSDLNotified.") + + if VARname == "ShadowPathSolved": + if ageSDL["ShadowPathSolved"][0] == 1: + PtDebugPrint("kdshShadowPath: Opening floor") + RevealStairs.run(self.key) + else: + PtDebugPrint("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 + + #~ PtDebugPrint("OnSDLNotify: Light ", light," SDL updated.") + + newstate = ageSDL["ShadowPathLight0" + str(light)][0] + + if newstate == 0: # true if that switch is now off + PtDebugPrint("kdshShadowPath.OnSDLNotify: Light", light," was on. Turning it off.") + code = "respSwitch0" + str(light) + ".run(self.key, state='off')" + #~ PtDebugPrint("off code = ", code) + exec(code) + + elif newstate == 1: # true if that switch is now on + PtDebugPrint("kdshShadowPath.OnSDLNotify: Light", light," was off. Turning it on.") + code = "respSwitch0" + str(light) + ".run(self.key, state='on')" + #~ PtDebugPrint("On code = ", code) + exec(code) + + else: + PtDebugPrint("Error. Not sure what the light thought it was.") + +''' + def BatonPassCheck(self,id,events,ageSDL): + global baton + PtDebugPrint("##") + + 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 + PtDebugPrint("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: + PtDebugPrint("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 + PtDebugPrint("Baton dropped. \n") + + + elif event[1] == 0: # Player exits a zone + PtDebugPrint("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. + PtDebugPrint("kdshShadowPath: Dropped the baton.") + baton = 0 + + + + if baton > 0: + PtDebugPrint("Baton value is now:", baton) +''' diff --git a/Scripts/Python/kdshTreeRings.py b/Scripts/Python/kdshTreeRings.py new file mode 100644 index 0000000000..4be93642e2 --- /dev/null +++ b/Scripts/Python/kdshTreeRings.py @@ -0,0 +1,401 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__kdshTreeRings v.", version,".1") + + def OnFirstUpdate(self): + PtLoadDialog("kdshScope0" + str(ScopeNumber.value), self.key, "Kadish") + #~ PtDebugPrint("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: + PtDebugPrint("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] + + PtDebugPrint("Current %s Ring settings:" % (ScopeNumber.value)) + PtDebugPrint("/tOuterRing: ", OuterRing) + PtDebugPrint("/tMiddleRing: ", MiddleRing) + PtDebugPrint("/tInnerRing: ", InnerRing) + + solo = not PtGetPlayerList() + + boolOperated = ageSDL["boolOperatedScope0" + str(ScopeNumber.value)][0] + if boolOperated: + if solo: + PtDebugPrint("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() + PtDebugPrint("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,) + PtDebugPrint("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() + #~ PtDebugPrint("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(): + PtDebugPrint("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() + + #~ PtDebugPrint("kdshTreeRings: GUI Notify id=%d, event=%d control=" % (id,event),control) + + #~ if event == kExitMode: + #~ self.IQuitTelescope() + + if event == kDialogLoaded: + return + PtDebugPrint("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)) + PtDebugPrint("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,) + PtDebugPrint("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)) + #~ PtDebugPrint("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/Scripts/Python/kdshTreeRingsSolution.py b/Scripts/Python/kdshTreeRingsSolution.py new file mode 100644 index 0000000000..769b78bc5b --- /dev/null +++ b/Scripts/Python/kdshTreeRingsSolution.py @@ -0,0 +1,397 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__kdshTreeRingsSolution v.", version,".2") + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + if ageSDL == None: + PtDebugPrint("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] + + PtDebugPrint("kdshTreeRingSolution: When I got here:") + #~ PtDebugPrint("\tOuterRing01=",OuterRing01) + #~ PtDebugPrint("\tMiddleRing01=",MiddleRing01) + #~ PtDebugPrint("\tInnerRing01=",InnerRing01) + #~ PtDebugPrint("\tOuterRing02=",OuterRing02) + #~ PtDebugPrint("\tMiddleRing02=",MiddleRing02) + #~ PtDebugPrint("\tInnerRing02=",InnerRing02) + #~ PtDebugPrint("\tOuterRing03=",OuterRing03) + #~ PtDebugPrint("\tMiddleRing03=",MiddleRing03) + #~ PtDebugPrint("\tInnerRing03=",InnerRing03) + + for i in ["Outer", "Middle", "Inner"]: + for j in ["1","2","3"]: + + ffcode1 = "InitState = "+i + "Ring0" +j + #~ PtDebugPrint("ffcode1 = ", ffcode1) + + exec(ffcode1) + #~ PtDebugPrint("InitState = ", InitState) + + ffcode2 = i + "Ring0" + j + "_0" + str(InitState) + ".animation.skipToEnd()" + #~ PtDebugPrint("ffcode2 = ", ffcode2) + + exec(ffcode2) + + #~ PtDebugPrint("Fastforwarding: Set = ",j," Ring = ",i," Position = ",InitState) + PtDebugPrint("\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] + #~ PtDebugPrint("VARname = ", VARname, "newbear = ", newbearing) + + code = VARname + "_0" + str(newbearing) + ".animation.play()" + #~ PtDebugPrint("code = ", code) + exec(code) # this runs the animation on the actual ring in the garden + + if "3" in VARname: + #~ PtDebugPrint("TRS: Nothing to ff. VARname = ", VARname) + pass + else: + GUIcode = "GUI" + string.join(string.split(VARname, "Ring"), "") + "_0" + str(newbearing) + ".animation.play()" + #~ PtDebugPrint("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] + + PtDebugPrint("Current Scope Positions [Outer, Middle, Inner]:") + PtDebugPrint("\tRing #1: [", OuterRing01 ,", ",MiddleRing01,", ",InnerRing01," ]") + PtDebugPrint("\tRing #2: [", OuterRing02 ,", ",MiddleRing02,", ",InnerRing02," ]") + PtDebugPrint("\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: + PtDebugPrint("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: + #~ PtDebugPrint("kdshTreeRingsSolution: Scope #2 occupied. Fast forwarding Scope 1 Rings in GUI") + ScopeNumber = 2 + elif id == actScope3.id: + #~ PtDebugPrint("kdshTreeRingsSolution: Scope #3 occupied. Fast forwarding Scope 2 Rings in GUI") + ScopeNumber = 3 + else: + PtDebugPrint("ERROR: Not sure who the notify came from.") + PtDebugPrint("id = ", id) + return + + ageSDL = PtGetAgeSDL() + if ageSDL == None: + PtDebugPrint("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] + + #~ PtDebugPrint("Outerbearing = ", Outerbearing) + #~ PtDebugPrint("Middlebearing = ", Middlebearing) + #~ PtDebugPrint("Innerbearing = ", Innerbearing) + + + GUIcode = "GUIOuter0" + str(ScopeNumber-1) + "_0" + str(Outerbearing) + ".animation.skipToEnd()" + #~ PtDebugPrint("FF Outer code = ", GUIcode) + exec(GUIcode) + + GUIcode = "GUIMiddle0" + str(ScopeNumber-1) + "_0" + str(Middlebearing) + ".animation.skipToEnd()" + #~ PtDebugPrint("FF Middle code = ", GUIcode) + exec(GUIcode) + + GUIcode = "GUIInner0" + str(ScopeNumber-1) + "_0" + str(Innerbearing) + ".animation.skipToEnd()" + #~ PtDebugPrint("FF Inner code = ", GUIcode) + exec(GUIcode) + + #~ GUIcode = "GUI" + string.join(string.split(VARname, "Ring"), "") + "_0" + str(newbearing) + ".animation.play()" + #~ PtDebugPrint("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: + PtDebugPrint("Patience, grasshopper.") + \ No newline at end of file diff --git a/Scripts/Python/kdshVault.py b/Scripts/Python/kdshVault.py new file mode 100644 index 0000000000..94208af498 --- /dev/null +++ b/Scripts/Python/kdshVault.py @@ -0,0 +1,404 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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 + PtDebugPrint("__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] + + PtDebugPrint("kdshVault: When I got here:") + PtDebugPrint("\t ButtonsPushed = ", ButtonsPushed) + + ButtonsPushed = str(ButtonsPushed) + + if len(ButtonsPushed) >= 6: + PtDebugPrint("All 6 buttons were already pushed. Resetting.") + respResetButtons.run(self.key) + ageSDL["ButtonsPushed"] = (0,) + + return + + if "1" in ButtonsPushed: + PtDebugPrint("fast forwarding button 1") + respButton1.run(self.key, fastforward=1) + actButton1.disable() + if "2" in ButtonsPushed: + PtDebugPrint("fast forwarding button 2") + respButton2.run(self.key, fastforward=1) + actButton2.disable() + if "3" in ButtonsPushed: + PtDebugPrint("fast forwarding button 3") + respButton3.run(self.key, fastforward=1) + actButton3.disable() + if "4" in ButtonsPushed: + PtDebugPrint("fast forwarding button 4") + respButton4.run(self.key, fastforward=1) + actButton4.disable() + if "5" in ButtonsPushed: + PtDebugPrint("fast forwarding button 5") + respButton5.run(self.key, fastforward=1) + actButton5.disable() + if "6" in ButtonsPushed: + PtDebugPrint("fast forwarding button 6") + respButton6.run(self.key, fastforward=1) + actButton6.disable() + if "0" in ButtonsPushed: + PtDebugPrint("No buttons have been pushed.") + #~ string.join(string.split(ButtonsPushed, "0"), "") + ageSDL["ButtonsPushed"] = (0,) + + + + def Load(self): + global VCPboolOperated + global ButtonsPushed + ageSDL = PtGetAgeSDL() + + solo = not PtGetPlayerList() + + VCPboolOperated = ageSDL["VCPboolOperated"][0] + if VCPboolOperated: + if solo: + PtDebugPrint("kdshVault.Load():\tVCPboolOperated=%d but no one else here...correcting" % VCPboolOperated) + VCPboolOperated = 0 + ageSDL["VCPboolOperated"] = (0,) + ageSDL["VCPOperatorID"] = (-1,) + Activate.enable() + else: + Activate.disable() + PtDebugPrint("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) + PtDebugPrint("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() + + #~ PtDebugPrint("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(): + PtDebugPrint("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 + #~ PtDebugPrint("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: + PtDebugPrint("Button has no effect. The Vault Door is already moving.") + return + + PtDebugPrint("\tkdshVault.OnNotify: Button #%d pushed" % (id)) + + + #append the pushed button to the list of those already clicked + ButtonsPushed = ageSDL["ButtonsPushed"][0] + ButtonsPushed = str(ButtonsPushed) + PtDebugPrint("kdshVault.OnNotify: Before, ButtonsPushed was ", ButtonsPushed) + + + ButtonsPushed = string.atoi(ButtonsPushed + (str(id))) + PtDebugPrint("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: + #~ PtDebugPrint("kdshVault.OnNotify: Reset Button clicked.") + LocalAvatar = PtFindAvatar(events) + respResetBtn.run(self.key,events=events) + + elif id == respResetBtn.id and OnlyOneOwner.sceneobject.isLocallyOwned(): + if VaultDoorMoving: + PtDebugPrint("Button has no effect. The Vault Door is already moving.") + return + + PtDebugPrint("kdshVault.OnNotify: Reset Button Pushed. Toggling Vault Door state.") + + vaultclosed = ageSDL["VaultClosed"][0] + if vaultclosed == 1: + #Open the door + PtDebugPrint("\t trying to open the Vault.") + + ageSDL.setTagString("VaultClosed","fromOutside") + ageSDL["VaultClosed"] = (0,) + + elif vaultclosed == 0: + #Close the door + PtDebugPrint("\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() + + PtDebugPrint("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:] + PtDebugPrint("kdshVault.OnSDLNotify: new ButtonsPushed = ", ButtonsPushed) + #~ PtDebugPrint("kdshVault.OnSDLNotify: lastbuttonpushed = ", lastbuttonpushed) + + #run the animation on the button itself + code = "respButton" + str(lastbuttonpushed) + ".run(self.key)" + #~ PtDebugPrint("code = ", code) + exec(code) + + #disable the clickable for that button + code = "actButton" + str(lastbuttonpushed) + ".disable()" + #~ PtDebugPrint("code = ", code) + exec(code) + + def OnTimer(self,id): + global VaultDoorMoving + + ageSDL = PtGetAgeSDL() + if id==1: + ButtonsPushed = ageSDL["ButtonsPushed"][0] + PtDebugPrint("kdshVault: Check solution. ButtonsPushed = ", ButtonsPushed) + if ButtonsPushed == 152346: + PtDebugPrint("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: + PtDebugPrint("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/Scripts/Python/kemoEmgrPhase0.py b/Scripts/Python/kemoEmgrPhase0.py new file mode 100644 index 0000000000..2aa4d298c9 --- /dev/null +++ b/Scripts/Python/kemoEmgrPhase0.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__kemoEmgrPhase0 v.", version) + + def OnFirstUpdate(self): + global AgeStartedIn + AgeStartedIn = PtGetAgeName() + + def OnServerInitComplete(self): + if AgeStartedIn == PtGetAgeName(): + ageSDL = PtGetAgeSDL() + for variable in BooleanVARs: + PtDebugPrint("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: + PtDebugPrint("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? + PtDebugPrint("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/Scripts/Python/kemoJourneyClothGate.py b/Scripts/Python/kemoJourneyClothGate.py new file mode 100644 index 0000000000..130f545414 --- /dev/null +++ b/Scripts/Python/kemoJourneyClothGate.py @@ -0,0 +1,270 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 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 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 + + PtDebugPrint("##") + + 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 + + PtDebugPrint("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 entry is not 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" + PtDebugPrint("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): + PtDebugPrint("Somebody touched the Journey Cloth Gate") + return + + PtDebugPrint("You clicked on the Gate") + vault = ptVault() + + entry = vault.findChronicleEntry("JourneyClothProgress") + if entry is None: # is this the player's first Journey Cloth? + PtDebugPrint("No cloths have been found. Get to work!") + else: + FoundJCs = entry.chronicleGetValue() + length = len(FoundJCs) + all = len(AllCloths) + + PtDebugPrint("You've found the following %d Journey Cloths: %s" % (length, FoundJCs)) + + if length < 0 or length > 11: + PtDebugPrint("xJourneyClothGate: ERROR: Unexpected length value received.") + return + + if "Z" in FoundJCs: + PtDebugPrint("You've been here before, traveller.") + PalmGlowStrong.run(self.key) + self.ToggleSDL("fromOutside") + return + + for each in FoundJCs: + if each not in AllCloths: + PtDebugPrint("Unexpected value among the 10 letters in the Chronicle:", each) + return + + if length < all: + PtDebugPrint("There are more Cloths out there. Get to work.") + PalmGlowWeak.run(self.key) + + elif length == all: + PtDebugPrint("All expected Cloths were found. Opening Door.") + PalmGlowStrong.run(self.key) + self.ToggleSDL("fromOutside") + + + 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 + + PtDebugPrint("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 + PtDebugPrint("Gate reactivated.") + if id==1: + GateInUse = 0 + + diff --git a/Scripts/Python/kemoStormWaterModifier.py b/Scripts/Python/kemoStormWaterModifier.py new file mode 100644 index 0000000000..593fc6c87b --- /dev/null +++ b/Scripts/Python/kemoStormWaterModifier.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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: + PtDebugPrint("starting rain drops on water") + rainlevel = 3.0 + texamp = 0.2 + #PtDebugPrint("changing specular noise from %f to %f" % (theWater.waveset.getSpecularNoise(), rainlevel)) + #PtDebugPrint("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: + PtDebugPrint("stoping raindrops on water") + rainlevel = NoiseStartValue + texamp = TexAmpStartValue + #PtDebugPrint("changing specular noise from %f to %f" % (theWater.waveset.getSpecularNoise(), rainlevel)) + #PtDebugPrint("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 + + PtDebugPrint("Using: get/set" + x[3:]) + + startval = getattr(theWater.waveset, "get" + x[3:])() + + if ifisinstance(p, ptColor): + PtDebugPrint("\tstartval = " + str( (startval.getRed(), startval.getGreen(), startval.getBlue()) )) + PtDebugPrint("\tsetting to " + str( (p.getRed(), p.getGreen(), p.getBlue()) )) + elif isinstance(p, (ptPoint3, ptVector3)): + PtDebugPrint("\tstartval = " + str( (startval.getX(), startval.getY(), startval.getZ()) )) + PtDebugPrint("\tsetting to " + str( (p.getX(), p.getY(), p.getZ()) )) + else: + PtDebugPrint("\tstartval = " + str(startval)) + PtDebugPrint("\tsetting to " + str(p)) + + getattr(theWater.waveset, x)(p) + + endval = getattr(theWater.waveset, "get" + x[3:])() + + if ifisinstance(p, ptColor): + PtDebugPrint("\tendval = " + str( (endval.getRed(), endval.getGreen(), endval.getBlue()) )) + elif isinstance(p, (ptPoint3, ptVector3)): + PtDebugPrint("\tendval = " + str( (endval.getX(), endval.getY(), endval.getZ()) )) + else: + PtDebugPrint("\tendval = " + str(endval)) + + val += 1 diff --git a/Scripts/Python/ki/__init__.py b/Scripts/Python/ki/__init__.py new file mode 100644 index 0000000000..61f416bcb9 --- /dev/null +++ b/Scripts/Python/ki/__init__.py @@ -0,0 +1,6680 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +MaxVersionNumber = 58 +MinorVersionNumber = 52 + +# Plasma engine. +from Plasma import * +from PlasmaTypes import * +from PlasmaKITypes import * +from PlasmaConstants import * +from PlasmaVaultConstants import * +from PlasmaNetConstants import * + +import time +import string +import xCensor +import xLinkingBookDefs +import xBookGUIs +import re # Used for CoD Fix. +import os # Used for saving pictures locally. +import glob # Used for saving pictures locally. +import math + +import xLocTools +import xEnum + +# Personal age SDL helper. +from xPsnlVaultSDL import * + +# Jalak constants. +from jlakConstants import * + +# xKI sub-modules. +from . import xKIExtChatCommands +from . import xKIChat +from .xKIConstants import * +from .xKIHelpers import * + +# Marker Game thingies +from . import xMarkerMgr + +# Define the attributes that will be entered in Max. +KIBlackbar = ptAttribGUIDialog(1, "The Blackbar dialog") +xKIChat.KIBlackbar = KIBlackbar +KIMini = ptAttribGUIDialog(2, "The KIMini dialog") +xKIChat.KIMini = KIMini +KIYesNo = ptAttribGUIDialog(3, "The KIYesNo dialog") +BigKI = ptAttribGUIDialog(5, "The BigKI (Mr. BigStuff)") +xKIChat.BigKI = BigKI +NewItemAlert = ptAttribGUIDialog(7, "The new item alert dialog") +KIListModeDialog = ptAttribGUIDialog(9, "The list mode dialog") +KIPictureExpanded = ptAttribGUIDialog(10, "The Picture expanded dialog") +KIJournalExpanded = ptAttribGUIDialog(11, "The journal entry expanded dialog") +KIOnAnim = ptAttribAnimation(12, "Turn on/off the KI on animation") +KIOnResp = ptAttribResponder(13, "Turn On responder") +KIOffResp = ptAttribResponder(14, "Turn Off responder") +KIPlayerExpanded = ptAttribGUIDialog(17, "The player expanded dialog") +KIMicroBlackbar = ptAttribGUIDialog(18, "The micro Blackbar dialog") +KIMicro = ptAttribGUIDialog(19, "The micro KI dialog") +xKIChat.KIMicro = KIMicro +KIVolumeExpanded = ptAttribGUIDialog(21, "The volume control dialog") +KIAgeOwnerExpanded = ptAttribGUIDialog(22, "The Age Owner settings dialog") +# Disabled: KIRateIt = ptAttribGUIDialog(23, "The Rate It dialog") +KISettings = ptAttribGUIDialog(24, "The KI settings dialog") +KIMarkerFolderExpanded = ptAttribGUIDialog(27, "The Marker Folder dialog") +KIMarkerFolderPopupMenu = ptAttribGUIPopUpMenu(28, "The MarkerFolder Time Popup Menu") +# Disabled: KIQuestionNote = ptAttribGUIDialog(29, "The Question Note dialog") +# Disabled: KIMarkerTypePopupMenu = ptAttribGUIPopUpMenu(30, "The MarkerFolder Type Popup Menu") +KICreateMarkerGameGUI = ptAttribGUIDialog(31, "The Marker Game Creation GUI") +KIMarkerGameGUIOpen = ptAttribResponder(32, "Marker Game GUI Open Responder") +KIMarkerGameGUIClose = ptAttribResponder(33, "Marker Game GUI Close Responder") +KIJalakMiniIconOn = ptAttribResponder(34, "Jalak KIMini icon 'on/off' resp", ["on", "off"]) +KIJalakGUIDialog = ptAttribGUIDialog(35, "The Jalak GUI dialog") +KIJalakGUIOpen = ptAttribResponder(36, "Jalak GUI 'open' resp") +KIJalakGUIClose = ptAttribResponder(37, "Jalak GUI 'close' resp") +KIJalakBtnLights = ptAttribResponder(38, "Jalak GUI btn lights resp", statelist=JalakBtnStates, netForce=0) + + +## The master class handling all of Uru's GUI. +# This includes the KI itself, the blackbar, the Jalak GUI... +class xKI(ptModifier): + + ## Initialize the KI. + # Called only once during Uru execution when the game is started. At this + # stage, Plasma is not yet initialized. + def __init__(self): + + # Set up the KI. + ptModifier.__init__(self) + self.id = 199 + self.version = MaxVersionNumber + self.folderOfDevices = DeviceFolder(PtGetLocalizedString("KI.Folders.Devices")) + PtDebugPrint(u"xKI: Max version {} - minor version {}.".format(MaxVersionNumber, MinorVersionNumber)) + + # Prepare the GUI's default state. + self.KIGUIInitialized = False + self.KIDisabled = False + self.KIHardDisabled = False + self.isPlayingLookingAtKIMode = False + self.miniKIWasUp = False + self.sawTheKIAtLeastOnce = False + self.miniKIFirstTimeShow = True + + # Set the default KI levels. + self.censorLevel = 0 + self.gKIMarkerLevel = 0 + self.KILevel = kMicroKI # Assume the KI is at the lowest level. + self.MGKILevel = 0 + + # Player state. + self.onlyGetPMsFromBuddies = False + self.onlyAllowBuddiesOnRequest = False + self.takingAPicture = False + self.waitingForAnimation = False + + # Transparency settings. + self.originalForeAlpha = 1.0 + self.originalSelectAlpha = 1.0 + self.originalminiKICenter = None + self.lastminiKICenter = None + + #~~~~~~~# + # BigKI # + #~~~~~~~# + self.previousTime = "20:20" + self.timeBlinker = True + + self.BKPlayerList = [] + self.BKPlayerSelected = None + self.previouslySelectedPlayer = None + + self.BKJournalFolderDict = {} + self.BKJournalListOrder = [] + self.BKJournalFolderSelected = 0 + self.BKJournalFolderTopLine = 0 + self.BKPlayerFolderDict = {} + self.BKPlayerListOrder = [] + self.BKPlayerFolderSelected = 0 + self.BKPlayerFolderTopLine = 0 + self.BKConfigFolderDict = {} + self.BKConfigListOrder = [PtGetLocalizedString("KI.Config.Settings")] + self.BKConfigDefaultListOrder = [PtGetLocalizedString("KI.Config.Settings")] + self.BKConfigFolderSelected = 0 + self.BKConfigFolderTopLine = 0 + self.BKFolderLineDict = self.BKJournalFolderDict + self.BKFolderListOrder = self.BKJournalListOrder + self.BKFolderSelected = self.BKJournalFolderSelected + self.BKFolderTopLine = self.BKJournalFolderTopLine + self.BKFolderSelectChanged = False + self.BKIncomingFolder = None + self.BKNewItemsInInbox = 0 + + self.BKCurrentContent = None + self.BKContentList = [] + self.BKContentListTopLine = 0 + + self.BKInEditMode = False + self.BKEditContent = None + self.BKEditField = -1 + self.BKGettingPlayerID = False + + self.BKRightSideMode = kGUI.BKListMode + + self.BKAgeOwnerEditDescription = False + + # New item alert. + self.alertTimerActive = False + self.alertTimeToUse = kAlertTimeDefault + + # Yes/No dialog globals. + self.YNWhatReason = kGUI.YNQuit + self.YNOutsideSender = None + + # Player book globals. + self.bookOfferer = None + self.offerLinkFromWho = None + self.offeredBookMode = 0 + self.psnlOfferedAgeInfo = None + + # The ptBook Yeesha book object. + self.isEntireYeeshaBookEnabled = True + self.isYeeshaBookEnabled = True + self.yeeshaBook = None + + # KI light state. + self.lightOn = False + self.lightStop = 0 + + # Pellet score operations. + self.scoreOpCur = kPellets.ScoreNoOp + self.scoreOps = [] + + # KI usage values. + self.numberOfPictures = 0 + self.numberOfNotes = 0 + self.numberOfMarkerFolders = 0 + self.numberOfMarkers = 0 + + # Marker Games state. + self.currentPlayingMarkerGame = None + self.markerGameState = kGames.MGNotActive + self.markerGameTimeID = 0 + self.markerJoinRequests = [] + self.MFdialogMode = kGames.MFOverview + self.MFScrollPos = 0 + + # New Marker Game dialog globals. + self.markerGameDefaultColor = "" + self.markerGameSelectedColor = "" + self.selectedMGType = 0 + + # GZ missions state. + self.gGZPlaying = 0 + self.gGZMarkerInRange = 0 + self.gGZMarkerInRangeRepy = None + self.gMarkerToGetColor = "off" + self.gMarkerGottenColor = "off" + self.gMarkerToGetNumber = 0 + self.gMarkerGottenNumber = 0 + + # Jalak GUI globals. + self.jalakGUIButtons = [] + self.jalakGUIState = False + self.jalakScript = None + + # Miscellaneous. + self.imagerMap = {} + self.pelletImager = "" + + ## Auto-completion manager. + self.autocompleteState = AutocompleteState() + + ## The chatting manager. + self.chatMgr = xKIChat.xKIChat(self.StartFadeTimer, self.ResetFadeState, self.FadeCompletely, self.GetCensorLevel) + + ## Unloads any loaded dialogs upon exit. + def __del__(self): + + PtUnloadDialog("KIMicroBlackBar") + PtUnloadDialog("KIMicro") + PtUnloadDialog("KIMini") + PtUnloadDialog("KIMain") + PtUnloadDialog("KIListMode") + PtUnloadDialog("KIJournalExpanded") + PtUnloadDialog("KIPictureExpanded") + PtUnloadDialog("KIPlayerExpanded") + PtUnloadDialog("KIAgeOwnerSettings") + PtUnloadDialog("KISettings") + PtUnloadDialog("KIMarkerFolder") + PtUnloadDialog("KIMarkerTimeMenu") + PtUnloadDialog("KIMarkerTypeMenu") + PtUnloadDialog("KIYesNo") + PtUnloadDialog("KINewItemAlert") + PtUnloadDialog("OptionsMenuGUI") + PtUnloadDialog("IntroBahroBgGUI") + PtUnloadDialog("KIHelp") + PtUnloadDialog("KIHelpMenu") + PtUnloadDialog("KeyMapDialog") + PtUnloadDialog("GameSettingsDialog") + PtUnloadDialog("CalibrationGUI") + PtUnloadDialog("TrailerPreviewGUI") + PtUnloadDialog("KeyMap2Dialog") + PtUnloadDialog("AdvancedGameSettingsDialog") + PtUnloadDialog("OptionsHelpGUI") + PtUnloadDialog("bkNotebook") + PtUnloadDialog("bkBahroRockBook") + PtUnloadDialog("YeeshaPageGUI") + PtUnloadDialog("KIMiniMarkers") + + if PtGetAgeName() == "Jalak": + PtDebugPrint(u"xKI: Unloading Jalak GUI dialog.", level=kWarningLevel) + KIJalakMiniIconOn.run(self.key, state="off", netPropagate=0, fastforward=1) + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).disable() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).hide() + PtUnloadDialog("jalakControlPanel") + + #~~~~~~~~~~~~~~~~~~# + # Plasma Functions # + #~~~~~~~~~~~~~~~~~~# + + ## Called by Plasma on receipt of the first PythonFileMod message. + # Preloads all the GUI dialogs. + def OnInit(self): + + # Preload all the dialogs. + PtLoadDialog("KIBlackBar", self.key) + PtLoadDialog("KIMicroBlackBar", self.key) + PtLoadDialog("KIMicro", self.key) + PtLoadDialog("KIMini", self.key) + PtLoadDialog("KIMain", self.key) + PtLoadDialog("KIListMode", self.key) + PtLoadDialog("KIJournalExpanded", self.key) + PtLoadDialog("KIPictureExpanded", self.key) + PtLoadDialog("KIPlayerExpanded", self.key) + PtLoadDialog("KIAgeOwnerSettings", self.key) + PtLoadDialog("KISettings", self.key) + PtLoadDialog("KIMarkerFolder", self.key) + PtLoadDialog("KIMarkerTimeMenu", self.key) + PtLoadDialog("KIMarkerTypeMenu", self.key) + PtLoadDialog("KIYesNo", self.key) + PtLoadDialog("KINewItemAlert", self.key) + PtLoadDialog("OptionsMenuGUI") + PtLoadDialog("IntroBahroBgGUI") + PtLoadDialog("KIHelp") + PtLoadDialog("KIHelpMenu") + PtLoadDialog("KeyMapDialog") + PtLoadDialog("GameSettingsDialog") + PtLoadDialog("CalibrationGUI") + PtLoadDialog("TrailerPreviewGUI") + PtLoadDialog("KeyMap2Dialog") + PtLoadDialog("AdvancedGameSettingsDialog") + PtLoadDialog("OptionsHelpGUI") + PtLoadDialog("bkNotebook") + PtLoadDialog("bkBahroRockBook") + PtLoadDialog("YeeshaPageGUI") + PtLoadDialog("KIMiniMarkers", self.key) + + self.markerGameManager = xMarkerMgr.MarkerGameManager() + self.chatMgr.markerGameManager = self.markerGameManager + + # Pass the newly-initialized key to the modules. + self.chatMgr.key = self.key + + ## Called by Plasma on receipt of the first plEvalMsg. + # Loads all the dialogs for the first update. + def OnFirstUpdate(self): + + # Create the dnicoordinate keeper. + self.dniCoords = ptDniCoordinates() + + # To start with, use randized numbers instead of the real thing. + self.chatMgr.logFile = ptStatusLog() + + xBookGUIs.LoadAllBookGUIs() + + logoutText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutTextID)) + logoutText.hide() + logoutButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutButtonID)) + logoutButton.hide() + + ## Called by Plasma when the player updates his account. + # This includes switching avatars and changing passwords. Because the KI + # gets started at initial load time, the KI needs to be re-initialized once + # the playerID has been updated, triggering this function. + def OnAccountUpdate(self, updateType, result, playerID): + + if updateType == PtAccountUpdateType.kActivePlayer and result == 0 and playerID != 0: + PtDebugPrint(u"xKI.OnAccountUpdate(): Active player set. Clear to re-init KI GUI.", level=kDebugDumpLevel) + self.KIGUIInitialized = False + elif updateType == PtAccountUpdateType.kChangePassword: + if result == 0: + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Messages.PasswordChangeSuccess")) + else: + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Messages.PasswordChangeFailure")) + + ## Called by Plasma when the Age state has been fully received. + # This function re-initializes Marker Games, puts away the KI and performs + # various other preparations. + def OnServerInitComplete(self): + # Force any open KIs to close. + self.ToggleMiniKI() + + self.CheckKILight() + + ageName = PtGetAgeName() + PtDebugPrint(u"xKI.OnServerInitComplete(): Age = ", ageName, level=kDebugDumpLevel) + + if ageName.lower() != "startup": + self.markerGameManager.OnServerInitComplete() + + # Set up Jalak GUI. + if ageName == "Jalak": + PtDebugPrint(u"xKI.OnServerInitComplete(): Loading Jalak GUI dialog.", level=kWarningLevel) + PtLoadDialog("jalakControlPanel", self.key) + KIJalakMiniIconOn.run(self.key, state="on", netPropagate=0) + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).show() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).enable() + self.AlertKIStart() + else: + KIJalakMiniIconOn.run(self.key, state="off", netPropagate=0, fastforward=1) + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).disable() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).hide() + + ## Called by Plasma when the avatar is linked out of an Age. + # Depending on the Age the avatar was linking out, the Jalak GUI will be + # disabled and the KI light turned off. + def BeginAgeUnLoad(self, avObj): + + ageName = PtGetAgeName() + if ageName == "Descent": + return + elif ageName == "Jalak": + if self.jalakGUIState: + self.JalakGUIToggle(1) + + if not self.lightOn: + return + + local = 0 + try: + local = PtGetLocalAvatar() + except: + PtDebugPrint(u"xKI.BeginAgeUnLoad(): Failed to get local avatar.") + return + if local == avObj: + PtDebugPrint(u"xKI.BeginAgeUnLoad(): Avatar page out.", level=kDebugDumpLevel) + curTime = PtGetDniTime() + timeRemaining = (self.lightStop - curTime) + if timeRemaining > 0: + self.DoKILight(0, 1, timeRemaining) + LocalAvatar = PtGetLocalAvatar() + avatarKey = LocalAvatar.getKey() + PtSetLightAnimStart(avatarKey, kKILightObjectName, False) + + ## Get any leftover, unwanted keystrokes. + def OnDefaultKeyCaught(self, ch, isDown, isRepeat, isShift, isCtrl, keycode): + + if ord(ch) != 0: + if not ord(ch) in kDefaultKeyIgnoreList: + if isDown and not isCtrl and not isRepeat: + if not self.KIDisabled and not PtIsEnterChatModeKeyBound(): + self.chatMgr.ToggleChatMode(1, firstChar=ch) + + ## Called by Plasma on receipt of a plNotifyMsg. + # This big function deals with the various responses sent upon a triggered + # event, such as a book being offered. + def OnNotify(self, state, ID, events): + + PtDebugPrint(u"xKI.OnNotify(): Notify state = {}, ID = {}.".format(state, ID), level=kDebugDumpLevel) + # Is it a notification from the scene input interface or PlayerBook? + for event in events: + if event[0] == kOfferLinkingBook: + if self.KILevel == kMicroKI: + plybkCB = ptGUIControlCheckBox(KIMicroBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + else: + plybkCB = ptGUIControlCheckBox(KIBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + # Make sure we get the events back if someone else used the PlayerBook. + if event[2] == -999: + # If waiting for offeree to accept. + if self.offeredBookMode == kGUI.Offeree: + # Then take the offered PlayerBook. + self.yeeshaBook.hide() + PtToggleAvatarClickability(True) + plybkCB.setChecked(0) + # Else, they were too late. + self.offeredBookMode = kGUI.NotOffering + self.bookOfferer = None + PtDebugPrint(u"xKI.OnNotify(): Offerer is rescinding the book offer.", level=kDebugDumpLevel) + PtToggleAvatarClickability(True) + return + # The book is being offered by someone else. + elif event[2] == 999: + self.bookOfferer = event[1] + avID = PtGetClientIDFromAvatarKey(self.bookOfferer.getKey()) + if ptVault().getIgnoreListFolder().playerlistHasPlayer(avID): + self.offeredBookMode = kGUI.NotOffering + PtNotifyOffererLinkRejected(avID) + self.bookOfferer = None + PtToggleAvatarClickability(True) + return + else: + self.offeredBookMode = kGUI.Offeree + PtDebugPrint(u"xKI.OnNotify(): Offered book by ", self.bookOfferer.getName(), level=kDebugDumpLevel) + self.ShowYeeshaBook() + PtToggleAvatarClickability(False) + return + + # Is it from the YeeshaBook? + elif event[0] == PtEventType.kBook: + if self.KILevel == kMicroKI: + plybkCB = ptGUIControlCheckBox(KIMicroBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + else: + plybkCB = ptGUIControlCheckBox(KIBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + if event[1] == PtBookEventTypes.kNotifyImageLink: + if event[2] == xLinkingBookDefs.kYeeshaBookShareID: + if self.isYeeshaBookEnabled: + # Rescind any previous offers. + PtClearOfferBookMode() + if self.offeredBookMode == kGUI.NotOffering: + # Take the PlayerBook. + self.yeeshaBook.hide() + PtToggleAvatarClickability(True) + plybkCB.setChecked(0) + # Prepare to choose who to offer the link to. + PtSetOfferBookMode(self.key, "Personal", "Relto") + elif event[2] == xLinkingBookDefs.kYeeshaBookLinkID: + if self.isYeeshaBookEnabled: + self.yeeshaBook.hide() + plybkCB.setChecked(0) + if self.offeredBookMode == kGUI.Offeree: + self.offeredBookMode = kGUI.NotOffering + avID = PtGetClientIDFromAvatarKey(self.bookOfferer.getKey()) + PtNotifyOffererLinkAccepted(avID) + PtNotifyOffererLinkCompleted(avID) + self.bookOfferer = None + else: + # Is the player on a ladder or something? + curBrainMode = PtGetLocalAvatar().avatar.getCurrentMode() + if self.isEntireYeeshaBookEnabled and (curBrainMode == PtBrainModes.kNonGeneric or curBrainMode == PtBrainModes.kAFK or curBrainMode == PtBrainModes.kSit): + linkmgr = ptNetLinkingMgr() + linkmgr.linkToMyPersonalAgeWithYeeshaBook() + PtToggleAvatarClickability(True) + elif event[2] >= xLinkingBookDefs.kYeeshaPageStartID: + whatpage = event[2] - xLinkingBookDefs.kYeeshaPageStartID + sdlvar = xLinkingBookDefs.xYeeshaPages[whatpage][0] + self.ToggleYeeshaPageSDL(sdlvar, 1) + elif event[1] == PtBookEventTypes.kNotifyShow: + pass + elif event[1] == PtBookEventTypes.kNotifyHide: + PtToggleAvatarClickability(True) + plybkCB.setChecked(0) + if self.offeredBookMode == kGUI.Offeree: + self.offeredBookMode = kGUI.NotOffering + avID = PtGetClientIDFromAvatarKey(self.bookOfferer.getKey()) + PtNotifyOffererLinkRejected(avID) + self.bookOfferer = None + elif event[1] == PtBookEventTypes.kNotifyNextPage: + pass + elif event[1] == PtBookEventTypes.kNotifyPreviousPage: + pass + elif event[1] == PtBookEventTypes.kNotifyCheckUnchecked: + if event[2] >= xLinkingBookDefs.kYeeshaPageStartID: + whatpage = event[2] - xLinkingBookDefs.kYeeshaPageStartID + sdlvar = xLinkingBookDefs.xYeeshaPages[whatpage][0] + self.ToggleYeeshaPageSDL(sdlvar, 0) + return + if state: + # Is it one of the responders that are displaying the BigKI? + if ID == KIOnResp.id: + self.ShowBigKIMode() + self.waitingForAnimation = False + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + toggleCB.enable() + elif ID == KIOffResp.id: + BigKI.dialog.hide() + self.waitingForAnimation = False + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + toggleCB.enable() + if ID == KIMarkerGameGUIClose.id: + PtHideDialog("KIMiniMarkers") + if ID == KIJalakGUIClose.id: + PtHideDialog("jalakControlPanel") + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).enable() + elif ID == KIJalakGUIOpen.id: + KIJalakGUIDialog.dialog.enable() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).enable() + elif ID == KIJalakBtnLights.id: + btnID = int(KIJalakBtnLights.getState()) + SendNote(self.key, self.jalakScript, "{}".format(btnID)) + PtAtTimeCallback(self.key, kJalakBtnDelaySeconds, kTimers.JalakBtnDelay) + + ## Called by Plasma when a page has been loaded. + # This is used to delay the display of objects until something is paged in. + def OnPageLoad(self, what, room): + + if not self.KIGUIInitialized: + self.KIGUIInitialized = True + self.SetupKI() + + # When we unload the page, then the device we have must be gone. + if what == kUnloaded: + self.folderOfDevices.removeAll() + # Remove any selected player. + if self.KILevel == kNormalKI: + self.BKPlayerSelected = None + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + sendToField.setString(" ") + if self.gGZMarkerInRange: + self.gGZMarkerInRange = 0 + self.gGZMarkerInRangeRepy = None + self.RefreshMiniKIMarkerDisplay() + NewItemAlert.dialog.hide() + kialert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertKIAlert)) + kialert.hide() + if self.pelletImager != "": + self.pelletImager = "" + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.PelletScoreButton)).hide() + + ## Called by Plasma when a GUI event occurs. + # Delegates the appropriate response to the correct handler. + def OnGUINotify(self, ID, control, event): + + PtDebugPrint(u"xKI.OnGUINotify(): ID = {}, event = {}, control = {}.".format(ID, event, control), level=kDebugDumpLevel) + if ID == KIBlackbar.id: + self.ProcessNotifyBlackbar(control, event) + elif ID == KIMicroBlackbar.id: + self.ProcessNotifyMicroBlackbar(control, event) + elif ID == KIMicro.id: + self.ProcessNotifyMicro(control, event) + elif ID == KIMini.id: + self.ProcessNotifyMini(control, event) + elif ID == BigKI.id: + self.ProcessNotifyBigKI(control, event) + elif ID == KIListModeDialog.id: + self.ProcessNotifyListMode(control, event) + elif ID == KIPictureExpanded.id: + self.ProcessNotifyPictureExpanded(control, event) + elif ID == KIJournalExpanded.id: + self.ProcessNotifyJournalExpanded(control, event) + elif ID == KIPlayerExpanded.id: + self.ProcessNotifyPlayerExpanded(control, event) + elif ID == KISettings.id: + self.ProcessNotifySettingsExpanded(control, event) + elif ID == KIVolumeExpanded.id: + self.ProcessNotifyVolumeExpanded(control, event) + elif ID == KIAgeOwnerExpanded.id: + self.ProcessNotifyAgeOwnerExpanded(control, event) + elif ID == KIYesNo.id: + self.ProcessNotifyYesNo(control, event) + elif ID == NewItemAlert.id: + self.ProcessNotifyNewItemAlert(control, event) + elif ID == KICreateMarkerGameGUI.id: + self.ProcessNotifyCreateMarkerGameGUI(control, event) + elif ID == KIMarkerFolderExpanded.id: + self.ProcessNotifyMarkerFolderExpanded(control, event) + elif ID == KIMarkerFolderPopupMenu.id: + self.ProcessNotifyMarkerFolderPopupMenu(control, event) + elif ID == KIJalakGUIDialog.id: + self.ProcessNotifyJalakGUI(control, event) + + ## Called by Plasma on receipt of a KI message. + # These are messages which instruct xKI to perform a certain command like + # enabling or disabling the KI, showing a Yes/No dialog, etc.. These + # messages can also be sent from the Python to Plasma and back. + def OnKIMsg(self, command, value): + + PtDebugPrint(u"xKI.OnKIMsg(): command = {} value = {}.".format(command, value), level=kDebugDumpLevel) + if self.markerGameManager.OnKIMsg(command, value): + return + + if command == kEnterChatMode and not self.KIDisabled: + self.chatMgr.ToggleChatMode(1) + elif command == kSetChatFadeDelay: + self.chatMgr.ticksOnFull = value + elif command == kSetTextChatAdminMode: + self.chatMgr.isAdmin = value + elif command == kDisableKIandBB: + self.KIDisabled = True + self.chatMgr.KIDisabled = True + self.KIHardDisabled = True + if self.KILevel == kMicroKI: + KIMicroBlackbar.dialog.hide() + if KIMicro.dialog.isEnabled(): + self.miniKIWasUp = True + KIMicro.dialog.hide() + else: + self.miniKIWasUp = False + else: + KIBlackbar.dialog.hide() + if KIMini.dialog.isEnabled(): + self.miniKIWasUp = True + KIMini.dialog.hide() + else: + self.miniKIWasUp = False + if not self.waitingForAnimation: + # Hide all dialogs on the right side of the BigKI and hide it. + KIListModeDialog.dialog.hide() + KIPictureExpanded.dialog.hide() + KIJournalExpanded.dialog.hide() + KIPlayerExpanded.dialog.hide() + BigKI.dialog.hide() + KIOnAnim.animation.skipToTime(1.5) + # If an outsider has a Yes/No up, tell them No. + if self.YNWhatReason == kGUI.YNOutside: + if self.YNOutsideSender is not None: + note = ptNotify(self.key) + note.clearReceivers() + note.addReceiver(self.YNOutsideSender) + note.netPropagate(0) + note.netForce(0) + note.setActivate(0) + note.addVarNumber("YesNo", 0) + note.send() + self.YNOutsideSender = None + # Hide the Yeesha Book. + if self.yeeshaBook: + self.yeeshaBook.hide() + PtToggleAvatarClickability(True) + plybkCB = ptGUIControlCheckBox(KIBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + plybkCB.setChecked(0) + self.YNWhatReason = kGUI.YNQuit + KIYesNo.dialog.hide() + elif command == kEnableKIandBB: + self.KIDisabled = False + self.chatMgr.KIDisabled = False + self.KIHardDisabled = False + if self.KILevel == kMicroKI: + KIMicroBlackbar.dialog.show() + if self.miniKIWasUp: + KIMicro.dialog.show() + else: + KIBlackbar.dialog.show() + if self.miniKIWasUp: + self.chatMgr.ClearBBMini(0) + KIMini.dialog.show() + elif command == kTempDisableKIandBB: + self.KIDisabled = True + self.chatMgr.KIDisabled = True + if self.KILevel == kMicroKI: + KIMicroBlackbar.dialog.hide() + else: + KIBlackbar.dialog.hide() + if self.yeeshaBook: + self.yeeshaBook.hide() + PtToggleAvatarClickability(True) + plybkCB = ptGUIControlCheckBox(KIBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + plybkCB.setChecked(0) + elif command == kTempEnableKIandBB and not self.KIHardDisabled: + self.KIDisabled = False + self.chatMgr.KIDisabled = False + if self.KILevel == kMicroKI: + KIMicroBlackbar.dialog.showNoReset() + else: + KIBlackbar.dialog.showNoReset() + elif command == kYesNoDialog: + self.YNWhatReason = kGUI.YNOutside + self.YNOutsideSender = value[1] + yesText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + yesText.setStringW(value[0]) + self.LocalizeDialog(1) + KIYesNo.dialog.show() + elif command == kAddPlayerDevice: + if "

" in value: + self.pelletImager = value.rstrip("

") + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.PelletScoreButton)).show() + PtDebugPrint(u"Pellet Imager:", self.pelletImager, level=kDebugDumpLevel) + return + try: + self.folderOfDevices.index(Device(value)) + except ValueError: + self.folderOfDevices.append(Device(value)) + self.RefreshPlayerList() + elif command == kRemovePlayerDevice: + if "

" in value: + self.pelletImager = "" + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.PelletScoreButton)).hide() + return + try: + self.folderOfDevices.remove(Device(value)) + except ValueError: + pass + self.RefreshPlayerList() + elif command == kUpgradeKILevel: + if value >= kLowestKILevel and value <= kHighestKILevel: + if value > self.KILevel: + PtDebugPrint(u"xKI.OnKIMsg(): Upgrading from KI level {} to new KI level of {}.".format(self.KILevel, value), level=kWarningLevel) + self.RemoveKILevel(self.KILevel) + self.KILevel = value + self.chatMgr.KILevel = self.KILevel + self.UpdateKILevelChronicle() + self.WearKILevel(self.KILevel) + else: + PtDebugPrint(u"xKI.OnKIMsg(): Ignoring, trying to upgrade from KI level {} to new KI level of {}.".format(self.KILevel, value), level=kWarningLevel) + self.MakeSureWeWereKILevel() + else: + PtDebugPrint(u"xKI.OnKIMsg(): Invalid KI level {}.".format(value), level=kErrorLevel) + elif command == kDowngradeKILevel: + if value == self.KILevel: + PtDebugPrint(u"xKI.OnKIMsg(): Remove KI level of {}.".format(value), level=kWarningLevel) + if value == kNormalKI: + self.RemoveKILevel(kNormalKI) + self.KILevel = kMicroKI + self.chatMgr.KILevel = self.KILevel + self.UpdateKILevelChronicle() + self.WearKILevel(self.KILevel) + else: + PtDebugPrint(u"xKI.OnKIMsg(): Ignoring, can't remove to any lower than {}.".format(value), level=kWarningLevel) + else: + PtDebugPrint(u"xKI.OnKIMsg(): Ignoring, trying to remove KI Level {}, but currently at {}.".format(value, self.KILevel), level=kWarningLevel) + elif command == kSetPrivateChatChannel: + self.chatMgr.privateChatChannel = value + elif command == kUnsetPrivateChatChannel: + self.chatMgr.privateChatChannel = 0 + elif command == kStartBookAlert: + self.AlertBookStart() + elif command == kStartKIAlert: + self.AlertKIStart() + elif command == kUpdatePelletScore: + self.UpdatePelletScore() + self.AlertKIStart() + elif command == kMiniBigKIToggle: + self.ToggleKISize() + elif command == kKIPutAway: + self.ToggleMiniKI() + elif command == kChatAreaPageUp: + self.chatMgr.ScrollChatArea(PtGUIMultiLineDirection.kPageUp) + elif command == kChatAreaPageDown: + self.chatMgr.ScrollChatArea(PtGUIMultiLineDirection.kPageDown) + elif command == kChatAreaGoToBegin: + self.chatMgr.ScrollChatArea(PtGUIMultiLineDirection.kBufferStart) + elif command == kChatAreaGoToEnd: + self.chatMgr.ScrollChatArea(PtGUIMultiLineDirection.kBufferEnd) + elif command == kKITakePicture: + self.TakePicture() + elif command == kKICreateJournalNote: + self.MiniKICreateJournalNote() + elif command == kKIToggleFade: + if self.chatMgr.IsFaded(): + self.ResetFadeState() + else: + self.FadeCompletely() + elif command == kKIToggleFadeEnable: + self.KillFadeTimer() + if self.chatMgr.fadeEnableFlag: + self.chatMgr.fadeEnableFlag = False + else: + self.chatMgr.fadeEnableFlag = True + self.StartFadeTimer() + elif command == kKIChatStatusMsg: + self.chatMgr.DisplayStatusMessage(value, 1) + elif command == kKILocalChatStatusMsg: + self.chatMgr.DisplayStatusMessage(value, 0) + elif command == kKILocalChatErrorMsg: + self.chatMgr.AddChatLine(None, value, kChat.SystemMessage) + elif command == kKIUpSizeFont: + self.ChangeFontSize(1) + elif command == kKIDownSizeFont: + self.ChangeFontSize(-1) + elif command == kKIOpenYeehsaBook: + nm = ptNetLinkingMgr() + if self.KILevel >= kMicroKI and not self.KIDisabled and not self.waitingForAnimation and nm.isEnabled(): + curBrainMode = PtGetLocalAvatar().avatar.getCurrentMode() + if self.isEntireYeeshaBookEnabled and (curBrainMode == PtBrainModes.kNonGeneric or curBrainMode == PtBrainModes.kAFK or curBrainMode == PtBrainModes.kSit): + self.ShowYeeshaBook() + if self.KILevel == kMicroKI: + plybkCB = ptGUIControlCheckBox(KIMicroBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + else: + plybkCB = ptGUIControlCheckBox(KIBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + plybkCB.setChecked(1) + elif command == kKIOpenKI: + if not self.waitingForAnimation: + if not KIMini.dialog.isEnabled(): + self.ToggleMiniKI(1) + elif not BigKI.dialog.isEnabled(): + if self.chatMgr.fadeEnableFlag and self.chatMgr.IsFaded(): + self.ResetFadeState() + else: + self.ToggleKISize() + else: + self.ToggleMiniKI() + elif command == kKIShowOptionsMenu: + if self.yeeshaBook: + self.yeeshaBook.hide() + PtToggleAvatarClickability(True) + if self.KILevel == kMicroKI: + plybkCB = ptGUIControlCheckBox(KIMicroBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + plybkCB.setChecked(0) + elif self.KILevel > kMicroKI: + plybkCB = ptGUIControlCheckBox(KIBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + plybkCB.setChecked(0) + if not self.waitingForAnimation and not self.KIDisabled: + PtShowDialog("OptionsMenuGUI") + elif command == kKIOKDialog or command == kKIOKDialogNoQuit: + reasonField = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + try: + localized = kLoc.OKDialogDict[value] + except KeyError: + localized = U"UNTRANSLATED: " + unicode(value) + reasonField.setStringW(localized) + noButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.NoButtonID)) + noButton.hide() + noBtnText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.NoButtonTextID)) + noBtnText.hide() + yesBtnText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesButtonTextID)) + yesBtnText.setStringW(PtGetLocalizedString("KI.YesNoDialog.OKButton")) + self.YNWhatReason = kGUI.YNQuit + if command == kKIOKDialogNoQuit: + self.YNWhatReason = kGUI.YNNoReason + KIYesNo.dialog.show() + elif command == kDisableYeeshaBook: + self.isYeeshaBookEnabled = False + elif command == kEnableYeeshaBook: + self.isYeeshaBookEnabled = True + elif command == kQuitDialog: + yesText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + yesText.setStringW(PtGetLocalizedString("KI.Messages.LeaveGame")) + self.LocalizeDialog() + logoutText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutTextID)) + logoutText.show() + logoutButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutButtonID)) + logoutButton.show() + KIYesNo.dialog.show() + elif command == kDisableEntireYeeshaBook: + self.isEntireYeeshaBookEnabled = False + elif command == kEnableEntireYeeshaBook: + self.isEntireYeeshaBookEnabled = True + elif command == kUpgradeKIMarkerLevel: + self.UpgradeKIMarkerLevel(value) + self.RefreshMiniKIMarkerDisplay() + elif command == kKIShowMiniKI: + if self.KILevel >= kNormalKI: + self.chatMgr.ClearBBMini(0) + elif command == kFriendInviteSent: + if value == 0: + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Messages.InviteSuccess")) + else: + if value == 30: + msg = PtGetLocalizedString("KI.Errors.InvitesDisabled") + else: + msg = "Error occured trying to send invite: " + str(value) + self.chatMgr.AddChatLine(None, msg, kChat.SystemMessage) + + elif command == kRegisterImager: + self.imagerMap[value[0]] = value[1] + + #~~~~~~~~~~~~~~~~~~~~~# + # GZ Markers messages # + #~~~~~~~~~~~~~~~~~~~~~# + elif command == kGZUpdated: + if value != 0: + # Setting the max in the GZ marker chronicle. + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleGZMarkersAquired) + if entry is not None: + markers = entry.chronicleGetValue() + if len(markers) < value: + # Need to increase the capacity of the markers; start as active. + markers += kGZMarkerAvailable * (value - len(markers)) + entry.chronicleSetValue(markers) + entry.save() + else: + # If there are none, then just add another entry; start as active. + markers = kGZMarkerAvailable * value + vault.addChronicleEntry(kChronicleGZMarkersAquired, kChronicleGZMarkersAquiredType, markers) + self.DetermineKILevel() + self.DetermineGZ() + self.RefreshMiniKIMarkerDisplay() + elif command == kGZFlashUpdate: + try: + args = value.split() + GZGame = int(args[0]) + except: + PtDebugPrint(u"xKI.OnKIMsg(): Cannot Update Marker Display, invalid Parameters: {}.".format(value)) + return + if GZGame == -1: + self.GZFlashUpdate(value) + else: + self.DetermineKILevel() + if self.gKIMarkerLevel > kKIMarkerNotUpgraded and self.gKIMarkerLevel < kKIMarkerNormalLevel: + self.GZFlashUpdate(value) + self.RefreshMiniKIMarkerDisplay() + elif command == kGZInRange: + # Only say markers are in range if there are more markers to get. + if self.gMarkerToGetNumber > self.gMarkerGottenNumber: + self.gGZMarkerInRange = value[0] + self.gGZMarkerInRangeRepy = value[1] + self.RefreshMiniKIMarkerDisplay() + # Show alert + NewItemAlert.dialog.show() + KIAlert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertKIAlert)) + KIAlert.show() + elif command == kGZOutRange: + self.gGZMarkerInRange = 0 + self.gGZMarkerInRangeRepy = None + self.RefreshMiniKIMarkerDisplay() + NewItemAlert.dialog.hide() + KIAlert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertKIAlert)) + KIAlert.hide() + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# + # User-created Marker Games messages # + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# + elif command == kKICreateMarker: + self.CreateAMarker() + elif command == kKICreateMarkerFolder: + self.CreateMarkerGame() + + ## Called by Plasma on receipt of a backdoor message. + # These backdoor messages can trigger various actions. + def OnBackdoorMsg(self, target, param): + + if target == "ki" and param == "refresh": + self.BKFolderLineDict = self.BKJournalFolderDict + self.BKFolderListOrder = self.BKJournalListOrder + self.BKFolderSelected = self.BKJournalFolderSelected + self.BKFolderTopLine = self.BKJournalFolderTopLine + + self.BigKIRefreshFolderList() + self.BigKIRefreshFolderDisplay() + self.BigKIRefreshContentList() + self.BigKIRefreshContentListDisplay() + + self.ChangeBigKIMode(kGUI.BKListMode) + + if target.lower() == "cgz": + self.markerGameManager.OnBackdoorMsg(target, param) + + ## Called by Plasma on receipt of a chat message. + # This does not get called if the user sends a chat message through the KI, + # only if he's getting a new message from another player. + def OnRTChat(self, player, message, flags): + + if message is not None: + cFlags = xKIChat.ChatFlags(flags) + # Is it a private channel message that can't be listened to? + if cFlags.broadcast and cFlags.channel != self.chatMgr.privateChatChannel: + return + + # Is the message from an ignored plaer? + vault = ptVault() + ignores = vault.getIgnoreListFolder() + if ignores is not None and ignores.playerlistHasPlayer(player.getPlayerID()): + return + + # Display the message if it passed all the above checks. + self.chatMgr.AddChatLine(player, message, cFlags, forceKI=not self.sawTheKIAtLeastOnce) + + # If they are AFK and the message was directly to them, send back their state to sender. + try: + if self.KIDisabled or PtGetLocalAvatar().avatar.getCurrentMode() == PtBrainModes.kAFK and cFlags.private and not cFlags.toSelf: + myself = PtGetLocalPlayer() + AFKSelf = ptPlayer(myself.getPlayerName() + PtGetLocalizedString("KI.Chat.AFK"), myself.getPlayerID()) + PtSendRTChat(AFKSelf, [player], " ", cFlags.flags) + except NameError: + pass + + ## Called by Plasma when a timer is running. + # Used to handle fading and the current time in the BigKI. + def OnTimer(self, ID): + + # Chat fading. + if ID == kTimers.Fade: + # If it is fading, fade a tick. + if self.chatMgr.fadeMode == kChat.FadeFullDisp: + self.chatMgr.currentFadeTick -= 1 + # Setup call for next second. + if self.chatMgr.currentFadeTick > 0: + PtAtTimeCallback(self.key, kChat.FullTickTime, kTimers.Fade) + else: + self.chatMgr.fadeMode = kChat.FadeDoingFade + self.chatMgr.currentFadeTick = kChat.TicksOnFade + PtAtTimeCallback(self.key, kChat.FadeTickTime, kTimers.Fade) + elif self.chatMgr.fadeMode == kChat.FadeDoingFade: + self.chatMgr.currentFadeTick -= 1 + if self.chatMgr.currentFadeTick > 0: + # Fade a little. + if self.KILevel < kNormalKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + mKIdialog.setForeColor(-1, -1, -1, self.originalForeAlpha * self.chatMgr.currentFadeTick / kChat.TicksOnFade) + mKIdialog.setSelectColor(-1, -1, -1, self.originalSelectAlpha * self.chatMgr.currentFadeTick / kChat.TicksOnFade) + mKIdialog.refreshAllControls() + # Setup call for next second. + PtAtTimeCallback(self.key, kChat.FadeTickTime, kTimers.Fade) + else: + # Completely fade out. + self.chatMgr.FadeCompletely() + elif self.chatMgr.fadeMode == kChat.FadeStopping: + self.chatMgr.fadeMode = kChat.FadeNotActive + + # Time of day. + elif ID == kTimers.BKITODCheck and BigKI.dialog.isEnabled(): + self.BigKISetChanging() + + # Time of the currently played Marker Game. + elif ID == kTimers.MarkerGame and self.currentPlayingMarkerGame is not None: + self.currentPlayingMarkerGame.updateGameTime() + PtAtTimeCallback(self.key, 1, kTimers.MarkerGame) + + # Stop an alert. + elif ID == kTimers.AlertHide: + self.AlertStop() + + # Take a snapshot after a waiting period. + elif ID == kTimers.TakeSnapShot: + PtDebugPrint(u"xKI.OnTimer(): Taking snapshot.") + PtStartScreenCapture(self.key) + + # Dump the open logs. + elif ID == kTimers.DumpLogs: + if (PtDumpLogs(self.chatMgr.logDumpDest)): + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Messages.LogDumpSuccess", [self.chatMgr.logDumpDest])) + else: + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Messages.LogDumpFailed", [self.chatMgr.logDumpDest])) + + # Turn off the KI light. + elif ID == kTimers.LightStop: + self.DoKILight(0, 0) + + # Turn on the Jalak GUI buttons. + elif ID == kTimers.JalakBtnDelay: + self.SetJalakGUIButtons(1) + + # Flash the scroll down arrow. + elif ID == kTimers.IncomingChatFlash: + if self.KILevel < kNormalKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + if self.chatMgr.incomingChatFlashState > 0: + btn = ptGUIControlButton(mKIdialog.getControlFromTag(kGUI.miniChatScrollDown)) + if self.chatMgr.incomingChatFlashState & 1: + btn.hide() + else: + btn.show() + self.chatMgr.incomingChatFlashState -= 1 + PtAtTimeCallback(self.key, 0.15, kTimers.IncomingChatFlash) + else: + mKIdialog.refreshAllControls() + + ## Called by Plasma when a screen capture is done. + # This gets called once the screen capture is performed and ready to be + # processed by the KI. + def OnScreenCaptureDone(self, image): + + PtDebugPrint(u"xKI.OnScreenCaptureDone(): Snapshot is ready to be processed.") + self.BigKICreateJournalImage(image) + # Only show the KI if there isn't a dialog in the way. + if not PtIsGUIModal(): + # Make sure that we are in journal mode. + if self.BKFolderLineDict is not self.BKJournalFolderDict: + modeselector = ptGUIControlRadioGroup(BigKI.dialog.getControlFromTag(kGUI.BKRadioModeID)) + modeselector.setValue(0) + # Hide any previously opened picture. + if self.BKRightSideMode != kGUI.BKPictureExpanded: + self.HideBigKIMode() + self.BKRightSideMode = kGUI.BKPictureExpanded + # Reset the top line and selection. + self.BigKIRefreshFolderDisplay() + # Prepare to edit the caption of the picture. + self.BigKIEnterEditMode(kGUI.BKEditFieldPICTitle) + BigKI.dialog.show() + # Was just the miniKI showing? + if self.lastminiKICenter is None and self.originalminiKICenter is not None: + dragBar = ptGUIControlDragBar(KIMini.dialog.getControlFromTag(kGUI.miniDragBar)) + self.lastminiKICenter = dragBar.getObjectCenter() + dragBar.setObjectCenter(self.originalminiKICenter) + dragBar.anchor() + KIMini.dialog.show() + else: + # If the KI isn't supposed to be displayed, at least flash it so they know something happened. + self.AlertKIStart() + + self.takingAPicture = False + + # Save the image to the filesystem. + basePath = os.path.join(PtGetUserPath(), kImages.Directory) + if not PtCreateDir(basePath): + PtDebugPrint(u"xKI.OnScreenCaptureDone(): Unable to create \"{}\" directory. Image not saved to disk.".formatZ(basePath)) + return + + imageList = glob.iglob(os.path.join(basePath, "{}[0-9][0-9][0-9][0-9].png".format(kImages.FileNameTemplate))) + imageNumbers = [int(os.path.basename(img)[7:-4]) for img in imageList] + [0] + missingNumbers = set(range(1, max(imageNumbers))).difference(set(imageNumbers)) + if len(missingNumbers) > 0: + firstMissing = min(missingNumbers) + else: + firstMissing = max(imageNumbers) + 1 + tryName = os.path.join(basePath, U"{}{:04d}.png".format(kImages.FileNameTemplate, firstMissing)) + + PtDebugPrint(u"xKI.OnScreenCaptureDone(): Saving image to \"{}\".".format(tryName), level=kWarningLevel) + gpsLocation = "{} {} {}".format(self.dniCoords.getTorans(), self.dniCoords.getHSpans(), self.dniCoords.getVSpans()) + metadata = { + "Explorer" : PtGetLocalPlayer().getPlayerName(), + "Location" : gpsLocation, + "Age Name" : xKIHelpers.GetAgeName() + } + image.saveAsPNG(tryName, metadata) + + ## Called by Plasma when the player list has been updated. + # This makes sure that everything is updated and refreshed. + def OnMemberUpdate(self): + + PtDebugPrint(u"xKI.OnMemberUpdate(): Refresh player list.", level=kDebugDumpLevel) + if PtIsDialogLoaded("KIMini"): + self.RefreshPlayerList() + + ## Called by Plasma when a new player is selected in the player list. + def OnRemoteAvatarInfo(self, player): + + if self.KILevel < kNormalKI: + return + avatarSet = 0 + if isinstance(player, ptPlayer): + avatarSet = 1 + self.BKPlayerSelected = player + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + sendToField.setString(player.getPlayerName()) + self.SetBigKIToButtons() + # Find the player in the list and select them. + for pidx in range(len(self.BKPlayerList)): + if isinstance(self.BKPlayerList[pidx], ptPlayer) and self.BKPlayerList[pidx] == player: + playerlist = ptGUIControlListBox(KIMini.dialog.getControlFromTag(kGUI.PlayerList)) + playerlist.setSelection(pidx) + # Set the caret for the chat. + caret = ptGUIControlTextBox(KIMini.dialog.getControlFromTag(kGUI.ChatCaretID)) + caret.setStringW(PtGetLocalizedString("KI.Chat.TOPrompt") + unicode(player.getPlayerName()) + U" >") + privateChbox = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniPrivateToggle)) + privateChbox.setChecked(1) + break + if avatarSet: + if not KIMini.dialog.isEnabled(): + KIMini.dialog.show() + self.ResetFadeState() + + ## Called by Plasma on receipt of a high-level player vault event. + def OnVaultNotify(self, event, tupData): + + PtDebugPrint(u"xKI.OnVaultNotify(): Event = {} and data = {}.".format(event, tupData), level=kDebugDumpLevel) + if not tupData: + PtDebugPrint(u"xKI.OnVaultNotify(): Bailing, no Age data.") + return + + if PtIsDialogLoaded("KIMain"): + if event == PtVaultNotifyTypes.kRegisteredOwnedAge or event == PtVaultNotifyTypes.kUnRegisteredOwnedAge or event == PtVaultNotifyTypes.kRegisteredVisitAge or event == PtVaultNotifyTypes.kUnRegisteredVisitAge: + if self.KILevel > kMicroKI: + # A new owned Age was added, refresh its folders. + if isinstance(tupData[0], ptVaultAgeLinkNode): + # Is it the neighborhood? + ownedAge = tupData[0].getAgeInfo() + if ownedAge is not None: + if self.IsAgeMyNeighborhood(ownedAge): + self.BigKIRefreshHoodStatics(ownedAge) + self.RefreshPlayerList() + # Rebuild the player folder list because it might have changed. + self.BigKIRefreshFolderList() + self.BigKIRefreshFolderDisplay() + self.BigKIRefreshContentList() + self.BigKIRefreshContentListDisplay() + self.RefreshAgeOwnerSettings() + else: + PtDebugPrint(u"xKI.OnVaultNotify(): No ageInfo. ", level=kErrorLevel) + else: + PtDebugPrint(u"xKI.OnVaultNotify(): Unknown tuple data type. ", level=kErrorLevel) + else: + PtDebugPrint(u"xKI.OnVaultNotify(): Unknown event {}.".format(event), level=kWarningLevel) + else: + PtDebugPrint(u"xKI.OnVaultNotify(): BigKI dialog was not loaded, waiting.", level=kDebugDumpLevel) + + ## Called by Plasma on receipt of a low-level player vault event. + def OnVaultEvent(self, event, tupData): + + PtDebugPrint(u"xKI.VaultEvent(): Event = {} and data = {}.".format(event, tupData), level=kDebugDumpLevel) + self.HandleVaultTypeEvents(event, tupData) + + ## Called by Plasma on receipt of a low-level Age vault event. + def OnAgeVaultEvent(self, event, tupData): + + PtDebugPrint(u"xKI.OnAgeVaultEvent(): Event = {} and data = {}.".format(event, tupData), level=kDebugDumpLevel) + self.HandleVaultTypeEvents(event, tupData) + + ## Called by Plasma when a marker has been captured by the player. + def OnMarkerMsg(self, msgType, tupData): + + self.markerGameManager.OnMarkerMsg(msgType, tupData) + + ## Called by Plasma on receipt of a game score message. + # This is used for handling pellet scoring. + def OnGameScoreMsg(self, msg): + + if isinstance(msg, ptGameScoreListMsg): + pelletTextBox = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPelletDrop)) + try: + score = msg.getScores()[0] + points = score.getPoints() + + if self.scoreOpCur == kPellets.ScoreFetchForDisplay: + if points < 0: + points = 0 + pelletTextBox.setString(str(points)) + PtDebugPrint(u"xKI.OnGameScoreMsg(): PelletDrop score: {}.".format(points), level=kWarningLevel) + elif self.scoreOpCur == kPellets.ScoreFetchMineForUpload: + self.scoreSource = score + self.DoScoreOp(kPellets.ScoreFetchUploadDestination) + elif self.scoreOpCur == kPellets.ScoreFetchUploadDestination: + self.scoreDestination = score + self.scoreUploaded = self.scoreSource.getPoints() + self.DoScoreOp(kPellets.ScoreTransfer) + except: + if self.scoreOpCur == kPellets.ScoreFetchForDisplay: + pelletTextBox.setString("000") + elif self.scoreOpCur == kPellets.ScoreFetchUploadDestination: + self.DoScoreOp(kPellets.ScoreCreateUploadDestination) + + elif isinstance(msg, ptGameScoreTransferMsg): + pelletTextBox = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPelletDrop)) + pelletTextBox.setString("000") + self.UploadPelletScore(self.scoreUploaded) + del self.scoreDestination + del self.scoreSource + self.scoreUploaded = 0 + + elif isinstance(msg, ptGameScoreUpdateMsg): + if self.scoreOpCur == kPellets.ScoreCreateUploadDestination: + self.scoreDestination = msg.getScore() + self.scoreUploaded = self.scoreSource.getPoints() + self.DoScoreOp(kPellets.ScoreTransfer) + + # Process any remaining queued ops. + self.ProcessScoreOps() + + #~~~~~~~~~~# + # KI Setup # + #~~~~~~~~~~# + + ## Sets up the KI for a given player. + # Goes through all the steps required to ensure the player's KI is + # appropriately up-to-date when a user starts playing. + def SetupKI(self): + + self.BKPlayerList = [] + self.BKPlayerSelected = None + self.previouslySelectedPlayer = None + + self.BKJournalFolderDict = {} + self.BKJournalListOrder = [] + self.BKJournalFolderSelected = 0 + self.BKJournalFolderTopLine = 0 + self.BKPlayerFolderDict = {} + self.BKPlayerListOrder = [] + self.BKPlayerFolderSelected = 0 + self.BKPlayerFolderTopLine = 0 + self.BKConfigFolderDict = {} + self.BKConfigFolderSelected = 0 + self.BKConfigFolderTopLine = 0 + self.BKFolderLineDict = self.BKJournalFolderDict + self.BKFolderListOrder = self.BKJournalListOrder + self.BKFolderSelected = self.BKJournalFolderSelected + self.BKFolderTopLine = self.BKJournalFolderTopLine + self.BKFolderSelectChanged = False + self.BKIncomingFolder = None + + self.BKNewItemsInInbox = 0 + self.BKCurrentContent = None + self.BKContentList = [] + self.BKContentListTopLine = 0 + + self.isYeeshaBookEnabled = True + self.isEntireYeeshaBookEnabled = True + + self.DetermineCensorLevel() + self.DetermineKILevel() + self.DetermineKIFlags() + self.DetermineGZ() + + # Hide all dialogs first. + KIMicroBlackbar.dialog.hide() + KIMicro.dialog.hide() + KIMini.dialog.hide() + KIBlackbar.dialog.hide() + BigKI.dialog.hide() + self.chatMgr.ToggleChatMode(0) + + # Remove unneeded kFontShadowed flags (as long as we can't do that directly in the PRPs) + for dialogAttr in (BigKI, KIListModeDialog, KIJournalExpanded, KIPictureExpanded, KIPlayerExpanded, KIAgeOwnerExpanded, KISettings, KIMarkerFolderExpanded, KICreateMarkerGameGUI): + for i in xrange(dialogAttr.dialog.getNumControls()): + f = ptGUIControl(dialogAttr.dialog.getControlFromIndex(i)) + # call this on all controls, even those that use the color scheme of the + # dialog and would already report the flag cleared after the first one, + # as they still need the setFontFlags call to refresh themselves + f.setFontFlags(f.getFontFlags() & ~int(PtFontFlags.kFontShadowed)) + + if self.KILevel == kMicroKI: + # Show the microBlackbar. + KIMicroBlackbar.dialog.show() + # Show the microKI. + KIMicro.dialog.show() + elif self.KILevel == kNormalKI: + # Show the normal Blackbar. + KIBlackbar.dialog.show() + self.chatMgr.ClearBBMini() + # Check for unseen messages. + self.CheckInboxForUnseen() + + self.ToggleMiniKI() + + modeselector = ptGUIControlRadioGroup(BigKI.dialog.getControlFromTag(kGUI.BKRadioModeID)) + modeselector.setValue(0) + + self.BigKIRefreshFolderList() + self.BigKIRefreshFolderDisplay() + self.BigKIRefreshContentList() + self.BigKIRefreshContentListDisplay() + + self.ChangeBigKIMode(kGUI.BKListMode) + + # Load the ding dang marker game + if self.gKIMarkerLevel == kKIMarkerNormalLevel: + self.markerGameManager.LoadFromVault() + + #~~~~~~~~~~# + # KI Flags # + #~~~~~~~~~~# + + ## Sets the KI Flags from the Chronicle. + # KI Flags are settings for the player's KI (pertaining to Buddies). + def DetermineKIFlags(self): + + vault = ptVault() + + # Only get PMs and KI Mails from Buddies. + entry = vault.findChronicleEntry(kChron.OnlyPMs) + if entry is None: + # Not found, set to 0 by default. + vault.addChronicleEntry(kChron.OnlyPMs, kChron.OnlyPMsType, str(int(self.onlyGetPMsFromBuddies))) + else: + self.onlyGetPMsFromBuddies = int(entry.chronicleGetValue()) + + # Only allow the player to be buddied on request. + entry = vault.findChronicleEntry(kChron.BuddiesOnRequest) + if entry is None: + # Not found, set to 0 by default. + vault.addChronicleEntry(kChron.BuddiesOnRequest, kChron.BuddiesOnRequestType, str(int(self.onlyAllowBuddiesOnRequest))) + else: + self.onlyAllowBuddiesOnRequest = int(entry.chronicleGetValue()) + + ## Save the KI Flags to the Chronicle. + def SaveKIFlags(self): + + vault = ptVault() + # Only get PMs and KI Mails from Buddies. + entry = vault.findChronicleEntry(kChron.OnlyPMs) + if entry is not None: + entry.chronicleSetValue(str(int(self.onlyGetPMsFromBuddies))) + entry.save() + else: + vault.addChronicleEntry(kChron.OnlyPMs, kChron.OnlyPMsType, str(int(self.onlyGetPMsFromBuddies))) + + # Only allow the player to be buddied on request. + entry = vault.findChronicleEntry(kChron.BuddiesOnRequest) + if entry is not None: + entry.chronicleSetValue(str(int(self.onlyAllowBuddiesOnRequest))) + entry.save() + else: + vault.addChronicleEntry(kChron.BuddiesOnRequest, kChron.BuddiesOnRequestType, str(int(self.onlyAllowBuddiesOnRequest))) + + #~~~~~~~~~~# + # KI Light # + #~~~~~~~~~~# + + ## Finds out what the current KI light state is. + def CheckKILight(self): + + timeRemaining = self.GetKILightChron() + if not timeRemaining: + PtDebugPrint(u"xKI.CheckKILight(): Had KI light, but it's currently off.", level=kDebugDumpLevel) + self.DoKILight(0, 1) + elif timeRemaining > 0: + PtDebugPrint(u"xKI.CheckKILight(): Have KI light, time remaining = ", timeRemaining, level=kDebugDumpLevel) + self.DoKILight(1, 1, timeRemaining) + self.SetKILightChron(0) + else: + PtDebugPrint(u"No KI light.", level=kDebugDumpLevel) + + ## Get the KI light remaining time from the chronicle. + def GetKILightChron(self): + + vault = ptVault() + entry = vault.findChronicleEntry("KILightStop") + if entry is not None: + entryValue = entry.chronicleGetValue() + remaining = int(entryValue) + return remaining + else: + PtDebugPrint(u"xKI.GetKILightChron(): No KI light.", level=kDebugDumpLevel) + return -1 + + ## Set the KI light remaining time in the chronicle. + def SetKILightChron(self, remaining): + + vault = ptVault() + entry = vault.findChronicleEntry("KILightStop") + if entry is not None: + entryValue = entry.chronicleGetValue() + oldVal = int(entryValue) + if remaining == oldVal: + return + PtDebugPrint(u"xKI.SetKILightChron(): Set KI light chron to: ", remaining, level=kDebugDumpLevel) + entry.chronicleSetValue(str(int(remaining))) + entry.save() + + ## Manages the KI light. + def DoKILight(self, state, ff, remaining=0): + + thisResp = kListLightResps[state] + LocalAvatar = PtGetLocalAvatar() + avatarKey = LocalAvatar.getKey() + avatarObj = avatarKey.getSceneObject() + respList = avatarObj.getResponders() + if len(respList) > 0: + PtDebugPrint(u"xKI.DoKILight(): Responder list:", level=kDebugDumpLevel) + for resp in respList: + PtDebugPrint(u" {}".format(resp.getName())) + if resp.getName() == thisResp: + PtDebugPrint(u"xKI.DoKILight(): Found KI light resp: {}.".format(thisResp), level=kDebugDumpLevel) + atResp = ptAttribResponder(42) + atResp.__setvalue__(resp) + atResp.run(self.key, avatar=LocalAvatar, fastforward=ff) + if state: + PtAtTimeCallback(self.key, remaining, kTimers.LightStop) + PtDebugPrint(u"xKI.DoKILight(): Light was on in previous age, turning on for remaining ", remaining, " seconds.", level=kWarningLevel) + curTime = PtGetDniTime() + self.lightStop = (remaining + curTime) + self.lightOn = True + else: + PtDebugPrint(u"xKI.DoKILight(): Light is shut off, updating chron.", level=kWarningLevel) + self.SetKILightChron(remaining) + self.lightOn = False + PtSetLightAnimStart(avatarKey, kKILightObjectName, False) + break + else: + PtDebugPrint(u"xKI.DoKILight(): Couldn't find any responders.", level=kErrorLevel) + + #~~~~~~~~~~~~~~# + # Localization # + #~~~~~~~~~~~~~~# + + ## Gets the appropriate localized values for a Yes/No dialog. + def LocalizeDialog(self, dialog_type=0): + + confirm = "KI.YesNoDialog.QuitButton" + if dialog_type == 1: + confirm = "KI.YesNoDialog.YESButton" + yesButton = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesButtonTextID)) + noButton = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.NoButtonTextID)) + yesButton.setStringW(PtGetLocalizedString(confirm)) + noButton.setStringW(PtGetLocalizedString("KI.YesNoDialog.NoButton")) + + #~~~~~~~~~# + # Pellets # + #~~~~~~~~~# + + ## Perform an operation on the pellet score. + def DoScoreOp(self, op): + + self.scoreOps.append(op) + if self.scoreOpCur == kPellets.ScoreNoOp: + self.ProcessScoreOps() + + ## Process the stored score operations. + def ProcessScoreOps(self): + + if not len(self.scoreOps): + self.scoreOpCur = kPellets.ScoreNoOp + return + + self.scoreOpCur = self.scoreOps.pop(0) + if self.scoreOpCur == kPellets.ScoreFetchForDisplay: + ptGameScore.findPlayerScores("PelletDrop", self.key) + elif self.scoreOpCur == kPellets.ScoreFetchMineForUpload: + ptGameScore.findPlayerScores("PelletDrop", self.key) + elif self.scoreOpCur == kPellets.ScoreFetchUploadDestination: + ptGameScore.findAgeScores("PelletDrop", self.key) + elif self.scoreOpCur == kPellets.ScoreCreateUploadDestination: + ptGameScore.createAgeScore("PelletDrop", PtGameScoreTypes.kAccumulative, 0, self.key) + elif self.scoreOpCur == kPellets.ScoreTransfer: + self.scoreSource.transferPoints(self.scoreDestination, key=self.key) + + ## Update the pellet score to the specified value. + # If no value is specified, fetch the current score for display. + def UpdatePelletScore(self, points=0): + + pelletTextBox = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPelletDrop)) + if points: + pelletTextBox.setString(str(points)) + else: + pelletTextBox.setString("...") # Fetching from server. + self.DoScoreOp(kPellets.ScoreFetchForDisplay) + + ## Upload the new pellet score to the server. + def UploadPelletScore(self, score=None): + + if score: + hoodInfoUpdate = PtFindActivator("PythHoodInfoImagerUpdater") + PtDebugPrint(u"xKI.UploadPelletScore(): HoodInfoUpdate: {}.".format(hoodInfoUpdate), level=kDebugDumpLevel) + if hoodInfoUpdate: + notify = ptNotify(self.key) + notify.clearReceivers() + notify.addReceiver(hoodInfoUpdate) + notify.netPropagate(1) + notify.netForce(1) + notify.setActivate(1.0) + sName = "Score={}".format(PtGetLocalPlayer().getPlayerName()) + notify.addVarNumber(sName, score) + notify.send() + PtDebugPrint(u"xKI.UploadPelletScore(): Sending score notify: {} {}.".format(sName, score), level=kDebugDumpLevel) + else: + self.DoScoreOp(kPellets.ScoreFetchMineForUpload) + + #~~~~~~~~~~~~~~~# + # Auto-complete # + #~~~~~~~~~~~~~~~# + + ## Auto-completes the text for a given editing control. + def Autocomplete(self, control): + + text = control.getStringW() + + proposition = self.autocompleteState.pickNext(text) + if proposition is not None: + control.setStringW(proposition) + control.end() + control.refresh() + return + + players = set() + + for item in self.BKPlayerList: + if isinstance(item, ptPlayer): + players.add(item.getPlayerName()) + elif isinstance(item, ptVaultNodeRef): + player = item.getChild() + playerInfo = player.upcastToPlayerInfoNode() + if playerInfo is not None: + players.add(playerInfo.playerGetName()) + + proposition = self.autocompleteState.pickFirst(text, players) + + if proposition is not None: + control.setStringW(proposition) + control.end() + control.refresh() + + #~~~~~~~~~~~~~~~~~# + # Message History # + #~~~~~~~~~~~~~~~~~# + + ## Set a control's text to a log entry in the message history + def MessageHistory(self, control, set): + + if (set == "up"): + if (self.chatMgr.MessageHistoryIs < len(self.chatMgr.MessageHistoryList)-1): + self.chatMgr.MessageHistoryIs = self.chatMgr.MessageHistoryIs +1 + control.setStringW(self.chatMgr.MessageHistoryList[self.chatMgr.MessageHistoryIs]) + control.end() + control.refresh() + elif (set == "down"): + if (self.chatMgr.MessageHistoryIs > 0): + self.chatMgr.MessageHistoryIs = self.chatMgr.MessageHistoryIs -1 + control.setStringW(self.chatMgr.MessageHistoryList[self.chatMgr.MessageHistoryIs]) + control.end() + control.refresh() + + #~~~~~~~~~~# + # GZ Games # + #~~~~~~~~~~# + + ## Sets the GZ globals from the Chronicle. + def DetermineGZ(self): + + if self.gKIMarkerLevel > kKIMarkerNotUpgraded: + if self.gKIMarkerLevel < kKIMarkerNormalLevel: + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleGZGames) + error = 0 + if entry is not None: + gameString = entry.chronicleGetValue() + PtDebugPrint(u"xKI.DetermineGZ(): Game string is: \"{}\".".format(gameString), level=kWarningLevel) + args = gameString.split() + if len(args) == 3: + try: + self.gGZPlaying = int(args[0]) + colors = args[1].split(":") + outof = args[2].split(":") + + # Check for corrupted entry. + if len(colors) != 2 or len(outof) != 2: + PtDebugPrint(u"xKI.DetermineGZ(): Invalid color field or marker field.") + raise ValueError + + # Check for invalid entry. + if (colors[0] == "red" or colors[0] == "green") and int(outof[1]) > 15: + PtDebugPrint(u"xKI.DetermineGZ(): Invalid marker number entry (i.e. 1515 bug).") + raise ValueError + + self.gMarkerGottenColor = colors[0] + self.gMarkerToGetColor = colors[1] + self.gMarkerGottenNumber = int(outof[0]) + self.gMarkerToGetNumber = int(outof[1]) + + return + except: + PtDebugPrint(u"xKI.DetermineGZ(): Could not read GZ Games Chronicle.", level=kErrorLevel) + error = 1 + else: + PtDebugPrint(u"xKI.DetermineGZ(): Invalid GZ Games string formation.", level=kErrorLevel) + error = 1 + + # If there was a problem, reset everything to "off". + self.gGZPlaying = 0 + self.gMarkerToGetColor = "off" + self.gMarkerGottenColor = "off" + self.gMarkerToGetNumber = 0 + self.gMarkerGottenNumber = 0 + + # Reset Marker Games if a corrupted vault occurred. + if error: + PtDebugPrint(u"xKI.DetermineGZ(): Vault corrupted, resetting all Marker Game data.", level=kErrorLevel) + import grtzKIMarkerMachine + grtzKIMarkerMachine.ResetMarkerGame() + else: + # Can't be playing a GZ Game. + self.gGZPlaying = 0 + # Clear only if there are no currently active games. + if self.markerGameState == kGames.MGNotActive or self.currentPlayingMarkerGame is None: + self.gMarkerToGetColor = "off" + self.gMarkerGottenColor = "off" + self.gMarkerToGetNumber = 0 + self.gMarkerGottenNumber = 0 + else: + # Reset everything to "off". + self.gGZPlaying = 0 + self.gMarkerToGetColor = "off" + self.gMarkerGottenColor = "off" + self.gMarkerToGetNumber = 0 + self.gMarkerGottenNumber = 0 + + ## Update the GZ globals using provided values, not the Chronicle. + def GZFlashUpdate(self, gameString): + + PtDebugPrint(u"xKI.GZFlashUpdate(): Game string is: \"{}\".".format(gameString), level=kWarningLevel) + args = gameString.split() + if len(args) == 3: + try: + GZPlaying = int(args[0]) + colors = args[1].split(":") + outof = args[2].split(":") + + # Check for corrupted entry. + if len(colors) != 2 or len(outof) != 2: + PtDebugPrint(u"xKI.GZFlashUpdate(): Invalid color field or marker field.") + raise ValueError + + MarkerGottenColor = colors[0] + MarkerToGetColor = colors[1] + MarkerGottenNumber = int(outof[0]) + MarkerToGetNumber = int(outof[1]) + + # Check for invalid entry. + if (colors[0] == "red" or colors[0] == "green") and MarkerToGetNumber > 15: + PtDebugPrint(u"xKI.GZFlashUpdate(): Invalid marker number entry (i.e. 1515 bug).") + raise ValueError + + # Make sure the player is playing a GZ Game. + if GZPlaying != -1: + self.gGZPlaying = GZPlaying + + self.gMarkerGottenColor = MarkerGottenColor + self.gMarkerToGetColor = MarkerToGetColor + self.gMarkerGottenNumber = MarkerGottenNumber + self.gMarkerToGetNumber = MarkerToGetNumber + return + + except: + PtDebugPrint(u"xKI.GZFlashUpdate(): Could not read GZ Games Chronicle. Checking Chronicle for corruption.", level=kErrorLevel) + else: + PtDebugPrint(u"xKI.GZFlashUpdate(): Invalid GZ Games string formation. Checking Chronicle for corruption.", level=kErrorLevel) + + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleGZGames) + if entry is not None: + if gameString == entry.chronicleGetValue(): + PtDebugPrint(u"xKI.GZFlashUpdate(): Vault corrupted: trying to gracefully reset to a default state.", level=kErrorLevel) + import grtzKIMarkerMachine + grtzKIMarkerMachine.ResetMarkerGame() + return + + ## Update the Chronicle's GZ Games values. + # This takes the form of a series of values, separated by ":". + def UpdateGZGamesChronicle(self): + + if self.gGZPlaying: + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleGZGames) + upString = "{} {}:{} {}:{}".format(self.gGZPlaying, self.gMarkerGottenColor, self.gMarkerToGetColor, self.gMarkerGottenNumber, self.gMarkerToGetNumber) + if entry is not None: + entry.chronicleSetValue(upString) + entry.save() + else: + vault.addChronicleEntry(kChronicleGZGames, kChronicleGZGamesType, upString) + + ## Register a captured GZ marker. + def CaptureGZMarker(self): + + if self.gGZPlaying and self.gMarkerToGetNumber > self.gMarkerGottenNumber: + # Set the marker status to "captured" in the Chronicle. + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleGZMarkersAquired) + if entry is not None: + markers = entry.chronicleGetValue() + markerIdx = self.gGZMarkerInRange - 1 + if markerIdx >= 0 and markerIdx < len(markers): + if len(markers) - (markerIdx + 1) != 0: + markers = markers[:markerIdx] + kGZMarkerCaptured + markers[-(len(markers) - (markerIdx + 1)):] + else: + markers = markers[:markerIdx] + kGZMarkerCaptured + entry.chronicleSetValue(markers) + entry.save() + # Update the "marker gotten" count. + totalGotten = markers.count(kGZMarkerCaptured) + if self.gKIMarkerLevel > kKIMarkerFirstLevel: + # Is this the second wave of markers (or beyond)? + totalGotten -= 15 + if totalGotten < 0: + totalGotten = 0 + if totalGotten > self.gMarkerToGetNumber: + totalGotten = self.gMarkerToGetNumber + self.gMarkerGottenNumber = totalGotten + # Save update to Chronicle. + self.UpdateGZGamesChronicle() + else: + PtDebugPrint(u"xKI.CaptureGZMarker(): Invalid marker serial number of {}.".format(self.gGZMarkerInRange)) + return + else: + PtDebugPrint(u"xKI.CaptureGZMarker(): No Chronicle entry found.") + return + # Start building the notify message to go back to the orignator. + if self.gGZMarkerInRangeRepy is not None: + note = ptNotify(self.key) + note.clearReceivers() + note.addReceiver(self.gGZMarkerInRangeRepy) + note.netPropagate(0) + note.netForce(0) + note.setActivate(1) + note.addVarNumber("Captured", 1) + note.send() + self.gGZMarkerInRangeRepy = None + self.gGZMarkerInRange = 0 + + #~~~~~~~~~~~~~~# + # Marker Games # + #~~~~~~~~~~~~~~# + + ## Selects a new Marker Game type. + def SelectMarkerType(self, tagID): + + dlgObj = KICreateMarkerGameGUI + if tagID and self.selectedMGType != tagID and self.selectedMGType != 0: + PtDebugPrint(u"xKI.SelectMarkerType(): Old Marker Game type ID: ", self.selectedMGType, level=kDebugDumpLevel) + ptGUIControlButton(dlgObj.dialog.getControlFromTag(self.selectedMGType)).enable() + self.ChangeMarkerTypeColor(self.selectedMGType) + + self.selectedMGType = tagID + PtDebugPrint(u"xKI.SelectMarkerType(): Selecting new Marker Game type: ", self.selectedMGType, level=kDebugDumpLevel) + ptGUIControlButton(dlgObj.dialog.getControlFromTag(self.selectedMGType)).disable() + self.ChangeMarkerTypeColor(tagID) + + ## Change the Marker Game type color. + def ChangeMarkerTypeColor(self, tagID): + + dlgObj = KICreateMarkerGameGUI + currentColor = ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(tagID + 5)).getForeColor() + if currentColor == self.markerGameDefaultColor: + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(tagID + 5)).setForeColor(self.markerGameSelectedColor) + elif currentColor == self.markerGameSelectedColor: + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(tagID + 5)).setForeColor(self.markerGameDefaultColor) + + ## Initialize the Marker Game creation GUI. + def InitMarkerGameGUI(self): + + dlgObj = KICreateMarkerGameGUI + self.selectedMGType = kGUI.MarkerGameType1 + if self.MGKILevel == 2: + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType1)).disable() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType2)).enable() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType2)).show() + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel2)).show() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType3)).enable() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType3)).show() + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel3)).show() + elif self.MGKILevel == 1: + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType1)).disable() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType2)).enable() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType2)).show() + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel2)).show() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType3)).hide() + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel3)).hide() + elif self.MGKILevel == 0: + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType1)).disable() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType2)).hide() + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel2)).hide() + ptGUIControlButton(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameType3)).hide() + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel3)).hide() + + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel1)).setForeColor(self.markerGameSelectedColor) + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel2)).setForeColor(self.markerGameDefaultColor) + ptGUIControlTextBox(dlgObj.dialog.getControlFromTag(kGUI.MarkerGameLabel3)).setForeColor(self.markerGameDefaultColor) + + playerName = PtGetLocalPlayer().getPlayerName() + if playerName[-1] == "s": + addToName = "'" + else: + addToName = "'s" + gameName = playerName + addToName + " Marker Game" + + ptGUIControlEditBox(KICreateMarkerGameGUI.dialog.getControlFromTag(kGUI.CreateMarkerGameNameEB)).setString(gameName) + + ## Begin the creation of a new Marker Game. + def CreateMarkerGame(self): + + # Make sure the player's KI Level is appropriately high. + if self.KILevel <= kMicroKI or self.KIDisabled: + PtDebugPrint(u"xKI.CreateMarkerGame(): Aborting Marker Game creation request, player does not have the KI.", level=kDebugDumpLevel) + return + + # Make sure the player's KI Marker Level is appropriately high. + if self.gKIMarkerLevel < kKIMarkerNormalLevel: + PtDebugPrint(u"xKI.CreateMarkerGame(): Aborting Marker Game creation request, player does not have sufficient privileges.", level=kDebugDumpLevel) + return + + # The player cannot be doing another task. + if self.takingAPicture or self.waitingForAnimation: + PtDebugPrint(u"xKI.CreateMarkerGame(): Aborting Marker Game creation request, player is busy.", level=kDebugDumpLevel) + return + + # The player cannot create a game if one is already in progress. + if self.markerGameManager.playing: + PtDebugPrint(u"xKI.CreateMarkerGame(): Aborting Marker Game creation request, a game is already in progress.", level=kDebugDumpLevel) + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.MarkerGame.createErrorExistingGame"), kChat.SystemMessage) + return + + # Make sure the player has enough room. + if not self.CanMakeMarkerGame(): + PtDebugPrint(u"xKI.CreateMarkerGame(): Aborting Marker Game creation request, player has reached the limit of Marker Games.", level=kDebugDumpLevel) + self.ShowKIFullErrorMsg(PtGetLocalizedString("KI.Messages.FullMarkerGames")) + return + + # The player can now launch the Marker Game creation GUI. + self.HideBigKI() + PtShowDialog("KIMiniMarkers") + KIMarkerGameGUIOpen.run(self.key, netPropagate=0) + + ## Finishes creating the Marker Game after the asynchronous mini-game + # server registers the parameters. + def FinishCreateMarkerGame(self, gameName): + + # Get the current Age's Journal folder. + load = 0 + while load < 2: + try: + journal = self.BKJournalFolderDict[self.GetAgeInstanceName()] + if journal is None: + raise + load = 2 + except: + if load == 1: + # Failed twice in a row, it's hopeless. + ## @todo Create the folder in case this happens. + PtDebugPrint(u"xKI.FinishCreateMarkerGame(): Could not load Age's Journal Folder, Marker Game creation failed.", level=kErrorLevel) + return + load += 1 + self.BigKIRefreshFolderList() + + # Hide the blackbar, just in case. + KIBlackbar.dialog.hide() + + # Put the toggle button back to the BigKI setting. + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + toggleCB.setChecked(1) + + # Set the current mode to the Age's Journal folder. + modeSelector = ptGUIControlRadioGroup(BigKI.dialog.getControlFromTag(kGUI.BKRadioModeID)) + modeSelector.setValue(0) + self.BKFolderTopLine = self.BKJournalFolderTopLine = 0 + self.BKFolderSelected = self.BKJournalFolderSelected = self.BKJournalListOrder.index(self.GetAgeInstanceName()) + self.BigKIRefreshFolderDisplay() + + # Create the Marker Game node. + PtDebugPrint(u"xKI.FinishCreateMarkerGame(): Creating Vault node with name = \"{}\".".format(gameName), level=kDebugDumpLevel) + markerGameNode = ptVaultMarkerGameNode() + markerGameNode.setCreatorNodeID(PtGetLocalClientID()) + markerGameNode.setGameName(gameName) + self.BKCurrentContent = journal.addNode(markerGameNode) + + # Change to display current content. + self.ChangeBigKIMode(kGUI.BKMarkerListExpanded) + if BigKI.dialog.isEnabled(): + self.ShowBigKIMode() + else: + KIMini.dialog.hide() + BigKI.dialog.show() + KIMini.dialog.show() + if self.lastminiKICenter is None: + if self.originalminiKICenter is not None: + dragbar = ptGUIControlDragBar(KIMini.dialog.getControlFromTag(kGUI.miniDragBar)) + self.lastminiKICenter = dragbar.getObjectCenter() + dragbar.setObjectCenter(self.originalminiKICenter) + dragbar.anchor() + + ## Add a new marker to the existing Marker Game. + def CreateAMarker(self): + + if not self.takingAPicture and not self.waitingForAnimation: + if self.KILevel > kMicroKI and not self.KIDisabled: + self.UpdateKIUsage() + if self.CanMakeMarker(): + markerName = u"{} marker".format(self.markerGameManager.game_name) + avaCoord = PtGetLocalAvatar().position() + self.markerGameManager.AddMarker(PtGetAgeName(), avaCoord, markerName) + PtDebugPrint(u"xKI.CreateAMarker(): Creating marker at: ({}, {}, {}).".format(avaCoord.getX(), avaCoord.getY(), avaCoord.getZ())) + else: + self.ShowKIFullErrorMsg(PtGetLocalizedString("KI.Messages.FullMarkers")) + + ## Perform the necessary operations to switch to a Marker Game. + def SetWorkingToCurrentMarkerGame(self): + + if self.BKCurrentContent is None: + PtDebugPrint(u"xKI.SetWorkingToCurrentMarkerGame(): Cannot set working game, as there is no Vault folder.") + return + + element = self.BKCurrentContent.getChild() + if element is None: + PtDebugPrint(u"xKI.SetWorkingToCurrentMarkerGame(): Cannot set working game, as there is no Vault node.") + return + + element = element.upcastToMarkerGameNode() + if element is None: + PtDebugPrint(u"xKI.SetWorkingToCurrentMarkerGame(): Cannot set working game, as the Vault node is of the wrong type.") + return + + # Refresh the content. + self.RefreshPlayerList() + self.BigKICheckContentRefresh(self.BKCurrentContent) + + ## Reset from the working Marker Game to None. + def ResetWorkingMarkerGame(self): + + MGmgr = ptMarkerMgr() + + # Don't delete any markers necessary for an existing game. + if not self.markerGameManager.is_game_loaded: + MGmgr.hideMarkersLocal() + + # Refresh the content. + self.MFScrollPos = 0 + self.RefreshPlayerList() + self.BigKICheckContentRefresh(self.BKCurrentContent) + + #~~~~~~~# + # Jalak # + #~~~~~~~# + + ## Initialize the Jalak KI GUI. + def JalakGUIInit(self): + + jlakRandom = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakRandomBtn)) + jlakExtreme = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakExtremeBtn)) + jlakWall = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakWallToggleBtn)) + jlakAllLow = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakColumnsLowBtn)) + jlakAllMed = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakColumnsMedBtn)) + jlakAllHigh = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakColumnsHighBtn)) + jlakRamp = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakRampBtn)) + jlakSphere = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakSphereBtn)) + jlakBigBox = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakBigBoxBtn)) + jlakLilBox = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakLilBoxBtn)) + jlakRect = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakRectangleBtn)) + jlakDestroy = ptGUIControlButton(KIJalakGUIDialog.dialog.getControlFromTag(kJalakDestroyBtn)) + + self.jalakGUIButtons = [jlakRandom, jlakExtreme, jlakWall, jlakAllLow, jlakAllMed, jlakAllHigh, + jlakRamp, jlakSphere, jlakBigBox, jlakLilBox, jlakRect, jlakDestroy] + + obj = PtFindSceneobject("JalakDONOTTOUCH", "Jalak") + pythonScripts = obj.getPythonMods() + for script in pythonScripts: + if script.getName() == kJalakPythonComponent: + self.jalakScript = script + PtDebugPrint(u"xKI.JalakGUIInit(): Found Jalak's python component.", level=kDebugDumpLevel) + return + PtDebugPrint(u"xKI.JalakGUIInit(): Did not find Jalak's python component.", level=kErrorLevel) + + ## Toggle on/off the Jalak KI GUI. + def JalakGUIToggle(self, ff=0): + + PtDebugPrint(u"xKI.JalakGUIToggle(): toggling GUI.", level=kDebugDumpLevel) + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).disable() + if PtGetAgeName() != "Jalak": + self.jalakGUIState = False + return + if self.jalakGUIState: + self.jalakGUIState = False + KIJalakGUIClose.run(self.key, netPropagate=0, fastforward=ff) + if ff: + PtHideDialog("jalakControlPanel") + else: + # User cannot be busy doing some other task. + if self.takingAPicture or self.waitingForAnimation: + PtDebugPrint(u"xKI.JalakGUIToggle(): Aborting request for Jalak GUI: user is busy.", level=kDebugDumpLevel) + return + # Only those that have Gahreesen KI can create a game. + if self.KILevel <= kMicroKI or self.KIDisabled: + PtDebugPrint(u"xKI.JalakGUIToggle(): Aborting request for Jalak GUI: user does not have the KI.", level=kDebugDumpLevel) + return + self.jalakGUIState = True + PtShowDialog("jalakControlPanel") + KIJalakGUIOpen.run(self.key, netPropagate=0) + + ## Activate or deactivate all the buttons in the Jalak GUI. + def SetJalakGUIButtons(self, state): + + for btn in self.jalakGUIButtons: + if state: + btn.enable() + else: + btn.disable() + + #~~~~~~~~~~~# + # KI Levels # + #~~~~~~~~~~~# + + ## Make sure all the parts of the KI specific to this level are undone. + def RemoveKILevel(self, level): + + # Is it removing the micro while upgrading? + if level == kMicroKI: + # Change the display to be the normal KI. + KIMicroBlackbar.dialog.hide() + KIMicro.dialog.hide() + # Is it going from normal back to micro? + elif level == kNormalKI: + avatar = PtGetLocalAvatar() + gender = avatar.avatar.getAvatarClothingGroup() + if gender > kFemaleClothingGroup: + gender = kMaleClothingGroup + avatar.netForce(1) + if gender == kFemaleClothingGroup: + avatar.avatar.removeClothingItem("FAccKI") + else: + avatar.avatar.removeClothingItem("MAccKI") + avatar.avatar.saveClothing() + # Fill in the listbox so that the test is near the enter box. + chatArea = ptGUIControlMultiLineEdit(KIMini.dialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatArea.lock() # Make the chat display immutable. + chatArea.unclickable() # Make the chat display non-clickable. + chatArea.moveCursor(PtGUIMultiLineDirection.kBufferEnd) + chatArea.disableScrollControl() + # Hide everything specific to the normalKI. + KIBlackbar.dialog.hide() + KIMini.dialog.hide() + KIListModeDialog.dialog.hide() + KIPictureExpanded.dialog.hide() + KIJournalExpanded.dialog.hide() + KIPlayerExpanded.dialog.hide() + BigKI.dialog.hide() + KIOnAnim.animation.skipToTime(1.5) + + ## Perform all operations associated with the newly-obtained KI level. + def WearKILevel(self, level): + + if level == kMicroKI: + avatar = PtGetLocalAvatar() + gender = avatar.avatar.getAvatarClothingGroup() + if gender > kFemaleClothingGroup: + gender = kMaleClothingGroup + avatar.netForce(1) + if gender == kFemaleClothingGroup: + avatar.avatar.wearClothingItem("FAccPlayerBook") + else: + avatar.avatar.wearClothingItem("MAccPlayerBook") + avatar.avatar.saveClothing() + # Show the microKI. + KIMicroBlackbar.dialog.show() + self.chatMgr.ClearBBMini() + KIMicro.dialog.show() + self.chatMgr.ToggleChatMode(0) + elif level == kNormalKI: + avatar = PtGetLocalAvatar() + gender = avatar.avatar.getAvatarClothingGroup() + if gender > kFemaleClothingGroup: + gender = kMaleClothingGroup + avatar.netForce(1) + if gender == kFemaleClothingGroup: + avatar.avatar.wearClothingItem("FAccKI") + else: + avatar.avatar.wearClothingItem("MAccKI") + avatar.avatar.saveClothing() + # Change the display to match the normal KI. + KIBlackbar.dialog.show() + self.chatMgr.ClearBBMini() + KIOnAnim.animation.skipToTime(1.5) + # Alert the user to the newly-available KI. + self.AlertKIStart() + # Check the player's inbox. + self.CheckInboxForUnseen() + # Refresh the folders, which will create the age journal for this Age. + self.BigKIRefreshFolderList() + + ## Forcefully make sure the avatar is wearing the current KI level. + # This ensures the player is wearing either the Yeesha Book, or the Yeesha + # Book and the Gahreesen KI. + def MakeSureWeWereKILevel(self): + + if self.KILevel == kMicroKI: + try: + avatar = PtGetLocalAvatar() + gender = avatar.avatar.getAvatarClothingGroup() + if gender > kFemaleClothingGroup: + gender = kMaleClothingGroup + avatar.netForce(1) + if gender == kFemaleClothingGroup: + avatar.avatar.wearClothingItem("FAccPlayerBook") + else: + avatar.avatar.wearClothingItem("MAccPlayerBook") + avatar.avatar.saveClothing() + except NameError: + pass + elif self.KILevel == kNormalKI: + try: + avatar = PtGetLocalAvatar() + gender = avatar.avatar.getAvatarClothingGroup() + if gender > kFemaleClothingGroup: + gender = kMaleClothingGroup + avatar.netForce(1) + if gender == kFemaleClothingGroup: + avatar.avatar.wearClothingItem("FAccPlayerBook") + avatar.avatar.wearClothingItem("FAccKI") + else: + avatar.avatar.wearClothingItem("MAccPlayerBook") + avatar.avatar.wearClothingItem("MAccKI") + avatar.avatar.saveClothing() + except NameError: + pass + + ## Sets the current KI level from the Chronicle. + # Also sets the current KI Marker Level. + def DetermineKILevel(self): + + # Set the global KI Level. + self.KILevel = kMicroKI + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleKILevel) + if entry is None: + # Not found, set to MicroKI by default. + vault.addChronicleEntry(kChronicleKILevel, kChronicleKILevelType, str(self.KILevel)) + else: + oldLevel = int(entry.chronicleGetValue()) + if oldLevel >= kLowestKILevel and oldLevel <= kHighestKILevel: + self.KILevel = oldLevel + elif oldLevel < kLowestKILevel: + # Make sure that the user has at least a microKI. + self.UpdateKILevelChronicle() + self.chatMgr.KILevel = self.KILevel + PtDebugPrint(u"xKI.DetermineKILevel(): The KI Level is {}.".format(self.KILevel), level=kWarningLevel) + + # Set the KI Marker Level. + self.gKIMarkerLevel = 0 + entry = vault.findChronicleEntry(kChronicleKIMarkerLevel) + if entry is None: + # Not found, set to 0 by default. + vault.addChronicleEntry(kChronicleKIMarkerLevel, kChronicleKIMarkerLevelType, str(self.gKIMarkerLevel)) + else: + try: + self.gKIMarkerLevel = int(entry.chronicleGetValue()) + except: + PtDebugPrint(u"xKI.DetermineKILevel(): Chronicle entry error with the KI's Marker Level, resetting to the default value.", level=kErrorLevel) + entry.chronicleSetValue(str(self.gKIMarkerLevel)) + entry.save() + PtDebugPrint(u"xKI.DetermineKILevel(): The KI Marker Level is {}.".format(self.gKIMarkerLevel), level=kWarningLevel) + + entry = vault.findChronicleEntry("feather") + if entry is None: + self.chatMgr.gFeather = 0 + else: + try: + self.chatMgr.gFeather = int(entry.chronicleGetValue()) + except ValueError: + self.chatMgr.gFeather = 0 + + ## Upgrade the KI Marker Level to a new setting. + def UpgradeKIMarkerLevel(self, newLevel): + + PtDebugPrint(u"xKI.UpgradeKIMarkerLevel(): KI Marker Level going from {} to {}.".format(self.gKIMarkerLevel, newLevel), level=kWarningLevel) + if self.KILevel > kMicroKI and newLevel > self.gKIMarkerLevel: + self.gKIMarkerLevel = newLevel + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleKIMarkerLevel) + if entry is None: + PtDebugPrint(u"xKI.UpgradeKIMarkerLevel(): Chronicle entry not found, set to {}.".format(self.gKIMarkerLevel), level=kWarningLevel) + vault.addChronicleEntry(kChronicleKIMarkerLevel, kChronicleKIMarkerLevelType, str(self.gKIMarkerLevel)) + else: + PtDebugPrint(u"xKI.UpgradeKIMarkerLevel(): Upgrading existing KI Marker Level to {}.".format(self.gKIMarkerLevel), level=kWarningLevel) + entry.chronicleSetValue(str(self.gKIMarkerLevel)) + entry.save() + + ## Updates the KI level's Chronicle value. + def UpdateKILevelChronicle(self): + + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleKILevel) + if entry is not None: + entry.chronicleSetValue(str(self.KILevel)) + entry.save() + else: + vault.addChronicleEntry(kChronicleKILevel, kChronicleKILevelType, str(self.KILevel)) + + #~~~~~~~~~~~~~# + # Yeesha Book # + #~~~~~~~~~~~~~# + + ## Show the Yeesha Book to the player, in accordance with its status. + def ShowYeeshaBook(self): + + if self.KILevel >= kMicroKI and not self.KIDisabled and not self.waitingForAnimation: + if BigKI.dialog.isEnabled() or KIMini.dialog.isEnabled(): + self.ToggleMiniKI() + startOpen = False + if self.isYeeshaBookEnabled: + if self.offeredBookMode == kGUI.NotOffering: + YeeshaBDef = xLinkingBookDefs.xYeeshaBookBase + self.GetYeeshaPageDefs() + else: + YeeshaBDef = xLinkingBookDefs.xYeeshaBookNoShare + startOpen = True + else: + YeeshaBDef = xLinkingBookDefs.xYeeshaBookBroke + self.GetYeeshaPageDefs() + self.yeeshaBook = ptBook(YeeshaBDef, self.key) + self.yeeshaBook.setSize(xLinkingBookDefs.YeeshaBookSizeWidth, xLinkingBookDefs.YeeshaBookSizeHeight) + self.yeeshaBook.show(startOpen) + PtToggleAvatarClickability(False) + + ## Returns the definitions for the Yeesha pages. + # Gets called whenever the Relto's Age GUI is drawn. + def GetYeeshaPageDefs(self): + + pageDefs = "" + vault = ptVault() + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + for SDLVar, page in xLinkingBookDefs.xYeeshaPages: + FoundValue = psnlSDL.findVar(SDLVar) + if FoundValue is not None: + PtDebugPrint(u"xKI.GetYeeshaPageDefs(): The previous value of the SDL variable \"{}\" is {}.".format(SDLVar, FoundValue.getInt()), level=kDebugDumpLevel) + state = FoundValue.getInt() % 10 + if state != 0: + active = 1 + if state == 2 or state == 3: + active = 0 + try: + pageDefs += page % (active) + except LookupError: + pageDefs += "Bogus page {}".format(SDLVar) + else: + PtDebugPrint(u"xKI.GetYeeshaPageDefs(): Trying to access the Chronicle psnlSDL failed: psnlSDL = \"{}\".".format(psnlSDL), level=kErrorLevel) + return pageDefs + + ## Turns on and off the Yeesha pages' SDL values. + def ToggleYeeshaPageSDL(self, varName, on): + vault = ptVault() + psnlSDL = vault.getPsnlAgeSDL() + if psnlSDL: + ypageSDL = psnlSDL.findVar(varName) + if ypageSDL: + size, state = divmod(ypageSDL.getInt(), 10) + value = None + if state == 1 and not on: + value = 3 + elif state == 3 and on: + value = 1 + elif state == 2 and on: + value = 4 + elif state == 4 and not on: + value = 2 + if value is not None: + PtDebugPrint(u"xKI.ToggleYeeshaPageSDL(): Setting {} to {}.".format(varName, value), level=kDebugDumpLevel) + ypageSDL.setInt((size * 10) + value) + vault.updatePsnlAgeSDL(psnlSDL) + + #~~~~~~~~~~~# + # Censoring # + #~~~~~~~~~~~# + + ## Sets the censor level. + # By default, it's set at PG, but it fetches the real value from the + # chronicle. If it is not found in the chronicle, it will set it to PG. + def DetermineCensorLevel(self): + + self.censorLevel = xCensor.xRatedPG + vault = ptVault() + entry = vault.findChronicleEntry(kChronicleCensorLevel) + if entry is None: + vault.addChronicleEntry(kChronicleCensorLevel, kChronicleCensorLevelType, str(self.censorLevel)) + else: + self.censorLevel = int(entry.chronicleGetValue()) + PtDebugPrint(u"xKI.DetermineCensorLevel(): The censor level is {}.".format(self.censorLevel), level=kWarningLevel) + + def GetCensorLevel(self): + return self.censorLevel + + #~~~~~~~# + # Fonts # + #~~~~~~~# + + ## Sets the current font size from the Chronicle. + def DetermineFontSize(self): + + fontSize = self.GetFontSize() + vault = ptVault() + entry = vault.findChronicleEntry(kChron.FontSize) + if entry is None: + # Not found, add the current size to the Chronicle. + vault.addChronicleEntry(kChron.FontSize, kChron.FontSizeType, str(fontSize)) + else: + fontSize = int(entry.chronicleGetValue()) + self.SetFontSize(fontSize) + PtDebugPrint(u"xKI.DetermineFontSize(): The saved font size is {}.".format(fontSize), level=kWarningLevel) + + ## Saves the current font size to the Chronicle. + def SaveFontSize(self): + + fontSize = self.GetFontSize() + vault = ptVault() + entry = vault.findChronicleEntry(kChron.FontSize) + if entry is not None: + entry.chronicleSetValue(str(fontSize)) + entry.save() + else: + vault.addChronicleEntry(kChron.FontSize, kChron.FontSizeType, str(fontSize)) + PtDebugPrint(u"xKI.SaveFontSize(): Saving font size of {}.".format(fontSize), level=kWarningLevel) + + ## Returns the font size currently applied to the KI. + def GetFontSize(self): + + if self.KILevel < kNormalKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + miniChatArea = ptGUIControlMultiLineEdit(mKIdialog.getControlFromTag(kGUI.ChatDisplayArea)) + return miniChatArea.getFontSize() + + ## Applies the specified font size. + def SetFontSize(self, fontSize): + + PtDebugPrint(u"xKI.SetFontSize(): Setting font size to {}.".format(fontSize), level=kWarningLevel) + if self.KILevel < kNormalKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + miniChatArea = ptGUIControlMultiLineEdit(mKIdialog.getControlFromTag(kGUI.ChatDisplayArea)) + miniChatArea.setFontSize(fontSize) + miniChatArea.refresh() + microChatArea = ptGUIControlMultiLineEdit(mKIdialog.getControlFromTag(kGUI.ChatDisplayArea)) + microChatArea.setFontSize(fontSize) + microChatArea.refresh() + noteArea = ptGUIControlMultiLineEdit(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKIJRNNote)) + noteArea.setFontSize(fontSize) + noteArea.refresh() + ownerNotes = ptGUIControlMultiLineEdit(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerDescription)) + ownerNotes.setFontSize(fontSize) + ownerNotes.refresh() + + ## Changes the font size currently in effect. + def ChangeFontSize(self, new): + + size = self.GetFontSize() + if new == 1: + fontRange = range(len(kChat.FontSizeList) - 1) + elif new == -1: + fontRange = range(len(kChat.FontSizeList) - 1, 0, -1) + for i in fontRange: + if size <= kChat.FontSizeList[i] and new == 1: + size = kChat.FontSizeList[i + 1] + break + size = kChat.FontSizeList[i - 1] + break + self.SetFontSize(size) + self.SaveFontSize() + self.RefreshKISettings() + + #~~~~~~~~# + # Fading # + #~~~~~~~~# + + ## Gets the current fading time from the Chronicle. + def DetermineFadeTime(self): + + vault = ptVault() + entry = vault.findChronicleEntry(kChron.FadeTime) + if entry is None: + # Not found, add the current fade time to the Chronicle. + vault.addChronicleEntry(kChron.FadeTime, kChron.FadeTimeType, str(self.chatMgr.ticksOnFull)) + else: + self.chatMgr.ticksOnFull = int(entry.chronicleGetValue()) + if self.chatMgr.ticksOnFull == kChat.FadeTimeMax: + # Disable the fade altogether. + self.chatMgr.fadeEnableFlag = False + self.KillFadeTimer() + PtDebugPrint(u"xKI.DetermineFadeTime(): Fade time disabled.", level=kWarningLevel) + else: + self.chatMgr.fadeEnableFlag = True + PtDebugPrint(u"xKI.DetermineFadeTime(): The saved fade time is {}.".format(self.chatMgr.ticksOnFull), level=kWarningLevel) + + ## Saves the current fading time to the Chronicle. + def SaveFadeTime(self): + + vault = ptVault() + entry = vault.findChronicleEntry(kChron.FadeTime) + if entry is not None: + entry.chronicleSetValue(str(self.chatMgr.ticksOnFull)) + entry.save() + else: + vault.addChronicleEntry(kChron.FadeTime, kChron.FadeTimeType, str(self.chatMgr.ticksOnFull)) + PtDebugPrint(u"xKI.SaveFadeTime(): Saving Fade Time of {}.".format(self.chatMgr.ticksOnFull), level=kWarningLevel) + + ## Start the fade timer. + # This gets called each time the user does something in relation to the + # chat to keep it alive. + def StartFadeTimer(self): + + if not self.chatMgr.fadeEnableFlag: + return + if not BigKI.dialog.isEnabled(): + if self.chatMgr.fadeMode in (kChat.FadeNotActive, kChat.FadeDone): + PtAtTimeCallback(self.key, kChat.FullTickTime, kTimers.Fade) + self.chatMgr.fadeMode = kChat.FadeFullDisp + self.currentFadeTick = self.chatMgr.ticksOnFull + + ## End the currently-active timer. + def KillFadeTimer(self): + + if self.KILevel < kNormalKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + + # Optimization: only do this if we are fading or have faded + if self.chatMgr.fadeMode in (kChat.FadeDoingFade, kChat.FadeDone, kChat.FadeNotActive): + mKIdialog.setForeColor(-1, -1, -1, self.originalForeAlpha) + mKIdialog.setSelectColor(-1, -1, -1, self.originalSelectAlpha) + if self.KILevel == kNormalKI: + playerlist = ptGUIControlListBox(mKIdialog.getControlFromTag(kGUI.PlayerList)) + playerlist.show() + chatArea = ptGUIControlMultiLineEdit(mKIdialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatArea.enableScrollControl() + mKIdialog.refreshAllControls() + + # Toggle state + if self.chatMgr.fadeMode not in (kChat.FadeNotActive, kChat.FadeDone): + self.chatMgr.fadeMode = kChat.FadeStopping + self.currentFadeTick = self.chatMgr.ticksOnFull + + def ResetFadeState(self, force=False): + """This turns the chat fade OFF and resets it if the user is not chatting. + Use this instead of calling `KillFadeTimer()` and `StartFadeTimer()` to toggle the state. + Use `force` to disable checking of the chatting status (why would you do that?) + """ + + # I'm cheating. + self.KillFadeTimer() + if not self.chatMgr.isChatting or force: + self.StartFadeTimer() + + ## Make the miniKI lists completely faded out. + def FadeCompletely(self): + + if self.KILevel < kNormalKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + # If the BigKI is enabled, make the chat opaque once more. + if BigKI.dialog.isEnabled(): + mKIdialog.setForeColor(-1, -1, -1, self.originalForeAlpha) + mKIdialog.setSelectColor(-1, -1, -1, self.originalSelectAlpha) + mKIdialog.refreshAllControls() + # Otherwise, add full transparency and hide everything. + else: + mKIdialog.setForeColor(-1, -1, -1, 0) + mKIdialog.setSelectColor(-1, -1, -1, 0) + mKIdialog.refreshAllControls() + if self.KILevel == kNormalKI: + playerlist = ptGUIControlListBox(mKIdialog.getControlFromTag(kGUI.PlayerList)) + playerlist.hide() + self.chatMgr.fadeMode = kChat.FadeDone + + #~~~~~~# + # Ages # + #~~~~~~# + + ## Determines whether or not the player can invite visitors to an Age. + def CanAgeInviteVistors(self, ageInfo, link): + + # Make sure it's not a special Age. + try: + for Age in kAges.NoInvite: + if Age == ageInfo.getAgeFilename(): + return False + except AttributeError: + pass + + # Make sure that the Age has not been deleted. + if link.getVolatile(): + return False + + # Make sure the player has a default link to this Age. + # If not, the Age has not yet been finished. + spawnPoints = link.getSpawnPoints() + for spawnlink in spawnPoints: + if spawnlink.getTitle() == "Default": + return True + return False + + ## Determines if the Age is the player's Neighborhood. + def IsAgeMyNeighborhood(self, ageInfo): + + try: + hoodGUID = ptVault().getLinkToMyNeighborhood().getAgeInfo().getAgeInstanceGuid() + if not isinstance(hoodGUID, str) or not hoodGUID: + PtDebugPrint(u"xKI.IsAgeMyNeighborhood(): Neighborhood GUID not valid.", level=kWarningLevel) + # Can't trust this test, try a different one. + if ageInfo.getAgeFilename() == "Neighborhood": + return True + else: + if ageInfo.getAgeInstanceGuid() == hoodGUID: + return True + except AttributeError: + pass + return False + + #~~~~~~~~~~~# + # Age Names # + #~~~~~~~~~~~# + + ## Returns the formatted and filtered name of an Age instance. + def GetAgeInstanceName(self, ageInfo=None): + + if ageInfo is None: + ageInfo = PtGetAgeInfo() + if ageInfo is not None: + if ageInfo.getAgeInstanceName() == "D'ni-Rudenna": + sdl = xPsnlVaultSDL() + if sdl["TeledahnPoleState"][0] > 5 or sdl["KadishPoleState"][0] > 5 or sdl["GardenPoleState"][0] > 5 or sdl["GarrisonPoleState"][0] > 5: + pass + else: + return "Unknown" + if ageInfo.getAgeInstanceName() == "Ae'gura": + return "D'ni-Ae'gura" + return FilterAgeName(ageInfo.getAgeInstanceName()) + else: + return "?UNKNOWN?" + + ## Returns the file name of the specified Age. + def GetAgeFileName(self, ageInfo=None): + + if ageInfo is None: + ageInfo = PtGetAgeInfo() + if ageInfo is not None: + return ageInfo.getAgeFilename() + else: + return "?UNKNOWN?" + + #~~~~~~~~# + # Limits # + #~~~~~~~~# + + ## Update the used-up space on the KI. + def UpdateKIUsage(self): + + usage = ptVault().getKIUsage() + self.numberOfPictures = usage[0] + self.numberOfNotes = usage[1] + self.numberOfMarkerFolders = usage[2] + try: + self.numberOfMarkers = self.markerGameManager.marker_total + except: + self.numberOfMarkers = -1 + + ## Check if the player has reached his limit of picture space. + def CanTakePicture(self): + + self.UpdateKIUsage() + if kLimits.MaxPictures == -1 or self.numberOfPictures < kLimits.MaxPictures: + return True + return False + + ## Check if the player has reached his limit of journal notes space. + def CanMakeNote(self): + + self.UpdateKIUsage() + if kLimits.MaxNotes == -1 or self.numberOfNotes < kLimits.MaxNotes: + return True + return False + + ## Check if the player has reached his limit of Marker Games. + def CanMakeMarkerGame(self): + + self.UpdateKIUsage() + if kLimits.MaxMarkerFolders == -1 or self.numberOfMarkerFolders < kLimits.MaxMarkerFolders: + return True + return False + + ## Check if the player has reached his limit of markers for a Marker Game. + def CanMakeMarker(self): + + self.UpdateKIUsage() + if kLimits.MaxMarkers == -1 or self.numberOfMarkers < kLimits.MaxMarkers: + return True + return False + + #~~~~~~~~# + # Errors # + #~~~~~~~~# + + ## Displays a OK dialog-based error message to the player. + def ShowKIFullErrorMsg(self, msg): + + self.YNWhatReason = kGUI.YNKIFull + reasonField = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + reasonField.setStringW(msg) + yesButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.YesButtonID)) + yesButton.hide() + yesBtnText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesButtonTextID)) + yesBtnText.hide() + noBtnText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.NoButtonTextID)) + noBtnText.setStringW(PtGetLocalizedString("KI.YesNoDialog.OKButton")) + KIYesNo.dialog.show() + + + ## Display an error message in the SendTo field. + def SetSendToErrorMessage(self, message): + + self.BKPlayerSelected = None + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + sendToField.setStringW(U"<" + unicode(message) + U">") + sendToButton = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKIToPlayerButton)) + sendToButton.hide() + + #~~~~~~~~~~~~~# + # Invitations # + #~~~~~~~~~~~~~# + + ## Invite another player to visit the player's Age. + def InviteToVisit(self, playerID, ageInfo): + + whereToLink = ptAgeLinkStruct() + whereToLink.setAgeInfo(ageInfo.asAgeInfoStruct()) + ptVault().invitePlayerToAge(whereToLink, playerID) + self.SendInviteRevoke(playerID, ageInfo.getDisplayName(), "KI.Invitation.VisitTitle", "KI.Invitation.VisitBody") + + ## Send an invitation or a revocation to another player. + def SendInviteRevoke(self, playerID, ageName, title, message): + + localPlayer = PtGetLocalPlayer() + invite = ptVaultTextNoteNode(0) + invite.noteSetText(PtGetLocalizedString(message, [ageName, localPlayer.getPlayerName()])) + invite.noteSetTitle(PtGetLocalizedString(title, [ageName])) + invite.sendTo(playerID) + + #~~~~~~~~~~~~~~~~~# + # New Item Alerts # + #~~~~~~~~~~~~~~~~~# + + ## Check the Inbox for unseen messages. + def CheckInboxForUnseen(self): + + inFolder = ptVault().getInbox() + if inFolder is not None: + inRefList = inFolder.getChildNodeRefList() + for inRef in inRefList: + if not inRef.beenSeen(): + self.AlertKIStart() + + ## Start the KI Alert if it's not already active. + def AlertKIStart(self): + + if self.KILevel >= kNormalKI: + PtFlashWindow() + if not self.alertTimerActive: + PtDebugPrint(u"xKI.AlertKIStart(): Show KI alert.", level=kDebugDumpLevel) + NewItemAlert.dialog.show() + KIAlert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertKIAlert)) + self.alertTimeToUse = kAlertTimeDefault + KIAlert.show() + + ## Start the Book Alert if it's not already active. + def AlertBookStart(self, time=kAlertTimeDefault): + + if not self.alertTimerActive: + PtDebugPrint(u"xKI.AlertBookStart(): Show Book Alert.", level=kDebugDumpLevel) + NewItemAlert.dialog.show() + bookAlert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertBookAlert)) + self.alertTimeToUse = time + bookAlert.show() + + ## Stop all alerts, by hiding their dialogs. + def AlertStop(self): + + self.alertTimerActive = False + NewItemAlert.dialog.hide() + KIAlert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertKIAlert)) + KIAlert.hide() + bookAlert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertBookAlert)) + bookAlert.hide() + + ## Starts the alert timer if it's not already active. + def AlertStartTimer(self): + + if not self.alertTimerActive: + self.alertTimerActive = True + PtAtTimeCallback(self.key, self.alertTimeToUse, kTimers.AlertHide) + + #~~~~~~~~~~~~~# + # Player List # + #~~~~~~~~~~~~~# + + ## Tries to scroll up the list of players. + def ScrollPlayerList(self, direction): + + if self.KILevel == kMicroKI: + return + elif self.KILevel == kMicroKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + control = ptGUIControlListBox(KIMini.dialog.getControlFromTag(kGUI.PlayerList)) + currPos = control.getScrollPos() + if direction == 1: + if currPos < control.getScrollRange(): + PtDebugPrint(u"xKI.ScrollPlayerList(): Scrolling player list up from {} to {}.".format(currPos, currPos + 1), level=kDebugDumpLevel) + control.setScrollPos(currPos + 1) + else: + PtDebugPrint(u"xKI.ScrollPlayerList(): Not scrolling player list up from {}.".format(currPos), level=kDebugDumpLevel) + else: + if currPos > 0: + PtDebugPrint(u"xKI.ScrollPlayerList(): Scrolling player list down from {} to {}.".format(currPos, currPos - 1), level=kDebugDumpLevel) + control.setScrollPos(currPos - 1) + else: + PtDebugPrint(u"xKI.ScrollPlayerList(): Not scrolling player list down from {}.".format(currPos), level=kDebugDumpLevel) + self.CheckScrollButtons() + mKIdialog.refreshAllControls() + self.ResetFadeState() + + ## Checks to see if the player list scroll buttons should be visible. + def CheckScrollButtons(self): + + if self.KILevel == kMicroKI: + return + elif self.KILevel == kMicroKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + control = ptGUIControlListBox(KIMini.dialog.getControlFromTag(kGUI.PlayerList)) + currentPos = control.getScrollPos() + PtDebugPrint(u"xKI.CheckScrollButtons(): Current position = {} and range = {}.".format(currentPos, control.getScrollRange()), level=kDebugDumpLevel) + try: + dbtn = ptGUIControlButton(mKIdialog.getControlFromTag(kGUI.miniPlayerListDown)) + if currentPos == 0: + dbtn.hide() + else: + dbtn.show() + ubtn = ptGUIControlButton(mKIdialog.getControlFromTag(kGUI.miniPlayerListUp)) + if currentPos >= control.getScrollRange(): + ubtn.hide() + else: + ubtn.show() + except KeyError: + pass + + ## Reloads the player list with the latest values and displays them. + def RefreshPlayerList(self, forceSmall=False): + + PtDebugPrint(u"xKI.RefreshPlayerList(): Refreshing.", level=kDebugDumpLevel) + playerlist = ptGUIControlListBox(KIMini.dialog.getControlFromTag(kGUI.PlayerList)) + select = playerlist.getSelection() + if select >= 0 and select < len(self.BKPlayerList): + self.previouslySelectedPlayer = self.BKPlayerList[select] + # Vault node refs change frequently, so get the unique ID instead. + if isinstance(self.previouslySelectedPlayer, ptVaultNodeRef): + PtDebugPrint(u"xKI.RefreshPlayerList(): Getting the vault node ID of the selected player.", level=kDebugDumpLevel) + self.previouslySelectedPlayer = self.previouslySelectedPlayer.getChild().getID() + else: + self.previouslySelectedPlayer = None + self.BKPlayerList = [] + vault = ptVault() + + # Age Players + ageMembers = KIFolder(PtVaultStandardNodes.kAgeMembersFolder) + if ageMembers is not None: + self.BKPlayerList.append(ageMembers) + self.BKPlayerList += PtGetPlayerListDistanceSorted() + else: + self.BKPlayerList.append("?NOAgeMembers?") + + # Buddies List + buddies = vault.getBuddyListFolder() + if buddies is not None: + self.BKPlayerList.append(buddies) + self.BKPlayerList += self.RemoveOfflinePlayers(buddies.getChildNodeRefList()) + else: + self.BKPlayerList.append("?NOBuddies?") + + # Neighbors List + neighbors = GetNeighbors() + if neighbors is not None: + self.BKPlayerList.append(neighbors) + onlinePlayers = self.RemoveOfflinePlayers(neighbors.getChildNodeRefList()) + FilterPlayerInfoList(onlinePlayers) + self.BKPlayerList += onlinePlayers + else: + self.BKPlayerList.append("NEIGHBORS") + + # All Players (INTERNAL CLIENT ONLY) + if PtIsInternalRelease(): + allPlayers = vault.getAllPlayersFolder() + if allPlayers: + self.BKPlayerList.append(allPlayers) + onlinePlayers = self.RemoveOfflinePlayers(allPlayers.getChildNodeRefList()) + FilterPlayerInfoList(onlinePlayers) + self.BKPlayerList += onlinePlayers + # don't append a dummy -- we don't care if our vault doesn't have a copy of AllPlayers + + # Age Devices + if self.folderOfDevices and BigKI.dialog.isEnabled() and not forceSmall: + self.BKPlayerList.append(self.folderOfDevices) + for device in self.folderOfDevices: + self.BKPlayerList.append(device) + + # Pass the new value to the chat manager. + self.chatMgr.BKPlayerList = self.BKPlayerList + + # Refresh the display. + self.RefreshPlayerListDisplay() + + ## Removes the offline players in a list of players. + def RemoveOfflinePlayers(self, playerlist): + + onlineList = [] + ignores = ptVault().getIgnoreListFolder() + for plyr in playerlist: + if isinstance(plyr, ptVaultNodeRef): + PLR = plyr.getChild() + PLR = PLR.upcastToPlayerInfoNode() + if PLR is not None and PLR.getType() == PtVaultNodeTypes.kPlayerInfoNode: + if PLR.playerIsOnline(): + if not ignores.playerlistHasPlayer(PLR.playerGetID()): + onlineList.append(plyr) + return onlineList + + ## Refresh the display of the player list. + def RefreshPlayerListDisplay(self): + + playerlist = ptGUIControlListBox(KIMini.dialog.getControlFromTag(kGUI.PlayerList)) + scrollPos = playerlist.getScrollPos() + playerlist.lock() + playerlist.clearAllElements() + newSelection = -1 # Assume no selection. + + idx = 0 + for plyr in self.BKPlayerList: + if isinstance(plyr, DeviceFolder): + playerlist.closeBranch() + playerlist.addBranchW(plyr.name.upper(), 1) + elif isinstance(plyr, Device): + playerlist.addStringWithColor(plyr.name, kColors.DniSelectable, kSelectUseGUIColor) + elif isinstance(plyr, ptVaultNodeRef): + PLR = plyr.getChild() + PLR = PLR.upcastToPlayerInfoNode() + if PLR is not None and PLR.getType() == PtVaultNodeTypes.kPlayerInfoNode: + if PLR.playerIsOnline(): + playerlist.addStringWithColor(PLR.playerGetName(), kColors.DniSelectable, kSelectUseGUIColor) + else: + playerlist.addStringWithColor(PLR.playerGetName(), kColors.AgenBlueDk,kSelectDetermined) + else: + PtDebugPrint(u"xKI.RefreshPlayerListDisplay(): Unknown player element type {}.".format(PLR.getType()), level=kErrorLevel) + elif isinstance(plyr, ptPlayer): + preText = " " + postText = " " + if plyr.getPlayerID() != 0: + if plyr.getDistanceSq() < PtMaxListenDistSq(): + preText = ">" + postText = "<" + if plyr.getPlayerName() != "": + playerlist.addStringWithColor(preText + plyr.getPlayerName() + postText, kColors.DniSelectable, kSelectUseGUIColor) + else: + if plyr.getPlayerID() != 0: + playerlist.addStringWithColor(preText + "[ID:{:08d}]".format(plyr.getPlayerID()) + postText, kColors.DniSelectable, kSelectDetermined) + else: + playerlist.addStringWithColor(preText + "?unknown user?" + postText, kColors.DniSelectable, kSelectDetermined) + elif isinstance(plyr, KIFolder): + playerlist.closeBranch() + playerlist.addBranchW(plyr.name.upper(), 1) + elif isinstance(plyr, ptVaultPlayerInfoListNode): + # It's a player list, display its name. + fldrType = plyr.folderGetType() + if fldrType == PtVaultStandardNodes.kAgeOwnersFolder: + fldrType = PtVaultStandardNodes.kHoodMembersFolder + playerlist.closeBranch() + playerlist.addBranchW(xLocTools.FolderIDToFolderName(fldrType).upper(), 1) + elif isinstance(plyr, ptVaultMarkerGameNode): + # its a marker list, display its name + playerlist.closeBranch() + playerlist.addBranchW(plyr.folderGetName(), 1) + elif isinstance(plyr, str): + playerlist.closeBranch() + playerlist.addBranchW(plyr, 1) + else: + PtDebugPrint(u"xKI.RefreshPlayerListDisplay(): Unknown list type ", plyr, level=kErrorLevel) + # Is it the selected player? + if self.previouslySelectedPlayer is not None: + PtDebugPrint(u"xKI.RefreshPlayerListDisplay(): A previously selected player.", self.previouslySelectedPlayer, level=kDebugDumpLevel) + # Fix for vaultNodeRef comparisons (which no longer work). + if isinstance(self.previouslySelectedPlayer, long) and isinstance(plyr, ptVaultNodeRef): + plyr = plyr.getChild().getID() # Set to the ID; let the testing begin. + # Was it the same class? + if self.previouslySelectedPlayer.__class__ == plyr.__class__: + PtDebugPrint(u"xKI.RefreshPlayerListDisplay(): Previous player matches class.", level=kDebugDumpLevel) + # And finally, was it the same object? + if self.previouslySelectedPlayer == plyr: + PtDebugPrint(u"xKI.RefreshPlayerListDisplay(): Previous player matches object, setting to {}.".format(idx), level=kDebugDumpLevel) + newSelection = idx + # Found him, stop looking. + self.previouslySelectedPlayer = None + else: + PtDebugPrint(u"xKI.RefreshPlayerListDisplay(): Previous player does not match object.", level=kDebugDumpLevel) + else: + PtDebugPrint(u"xKI.RefreshPlayerListDisplay(): Previous player does not match class.", level=kDebugDumpLevel) + idx += 1 + # Is there no selection? + if newSelection == -1: + # Select the first item in the list. + newSelection = 0 + # Put the caret back to the regular prompt. + caret = ptGUIControlTextBox(KIMini.dialog.getControlFromTag(kGUI.ChatCaretID)) + caret.setString(">") + PtDebugPrint(u"xKI.RefreshPlayerListDisplay(): Setting new selection to {}.".format(newSelection), level=kDebugDumpLevel) + playerlist.setSelection(newSelection) + self.previouslySelectedPlayer = None + + # Re-establish the selection the player had before. + playerlist.setScrollPos(scrollPos) + playerlist.unlock() + + self.CheckScrollButtons() + + # Set the SendTo button. + sendToButton = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKIToPlayerButton)) + if self.BKPlayerSelected is None: + sendToButton.hide() + else: + # Make sure that the person is still here (this shouldn't happen). + if isinstance(self.BKPlayerSelected, DeviceFolder): + self.BKPlayerSelected = None + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + sendToField.setString(" ") + sendToButton.hide() + # Otherwise see if the device is still in range. + elif isinstance(self.BKPlayerSelected, Device): + try: + self.folderOfDevices.index(self.BKPlayerSelected) + except ValueError: + # No longer in the list of devices; remove it. + self.BKPlayerSelected = None + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + sendToField.setString(" ") + sendToButton.hide() + + #~~~~~~~~~~# + # Settings # + #~~~~~~~~~~# + + ## Refresh the KI configuration settings to match the current values. + def RefreshKISettings(self): + + fontSizeSlider = ptGUIControlKnob(KISettings.dialog.getControlFromTag(kGUI.BKIKIFontSize)) + fontSize = self.GetFontSize() + # Find font size in font table. + whichFont = 0 + for fs in kChat.FontSizeList: + if fontSize <= fs: + break + whichFont += 1 + if whichFont >= len(kChat.FontSizeList): + whichFont = len(kChat.FontSizeList) - 1 + slidePerFont = float(fontSizeSlider.getMax() - fontSizeSlider.getMin() + 1.0) / float(len(kChat.FontSizeList)) + FSslider = int(slidePerFont * whichFont + 0.25) + fontSizeSlider.setValue(FSslider) + + fadeTimeSlider = ptGUIControlKnob(KISettings.dialog.getControlFromTag(kGUI.BKIKIFadeTime)) + slidePerTime = float(fadeTimeSlider.getMax() - fadeTimeSlider.getMin()) / float(kChat.FadeTimeMax) + if not self.chatMgr.fadeEnableFlag: + self.chatMgr.ticksOnFull = kChat.FadeTimeMax + FTslider = slidePerTime * self.chatMgr.ticksOnFull + fadeTimeSlider.setValue(FTslider) + + onlyPMCheckbox = ptGUIControlCheckBox(KISettings.dialog.getControlFromTag(kGUI.BKIKIOnlyPM)) + onlyPMCheckbox.setChecked(self.onlyGetPMsFromBuddies) + + ## Refresh the volume settings to match the current values. + def RefreshVolumeSettings(self): + + audio = ptAudioControl() + soundFX = ptGUIControlValue(KIVolumeExpanded.dialog.getControlFromTag(kGUI.BKISoundFXVolSlider)) + setting = audio.getSoundFXVolume() + soundFX.setValue(setting * 10) + + music = ptGUIControlValue(KIVolumeExpanded.dialog.getControlFromTag(kGUI.BKIMusicVolSlider)) + setting = audio.getMusicVolume() + music.setValue(setting * 10) + + voice = ptGUIControlValue(KIVolumeExpanded.dialog.getControlFromTag(kGUI.BKIVoiceVolSlider)) + setting = audio.getVoiceVolume() + voice.setValue(setting * 10) + + ambience = ptGUIControlValue(KIVolumeExpanded.dialog.getControlFromTag(kGUI.BKIAmbienceVolSlider)) + setting = audio.getAmbienceVolume() + ambience.setValue(setting * 10) + + miclevel = ptGUIControlValue(KIVolumeExpanded.dialog.getControlFromTag(kGUI.BKIMicLevelSlider)) + setting = audio.getMicLevel() + miclevel.setValue(setting * 10) + + guivolume = ptGUIControlValue(KIVolumeExpanded.dialog.getControlFromTag(kGUI.BKIGUIVolSlider)) + setting = audio.getGUIVolume() + guivolume.setValue(setting * 10) + + ## Refresh the Age Owner settings to match the current values. + def RefreshAgeOwnerSettings(self): + + # Is it actually going to display, or is it just an update? + if BigKI.dialog.isEnabled() and self.BKRightSideMode == kGUI.BKAgeOwnerExpanded: + try: + # Get the selected Age config setting. + myAge = self.BKConfigFolderDict[self.BKConfigListOrder[self.BKFolderSelected]] + except LookupError: + myAge = None + if myAge is not None: + title = ptGUIControlTextBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleTB)) + title.setString(GetAgeName(myAge)) + titlebtn = ptGUIControlButton(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleBtn)) + titlebtn.enable() + titleEdit = ptGUIControlEditBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleEditbox)) + titleEdit.hide() + status = ptGUIControlTextBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerStatusTB)) + visitors = myAge.getCanVisitFolder() + owners = myAge.getAgeOwnersFolder() + numvisitors = visitors.getChildNodeCount() + numowners = owners.getChildNodeCount() + vsess = "s" + if numvisitors == 1: + vsess = "" + osess = "s" + if numowners == 1: + osess = "" + + # For now, Ages can be made public/private only through the Nexus. + makepublicTB = ptGUIControlTextBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerMakePublicTB)) + makepublicBtn = ptGUIControlButton(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerMakePublicBtn)) + makepublicBtn.disable() + makepublicTB.hide() + makepublicTB.setString(" ") + status.setStringW(PtGetLocalizedString("KI.Neighborhood.AgeOwnedStatus", [str(numowners), str(osess), str(numvisitors), str(vsess)])) + descript = ptGUIControlMultiLineEdit(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerDescription)) + encoded = buffer(myAge.getAgeDescription()) + descript.setEncodedBuffer(encoded) + + #~~~~~~~~# + # miniKI # + #~~~~~~~~# + + ## Refresh the display of the miniKI indicator bars. + def RefreshMiniKIMarkerDisplay(self): + + PtDebugPrint(u"xKI.RefreshMiniKIMarkerDisplay(): Refreshing {}:{}.".format(self.gMarkerGottenNumber, self.gMarkerToGetNumber), level=kDebugDumpLevel) + if self.KILevel > kMicroKI: + if self.gMarkerGottenNumber == self.gMarkerToGetNumber and (self.gMarkerToGetNumber % 25) == 0: + xMyMaxMarkers = self.gMarkerToGetNumber + xMyGotMarkers = self.gMarkerGottenNumber + else: + xMyGotMarkers = self.gMarkerGottenNumber % 25 + if self.gMarkerGottenNumber >= math.floor((self.gMarkerToGetNumber / 25)) * 25: + xMyMaxMarkers = self.gMarkerToGetNumber % 25 + else: + xMyMaxMarkers = 25 + for mcbID in range(kGUI.miniMarkerIndicator01, kGUI.miniMarkerIndicatorLast + 1): + mcb = ptGUIControlProgress(KIMini.dialog.getControlFromTag(mcbID)) + markerNumber = mcbID - kGUI.miniMarkerIndicator01 + 1 + try: + if not self.gKIMarkerLevel or markerNumber > xMyMaxMarkers: + mcb.setValue(kGUI.miniMarkerColors["off"]) + elif markerNumber <= xMyMaxMarkers and markerNumber > xMyGotMarkers: + mcb.setValue(kGUI.miniMarkerColors[self.gMarkerToGetColor]) + else: + mcb.setValue(kGUI.miniMarkerColors[self.gMarkerGottenColor]) + except LookupError: + PtDebugPrint(u"xKI.RefreshMiniKIMarkerDisplay(): Couldn't find color, defaulting to off.", level=kWarningLevel) + mcb.setValue(kGUI.miniMarkerColors["off"]) + btnmtDrip = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniGZDrip)) + btnmtActive = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniGZActive)) + btnmtPlaying = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniGZMarkerGameActive)) + btnmtInRange = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniGZMarkerInRange)) + btnmgNewMarker = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniMGNewMarker)) + btnmgNewGame = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniMGNewGame)) + btnmgInactive = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniMGInactive)) + + if self.gKIMarkerLevel: + btnmtDrip.hide() + if self.gMarkerToGetNumber > self.gMarkerGottenNumber: + if self.gGZMarkerInRange: + btnmtInRange.show() + btnmtPlaying.hide() + btnmtActive.hide() + else: + btnmtInRange.hide() + btnmtPlaying.show() + btnmtActive.hide() + else: + btnmtPlaying.hide() + btnmtInRange.hide() + btnmtActive.show() + else: + btnmtDrip.hide() + btnmtActive.hide() + btnmtPlaying.hide() + btnmtInRange.hide() + + # Should the Marker Game GUI be displayed? + if self.gKIMarkerLevel >= kKIMarkerNormalLevel and not self.markerGameManager.is_cgz: + btnmtDrip.hide() + btnmtActive.hide() + btnmtPlaying.hide() + btnmtInRange.hide() + try: + showMarkers = self.markerGameManager.markers_visible + except: + showMarkers = False + try: + selectedMarker = self.markerGameManager.selected_marker_id + except : + selectedMarker = -1 + if self.markerGameManager.playing: + btnmgNewMarker.hide() + btnmgNewGame.hide() + btnmgInactive.show() + elif showMarkers and selectedMarker < 0: + btnmgNewMarker.show() + btnmgNewGame.hide() + btnmgInactive.hide() + else: + btnmgNewMarker.hide() + btnmgNewGame.show() + btnmgInactive.hide() + else: + btnmgNewMarker.hide() + btnmgNewGame.hide() + btnmgInactive.hide() + + ## Toggle between the miniKI and the BigKI. + def ToggleKISize(self): + + if self.KILevel > kMicroKI and (not self.KIDisabled or BigKI.dialog.isEnabled()): + if self.KIDisabled and BigKI.dialog.isEnabled(): + self.ToggleMiniKI() + return + if not self.waitingForAnimation: + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + if BigKI.dialog.isEnabled(): + self.HideBigKI() + # Can't be chatting. + self.chatMgr.ToggleChatMode(0) + KIBlackbar.dialog.show() + if self.lastminiKICenter is not None: + dragbar = ptGUIControlDragBar(KIMini.dialog.getControlFromTag(kGUI.miniDragBar)) + dragbar.setObjectCenter(self.lastminiKICenter) + dragbar.unanchor() + self.lastminiKICenter = None + # Refresh the player list, because it will be the shorter version. + self.RefreshPlayerList(True) + toggleCB.setChecked(0) + else: + # If there is nothing showing, just bring up the miniKI. + if not KIMini.dialog.isEnabled(): + self.chatMgr.ClearBBMini(0) + # Bring up the BigKI, then the miniKI. + else: + self.waitingForAnimation = True + KIBlackbar.dialog.hide() + KIMini.dialog.hide() + # Can't be chatting. + self.chatMgr.ToggleChatMode(0) + # Show the BigKI. + BigKI.dialog.show() + # Save current location and snap back to original. + if self.originalminiKICenter is not None: + dragbar = ptGUIControlDragBar(KIMini.dialog.getControlFromTag(kGUI.miniDragBar)) + self.lastminiKICenter = dragbar.getObjectCenter() + PtDebugPrint(u"xKI.ToggleKISize(): Distance to original = {}.".format(self.lastminiKICenter.distance(self.originalminiKICenter)), level=kDebugDumpLevel) + # If they are close, then snap it to original. + if self.lastminiKICenter.distance(self.originalminiKICenter) < 0.027: + self.lastminiKICenter = self.originalminiKICenter + dragbar.setObjectCenter(self.originalminiKICenter) + dragbar.anchor() + KIMini.dialog.show() + toggleCB.setChecked(1) + + ## Put away the miniKI (and the BigKI, if up). + def ToggleMiniKI(self, forceOpen = 0): + + if self.KILevel > kMicroKI and (not self.KIDisabled or KIMini.dialog.isEnabled()): + if KIMini.dialog.isEnabled(): + KIMini.dialog.hide() + # Put the miniKI back where it used to be. + if self.lastminiKICenter is not None: + dragbar = ptGUIControlDragBar(KIMini.dialog.getControlFromTag(kGUI.miniDragBar)) + dragbar.setObjectCenter(self.lastminiKICenter) + dragbar.unanchor() + self.lastminiKICenter = None + if BigKI.dialog.isEnabled(): + self.HideBigKI() + KIBlackbar.dialog.show() + self.chatMgr.ClearBBMini(-1) + # Put the toggle button back to the miniKI setting. + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + toggleCB.setChecked(0) + self.sawTheKIAtleastOnce = True + else: + # If the miniKI is hidden, show it. + if forceOpen: + self.chatMgr.ClearBBMini(0) + + ## Take a screenshot through the miniKI. + def TakePicture(self): + + if not self.takingAPicture and not self.waitingForAnimation: + # Ignoring the KIDisabled flag here, because screenshots can be + # taken even with certain GUIs showing. + if self.KILevel > kMicroKI: + if self.CanTakePicture(): + self.takingAPicture = True + if not PtIsGUIModal(): + # Hide everything to take a picture. + KIBlackbar.dialog.hide() + KIMini.dialog.hide() + self.HideBigKIMode() + BigKI.dialog.hide() + # Put the toggle button back to BigKI. + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + toggleCB.setChecked(1) + # Wait a moment, then take the picture. + PtAtTimeCallback(self.key, 0.25, kTimers.TakeSnapShot) + else: + # Put up an error message. + self.ShowKIFullErrorMsg(PtGetLocalizedString("KI.Messages.FullImages")) + + ## Create a new Journal entry through the miniKI. + def MiniKICreateJournalNote(self): + + if self.takingAPicture or self.waitingForAnimation: + return + if self.KILevel > kMicroKI and not self.KIDisabled: + if self.CanMakeNote(): + KIBlackbar.dialog.hide() + # Put the toggle button back to BigKI. + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + toggleCB.setChecked(1) + # Create the actual journal entry. + self.BigKICreateJournalNote() + # Make sure that the player is in Journal mode. + modeselector = ptGUIControlRadioGroup(BigKI.dialog.getControlFromTag(kGUI.BKRadioModeID)) + modeselector.setValue(0) + # Set things up so that when the BigKI shows, it goes into edit mode. + if self.BKRightSideMode != kGUI.BKJournalExpanded: + self.HideBigKIMode() + self.BKRightSideMode = kGUI.BKJournalExpanded + # Reset the top line and selection. + self.BigKIRefreshFolderDisplay() + self.BigKIDisplayJournalEntry() + # Setup to edit the caption of the note. + self.BigKIEnterEditMode(kGUI.BKEditFieldJRNTitle) + if BigKI.dialog.isEnabled(): + self.ShowBigKIMode() + else: + # Put the miniKI on top. + KIMini.dialog.hide() + BigKI.dialog.show() + KIMini.dialog.show() + # Was just the miniKI showing? + if self.lastminiKICenter is None: + if self.originalminiKICenter is not None: + dragbar = ptGUIControlDragBar(KIMini.dialog.getControlFromTag(kGUI.miniDragBar)) + self.lastminiKICenter = dragbar.getObjectCenter() + dragbar.setObjectCenter(self.originalminiKICenter) + dragbar.anchor() + else: + # Put up an error message. + self.ShowKIFullErrorMsg(PtGetLocalizedString("KI.Messages.FullNotes")) + + #~~~~~~~# + # BigKI # + #~~~~~~~# + + ## Open up and show the BigKI. + def ShowBigKI(self): + + self.waitingForAnimation = True + curBrainMode = PtGetLocalAvatar().avatar.getCurrentMode() + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + toggleCB.disable() + if curBrainMode == PtBrainModes.kNonGeneric: + PtDebugPrint(u"xKI.ShowBigKI(): Entering LookingAtKI mode.", level=kDebugDumpLevel) + PtAvatarEnterLookingAtKI() + self.isPlayingLookingAtKIMode = True + PtDisableMovementKeys() + KIOnResp.run(self.key, netPropagate=0) + + ## Close and hide the BigKI. + def HideBigKI(self): + + self.waitingForAnimation = True + toggleCB = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniToggleBtnID)) + toggleCB.disable() + self.HideBigKIMode() + # Make sure the player was actually looking at the KI. + if self.isPlayingLookingAtKIMode: + PtDebugPrint(u"xKI.HideBigKI(): Leaving LookingAtKI mode.", level=kDebugDumpLevel) + PtAvatarExitLookingAtKI() + self.isPlayingLookingAtKIMode = False + PtEnableMovementKeys() + KIOffResp.run(self.key, netPropagate=0) + + ## Show a new mode inside the BigKI. + # This can be an expanded picture, a player entry, a list... + def ShowBigKIMode(self): + + if BigKI.dialog.isEnabled(): + # Hide up/down scroll buttons. + upbtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKLMUpButton)) + upbtn.hide() + dwnbtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKLMDownButton)) + dwnbtn.hide() + if self.BKRightSideMode == kGUI.BKListMode: + KIListModeDialog.dialog.show() + self.BigKIOnlySelectedToButtons() + self.BKCurrentContent = None + self.BKGettingPlayerID = False + elif self.BKRightSideMode == kGUI.BKJournalExpanded: + KIJournalExpanded.dialog.show() + if self.IsContentMutable(self.BKCurrentContent): + self.BigKIInvertToFolderButtons() + else: + self.BigKIOnlySelectedToButtons() + self.BKGettingPlayerID = False + elif self.BKRightSideMode == kGUI.BKPictureExpanded: + KIPictureExpanded.dialog.show() + if self.IsContentMutable(self.BKCurrentContent): + self.BigKIInvertToFolderButtons() + else: + self.BigKIOnlySelectedToButtons() + self.BKGettingPlayerID = False + elif self.BKRightSideMode == kGUI.BKPlayerExpanded: + KIPlayerExpanded.dialog.show() + # If the expanded player is ourselves, then no move buttons. + localPlayer = PtGetLocalPlayer() + if self.BKCurrentContent is not None: + if isinstance(self.BKCurrentContent, ptPlayer): + if self.BKCurrentContent.getPlayerID() == localPlayer.getPlayerID(): + self.BigKIOnlySelectedToButtons() + return + # Otherwise assume that it's a plVaultNodeRef. + else: + elem = self.BKCurrentContent.getChild() + if elem.getType() == PtVaultNodeTypes.kPlayerInfoNode: + elem = elem.upcastToPlayerInfoNode() + if elem.playerGetID() == localPlayer.getPlayerID(): + self.BigKIOnlySelectedToButtons() + return + self.BigKIInvertToFolderButtons() + elif self.BKRightSideMode == kGUI.BKVolumeExpanded: + KIVolumeExpanded.dialog.show() + self.BigKIOnlySelectedToButtons() + self.BKCurrentContent = None + self.BKGettingPlayerID = False + elif self.BKRightSideMode == kGUI.BKKIExpanded: + KISettings.dialog.show() + self.BigKIOnlySelectedToButtons() + self.BKCurrentContent = None + self.BKGettingPlayerID = False + elif self.BKRightSideMode == kGUI.BKAgeOwnerExpanded: + KIAgeOwnerExpanded.dialog.show() + self.BigKIOnlySelectedToButtons() + self.BKCurrentContent = None + self.BKGettingPlayerID = False + elif self.BKRightSideMode == kGUI.BKMarkerListExpanded: + KIMarkerFolderExpanded.dialog.show() + if self.IsContentMutable(self.BKCurrentContent): + self.BigKIInvertToFolderButtons() + else: + self.BigKIOnlySelectedToButtons() + self.BKGettingPlayerID = False + + ## Hide an open mode in the BigKI. + def HideBigKIMode(self): + + if self.BKRightSideMode == kGUI.BKListMode: + KIListModeDialog.dialog.hide() + elif self.BKRightSideMode == kGUI.BKJournalExpanded: + KIJournalExpanded.dialog.hide() + elif self.BKRightSideMode == kGUI.BKPictureExpanded: + KIPictureExpanded.dialog.hide() + elif self.BKRightSideMode == kGUI.BKPlayerExpanded: + KIPlayerExpanded.dialog.hide() + elif self.BKRightSideMode == kGUI.BKVolumeExpanded: + KIVolumeExpanded.dialog.hide() + elif self.BKRightSideMode == kGUI.BKKIExpanded: + KISettings.dialog.hide() + elif self.BKRightSideMode == kGUI.BKAgeOwnerExpanded: + KIAgeOwnerExpanded.dialog.hide() + elif self.BKRightSideMode == kGUI.BKMarkerListExpanded: + KIMarkerFolderExpanded.dialog.hide() + + ## Switch to a new mode in the BigKI. + # This hides the old mode and displays the new one, or just refreshes + # the content list if it's a selection change. + def ChangeBigKIMode(self, newMode): + + # Is the player switching to a new mode? + if newMode != self.BKRightSideMode: + self.HideBigKIMode() + self.BKRightSideMode = newMode + self.ShowBigKIMode() + # Or is he changing the selection? + elif newMode == kGUI.BKListMode: + self.BigKIOnlySelectedToButtons() + + ## Set the SendTo buttons appropriately. + # This will set all the little glowing arrows next to items in accordance + # with the currently displayed mode. + def SetBigKIToButtons(self): + + if self.BKRightSideMode == kGUI.BKListMode: + self.BigKIOnlySelectedToButtons() + elif self.BKRightSideMode == kGUI.BKJournalExpanded: + if self.IsContentMutable(self.BKCurrentContent): + self.BigKIInvertToFolderButtons() + else: + self.BigKIOnlySelectedToButtons() + elif self.BKRightSideMode == kGUI.BKPictureExpanded: + if self.IsContentMutable(self.BKCurrentContent): + self.BigKIInvertToFolderButtons() + else: + self.BigKIOnlySelectedToButtons() + elif self.BKRightSideMode == kGUI.BKPlayerExpanded: + localPlayer = PtGetLocalPlayer() + if self.BKCurrentContent is not None: + if isinstance(self.BKCurrentContent, ptPlayer): + if self.BKCurrentContent.getPlayerID() == localPlayer.getPlayerID(): + self.BigKIOnlySelectedToButtons() + return + # Otherwise assume that it's a plVaultNodeRef. + else: + elem = self.BKCurrentContent.getChild() + if elem.getType() == PtVaultNodeTypes.kPlayerInfoNode: + elem = elem.upcastToPlayerInfoNode() + if elem.playerGetID() == localPlayer.getPlayerID(): + self.BigKIOnlySelectedToButtons() + return + self.BigKIInvertToFolderButtons() + elif self.BKRightSideMode == kGUI.BKVolumeExpanded: + self.BigKIOnlySelectedToButtons() + elif self.BKRightSideMode == kGUI.BKKIExpanded: + self.BigKIOnlySelectedToButtons() + elif self.BKRightSideMode == kGUI.BKAgeOwnerExpanded: + self.BigKIOnlySelectedToButtons() + elif self.BKRightSideMode == kGUI.BKMarkerListExpanded: + if self.MFdialogMode not in (kGames.MFEditing, kGames.MFEditingMarker) and self.IsContentMutable(self.BKCurrentContent): + self.BigKIInvertToFolderButtons() + else: + self.BigKIOnlySelectedToButtons() + + ## Show only the selected SendTo buttons. + def BigKIOnlySelectedToButtons(self): + + toPlayerBtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKIToPlayerButton)) + toPlayerBtn.hide() + self.BigKIRefreshFolderDisplay() + # Hide all the buttons. + for ID in range(kGUI.BKIToIncomingButton, kGUI.BKIToFolderButtonLast + 1): + toFolder = ptGUIControlButton(BigKI.dialog.getControlFromTag(ID)) + toFolder.hide() + self.BigKINewContentList() + + ## Determines if the selected content can be sent to someone. + def BigKICanShowSendToPlayer(self): + + # Make sure that there is a selected player. + if self.BKPlayerSelected is None: + return False + + # Make sure that it's something that can be sent to a player. + if self.BKRightSideMode == kGUI.BKPlayerExpanded or self.BKRightSideMode == kGUI.BKVolumeExpanded or self.BKRightSideMode == kGUI.BKAgeOwnerExpanded: + return False + + # Make sure that it's not the player. + if isinstance(self.BKPlayerSelected, ptVaultNodeRef): + plyrElement = self.BKPlayerSelected.getChild() + if plyrElement is not None and plyrElement.getType() == PtVaultNodeTypes.kPlayerInfoNode: + plyrElement = plyrElement.upcastToPlayerInfoNode() + if plyrElement.playerGetID() == PtGetLocalClientID(): + return False + + return True + + ## Hides or shows the ToPlayer buttons. + def BigKIInvertToFolderButtons(self): + + # Setup ToPlayer button. + toPlayerBtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKIToPlayerButton)) + if self.BigKICanShowSendToPlayer(): + toPlayerBtn.show() + else: + toPlayerBtn.hide() + + # Add the ToPlayer button to the elements. + selectedButton = self.BKFolderSelected - self.BKFolderTopLine + kGUI.BKIToIncomingButton + for ID in range(kGUI.BKIToIncomingButton, kGUI.BKIToFolderButtonLast + 1): + toFolder = ptGUIControlButton(BigKI.dialog.getControlFromTag(ID)) + if ID == selectedButton: + toFolder.hide() + else: + # Don't show on elements that are not there or immutable. + if ID - kGUI.BKIToIncomingButton <= len(self.BKFolderListOrder) - 1 - self.BKFolderTopLine: + try: + if self.IsFolderContentMutable(self.BKFolderLineDict[self.BKFolderListOrder[ID - kGUI.BKIToIncomingButton + self.BKFolderTopLine]]): + toFolder.show() + else: + toFolder.hide() + except LookupError: + toFolder.hide() + else: + toFolder.hide() + + ## Check incoming content for the sender, and set the SendTo field. + def CheckContentForSender(self, content): + + folder = content.getParent() + if folder: + folder = folder.upcastToFolderNode() + if folder is not None and folder.folderGetType() == PtVaultStandardNodes.kInboxFolder: + sender = content.getSaver() + if sender is not None and sender.getType() == PtVaultNodeTypes.kPlayerInfoNode: + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + curSendTo = sendToField.getString().strip() + if not curSendTo: + self.BKPlayerSelected = sender + sendToField.setString(sender.playerGetName()) + + #~~~~~~~~~~~~~~~# + # BigKI Content # + #~~~~~~~~~~~~~~~# + + ## Determines whether the specified folder can be modified. + def IsFolderContentMutable(self, folder): + + # Make sure there is a real folder there to play with. + if folder is None or not isinstance(folder, ptVaultNode): + return False + + # If it's not really a folder but an AgeInfoNode, then it's for the canVisit player list. + if folder.getType() == PtVaultNodeTypes.kAgeInfoNode: + return True + + if folder.getType() != PtVaultNodeTypes.kPlayerInfoListNode and folder.getType() != PtVaultNodeTypes.kFolderNode: + return False + + # Check for the incoming folder. + if folder.folderGetType() == PtVaultStandardNodes.kInboxFolder: + return False + + # Check against the AgeMembers folder. + if folder.folderGetType() == PtVaultStandardNodes.kAgeMembersFolder: + return False + + # Check for the neighborhood members folder. + if folder.folderGetType() == PtVaultStandardNodes.kHoodMembersFolder: + return False + + # Oh hayll no, you can't change AllPlayers + if folder.folderGetType() == PtVaultStandardNodes.kAllPlayersFolder: + return False + + # Check for neighborhood CanVisit folder (actually half-mutable, they can delete). + if folder.folderGetType() == PtVaultStandardNodes.kAgeOwnersFolder: + return False + + # It's not a special folder, so it's mutable. + return True + + ## Determines whether this is a hidden folder. + def IsFolderHidden(self, ageFolder): + + if ageFolder.folderGetName() == "Hidden": + return True + return False + + ## Determines whether the content Node Reference is mutable. + def IsContentMutable(self, nodeRef): + + # Get its parent folder. + if isinstance(nodeRef, ptVaultNodeRef): + folder = self.BKCurrentContent.getParent() + if folder: + folder = folder.upcastToFolderNode() + if folder: + if folder.folderGetType() == PtVaultStandardNodes.kGlobalInboxFolder: + return False + return True + + #~~~~~~~~~~~~~~# + # BigKI Values # + #~~~~~~~~~~~~~~# + + ## Sets some global values for the KI should never change. + def BigKISetStatics(self): + + ageText = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKICurAgeNameID)) + ageName = GetAgeName().replace("(null)", "").strip() + PtDebugPrint(u"xKI.BigKISetStatics(): Displaying age name of {}.".format(ageName), level=kDebugDumpLevel) + ageText.setStringW(ageName) + playerText = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKPlayerName)) + IDText = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKPlayerID)) + localPlayer = PtGetLocalPlayer() + playerText.setString(localPlayer.getPlayerName()) + IDText.setString("[ID:{:08d}]".format(localPlayer.getPlayerID())) + self.UpdatePelletScore() + self.BigKIRefreshHoodStatics() + + ## Sets some Neighborhood-specific values for the KI that won't change. + def BigKIRefreshHoodStatics(self, neighborhood=None): + + neighborText = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKNeighborhoodAndID)) + # If a neighborhood was not specified, get the one from the player's Vault. + if not neighborhood: + neighborhood = GetNeighborhood() + if neighborhood is not None: + neighborName = xLocTools.LocalizeAgeName(neighborhood.getDisplayName()) + if neighborName == U"": + neighborName = PtGetLocalizedString("KI.Neighborhood.NoName") + neighborText.setStringW(PtGetLocalizedString("KI.Neighborhood.BottomLine", [xLocTools.MemberStatusString(), neighborName])) + else: + neighborText.setStringW(PtGetLocalizedString("KI.Neighborhood.None")) + + ## Sets some global changing values for the KI. + def BigKISetChanging(self): + + # Use the D'ni time for this Age. + dniTime = PtGetDniTime() + if dniTime: + tupTime = time.gmtime(dniTime) + if self.timeBlinker: + curTime = unicode(time.strftime(PtGetLocalizedString("Global.Formats.DateTime"), tupTime)) + self.timeBlinker = False + else: + curTime = unicode(time.strftime(PtGetLocalizedString("Global.Formats.DateTime"), tupTime)) + self.timeBlinker = True + else: + curTime = PtGetLocalizedString("KI.Errors.TimeBroke") + if curTime != self.previousTime: + timeText = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKICurTimeID)) + timeText.setStringW(curTime) + self.previousTime = curTime + # Set the D'ni GPS coordinates. + gps1 = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIGPS1TextID)) + gps2 = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIGPS2TextID)) + gps3 = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIGPS3TextID)) + self.dniCoords.update() + if self.gKIMarkerLevel == kKIMarkerNormalLevel: + sdl = xPsnlVaultSDL() + if sdl["GPSEnabled"][0]: + gps1.setString(str(self.dniCoords.getTorans())) + gps2.setString(str(self.dniCoords.getHSpans())) + gps3.setString(str(self.dniCoords.getVSpans())) + else: + gps1.setString("0") + gps2.setString("0") + gps3.setString("0") + else: + gps1.setString("0") + gps2.setString("0") + gps3.setString("0") + PtAtTimeCallback(self.key, 5, kTimers.BKITODCheck) + + #~~~~~~~~~~~~~~~~~~# + # BigKI Refreshing # + #~~~~~~~~~~~~~~~~~~# + + ## Check to see if a folder needs to be refreshed. + def BigKICheckFolderRefresh(self, folder=None): + + if folder is not None: + if folder.getType() == PtVaultNodeTypes.kPlayerInfoListNode: + self.RefreshPlayerList() + # Otherwise, check everything just in case. + else: + self.RefreshPlayerList() + # Check content refresh only if using the BigKI. + if self.KILevel > kMicroKI: + self.BigKIRefreshContentList() + self.BigKIRefreshContentListDisplay() + + ## Check to see if the current content has changed since. + def BigKICheckContentRefresh(self, content): + + if self.BKCurrentContent is not None and content == self.BKCurrentContent: + if self.BKRightSideMode == kGUI.BKListMode: + self.BigKIRefreshContentListDisplay() + elif self.BKRightSideMode == kGUI.BKJournalExpanded: + self.BigKIDisplayJournalEntry() + elif self.BKRightSideMode == kGUI.BKPictureExpanded: + self.BigKIDisplayPicture() + elif self.BKRightSideMode == kGUI.BKPlayerExpanded: + self.BigKIDisplayPlayerEntry() + elif self.BKRightSideMode == kGUI.BKMarkerListExpanded: + self.BigKIDisplayMarkerGame() + + ## Check to see if the current content element has changed since. + def BigKICheckElementRefresh(self, element): + + if self.BKCurrentContent is not None: + if isinstance(self.BKCurrentContent,ptVaultNodeRef) and element == self.BKCurrentContent.getChild(): + if self.BKRightSideMode == kGUI.BKListMode: + self.BigKIRefreshContentListDisplay() + elif self.BKRightSideMode == kGUI.BKJournalExpanded: + self.BigKIDisplayJournalEntry() + elif self.BKRightSideMode == kGUI.BKPictureExpanded: + self.BigKIDisplayPicture() + elif self.BKRightSideMode == kGUI.BKPlayerExpanded: + self.BigKIDisplayPlayerEntry() + elif self.BKRightSideMode == kGUI.BKMarkerListExpanded: + self.BigKIDisplayMarkerGame() + + ## Refresh the list of folders for the Inbox and Age Journal folders. + def BigKIRefreshFolderList(self): + + # Remember selected and what position in the list the player is at. + vault = ptVault() + + # Get Journal folder information. + if xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kInboxFolder) not in self.BKJournalFolderDict: + inFolder = vault.getInbox() + if inFolder is not None: + self.BKJournalListOrder.insert(0, xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kInboxFolder)) + self.BKJournalFolderDict[xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kInboxFolder)] = inFolder + + # Get the Age Journal folders and add any new ones. + masterAgeFolder = vault.getAgeJournalsFolder() + if masterAgeFolder is not None: + ageFolderRefs = masterAgeFolder.getChildNodeRefList() + for ageFolderRef in ageFolderRefs: + ageFolder = ageFolderRef.getChild() + ageFolder = ageFolder.upcastToFolderNode() + if ageFolder is not None: + if not self.IsFolderHidden(ageFolder): + ageFolderName = ageFolder.folderGetName() + if ageFolderName == "": + ageFolderName = "[invalid]" + ageFolderName = FilterAgeName(ageFolderName) + if ageFolderName in kAges.Hide: + continue + if ageFolderName not in self.BKJournalFolderDict: + # New Age folder, add it. + self.BKJournalListOrder.append(ageFolderName) + self.BKJournalFolderDict[ageFolderName] = ageFolder + # Make sure the current Age is at the top of the list. + try: + line = self.BKJournalListOrder.index(self.GetAgeInstanceName()) + if line != 1: + # It's not at the top of the list, so put it at the top. + self.BKJournalListOrder.remove(self.GetAgeInstanceName()) + self.BKJournalListOrder.insert(1, self.GetAgeInstanceName()) + # If the player is looking at a Journal entry then switch to list mode. + if self.BKRightSideMode == kGUI.BKJournalExpanded or self.BKRightSideMode == kGUI.BKPictureExpanded or self.BKRightSideMode == kGUI.BKMarkerListExpanded: + self.ChangeBigKIMode(kGUI.BKListMode) + except ValueError: + # Create a folder for most Ages. + ageName = self.GetAgeFileName().lower() + if ageName != "startup" and ageName != "avatarcustomization" and ageName != "unknown age" and self.GetAgeInstanceName() != "?unknown?": + entry = vault.findChronicleEntry("CleftSolved") + cleftSolved = False + if entry is not None: + if entry.chronicleGetValue() == "yes": + cleftSolved = True + if self.GetAgeInstanceName() != "D'ni-Riltagamin" or cleftSolved: + instAgeName = self.GetAgeInstanceName() + createAgeFolder = True + + ageFolderRefs = masterAgeFolder.getChildNodeRefList() + for ageFolderRef in ageFolderRefs: + ageFolder = ageFolderRef.getChild() + ageFolder = ageFolder.upcastToFolderNode() + if ageFolder is not None and ageFolder.getFolderNameW() == instAgeName: + createAgeFolder = False + break + + if instAgeName and createAgeFolder: + nFolder = ptVaultFolderNode(0) + if nFolder is not None: + nFolder.setFolderNameW(self.GetAgeInstanceName()) + nFolder.folderSetType(PtVaultStandardNodes.kAgeTypeJournalFolder) + # Add to the master Age folder folder. + masterAgeFolder.addNode(nFolder) + else: + PtDebugPrint(u"xKI.BigKIRefreshFolderList(): Could not create folder for {}.".format(self.GetAgeInstanceName()), level=kErrorLevel) + else: + PtDebugPrint(u"xKI.BigKIRefreshFolderList(): Could not find the Master Age jounal folder.", level=kErrorLevel) + + # Get the player lists. + self.BKPlayerFolderDict.clear() + self.BKPlayerListOrder = [] + + ageMembers = KIFolder(PtVaultStandardNodes.kAgeMembersFolder) + if ageMembers is not None: + if xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kAgeMembersFolder) not in self.BKPlayerFolderDict: + # Add the new player folder. + self.BKPlayerListOrder.append(xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kAgeMembersFolder)) + self.BKPlayerFolderDict[xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kAgeMembersFolder)] = ageMembers + PtDebugPrint(u"xKI.BigKIRefreshFolderList(): Updating ageMembers.", level=kDebugDumpLevel) + else: + PtDebugPrint(u"xKI.BigKIRefreshFolderList(): AgeMembers folder is missing.", level=kWarningLevel) + + buddies = vault.getBuddyListFolder() + if buddies is not None: + if xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kBuddyListFolder) not in self.BKPlayerFolderDict: + # Add the new player folder. + self.BKPlayerListOrder.append(xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kBuddyListFolder)) + self.BKPlayerFolderDict[xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kBuddyListFolder)] = buddies + else: + PtDebugPrint(u"xKI.BigKIRefreshFolderList(): Buddies folder is missing.", level=kWarningLevel) + + # Update the neighborhood folder. + self.BigKIRefreshNeighborFolder() + + # Update the Recent people folder. + PIKA = vault.getPeopleIKnowAboutFolder() + if PIKA is not None: + if xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kPeopleIKnowAboutFolder) not in self.BKPlayerFolderDict: + # Add the new player folder. + self.BKPlayerListOrder.append(xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kPeopleIKnowAboutFolder)) + self.BKPlayerFolderDict[xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kPeopleIKnowAboutFolder)] = PIKA + else: + PtDebugPrint(u"xKI.BigKIRefreshFolderList(): PeopleIKnowAbout folder is missing.", level=kWarningLevel) + ignores = vault.getIgnoreListFolder() + if ignores is not None: + if xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kIgnoreListFolder) not in self.BKPlayerFolderDict: + # Add the new player folder. + self.BKPlayerListOrder.append(xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kIgnoreListFolder)) + self.BKPlayerFolderDict[xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kIgnoreListFolder)] = ignores + else: + PtDebugPrint(u"xKI.BigKIRefreshFolderList(): IgnoreList folder is missing.", level=kWarningLevel) + + # All Players + if PtIsInternalRelease(): + ap = vault.getAllPlayersFolder() + if ap: + name = xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kAllPlayersFolder) + if name not in self.BKPlayerFolderDict: + # Add the new player folder. + self.BKPlayerListOrder.append(name) + self.BKPlayerFolderDict[name] = ap + + # Age Visitors. + visSep = SeparatorFolder(PtGetLocalizedString("KI.Folders.VisLists")) + self.BKPlayerListOrder.append(visSep.name) + self.BKPlayerFolderDict[visSep.name] = visSep + self.BigKIRefreshAgeVisitorFolders() + + # Age Owners. + self.BigKIRefreshAgesOwnedFolder() + + ## Refresh the Neighbors folder. + def BigKIRefreshNeighborFolder(self): + + neighborhood = GetNeighborhood() + try: + neighbors = neighborhood.getAgeOwnersFolder() + if xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kHoodMembersFolder) not in self.BKPlayerFolderDict: + # Add the new Neighbors folder. + self.BKPlayerListOrder.append(xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kHoodMembersFolder)) + PtDebugPrint(u"xKI.BigKIRefreshNeighborFolder(): Got the neighbors player folder.", level=kDebugDumpLevel) + self.BKPlayerFolderDict[xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kHoodMembersFolder)] = neighbors + except AttributeError: + PtDebugPrint(u"xKI.BigKIRefreshNeighborFolder(): Neighbors folder is missing.", level=kWarningLevel) + + ## Refresh the Age Visitors folders for Ages the player owns. + def BigKIRefreshAgeVisitorFolders(self): + + vault = ptVault() + try: + myAgesFolder = vault.getAgesIOwnFolder() + listOfMyAgeLinks = myAgesFolder.getChildNodeRefList() + for myAgeLinkRef in listOfMyAgeLinks: + myAgeLink = myAgeLinkRef.getChild() + myAgeLink = myAgeLink.upcastToAgeLinkNode() + myAge = myAgeLink.getAgeInfo() + if myAge is not None: + if self.CanAgeInviteVistors(myAge, myAgeLink) and myAge.getAgeFilename() not in kAges.Hide: + PtDebugPrint(u"xKI.BigKIRefreshAgeVisitorFolders(): Refreshing visitor list for {}.".format(GetAgeName(myAge)), level=kDebugDumpLevel) + folderName = xCensor.xCensor(PtGetLocalizedString("KI.Config.OwnerVisitors", [GetAgeName(myAge)]), self.censorLevel) + if folderName not in self.BKPlayerFolderDict: + # Add the new Age Visitors folder. + PtDebugPrint(u"xKI.BigKIRefreshAgeVisitorFolders(): Adding visitor list for {}.".format(GetAgeName(myAge)), level=kDebugDumpLevel) + self.BKPlayerListOrder.append(folderName) + self.BKPlayerFolderDict[folderName] = myAge + else: + PtDebugPrint(u"xKI.BigKIRefreshAgeVisitorFolders(): Age info for {} is not ready yet.".format(myAgeLink.getUserDefinedName()), level=kErrorLevel) + except AttributeError: + PtDebugPrint(u"xKI.BigKIRefreshAgeVisitorFolders(): Error finding Age Visitors folder.", level=kErrorLevel) + + ## Refresh the configuration folder listing for owned Ages. + # This is currently only used for Neighborhoods. + def BigKIRefreshAgesOwnedFolder(self): + + # First, get rid of all the Age config entries, in case one of them got deleted. + self.BKConfigFolderDict.clear() + self.BKConfigListOrder = [] + for config in self.BKConfigDefaultListOrder: + self.BKConfigListOrder.append(config) + vault = ptVault() + try: + myAgesFolder = vault.getAgesIOwnFolder() + listOfMyAgeLinks = myAgesFolder.getChildNodeRefList() + for myAgeLinkRef in listOfMyAgeLinks: + myAgeLink = myAgeLinkRef.getChild() + myAgeLink = myAgeLink.upcastToAgeLinkNode() + myAge = myAgeLink.getAgeInfo() + if myAge is not None: + if myAge.getAgeFilename() == "Neighborhood": + PtDebugPrint(u"xKI.BigKIRefreshAgesOwnedFolder(): Refreshing owner configuration for Age {}.".format(GetAgeName(myAge)), level=kDebugDumpLevel) + configName = xCensor.xCensor(PtGetLocalizedString("KI.Config.OwnerConfig", [GetAgeName(myAge)]), self.censorLevel) + if configName not in self.BKConfigFolderDict: + # Add the new Age configuration. + PtDebugPrint(u"xKI: adding owner config for Age {}.".format(GetAgeName(myAge)), level=kDebugDumpLevel) + self.BKConfigListOrder.append(configName) + self.BKConfigFolderDict[configName] = myAge + else: + PtDebugPrint(u"xKI.BigKIRefreshAgesOwnedFolder(): Age info for {} is not ready yet.".format(myAgeLink.getUserDefinedName()), level=kErrorLevel) + except AttributeError: + PtDebugPrint(u"xKI.BigKIRefreshAgesOwnedFolder(): Error finding Age folder.", level=kErrorLevel) + + ## Reget the contents of the selected content list. + def BigKINewContentList(self): + + try: + folderName = self.BKFolderListOrder[self.BKFolderSelected] + folder = self.BKFolderLineDict[folderName] + if folder is not None: + if isinstance(folder, ptVaultNode): + if folder.getType() == PtVaultNodeTypes.kAgeInfoNode: + try: + self.BKContentList = folder.getCanVisitFolder().getChildNodeRefList() + except AttributeError: + self.BKContentList = [] + else: + self.BKContentList = folder.getChildNodeRefList() + self.BigKIProcessContentList(True) + if self.BKFolderSelectChanged: + self.BKContentListTopLine = 0 + elif isinstance(folder, KIFolder): + self.BKContentList = PtGetPlayerListDistanceSorted() + self.BigKIProcessContentList(True) + if self.BKFolderSelectChanged: + self.BKContentListTopLine = 0 + else: + # Shouldn't happen because the player can't click on these. + self.BKContentList = [] + except (IndexError, KeyError): + self.BKContentList = [] + self.BigKIRefreshContentListDisplay() + + ## Refreshes the contents of the selected content list. + def BigKIRefreshContentList(self): + + try: + folderName = self.BKFolderListOrder[self.BKFolderSelected] + folder = self.BKFolderLineDict[folderName] + if folder is not None: + if isinstance(folder, ptVaultNode): + if folder.getType() == PtVaultNodeTypes.kAgeInfoNode: + try: + self.BKContentList = folder.getCanVisitFolder().getChildNodeRefList() + except AttributeError: + self.BKContentList = [] + else: + self.BKContentList = folder.getChildNodeRefList() + self.BigKIProcessContentList() + elif isinstance(folder, KIFolder): + self.BKContentList = PtGetPlayerListDistanceSorted() + self.BigKIProcessContentList() + else: + self.BKContentList = [] + except LookupError: + pass + + #~~~~~~~~~~~~~~~~~~~~~~~~~~# + # BigKI Display Refreshing # + #~~~~~~~~~~~~~~~~~~~~~~~~~~# + + ## Refresh the display of the folders and the selection. + def BigKIRefreshFolderDisplay(self): + + # Refresh the display of the folders. + ID = kGUI.BKIIncomingLine + if self.BKFolderListOrder: + # Make sure that it is a valid index. + if self.BKFolderTopLine >= len(self.BKFolderListOrder): + self.BKFolderTopLine = len(self.BKFolderListOrder) - 1 + # If the selected is off the screen, go to the top then (only in list mode). + ## @todo Note when the self.BKFolderSelected has changed, refresh the content display. + if self.BKRightSideMode == kGUI.BKListMode: + if self.BKFolderSelected < self.BKFolderTopLine: + self.BKFolderSelected = self.BKFolderTopLine + if self.BKFolderSelected > self.BKFolderTopLine + (kGUI.BKIFolderLineLast - kGUI.BKIIncomingLine): + self.BKFolderSelected = self.BKFolderTopLine + (kGUI.BKIFolderLineLast - kGUI.BKIIncomingLine) + if self.BKFolderSelected > self.BKFolderTopLine + len(self.BKFolderListOrder[self.BKFolderTopLine:]) - 1: + self.BKFolderSelected = self.BKFolderTopLine + len(self.BKFolderListOrder[self.BKFolderTopLine]) - 1 + selectedFolder = self.BKFolderSelected - self.BKFolderTopLine + kGUI.BKIIncomingLine + for folderName in self.BKFolderListOrder[self.BKFolderTopLine:]: + folderField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(ID)) + longFolderField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(ID + 500)) + buttonID = ID - kGUI.BKIFolderLine01+kGUI.BKIFolderLineBtn01 + folderButton = ptGUIControlButton(BigKI.dialog.getControlFromTag(buttonID)) + # Make sure it's not a separator folder. + if folderName in self.BKFolderLineDict and isinstance(self.BKFolderLineDict[folderName], SeparatorFolder): + # This button can't be clicked. + folderButton.hide() + folderField.setStringJustify(kLeftJustify) + folderField.setForeColor(kColors.DniStatic) + else: + folderButton.show() + folderField.setStringJustify(kRightJustify) + if ID == selectedFolder: + folderField.setForeColor(kColors.DniSelected) + longFolderField.setForeColor(kColors.DniSelected) + else: + folderField.setForeColor(kColors.DniSelectable) + longFolderField.setForeColor(kColors.DniSelectable) + folderField.setStringW(folderName) + longFolderField.setStringW(folderName) + ID += 1 + if ID > kGUI.BKIFolderLineLast: + break + # Set the up and down buttons, if needed. + upbtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKFolderUpLine)) + if self.BKFolderTopLine > 0: + upbtn.show() + else: + upbtn.hide() + dwnbtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKFolderDownLine)) + # Has the listbox been filled up? + if ID > kGUI.BKIFolderLineLast: + dwnbtn.show() + else: + dwnbtn.hide() + + # If there are more folder lines, fill them out to be blank and disable + # their button fields. + for tagID in range(ID, kGUI.BKIFolderLineLast + 1): + folderField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(tagID)) + folderField.setForeColor(kColors.DniSelectable) + folderField.setString(" ") + buttonID = tagID - kGUI.BKIFolderLine01 + kGUI.BKIFolderLineBtn01 + folderButton = ptGUIControlButton(BigKI.dialog.getControlFromTag(buttonID)) + folderButton.hide() + + ## Do some extra processing on the content list. + def BigKIProcessContentList(self, removeInboxStuff=False): + + # Start with nothing in the removeList (remove from current content list). + removeList = [] + # If it's a player list. + if self.BKFolderLineDict is self.BKPlayerFolderDict: + ignores = ptVault().getIgnoreListFolder() + # Make sure there are some players to process. + if len(self.BKContentList) > 0: + # If this is a ptPlayer. + if isinstance(self.BKContentList[0], ptPlayer): + # Sort the list of Age players. + try: + self.BKContentList.sort(lambda a, b: cmp(a.getPlayerName().lower(), b.getPlayerName().lower())) + except: + PtDebugPrint(u"xKI.BigKIProcessContentList(): Unable to sort Age players, but don't break the list.", level=kErrorLevel) + + for idx in range(len(self.BKContentList)): + player = self.BKContentList[idx] + if isinstance(player, ptPlayer): + if ignores.playerlistHasPlayer(player.getPlayerID()): + # Remove ignored player. + removeList.insert(0, idx) + else: + # Not a player, remove from the list. + removeList.insert(0, idx) + else: + # Sort the list of players, online first. + self.BKContentList.sort(CMPplayerOnline) + # Remove all the unnamed players and ignored people. + for idx in range(len(self.BKContentList)): + ref = self.BKContentList[idx] + elem = ref.getChild() + if elem is not None: + if elem.getType() == PtVaultNodeTypes.kPlayerInfoNode: + elem = elem.upcastToPlayerInfoNode() + if elem.playerGetName() == "": + # Put them in reverse order in the removeList. + removeList.insert(0, idx) + # Check if they are in the ignore list. + elif ignores.playerlistHasPlayer(elem.playerGetID()): + # Get parent; in some folders the player has to be still visible. + parent = ref.getParent() + if parent: + parent = parent.upcastToFolderNode() + if parent is None: + # Make sure this is not the IgnoreList. + if parent.folderGetType() != PtVaultStandardNodes.kIgnoreListFolder: + # Put in them in reverse order in the removeList. + removeList.insert(0, idx) + else: + removeList.insert(0, idx) + else: + removeList.insert(0, idx) + elif self.BKFolderListOrder[self.BKFolderSelected] == xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kInboxFolder): + # Look for KI-Mail from non-Buddies if the player only wants KI-Mail from Buddies. + vault = ptVault() + inbox = vault.getInbox() + buddies = vault.getBuddyListFolder() + ignores = vault.getIgnoreListFolder() + + for idx in range(len(self.BKContentList)): + ref = self.BKContentList[idx] + if ref is not None: + if ref.getSaver() is None or ref.getSaverID() == 0: + continue + + if (self.onlyGetPMsFromBuddies and not buddies.playerlistHasPlayer(ref.getSaverID())) or ignores.playerlistHasPlayer(ref.getSaverID()): + PtDebugPrint(u"xKI.BigKIProcessContentList(): Remove from inbox because it's from {}.".format(ref.getSaver().playerGetName()), level=kWarningLevel) + # Remove from the list. + removeList.insert(0, idx) + # Only remove from inbox if specified. + if removeInboxStuff: + PtDebugPrint(u"xKI.BigKIProcessContentList(): Really removed from inbox because it's from {}, this time.".format(ref.getSaver().playerGetName()), level=kWarningLevel) + # Remove from inbox (how will this work?). + element = ref.getChild() + inbox.removeNode(element) + if removeList: + PtDebugPrint(u"xKI.BigKIProcessContentList(): Removing {} contents from being displayed.".format(len(removeList)), level=kWarningLevel) + for removeidx in removeList: + del self.BKContentList[removeidx] + + if self.BKFolderListOrder[self.BKFolderSelected] == xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kInboxFolder): + self.BKContentList = self.markerJoinRequests + self.BKContentList + # Also add in the GlobalInbox stuff here. + vault = ptVault() + gInbox = vault.getGlobalInbox() + if gInbox is not None: + self.BKContentList = gInbox.getChildNodeRefList() + self.BKContentList + self.BKContentList.sort(CMPNodeDate) + + removeList = [] + for contentidx in range(len(self.BKContentList)): + content = self.BKContentList[contentidx] + if isinstance(content, ptVaultNodeRef): + element = content.getChild() + if element is not None: + if element.getType() == PtVaultNodeTypes.kFolderNode or element.getType() == PtVaultNodeTypes.kChronicleNode: + removeList.insert(0, contentidx) + for removeidx in removeList: + del self.BKContentList[removeidx] + + ## Refresh the display of the selected content list. + def BigKIRefreshContentListDisplay(self): + + if self.BKRightSideMode == kGUI.BKListMode: + createField = ptGUIControlTextBox(KIListModeDialog.dialog.getControlFromTag(kGUI.BKILMTitleCreateLine)) + createBtn = ptGUIControlButton(KIListModeDialog.dialog.getControlFromTag(kGUI.BKIListModeCreateBtn)) + try: + if self.BKFolderLineDict is self.BKPlayerFolderDict: + if self.BKFolderListOrder[self.BKFolderSelected] == xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kBuddyListFolder): + createField.setStringW(PtGetLocalizedString("KI.Player.CreateBuddyTitle")) + createBtn.show() + else: + createField.setString(" ") + createBtn.hide() + else: + createField.setString(" ") + createBtn.hide() + except IndexError: + createField.setString(" ") + createBtn.hide() + if len(self.BKFolderListOrder) != 0: + PtDebugPrint(u"xKI.BigKIRefreshContentListDisplay(): Index error: self.BKFolderSelected = {} and list = {}.".format(self.BKFolderSelected, self.BKFolderListOrder), level=kWarningLevel) + return + ID = kGUI.BKILMOffsetLine01 + if len(self.BKContentList) != 0: + if self.BKContentListTopLine >= len(self.BKContentList): + self.BKContentListTopLine = len(self.BKContentList) - 1 + for content in self.BKContentList[self.BKContentListTopLine:]: + if content is not None: + # Add the new line. + contentIconJ = ptGUIControlButton(KIListModeDialog.dialog.getControlFromTag(ID + kGUI.BKILMIconJournalOffset)) + contentIconAva = ptGUIControlButton(KIListModeDialog.dialog.getControlFromTag(ID + kGUI.BKILMIconPersonOffset)) + contentIconP = ptGUIControlDynamicText(KIListModeDialog.dialog.getControlFromTag(ID + kGUI.BKILMIconPictureOffset)) + contentTitle = ptGUIControlTextBox(KIListModeDialog.dialog.getControlFromTag(ID + kGUI.BKILMTitleOffset)) + contentDate = ptGUIControlTextBox(KIListModeDialog.dialog.getControlFromTag(ID + kGUI.BKILMDateOffset)) + contentFrom = ptGUIControlTextBox(KIListModeDialog.dialog.getControlFromTag(ID + kGUI.BKILMFromOffset)) + if isinstance(content, ptPlayer): + contentIconAva.show() + contentIconJ.hide() + contentIconP.hide() + contentTitle.setForeColor(kColors.DniSelectable) + contentTitle.setString(xCensor.xCensor(content.getPlayerName(), self.censorLevel)) + contentTitle.show() + contentDate.hide() + contentFrom.setForeColor(kColors.DniSelectable) + contentFrom.setFontSize(10) + contentFrom.setString(GetAgeName()) + contentFrom.show() + # Find the button to enable it. + lmButton = ptGUIControlButton(KIListModeDialog.dialog.getControlFromTag(((ID - 100) / 10) + kGUI.BKIListModeCreateBtn)) + lmButton.show() + ID += 10 + if ID > kGUI.BKILMOffsetLineLast: + break + else: + element = content.getChild() + if element is not None: + if element.getType() == PtVaultNodeTypes.kTextNoteNode: + element = element.upcastToTextNoteNode() + contentIconJ.show() + contentIconP.hide() + contentIconAva.hide() + elif element.getType() == PtVaultNodeTypes.kImageNode: + element = element.upcastToImageNode() + contentIconJ.hide() + contentIconAva.hide() + if contentIconP.getNumMaps() > 0: + dynMap = contentIconP.getMap(0) + image = element.imageGetImage() + dynMap.clearToColor(ptColor(.1, .1, .1, .1)) + if image is not None: + dynMap.drawImage(kGUI.BKIImageStartX, kGUI.BKIImageStartY, image, 0) + dynMap.flush() + contentIconP.show() + elif element.getType() == PtVaultNodeTypes.kPlayerInfoNode: + element = element.upcastToPlayerInfoNode() + contentIconAva.show() + contentIconJ.hide() + contentIconP.hide() + elif element.getType() == PtVaultNodeTypes.kMarkerGameNode: + element = element.upcastToMarkerGameNode() + # No icon for Marker Game. + contentIconAva.hide() + contentIconJ.hide() + contentIconP.hide() + elif element.getType() == PtVaultNodeTypes.kFolderNode: + continue + else: + contentIconAva.hide() + contentIconJ.hide() + contentIconP.hide() + if isinstance(element, ptVaultPlayerInfoNode): + # If it's a player, use the title for the player name. + contentTitle.setForeColor(kColors.DniSelectable) + contentTitle.setString(xCensor.xCensor(element.playerGetName(), self.censorLevel)) + contentTitle.show() + contentDate.hide() + contentFrom.setForeColor(kColors.DniSelectable) + contentFrom.setFontSize(10) + if element.playerIsOnline(): + contentFrom.setString(FilterAgeName(element.playerGetAgeInstanceName())) + else: + contentFrom.setString(" ") + contentFrom.show() + else: + # Otherwise it's an image or a text note. + if content.getSaverID() == 0: + # Must be from the DRC. + contentTitle.setForeColor(kColors.DniStatic) + contentDate.setForeColor(kColors.DniStatic) + else: + contentTitle.setForeColor(kColors.DniSelectable) + contentDate.setForeColor(kColors.DniSelectable) + + if isinstance(element, ptVaultImageNode): + contentTitle.setString(xCensor.xCensor(element.imageGetTitle(), self.censorLevel)) + elif isinstance(element, ptVaultTextNoteNode): + contentTitle.setString(xCensor.xCensor(element.noteGetTitle(), self.censorLevel)) + elif isinstance(element, ptVaultMarkerGameNode): + contentTitle.setString(xCensor.xCensor(element.getGameName(), self.censorLevel)) + else: + # Probably still downloading because of lag. + contentTitle.setString("--[Downloading]--") + contentTitle.setForeColor(kColors.DniYellow) + PtDebugPrint(u"xKI.BigKIRefreshContentListDisplay(): Unknown data type in content list: type = {}.".format(element.getType()), level=kErrorLevel) + contentTitle.show() + try: + tupTime = time.gmtime(PtGMTtoDniTime(element.getModifyTime())) + curTime = time.strftime(PtGetLocalizedString("Global.Formats.Date"), tupTime) + except: + curTime = "" + contentDate.setString(curTime) + contentDate.show() + sender = content.getSaver() + # See if the saver was the player. + localPlayer = PtGetLocalPlayer() + if sender is not None and localPlayer.getPlayerID() != sender.playerGetID(): + if content.getSaverID() == 0: + # Must be from the DRC. + contentFrom.setForeColor(kColors.DniStatic) + contentFrom.setFontSize(13) + contentFrom.setString("DRC") + else: + contentFrom.setForeColor(kColors.DniSelectable) + contentFrom.setFontSize(10) + contentFrom.setString(sender.playerGetName()) + contentFrom.show() + else: + if content.getSaverID() == 0: + # Must be from the DRC. + contentFrom.setString("DRC") + contentFrom.show() + else: + contentFrom.setString(" ") + contentFrom.hide() + # Find the button to enable it. + lmButton = ptGUIControlButton(KIListModeDialog.dialog.getControlFromTag(((ID - 100) / 10) + kGUI.BKIListModeCreateBtn)) + lmButton.show() + ID += 10 + if ID > kGUI.BKILMOffsetLineLast: + break + else: + PtDebugPrint(u"xKI.BigKIRefreshContentListDisplay: No element inside the content.", level=kErrorLevel) + else: + PtDebugPrint(u"xKI.BigKIRefreshContentListDisplay: No content, even though the folder said there was.", level=kErrorLevel) + # Set the up and down buttons if needed. + upBtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKLMUpButton)) + if self.BKContentListTopLine > 0: + upBtn.show() + else: + upBtn.hide() + dwnBtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKLMDownButton)) + # Has the ListBox been filled up? + if ID > kGUI.BKILMOffsetLineLast: + dwnBtn.show() + else: + dwnBtn.hide() + # If there are more content lines, fill them out to be blank + # and disable the button fields. + for tagID in range(ID,kGUI.BKILMOffsetLineLast + 10, 10): + iconPic = ptGUIControlDynamicText(KIListModeDialog.dialog.getControlFromTag(tagID + kGUI.BKILMIconPictureOffset)) + iconPic.hide() + iconJrn = ptGUIControlButton(KIListModeDialog.dialog.getControlFromTag(tagID + kGUI.BKILMIconJournalOffset)) + iconJrn.hide() + iconAva = ptGUIControlButton(KIListModeDialog.dialog.getControlFromTag(tagID + kGUI.BKILMIconPersonOffset)) + iconAva.hide() + titleField = ptGUIControlTextBox(KIListModeDialog.dialog.getControlFromTag(tagID + kGUI.BKILMTitleOffset)) + titleField.hide() + dateField = ptGUIControlTextBox(KIListModeDialog.dialog.getControlFromTag(tagID + kGUI.BKILMDateOffset)) + dateField.hide() + fromField = ptGUIControlTextBox(KIListModeDialog.dialog.getControlFromTag(tagID + kGUI.BKILMFromOffset)) + fromField.hide() + # Find the button to disable it. + lmButton = ptGUIControlButton(KIListModeDialog.dialog.getControlFromTag(((tagID - 100) / 10) + kGUI.BKIListModeCreateBtn)) + lmButton.hide() + + #~~~~~~~~~~~~~~~~~~~~~~~# + # BigKI Content Display # + #~~~~~~~~~~~~~~~~~~~~~~~# + + ## Display a text Journal entry in the KI. + def BigKIDisplayJournalEntry(self): + + jrnAgeName = ptGUIControlTextBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKIJRNAgeName)) + jrnAgeName.hide() + jrnDate = ptGUIControlTextBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKIJRNDate)) + jrnDate.hide() + jrnTitle = ptGUIControlTextBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKIJRNTitle)) + jrnTitle.hide() + jrnNote = ptGUIControlMultiLineEdit(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKIJRNNote)) + jrnNote.hide() + jrnNote.setBufferLimit(kLimits.JournalTextSize) + jrnDeleteBtn = ptGUIControlButton(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKIJRNDeleteButton)) + jrnDeleteBtn.hide() + jrnTitleBtn = ptGUIControlButton(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKIJRNTitleButton)) + if self.BKCurrentContent is None: + PtDebugPrint(u"xKI.BigKIDisplayJournalEntry(): self.BKCurrentContent is None.", level=kErrorLevel) + return + if self.IsContentMutable(self.BKCurrentContent): + jrnDeleteBtn.show() + jrnNote.unlock() + if not self.BKInEditMode or self.BKEditField != kGUI.BKEditFieldJRNTitle: + jrnTitleBtn.show() + else: + jrnNote.lock() + jrnTitleBtn.hide() + element = self.BKCurrentContent.getChild() + if element is None: + PtDebugPrint(u"xKI.BigKIDisplayJournalEntry(): Element is None.", level=kErrorLevel) + return + dataType = element.getType() + if dataType != PtVaultNodeTypes.kTextNoteNode: + PtDebugPrint(u"xKI.BigKIDisplayJournalEntry(): Wrong element type {}.".format(dataType), level=kErrorLevel) + return + element = element.upcastToTextNoteNode() + # Display the content on the screen. + jrnAgeName.setString(FilterAgeName(xCensor.xCensor(element.getCreateAgeName(), self.censorLevel))) + jrnAgeName.show() + tupTime = time.gmtime(PtGMTtoDniTime(element.getModifyTime())) + curTime = time.strftime(PtGetLocalizedString("Global.Formats.Date"), tupTime) + jrnDate.setString(curTime) + jrnDate.show() + if not self.BKInEditMode or self.BKEditField != kGUI.BKEditFieldJRNTitle: + jrnTitle.setString(xCensor.xCensor(element.noteGetTitle(), self.censorLevel)) + jrnTitle.show() + if not self.BKInEditMode or self.BKEditField != kGUI.BKEditFieldJRNNote: + encoded = buffer(xCensor.xCensor(element.noteGetText(), self.censorLevel)) + jrnNote.setEncodedBuffer(encoded) + jrnNote.show() + self.BigKISetSeen(self.BKCurrentContent) + # If it came from someone else, add them to the SendTo field. + self.CheckContentForSender(self.BKCurrentContent) + + ## Create and display a new note in the Journal. + def BigKICreateJournalNote(self): + + PtDebugPrint(u"xKI.BigKICreateJournalNote(): Create text note message.", level=kDebugDumpLevel) + # If there is no folder list, then make one. + if not self.BKFolderListOrder: + self.BigKIRefreshFolderList() + try: + journal = self.BKJournalFolderDict[self.GetAgeInstanceName()] + if journal is not None: + # Make sure that the age folder is selected. + self.BKFolderTopLine = self.BKJournalFolderTopLine = 0 # Scroll back to the top. + self.BKFolderSelected = self.BKJournalFolderSelected = self.BKJournalListOrder.index(self.GetAgeInstanceName()) + + # Create the note. + note = ptVaultTextNoteNode(0) + note.setTextW(PtGetLocalizedString("KI.Journal.InitialMessage")) + note.setTitleW(PtGetLocalizedString("KI.Journal.InitialTitle")) + + self.BKCurrentContent = journal.addNode(note) + return self.BKCurrentContent + else: + PtDebugPrint(u"xKI.BigKICreateJournalNote(): Journal not ready.", level=kErrorLevel) + return None + except KeyError: + PtDebugPrint(u"xKI.BigKICreateJournalNote(): Could not find journal for this Age: {}.".format(self.GetAgeInstanceName()), level=kErrorLevel) + + ## Display a KI Picture in the KI. + def BigKIDisplayPicture(self): + + picAgeName = ptGUIControlTextBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKIPICAgeName)) + picAgeName.hide() + picDate = ptGUIControlTextBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKIPICDate)) + picDate.hide() + picTitle = ptGUIControlTextBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKIPICTitle)) + picTitle.hide() + picImage = ptGUIControlDynamicText(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKIPICImage)) + picImage.hide() + picDeleteBtn = ptGUIControlButton(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKIPICDeleteButton)) + picDeleteBtn.hide() + picTitleBtn = ptGUIControlButton(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKIPICTitleButton)) + if self.BKCurrentContent is None: + PtDebugPrint(u"xKI.BigKIDisplayPicture(): self.BKCurrentContent is None.", level=kErrorLevel) + return + if self.IsContentMutable(self.BKCurrentContent): + picDeleteBtn.show() + if not self.BKInEditMode or self.BKEditField != kGUI.BKEditFieldPICTitle: + picTitleBtn.show() + else: + picTitleBtn.hide() + element = self.BKCurrentContent.getChild() + if element is None: + PtDebugPrint(u"xKI.BigKIDisplayPicture(): Element is None.", level=kErrorLevel) + return + dataType = element.getType() + if dataType != PtVaultNodeTypes.kImageNode: + PtDebugPrint(u"xKI.BigKIDisplayPicture(): Wrong element type {}.".format(dataType), level=kErrorLevel) + return + element = element.upcastToImageNode() + # Display the content on the screen. + picAgeName.setString(FilterAgeName(xCensor.xCensor(element.getCreateAgeName(), self.censorLevel))) + picAgeName.show() + tupTime = time.gmtime(PtGMTtoDniTime(element.getModifyTime())) + curTime = time.strftime(PtGetLocalizedString("Global.Formats.Date"), tupTime) + picDate.setString(curTime) + picDate.show() + if not self.BKInEditMode or self.BKEditField != kGUI.BKEditFieldPICTitle: + picTitle.setString(xCensor.xCensor(element.imageGetTitle(), self.censorLevel)) + picTitle.show() + if picImage.getNumMaps() > 0: + dynMap = picImage.getMap(0) + image = element.imageGetImage() + dynMap.clearToColor(ptColor(.1, .1, .1, .3)) + if image is not None: + dynMap.drawImage(kGUI.BKIImageStartX, kGUI.BKIImageStartY, image, 0) + else: + dynMap.fillRect(kGUI.BKIImageStartX, kGUI.BKIImageStartY, kGUI.BKIImageStartX + 800, kGUI.BKIImageStartY + 600, ptColor(.2, .2, .2, .1)) + dynMap.flush() + picImage.show() + self.BigKISetSeen(self.BKCurrentContent) + # If it came from someone else, add them to the SendTo field. + self.CheckContentForSender(self.BKCurrentContent) + + ## Create and display a new KI Picture in the Journal. + def BigKICreateJournalImage(self, image, useScreenShot=False): + + PtDebugPrint(u"xKI.BigKICreateJournalImage(): Create a KI Picture from {}.".format(image), level=kDebugDumpLevel) + # If there is no folder list, then make one. + if not self.BKFolderListOrder: + self.BigKIRefreshFolderList() + try: + journal = self.BKJournalFolderDict[self.GetAgeInstanceName()] + if journal is not None: + # Make sure that the age folder is selected. + self.BKFolderTopLine = self.BKJournalFolderTopLine = 0 # Scroll back to the top. + self.BKFolderSelected = self.BKJournalFolderSelected = self.BKJournalListOrder.index(self.GetAgeInstanceName()) + # Create the image entry. + imgElem = ptVaultImageNode(0) + if useScreenShot: + imgElem.setImageFromScrShot() + else: + imgElem.imageSetImage(image) + imgElem.setTitleW(PtGetLocalizedString("KI.Image.InitialTitle")) + self.BKCurrentContent = journal.addNode(imgElem) + return self.BKCurrentContent + else: + PtDebugPrint(u"xKI.BigKICreateJournalImage(): Journal not ready.", level=kErrorLevel) + return None + except KeyError: + PtDebugPrint(u"xKI.BigKICreateJournalImage(): Could not find journal for this Age: {}.".format(self.GetAgeInstanceName()), level=kErrorLevel) + + ## Display a player entry. + def BigKIDisplayPlayerEntry(self): + + plyName = ptGUIControlTextBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYName)) + plyName.hide() + plyID = ptGUIControlTextBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYID)) + plyID.hide() + plyIDedit = ptGUIControlEditBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYPlayerIDEditBox)) + plyIDedit.hide() + plyDetail = ptGUIControlTextBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYDetail)) + plyDetail.hide() + plyDeleteBtn = ptGUIControlButton(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYDeleteButton)) + plyDeleteBtn.hide() + # Is the player asking for a player ID number? + if self.BKGettingPlayerID: + plyName.setStringW(PtGetLocalizedString("KI.Player.EnterID")) + plyName.show() + plyIDedit.setString("") + plyIDedit.show() + plyIDedit.focus() + KIPlayerExpanded.dialog.setFocus(plyIDedit.getKey()) + return + if self.BKCurrentContent is None: + PtDebugPrint(u"xKI.BigKIDisplayPlayerEntry(): self.BKCurrentContent is None.", level=kErrorLevel) + return + if isinstance(self.BKCurrentContent, ptPlayer): + # Display the content on the screen. + plyName.setString(xCensor.xCensor(self.BKCurrentContent.getPlayerName(), self.censorLevel)) + plyName.show() + IDText = "{:08d}".format(self.BKCurrentContent.getPlayerID()) + plyID.setString(IDText) + plyID.show() + plyDetail.setStringW(PtGetLocalizedString("KI.Player.InAge", [GetAgeName()])) + plyDetail.show() + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + self.BKPlayerSelected = self.BKCurrentContent + sendToField.setString(self.BKCurrentContent.getPlayerName()) + return + element = self.BKCurrentContent.getChild() + if element is None: + PtDebugPrint(u"xKI.BigKIDisplayPlayerEntry(): Element is None.", level=kErrorLevel) + return + dataType = element.getType() + if dataType != PtVaultNodeTypes.kPlayerInfoNode: + PtDebugPrint(u"xKI.BigKIDisplayPlayerEntry(): Wrong element type {}.".format(dataType), level=kErrorLevel) + return + element = element.upcastToPlayerInfoNode() + # Display the content on the screen. + plyName.setString(xCensor.xCensor(element.playerGetName(), self.censorLevel)) + plyName.show() + IDText = "{:08d}".format(element.playerGetID()) + plyID.setString(IDText) + plyID.show() + if element.playerIsOnline(): + if element.playerGetAgeInstanceName() == "Cleft": + plyDetail.setStringW(PtGetLocalizedString("KI.Player.InCleft")) + elif element.playerGetAgeInstanceName() == "AvatarCustomization": + plyDetail.setStringW(PtGetLocalizedString("KI.Player.InCloset")) + else: + plyDetail.setStringW(PtGetLocalizedString("KI.Player.InAge", [FilterAgeName(element.playerGetAgeInstanceName())])) + else: + plyDetail.setStringW(PtGetLocalizedString("KI.Player.Offline")) + plyDetail.show() + # Determine if this player can be removed from this folder. + folder = self.BKCurrentContent.getParent() + if folder: + folder = folder.upcastToFolderNode() + if folder and self.IsFolderContentMutable(folder): + plyDeleteBtn.show() + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + self.BKPlayerSelected = self.BKCurrentContent + sendToField.setString(element.playerGetName()) + + ## Save after a player was edited. + def BigKICheckSavePlayer(self): + + if self.BKGettingPlayerID: + # Create and save a player element into Buddies. + self.BKGettingPlayerID = False + plyIDedit = ptGUIControlEditBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYPlayerIDEditBox)) + if not plyIDedit.wasEscaped(): + ID = self.chatMgr.commandsProcessor.GetPID(plyIDedit.getString()) + if ID: + localPlayer = PtGetLocalPlayer() + if ID != localPlayer.getPlayerID(): + vault = ptVault() + buddies = vault.getBuddyListFolder() + if buddies is not None: + if buddies.playerlistHasPlayer(ID): + plyDetail = ptGUIControlTextBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYDetail)) + plyDetail.setStringW(PtGetLocalizedString("KI.Player.AlreadyAdded")) + plyDetail.show() + self.BKGettingPlayerID = True + else: + buddies.playerlistAddPlayer(ID) + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Player.Added")) + if not self.BKGettingPlayerID: + self.ChangeBigKIMode(kGUI.BKListMode) + else: + plyDetail = ptGUIControlTextBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYDetail)) + plyDetail.setStringW(PtGetLocalizedString("KI.Player.NotYourself")) + plyDetail.show() + self.BKGettingPlayerID = True + else: + plyDetail = ptGUIControlTextBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYDetail)) + plyDetail.setStringW(PtGetLocalizedString("KI.Player.NumberOnly")) + plyDetail.show() + self.BKGettingPlayerID = True + else: + # Nothing here, just go back to list mode. + self.ChangeBigKIMode(kGUI.BKListMode) + + ## Prepares the display of a marker game, as it may be loading. + def BigKIDisplayMarkerGame(self): + + # Make sure that the player can view this game. + if self.gKIMarkerLevel < kKIMarkerNormalLevel: + self.BigKIDisplayMarkerGameMessage(PtGetLocalizedString("KI.MarkerGame.pendingActionUpgradeKI")) + return + + # Save some typing. + mgr = self.markerGameManager + getControl = KIMarkerFolderExpanded.dialog.getControlFromTag + + # Initialize the markerGameDisplay to the currently selected game. + # But first, ensure that the player meets all the necessary criteria. + if self.BKCurrentContent is None: + PtDebugPrint(u"xKI.BigKIDisplayMarkerGame(): Could not find the current selected content selected.", level=kErrorLevel) + return + element = self.BKCurrentContent.getChild() + if element is None: + PtDebugPrint(u"xKI.BigKIDisplayMarkerGame(): Could not find the current content's child node.", level=kErrorLevel) + return + dataType = element.getType() + if dataType != PtVaultNodeTypes.kMarkerGameNode: + PtDebugPrint(u"xKI.BigKIDisplayMarkerGame(): Cannot process this node, wrong data type: {}.".format(element.getType()), level=kErrorLevel) + return + element = element.upcastToMarkerGameNode() + PtDebugPrint(u"xKI.BigKIDisplayMarkerGame(): Starting Marker Game KI Display Manager, loading game: {}.".format(element.getGameName()), level=kDebugDumpLevel) + + ## This was previously BigKIFinishDisplayMarkerGame() + questGameFinished = False + + # A game is in progress, restrict access. + if mgr.AmIPlaying(element): + self.MFdialogMode = kGames.MFPlaying + + # Are we editing this game? If so, how? + elif mgr.IsActive(element) and mgr.edit_mode: + if mgr.selected_marker_id != -1: + self.MFdialogMode = kGames.MFEditingMarker + else: + self.MFdialogMode = kGames.MFEditing + + # Whatever. + else: + self.MFdialogMode = kGames.MFOverview + + # Refresh miniKI. + self.RefreshMiniKIMarkerDisplay() + + self.SetBigKIToButtons() + + # Hide the invite buttons controls. + ptGUIControlButton(getControl(kGUI.MarkerFolderInvitePlayer)).hide() + mtbInvitePlayer = ptGUIControlTextBox(getControl(kGUI.MarkerFolderInvitePlayerTB)) + mtbInvitePlayer.setForeColor(kColors.Clear) + mtbInvitePlayer.setString(" ") + + mbtnEditStart = ptGUIControlButton(getControl(kGUI.MarkerFolderEditStartGame)) + mbtnPlayEnd = ptGUIControlButton(getControl(kGUI.MarkerFolderPlayEndGame)) + mrkfldOwner = ptGUIControlTextBox(getControl(kGUI.MarkerFolderOwner)) + mtbEditStart = ptGUIControlTextBox(getControl(kGUI.MarkerFolderEditStartGameTB)) + mtbPlayEnd = ptGUIControlTextBox(getControl(kGUI.MarkerFolderPlayEndGameTB)) + mrkfldStatus = ptGUIControlTextBox(getControl(kGUI.MarkerFolderStatus)) + mrkfldTitle = ptGUIControlTextBox(getControl(kGUI.MarkerFolderTitleText)) + mrkfldTitleBtn = ptGUIControlButton(getControl(kGUI.MarkerFolderTitleBtn)) + mbtnDelete = ptGUIControlButton(getControl(kGUI.MarkerFolderDeleteBtn)) + mbtnGameTimePullD = ptGUIControlButton(getControl(kGUI.MarkerFolderTimePullDownBtn)) + mtbGameType = ptGUIControlTextBox(getControl(kGUI.MarkerFolderGameTypeTB)) + mbtnGameTypePullD = ptGUIControlButton(getControl(kGUI.MarkerFolderTypePullDownBtn)) + mbtnGameTypePullD.hide() + mbtnGameTimeArrow = ptGUIControlButton(getControl(kGUI.MarkerFolderTimeArrow)) + mbtnGameTypeArrow = ptGUIControlButton(getControl(kGUI.MarkerFolderTypeArrow)) + mbtnGameTypeArrow.hide() + mtbGameTime = ptGUIControlTextBox(getControl(kGUI.MarkerFolderGameTimeTB)) + mtbGameTimeTitle = ptGUIControlTextBox(getControl(kGUI.MarkerFolderGameTimeTitleTB)) + mtbGameTimeTitle.setStringW(PtGetLocalizedString("KI.MarkerGame.Time")) + mlbMarkerList = ptGUIControlListBox(getControl(kGUI.MarkerFolderMarkListbox)) + mlbMarkerTextTB = ptGUIControlTextBox(getControl(kGUI.MarkerFolderMarkerTextTB)) + mbtnMarkerText = ptGUIControlTextBox(getControl(kGUI.MarkerFolderMarkerTextBtn)) + + mbtnToran = ptGUIControlButton(getControl(kGUI.MarkerFolderToranIcon)) + mbtnToran.disable() + mbtnHSpan = ptGUIControlButton(getControl(kGUI.MarkerFolderHSpanIcon)) + mbtnHSpan.disable() + mbtnVSpan = ptGUIControlButton(getControl(kGUI.MarkerFolderVSpanIcon)) + mbtnVSpan.disable() + mtbToran = ptGUIControlTextBox(getControl(kGUI.MarkerFolderToranTB)) + mtbHSPan = ptGUIControlTextBox(getControl(kGUI.MarkerFolderHSpanTB)) + mtbVSpan = ptGUIControlTextBox(getControl(kGUI.MarkerFolderVSpanTB)) + + ## FIXME: non quest game types + mtbGameType.setStringW(PtGetLocalizedString("KI.MarkerGame.NameQuest").title()) + + mbtnEditStart.show() + mbtnPlayEnd.show() + + # Is the player merely looking at a Marker Game? + if self.MFdialogMode == kGames.MFOverview: + mrkfldTitleBtn.disable() + if self.IsContentMutable(self.BKCurrentContent): + mbtnDelete.show() + else: + mbtnDelete.hide() + mbtnGameTimePullD.hide() + mbtnGameTimeArrow.hide() + if element.getCreatorNodeID() == PtGetLocalClientID(): + mbtnEditStart.show() + mtbEditStart.setForeColor(kColors.DniShowBtn) + else: + mbtnEditStart.hide() + mtbEditStart.setForeColor(kColors.DniGhostBtn) + mtbEditStart.setStringW(PtGetLocalizedString("KI.MarkerGame.EditButton")) + mtbEditStart.show() + mbtnPlayEnd.show() + mtbPlayEnd.setForeColor(kColors.DniShowBtn) + mtbPlayEnd.setString(PtGetLocalizedString("KI.MarkerGame.PlayButton")) + mtbPlayEnd.show() + mlbMarkerList.hide() + self.BigKIMarkerListScrollVis(False) + mlbMarkerTextTB.hide() + mbtnToran.hide() + mbtnHSpan.hide() + mbtnVSpan.hide() + mtbToran.hide() + mtbHSPan.hide() + mtbVSpan.hide() + mbtnMarkerText.disable() + # Is the player editing a Marker Game? + elif self.MFdialogMode == kGames.MFEditing or self.MFdialogMode == kGames.MFEditingMarker: + mrkfldTitleBtn.enable() + mbtnDelete.hide() + mbtnGameTimePullD.hide() + mbtnGameTimeArrow.hide() + mbtnEditStart.show() + mtbEditStart.setForeColor(kColors.DniShowBtn) + mbtnPlayEnd.show() + mtbPlayEnd.setForeColor(kColors.DniShowBtn) + # Is the player editing the entire game? + if self.MFdialogMode == kGames.MFEditing: + mtbEditStart.setStringW(PtGetLocalizedString("KI.MarkerGame.DoneEditButton")) + mtbEditStart.show() + mtbPlayEnd.setStringW(PtGetLocalizedString("KI.MarkerGame.AddMarkerButton")) + mtbPlayEnd.show() + mlbMarkerList.clearAllElements() + mlbMarkerList.show() + + # Add the Markers to the list. + mlbMarkerList.lock() + for idx, age, pos, desc in mgr.markers: + coord = ptDniCoordinates() + coord.fromPoint(pos) + torans = coord.getTorans() + hSpans = coord.getHSpans() + vSpans = coord.getVSpans() + mlbMarkerList.addStringW(u"[{}:{},{},{}] {}".format(FilterAgeName(age), torans, hSpans, vSpans, xCensor.xCensor(desc, self.censorLevel))) + mlbMarkerList.unlock() + + # Refresh the scroll position + self.BigKIMarkerListScrollVis(True) + mlbMarkerList.setScrollPos(self.MFScrollPos) + + mlbMarkerTextTB.hide() + mbtnToran.hide() + mbtnHSpan.hide() + mbtnVSpan.hide() + mtbToran.hide() + mtbHSPan.hide() + mtbVSpan.hide() + mbtnMarkerText.disable() + # Or just editing one of the Markers? + else: + selectedMarker = mgr.selected_marker + if selectedMarker is not None: + idx, age, pos, desc = selectedMarker + + # Must be editing a Marker. + mtbEditStart.setStringW(PtGetLocalizedString("KI.MarkerGame.MarkerListButton")) + mtbEditStart.show() + mtbPlayEnd.setStringW(PtGetLocalizedString("KI.MarkerGame.RemoveMarkerButton")) + mtbPlayEnd.show() + mlbMarkerList.hide() + self.BigKIMarkerListScrollVis(False) + mlbMarkerTextTB.show() + # don't censor here... we don't want censored stuff saved to the vault + mlbMarkerTextTB.setStringW(desc) + mbtnToran.show() + mbtnHSpan.show() + mbtnVSpan.show() + mtbToran.show() + mtbHSPan.show() + mtbVSpan.show() + + # Get the selected Marker's coordinates. + coord = ptDniCoordinates() + coord.fromPoint(pos) + + mtbToran.setString(str(coord.getTorans())) + mtbHSPan.setString(str(coord.getHSpans())) + mtbVSpan.setString(str(coord.getVSpans())) + mbtnMarkerText.show() + mbtnMarkerText.enable() + else: + # Error... + PtDebugPrint(u"xKI.BigKIFinishDisplayMarkerGame(): Could not find selected marker.", level=kErrorLevel) + mtbEditStart.setStringW(PtGetLocalizedString("KI.MarkerGame.GoBackButton")) + mtbEditStart.show() + mtbPlayEnd.setString(" ") + mtbPlayEnd.show() + mlbMarkerList.hide() + mlbMarkerTextTB.show() + mlbMarkerTextTB.setString("?Unknown Marker?") + mbtnToran.hide() + mbtnHSpan.hide() + mbtnVSpan.hide() + mtbToran.hide() + mtbHSPan.hide() + mtbVSpan.hide() + # Is the player currently playing a Marker Game? + elif self.MFdialogMode == kGames.MFPlaying: + mrkfldTitleBtn.disable() + mbtnDelete.hide() + mbtnGameTimePullD.hide() + mbtnGameTimeArrow.hide() + mbtnToran.hide() + mbtnHSpan.hide() + mbtnVSpan.hide() + mtbToran.hide() + mtbHSPan.hide() + mtbVSpan.hide() + mbtnMarkerText.disable() + mbtnEditStart.show() + mtbEditStart.setForeColor(kColors.DniShowBtn) + mtbEditStart.setString(PtGetLocalizedString("KI.MarkerGame.StopPlayingButton")) + mtbEditStart.show() + mbtnPlayEnd.show() + mtbPlayEnd.setForeColor(kColors.DniShowBtn) + mtbPlayEnd.setString(PtGetLocalizedString("KI.MarkerGame.ResetGameButton")) + mtbPlayEnd.show() + mlbMarkerList.clearAllElements() + mlbMarkerList.show() + self.BigKIMarkerListScrollVis(True) + + # Assume that the game is finished, unless an unseen Marker is still left. + questGameFinished = True + + # Add the Markers into the list. + for idx, age, pos, desc in mgr.markers: + if mgr.IsMarkerCaptured(idx): + coord = ptDniCoordinates() + coord.fromPoint(pos) + torans = coord.getTorans() + hSpans = coord.getHSpans() + vSpans = coord.getVSpans() + mlbMarkerList.addStringW(u"[{}:{},{},{}] {}".format(FilterAgeName(age), torans, hSpans, vSpans, xCensor.xCensor(desc, self.censorLevel))) + else: + questGameFinished = False + mlbMarkerTextTB.hide() + + # Refresh the text of the buttons (color changed). + mtbEditStart.refresh() + mtbPlayEnd.refresh() + # Display the content on the screen. + mrkfldTitle.setStringW(xCensor.xCensor(element.getGameName(), self.censorLevel)) + mrkfldTitle.show() + # Enable the editable Title. + mrkfldTitleBtn.show() + mrkfldTitleBtn.enable() + + count = mgr.marker_total + if self.MFdialogMode == kGames.MFEditing or self.MFdialogMode == kGames.MFEditingMarker: + if count == 0: + statusLine = PtGetLocalizedString("KI.MarkerGame.StatusNoMarkers") + elif count == 1: + statusLine = PtGetLocalizedString("KI.MarkerGame.StatusOneMarker") + else: + statusLine = PtGetLocalizedString("KI.MarkerGame.StatusNMarkers", [str(count)]) + else: + if questGameFinished: + statusLine = PtGetLocalizedString("KI.MarkerGame.StatusAllFound") + else: + statusLine = PtGetLocalizedString("KI.MarkerGame.StatusNotAllFound") + mrkfldStatus.setStringW(statusLine) + mrkfldStatus.show() + + creatorID = element.getCreatorNodeID() + tempNode = ptVaultPlayerInfoNode() + tempNode.playerSetID(creatorID) + + try: + vault = ptVault() + creatorName = vault.findNode(tempNode).upcastToPlayerInfoNode().playerGetName() + except: + creatorName = "" + + mrkfldOwner.setStringW(PtGetLocalizedString("KI.MarkerGame.OwnerTitle") + U" {} [ID:{:08d}]".format(creatorName, creatorID)) + mrkfldOwner.show() + # TODO: time limit + mtbGameTime.hide() + mtbGameTimeTitle.hide() + + def BigKIDisplayMarkerGameMessage(self, msg): + """Displays some message in the Marker Folder subdialog""" + + # Save some typing. + getControl = KIMarkerFolderExpanded.dialog.getControlFromTag + + # Disable all controls until we need them. + mrkfldTitle = ptGUIControlTextBox(getControl(kGUI.MarkerFolderTitleText)) + mrkfldTitle.hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderStatus)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderOwner)).hide() + # Hide the scroll buttons for the Marker list; the scroll control will turn them back on. + self.BigKIMarkerListScrollVis(False) + + ptGUIControlButton(getControl(kGUI.MarkerFolderInvitePlayer)).hide() + ptGUIControlButton(getControl(kGUI.MarkerFolderEditStartGame)).hide() + ptGUIControlButton(getControl(kGUI.MarkerFolderPlayEndGame)).hide() + + ptGUIControlTextBox(getControl(kGUI.MarkerFolderInvitePlayerTB)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderEditStartGameTB)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderPlayEndGameTB)).hide() + + ptGUIControlButton(getControl(kGUI.MarkerFolderTitleBtn)).hide() + ptGUIControlButton(getControl(kGUI.MarkerFolderDeleteBtn)).hide() + ptGUIControlButton(getControl(kGUI.MarkerFolderTimePullDownBtn)).hide() + ptGUIControlButton(getControl(kGUI.MarkerFolderTypePullDownBtn)).hide() + ptGUIControlButton(getControl(kGUI.MarkerFolderTypePullDownBtn)).disable() + ptGUIControlButton(getControl(kGUI.MarkerFolderTimeArrow)).hide() + ptGUIControlButton(getControl(kGUI.MarkerFolderTypeArrow)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderGameTimeTB)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderGameTimeTitleTB)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderGameTypeTB)).hide() + ptGUIControlListBox(getControl(kGUI.MarkerFolderMarkListbox)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderMarkerTextTB)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderMarkerTextBtn)).hide() + ptGUIControlButton(getControl(kGUI.MarkerFolderToranIcon)).disable() + ptGUIControlButton(getControl(kGUI.MarkerFolderHSpanIcon)).disable() + ptGUIControlButton(getControl(kGUI.MarkerFolderVSpanIcon)).disable() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderToranTB)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderHSpanTB)).hide() + ptGUIControlTextBox(getControl(kGUI.MarkerFolderVSpanTB)).hide() + + # Show the status. + mrkfldTitle.setStringW(msg) + mrkfldTitle.show() + mrkfldTitle.refresh() + + def BigKIMarkerListScrollVis(self, visible=True): + if visible: + ptGUIControlButton(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerListUpBtn)).show() + ptGUIControlButton(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerListDownBtn)).show() + else: + ptGUIControlButton(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerListUpBtn)).hide() + ptGUIControlButton(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerListDownBtn)).hide() + + ## Show the selected configuration screen. + def ShowSelectedConfig(self): + + if self.BKConfigListOrder[self.BKFolderSelected] == PtGetLocalizedString("KI.Config.Settings"): + self.ChangeBigKIMode(kGUI.BKKIExpanded) + elif self.BKConfigListOrder[self.BKFolderSelected] == PtGetLocalizedString("KI.Config.Volume"): + self.ChangeBigKIMode(kGUI.BKVolumeExpanded) + else: + # Is the dialog hidden? + if self.BKRightSideMode != kGUI.BKAgeOwnerExpanded: + self.ChangeBigKIMode(kGUI.BKAgeOwnerExpanded) + # Otherwise, refresh it. + else: + self.RefreshAgeOwnerSettings() + self.BigKIOnlySelectedToButtons() + + ## Enter edit mode for a particular field. + def BigKIEnterEditMode(self, whichField): + + # Can't be in chatting mode. + self.chatMgr.ToggleChatMode(0) + # If the player was already in edit mode, save the values before re-entering. + if self.BKInEditMode: + self.BigKISaveEdit() + if whichField == kGUI.BKEditFieldJRNTitle: + textBox = ptGUIControlTextBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[whichField][kGUI.BKEditIDtextbox])) + button = ptGUIControlButton(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[whichField][kGUI.BKEditIDbutton])) + editBox = ptGUIControlEditBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[whichField][kGUI.BKEditIDeditbox])) + elif whichField == kGUI.BKEditFieldPICTitle: + textBox = ptGUIControlTextBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[whichField][kGUI.BKEditIDtextbox])) + button = ptGUIControlButton(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[whichField][kGUI.BKEditIDbutton])) + editBox = ptGUIControlEditBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[whichField][kGUI.BKEditIDeditbox])) + editBox.setStringSize(56) + else: + textBox = None + button = None + editBox = None + # Make sure it is a valid field to edit. + if textBox is not None: + if self.BKCurrentContent is not None: + edElement = self.BKCurrentContent.getChild() + else: + edElement = None + if edElement is not None: + self.BKInEditMode = True + self.BKEditContent = self.BKCurrentContent + self.BKEditField = whichField + # Hide the TextBox and the button. + textBox.hide() + button.hide() + # Set the edit box and display it. + if self.BKEditField == kGUI.BKEditFieldJRNTitle: + edElement = edElement.upcastToTextNoteNode() + editBox.setString(xCensor.xCensor(edElement.noteGetTitle(), self.censorLevel)) + KIJournalExpanded.dialog.setFocus(editBox.getKey()) + elif self.BKEditField == kGUI.BKEditFieldPICTitle: + edElement = edElement.upcastToImageNode() + editBox.setString(xCensor.xCensor(edElement.imageGetTitle(), self.censorLevel)) + KIPictureExpanded.dialog.setFocus(editBox.getKey()) + else: + editBox.setString("") + editBox.end() + editBox.show() + editBox.focus() + if whichField == kGUI.BKEditFieldJRNTitle or whichField == kGUI.BKEditFieldJRNNote: + KIJournalExpanded.dialog.refreshAllControls() + elif whichField == kGUI.BKEditFieldPICTitle: + KIPictureExpanded.dialog.refreshAllControls() + else: + PtDebugPrint(u"xKI.BigKIEnterEditMode(): Content has no element to edit.", level=kErrorLevel) + else: + # Is it for the journal edit? + if whichField == kGUI.BKEditFieldJRNNote: + # If so, then it's sort of automatically in edit mode. + self.BKInEditMode = True + self.BKEditContent = self.BKCurrentContent + self.BKEditField = whichField + + ## Save what the player was editing to the right place. + def BigKISaveEdit(self, noExitEditMode=False): + + if self.BKInEditMode: + if self.BKEditField == kGUI.BKEditFieldJRNTitle: + textBox = ptGUIControlTextBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDtextbox])) + button = ptGUIControlButton(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDbutton])) + editBox = ptGUIControlEditBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDeditbox])) + elif self.BKEditField == kGUI.BKEditFieldJRNNote: + textBox = ptGUIControlMultiLineEdit(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDtextbox])) + button = None + editBox = None + elif self.BKEditField == kGUI.BKEditFieldPICTitle: + textBox = ptGUIControlTextBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDtextbox])) + button = ptGUIControlButton(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDbutton])) + editBox = ptGUIControlEditBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDeditbox])) + else: + textBox = None + button = None + editBox = None + + # Make sure that it can be edited. + if textBox is not None: + if self.BKEditContent is not None: + edElement = self.BKEditContent.getChild() + if edElement is not None: + if editBox is not None: + if not editBox.wasEscaped(): + textBox.setString(editBox.getString()) + if self.BKEditField == kGUI.BKEditFieldJRNTitle: + edElement = edElement.upcastToTextNoteNode() + jTitle = editBox.getStringW() + if jTitle[:len(PtGetLocalizedString("KI.Journal.InitialTitle"))] == PtGetLocalizedString("KI.Journal.InitialTitle"): + # Make sure that the player actually added something (so as not to get a blank title). + if jTitle != PtGetLocalizedString("KI.Journal.InitialTitle"): + jTitle = jTitle[len(PtGetLocalizedString("KI.Journal.InitialTitle")):] + edElement.setTitleW(jTitle) + elif self.BKEditField == kGUI.BKEditFieldPICTitle: + edElement = edElement.upcastToImageNode() + pTitle = editBox.getStringW() + if pTitle[:len(PtGetLocalizedString("KI.Image.InitialTitle"))] == PtGetLocalizedString("KI.Image.InitialTitle"): + # Make sure that the player actually added something (so as not to get a blank title). + if pTitle != PtGetLocalizedString("KI.Image.InitialTitle"): + pTitle = pTitle[len(PtGetLocalizedString("KI.Image.InitialTitle")):] + edElement.setTitleW(pTitle) + edElement.save() + else: + if self.BKEditField == kGUI.BKEditFieldJRNNote: + buf = textBox.getEncodedBufferW() + if buf[:len(PtGetLocalizedString("KI.Journal.InitialMessage"))] == PtGetLocalizedString("KI.Journal.InitialMessage"): + buf = buf[len(PtGetLocalizedString("KI.Journal.InitialMessage")):] + edElement = edElement.upcastToTextNoteNode() + edElement.setTextW(buf) + edElement.save() + if self.BKEditField != kGUI.BKEditFieldJRNNote: + # Put the fields back into no-edit mode. + textBox.show() + button.show() + editBox.hide() + if not noExitEditMode: + # Stop editing. + self.BKInEditMode = False + self.BKEditContent = None + self.BKEditField = -1 + + ## If the focus has changed, check to see if editing should be stopped. + def BigKICheckFocusChange(self): + + if self.BKInEditMode: + if self.BKEditField == kGUI.BKEditFieldJRNTitle: + editBox = ptGUIControlEditBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDeditbox])) + elif self.BKEditField == kGUI.BKEditFieldPICTitle: + editBox = ptGUIControlEditBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[self.BKEditField][kGUI.BKEditIDeditbox])) + else: + editBox = None + if editBox is not None: + if editBox.isFocused(): + return + self.BigKISaveEdit() + + ## Mark a content as seen (unimplemented) in the BigKI. + def BigKISetSeen(self, content): + + if BigKI.dialog.isEnabled(): + content.setSeen() + + #~~~~~~~~~~~~~~# + # BigKI Saving # + #~~~~~~~~~~~~~~# + + ## Save the player-editted name of an Age. + def SaveAgeNameFromEdit(self, control): + + newTitle = "" + try: + # Get the selected Age config setting. + myAge = self.BKConfigFolderDict[self.BKConfigListOrder[self.BKFolderSelected]] + if not control.wasEscaped(): + # Set the new title. + myAge.setAgeUserDefinedName(control.getStringW()) + myAge.save() + PtDebugPrint(u"xKI.SaveAgeNameFromEdit(): Updating title to \"{}\".".format(control.getStringW()), level=kDebugDumpLevel ) + else: + PtDebugPrint(u"xKI.SaveAgeNameFromEdit(): Escape hit.", level=kDebugDumpLevel ) + newTitle = myAge.getDisplayName() + except LookupError: + PtDebugPrint(u"xKI.SaveAgeNameFromEdit(): The current Age could not be found.", level=kDebugDumpLevel ) + myAge = None + control.hide() + # Re-enable the button and text. + title = ptGUIControlTextBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleTB)) + title.setStringW(newTitle) + title.show() + titlebtn = ptGUIControlButton(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleBtn)) + titlebtn.enable() + + ## Save the new name of the Marker Game. + # This saves it both in the Vault and on the Game Server. + def SaveMarkerGameNameFromEdit(self, control): + + title = ptGUIControlTextBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderTitleText)) + if self.BKCurrentContent is not None: + element = self.BKCurrentContent.getChild() + if element is not None: + dataType = element.getType() + if dataType == PtVaultNodeTypes.kMarkerGameNode: + element = element.upcastToMarkerGameNode() + if element is not None: + if not control.wasEscaped() and control.getString() != "": + # Set the new title. + newText = xCensor.xCensor(control.getStringW(), self.censorLevel) + element.setGameName(control.getStringW()) + title.setString(control.getStringW()) + element.save() + PtDebugPrint(u"xKI.SaveMarkerGameNameFromEdit(): Updating title to \"{}\".".format(newText), level=kDebugDumpLevel) + self.RefreshPlayerList() + else: + PtDebugPrint(u"xKI.SaveMarkerGameNameFromEdit(): Escape hit.", level=kDebugDumpLevel) + control.hide() + # Re-enable the button and text. + titlebtn = ptGUIControlTextBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderTitleBtn)) + titlebtn.enable() + title.show() + + ## Save the text of a Marker on the Game Server. + def SaveMarkerTextFromEdit(self, control): + + title = ptGUIControlTextBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerTextTB)) + if self.BKCurrentContent is not None: + element = self.BKCurrentContent.getChild() + if element is not None: + dataType = element.getType() + if dataType == PtVaultNodeTypes.kMarkerGameNode: + element = element.upcastToMarkerGameNode() + if element is not None: + name = control.getStringW() + if not control.wasEscaped() and name: + self.markerGameManager.selected_marker_name = name + else: + PtDebugPrint(u"xKI.SaveMarkerTextFromEdit(): escape hit!", level=kDebugDumpLevel ) + control.hide() + # Re-enable the button and text. + titlebtn = ptGUIControlTextBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerTextBtn)) + titlebtn.enable() + title.show() + + #~~~~~~~~~~~~~~~~~~~# + # GUI Notifications # + #~~~~~~~~~~~~~~~~~~~# + + ## Process notifications originating from the Blackbar. + # This handles objects like the Yeesha book icon, the quitting icon, the + # options menu icon and the miniKI icon, when the KI has been obtained. + def ProcessNotifyBlackbar(self, control, event): + + if event == kDialogLoaded: + pass + elif event == kAction or event == kValueChanged: + bbID = control.getTagID() + if bbID == kGUI.MiniMaximizeRGID: + if control.getValue() == 0: + if PtIsDialogLoaded("KIMini"): + KIMini.dialog.show() + elif control.getValue() == -1: + if PtIsDialogLoaded("KIMini"): + KIMini.dialog.hide() + elif bbID == kGUI.ExitButtonID: + yesText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + yesText.setStringW(PtGetLocalizedString("KI.Messages.LeaveGame")) + self.LocalizeDialog(0) + logoutText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutTextID)) + logoutText.show() + logoutButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutButtonID)) + logoutButton.show() + KIYesNo.dialog.show() + elif bbID == kGUI.PlayerBookCBID: + if control.isChecked(): + curBrainMode = PtGetLocalAvatar().avatar.getCurrentMode() + if self.isEntireYeeshaBookEnabled and (curBrainMode == PtBrainModes.kNonGeneric or curBrainMode == PtBrainModes.kAFK or curBrainMode == PtBrainModes.kSit): + if not self.waitingForAnimation: + self.ShowYeeshaBook() + else: + control.setChecked(0) + else: + control.setChecked(0) + elif bbID == kGUI.OptionsMenuButtonID: + PtShowDialog("OptionsMenuGUI") + else: + PtDebugPrint(u"xKI.ProcessNotifyBlackbar(): Don't know this control bbID = {}.".format(bbID), level=kDebugDumpLevel) + elif event == kInterestingEvent: + plybkCB = ptGUIControlCheckBox(KIBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + try: + curBrainMode = PtGetLocalAvatar().avatar.getCurrentMode() + if self.isEntireYeeshaBookEnabled and (curBrainMode == PtBrainModes.kNonGeneric or curBrainMode == PtBrainModes.kAFK or curBrainMode == PtBrainModes.kSit): + PtDebugPrint(u"xKI.ProcessNotifyBlackbar(): Show PlayerBook.", level=kDebugDumpLevel) + plybkCB.show() + else: + PtDebugPrint(u"xKI.ProcessNotifyBlackbar(): On ladder, hide PlayerBook.", level=kDebugDumpLevel) + plybkCB.hide() + except NameError: + if self.isEntireYeeshaBookEnabled: + PtDebugPrint(u"xKI.ProcessNotifyBlackbar(): Show PlayerBook.", level=kDebugDumpLevel) + plybkCB.show() + else: + PtDebugPrint(u"xKI.ProcessNotifyBlackbar(): On ladder, hide PlayerBook.", level=kDebugDumpLevel) + plybkCB.hide() + + ## Process notifications originating from the microKI's Blackbar. + # This takes care of the same duties at the Blackbar processor, with the + # sole difference that it is used only while the user does not yet possess + # a full KI from Gahreesen (thus there is no miniKI icon). + def ProcessNotifyMicroBlackbar(self, control, event): + + if event == kDialogLoaded: + rollBtn = ptGUIControlButton(KIMicroBlackbar.dialog.getControlFromTag(kGUI.RolloverLeftID)) + rollBtn.setNotifyOnInteresting(1) + rollBtn = ptGUIControlButton(KIMicroBlackbar.dialog.getControlFromTag(kGUI.RolloverRightID)) + rollBtn.setNotifyOnInteresting(1) + elif event == kAction or event == kValueChanged: + bbID = control.getTagID() + if bbID == kGUI.ExitButtonID: + yesText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + yesText.setStringW(PtGetLocalizedString("KI.Messages.LeaveGame")) + self.LocalizeDialog(0) + logoutText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutTextID)) + logoutText.show() + logoutButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutButtonID)) + logoutButton.show() + KIYesNo.dialog.show() + elif bbID == kGUI.PlayerBookCBID: + if control.isChecked(): + curBrainMode = PtGetLocalAvatar().avatar.getCurrentMode() + if self.isEntireYeeshaBookEnabled and (curBrainMode == PtBrainModes.kNonGeneric or curBrainMode == PtBrainModes.kAFK or curBrainMode == PtBrainModes.kSit): + if not self.waitingForAnimation: + self.ShowYeeshaBook() + else: + control.setChecked(0) + else: + control.setChecked(0) + elif bbID == kGUI.OptionsMenuButtonID: + PtShowDialog("OptionsMenuGUI") + else: + PtDebugPrint(u"xKI.ProcessNotifyMicroBlackbar(): Don't know this control bbID = {}.".format(bbID), level=kDebugDumpLevel) + elif event == kInterestingEvent: + plybkCB = ptGUIControlCheckBox(KIMicroBlackbar.dialog.getControlFromTag(kGUI.PlayerBookCBID)) + try: + curBrainMode = PtGetLocalAvatar().avatar.getCurrentMode() + if self.isEntireYeeshaBookEnabled and (curBrainMode == PtBrainModes.kNonGeneric or curBrainMode == PtBrainModes.kAFK or curBrainMode == PtBrainModes.kSit): + PtDebugPrint(u"xKI.ProcessNotifyMicroBlackbar(): Show PlayerBook.", level=kDebugDumpLevel) + plybkCB.show() + else: + PtDebugPrint(u"xKI.ProcessNotifyMicroBlackbar(): On ladder, hide PlayerBook.", level=kDebugDumpLevel) + plybkCB.hide() + except NameError: + if self.isEntireYeeshaBookEnabled: + PtDebugPrint(u"xKI.ProcessNotifyMicroBlackbar(): Show PlayerBook.", level=kDebugDumpLevel) + plybkCB.show() + else: + PtDebugPrint(u"xKI.ProcessNotifyMicroBlackbar(): On ladder, hide PlayerBook.", level=kDebugDumpLevel) + plybkCB.hide() + + ## Process notifications originating from the microKI. + # These notifications get called when using the basic chat mode available + # only until the user obtains a real KI from Gahreesen (thus the name, + # microKI). + def ProcessNotifyMicro(self, control, event): + + if event == kDialogLoaded: + # Fill in the listbox so that the test is near the enter box. + chatArea = ptGUIControlMultiLineEdit(KIMicro.dialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatArea.lock() # Make the chat display immutable. + chatArea.unclickable() # Make the chat display non-clickable. + chatArea.moveCursor(PtGUIMultiLineDirection.kBufferEnd) + chatArea.disableScrollControl() + btnUp = ptGUIControlButton(KIMicro.dialog.getControlFromTag(kGUI.miniChatScrollUp)) + btnUp.show() + btnUp.hide() + # Set the edit box buffer size to something larger. + chatedit = ptGUIControlEditBox(KIMicro.dialog.getControlFromTag(kGUI.ChatEditboxID)) + chatedit.setStringSize(500) + chatedit.setChatMode(1) + elif event == kShowHide: + if control.isEnabled(): + if not self.chatMgr.isChatting: + self.FadeCompletely() + elif event == kAction or event == kValueChanged: + ctrlID = control.getTagID() + if ctrlID == kGUI.ChatEditboxID: + if not control.wasEscaped() and control.getStringW() != "": + self.chatMgr.SendMessage(control.getStringW()) + self.chatMgr.ToggleChatMode(0) + elif ctrlID == kGUI.ChatDisplayArea: + self.ResetFadeState() + elif event == kFocusChange: + # If they are chatting, get the focus back. + if self.chatMgr.isChatting: + KIMicro.dialog.setFocus(KIMicro.dialog.getControlFromTag(kGUI.ChatEditboxID)) + elif event == kSpecialAction: + ctrlID = control.getTagID() + if ctrlID == kGUI.ChatEditboxID: + self.Autocomplete(control) + + ## Process notifications originating from the miniKI. + # The miniKI is the display in the top-left corner of the screen (by + # default); these notifications are triggered through interaction with the + # various buttons on it. It also takes care of the floating player list. + def ProcessNotifyMini(self, control, event): + + if event == kDialogLoaded: + # Get the original position of the miniKI. + dragbar = ptGUIControlDragBar(KIMini.dialog.getControlFromTag(kGUI.miniDragBar)) + self.originalminiKICenter = dragbar.getObjectCenter() + # Retreive the original alpha. + fore = control.getForeColor() + self.originalForeAlpha = fore.getAlpha() + sel = control.getSelectColor() + self.originalSelectAlpha = sel.getAlpha() + # Fill in the listbox so that the test is near the enter box. + chatArea = ptGUIControlMultiLineEdit(KIMini.dialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatArea.lock() # Make the chat display immutable. + chatArea.unclickable() # Make the chat display non-clickable. + chatArea.moveCursor(PtGUIMultiLineDirection.kBufferEnd) + # Hide the chat scroll buttons (should be nothing in chat area yet anyhow). + chatArea.disableScrollControl() + btnUp = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniChatScrollUp)) + btnUp.show() + privateChbox = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniPrivateToggle)) + privateChbox.disable() + # Set the edit box buffer size to something larger. + chatedit = ptGUIControlEditBox(KIMini.dialog.getControlFromTag(kGUI.ChatEditboxID)) + chatedit.setStringSize(500) + chatedit.setChatMode(1) + # Default the marker tag stuff to be off. + btnmt = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniGZDrip)) + btnmt.hide() + btnmt = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniGZActive)) + btnmt.hide() + btnmt = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniGZMarkerGameActive)) + btnmt.hide() + btnmt = ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniGZMarkerInRange)) + btnmt.hide() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniMGNewMarker)).hide() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniMGNewGame)).hide() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniMGInactive)).hide() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.miniMGInactive)).disable() + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.PelletScoreButton)).hide() + # Set the color to the off color. + for mcbID in range(kGUI.miniMarkerIndicator01, kGUI.miniMarkerIndicatorLast + 1): + mcb = ptGUIControlProgress(KIMini.dialog.getControlFromTag(mcbID)) + mcb.setValue(kGUI.miniMarkerColors["off"]) + elif event == kShowHide: + if control.isEnabled(): + if self.pelletImager != "": + ptGUIControlButton(KIMini.dialog.getControlFromTag(kGUI.PelletScoreButton)).show() + if self.miniKIFirstTimeShow: + # Set the font size and fade time. + self.DetermineFontSize() + self.DetermineFadeTime() + # If we are chatting then just let it happen. + if not self.chatMgr.isChatting: + self.chatMgr.ToggleChatMode(0) + self.FadeCompletely() + self.miniKIFirstTimeShow = False + self.RefreshPlayerList() + self.RefreshMiniKIMarkerDisplay() + else: + self.chatMgr.ToggleChatMode(0) + self.chatMgr.ClearBBMini() + elif event == kAction or event == kValueChanged: + ctrlID = control.getTagID() + if ctrlID == kGUI.ChatEditboxID: + if not control.wasEscaped() and control.getStringW() != u"": + self.chatMgr.SendMessage(control.getStringW()) + self.chatMgr.ToggleChatMode(0) + self.StartFadeTimer() + elif ctrlID == kGUI.PlayerList: + # Make sure they don't click outside what's there. + plyrsel = control.getSelection() + if plyrsel >= control.getNumElements(): + control.setSelection(0) + plyrsel = 0 + # Place selected player in SendTo textbox. + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + caret = ptGUIControlTextBox(KIMini.dialog.getControlFromTag(kGUI.ChatCaretID)) + caret.setString(">") + privateChbox = ptGUIControlCheckBox(KIMini.dialog.getControlFromTag(kGUI.miniPrivateToggle)) + privateChbox.setChecked(0) + if plyrsel == -1: + self.BKPlayerSelected = None + else: + self.BKPlayerSelected = self.BKPlayerList[plyrsel] + # Is it a Device Folder or just a string? + if isinstance(self.BKPlayerSelected, DeviceFolder) or isinstance(self.BKPlayerSelected, str): + # Can't be sent to. + pass + elif isinstance(self.BKPlayerSelected, Device): + sendToField.setString(self.BKPlayerSelected.name) + # Is it a specific player info node? + elif isinstance(self.BKPlayerSelected, ptVaultNodeRef): + plyrInfoNode = self.BKPlayerSelected.getChild() + plyrInfo = plyrInfoNode.upcastToPlayerInfoNode() + if plyrInfo is not None: + sendToField.setString(plyrInfo.playerGetName()) + # Set private caret. + caret.setStringW(PtGetLocalizedString("KI.Chat.TOPrompt") + unicode(plyrInfo.playerGetName()) + U" >") + privateChbox.setChecked(1) + else: + self.BKPlayerSelected = None + # Is it a specific player? + elif isinstance(self.BKPlayerSelected, ptPlayer): + sendToField.setString(self.BKPlayerSelected.getPlayerName()) + caret.setStringW(PtGetLocalizedString("KI.Chat.TOPrompt") + unicode(self.BKPlayerSelected.getPlayerName()) + U" >") + privateChbox.setChecked(1) + # Is it a list of players? + elif isinstance(self.BKPlayerSelected, ptVaultPlayerInfoListNode): + fldrType = self.BKPlayerSelected.folderGetType() + # Is it not the All Players folder? + if fldrType != PtVaultStandardNodes.kAgeMembersFolder: + # If it's a list of age owners, it's a list of neighbors. + if fldrType == PtVaultStandardNodes.kAgeOwnersFolder: + fldrType = PtVaultStandardNodes.kHoodMembersFolder + caret.setStringW(PtGetLocalizedString("KI.Chat.TOPrompt") + xLocTools.FolderIDToFolderName(fldrType) + U" >") + # It's not private and no player is selected. + privateChbox.setChecked(0) + self.BKPlayerSelected = None + if self.BKPlayerSelected is None: + sendToField.setString(" ") + self.SetBigKIToButtons() + # No need to keep the focus. + if self.chatMgr.isChatting: + chatedit = ptGUIControlEditBox(KIMini.dialog.getControlFromTag(kGUI.ChatEditboxID)) + KIMini.dialog.setFocus(chatedit.getKey()) + # They're playing with the player list, so reset the fade. + self.ResetFadeState() + elif ctrlID == kGUI.miniPutAwayID: + self.ToggleMiniKI() + elif ctrlID == kGUI.miniToggleBtnID: + self.ToggleKISize() + elif ctrlID == kGUI.miniTakePicture: + self.TakePicture() + elif ctrlID == kGUI.miniCreateJournal: + self.MiniKICreateJournalNote() + elif ctrlID == kGUI.miniMuteAll: + # Hit the mute button, and set mute depending on control. + audio = ptAudioControl() + if control.isChecked(): + audio.muteAll() + else: + audio.unmuteAll() + elif ctrlID == kGUI.miniPlayerListUp: + # Scroll the player list up one line. + self.ScrollPlayerList(1) + elif ctrlID == kGUI.miniPlayerListDown: + # Scroll the player list down one line. + self.ScrollPlayerList(-1) + elif ctrlID == kGUI.miniGZMarkerInRange: + self.CaptureGZMarker() + self.RefreshMiniKIMarkerDisplay() + elif ctrlID == kGUI.ChatDisplayArea: + self.ResetFadeState() + elif ctrlID == kGUI.miniMGNewMarker: + self.CreateAMarker() + elif ctrlID == kGUI.miniMGNewGame: + self.CreateMarkerGame() + elif ctrlID == kJalakMiniIconBtn: + if PtGetAgeName() == "Jalak": + self.JalakGUIToggle() + else: + ptGUIControlButton(KIMini.dialog.getControlFromTag(kJalakMiniIconBtn)).disable() + elif ctrlID == kGUI.PelletScoreButton: + self.UploadPelletScore() + elif event == kFocusChange: + # If they are chatting, get the focus back. + if self.chatMgr.isChatting: + # If the bigKI is up then let the focus go where it wants. + # Otherwise put the focus back to the chat line. + if not BigKI.dialog.isEnabled(): + KIMini.dialog.setFocus(KIMini.dialog.getControlFromTag(kGUI.ChatEditboxID)) + else: + if not self.BKInEditMode: + KIMini.dialog.setFocus(KIMini.dialog.getControlFromTag(kGUI.ChatEditboxID)) + elif event == kSpecialAction: + ctrlID = control.getTagID() + if ctrlID == kGUI.ChatEditboxID: + self.Autocomplete(control) + # Up or Down key to scroll in the chat history + elif event == kMessageHistoryUp: + ctrlID = control.getTagID() + if ctrlID == kGUI.ChatEditboxID: + self.MessageHistory(control, "up") + elif event == kMessageHistoryDown: + ctrlID = control.getTagID() + if ctrlID == kGUI.ChatEditboxID: + self.MessageHistory(control, "down") + + ## Process notifications originating from the BigKI itself. + # This does not process notifications specific to an expanded view - each + # view gets its own function, to avoid bloat. This rather deals with + # controls such as the scroll button, the mode switcher, etc., anything + # related to the navigation interface. + def ProcessNotifyBigKI(self, control, event): + + if event == kDialogLoaded: + self.BKInEditMode = False + # Put animation at off position, so there is no pop when the animation plays. + KIOnAnim.animation.skipToTime(1.5) + pdisable = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKDisabledPeopleButton)) + pdisable.disable() + gdisable = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKDisabledGearButton)) + gdisable.disable() + for ID in range(kGUI.BKIIncomingBtn, kGUI.BKIFolderLineBtnLast): + overBtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(ID)) + overBtn.setNotifyOnInteresting(1) + elif event == kShowHide: + if control.isEnabled(): + # Hide the long folder names. + for ID in range(kGUI.LONGBKIIncomingLine,kGUI.LONGBKIFolderLineLast+1): + longTB = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(ID)) + longTB.hide() + + self.BigKISetStatics() + self.BigKISetChanging() + self.RefreshPlayerList() + self.KillFadeTimer() + self.BigKIRefreshFolderList() + self.BigKIRefreshFolderDisplay() + self.ShowBigKI() + else: + self.StartFadeTimer() + elif event == kAction or event == kValueChanged: + bkID = control.getTagID() + # Is it one of the folder buttons? + if bkID >= kGUI.BKIIncomingBtn and bkID <= kGUI.BKIFolderLineBtnLast: + if self.BKFolderLineDict is self.BKConfigFolderDict: + self.BKFolderSelected = bkID - kGUI.BKIIncomingBtn + self.BKFolderTopLine + self.ShowSelectedConfig() + else: + oldselect = self.BKFolderSelected + self.BKFolderSelected = bkID - kGUI.BKIIncomingBtn + self.BKFolderTopLine + if oldselect != self.BKFolderSelected: + self.BKFolderSelectChanged = True + else: + self.BKFolderSelectChanged = False + self.ChangeBigKIMode(kGUI.BKListMode) + # Is it the scroll folder up button? + elif bkID == kGUI.BKFolderUpLine: + if self.BKFolderTopLine > 0: + self.BKFolderTopLine -= 1 + self.BigKIRefreshFolderDisplay() + self.SetBigKIToButtons() + # Is it the scroll folder down button? + elif bkID == kGUI.BKFolderDownLine: + self.BKFolderTopLine += 1 + self.BigKIRefreshFolderDisplay() + self.SetBigKIToButtons() + elif bkID == kGUI.BKLMUpButton: + if self.BKRightSideMode == kGUI.BKListMode: + if self.BKContentListTopLine > 0: + self.BKContentListTopLine -= kContentListScrollSize + if self.BKContentListTopLine < 0: + self.BKContentListTopLine = 0 + self.BigKIRefreshContentListDisplay() + elif bkID == kGUI.BKLMDownButton: + if self.BKRightSideMode == kGUI.BKListMode: + self.BKContentListTopLine += kContentListScrollSize + self.BigKIRefreshContentListDisplay() + elif bkID >= kGUI.BKIToIncomingButton and bkID <= kGUI.BKIToFolderButtonLast: + toFolderNum = bkID - kGUI.BKIToFolderButton01 + self.BKFolderTopLine + 1 + # If they are in an expanded mode, then they can move the element to another folder. + if self.BKRightSideMode != kGUI.BKListMode and self.BKCurrentContent is not None: + # Move the current content to the selected folder. + if isinstance(self.BKCurrentContent, ptPlayer): + # Add to new folder. + try: + newFolderName = self.BKFolderListOrder[toFolderNum] + newFolder = self.BKFolderLineDict[newFolderName] + playerID = self.BKCurrentContent.getPlayerID() + localPlayerID = PtGetLocalPlayer().getPlayerID() + if newFolder is not None and playerID != localPlayerID: + if newFolder.getType() == PtVaultNodeTypes.kAgeInfoNode: + self.InviteToVisit(playerID, newFolder) + elif newFolder.getType() == PtVaultNodeTypes.kPlayerInfoListNode: + newFolder.playerlistAddPlayer(playerID) + except (IndexError, KeyError): + # If there was an error, display whatever was already selected. + toFolderNum = self.BKFolderSelected + else: + oldFolder = self.BKCurrentContent.getParent() + theElement = self.BKCurrentContent.getChild() + if theElement is not None: + # Add to new folder. + try: + newFolderName = self.BKFolderListOrder[toFolderNum] + newFolder = self.BKFolderLineDict[newFolderName] + localPlayerID = PtGetLocalPlayer().getPlayerID() + if newFolder is not None: + if newFolder.getType() == PtVaultNodeTypes.kAgeInfoNode: + theElement = theElement.upcastToPlayerInfoNode() + if theElement is not None and theElement.playerGetID() != localPlayerID: + self.InviteToVisit(theElement.playerGetID(), newFolder) + elif newFolder.getType() == PtVaultNodeTypes.kPlayerInfoListNode: + theElement = theElement.upcastToPlayerInfoNode() + if theElement is not None and theElement.playerGetID() != localPlayerID: + theElement = theElement.upcastToPlayerInfoNode() + newFolder.playerlistAddPlayer(theElement.playerGetID()) + else: + self.BKCurrentContent = newFolder.addNode(theElement) + if oldFolder is not None: + oldFolder.removeNode(theElement) + except (IndexError, KeyError): + # If there was an error, display whatever was already selected. + toFolderNum = self.BKFolderSelected + # Leave it at the folder they are on. + self.BKFolderSelectChanged = True + self.ChangeBigKIMode(kGUI.BKListMode) + # They could have copied a player, so refresh list. + self.RefreshPlayerList() + elif bkID == kGUI.BKRadioModeID: + # Save the previous selected and top line. + if self.BKFolderLineDict is self.BKJournalFolderDict: + self.BKJournalFolderSelected = self.BKFolderSelected + self.BKJournalFolderTopLine = self.BKFolderTopLine + elif self.BKFolderLineDict is self.BKPlayerFolderDict: + self.BKPlayerFolderSelected = self.BKFolderSelected + self.BKPlayerFolderTopLine = self.BKFolderTopLine + elif self.BKFolderLineDict is self.BKConfigFolderDict: + self.BKConfigFolderSelected = self.BKFolderSelected + self.BKConfigFolderTopLine = self.BKFolderTopLine + modeselect = control.getValue() + # Is it journal mode? + if modeselect == 0: + self.BKFolderLineDict = self.BKJournalFolderDict + self.BKFolderListOrder = self.BKJournalListOrder + self.BKFolderSelected = self.BKJournalFolderSelected + self.BKFolderTopLine = self.BKJournalFolderTopLine + # Is it player list mode? + elif modeselect == 1: + self.BKFolderLineDict = self.BKPlayerFolderDict + self.BKFolderListOrder = self.BKPlayerListOrder + self.BKFolderSelected = self.BKPlayerFolderSelected + self.BKFolderTopLine = self.BKPlayerFolderTopLine + # It is configuration mode. + else: + self.BKFolderLineDict = self.BKConfigFolderDict + self.BKFolderListOrder = self.BKConfigListOrder + self.BKFolderSelected = self.BKConfigFolderSelected + self.BKFolderTopLine = self.BKConfigFolderTopLine + # Reset the top line and selection. + self.BigKIRefreshFolderDisplay() + if modeselect == 0 and (self.BKRightSideMode == kGUI.BKPictureExpanded or self.BKRightSideMode == kGUI.BKJournalExpanded or self.BKRightSideMode == kGUI.BKMarkerListExpanded): + # The player is taking a picture. + self.BigKIInvertToFolderButtons() + else: + # Is the player switching to configuration mode? + if modeselect == 2: + self.ShowSelectedConfig() + # Otherwise, make sure the player is in list mode. + else: + self.ChangeBigKIMode(kGUI.BKListMode) + elif bkID == kGUI.BKIToPlayerButton: + if self.BKCurrentContent is not None and self.BKPlayerSelected is not None: + sendElement = self.BKCurrentContent.getChild() + toPlayerBtn = ptGUIControlButton(BigKI.dialog.getControlFromTag(kGUI.BKIToPlayerButton)) + if sendElement is not None: + if isinstance(self.BKPlayerSelected, DeviceFolder): + pass + elif isinstance(self.BKPlayerSelected, Device): + if self.BKPlayerSelected.name in self.imagerMap: + sName = "Upload={}".format(self.BKPlayerSelected.name) + SendNote(self.key, self.imagerMap[self.BKPlayerSelected.name], sName, sendElement.getID()) + toPlayerBtn.hide() + elif isinstance(self.BKPlayerSelected, ptVaultNode): + if self.BKPlayerSelected.getType() == PtVaultNodeTypes.kPlayerInfoListNode: + plyrRefList = self.BKPlayerSelected.getChildNodeRefList() + for plyrRef in plyrRefList: + plyr = plyrRef.getChild() + plyr = plyr.upcastToPlayerInfoNode() + if plyr is not None: + sendElement.sendTo(plyr.playerGetID()) + elif self.BKPlayerSelected.getType() == PtVaultNodeTypes.kPlayerInfoNode: + sendElement.sendTo(self.BKPlayerSelected.playerGetID()) + else: + self.SetSendToErrorMessage(PtGetLocalizedString("KI.Errors.CantSend")) + toPlayerBtn.hide() + elif isinstance(self.BKPlayerSelected, ptVaultNodeRef): + plyrElement = self.BKPlayerSelected.getChild() + if plyrElement is not None and plyrElement.getType() == PtVaultNodeTypes.kPlayerInfoNode: + plyrElement = plyrElement.upcastToPlayerInfoNode() + sendElement.sendTo(plyrElement.playerGetID()) + else: + self.SetSendToErrorMessage(PtGetLocalizedString("KI.Errors.PlayerNotFound")) + toPlayerBtn.hide() + elif isinstance(self.BKPlayerSelected, ptPlayer): + sendElement.sendTo(self.BKPlayerSelected.getPlayerID()) + toPlayerBtn.hide() + else: + self.SetSendToErrorMessage(PtGetLocalizedString("KI.Errors.UnknownPlayerType")) + else: + self.SetSendToErrorMessage(PtGetLocalizedString("KI.Errors.BadJournalElement")) + elif event == kInterestingEvent: + if control is not None: + shortTB = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(control.getTagID() + 21)) + longTB = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(control.getTagID() + 521)) + if shortTB.getStringJustify() == kRightJustify and control.isInteresting(): + # Switch to long versions. + longTB.setForeColor(shortTB.getForeColor()) + longTB.setString(shortTB.getString()) + shortTB.hide() + longTB.show() + else: + shortTB.show() + longTB.hide() + + ## Process notifications originating from a list mode in the BigKI. + # Handles navigation from a list mode (like a list of players or notes) to + # the specified content (a picture, a note, a marker game...). Also takes + # care of creating a new entry when asked. + def ProcessNotifyListMode(self, control, event): + + if event == kAction or event == kValueChanged: + lmID = control.getTagID() + if lmID >= kGUI.BKIListModeLineBtn01 and lmID <= kGUI.BKIListModeLineBtnLast: + # Find out which button was clicked and its associated content. + whichOne = lmID - kGUI.BKIListModeLineBtn01 + self.BKContentListTopLine + if whichOne < len(self.BKContentList): + theContent = self.BKContentList[whichOne] + if theContent is not None: + self.BKCurrentContent = theContent + if isinstance(self.BKCurrentContent, ptPlayer): + nextMode = kGUI.BKPlayerExpanded + self.ChangeBigKIMode(nextMode) + else: + theElement = theContent.getChild() + if theElement is not None: + dataType = theElement.getType() + if dataType == PtVaultNodeTypes.kTextNoteNode: + nextMode = kGUI.BKJournalExpanded + elif dataType == PtVaultNodeTypes.kImageNode: + nextMode = kGUI.BKPictureExpanded + elif dataType == PtVaultNodeTypes.kPlayerInfoNode: + nextMode = kGUI.BKPlayerExpanded + elif dataType == PtVaultNodeTypes.kMarkerGameNode: + nextMode = kGUI.BKMarkerListExpanded + else: + self.BKCurrentContent = None + nextMode = kGUI.BKListMode + self.ChangeBigKIMode(nextMode) + else: + PtDebugPrint(u"xKI.ProcessNotifyListMode(): List Mode: content is None for element!", level=kErrorLevel) + elif lmID == kGUI.BKIListModeCreateBtn: + if self.BKFolderLineDict is self.BKPlayerFolderDict: + self.BKGettingPlayerID = True + self.ChangeBigKIMode(kGUI.BKPlayerExpanded) + else: + self.BigKICreateJournalNote() + self.ChangeBigKIMode(kGUI.BKJournalExpanded) + self.BigKIDisplayJournalEntry() + self.BigKIEnterEditMode(kGUI.BKEditFieldJRNTitle) + + ## Process notifications originating from an expanded picture mode in the BigKI. + # This essentially deals with the taking of new pictures and the editing of + # existing ones, as well as their deletion. + def ProcessNotifyPictureExpanded(self, control, event): + + if event == kDialogLoaded: + editBox = ptGUIControlEditBox(KIPictureExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[kGUI.BKEditFieldPICTitle][kGUI.BKEditIDeditbox])) + editBox.hide() + elif event == kShowHide: + if control.isEnabled(): + self.BigKIDisplayPicture() + elif event == kAction or event == kValueChanged: + peID = control.getTagID() + if peID == kGUI.BKIPICTitleButton: + if self.IsContentMutable(self.BKCurrentContent): + self.BigKIEnterEditMode(kGUI.BKEditFieldPICTitle) + elif peID == kGUI.BKIPICDeleteButton: + self.YNWhatReason = kGUI.YNDelete + elem = self.BKCurrentContent.getChild() + elem = elem.upcastToImageNode() + if elem is not None: + picTitle = elem.imageGetTitle() + else: + picTitle = "" + yesText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + yesText.setStringW(PtGetLocalizedString("KI.Messages.DeletePicture", [xCensor.xCensor(picTitle, self.censorLevel)])) + self.LocalizeDialog(1) + KIYesNo.dialog.show() + elif peID == kGUI.BKIPICTitleEdit: + self.BigKISaveEdit(1) + elif event == kFocusChange: + if self.IsContentMutable(self.BKCurrentContent): + self.BigKICheckFocusChange() + + ## Process notifications originating from an expanded journal mode in the BigKI. + # Handles note creation, editing and deletion. + def ProcessNotifyJournalExpanded(self, control, event): + + if event == kDialogLoaded: + editBox = ptGUIControlEditBox(KIJournalExpanded.dialog.getControlFromTag(kGUI.BKEditFieldIDs[kGUI.BKEditFieldJRNTitle][kGUI.BKEditIDeditbox])) + editBox.hide() + elif event == kShowHide: + if control.isEnabled(): + self.BigKIDisplayJournalEntry() + elif event == kAction or event == kValueChanged: + jeID = control.getTagID() + # Is it one of the buttons? + if jeID == kGUI.BKIJRNTitleButton: + if self.IsContentMutable(self.BKCurrentContent): + self.BigKIEnterEditMode(kGUI.BKEditFieldJRNTitle) + elif jeID == kGUI.BKIJRNNoteButton: + if self.IsContentMutable(self.BKCurrentContent): + self.BigKIEnterEditMode(kGUI.BKEditFieldJRNNote) + elif jeID == kGUI.BKIJRNDeleteButton: + self.YNWhatReason = kGUI.YNDelete + elem = self.BKCurrentContent.getChild() + elem = elem.upcastToTextNoteNode() + if elem is not None: + jrnTitle = elem.noteGetTitle() + else: + jrnTitle = "" + yesText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + yesText.setStringW(PtGetLocalizedString("KI.Messages.DeleteJournal", [xCensor.xCensor(jrnTitle, self.censorLevel)])) + self.LocalizeDialog(1) + KIYesNo.dialog.show() + # Is it one of the editing boxes? + elif jeID == kGUI.BKIJRNTitleEdit or jeID == kGUI.BKIJRNNoteEdit: + if self.IsContentMutable(self.BKCurrentContent): + self.BigKISaveEdit(1) + elif event == kFocusChange: + if self.IsContentMutable(self.BKCurrentContent): + if control is not None: + # If the focus is changing to the multiline, the plaer is entering edit mode. + jeID = control.getTagID() + if jeID == kGUI.BKIJRNNote: + self.BigKIEnterEditMode(kGUI.BKEditFieldJRNNote) + return + self.BigKICheckFocusChange() + + ## Process notifications originating from an expanded player mode in the BigKI. + # Handles deletion of a player's entry. + def ProcessNotifyPlayerExpanded(self, control, event): + + if event == kShowHide: + if control.isEnabled(): + self.BigKIDisplayPlayerEntry() + elif event == kAction or event == kValueChanged: + plID = control.getTagID() + # Is it one of the buttons? + if plID == kGUI.BKIPLYDeleteButton: + self.YNWhatReason = kGUI.YNDelete + elem = self.BKCurrentContent.getChild() + elem = elem.upcastToPlayerInfoNode() + if elem is not None: + plyrName = elem.playerGetName() + else: + plyrName = "" + try: + pfldName = self.BKFolderListOrder[self.BKFolderSelected] + except LookupError: + pfldName = "" + yesText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + yesText.setStringW(PtGetLocalizedString("KI.Messages.DeletePlayer", [xCensor.xCensor(plyrName, self.censorLevel), pfldName])) + self.LocalizeDialog(1) + KIYesNo.dialog.show() + elif plID == kGUI.BKIPLYPlayerIDEditBox: + self.BigKICheckSavePlayer() + elif event == kFocusChange: + if self.BKGettingPlayerID: + if KIPlayerExpanded.dialog.isEnabled(): + plyIDedit = ptGUIControlEditBox(KIPlayerExpanded.dialog.getControlFromTag(kGUI.BKIPLYPlayerIDEditBox)) + plyIDedit.focus() + KIPlayerExpanded.dialog.setFocus(plyIDedit.getKey()) + else: + self.BKGettingPlayerID = False + self.ChangeBigKIMode(kGUI.BKListMode) + + ## Process notifications originating from an expanded settings mode in the BigKI. + # Handles the processing tied to settings modification. + def ProcessNotifySettingsExpanded(self, control, event): + + if event == kShowHide: + if control.isEnabled(): + tfield = ptGUIControlTextBox(KISettings.dialog.getControlFromTag(kGUI.BKIKISettingsText)) + tfield.setStringW(PtGetLocalizedString("KI.Config.Settings")) + tfield = ptGUIControlTextBox(KISettings.dialog.getControlFromTag(kGUI.BKIKIFontSizeText)) + tfield.setStringW(PtGetLocalizedString("KI.Config.FontSize")) + tfield = ptGUIControlTextBox(KISettings.dialog.getControlFromTag(kGUI.BKIKIFadeTimeText)) + tfield.setStringW(PtGetLocalizedString("KI.Config.ChatFadeTime")) + tfield = ptGUIControlTextBox(KISettings.dialog.getControlFromTag(kGUI.BKIKIOnlyPMText)) + tfield.setStringW(PtGetLocalizedString("KI.Config.OnlyBuddies")) + self.RefreshKISettings() + else: + self.SaveFontSize() + self.SaveFadeTime() + self.SaveKIFlags() + elif event == kAction or event == kValueChanged: + kiID = control.getTagID() + if kiID == kGUI.BKIKIFontSize: + slidePerFont = float(control.getMax() - control.getMin() + 1.0) / float(len(kChat.FontSizeList)) + fontIndex = int(control.getValue() / slidePerFont + 0.25) + if fontIndex >= len(kChat.FontSizeList): + fontIndex = len(kChat.FontSizeList) - 1 + self.SetFontSize(kChat.FontSizeList[fontIndex]) + elif kiID == kGUI.BKIKIFadeTime: + slidePerTime = float(control.getMax() - control.getMin()) / float(kChat.FadeTimeMax) + self.chatMgr.ticksOnFull = int(control.getValue() / slidePerTime + 0.25) + PtDebugPrint(u"xKI.ProcessNotifySettingsExpanded(): FadeTime set to {}.".format(self.chatMgr.ticksOnFull), level=kDebugDumpLevel) + if self.chatMgr.ticksOnFull == kChat.FadeTimeMax: + self.chatMgr.fadeEnableFlag = False + PtDebugPrint(u"KISettings: FadeTime disabled.", level=kDebugDumpLevel) + else: + self.chatMgr.fadeEnableFlag = True + PtDebugPrint(u"KISettings: FadeTime enabled.", level=kDebugDumpLevel) + elif kiID == kGUI.BKIKIOnlyPM: + self.onlyGetPMsFromBuddies = control.isChecked() + elif kiID == kGUI.BKIKIBuddyCheck: + self.onlyAllowBuddiesOnRequest = control.isChecked() + + ## Process notifications originating from an expanded settings mode in the BigKI. + # Handles the sound controls from the options menu being modified. + def ProcessNotifyVolumeExpanded(self, control, event): + + if event == kShowHide: + if control.isEnabled(): + self.RefreshVolumeSettings() + elif event == kAction or event == kValueChanged: + plID = control.getTagID() + audio = ptAudioControl() + if plID == kGUI.BKISoundFXVolSlider: + setting = control.getValue() + PtDebugPrint(u"xKI.ProcessNotifyVolumeExpanded(): SoundFX being changed to {:g} (into {:g}).".format(setting, setting / 10), level=kDebugDumpLevel) + audio.setSoundFXVolume(setting / 10) + elif plID == kGUI.BKIMusicVolSlider: + setting = control.getValue() + PtDebugPrint(u"xKI.ProcessNotifyVolumeExpanded(): Music being changed to {:g} (into {:g}).".format(setting, setting / 10), level=kDebugDumpLevel) + audio.setMusicVolume(setting / 10) + elif plID == kGUI.BKIVoiceVolSlider: + setting = control.getValue() + PtDebugPrint(u"xKI.ProcessNotifyVolumeExpanded(): Voice being changed to {:g} (into {:g}).".format(setting, setting / 10), level=kDebugDumpLevel) + audio.setVoiceVolume(setting / 10) + elif plID == kGUI.BKIAmbienceVolSlider: + setting = control.getValue() + PtDebugPrint(u"xKI.ProcessNotifyVolumeExpanded(): Ambience being changed to {:g} (into {:g}).".format(setting, setting / 10), level=kDebugDumpLevel) + audio.setAmbienceVolume(setting / 10) + elif plID == kGUI.BKIMicLevelSlider: + setting = control.getValue() + PtDebugPrint(u"xKI.ProcessNotifyVolumeExpanded(): MicLevel being changed to {:g} (into {:g}).".format(setting, setting / 10), level=kDebugDumpLevel) + audio.setMicLevel(setting / 10) + elif plID == kGUI.BKIGUIVolSlider: + setting = control.getValue() + PtDebugPrint(u"xKI.ProcessNotifyVolumeExpanded(): MicLevel being changed to {:g} (into {:g}).".format(setting, setting / 10), level=kDebugDumpLevel) + audio.setGUIVolume(setting / 10) + + ## Process notifications originating from an expanded Age Owner mode in the BigKI. + # Processes owned Ages (currently only applies to Neighborhoods). Note that + # the public/private feature is currently available only through the Nexus. + # This mostly handles description modifications for now. + def ProcessNotifyAgeOwnerExpanded(self, control, event): + + if event == kShowHide: + if control.isEnabled(): + tField = ptGUIControlTextBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerDescriptionTitle)) + tField.setStringW(PtGetLocalizedString("KI.Config.Description")) + titleEdit = ptGUIControlEditBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleEditbox)) + titleEdit.hide() + self.RefreshAgeOwnerSettings() + elif event == kAction or event == kValueChanged: + plID = control.getTagID() + if plID == kGUI.BKAgeOwnerMakePublicBtn: + # This feature is not currently available in the BigKI. + try: + vault = ptVault() + myAge = self.BKConfigFolderDict[self.BKConfigListOrder[self.BKFolderSelected]] + myAgeStruct = myAge.asAgeInfoStruct() + makePublic = 1 + if myAge.isPublic(): + makePublic = 0 + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Making {} private.".format(myAge.getDisplayName()), level=kDebugDumpLevel) + else: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Making {} public.".format(myAge.getDisplayName()), level=kDebugDumpLevel) + vault.setAgePublic(myAgeStruct, makePublic) + # Let the refresh re-enable the public button. + control.disable() + except AttributeError: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Couldn't toggle public/private.", level=kErrorLevel) + elif plID == kGUI.BKAgeOwnerTitleBtn: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Change title button hit.", level=kDebugDumpLevel) + control.disable() + title = ptGUIControlTextBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleTB)) + title.hide() + titleEdit = ptGUIControlEditBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleEditbox)) + try: + # Get the selected Age config setting. + myAge = self.BKConfigFolderDict[self.BKConfigListOrder[self.BKFolderSelected]] + titleEdit.setString(myAge.getAgeUserDefinedName()) + except LookupError: + titleEdit.setString("") + titleEdit.show() + titleEdit.end() + KIAgeOwnerExpanded.dialog.setFocus(titleEdit.getKey()) + elif plID == kGUI.BKAgeOwnerTitleEditbox: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): edit field set.", level=kDebugDumpLevel) + self.SaveAgeNameFromEdit(control) + elif event == kFocusChange: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Focus change.", level=kDebugDumpLevel) + titleEdit = ptGUIControlEditBox(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerTitleEditbox)) + if titleEdit.isVisible(): + if control is None or (control.getTagID() != kGUI.BKAgeOwnerTitleEditbox and control.getTagID() != kGUI.BKAgeOwnerTitleBtn): + self.SaveAgeNameFromEdit(titleEdit) + if control is not None: + # Check if the decription was updated. + plID = control.getTagID() + if plID == kGUI.BKAgeOwnerDescription: + self.BKAgeOwnerEditDescription = True + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Start editing description.", level=kDebugDumpLevel) + else: + if self.BKAgeOwnerEditDescription: + descript = ptGUIControlMultiLineEdit(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerDescription)) + myAge = self.BKConfigFolderDict[self.BKConfigListOrder[self.BKFolderSelected]] + if myAge is not None: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Age description updated for {}.".format(myAge.getDisplayName()), level=kDebugDumpLevel) + myAge.setAgeDescription(descript.getString()) + myAge.save() + else: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Neighborhood is None while trying to update description.", level=kDebugDumpLevel) + self.BKAgeOwnerEditDescription = False + else: + if self.BKAgeOwnerEditDescription: + descript = ptGUIControlMultiLineEdit(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerDescription)) + myAge = self.BKConfigFolderDict[self.BKConfigListOrder[self.BKFolderSelected]] + if myAge is not None: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Age description updated for {}.".format(myAge.getDisplayName()), level=kDebugDumpLevel) + buff = descript.getEncodedBuffer() + myAge.setAgeDescription(str(buff)) + myAge.save() + else: + PtDebugPrint(u"xKI.ProcessNotifyAgeOwnerExpanded(): Neighborhood is None while trying to update description.", level=kDebugDumpLevel) + self.BKAgeOwnerEditDescription = False + + ## Process notifications originating from a YesNo dialog. + # Yes/No dialogs are omnipresent throughout Uru. Those processed here are: + # - Quitting dialog (quit/logout/cancel). + # - Deleting dialog (yes/no); various such dialogs. + # - Link offer dialog (yes/no). + # - Outside sender dialog (?). + # - KI Full dialog (OK); just a notification. + def ProcessNotifyYesNo(self, control, event): + + if event == kAction or event == kValueChanged: + ynID = control.getTagID() + if self.YNWhatReason == kGUI.YNQuit: + if ynID == kGUI.YesButtonID: + PtConsole("App.Quit") + elif ynID == kGUI.NoButtonID: + KIYesNo.dialog.hide() + logoutText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutTextID)) + logoutText.hide() + logoutButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutButtonID)) + logoutButton.hide() + elif ynID == kGUI.YesNoLogoutButtonID: + KIYesNo.dialog.hide() + logoutText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutTextID)) + logoutText.hide() + logoutButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.YesNoLogoutButtonID)) + logoutButton.hide() + + # Clear out all chat on microKI. + chatArea = ptGUIControlMultiLineEdit(KIMicro.dialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatArea.setString("") + chatArea.moveCursor(PtGUIMultiLineDirection.kBufferStart) + KIMicro.dialog.refreshAllControls() + + # Clear out all chat on miniKI. + chatArea = ptGUIControlMultiLineEdit(KIMini.dialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatArea.setString("") + chatArea.moveCursor(PtGUIMultiLineDirection.kBufferStart) + KIMini.dialog.refreshAllControls() + + linkmgr = ptNetLinkingMgr() + ageLink = ptAgeLinkStruct() + + ageInfo = ptAgeInfoStruct() + ageInfo.setAgeFilename("StartUp") + + spawnPoint = ptSpawnPointInfo() + spawnPoint.setName("LinkInPointDefault") + + ageLink.setAgeInfo(ageInfo) + ageLink.setSpawnPoint(spawnPoint) + ageLink.setLinkingRules(PtLinkingRules.kBasicLink) + linkmgr.linkToAge(ageLink) + + elif self.YNWhatReason == kGUI.YNDelete: + if ynID == kGUI.YesButtonID: + # Remove the current element + if self.BKCurrentContent is not None: + delFolder = self.BKCurrentContent.getParent() + delElem = self.BKCurrentContent.getChild() + if delFolder is not None and delElem is not None: + # Are we removing a visitor from an Age we own? + tFolder = delFolder.upcastToFolderNode() + if tFolder is not None and tFolder.folderGetType() == PtVaultStandardNodes.kCanVisitFolder: + PtDebugPrint(u"xKI.ProcessNotifyYesNo(): Revoking visitor.", level=kDebugDumpLevel) + delElem = delElem.upcastToPlayerInfoNode() + # Need to refind the folder that has the ageInfo in it. + ageFolderName = self.BKFolderListOrder[self.BKFolderSelected] + ageFolder = self.BKFolderLineDict[ageFolderName] + # Revoke invite. + ptVault().unInvitePlayerToAge(ageFolder.getAgeInstanceGuid(), delElem.playerGetID()) + # Are we removing a player from a player list? + elif delFolder.getType() == PtVaultNodeTypes.kPlayerInfoListNode and delElem.getType() == PtVaultNodeTypes.kPlayerInfoNode: + PtDebugPrint(u"xKI.ProcessNotifyYesNo(): Removing player from folder.", level=kDebugDumpLevel) + delFolder = delFolder.upcastToPlayerInfoListNode() + delElem = delElem.upcastToPlayerInfoNode() + delFolder.playerlistRemovePlayer(delElem.playerGetID()) + self.BKPlayerSelected = None + sendToField = ptGUIControlTextBox(BigKI.dialog.getControlFromTag(kGUI.BKIPlayerLine)) + sendToField.setString(" ") + # Are we removing a journal entry? + else: + # See if this is a Marker Game folder that is being deleted. + if delElem.getType() == PtVaultNodeTypes.kMarkerGameNode: + if self.markerGameManager.IsActive(delElem): + self.markerGameManager.StopGame() + + self.BKCurrentContent = None + delFolder.removeNode(delElem) + PtDebugPrint(u"xKI.ProcessNotifyYesNo(): Deleting element from folder.", level=kDebugDumpLevel) + else: + PtDebugPrint(u"xKI.ProcessNotifyYesNo(): Tried to delete bad Vault node or delete from bad folder.", level=kErrorLevel) + self.ChangeBigKIMode(kGUI.BKListMode) + self.RefreshPlayerList() + self.YNWhatReason = kGUI.YNQuit + KIYesNo.dialog.hide() + elif self.YNWhatReason == kGUI.YNOfferLink: + self.YNWhatReason = kGUI.YNQuit + KIYesNo.dialog.hide() + if ynID == kGUI.YesButtonID: + if self.offerLinkFromWho is not None: + PtDebugPrint(u"xKI.ProcessNotifyYesNo(): Linking to offered age {}.".format(self.offerLinkFromWho.getDisplayName()), level=kDebugDumpLevel) + link = ptAgeLinkStruct() + link.setLinkingRules(PtLinkingRules.kBasicLink) + link.setAgeInfo(self.offerLinkFromWho) + ptNetLinkingMgr().linkToAge(link) + self.offerLinkFromWho = None + self.offerLinkFromWho = None + elif self.YNWhatReason == kGUI.YNOutside: + self.YNWhatReason = kGUI.YNQuit + KIYesNo.dialog.hide() + if self.YNOutsideSender is not None: + note = ptNotify(self.key) + note.clearReceivers() + note.addReceiver(self.YNOutsideSender) + note.netPropagate(0) + note.netForce(0) + # Is it a good return? + if ynID == kGUI.YesButtonID: + note.setActivate(1) + note.addVarNumber("YesNo", 1) + # Or a bad return? + elif ynID == kGUI.NoButtonID: + note.setActivate(0) + note.addVarNumber("YesNo", 0) + note.send() + self.YNOutsideSender = None + elif self.YNWhatReason == kGUI.YNKIFull: + KIYesNo.dialog.hide() + yesButton = ptGUIControlButton(KIYesNo.dialog.getControlFromTag(kGUI.YesButtonID)) + yesButton.show() + yesBtnText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesButtonTextID)) + yesBtnText.show() + noBtnText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.NoButtonTextID)) + noBtnText.setStringW(PtGetLocalizedString("KI.YesNoDialog.NOButton")) + self.YNWhatReason = kGUI.YNQuit + else: + self.YNWhatReason = kGUI.YNQuit + KIYesNo.dialog.hide() + self.YNOutsideSender = None + elif event == kExitMode: + self.YNWhatReason = kGUI.YNQuit + KIYesNo.dialog.hide() + self.YNOutsideSender = None + + ## Process notifications originating from a new item alert dialog. + # Such alerts make either the KI's icon or the Yeesha Book icon + # flash for a while. + def ProcessNotifyNewItemAlert(self, control, event): + + if event == kDialogLoaded: + kiAlert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertKIAlert)) + kiAlert.disable() + kiAlert.hide() + bookalert = ptGUIControlButton(NewItemAlert.dialog.getControlFromTag(kAlertBookAlert)) + bookalert.disable() + bookalert.hide() + elif event == kShowHide: + if control.isEnabled(): + self.AlertStartTimer() + + ## Process notifications originating from the Marker Game creation GUI. + # This gets the values submitted by the player and passes them to the + # Marker Game manager. + def ProcessNotifyCreateMarkerGameGUI(self, control, event): + + if control: + tagID = control.getTagID() + if event == kDialogLoaded: + self.markerGameDefaultColor = ptGUIControlTextBox(KICreateMarkerGameGUI.dialog.getControlFromTag(kGUI.MarkerGameLabel1)).getForeColor() + self.markerGameSelectedColor = ptGUIControlTextBox(KICreateMarkerGameGUI.dialog.getControlFromTag(kGUI.MarkerGameLabel1)).getSelectColor() + elif event == kShowHide: + self.InitMarkerGameGUI() + PtDebugPrint(u"xKI.ProcessNotifyCreateMarkerGameGUI(): Marker Game dialog is showing or hiding.", level=kDebugDumpLevel) + elif event == kAction or event == kValueChanged: + if tagID == kGUI.MarkerGameType1 or tagID == kGUI.MarkerGameType2 or tagID == kGUI.MarkerGameType3: + self.SelectMarkerType(tagID) + elif tagID == kGUI.CreateMarkerGameCancelBT: + KIMarkerGameGUIClose.run(self.key, netPropagate=0) + elif kGUI.CreateMarkerGameSubmitBT: + markerGameNameText = ptGUIControlEditBox(KICreateMarkerGameGUI.dialog.getControlFromTag(kGUI.CreateMarkerGameNameEB)).getStringW() + try: + markerGameType = kGUI.MarkerGameStates[self.selectedMGType] + except: + markerGameType = 0 + PtDebugPrint(u"xKI.ProcessNotifyCreateMarkerGameGUI(): Couldn't find marker game type, so setting it to Quest Mode.", level=kWarningLevel) + self.FinishCreateMarkerGame(markerGameNameText) + KIMarkerGameGUIClose.run(self.key, netPropagate=0) + + ## Processes notifications originating from an expanded Marker Game mode in the BigKI. + # This handles the edit buttons, marker saving buttons, deletion buttons, + # etc.. + def ProcessNotifyMarkerFolderExpanded(self, control, event): + + mgr = self.markerGameManager + + if event == kDialogLoaded: + typeField = ptGUIControlTextBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderGameTimeTB)) + typeField.setString(kLoc.MarkerFolderPopupMenu[self.markerGameTimeID][0]) + elif event == kShowHide: + # Reset the edit text lines. + if control.isEnabled(): + titleEdit = ptGUIControlEditBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderTitleEB)) + titleEdit.hide() + markerEdit = ptGUIControlEditBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerTextEB)) + markerEdit.hide() + self.BigKIDisplayMarkerGame() + elif event == kAction or event == kValueChanged: + mFldrID = control.getTagID() + if mFldrID == kGUI.MarkerFolderEditStartGame: + mgr.LoadGame(self.BKCurrentContent) + + # Is it the "Edit" button? + if self.MFdialogMode == kGames.MFOverview: + mgr.BeginEditingMarkers() + self.SetWorkingToCurrentMarkerGame() + # Is it the "Done Editing" button? + elif self.MFdialogMode == kGames.MFEditing: + mgr.FinishEditingMarkers() + self.ResetWorkingMarkerGame() + # Is it the "Stop Game" button? + elif self.MFdialogMode == kGames.MFPlaying: + mgr.StopGame(reset=False) + # Is it the "Save Marker" button? + elif self.MFdialogMode == kGames.MFEditingMarker: + # Should already be saved, just clear selection for now. + mgr.selected_marker_id = -1 + self.BigKICheckContentRefresh(self.BKCurrentContent) + elif mFldrID == kGUI.MarkerFolderPlayEndGame: + mgr.LoadGame(self.BKCurrentContent) + + # Is it the "Play Game" button? + if self.MFdialogMode == kGames.MFOverview: + mgr.Play() + # Is it the "Add Marker" button? + elif self.MFdialogMode == kGames.MFEditing: + self.CreateAMarker() + # Is it the "Reset Game" button? + elif self.MFdialogMode == kGames.MFPlaying: + mgr.StopGame(reset=True) + # Is it the "Remove Marker" button? + elif self.MFdialogMode == kGames.MFEditingMarker: + mgr.DeleteMarker(mgr.selected_marker_id) + self.BigKICheckContentRefresh(self.BKCurrentContent) + + elif mFldrID == kGUI.MarkerFolderMarkListbox: + mgr.LoadGame(self.BKCurrentContent) + + # Save the current scroll position before transitioning to some other content + mfmlb = ptGUIControlListBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkListbox)) + self.MFScrollPos = mfmlb.getScrollPos() + + if not mgr.playing: + # NOTE: We must use selected_marker_index because marker IDs don't necessarily + # match up with the indices used in the GUI + mgr.selected_marker_index = control.getSelection() + self.BigKICheckContentRefresh(self.BKCurrentContent) + + elif mFldrID == kGUI.MarkerFolderTitleBtn: + control.disable() + title = ptGUIControlTextBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderTitleText)) + titleEdit = ptGUIControlEditBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderTitleEB)) + titleEdit.setStringW(title.getStringW()) + title.hide() + titleEdit.show() + titleEdit.end() + KIMarkerFolderExpanded.dialog.setFocus(titleEdit.getKey()) + elif mFldrID == kGUI.MarkerFolderTitleEB: + self.SaveMarkerGameNameFromEdit(control) + self.BigKICheckContentRefresh(self.BKCurrentContent) + elif mFldrID == kGUI.MarkerFolderMarkerTextBtn: + control.disable() + title = ptGUIControlTextBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerTextTB)) + titleEdit = ptGUIControlEditBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerTextEB)) + titleEdit.setStringW(title.getStringW()) + title.hide() + titleEdit.show() + titleEdit.end() + KIMarkerFolderExpanded.dialog.setFocus(titleEdit.getKey()) + elif mFldrID == kGUI.MarkerFolderMarkerTextEB: + self.SaveMarkerTextFromEdit(control) + self.BigKICheckContentRefresh(self.BKCurrentContent) + elif mFldrID == kGUI.MarkerFolderTimePullDownBtn or mFldrID == kGUI.MarkerFolderTimeArrow: + KIMarkerFolderPopupMenu.menu.show() + elif mFldrID == kGUI.MarkerFolderDeleteBtn: + self.YNWhatReason = kGUI.YNDelete + elem = self.BKCurrentContent.getChild() + elem = elem.upcastToMarkerGameNode() + if elem is not None: + mfTitle = elem.getGameName() + else: + mfTitle = "" + yesText = ptGUIControlTextBox(KIYesNo.dialog.getControlFromTag(kGUI.YesNoTextID)) + yesText.setStringW(PtGetLocalizedString("KI.Messages.DeletePicture", [xCensor.xCensor(mfTitle, self.censorLevel)])) + self.LocalizeDialog(1) + KIYesNo.dialog.show() + elif event == kFocusChange: + titleEdit = ptGUIControlEditBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderTitleEB)) + # Is the editbox enabled and something other than the button is getting the focus? + if titleEdit.isVisible(): + if control is None or (control.getTagID() != kGUI.MarkerFolderTitleEB and control.getTagID() != kGUI.MarkerFolderTitleBtn): + self.SaveMarkerGameNameFromEdit(titleEdit) + if self.MFdialogMode == kGames.MFEditingMarker: + titleEdit = ptGUIControlEditBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderMarkerTextEB)) + # Is the editbox enabled and something other than the button is getting the focus? + if titleEdit.isVisible(): + if control is None or (control.getTagID() != kGUI.MarkerFolderMarkerTextEB and control.getTagID() != kGUI.MarkerFolderMarkerTextBtn): + self.SaveMarkerTextFromEdit(titleEdit) + self.BigKICheckContentRefresh(self.BKCurrentContent) + + ## Processes notifications originating from the Marker Game popup menu. + # (What is this? Is it used?) + def ProcessNotifyMarkerFolderPopupMenu(self, control, event): + + if event == kDialogLoaded: + for menuItem in kLoc.MarkerFolderPopupMenu: + KIMarkerFolderPopupMenu.menu.addNotifyItem(menuItem[0]) + elif event == kAction: + menuID = control.getTagID() + self.markerGameTimeID = menuID + typeField = ptGUIControlTextBox(KIMarkerFolderExpanded.dialog.getControlFromTag(kGUI.MarkerFolderGameTimeTB)) + typeField.setString(kLoc.MarkerFolderPopupMenu[self.markerGameTimeID][0]) + # Save the current Marker Game to this type of game. + if self.BKCurrentContent is not None: + element = self.BKCurrentContent.getChild() + if element is not None: + datatype = element.getType() + if datatype == PtVaultNodeTypes.kMarkerGameNode: + element = element.upcastToMarkerGameNode() + if element: + element.setRoundLength(kLoc.MarkerFolderPopupMenu[self.markerGameTimeID][1]) + element.save() + elif event == kExitMode: + if KIMarkerFolderPopupMenu.menu.isEnabled(): + KIMarkerFolderPopupMenu.menu.hide() + + ## Processes notifications originating from the Jalak GUI. + # These controls are only used within the Age of Jalak, obviously. + def ProcessNotifyJalakGUI(self, control, event): + + if event == kDialogLoaded: + self.JalakGUIInit() + elif event == kAction or event == kValueChanged: + if control is not None: + tagID = control.getTagID() + btn = str(tagID) + if btn in JalakBtnStates: + KIJalakBtnLights.run(self.key, state=btn, netPropagate=0) + self.SetJalakGUIButtons(0) + + #~~~~~~~~~~~~~~~~~~~# + # Vault Type Events # + #~~~~~~~~~~~~~~~~~~~# + + ## Handles the passed vault type event. + # This is used to react to saved nodes, new nodes, etc. + def HandleVaultTypeEvents(self, event, tupData): + + # Make sure that the BigKI dialog is loaded before trying to update it. + if not PtIsDialogLoaded("KIMain"): + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): BigKI dialog was not loaded, waiting.", level=kDebugDumpLevel) + return + if event == PtVaultCallbackTypes.kVaultConnected: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): Connected to the Vault.", level=kDebugDumpLevel) + elif event == PtVaultCallbackTypes.kVaultDisconnected: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): Disconnected from the Vault.", level=kDebugDumpLevel) + elif event == PtVaultCallbackTypes.kVaultNodeSaved: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): A node is being saved (ID = {}, type = {}).".format(tupData[0].getID(), tupData[0].getType()), level=kDebugDumpLevel) + if tupData[0].getType() == PtVaultNodeTypes.kPlayerInfoNode: + self.RefreshPlayerList() + elif tupData[0].getType() == PtVaultNodeTypes.kAgeInfoNode: + self.BigKISetStatics() + self.BigKIRefreshFolderList() + self.BigKIOnlySelectedToButtons() + self.RefreshAgeOwnerSettings() + self.BigKIRefreshContentList() + self.BigKIRefreshContentListDisplay() + elif event == PtVaultCallbackTypes.kVaultNodeInitialized: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): A node has been initalized (ID = {}, type = {}).".format(tupData[0].getID(), tupData[0].getType()), level=kDebugDumpLevel) + if self.KILevel > kMicroKI: + self.BigKICheckElementRefresh(tupData[0]) + elif event == PtVaultCallbackTypes.kVaultNodeAdded: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): A node has been added.", level=kDebugDumpLevel) + elif event == PtVaultCallbackTypes.kVaultNodeRefAdded: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): A node reference has been added (childID = {}, parentID = {}).".format(tupData[0].getChildID(), tupData[0].getParentID()), level=kDebugDumpLevel) + if self.KILevel > kMicroKI: + folder = tupData[0].getParent() + folder = folder.upcastToFolderNode() + # If the parent of this ref is the Inbox, then it's incoming mail. + if folder is not None and folder.folderGetType() == PtVaultStandardNodes.kInboxFolder: + self.AlertKIStart() + # Note: beenSeen() is not yet implemented. + if not tupData[0].beenSeen(): + if self.onlyGetPMsFromBuddies: + vault = ptVault() + buddies = vault.getBuddyListFolder() + if buddies.playerlistHasPlayer(tupData[0].getSaverID()): + # then show alert + self.AlertKIStart() + else: + self.AlertKIStart() + + child = tupData[0].getChild() + child = child.upcastToFolderNode() + if child is not None: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): Adding a folder, refresh folder list.", level=kDebugDumpLevel) + self.BigKIRefreshFolderList() + self.BigKICheckFolderRefresh(folder) + elif event == PtVaultCallbackTypes.kVaultRemovingNodeRef: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): A node reference is being removed (childID = {}, parentID = {}).".format(tupData[0].getChildID(), tupData[0].getParentID()), level=kDebugDumpLevel) + elif event == PtVaultCallbackTypes.kVaultNodeRefRemoved: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): A node reference has been removed (childID, parentID): ", tupData, level=kDebugDumpLevel) + if self.KILevel > kMicroKI: + if self.BKRightSideMode == kGUI.BKMarkerListExpanded: + self.BigKIDisplayMarkerGame() + self.BigKICheckFolderRefresh() + elif event == PtVaultCallbackTypes.kVaultOperationFailed: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): A Vault operation failed (operation, resultCode): ", tupData, level=kDebugDumpLevel) + else: + PtDebugPrint(u"xKI.HandleVaultTypeEvents(): Unknown Vault event: {}.".format(event), level=kWarningLevel) diff --git a/Scripts/Python/ki/xKIChat.py b/Scripts/Python/ki/xKIChat.py new file mode 100644 index 0000000000..52d073e923 --- /dev/null +++ b/Scripts/Python/ki/xKIChat.py @@ -0,0 +1,1434 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +import re +import time + +# Plasma Engine. +from Plasma import * +from PlasmaConstants import * +from PlasmaKITypes import * +from PlasmaNetConstants import * +from PlasmaTypes import * +from PlasmaVaultConstants import * + +import xCensor +import xLocTools + +# xKI sub-modules. +from . import xKIExtChatCommands +from .xKIConstants import * +from .xKIHelpers import * + + +## A class to process all the RT Chat functions of the KI. +class xKIChat(object): + + ## Set up the chat manager's default state. + def __init__(self, StartFadeTimer, ResetFadeState, FadeCompletely, GetCensorLevel): + + # Set the default properties. + self.chatLogFile = None + self.gFeather = 0 + self.isAdmin = False + self.isChatting = False + self.lastPrivatePlayerID = None + self.logFile = None + self.onlyGetPMsFromBuddies = False + self.onlyAllowBuddiesOnRequest = False + self.privateChatChannel = 0 + self.toReplyToLastPrivatePlayerID = None + + # Fading & blinking globals. + self.currentFadeTick = 0 + self.fadeEnableFlag = True + self.fadeMode = kChat.FadeNotActive + self.ticksOnFull = 30 + self.incomingChatFlashState = 0 + + # Set the properties from the KI. + self.key = None # Plasma has to be initialized for this. + self.BKPlayerList = [] + self.KIDisabled = False + self.KILevel = kMicroKI + self.StartFadeTimer = StartFadeTimer + self.ResetFadeState = ResetFadeState + self.FadeCompletely = FadeCompletely + self.GetCensorLevel = GetCensorLevel + + # Add the commands processor. + self.commandsProcessor = CommandsProcessor(self) + + # Message History + self.MessageHistoryIs = -1 # Current position in message history (up/down key) + self.MessageHistoryList = [] # Contains our message history + + ####### + # GUI # + ####### + + ## Toggles the state of the miniKI icon in the Blackbar. + # Changing the value will initiate a chain reaction of events to display + # the miniKI. + def ClearBBMini(self, value=-1): + + if self.KILevel == kNormalKI: + mmRG = ptGUIControlRadioGroup(KIBlackbar.dialog.getControlFromTag(kGUI.MiniMaximizeRGID)) + mmRG.setValue(value) + + ## Check if the chat is faded out. + def IsFaded(self): + + if self.KILevel >= kMicroKI: + if not BigKI.dialog.isEnabled() and (KIMini.dialog.isEnabled() or KIMicro.dialog.isEnabled()): + if self.fadeMode == kChat.FadeNotActive: + return True + return False + + ## Scroll the chat in the specified direction on the miniKI. + # Possible directions are to scroll up, down, to the beginning and to the + # end. + def ScrollChatArea(self, direction): + + if self.KILevel < kNormalKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + self.ResetFadeState() + chatarea = ptGUIControlMultiLineEdit(mKIdialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatarea.moveCursor(direction) + + ############ + # Chatting # + ############ + + ## Make the player enter or exit chat mode. + # Chat mode means the player's keyboard input is being sent to the chat. + def ToggleChatMode(self, entering, firstChar=None): + # Reset selection in message history + self.MessageHistoryIs = -1 + + if self.KILevel == kMicroKI: + mKIdialog = KIMicro.dialog + KIMicro.dialog.show() + else: + mKIdialog = KIMini.dialog + caret = ptGUIControlTextBox(mKIdialog.getControlFromTag(kGUI.ChatCaretID)) + chatEdit = ptGUIControlEditBox(mKIdialog.getControlFromTag(kGUI.ChatEditboxID)) + if entering: + self.isChatting = True + if not KIMini.dialog.isEnabled(): + self.ClearBBMini(0) + if firstChar: + chatEdit.setString(firstChar) + chatEdit.end() + else: + chatEdit.clearString() + chatEdit.show() + caret.show() + mKIdialog.setFocus(chatEdit.getKey()) + self.toReplyToLastPrivatePlayerID = self.lastPrivatePlayerID + self.ResetFadeState() + else: + caret.hide() + chatEdit.hide() + self.isChatting = False + self.StartFadeTimer() + + ## Sends a chat message appropriately to other players. + # A broadcast message gets sent to everyone in the Age (purple header), a + # private message is sent to one player (yellow header), and so on. + def SendMessage(self, message): + + # Set up the chat message's flags. + cFlags = ChatFlags(0) + cFlags.toSelf = True + listenerOnly = True + nobodyListening = False + goesToFolder = None + if self.isAdmin: + cFlags.admin = True + ## The prefix for inter-Age chat. + pre = "<<" + GetAgeName() + ">>" + + # If the player is in AFK mode, make him exit it. + if PtGetLocalAvatar().avatar.getCurrentMode() == PtBrainModes.kAFK: + PtAvatarExitAFK() + + # Add the input to the local chat message history. + self.MessageHistoryList.insert(0, message) + if (len(self.MessageHistoryList) > kMessageHistoryListMax): + self.MessageHistoryList.pop() + + # Check for special commands. + message = self.commandsProcessor(message) + if not message: + return + msg = message.lower() + + # Get any selected players. + userListBox = ptGUIControlListBox(KIMini.dialog.getControlFromTag(kGUI.PlayerList)) + iSelect = userListBox.getSelection() + selPlyrList = [] + + # Is it a reply to a private message? + if msg.startswith(PtGetLocalizedString("KI.Commands.ChatReply")): + if self.toReplyToLastPrivatePlayerID is None: + self.AddChatLine(None, PtGetLocalizedString("KI.Chat.NoOneToReply"), kChat.SystemMessage) + return + # If it is local, check to see if the player is still in the Age. + if not self.toReplyToLastPrivatePlayerID[2]: + ageMembers = PtGetPlayerListDistanceSorted() + hasPlayer = False + for member in ageMembers: + if member.getPlayerID() == self.toReplyToLastPrivatePlayerID[1]: + hasPlayer = True + break + if not hasPlayer: + self.lastPrivatePlayerID = None + self.AddChatLine(None, PtGetLocalizedString("KI.Chat.LeftTheAge", [str(self.toReplyToLastPrivatePlayerID[0])]), kChat.SystemMessage) + return + # If it is not local, check to see if the player is still online. + else: + vault = ptVault() + PIKA = vault.getPeopleIKnowAboutFolder() + if PIKA is not None and PIKA.playerlistHasPlayer(self.toReplyToLastPrivatePlayerID[1]): + PIKArefs = PIKA.getChildNodeRefList() + for PIKAref in PIKArefs: + PIKAelem = PIKAref.getChild() + PIKAelem = PIKAelem.upcastToPlayerInfoNode() + if PIKAelem is not None and PIKAelem.playerGetID() == self.toReplyToLastPrivatePlayerID[1]: + if not PIKAelem.playerIsOnline(): + self.lastPrivatePlayerID = None + self.AddChatLine(None, PtGetLocalizedString("KI.Chat.LeftTheGame", [str(self.toReplyToLastPrivatePlayerID[0])]), kChat.SystemMessage) + return + break + message = message[len(PtGetLocalizedString("KI.Commands.ChatReply")) + 1:] + # What they selected doesn't matter if they're replying. + selPlyrList = [ptPlayer(self.toReplyToLastPrivatePlayerID[0], self.toReplyToLastPrivatePlayerID[1])] + cFlags.private = True + if self.toReplyToLastPrivatePlayerID[2]: + cFlags.interAge = True + message = pre + message + + # Is it a private message sent with "/p"? + elif msg.startswith(PtGetLocalizedString("KI.Commands.ChatPrivate")): + pWords = message.split(" ", 1) + foundBuddy = False + # Make sure it's still just a "/p". + if len(pWords) > 1 and pWords[0] == PtGetLocalizedString("KI.Commands.ChatPrivate"): + # Try to find the buddy in the DPL online lists. + for player in self.BKPlayerList: + # Is the player in this Age? + if isinstance(player, ptPlayer): + plyrName = player.getPlayerName() + if pWords[1].startswith(plyrName + " "): + selPlyrList.append(player) + cFlags.private = True + foundBuddy = True + # Remove the "/p buddyname" from the message. + message = pWords[1][len(plyrName) + 1:] + self.AddPlayerToRecents(player.getPlayerID()) + break + # Is the player in another Age? + elif isinstance(player, ptVaultNodeRef): + ePlyr = player.getChild() + ePlyr = ePlyr.upcastToPlayerInfoNode() + if ePlyr is not None: + plyrName = ePlyr.playerGetName() + if pWords[1].startswith(plyrName + " "): + selPlyrList.append(ptPlayer(ePlyr.playerGetName(), ePlyr.playerGetID())) + cFlags.private = True + cFlags.interAge = True + foundBuddy = True + # Add this player's current Age. + message = pre + pWords[1][len(plyrName) + 1:] + self.AddPlayerToRecents(ePlyr.playerGetID()) + break + if not foundBuddy: + PtDebugPrint(u"xKIChat.SendMessage(): \"/p\" command can't find player.", level=kDebugDumpLevel) + # Note: because there's no way of knowing the player's name + #(might have spaces), just don't try to display it. + self.AddChatLine(None, "(Can't find the player in any of the player lists.)", kChat.SystemMessage) + return + + # Is it a message to the player's neighbors? + elif msg.startswith(PtGetLocalizedString("KI.Commands.ChatNeighbors")): + cFlags.neighbors = True + message = message[len(PtGetLocalizedString("KI.Commands.ChatNeighbors")) + 1:] + neighbors = GetNeighbors() + if neighbors is not None: + selPlyrList = self.GetOnlinePlayers(neighbors.getChildNodeRefList()) + if len(selPlyrList) == 0: + self.AddChatLine(None, PtGetLocalizedString("KI.Chat.WentOffline", ["Everyone in your neighbor list"]), kChat.SystemMessage) + return + cFlags.interAge = True + message = pre + message + goesToFolder = xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kHoodMembersFolder) + + # Is it a message to the player's buddies? + elif msg.startswith(PtGetLocalizedString("KI.Commands.ChatBuddies")): + vault = ptVault() + buddies = vault.getBuddyListFolder() + message = message[len(PtGetLocalizedString("KI.Commands.ChatBuddies")) + 1:] + if buddies is not None: + selPlyrList = self.GetOnlinePlayers(buddies.getChildNodeRefList()) + if len(selPlyrList) == 0: + self.AddChatLine(None, PtGetLocalizedString("KI.Chat.WentOffline", ["Everyone in your buddy list"]), kChat.SystemMessage) + return + cFlags.interAge = True + message = pre + message + goesToFolder = xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kBuddyListFolder) + + # Otherwise, the message has a selected destination. + else: + if iSelect >= 0 and iSelect < len(self.BKPlayerList): + toPlyr = self.BKPlayerList[iSelect] + + # Is it a player? + if isinstance(toPlyr, ptPlayer): + selPlyrList.append(toPlyr) + cFlags.private = True + self.AddPlayerToRecents(toPlyr.getPlayerID()) + PtDebugPrint(u"xKIChat.SendMessage(): Private message to \"{}\".".format(toPlyr.getPlayerName()), level=kDebugDumpLevel) + + # Is it a player (possibly in another Age)? + elif isinstance(toPlyr, ptVaultNodeRef): + ePlyr = toPlyr.getChild() + ePlyr = ePlyr.upcastToPlayerInfoNode() + if ePlyr is not None: + if not ePlyr.playerIsOnline(): + self.AddChatLine(None, PtGetLocalizedString("KI.Chat.WentOffline", [ePlyr.playerGetName()]), kChat.SystemMessage) + return + selPlyrList.append(ptPlayer(ePlyr.playerGetName(), ePlyr.playerGetID())) + cFlags.private = True + self.AddPlayerToRecents(ePlyr.playerGetID()) + if not PtValidateKey(PtGetAvatarKeyFromClientID(ePlyr.playerGetID())): + cFlags.interAge = True + message = pre + message + + # Is it a list of players? + elif isinstance(toPlyr, ptVaultPlayerInfoListNode): + fldrType = toPlyr.folderGetType() + # If it's a list of Age Owners, they must be neighbors. + if fldrType == PtVaultStandardNodes.kAgeOwnersFolder: + fldrType = PtVaultStandardNodes.kHoodMembersFolder + cFlags.neighbors = True + + # Special rules for AllPlayers: ccr message and NOT directed! + if fldrType == PtVaultStandardNodes.kAllPlayersFolder: + selPlyrList = [] + listenerOnly = False + cFlags.admin = 1 + cFlags.ccrBcast = 1 + pre = "" + else: + selPlyrList = self.GetOnlinePlayers(toPlyr.getChildNodeRefList()) + if len(selPlyrList) == 0: + self.AddChatLine(None, PtGetLocalizedString("KI.Chat.WentOffline", ["Everyone in list"]), kChat.SystemMessage) + return + cFlags.interAge = 1 + + message = pre + message + goesToFolder = xLocTools.FolderIDToFolderName(fldrType) + + # Is it a folder of players within listening distance? + elif isinstance(toPlyr, KIFolder): + listenerOnly = False + + # Add message to player's private chat channel. + cFlags.channel = self.privateChatChannel + if len(selPlyrList) == 0 and listenerOnly: + if nobodyListening: + self.AddChatLine(None, PtGetLocalizedString("KI.Chat.NoOneListening"), kChat.SystemMessage) + else: + PtSendRTChat(PtGetLocalPlayer(), selPlyrList, message, cFlags.flags) + sender = PtGetLocalPlayer() + if cFlags.private: + sender = selPlyrList[0] + if cFlags.interAge: + if goesToFolder: + sender = ptPlayer(str(goesToFolder), 0) + else: + sender = selPlyrList[0] + elif goesToFolder: + sender = ptPlayer(str(goesToFolder), 0) + self.AddChatLine(sender, message, cFlags) + + ####################### + # Displaying messages # + ####################### + + ## Adds a line to the RT chat. + def AddChatLine(self, player, message, cFlags, forceKI=True): + + try: + PtDebugPrint(u"xKIChat.AddChatLine(): Message = \"{}\".".format(message), player, cFlags, level=kDebugDumpLevel) + except UnicodeEncodeError: + pass + + # Fix for Character of Doom (CoD). + (message, RogueCount) = re.subn("[\x00-\x08\x0a-\x1f]", "", message) + + # Censor the chat message to their taste + message = xCensor.xCensor(message, self.GetCensorLevel()) + + if self.KILevel == kMicroKI: + mKIdialog = KIMicro.dialog + else: + mKIdialog = KIMini.dialog + pretext = U"" + headerColor = kColors.ChatHeaderBroadcast + bodyColor = kColors.ChatMessage + + # Is it an object to represent the flags? + if isinstance(cFlags, ChatFlags): + + # Is it a status message? + if cFlags.status: + bodyColor = kColors.ChatHeaderStatus + player = None + + # Is it an inter-Age message? + elif cFlags.interAge: + if cFlags.private: + if cFlags.admin: + headerColor = kColors.ChatHeaderError + else: + headerColor = kColors.ChatHeaderPrivate + forceKI = True + else: + if cFlags.neighbors: + headerColor = kColors.ChatHeaderNeighbors + else: + headerColor = kColors.ChatHeaderBuddies + if cFlags.toSelf: + pretext = PtGetLocalizedString("KI.Chat.InterAgeSendTo") + if message[:2] == "<<": + try: + idx = message.index(">>") + message = message[idx + 2:] + except ValueError: + pass + else: + if not self.CheckIfCanPM(player.getPlayerID()): + return + pretext = PtGetLocalizedString("KI.Chat.InterAgeMsgRecvd") + forceKI = True + if message[:2] == "<<": + try: + idx = message.index(">>") + player = ptPlayer(PtGetLocalizedString("KI.Chat.InterAgePlayerRecvd", [player.getPlayerName(), message[2:idx]]), player.getPlayerID()) + message = message[idx + 2:] + if not cFlags.private and not cFlags.neighbors: + buddies = ptVault().getBuddyListFolder() + if buddies is not None: + buddyID = player.getPlayerID() + if not buddies.playerlistHasPlayer(buddyID): + PtDebugPrint(u"xKIChat.AddChatLine(): Add unknown buddy {} to recents.".format(buddyID)) + self.AddPlayerToRecents(buddyID) + except ValueError: + pass + + # PM Processing: Save playerID and flash client window + if cFlags.private: + self.lastPrivatePlayerID = (player.getPlayerName(), player.getPlayerID(), 1) + PtFlashWindow() + # Are we mentioned in the message? + elif message.lower().find(PtGetLocalPlayer().getPlayerName().lower()) >= 0: + bodyColor = kColors.ChatMessageMention + PtFlashWindow() + + # Is it a ccr broadcast? + elif cFlags.ccrBcast: + headerColor = kColors.ChatHeaderAdmin + if cFlags.toSelf: + pretext = PtGetLocalizedString("KI.Chat.PrivateSendTo") + else: + pretext = PtGetLocalizedString("KI.Chat.PrivateMsgRecvd") + forceKI = True + self.AddPlayerToRecents(player.getPlayerID()) + + # Is it an admin message? + elif cFlags.admin: + if cFlags.private: + headerColor = kColors.ChatHeaderError + if cFlags.toSelf: + pretext = PtGetLocalizedString("KI.Chat.PrivateSendTo") + else: + pretext = PtGetLocalizedString("KI.Chat.PrivateMsgRecvd") + forceKI = True + + # PM Processing: Save playerID and flash client window + self.lastPrivatePlayerID = (player.getPlayerName(), player.getPlayerID(), 0) + self.AddPlayerToRecents(player.getPlayerID()) + PtFlashWindow() + else: + headerColor = kColors.ChatHeaderAdmin + forceKI = True + + # Is it a broadcast message? + elif cFlags.broadcast: + if cFlags.toSelf: + headerColor = kColors.ChatHeaderBroadcast + pretext = PtGetLocalizedString("KI.Chat.BroadcastSendTo") + else: + headerColor = kColors.ChatHeaderBroadcast + pretext = PtGetLocalizedString("KI.Chat.BroadcastMsgRecvd") + self.AddPlayerToRecents(player.getPlayerID()) + + # Are we mentioned in the message? + if message.lower().find(PtGetClientName().lower()) >= 0: + bodyColor = kColors.ChatMessageMention + forceKI = True + PtFlashWindow() + + # Is it a private message? + elif cFlags.private: + if cFlags.toSelf: + headerColor = kColors.ChatHeaderPrivate + pretext = PtGetLocalizedString("KI.Chat.PrivateSendTo") + else: + if not self.CheckIfCanPM(player.getPlayerID()): + return + headerColor = kColors.ChatHeaderPrivate + pretext = PtGetLocalizedString("KI.Chat.PrivateMsgRecvd") + forceKI = True + + # PM Processing: Save playerID and flash client window + self.lastPrivatePlayerID = (player.getPlayerName(), player.getPlayerID(), 0) + self.AddPlayerToRecents(player.getPlayerID()) + PtFlashWindow() + + # Otherwise, cFlags is just a number. + else: + if cFlags == kChat.SystemMessage: + headerColor = kColors.ChatHeaderError + pretext = PtGetLocalizedString("KI.Chat.ErrorMsgRecvd") + else: + headerColor = kColors.ChatHeaderBroadcast + pretext = PtGetLocalizedString("KI.Chat.BroadcastMsgRecvd") + + if forceKI: + if not self.KIDisabled and not mKIdialog.isEnabled(): + mKIdialog.show() + if player is not None: + separator = "" if pretext.endswith(" ") else " " + chatHeaderFormatted = U"{}{}{}:".format(pretext, separator, player.getPlayerNameW()) + chatMessageFormatted = U" {}".format(message) + else: + # It must be a status or error message. + chatHeaderFormatted = pretext + if not pretext: + chatMessageFormatted = U"{}".format(message) + else: + chatMessageFormatted = U" {}".format(message) + + chatArea = ptGUIControlMultiLineEdit(mKIdialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatArea.beginUpdate() + savedPosition = chatArea.getScrollPosition() + wasAtEnd = chatArea.isAtEnd() + chatArea.moveCursor(PtGUIMultiLineDirection.kBufferEnd) + chatArea.insertColor(headerColor) + + # Added unicode support here. + chatArea.insertStringW(U"\n{}".format(chatHeaderFormatted)) + chatArea.insertColor(bodyColor) + chatArea.insertStringW(chatMessageFormatted) + chatArea.moveCursor(PtGUIMultiLineDirection.kBufferEnd) + + # Write to the log file. + if self.chatLogFile is not None and self.chatLogFile.isOpen(): + self.chatLogFile.write(chatHeaderFormatted[0:] + chatMessageFormatted) + + # If the chat is overflowing, erase the first line. + if chatArea.getBufferSize() > kChat.MaxChatSize: + while chatArea.getBufferSize() > kChat.MaxChatSize and chatArea.getBufferSize() > 0: + PtDebugPrint(u"xKIChat.AddChatLine(): Max chat buffer size reached. Removing top line.", level=kDebugDumpLevel) + chatArea.deleteLinesFromTop(1) + if savedPosition > 0: + # this is only accurate if the deleted line only occupied one line in the control (wasn't soft-wrapped), but that tends to be the usual case + savedPosition -= 1 + if not wasAtEnd: + # scroll back to where we were + chatArea.setScrollPosition(savedPosition) + # flash the down arrow to indicate that new chat has come in + self.incomingChatFlashState = 3 + PtAtTimeCallback(self.key, 0.0, kTimers.IncomingChatFlash) + chatArea.endUpdate() + + # Copy all the data to the miniKI if the user upgrades it. + if self.KILevel == kMicroKI: + chatArea2 = ptGUIControlMultiLineEdit(KIMini.dialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatArea2.beginUpdate() + chatArea2.moveCursor(PtGUIMultiLineDirection.kBufferEnd) + chatArea2.insertColor(headerColor) + + # Added unicode support here. + chatArea2.insertStringW(U"\n{}".format(chatHeaderFormatted)) + chatArea2.insertColor(bodyColor) + chatArea2.insertStringW(chatMessageFormatted) + chatArea2.moveCursor(PtGUIMultiLineDirection.kBufferEnd) + + if chatArea2.getBufferSize() > kChat.MaxChatSize: + while chatArea2.getBufferSize() > kChat.MaxChatSize and chatArea2.getBufferSize() > 0: + chatArea2.deleteLinesFromTop(1) + chatArea2.endUpdate() + + # Update the fading controls. + self.ResetFadeState() + + ## Display a status message to the player (or players if net-propagated). + def DisplayStatusMessage(self, statusMessage, netPropagate=0): + + cFlags = ChatFlags(0) + cFlags.toSelf = True + cFlags.status = True + if netPropagate: + plyrList = self.GetPlayersInChatDistance() + if len(plyrList) > 0: + PtSendRTChat(PtGetLocalPlayer(), plyrList, statusMessage, cFlags.flags) + self.AddChatLine(None, statusMessage, cFlags) + + ########### + # Players # + ########### + + ## Adds a player to the recent players folder. + def AddPlayerToRecents(self, playerID): + + vault = ptVault() + PIKAFolder = vault.getPeopleIKnowAboutFolder() + if PIKAFolder: + PIKA = PIKAFolder.upcastToPlayerInfoListNode() + if PIKA is not None: + if not PIKA.playerlistHasPlayer(playerID): + PIKA.playerlistAddPlayer(playerID) + childRefList = PIKAFolder.getChildNodeRefList() + numPeople = len(childRefList) + if numPeople > kLimits.MaxRecentPlayerListSize: + peopleToRemove = [] + numToRemove = numPeople - kLimits.MaxRecentPlayerListSize + for i in range(numToRemove): + peopleToRemove.append(childRefList[i].getChild()) + for person in peopleToRemove: + PIKAFolder.removeNode(person) + + ## Returns a list of players within chat distance. + def GetPlayersInChatDistance(self, minPlayers=8): + + plyrList = [] + agePlayers = PtGetPlayerListDistanceSorted() + for player in agePlayers: + if player.getPlayerID() != 0: + if player.getDistanceSq() < PtMaxListenDistSq(): + plyrList.append(player) + else: + if len(plyrList) <= minPlayers: + plyrList.append(player) + return plyrList + + ## Find the player's online buddy or neighbor list. + def GetOnlinePlayers(self, pList): + + outList = [] + for player in pList: + if isinstance(player, ptVaultNodeRef): + ePlayer = player.getChild().upcastToPlayerInfoNode() + if ePlayer is not None: + if ePlayer.playerIsOnline(): + outList.append(ptPlayer(ePlayer.playerGetName(), ePlayer.playerGetID())) + return outList + + ## Determine if the player is a buddy, if PMs should come only through + # them. Returns True if any player can send PMs. + def CheckIfCanPM(self, playerID): + + if self.onlyGetPMsFromBuddies: + buddies = ptVault().getBuddyListFolder() + if buddies is not None: + return buddies.playerlistHasPlayer(playerID) + return False + return True + + +## A object to hold and manipulate flags for a chat message. +class ChatFlags: + + # Create a container for the flags. + def __init__(self, flags): + + self.__dict__["flags"] = flags + + self.__dict__["broadcast"] = True + self.__dict__["toSelf"] = False + + if flags & kRTChatPrivate: + self.__dict__["private"] = True + self.__dict__["broadcast"] = False + else: + self.__dict__["private"] = False + + if flags & kRTChatAdmin: + self.__dict__["admin"] = True + else: + self.__dict__["admin"] = False + + if flags & kRTChatGlobal: + self.__dict__["ccrBcast"] = True + else: + self.__dict__["ccrBcast"] = False + + if flags & kRTChatInterAge: + self.__dict__["interAge"] = True + else: + self.__dict__["interAge"] = False + + if flags & kRTChatStatusMsg: + self.__dict__["status"] = True + else: + self.__dict__["status"] = False + + if flags & kRTChatNeighborsMsg: + self.__dict__["neighbors"] = True + else: + self.__dict__["neighbors"] = False + + self.__dict__["channel"] = (kRTChatChannelMask & flags) / 256 + + def __setattr__(self, name, value): + + if name == "broadcast" and value: + self.__dict__["flags"] &= kRTChatFlagMask ^ kRTChatPrivate + + elif name == "ccrBcast": + self.__dict__["flags"] &= kRTChatFlagMask ^ kRTChatGlobal + if value: + self.__dict__["flags"] |= kRTChatGlobal + else: + self.__dict__["flags"] &= ~kRTChatGlobal + + elif name == "private": + self.__dict__["flags"] &= kRTChatFlagMask ^ kRTChatPrivate + if value: + self.__dict__["flags"] |= kRTChatPrivate + self.__dict__["broadcast"] = False + else: + self.__dict__["broadcast"] = True + + elif name == "admin": + self.__dict__["flags"] &= kRTChatFlagMask ^ kRTChatAdmin + if value: + self.__dict__["flags"] |= kRTChatAdmin + + elif name == "interAge": + self.__dict__["flags"] &= kRTChatFlagMask ^ kRTChatInterAge + if value: + self.__dict__["flags"] |= kRTChatInterAge + + elif name == "status": + self.__dict__["flags"] &= kRTChatFlagMask ^ kRTChatStatusMsg + if value: + self.__dict__["flags"] |= kRTChatStatusMsg + + elif name == "neighbors": + self.__dict__["flags"] &= kRTChatFlagMask ^ kRTChatNeighborsMsg + if value: + self.__dict__["flags"] |= kRTChatNeighborsMsg + + elif name == "channel": + flagsNoChannel = self.__dict__["flags"] & kRTChatNoChannel + self.__dict__["flags"] = flagsNoChannel + (value * 256) + + self.__dict__[name] = value + + def __repr__(self): + + string = "ChatFlag: " + if self.toSelf: + string += "toSelf " + if self.broadcast: + string += "broadcast " + if self.private: + string += "private " + if self.admin: + string += "admin " + if self.interAge: + string += "interAge " + if self.status: + string += "status " + if self.neighbors: + string += "neighbors " + if self.ccrBcast: + string += "ccrBcast " + string += "channel = {} ".format(self.channel) + string += "flags = {}".format(self.flags) + return string + + +## Processes KI Chat commands. +class CommandsProcessor: + + ## Link the processor with the chat manager. + def __init__(self, chatMgr): + + self.chatMgr = chatMgr + + ## Called when the processor needs to process a message. + # Returns the appropriate message and performs all the necessary operations + # to apply the command. + def __call__(self, message): + + msg = message.lower() + + # Load all available commands. + commands = dict() + commands.update(kCommands.Localized) + if PtGetAgeName() == "Jalak": + commands.update(kCommands.Jalak) + if PtIsInternalRelease(): + commands.update(kCommands.Internal) + commands.update(kCommands.EasterEggs) + commands.update(kCommands.Other) + + # Does the message contain a standard command? + for command, function in commands.iteritems(): + if msg.startswith(command): + theMessage = message.split(" ", 1) + if len(theMessage) > 1 and theMessage[1]: + params = theMessage[1] + else: + params = None + getattr(self, function)(params) + return None + + # Is it a simple text-based command? + for command, text in kCommands.Text.iteritems(): + if msg.startswith(command): + self.chatMgr.AddChatLine(None, text, 0) + return None + + # Is it another text-based easter-egg command? + if msg.startswith("/get "): + v = "is" + if message[-1:] == "s": + v = "are" + self.chatMgr.AddChatLine(None, "The %s %s too heavy to lift. Maybe you should stick to feathers." % (message[len("/get "):], v), 0) + return None + elif PtIsInternalRelease() and msg.startswith("/system "): + send = message[len("/system "):] + cFlags = ChatFlags(0) + cFlags.admin = 1 + cFlags.ccrBcast = 1 + cFlags.toSelf = 1 + PtSendRTChat(PtGetLocalPlayer(), [], send, cFlags.flags) + fldr = xLocTools.FolderIDToFolderName(PtVaultStandardNodes.kAllPlayersFolder) + self.chatMgr.AddChatLine(ptPlayer(fldr, 0), send, cFlags) + return None + + # Is it an emote, a "/me" or invalid command? + if message.startswith("/"): + words = message.split() + try: + emote = xKIExtChatCommands.xChatEmoteXlate[unicode(words[0][1:].lower())] + if emote[0] in xKIExtChatCommands.xChatEmoteLoop: + PtAvatarEnterAnimMode(emote[0]) + else: + PtEmoteAvatar(emote[0]) + if PtGetLanguage() == PtLanguage.kEnglish: + avatar = PtGetLocalAvatar() + gender = avatar.avatar.getAvatarClothingGroup() + if gender > kFemaleClothingGroup: + gender = kMaleClothingGroup + hisHer = PtGetLocalizedString("KI.EmoteStrings.His") + if gender == kFemaleClothingGroup: + hisHer = PtGetLocalizedString("KI.EmoteStrings.Her") + statusMsg = PtGetLocalizedString(emote[1], [PtGetLocalPlayer().getPlayerName(), hisHer]) + else: + statusMsg = PtGetLocalizedString(emote[1], [PtGetLocalPlayer().getPlayerName()]) + self.chatMgr.DisplayStatusMessage(statusMsg, 1) + message = message[len(words[0]):] + if message == "": + return None + return message[1:] + except LookupError: + try: + command = xKIExtChatCommands.xChatExtendedChat[unicode(words[0][1:].lower())] + if isinstance(command, str): + args = message[len(words[0]):] + PtConsole(command + args) + else: + try: + args = message[len(words[0]) + 1:] + if args: + try: + retDisp = command(args) + except TypeError: + retDisp = command() + return args + else: + retDisp = command() + if isinstance(retDisp, unicode) or isinstance(retDisp, str): + self.chatMgr.DisplayStatusMessage(retDisp) + elif isinstance(retDisp, tuple): + if retDisp[0]: + self.chatMgr.AddChatLine(None, retDisp[1], kChat.SystemMessage) + else: + self.chatMgr.DisplayStatusMessage(retDisp[1]) + except: + PtDebugPrint(u"xKIChat.commandsProcessor(): Chat command function did not run.", command, level=kErrorLevel) + except LookupError: + if unicode(words[0].lower()) in xKIExtChatCommands.xChatSpecialHandledCommands: + return message + else: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Errors.CommandError", [message]), kChat.SystemMessage) + return None + + return message + + ## Extract the player ID from a chat's params. + def GetPID(self, params): + + if not params: + return 0 + try: + pID = long(int(params)) + return pID + except ValueError: + for player in self.chatMgr.BKPlayerList: + if isinstance(player, ptPlayer): + plyrName = player.getPlayerName() + if params == plyrName: + return player.getPlayerID() + return 0 + + #~~~~~~~~~~~~~~~~~~~# + # Standard Commands # + #~~~~~~~~~~~~~~~~~~~# + + ## Add a player as a buddy. + def AddBuddy(self, player): + + pID = self.GetPID(player) + if pID: + localPlayer = PtGetLocalPlayer() + if pID != localPlayer.getPlayerID(): + vault = ptVault() + buddies = vault.getBuddyListFolder() + if buddies is not None: + if buddies.playerlistHasPlayer(pID): + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.AlreadyAdded"), kChat.SystemMessage) + else: + buddies.playerlistAddPlayer(pID) + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Player.Added")) + else: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.NotYourself"), kChat.SystemMessage) + else: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.NumberOnly"), kChat.SystemMessage) + + ## Clear the chat. + def ClearChat(self, params): + + chatAreaU = ptGUIControlMultiLineEdit(KIMicro.dialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatAreaM = ptGUIControlMultiLineEdit(KIMini.dialog.getControlFromTag(kGUI.ChatDisplayArea)) + chatAreaU.clearBuffer() + chatAreaM.clearBuffer() + + ## Ignores a player. + def IgnorePlayer(self, player): + + pID = self.GetPID(player) + if pID: + localplayer = PtGetLocalPlayer() + if pID != localplayer.getPlayerID(): + vault = ptVault() + ignores = vault.getIgnoreListFolder() + if ignores is not None: + if ignores.playerlistHasPlayer(pID): + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.AlreadyAdded"), kChat.SystemMessage) + else: + ignores.playerlistAddPlayer(pID) + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Player.Added")) + else: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.NotYourself"), kChat.SystemMessage) + else: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.NumberOnly"), kChat.SystemMessage) + + ## Remove a player from this player's buddies. + def RemoveBuddy(self, player): + + pID = self.GetPID(player) + vault = ptVault() + buddies = vault.getBuddyListFolder() + if buddies is None: + return + + # Is it a number? + if pID: + if buddies.playerlistHasPlayer(pID): + buddies.playerlistRemovePlayer(pID) + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Player.Removed")) + else: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.NotFound"), kChat.SystemMessage) + # Or is it a username? + else: + buddyRefs = buddies.getChildNodeRefList() + for plyr in buddyRefs: + if isinstance(plyr, ptVaultNodeRef): + PLR = plyr.getChild() + PLR = PLR.upcastToPlayerInfoNode() + if PLR is not None and PLR.getType() == PtVaultNodeTypes.kPlayerInfoNode: + if player == PLR.playerGetName(): + buddies.playerlistRemovePlayer(PLR.playerGetID()) + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Player.Removed")) + return + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.NumberOnly"), kChat.SystemMessage) + + ## Start logging the chat. + def StartLog(self, params): + + if self.chatMgr.chatLogFile is None: + self.chatMgr.chatLogFile = ptStatusLog() + self.chatMgr.chatLogFile.open("Chat.log", 30, int(PtStatusLogFlags.kAppendToLast) + int(PtStatusLogFlags.kTimestamp)) + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Chat.LogStarted")) + + ## Stop logging the chat. + def StopLog(self, params): + + if self.chatMgr.chatLogFile is not None: + if self.chatMgr.chatLogFile.isOpen(): + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Chat.LogStopped")) + self.chatMgr.chatLogFile.close() + + ## Remove a player from this player's ignore list. + def UnignorePlayer(self, player): + + pID = self.GetPID(player) + vault = ptVault() + ignores = vault.getIgnoreListFolder() + if ignores is None: + return + + # Is it a number? + if pID: + if ignores.playerlistHasPlayer(pID): + ignores.playerlistRemovePlayer(pID) + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Player.Removed")) + else: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.NotFound"), kChat.SystemMessage) + # Or is it a username? + else: + ignorerefs = ignores.getChildNodeRefList() + for plyr in ignorerefs: + if isinstance(plyr, ptVaultNodeRef): + PLR = plyr.getChild() + PLR = PLR.upcastToPlayerInfoNode() + if PLR is not None and PLR.getType() == PtVaultNodeTypes.kPlayerInfoNode: + if player == PLR.playerGetName(): + ignores.playerlistRemovePlayer(PLR.playerGetID()) + self.chatMgr.DisplayStatusMessage(PtGetLocalizedString("KI.Player.Removed")) + return + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Player.NumberOnly"), kChat.SystemMessage) + + ## Dumps logs to the specified destination. + def DumpLogs(self, destination): + + if not destination: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Errors.MalformedLogDumpCmd"), kChat.SystemMessage) + return + destination = destination.strip() + currentTime = time.strftime("%d %b %Y %H:%M:%S (GMT)", time.gmtime()) + PtDebugPrint(u"-- Logs dumped to \"{}\" at {}. --".format(destination, currentTime)) + # Use a timer to allow for a final message to be logged. + self.chatMgr.logDumpDest = destination # So the timer can get at it. + PtAtTimeCallback(self.chatMgr.key, 0.25, kTimers.DumpLogs) + + ## Changes the user's password. + def ChangePassword(self, newPassword): + + if not newPassword: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Errors.BadPassword"), kChat.SystemMessage) + return + newPassword = newPassword.strip() + if len(newPassword) > 15: + self.chatMgr.AddChatLine(None, PtGetLocalizedString("KI.Errors.PasswordTooLong"), kChat.SystemMessage) + return + PtChangePassword(newPassword) + + #~~~~~~~~~~~~~~~~# + # Jalak Commands # + #~~~~~~~~~~~~~~~~# + + ## Save the player's current Jalak columns to a file. + def SaveColumns(self, columnsFile): + + if columnsFile: + fName = columnsFile.strip() + fName = fName + ".txt" + else: + fName = "JalakColumns.txt" + obj = PtFindSceneobject("JalakDONOTTOUCH", "Jalak") + pythonScripts = obj.getPythonMods() + for script in pythonScripts: + if script.getName() == kJalakPythonComponent: + PtDebugPrint(u"xKIChat.SaveColumns(): Found Jalak's python component.", level=kDebugDumpLevel) + SendNote(self.chatMgr.key, script, "SaveColumns;" + fName) + return + PtDebugPrint(u"xKIChat.SaveColumns(): Did not find Jalak's python component.", level=kErrorLevel) + + ## Load the player's Jalak columns from a file. + def LoadColumns(self, columnsFile): + + if columnsFile: + fName = columnsFile.strip() + fName = fName + ".txt" + else: + fName = "JalakColumns.txt" + obj = PtFindSceneobject("JalakDONOTTOUCH", "Jalak") + pythonScripts = obj.getPythonMods() + for script in pythonScripts: + if script.getName() == kJalakPythonComponent: + PtDebugPrint(u"xKIChat.LoadColumns(): Found Jalak's python component.", level=kDebugDumpLevel) + SendNote(self.chatMgr.key, script, "LoadColumns;" + fName) + return + PtDebugPrint(u"xKIChat.LoadColumns(): Did not find Jalak's python component.", level=kErrorLevel) + + #~~~~~~~~~~~~~~~~~~~# + # Internal Commands # + #~~~~~~~~~~~~~~~~~~~# + + ## Reset the Cleft to its default setting. + def RevisitCleft(self, params): + + vault = ptVault() + chron = vault.findChronicleEntry("CleftSolved") + if chron is not None: + chronFolder = vault.getChronicleFolder() + if chronFolder is not None: + chronFolder.removeNode(chron) + + ## Restart the game with key points reset. + def RestartGame(self, params): + + vault = ptVault() + chron = vault.findChronicleEntry("InitialAvCustomizationsDone") + if chron is not None: + chronFolder = vault.getChronicleFolder() + if chronFolder is not None: + chronFolder.removeNode(chron) + chron = vault.findChronicleEntry("IntroPlayed") + if chron is not None: + chronFolder = vault.getChronicleFolder() + if chronFolder is not None: + chronFolder.removeNode(chron) + chron = vault.findChronicleEntry("CleftSolved") + if chron is not None: + chronFolder = vault.getChronicleFolder() + if chronFolder is not None: + chronFolder.removeNode(chron) + + #~~~~~~~~~~~~~~~~~~~~~~# + # Easter Eggs Commands # + #~~~~~~~~~~~~~~~~~~~~~~# + + ## Look around for exits and informational text. + def LookAround(self, params): + + # Find the nearby people. + playerList = self.chatMgr.GetPlayersInChatDistance(minPlayers=-1) + people = "nobody in particular" + if len(playerList) > 0: + people = "" + for player in playerList: + people += player.getPlayerName() + ", " + people = people[:-2] + + # Load the Age-specific text. + ageInfo = PtGetAgeInfo() + if ageInfo is None: + return + currentAge = ageInfo.getAgeFilename() + see = "" + exits = " North and West." + if currentAge in kEasterEggs: + see = kEasterEggs[currentAge]["see"] + if not kEasterEggs[currentAge]["exits"]: + exits = "... well, there are no exits." + else: + exits = " " + kEasterEggs[currentAge]["exits"] + if "people" in kEasterEggs[currentAge]: + people = kEasterEggs[currentAge]["people"] + + ## Display the info. + self.chatMgr.AddChatLine(None, "{}: {} Standing near you is {}. There are exits to the{}".format(GetAgeName(), see, people, exits), 0) + + ## Get a feather in the current Age. + def GetFeather(self, params): + + ageInfo = PtGetAgeInfo() + if ageInfo is None: + return + currentAge = ageInfo.getAgeFilename() + if currentAge == "Gira": + if self.chatMgr.gFeather < 7: + self.chatMgr.AddChatLine(None, "You pick up a plain feather and put it in your pocket. I know you didn't see yourself do that... trust me, you have a feather in your pocket.", 0) + self.chatMgr.gFeather += 1 + else: + self.chatMgr.AddChatLine(None, "You can only carry seven plain feathers.", 0) + elif currentAge == "EderDelin": + if self.chatMgr.gFeather == 7: + self.chatMgr.AddChatLine(None, "You search... and find the \"Red\" feather and put it in your pocket.", 0) + self.chatMgr.gFeather += 1 + elif self.chatMgr.gFeather > 7: + self.chatMgr.AddChatLine(None, "You search... but find no other feathers.", 0) + else: + self.chatMgr.AddChatLine(None, "You search... but then suddenly stop when you realize that you are missing seven plain feathers.", 0) + elif currentAge == "Dereno": + if self.chatMgr.gFeather == 8: + self.chatMgr.AddChatLine(None, "You search... and find the \"Blue\" feather and put it in your pocket.", 0) + self.chatMgr.gFeather += 1 + elif self.chatMgr.gFeather > 8: + self.chatMgr.AddChatLine(None, "You search... but find no other feathers.", 0) + else: + self.chatMgr.AddChatLine(None, "You search... but then suddenly stop when you realize that you are missing the \"Red\" feather.", 0) + elif currentAge == "Payiferen": + if self.chatMgr.gFeather == 9: + self.chatMgr.AddChatLine(None, "You search... and find the \"Black\" feather and put it in your pocket.", 0) + self.chatMgr.gFeather += 1 + elif self.chatMgr.gFeather > 9: + self.chatMgr.AddChatLine(None, "You search... but find no other feathers.", 0) + else: + self.chatMgr.AddChatLine(None, "You search... but then suddenly stop when you realize that you are missing the \"Blue\" feather.", 0) + elif currentAge == "Ercana": + if self.chatMgr.gFeather == 10: + self.chatMgr.AddChatLine(None, "You search... and find the \"Silver\" feather and put it in your pocket.", 0) + self.chatMgr.gFeather += 1 + elif self.chatMgr.gFeather > 10: + self.chatMgr.AddChatLine(None, "You search... but find no other feathers.", 0) + else: + self.chatMgr.AddChatLine(None, "You search... but then suddenly stop when you realize that you are missing the \"Black\" feather.", 0) + elif currentAge == "Jalak": + if self.chatMgr.gFeather == 11: + self.chatMgr.AddChatLine(None, "You search... and find the \"Duck\" feather and put it in your pocket.", 0) + self.chatMgr.gFeather += 1 + elif self.chatMgr.gFeather > 11: + self.chatMgr.AddChatLine(None, "You search... but find no other feathers.", 0) + else: + self.chatMgr.AddChatLine(None, "You search... but then suddenly stop when you realize that you are missing the \"Silver\" feather.", 0) + elif currentAge == "Ahnonay": + if self.chatMgr.gFeather == 12: + self.chatMgr.AddChatLine(None, "You search... and find a large \"Rukh\" feather (how could you have missed it?) and put it in your pocket.", 0) + self.chatMgr.gFeather += 1 + elif self.chatMgr.gFeather > 12: + self.chatMgr.AddChatLine(None, "You search... but find no other feathers.", 0) + else: + self.chatMgr.AddChatLine(None, "You search... but then suddenly stop when you realize that you are missing the \"Duck\" feather.", 0) + else: + self.chatMgr.AddChatLine(None, "There are no feathers here.", 0) + return + vault = ptVault() + entry = vault.findChronicleEntry("feather") + if entry is None: + vault.addChronicleEntry("feather", 1, str(self.chatMgr.gFeather)) + entry = vault.findChronicleEntry("feather") + entry.chronicleSetValue(str(self.chatMgr.gFeather)) + entry.save() + + ## Looks for feathers in the player's "inventory". + def LookForFeathers(self, params): + + if self.chatMgr.gFeather: + if self.chatMgr.gFeather == 1: + self.chatMgr.AddChatLine(None, "You see a feather!", 0) + else: + pFeathers = self.chatMgr.gFeather + if pFeathers > 7: + pFeathers = 7 + pOut = "You see {} plain feathers".format(pFeathers) + if self.chatMgr.gFeather > 7: + pOut += " and a \"Red\" feather" + if self.chatMgr.gFeather > 8: + pOut += " and a \"Blue\" feather" + if self.chatMgr.gFeather > 9: + pOut += " and a \"Black\" feather" + if self.chatMgr.gFeather > 10: + pOut += " and a \"Silver\" feather" + if self.chatMgr.gFeather > 11: + pOut += " and a \"Duck\" feather" + if self.chatMgr.gFeather > 12: + pOut += " and a large \"Rukh\" feather (sticking out of your pocket)" + pOut += "." + self.chatMgr.AddChatLine(None, pOut, 0) + else: + self.chatMgr.AddChatLine(None, "There is nothing there but lint.", 0) + + ################## + # Other Commands # + ################## + + def PartyTime(self, params): + """Implements the `/party` command""" + + # First, find the PartyAge chronicle in the global inbox + party = None + vault = ptVault() + inbox = vault.getGlobalInbox() + for childRef in inbox.getChildNodeRefList(): + child = childRef.getChild() + if not child: + continue + child = child.upcastToChronicleNode() + if not child: + continue + if child.chronicleGetName() == kChron.Party: + party = child + break + + # Let's see what we need to do + if not params: + # No params = LINK ME! + if party and party.chronicleGetValue(): + data = party.chronicleGetValue().split(";", 3) + ageInfo = ptAgeInfoStruct() + ageInfo.setAgeFilename(data[0]) + ageInfo.setAgeInstanceGuid(data[1]) + + ageLink = ptAgeLinkStruct() + ageLink.setAgeInfo(ageInfo) + ageLink.setLinkingRules(PtLinkingRules.kBasicLink) + ageLink.setSpawnPoint(ptSpawnPointInfo(data[2], data[2])) + + # Player is not really linking--this is an OOC cheat. + nlm = ptNetLinkingMgr() + nlm.linkToAge(ageLink, linkInSfx=False, linkOutSfx=False) + else: + self.chatMgr.AddChatLine(None, "There is no party to crash!", kChat.SystemMessage) + return + elif PtIsInternalRelease(): + try: + PtFindSceneobject(params, PtGetAgeName()) + except NameError: + # Garbage SO = kill party + if party: + party.chronicleSetValue("") + party.save() + self.chatMgr.AddChatLine(None, "Party Crashed.", 0) + else: + self.chatMgr.AddChatLine(None, "No party. Your link-in-point is invalid.", kChat.SystemMessage) + else: + # Got a LIP... Need to set the chronicle + ageInfo = PtGetAgeInfo() + data = "%s;%s;%s" % (ageInfo.getAgeFilename(), ageInfo.getAgeInstanceGuid(), params) + if not party: + party = ptVaultChronicleNode() + party.chronicleSetName(kChron.Party) + party.chronicleSetValue(data) + party.save() # creates node on server (and blocks) so we can add it to the global inbox + inbox.addNode(party) + else: + party.chronicleSetValue(data) + party.save() + + ## Export the local avatar's clothing to a file + def SaveClothing(self, file): + if not file: + self.chatMgr.AddChatLine(None, "Usage: /loadclothing ", kChat.SystemMessage) + return + file = file + ".clo" + if PtGetLocalAvatar().avatar.saveClothingToFile(file): + self.chatMgr.AddChatLine(None, "Outfit exported to " + file, 0) + else: + self.chatMgr.AddChatLine(None, "Could not export to " + file, kChat.SystemMessage) + + ## Import the local avatar's clothing from a file + def LoadClothing(self, file): + if not file: + self.chatMgr.AddChatLine(None, "Usage: /loadclothing ", kChat.SystemMessage) + return + if PtGetPlayerList() and not PtIsInternalRelease(): + self.chatMgr.AddChatLine(None, "You have to be alone to change your clothes!", kChat.SystemMessage) + return + file = file + ".clo" + if PtGetLocalAvatar().avatar.loadClothingFromFile(file): + self.chatMgr.AddChatLine(None, "Outfit imported from " + file, 0) + else: + self.chatMgr.AddChatLine(None, file + " not found", kChat.SystemMessage) + + ## Example function for a coop animation + def CoopExample(self, name): + if not name: + self.chatMgr.AddChatLine(None, "Usage: /threaten ", kChat.SystemMessage) + return + targetKey = None; + for player in PtGetPlayerList(): + if player.getPlayerName().lower() == name.lower(): + name = player.getPlayerName() + targetKey = PtGetAvatarKeyFromClientID(player.getPlayerID()) + break + if targetKey is None: + self.chatMgr.AddChatLine(None, name + " not found", kChat.SystemMessage) + return + if PtGetLocalAvatar().avatar.runCoopAnim(targetKey, "ShakeFist", "Cower"): + self.chatMgr.DisplayStatusMessage(PtGetClientName() + " threatens " + name, 1) + else: + self.chatMgr.AddChatLine(None, "You are too far away", kChat.SystemMessage) + + ## Sets a reward for the current marker game + def MarkerGameReward(self, reward): + markerMgr = self.chatMgr.markerGameManager + if not markerMgr.is_game_loaded or not hasattr(markerMgr, "reward"): + self.chatMgr.AddChatLine(None, "There is no active marker game that can grant rewards.", kChat.SystemMessage) + return + if reward: + self.chatMgr.AddChatLine(None, "Old Reward: '{}'".format(markerMgr.reward), 0) + try: + markerMgr.reward = reward + except: + self.chatMgr.AddChatLine(None, "Failed to set reward.", kChat.SystemMessage) + raise + else: + self.chatMgr.AddChatLine(None, "New Reward: '{}'".format(reward), 0) + elif markerMgr.reward: + self.chatMgr.AddChatLine(None, "Current Reward: '{}'".format(markerMgr.reward), 0) + else: + self.chatMgr.AddChatLine(None, "This game has no associated reward.", 0) diff --git a/Scripts/Python/ki/xKIConstants.py b/Scripts/Python/ki/xKIConstants.py new file mode 100644 index 0000000000..06838bd7c2 --- /dev/null +++ b/Scripts/Python/ki/xKIConstants.py @@ -0,0 +1,637 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +# Plasma Engine. +from Plasma import * +from PlasmaTypes import * + +# Uru modules. +import xEnum + +## Number of items to scroll through in content list. +kContentListScrollSize = 5 + +## Waiting message for marker games. +kMessageWait = xEnum.Enum("createMarker, changeMarkerName") + +## Python component for the Jalak Age. +kJalakPythonComponent = "cPythField" + +## Keys to ignore (Escape, Enter, Space). +kDefaultKeyIgnoreList = [ 10, 27, 32 ] + +# "New Item" alerts (flashing KI and Relto Book). +kAlertTimeDefault = 10.0 +kMaxBookAlertTime = 20.0 +kAlertKIAlert = 60 +kAlertBookAlert = 61 + +## How many of our chat messages shall we log +kMessageHistoryListMax = 50 + +## KI light responders. +kListLightResps = ["respKILightOff","respKILightOn" ] + +## The name of the KI light scene object. +kKILightObjectName = "RTOmniKILight" + +## The easter eggs chat commands. +kEasterEggs = { + "city" : {"see" : "You see the remnants of a great civilization, ready to be rebuilt. Where are the flying monkeys?", + "exits" : "NorthWest and South."}, + "Personal" : {"see" : "You see a small hut... looks deserted.", + "exits" : None}, + "Teledahn" : {"see" : "You see 'shrooms everywhere! Big ones, small ones. Are they edible?", + "exits" : "East."}, + "Nexus" : {"see" : "You see a jukebox-like machine.", + "exits" : None}, + "Garden" : {"see" : "You see bugs. BUGS! I hate bugs.", + "exits" : "North and South."}, + "EderTsogal" : {"see" : "You see grass, water and things floating in the air (not feathers).", + "exits" : "North. But you'll have to climb or fly to get there."}, + "Dereno" : {"see" : "Ah, Dah-Ree-Toe. You see... Well, if someone would clean those stupid windows you could see a *lot*. Have I been here before? Maybe all pods just look the same.", + "exits" : "SouthWest and East. But they are both blocked."}, + "BahroCave" : {"see" : "You see a darkly lit cavern. Strange images on the wall next to you, flickering in the subdued light.Be afraid. Be very afraid!", + "exits" : "North, West and East. But they are blocked by a large hole in the floor."}, + "Minkata" : {"see" : "You see sand and dust in all directions. Above you there is a filtered sun or two... or more. Somewhere there is a horse with no name.", + "exits" : "East. Nine days away."}, + "Cleft" : {"see" : "You see sand for as far as the eye can see. Gonna need a vehicle of some sort.", + "exits" : "... well, I don't know. Maybe you can ask the old man (if he ever stops listening to that music!).", + "people" : "an old man. Ok, maybe he's not standing. BTW, wasn't he on M*A*S*H?"}, +} + +## Constants for Age display names. +class kAges: + Display = {"Ae'gura" : "D'ni-Ae'gura", + "AhnonayCathedral" : "Ahnonay Cathedral", + "AvatarCustomization" : "Avatar Customization", + "BaronCityOffice" : "D'ni-Ae'gura", + "city" : "D'ni-Ae'gura", + "Cleft" : "D'ni-Riltagamin", + "Descent" : "D'ni-Tiwah", + "EderDelin" : "Eder Delin", + "EderTsogal" : "Eder Tsogal", + "Er'canaCitySilo" : "D'ni-Ashem'en", + "ErcanaCitySilo" : "D'ni-Ashem'en", + "GreatTreePub" : "The Watcher's Pub", + "Great Zero" : "D'ni-Rezeero", + "GreatZero" : "D'ni-Rezeero", + "GuildPub-Cartographers" : "The Cartographers' Pub", + "GuildPub-Greeters" : "The Greeters' Pub", + "GuildPub-Maintainers" : "The Maintainers' Pub", + "GuildPub-Messengers" : "The Messengers' Pub", + "GuildPub-Writers" : "The Writers' Pub", + "Kirel" : "D'ni-Kirel", + "K'veer" : "D'ni-K'veer", + "Kveer" : "D'ni-K'veer", + "Neighborhood02" : "D'ni-Kirel", + "Old Spy Room" : "D'ni-Ae'gura", + "philRelto" : "Phil's Relto", + "Shaft" : "D'ni-Tiwah", + "Spy Room" : "D'ni-Ae'gura", + "spyroom" : "D'ni-Ae'gura", + "Trebivdil" : "Tre'bivdil", + "trebivdil" : "Tre'bivdil", + "vothol" : "Vothol Gallery"} + Hide = {"BahroCave", "PelletBahroCave", "Pellet Cave", "LiveBahroCave", "LiveBahroCaves"} + NoInvite = {"Personal", "Nexus", "Cleft", "AvatarCustomization", "city", + "BahroCave", "LiveBahroCave", "LiveBahroCaves", + "BaronCityOffice", "ErcanaCitySilo", "GreatZero", "Shaft", + "Descent", "Spyroom", "Myst"} + Replace = {"Ercana" : "Er'cana", + "Garden" : "Eder Kemo", + "Garrison" : "Gahreesen", + "Gira" : "Eder Gira", + "Personal" : "Relto", + } + +## Constants used for the chat. +class kChat: + MaxChatSize = 2048 + MaxNumChatItems = 50 + StartNumChatItems = 9 + StartOffScreenLine = 0 + ChatBlankLine = " \n" + + # Chat message types. + SelfMsg = 1 + BroadcastMsg = 2 + PrivateMsg = 3 + AdminBroadcastMsg = 4 + AdminPrivateMsg = 5 + PrivateMsgSelf = 6 + OfferLink = 7 + SystemMessage = 8 + InterAge = 9 + InterAgeSelf = 10 + + # Chat fading. + FadeNotActive = 0 + FadeFullDisp = 1 + FadeDoingFade = 2 + FadeStopping = 3 + FadeDone = 4 + FadeTimeMax = 120 + FullTickTime = 1.0 + FadeTickTime = 0.05 + TicksOnFade = 16 + + # Chat fonts. + FontSizeList = [ 7, 8, 10, 12, 14 ] + +## Constants used for the chronicle. +class kChron: + FontSize = "PlayerKIFontSize" + FontSizeType = 2 + FadeTime = "PlayerKIFadeTime" + FadeTimeType = 2 + OnlyPMs = "PlayerKIOnlyPMsBuddies" + OnlyPMsType = 2 + BuddiesOnRequest = "PlayerKIBuddiesOnRequest" + BuddiesOnRequestType = 2 + CGZPlaying = "CGZPlaying" + Party = "PartyAge" + +## Color definitions. +class kColors: + # Basic colors (RGB). + Clear = ptColor(0, 0, 0, 0) + AgenBlueDk = ptColor(0.65, 0.6353, 0.745, 1.0) + AgenGreenLt = ptColor(0.8745, 1.0, 0.85, 1.0) + AgenGreenDk = ptColor(0.65, 0.745, 0.6353, 1.0) + + DniYellow = ptColor(0.851, 0.812, 0.576, 1.0) + DniYellowLt = ptColor(1.0, 1.0, 0.6, 1.0) + DniCyan = ptColor(0.576, 0.867, 0.851, 1.0) + DniBlue = ptColor(0.780, 0.706, 0.870, 1.0) + DniRed = ptColor(1.0, 0.216, 0.380, 1.0) + DniGreen = ptColor(0.698, 0.878, 0.761, 1.0) + DniGreenDk = ptColor(0.0, 0.596, 0.211, 1.0) + DniPurple = ptColor(0.878, 0.698, 0.819, 1.0) + DniWhite = ptColor().white() + + DniShowRed = ptColor(1.0, 0.851, 0.874, 1.0) + DniHideBlue = ptColor(0.780, 0.706, 0.870, 0.3) + + DniShowBtn = DniShowRed + DniGhostBtn = DniHideBlue + + # Chat colors (messages and headers). + ChatMessage = DniWhite + ChatMessageMention = DniYellowLt + ChatHeaderBroadcast = DniBlue + ChatHeaderPrivate = DniYellow + ChatHeaderAdmin = DniCyan + ChatHeaderStatus = DniBlue + ChatHeaderError = DniRed + ChatHeaderNeighbors = DniPurple + ChatHeaderBuddies = DniGreen + + DniSelectable = DniGreen + DniSelected = DniWhite + DniStatic = DniBlue + +## Constants for KI Chat commands. +class kCommands: + Localized = {PtGetLocalizedString("KI.Commands.ChatClearAll") : "ClearChat", + PtGetLocalizedString("KI.Commands.ChatStartLog") : "StartLog", + PtGetLocalizedString("KI.Commands.ChatStopLog") : "StopLog", + PtGetLocalizedString("KI.Commands.AddBuddy") : "AddBuddy", + PtGetLocalizedString("KI.Commands.RemoveBuddy") : "RemoveBuddy", + PtGetLocalizedString("KI.Commands.Ignore") : "IgnorePlayer", + PtGetLocalizedString("KI.Commands.Unignore") : "UnignorePlayer", + PtGetLocalizedString("KI.Commands.DumpLogs") : "DumpLogs", + PtGetLocalizedString("KI.Commands.DumpLog") : "DumpLogs", + PtGetLocalizedString("KI.Commands.ChangePassword") : "ChangePassword"} + Jalak = {"/savecolumns" : "SaveColumns", + "/loadcolumns" : "LoadColumns"} + Internal = {"/revisitcleft" : "RevisitCleft", + "/restart" : "RestartGame", + "/gamereward" : "MarkerGameReward"} + EasterEggs = {"/look" : "LookAround", + "/get feather" : "GetFeather", + "/look in pocket" : "LookForFeathers"} + Text = {"/go" : "Put one foot in front of the other and eventually you will get there.", + "/fly" : "You close your eyes, you feel light headed and the ground slips away from your feet... Then you open your eyes and WAKE UP! (Ha, you can only dream about flying.)"} + Other = {"/party" : "PartyTime", + "/saveclothing" : "SaveClothing", + "/loadclothing" : "LoadClothing", + "/threaten" : "CoopExample"} + +## Numeric limits for the KI. +class kLimits: + JournalTextSize = 2048 + MaxPictures = 15 + MaxNotes = 30 + MaxMarkerFolders = 10 + MaxMarkers = 1000 + MaxRecentPlayerListSize = 50 + +## Ties to the GUI elements. +class kGUI: + # Blackbar. + ExitButtonID = 4 + PlayerBookCBID = 15 + MiniMaximizeRGID = 34 + OptionsMenuButtonID = 200 + microChatButton = 100 + + RolloverLeftID = 998 + RolloverRightID = 999 + + # miniKI. + ChatCaretID = 12 + ChatEditboxID = 5 + ChatDisplayArea = 70 + FolderPlayerList = 30 + PlayerList = 31 + + miniToggleBtnID = 1 + miniPutAwayID = 4 + miniTakePicture = 60 + miniMuteAll = 61 + miniPrivateToggle = 62 + miniCreateJournal = 63 + miniDragBar = 50 + miniChatScrollUp = 51 + miniChatScrollDown = 52 + miniPlayerListUp = 53 + miniPlayerListDown = 54 + + mini7Indicator1 = 71 + mini7Indicator2 = 72 + mini7Indicator3 = 73 + mini7Indicator4 = 74 + + miniMarkerIndicator01 = 601 + miniMarkerIndicatorLast = 625 + miniMarkerColors = { + "off" : 0.0, + "redlt" : 1.5, + "red" : 3.5, + "yellowlt" : 6.0, + "yellow" : 8.5, + "purplelt" : 11.0, + "purple" : 13.5, + "greenlt" : 16.0, + "green" : 18.5, + } + miniGZDrip = 700 + miniGZActive = 701 + miniGZMarkerGameActive = 702 + miniGZMarkerInRange = 703 + miniMGNewMarker = 1010 + miniMGNewGame = 1011 + miniMGInactive = 1012 + + # Big KI - right panel. + BKListMode = 1 + BKJournalExpanded = 2 + BKPictureExpanded = 3 + BKPlayerExpanded = 4 + BKVolumeExpanded = 5 + BKAgeOwnerExpanded = 6 + BKKIExpanded = 7 + BKMarkerListExpanded = 8 + BKQuestionNote = 9 + + # Big KI - controls. + BKIPutAwayID = 4 + BKToggleMiniID = 14 + BKFolderUpLine = 66 + BKFolderDownLine = 67 + BKLMUpButton = 110 + BKLMDownButton = 111 + BKDisabledPeopleButton = 300 + BKDisabledGearButton = 301 + + # Big KI - controls (left). + BKIIncomingBtn = 70 + BKIFolderLineBtn01 = 71 + BKIFolderLineBtnLast = 78 + BKIToPlayerButton = 80 + BKIToIncomingButton = 81 + BKIToFolderButton01 = 82 + BKIToFolderButtonLast = 88 + + # Big KI - controls (right). + BKIListModeCreateBtn = 80 + BKIListModeLineBtn01 = 81 + BKIListModeLineBtnLast = 89 + + # Big KI - fields. + BKNeighborhoodAndID = 59 + BKICurAgeNameID = 60 + BKICurTimeID = 61 + BKIGPS1TextID = 62 + BKIGPS2TextID = 63 + BKIGPS3TextID = 64 + BKPlayerListID = 65 + BKRadioModeID = 68 + BKIPlayerLine = 90 + BKIIncomingLine = 91 + BKIFolderLine01 = 92 + BKIFolderLineLast = 98 + BKPlayerName = 200 + BKPlayerID = 201 + BKIPelletDrop = 400 + BKILMTitleCreateLine = 101 + BKILMOffsetLine01 = 110 + BKILMOffsetLineLast = 190 + BKILMIconPictureOffset = 0 + BKILMTitleOffset = 1 + BKILMDateOffset = 2 + BKILMFromOffset = 3 + BKILMIconJournalOffset = 4 + BKILMIconPersonOffset = 5 + + # Big KI - fields (elongated on mouseover). + LONGBKIIncomingLine = 591 + LONGBKIFolderLine01 = 592 + LONGBKIFolderLineLast = 598 + + # Big KI - expanded journal. + BKIJRNTitleButton = 80 + BKIJRNNoteButton = 81 + BKIJRNDeleteButton = 82 + BKIJRNTitleEdit = 85 + BKIJRNNoteEdit = 86 + BKIJRNAgeName = 90 + BKIJRNDate = 91 + BKIJRNTitle = 92 + BKIJRNNote = 93 + BKIJRNFrom = 94 + BKIJRNSentDate = 95 + + # Big KI - expanded picture. + BKIPICTitleButton = 80 + BKIPICDeleteButton = 82 + BKIPICTitleEdit = 85 + BKIPICAgeName= 90 + BKIPICDate = 91 + BKIPICTitle = 92 + BKIPICImage = 93 + BKIPICFrom = 94 + BKIPICSentDate = 95 + BKIImageStartX = 112 + BKIImageStartY = 212 + + # Big KI - expanded player. + BKIPLYPlayerIDEditBox = 80 + BKIPLYDeleteButton = 82 + BKIPLYName = 90 + BKIPLYID = 91 + BKIPLYDetail = 92 + + # Big KI - expanded KI settings. + BKIKIFontSize=80 + BKIKIFadeTime = 81 + BKIKIOnlyPM = 90 + BKIKIBuddyCheck = 91 + BKIKISettingsText = 570 + BKIKIFontSizeText = 580 + BKIKIFadeTimeText = 581 + BKIKIOnlyPMText = 590 + + # Big KI - expanded volume. + BKISoundFXVolSlider = 80 + BKIMusicVolSlider = 81 + BKIVoiceVolSlider = 82 + BKIAmbienceVolSlider = 83 + BKIMicLevelSlider = 84 + BKIGUIVolSlider = 85 + + # Big KI - expanded Age owner settings. + BKAgeOwnerTitleTB = 90 + BKAgeOwnerTitleBtn = 91 + BKAgeOwnerTitleEditbox = 92 + BKAgeOwnerStatusTB = 93 + BKAgeOwnerMakePublicTB = 94 + BKAgeOwnerMakePublicBtn = 95 + BKAgeOwnerGUIDTB = 96 + BKAgeOwnerDescription = 99 + BKAgeOwnerDescriptionTitle = 510 + + # Big KI - expanded marker folder. + MarkerFolderTitleText = 80 + MarkerFolderTitleBtn = 81 + MarkerFolderTitleEB = 82 + MarkerFolderOwner = 84 + MarkerFolderStatus = 85 + MarkerFolderInvitePlayer = 90 + MarkerFolderEditStartGame = 93 + MarkerFolderPlayEndGame = 94 + MarkerFolderInvitePlayerTB = 100 + MarkerFolderEditStartGameTB = 103 + MarkerFolderPlayEndGameTB = 104 + + MarkerFolderGameTimeTitleTB = 199 + MarkerFolderGameTimeTB = 200 + MarkerFolderTimePullDownBtn = 201 + MarkerFolderTimeArrow = 202 + MarkerFolderGameTypeTB = 210 + MarkerFolderTypePullDownBtn = 211 + MarkerFolderTypeArrow = 212 + MarkerFolderDeleteBtn = 150 + + MarkerFolderToranIcon = 220 + MarkerFolderHSpanIcon = 221 + MarkerFolderVSpanIcon = 222 + MarkerFolderToranTB = 224 + MarkerFolderHSpanTB = 225 + MarkerFolderVSpanTB = 226 + + MarkerFolderMarkListbox = 300 + MarkerFolderMarkerListUpBtn = 301 + MarkerFolderMarkerListDownBtn = 302 + MarkerFolderMarkerTextTB = 310 + MarkerFolderMarkerTextBtn = 311 + MarkerFolderMarkerTextEB = 312 + + # Big KI - editables. + BKEditIDtextbox = 0 + BKEditIDbutton = 1 + BKEditIDeditbox = 2 + BKEditFieldIDs = [ [BKIJRNTitle, BKIJRNTitleButton, BKIJRNTitleEdit], + [BKIJRNNote, BKIJRNNoteButton, BKIJRNNoteEdit], + [BKIPICTitle, BKIPICTitleButton, BKIPICTitleEdit] ] + BKEditFieldJRNTitle = 0 + BKEditFieldJRNNote = 1 + BKEditFieldPICTitle = 2 + + # Yes/No dialog. + YesNoTextID=12 + YesButtonID = 10 + NoButtonID = 11 + YesButtonTextID = 60 + NoButtonTextID = 61 + YesNoLogoutButtonID = 62 + YesNoLogoutTextID = 63 + YNQuit = 0 + YNDelete = 1 + YNOfferLink = 2 + YNOutside = 3 + YNKIFull = 4 + YNWanaPlay = 5 + YNNoReason = 6 + + # Question note dialog. + QNTitle = 100 + QNMessage = 101 + QNAcceptBtn = 110 + QNAcceptText = 120 + QNDeclineBtn = 111 + QNDeclineText = 121 + + # Player Book. + NotOffering = 0 + Offeree = 1 + Offerer = 2 + + # Marker game creation dialog. + CreateMarkerGameNameEB = 1000 + MarkerGameType1 = 1001 + MarkerGameType2 = 1002 + MarkerGameType3 = 1003 + CreateMarkerGameSubmitBT = 1004 + CreateMarkerGameCancelBT = 1005 + MarkerGameLabel1 = 1006 + MarkerGameLabel2 = 1007 + MarkerGameLabel3 = 1008 + MarkerGameStates = { MarkerGameType1 : 0, "UNKNOWN" : 1, MarkerGameType2 : 2, MarkerGameType3 : 3 } + + # Pellet score upload button. + PelletScoreButton = 1020 + + # Scrolling up and down. + ScrollDown = 0 + ScrollUp = 1 + +## Constants for marker games. +class kGames: + MGNotActive = 0 + MGGameCreation = 1 + MGGameOn = 2 + MFOverview = 1 + MFEditing = 2 + MFEditingMarker = 3 + MFPlaying = 4 + +## Constants for the KI images. +class kImages: + Directory = U"KIimages" + FileNameTemplate = U"KIimage" + +## Constants for the KI. +class kKI: + + # Folders. + JournalFolder = 0 + PlayersFolder = 1 + ConfigFolder = 2 + + # State settings. + ClosedKI = 0 + miniKI = 1 + BigKI = 2 + ToggleKI = 3 + +## Localization helpers. +class kLoc: + MarkerFolderPopupMenu = [ + (PtGetLocalizedString("KI.MarkerGame.Popup1Min"), 60), + (PtGetLocalizedString("KI.MarkerGame.Popup2Min"), 120), + (PtGetLocalizedString("KI.MarkerGame.Popup5Min"), 300), + (PtGetLocalizedString("KI.MarkerGame.Popup10Min"), 600), + ] + + OKDialogDict = { + "" : PtGetLocalizedString("KI.Errors.EmptyError"), #01 + "TERMINATED: Server LogOff. Reason: Logged In Elsewhere" : PtGetLocalizedString("KI.Errors.LoggedInElsewhere"), #02 + "TERMINATED: Server LogOff. Reason: Timed Out" : PtGetLocalizedString("KI.Errors.TimedOut"), #03 + "TERMINATED: Server LogOff. Reason: Not Authenticated" : PtGetLocalizedString("KI.Errors.NotAuthenticated"), #04 + "TERMINATED: Server LogOff. Reason: Kicked Off" : PtGetLocalizedString("KI.Errors.KickedOff"), #05 + "TERMINATED: Server LogOff. Reason: Unknown Reason" : PtGetLocalizedString("KI.Errors.UnknownReason"), #06 + "TERMINATED: Server LogOff. Reason: UNKNOWN REASON CODE" : PtGetLocalizedString("KI.Errors.UnknownReason2"), #09 + "SERVER SILENCE" : PtGetLocalizedString("KI.Errors.ServerSilence"), #10 + "BAD VERSION" : PtGetLocalizedString("KI.Errors.OldVersion"), #11 + "Player Disabled" : PtGetLocalizedString("KI.Errors.PlayerDisabled"), #12 + "CAN'T FIND AGE" : PtGetLocalizedString("KI.Errors.CantFindAge"), #13 + "AUTH RESPONSE FAILED" : PtGetLocalizedString("KI.Errors.AuthFailed"), #14 + "AUTH TIMEOUT" : PtGetLocalizedString("KI.Errors.AuthTimeout"), #15 + "SDL Desc Problem" : PtGetLocalizedString("KI.Errors.SDLDescProblem"), #16 + "Unspecified error" : PtGetLocalizedString("KI.Errors.UnspecifiedError"), #17 + "Failed to send msg" : PtGetLocalizedString("KI.Errors.FailedToSendMsg"), #18 + "Authentication timed out" : PtGetLocalizedString("KI.Errors.AuthenticationTimedOut"), #19 + "Peer timed out" : PtGetLocalizedString("KI.Errors.PeerTimedOut"), #20 + "Server silence" : PtGetLocalizedString("KI.Errors.ServerSilence2"), #21 + "Protocol version mismatch" : PtGetLocalizedString("KI.Errors.ProtocolVersionMismatch"), #22 + "Auth failed" : PtGetLocalizedString("KI.Errors.AuthFailed2"), #23 + "Failed to create player" : PtGetLocalizedString("KI.Errors.FailedToCreatePlayer"), #24 + "Invalid error code" : PtGetLocalizedString("KI.Errors.InvalidErrorCode"), #25 + "linking banned" : PtGetLocalizedString("KI.Errors.LinkingBanned"), #26 + "linking restored" : PtGetLocalizedString("KI.Errors.LinkingRestored"), #27 + "silenced" : PtGetLocalizedString("KI.Errors.Silenced"), #28 + "unsilenced" : PtGetLocalizedString("KI.Errors.Unsilenced"), #29 + } + +## Pellet Score operation types. +class kPellets: + ScoreNoOp = 0 + ScoreFetchForDisplay = 1 + ScoreFetchMineForUpload = 2 + ScoreFetchUploadDestination = 3 + ScoreCreateUploadDestination = 4 + ScoreTransfer = 5 + +## A list of timer values. +class kTimers: + Fade = 1 + BKITODCheck = 2 + AlertHide = 3 + TakeSnapShot = 4 + MarkerGame = 5 + DumpLogs = 6 + LightStop = 7 + JalakBtnDelay = 8 + IncomingChatFlash = 9 diff --git a/Scripts/Python/ki/xKIExtChatCommands.py b/Scripts/Python/ki/xKIExtChatCommands.py new file mode 100644 index 0000000000..ebc9fc400b --- /dev/null +++ b/Scripts/Python/ki/xKIExtChatCommands.py @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +# Plasma Engine. +import Plasma + +# Uru modules. +import xInvite + +# Enter new commands in the dictionary below. +# The key is a lowercase version of what the user types after the '/'. +# The value is a string that is a console command or a python function that +# will be executed. +xChatExtendedChat = { + Plasma.PtGetLocalizedString("KI.Commands.Sit") : Plasma.PtAvatarSitOnGround, + Plasma.PtGetLocalizedString("KI.Commands.Afk") : Plasma.PtAvatarEnterAFK, + Plasma.PtGetLocalizedString("KI.Commands.Invite") : xInvite.CreateInvitation, + Plasma.PtGetLocalizedString("KI.Commands.Uninvite") : xInvite.DeleteInvitation, + Plasma.PtGetLocalizedString("KI.Commands.Accept") : xInvite.AcceptInvitation, + Plasma.PtGetLocalizedString("KI.Commands.ShowInvites") : xInvite.ShowInvitations, + Plasma.PtGetLocalizedString("KI.Commands.Me") : xInvite.MeChat +} + +# Enter new commands in the dictionary below. +# The key is a lowercase version of what the user types after the '/'. +# The value is a string that is the engine emote name. +xChatEmoteXlate = { + Plasma.PtGetLocalizedString("KI.Commands.Wave"): ("Wave", "KI.EmoteStrings.Wave"), + Plasma.PtGetLocalizedString("KI.Commands.Sneeze"): ("Sneeze", "KI.EmoteStrings.Sneeze"), + Plasma.PtGetLocalizedString("KI.Commands.Clap"): ("Clap", "KI.EmoteStrings.Clap"), + Plasma.PtGetLocalizedString("KI.Commands.Laugh"): ("Laugh", "KI.EmoteStrings.Laugh"), + Plasma.PtGetLocalizedString("KI.Commands.LOL"): ("Laugh", "KI.EmoteStrings.LOL"), + Plasma.PtGetLocalizedString("KI.Commands.ROTFL"): ("Laugh", "KI.EmoteStrings.ROTFL"), + Plasma.PtGetLocalizedString("KI.Commands.Dance"): ("Dance", "KI.EmoteStrings.Dance"), + Plasma.PtGetLocalizedString("KI.Commands.Yes"): ("Agree", "KI.EmoteStrings.Yes"), + Plasma.PtGetLocalizedString("KI.Commands.No"): ("ShakeHead", "KI.EmoteStrings.No"), + Plasma.PtGetLocalizedString("KI.Commands.Yawn"): ("Yawn", "KI.EmoteStrings.Yawn"), + Plasma.PtGetLocalizedString("KI.Commands.Cheer"): ("Cheer", "KI.EmoteStrings.Cheer"), + Plasma.PtGetLocalizedString("KI.Commands.Thanks"): ("Thank", "KI.EmoteStrings.Thanks"), + Plasma.PtGetLocalizedString("KI.Commands.Thx"): ("Thank", "KI.EmoteStrings.Thx"), + Plasma.PtGetLocalizedString("KI.Commands.Cry"): ("Cry", "KI.EmoteStrings.Cry"), + Plasma.PtGetLocalizedString("KI.Commands.Cries"): ("Cry", "KI.EmoteStrings.Cries"), + Plasma.PtGetLocalizedString("KI.Commands.DontKnow"): ("Shrug", "KI.EmoteStrings.DontKnow"), + Plasma.PtGetLocalizedString("KI.Commands.Shrug"): ("Shrug", "KI.EmoteStrings.Shrug"), + Plasma.PtGetLocalizedString("KI.Commands.Dunno"): ("Shrug", "KI.EmoteStrings.Dunno"), + Plasma.PtGetLocalizedString("KI.Commands.Point"): ("Point", "KI.EmoteStrings.Point"), + Plasma.PtGetLocalizedString("KI.Commands.BeckonBig"): ("BeckonBig", "KI.EmoteStrings.BeckonBig"), + Plasma.PtGetLocalizedString("KI.Commands.BeckonSmall"): ("BeckonSmall", "KI.EmoteStrings.BeckonSmall"), + Plasma.PtGetLocalizedString("KI.Commands.BlowKiss"): ("BlowKiss", "KI.EmoteStrings.BlowKiss"), + Plasma.PtGetLocalizedString("KI.Commands.CallMe"): ("CallMe", "KI.EmoteStrings.CallMe"), + Plasma.PtGetLocalizedString("KI.Commands.Cower"): ("Cower", "KI.EmoteStrings.Cower"), + Plasma.PtGetLocalizedString("KI.Commands.Groan"): ("Groan", "KI.EmoteStrings.Groan"), + Plasma.PtGetLocalizedString("KI.Commands.LeanLeft"): ("LeanLeft", "KI.EmoteStrings.LeanLeft"), + Plasma.PtGetLocalizedString("KI.Commands.LeanRight"): ("LeanRight", "KI.EmoteStrings.LeanRight"), + Plasma.PtGetLocalizedString("KI.Commands.Okay"): ("Okay", "KI.EmoteStrings.Okay"), + Plasma.PtGetLocalizedString("KI.Commands.OverHere"): ("OverHere", "KI.EmoteStrings.OverHere"), + Plasma.PtGetLocalizedString("KI.Commands.Stop"): ("Stop", "KI.EmoteStrings.Stop"), + Plasma.PtGetLocalizedString("KI.Commands.TalkHand"): ("TalkHand", "KI.EmoteStrings.TalkHand"), + Plasma.PtGetLocalizedString("KI.Commands.TapFoot"): ("TapFoot", "KI.EmoteStrings.TapFoot"), + Plasma.PtGetLocalizedString("KI.Commands.ThumbsDown"): ("ThumbsDown", "KI.EmoteStrings.ThumbsDown"), + Plasma.PtGetLocalizedString("KI.Commands.ThumbsUp"): ("ThumbsUp", "KI.EmoteStrings.ThumbsUp"), + Plasma.PtGetLocalizedString("KI.Commands.Amazed"): ("Amazed", "KI.EmoteStrings.Amazed"), + Plasma.PtGetLocalizedString("KI.Commands.Bow"): ("Bow", "KI.EmoteStrings.Bow"), + Plasma.PtGetLocalizedString("KI.Commands.Crazy"): ("Crazy", "KI.EmoteStrings.Crazy"), + Plasma.PtGetLocalizedString("KI.Commands.Cringe"): ("Cringe", "KI.EmoteStrings.Cringe"), + Plasma.PtGetLocalizedString("KI.Commands.CrossArms"): ("CrossArms", "KI.EmoteStrings.CrossArms"), + Plasma.PtGetLocalizedString("KI.Commands.Doh"): ("Doh", "KI.EmoteStrings.Doh"), + Plasma.PtGetLocalizedString("KI.Commands.Flinch"): ("Flinch", "KI.EmoteStrings.Flinch"), + Plasma.PtGetLocalizedString("KI.Commands.Kneel"): ("Kneel", "KI.EmoteStrings.Kneel"), + Plasma.PtGetLocalizedString("KI.Commands.LookAround"): ("LookAround", "KI.EmoteStrings.LookAround"), + Plasma.PtGetLocalizedString("KI.Commands.Peer"): ("Peer", "KI.EmoteStrings.Peer"), + Plasma.PtGetLocalizedString("KI.Commands.Salute"): ("Salute", "KI.EmoteStrings.Salute"), + Plasma.PtGetLocalizedString("KI.Commands.ScratchHead"): ("ScratchHead", "KI.EmoteStrings.ScratchHead"), + Plasma.PtGetLocalizedString("KI.Commands.ShakeFist"): ("ShakeFist", "KI.EmoteStrings.ShakeFist"), + Plasma.PtGetLocalizedString("KI.Commands.Shoo"): ("Shoo", "KI.EmoteStrings.Shoo"), + Plasma.PtGetLocalizedString("KI.Commands.SlouchSad"): ("SlouchSad", "KI.EmoteStrings.SlouchSad"), + Plasma.PtGetLocalizedString("KI.Commands.WaveLow"): ("WaveLow", "KI.EmoteStrings.WaveLow"), + Plasma.PtGetLocalizedString("KI.Commands.WaveBye"): ("Wave", "KI.EmoteStrings.WaveBye"), + Plasma.PtGetLocalizedString("KI.Commands.ThumbsDown2"): ("ThumbsDown2", "KI.EmoteStrings.ThumbsDown2"), + Plasma.PtGetLocalizedString("KI.Commands.ThumbsUp2"): ("ThumbsUp2", "KI.EmoteStrings.ThumbsUp2"), + Plasma.PtGetLocalizedString("KI.Commands.Taunt"): ("Taunt", "KI.EmoteStrings.Taunt"), + Plasma.PtGetLocalizedString("KI.Commands.Cough"): ("Cough", "KI.EmoteStrings.Cough"), + Plasma.PtGetLocalizedString("KI.Commands.AskQuestion"): ("AskQuestion", "KI.EmoteStrings.AskQuestion"), + Plasma.PtGetLocalizedString("KI.Commands.Winded"): ("Winded", "KI.EmoteStrings.Winded") +} + +# Insert an emote animation from xChatEmoteXlate here to make it become a loop +xChatEmoteLoop = [ + "Dance" +] + +## A list of the specially handled extended chat commands. +xChatSpecialHandledCommands = [ + Plasma.PtGetLocalizedString("KI.Commands.ChatReply"), + Plasma.PtGetLocalizedString("KI.Commands.ChatPrivate"), + Plasma.PtGetLocalizedString("KI.Commands.ChatNeighbors"), + Plasma.PtGetLocalizedString("KI.Commands.ChatBuddies"), +] diff --git a/Scripts/Python/ki/xKIHelpers.py b/Scripts/Python/ki/xKIHelpers.py new file mode 100644 index 0000000000..11067d5f11 --- /dev/null +++ b/Scripts/Python/ki/xKIHelpers.py @@ -0,0 +1,328 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +import re + +# Plasma engine. +from Plasma import * +from PlasmaVaultConstants import * + +import xLocTools +from xPsnlVaultSDL import * + +# xKI sub-modules. +from .xKIConstants import * + + +## Helper class for autocompletion in the KI. +class AutocompleteState: + + def __init__(self): + + self.prefix = "" + self.candidates = list() + self.lastCandidateId = None + self.space_match = re.compile("\\s+", re.UNICODE) + self.word_match = re.compile("\\S+", re.UNICODE) + + def pickFirst(self, text, nameList): + + if not text or not nameList: + return None + + names = set() + + for name in nameList: + nospace = self.space_match.sub('', name.lower()) + names.add((nospace, name)) + + text_lower = text.lower() + words = [(m.start(), m.end()) for m in self.word_match.finditer(text_lower)] + words.reverse() + suffix = "" + + for (word_start, word_end) in words: + suffix = text_lower[word_start:word_end] + suffix + + self.candidates = [normal for (nospace, normal) in names + if nospace.startswith(suffix)] + + if self.candidates: + self.candidates.sort() + self.lastCandidateId = 0 + self.prefix = text[:word_start] + return self.prefix + self.candidates[0] + + return None + + def pickNext(self, text): + + if not text or not self.candidates or self.lastCandidateId is None: + return None + + lastCandidate = self.candidates[self.lastCandidateId] + if not text.endswith(lastCandidate): + return None + + nextCandidateId = (self.lastCandidateId + 1) % len(self.candidates) + self.lastCandidateId = nextCandidateId + return self.prefix + self.candidates[nextCandidateId] + + +## A device manager. +class Device: + + def __init__(self, name): + + try: + idx = name.index("/type=") + self.type = name[idx + len("/type="):] + name = name[:idx] + except (LookupError, ValueError): + # Assume that the default device is an imager. + self.type = "imager" + self.name = name + + def __eq__(self, other): + + if self.name == other.name: + return True + else: + return False + + def __ne__(self, other): + + if self.name == other.name: + return False + else: + return True + + +## A folder type for devices like the imager. +class DeviceFolder: + + def __init__(self, name): + + self.name = name + self.dflist = [] + + def __getitem__(self, key): + + return self.dflist[key] + + def __setitem__(self, key, value): + + self.dflist[key] = value + + def append(self, value): + + self.dflist.append(value) + + def remove(self, value): + + self.dflist.remove(value) + + def removeAll(self): + + self.dflist = [] + + def index(self, value): + + return self.dflist.index(value) + + def __getslice__(self, i, j): + + return self.dflist[i:j] + + def __len__(self): + + return len(self.dflist) + + +## A KI Folder holder. +class KIFolder: + + def __init__(self, folderType): + + self.type = folderType + self.name = xLocTools.FolderIDToFolderName(self.type) + + +## A simple class for a separator folder. +class SeparatorFolder: + + def __init__(self, name): + + self.name = name + +## Helper function to prioritize online players in lists. +def CMPplayerOnline(playerA, playerB): + + elPlayerA = playerA.getChild() + elPlayerB = playerB.getChild() + if elPlayerA and elPlayerB: + if elPlayerA.getType() == PtVaultNodeTypes.kPlayerInfoNode and elPlayerB.getType() == PtVaultNodeTypes.kPlayerInfoNode: + elPlayerA = elPlayerA.upcastToPlayerInfoNode() + elPlayerB = elPlayerB.upcastToPlayerInfoNode() + if elPlayerA.playerIsOnline() and elPlayerB.playerIsOnline(): + return cmp(elPlayerA.playerGetName().lower(), elPlayerB.playerGetName().lower()) + if elPlayerA.playerIsOnline(): + return -1 + if elPlayerB.playerIsOnline(): + return 1 + return cmp(elPlayerA.playerGetName().lower(), elPlayerB.playerGetName().lower()) + return 0 + + +## Helper function to sort nodes according to modification date. +def CMPNodeDate(nodeA, nodeB): + + elNodeA = nodeA.getChild() + elNodeB = nodeB.getChild() + if elNodeA is not None and elNodeB is not None: + if elNodeA.getModifyTime() > elNodeB.getModifyTime(): + return -1 + else: + return 1 + return 0 + +## Replace the Age's name as is appropriate. +# It accepts as a parameter a name, unlike GetAgeName. +def FilterAgeName(ageName): + # Many age instance names without a possessive component have a spurious + # apostrophe at the end of the name. Let's correct that before we do anything + if ageName.endswith("'"): + ageName = ageName[:-1] + + # Replace file names with display names - only once, from the right. + # This fixes a bug in which avatars' names containing words like Garden + # incorrectly get replaced. + for Age, replacement in kAges.Replace.iteritems(): + # Only replace if the replacement is not already in there... + # Otherwise we wend up with junk like "Eder Eder Gira" + if ageName.find(replacement) == -1: + ageNameList = ageName.rsplit(Age, 1) + ageName = replacement.join(ageNameList) + + # Find the appropriate display name. + if ageName == "???" or ageName == "BahroCave": + sdl = xPsnlVaultSDL() + if sdl["TeledahnPoleState"][0] > 5 or sdl["KadishPoleState"][0] > 5 or sdl["GardenPoleState"][0] > 5 or sdl["GarrisonPoleState"][0] > 5: + ageName = "D'ni-Rudenna" + else: + ageName = "Unknown" + elif ageName in kAges.Hide: + ageName = "Unknown" + else: + for Age in kAges.Display: + if Age.lower() == ageName.lower(): + ageName = kAges.Display[Age] + break + + ageName = ageName.replace("(null)", "").strip() + return ageName + +def FilterPlayerInfoList(playerInfoList): + """Removes yourself from a list of player info nodes""" + myID = PtGetLocalPlayer().getPlayerID() + for i, playerInfo in enumerate(playerInfoList): + playerInfo = playerInfo.getChild().upcastToPlayerInfoNode() + if not playerInfo: + continue + if playerInfo.playerGetID() == myID: + del playerInfoList[i] + +## Returns an Age's name the way a player should see it. +# This display is used in the top-right corner of the BigKI. +def GetAgeName(ageInfo=None): + if not ageInfo: + ageLink = ptNetLinkingMgr().getCurrAgeLink() + if not ageLink: + return "?UNKNOWN?" + ageInfo = ageLink.getAgeInfo() + if not ageInfo: + return "?UNKNOWN?" + + if ageInfo.getAgeFilename() == "BahroCave": + sdl = xPsnlVaultSDL() + if sdl["TeledahnPoleState"][0] > 5 or sdl["KadishPoleState"][0] > 5 or sdl["GardenPoleState"][0] > 5 or sdl["GarrisonPoleState"][0] > 5: + return "D'ni-Rudenna" + + if ageInfo.getAgeFilename() in kAges.Hide: + return "Unknown" + + if ageInfo.getAgeFilename() in kAges.Display: + return kAges.Display[ageInfo.getAgeFilename()] + + localizeName = ageInfo.getDisplayName() + return FilterAgeName(xLocTools.LocalizeAgeName(localizeName)) + +## Find the player's neighborhood. +def GetNeighborhood(): + + try: + return ptVault().getLinkToMyNeighborhood().getAgeInfo() + except AttributeError: + PtDebugPrint(u"xKIHelpers.GetNeighborhood(): Neighborhood not found.", level=kDebugDumpLevel) + return None + +## Find the player's neighbors. +def GetNeighbors(): + + try: + return GetNeighborhood().getAgeOwnersFolder() + except AttributeError: + PtDebugPrint(u"xKIHelpers.GetNeighbors(): List of neighbors not found.", level=kDebugDumpLevel) + return None + +## Sends a notification message to a script. +def SendNote(key, script, name, varValue=1.0, net=False): + + note = ptNotify(key) + note.clearReceivers() + note.addReceiver(script) + note.netPropagate(net) + note.netForce(net) + note.setActivate(1.0) + note.addVarNumber(str(name), varValue) + note.send() diff --git a/Scripts/Python/ki/xMarkerBrainQuest.py b/Scripts/Python/ki/xMarkerBrainQuest.py new file mode 100644 index 0000000000..6b2c35f59f --- /dev/null +++ b/Scripts/Python/ki/xMarkerBrainQuest.py @@ -0,0 +1,262 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +from Plasma import * +from PlasmaKITypes import * +from PlasmaTypes import * + +import grtzMarkerGames +from .xMarkerGameBrain import * +from .xMarkerBrainUser import * + +class QuestMarkerBrain(object): + def CaptureAllMarkers(self): + mgr = ptMarkerMgr() + captures = {} + for i in xrange(self.marker_total): + mgr.captureQuestMarker(i, True) + captures[i] = True + self._captures = captures + + def CaptureMarker(self, idx): + for marker in self.markers: + if marker[0] == idx: + desc = marker[3] + break + else: + PtDebugPrint("QuestMarkerBrain.CaptureMarker():\tMarker #{} does not exist. Are you drunk?".format(idx)) + return + + PtDebugPrint(u"QuestMarkerBrain.CaptureMarker():\tCapturing marker #{}, '{}'".format(idx, desc), level=kWarningLevel) + ptMarkerMgr().captureQuestMarker(idx, True) + msg = PtGetLocalizedString("KI.MarkerGame.FoundMarker", [desc]) + PtSendKIMessage(kKILocalChatStatusMsg, msg) + + caps = self._captures + if idx not in caps or not caps[idx]: + caps[idx] = True + self._captures = caps + + def _get_captures(self): + return PtGetMarkerQuestCaptures(self.game_id) + def _set_captures(self, value): + PtSetMarkerQuestCaptures(self.game_id, value) + _captures = property(_get_captures, _set_captures) + + def Cleanup(self): + self._captures = {} + + def IsMarkerCaptured(self, idx): + try: + return bool(self._captures[idx]) + except: + return False + + @property + def markers_captured(self): + for i, captured in self._captures.iteritems(): + if captured: + age, pos, desc = self._markers[i] + yield (i, age, pos, desc) + + @property + def num_markers_captured(self): + return len(self._captures) + + def RefreshMarkers(self): + mgr = ptMarkerMgr() + mgr.removeAllMarkers() + + ageName = PtGetAgeName().lower() + captures = self._captures + for i, age, pos, desc in self.markers: + if ageName != age.lower(): + continue + try: + captured = captures[i] + except LookupError: + captured = False + if not captured: + mgr.addMarker(pos, i, False) + + +class CGZMarkerGame(QuestMarkerBrain): + def __init__(self, mission, newMission=True): + self._markers = grtzMarkerGames.mgs[mission] + if newMission: + PtSetCGZM(mission) + PtUpdateCGZStartTime() + self._captures = {} + + def Cleanup(self): + PtSetCGZM(-1) + self._captures = {} + + @property + def game_id(self): + return "cgz" + + @staticmethod + def LoadFromVault(): + try: + return CGZMarkerGame(PtGetCGZM(), newMission=False) + except: + return None + + @property + def marker_colors(self): + return ("yellow", "yellowlt") + + @property + def marker_total(self): + return len(list(self.markers)) + + @property + def markers(self): + for i, (age, pos, desc) in enumerate(self._markers): + yield (i, age, pos, desc) + + @property + def playing(self): + return True + + +class UCQuestMarkerGame(QuestMarkerBrain, UCMarkerGame): + def __init__(self, markerNode): + UCMarkerGame.__init__(self, markerNode) + + def _get_is_active(self): + mg = PtGetMarkerGameChronicle() + if mg is not None and mg.getValue() == "quest": + chron = PtFindCreateMarkerChronicle("ActiveQuest") + return chron.getValue() == self.game_id + return False + def _set_is_active(self, value): + mg = PtGetMarkerGameChronicle() + mg.setValue("quest" if value else "") + mg.save() + chron = PtFindCreateMarkerChronicle("ActiveQuest") + chron.setValue(self.game_id if value else "-1") + chron.save() + _is_active = property(_get_is_active, _set_is_active) + + def CaptureMarker(self, id): + # We're still told to capture markers even if the game is not being played (eg in edit mode) + if self.playing: + QuestMarkerBrain.CaptureMarker(self, id) + if self._finished_game: + self._GiveReward() + + def Cleanup(self): + QuestMarkerBrain.Cleanup(self) + self._is_active = False + + def DeleteMarker(self, id): + UCMarkerGame.DeleteMarker(self, id) + if self.markers_visible: + self.RefreshMarkers() + + @property + def _finished_game(self): + """Checks our captures against the markers because yhe game may have been updated""" + captures = self._captures + for idx, age, pos, desc in self.markers: + if idx not in self._captures: + return False + return True + + def _GiveReward(self): + # Send a congratulatory note to the KI + congrats = PtGetLocalizedString("KI.MarkerGame.FinishedGame", [self.game_name]) + PtSendKIMessage(kKILocalChatStatusMsg, congrats) + + # Apply any game-specific reward + UCMarkerGame._GiveReward(self) + + @staticmethod + def LoadFromVault(): + chron = PtFindCreateMarkerChronicle("ActiveQuest", default=0) + try: + gameID = int(chron.getValue()) + except: + return None + + # We need to search for the game's node. It should already be in our player vault, thankfully. + template = ptVaultMarkerGameNode() + template.setID(gameID) + gameNode = ptVault().findNode(template) + if gameNode is None: + PtDebugPrint("UCQuestMarkerGame.LoadFromVault():\tFailed to fetch game #{}".format(gameID)) + return None + gameNode = gameNode.upcastToMarkerGameNode() + if gameNode is None: + PtDebugPrint("UCQuestMarkerGame.LoadFromVault():\tNode #{} is not a marker game".format(gameID)) + return None + + PtDebugPrint("UCQuestMarkerGame.LoadFromVault():\tRestored game #{}".format(gameID), level=kWarningLevel) + brain = UCQuestMarkerGame(gameNode) + # refresh markers now == KABLOOEY! + brain.Play(refreshMarkers=False) + return brain + + @property + def marker_colors(self): + return ("purple", "purplelt") + + def Play(self, refreshMarkers=True): + UCMarkerGame.Play(self) + self._is_active = True + if refreshMarkers: + self.RefreshMarkers() + + def RefreshMarkers(self): + if self.markers_visible: + QuestMarkerBrain.RefreshMarkers(self) + + def Stop(self): + UCMarkerGame.Stop(self) + self._is_active = False + +# Register our ABC so it doesn't complain about all the mixins +MarkerGameBrain.register(CGZMarkerGame) +MarkerGameBrain.register(UCQuestMarkerGame) diff --git a/Scripts/Python/ki/xMarkerBrainUser.py b/Scripts/Python/ki/xMarkerBrainUser.py new file mode 100644 index 0000000000..71457415de --- /dev/null +++ b/Scripts/Python/ki/xMarkerBrainUser.py @@ -0,0 +1,227 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +from Plasma import * +from PlasmaTypes import * + +def _str2color(col): + r, g, b = col.strip().split(',', 3) + r = float(r.strip()) / 255.0 + g = float(g.strip()) / 255.0 + b = float(b.strip()) / 255.0 + return ptColor(r, g, b) + +class UCMarkerGame(object): + def __init__(self, markerNode): + assert isinstance(markerNode, ptVaultMarkerGameNode) + self._node = markerNode + self._RefreshMarkersFromNode() + + self._editMode = False + self._showingMarkers = False + self._playing = False + + def AddMarker(self, age, pos, desc): + """"Adds a new marker to this game""" + idx = self._nextMarkerID + self._nextMarkerID += 1 + + self._markers.append((idx, age, pos, desc)) + if self._showingMarkers and age.lower() == PtGetAgeName().lower(): + ptMarkerMgr().addMarker(pos, idx, True) + return idx + + def BeginEditingMarkers(self): + """Displays all markers for editing""" + self._RefreshMarkersFromNode() + curAge = PtGetAgeName().lower() + + mgr = self._ResetMarkerMgr() + self._editMode = True + self._showingMarkers = True + for idx, age, pos, desc in self.markers: + if curAge == age.lower(): + mgr.addMarker(pos, idx, False) + + def DeleteMarker(self, idx): + for i, marker in enumerate(self._markers): + if marker[0] == idx: + if self.selected_marker_id == idx: + self.selected_marker_id = -1 + self._markers.pop(i) + return + raise KeyError(idx) + + @property + def edit_mode(self): + return self._editMode + + def FinishEditingMarkers(self): + """Hides all markers and commits edits back to the vault node""" + self._editMode = False + self._ResetMarkerMgr() + self._node.setMarkers(self._markers) + self._node.save() + + @property + def game_id(self): + return str(self._node.getID()) + + @property + def game_name(self): + return self._node.getGameName() + + def _GiveReward(self): + for reward in self._node.getReward().split(';'): + things = reward.split(':') + if things[0] == "chron": + value = things[2] if len(things) > 2 else "1" + PtDebugPrint("UCMarkerGame._GiveReward():\tSetting chronicle '{}' = '{}'".format(things[1], value), level=kWarningLevel) + # NOTE: searches for a matching entry before creating + ptVault().addChronicleEntry(things[1], 0, value) + elif things[0] == "clothing": + av = PtGetLocalAvatar().avatar + gender = "F" if av.getAvatarClothingGroup() else "M" + clothing = "{}{}".format(gender, things[1]) + if clothing in av.getWardrobeClothingList(): + PtDebugPrint("UCMarkerGame._GiveReward():\tAlready have clothing item '{}'".format(clothing), level=kWarningLevel) + else: + PtDebugPrint("UCMarkerGame._GiveReward():\tGiving clothing item '{}'".format(clothing), level=kWarningLevel) + try: + tint1 = _str2color(things[2]) + except IndexError: + tint1 = ptColor().white() + try: + tint2 = _str2color(things[3]) + except IndexError: + tint2 = ptColor().white() + av.addWardrobeClothingItem(clothing, tint1, tint2) + + @property + def marker_total(self): + return len(self._markers) + + @property + def markers(self): + return self._markers + + @property + def markers_visible(self): + return self._showingMarkers + + def Play(self): + self._playing = True + self._showingMarkers = True + self._RefreshMarkersFromNode() + + @property + def playing(self): + return self._playing + + def _RefreshMarkersFromNode(self): + # We hold a local copy of the markers so that we don't have to worry if the game is updated + # while we're in the middle of playing it. + self._markers = self._node.getMarkers() + + # This will hold the next marker ID. Will be useful for adding new markers + if self._markers: + self._nextMarkerID = max(self._markers, key=lambda x: x[0])[0] + 1 + else: + self._nextMarkerID = 0 + + def _ResetMarkerMgr(self): + self._showingMarkers = False + mgr = ptMarkerMgr() + mgr.clearSelectedMarker() + mgr.removeAllMarkers() + return mgr + + def _get_reward(self): + return self._node.getReward() + def _set_reward(self, value): + self._node.setReward(value) + reward = property(_get_reward, _set_reward) + + @property + def selected_marker(self): + id = ptMarkerMgr().getSelectedMarker() + if id != -1: + for marker in self._markers: + if marker[0] == id: + return marker + return None + + def _get_selected_marker_id(self): + return ptMarkerMgr().getSelectedMarker() + def _set_selected_marker_id(self, value): + ptMarkerMgr().setSelectedMarker(value) + selected_marker_id = property(_get_selected_marker_id, _set_selected_marker_id) + + def _get_selected_marker_index(self): + wantID = ptMarkerMgr().getSelectedMarker() + for idx, (id, age, pos, desc) in enumerate(self._markers): + if id == wantID: + return idx + return -1 + def _set_selected_marker_index(self, value): + for idx, (id, age, pos, desc) in enumerate(self._markers): + if idx == value: + ptMarkerMgr().setSelectedMarker(id) + return + selected_marker_index = property(_get_selected_marker_index, _set_selected_marker_index) + + def _get_selected_marker_name(self): + marker = self.selected_marker + if marker is not None: + return marker[3] + return "?UNKOWN MARKER?" + def _set_selected_marker_name(self, value): + idx = self.selected_marker_index + if idx != -1: + id, age, pos, desc = self._markers[idx] + self._markers[idx] = (id, age, pos, value) + selected_marker_name = property(_get_selected_marker_name, _set_selected_marker_name) + + def Stop(self): + self._playing = False + self._ResetMarkerMgr() diff --git a/Scripts/Python/ki/xMarkerGameBrain.py b/Scripts/Python/ki/xMarkerGameBrain.py new file mode 100644 index 0000000000..bc42d04c6b --- /dev/null +++ b/Scripts/Python/ki/xMarkerGameBrain.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +import abc + +from Plasma import * + +class MarkerGameBrain(object): + """ABC for marker games""" + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def CaptureMarker(self, idx): + pass + + @abc.abstractmethod + def Cleanup(self): + pass + + @abc.abstractproperty + def game_id(self): + pass + + @abc.abstractmethod + def IsMarkerCaptured(self, idx): + """Returns if the marker has been captured""" + return False + + @abc.abstractproperty + def marker_colors(self): + """Returns a tuple of colors to use in the KI (captured, need_capture)""" + pass + + @abc.abstractproperty + def marker_total(self): + """Returns the total number of markers""" + return 0 + + @abc.abstractproperty + def markers(self): + """Returns all markers as (id, age, position, description)""" + pass + + @abc.abstractproperty + def markers_captured(self): + """Returns all markers captured""" + pass + + @abc.abstractproperty + def num_markers_captured(self): + """Returns the total number of markers captured""" + return 0 + + @abc.abstractproperty + def playing(self): + return False + + @abc.abstractmethod + def RefreshMarkers(self): + pass diff --git a/Scripts/Python/ki/xMarkerMgr.py b/Scripts/Python/ki/xMarkerMgr.py new file mode 100644 index 0000000000..c044a4a6bf --- /dev/null +++ b/Scripts/Python/ki/xMarkerMgr.py @@ -0,0 +1,201 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +from Plasma import * +from PlasmaConstants import * +from PlasmaKITypes import * +from PlasmaTypes import * + +from .xMarkerBrainQuest import * +from .xMarkerGameBrain import * + +class MarkerGameManager(object): + def __init__(self): + self._brain = None + + def __getattr__(self, name): + if self._brain is not None: + return getattr(self._brain, name) + + def __setattr__(self, name, value): + if name != "_brain" and self._brain is not None: + if hasattr(self._brain, name): + setattr(self._brain, name, value) + return + self.__dict__[name] = value + + def AmIPlaying(self, node): + """Determines if we are playing a given marker game""" + if self.IsActive(node): + return self._brain.playing + return False + + def _BeginMarkerGame(self, braincls, *args): + """Sets up a new marker game brain""" + self._brain = braincls(*args) + self.RefreshMarkers() + self._UpdateKIMarkerLightsFromBrain() + + def IsActive(self, node): + if self._brain is None: + return False + elif isinstance(self._brain, CGZMarkerGame): + return False + else: + return self._brain._node == node + + @property + def is_cgz(self): + """Is the current game a Calibration GZ Mission?""" + return isinstance(self._brain, CGZMarkerGame) + + @property + def is_game_loaded(self): + """Is there an active Marker Game?""" + return self._brain is not None + + @property + def is_quest(self): + """Is the current game a user created Quest?""" + return isinstance(self._brain, UCQuestMarkerGame) + + def LoadFromVault(self): + """Loads the game state from the vault""" + chron = PtGetMarkerGameChronicle() + if chron is not None: + game = chron.getValue().lower() + if game == "cgz": + self._brain = CGZMarkerGame.LoadFromVault() + elif game == "quest": + self._brain = UCQuestMarkerGame.LoadFromVault() + else: + self._TeardownMarkerGame() + else: + self._TeardownMarkerGame() + + if self._brain is not None: + self.RefreshMarkers() + self._UpdateKIMarkerLightsFromBrain() + else: + ptMarkerMgr().removeAllMarkers() + self._UpdateKIMarkerLights("off", "off", 0, 0) + + def LoadGame(self, node): + """Ensures that the given game is loaded (note: if so, this is a no-op)""" + if isinstance(node, ptVaultNodeRef): + node = node.getChild().upcastToMarkerGameNode() + if node is None: + return + + if not self.IsActive(node): + PtDebugPrint(u"xMarkerMgr.LoadGame():\tLoading brain for '{}'".format(node.getGameName())) + self._TeardownMarkerGame() + ## FIXME: other game types + self._BeginMarkerGame(UCQuestMarkerGame, node) + + def OnBackdoorMsg(self, target, param): + if target.lower() == "cgz": + if param.lower() == "capture": + if isinstance(self._brain, CGZMarkerGame): + self._brain.CaptureAllMarkers() + self._UpdateKIMarkerLightsFromBrain() + + def OnKIMsg(self, command, value): + if command == kMGStartCGZGame: + if PtGetCGZM() != value: + self._TeardownMarkerGame() + self._BeginMarkerGame(CGZMarkerGame, value) + elif command == kMGStopCGZGame: + if isinstance(self._brain, CGZMarkerGame): + self._TeardownMarkerGame() + + def OnMarkerMsg(self, msgType, tupData): + if msgType == PtMarkerMsgType.kMarkerCaptured: + if self._brain is None: + return + marker = tupData[0] + self._brain.CaptureMarker(marker) + self._UpdateKIMarkerLightsFromBrain() + + def OnServerInitComplete(self): + # We've entered a new age, it's time to show the relevant markers + if self._brain is not None: + self.RefreshMarkers() + + def Play(self): + self._brain.Play() + self._UpdateKIMarkerLightsFromBrain() + + def StopGame(self, reset=False): + """This is designed to halt UCMarkerGames""" + if not isinstance(self._brain, UCMarkerGame): + PtDebugPrint("xMarkerMgr.StopGame():\tStopping a non-UC game. Seems fishy.") + return + if self._brain is not None: + self._brain.Stop() + if reset: + self._brain.Cleanup() + ptMarkerMgr().removeAllMarkers() + self._UpdateKIMarkerLights("off", "off", 0, 0) + + def _TeardownMarkerGame(self, suspend=False): + if self._brain is not None: + if not suspend: + self._brain.Cleanup() + del self._brain + self._brain = None + + ptMarkerMgr().removeAllMarkers() + self._UpdateKIMarkerLights("off", "off", 0, 0) + + def _UpdateKIMarkerLights(self, getColor, toGetColor, numCaptured, totalMarkers): + """Updates the circular marker status display around the Mini KI""" + value = "-1 {}:{} {}:{}".format(getColor, toGetColor, max(numCaptured, 0), max(totalMarkers, 0)) + PtSendKIMessage(kGZFlashUpdate, value) + + def _UpdateKIMarkerLightsFromBrain(self): + if self._brain.playing: + getColor, toGetColor = self._brain.marker_colors + self._UpdateKIMarkerLights(getColor, toGetColor, self._brain.num_markers_captured, self._brain.marker_total) + else: + self._UpdateKIMarkerLights("off", "off", 0, 0) diff --git a/Scripts/Python/krelPodium.py b/Scripts/Python/krelPodium.py new file mode 100644 index 0000000000..6d2139fc16 --- /dev/null +++ b/Scripts/Python/krelPodium.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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 + PtDebugPrint("__init__krelPodium v.", version,".0") + + def OnServerInitComplete(self): + try: + ageSDL = PtGetAgeSDL() + except: + PtDebugPrint("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() + + PtDebugPrint("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(): + PtDebugPrint("##") + nb01CmnRmSpeech = ageSDL["nb01CmnRmSpeech"][0] + + if nb01CmnRmSpeech == 0: # No speech was playing + PtDebugPrint("krelPodium: No speech was previously playing. Playing speech #1.") + respSpeech01.run(self.key) + ageSDL["nb01CmnRmSpeech"] = (1,) + + else: + PtDebugPrint("krelPodium: Speech #1 was stopped manually by the avatar.") + respSilence.run(self.key) + ageSDL["nb01CmnRmSpeech"] = (0,) + + + elif id == respSpeech01.id: + PtDebugPrint("krelPodium: Speech #1 was stopped automatically after it finished playing.") + respSilence.run(self.key) + ageSDL["nb01CmnRmSpeech"] = (0,) diff --git a/Scripts/Python/minkCage.py b/Scripts/Python/minkCage.py new file mode 100644 index 0000000000..df67476b10 --- /dev/null +++ b/Scripts/Python/minkCage.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__minkCage v.", version,".0") + + ########################### + def OnFirstUpdate(self): + # set flags on age SDL vars we'll be changing + try: + ageSDL = PtGetAgeSDL() + except: + PtDebugPrint("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) + + PtDebugPrint("minkCage.OnFirstUpdate(): Hiding all Cage Symbol pieces") + respCageSymbol.run(self.key, state="Hide") + + symbolCount = 0 + + if ageSDL["minkSymbolPart01"][0]: + PtDebugPrint("minkCage.OnFirstUpdate(): You've found piece 1") + respCageSymbol.run(self.key, state="1") + symbolCount += 1 + + if ageSDL["minkSymbolPart02"][0]: + PtDebugPrint("minkCage.OnFirstUpdate(): You've found piece 2") + respCageSymbol.run(self.key, state="2") + symbolCount += 1 + + if ageSDL["minkSymbolPart03"][0]: + PtDebugPrint("minkCage.OnFirstUpdate(): You've found piece 3") + respCageSymbol.run(self.key, state="3") + symbolCount += 1 + + if ageSDL["minkSymbolPart04"][0]: + PtDebugPrint("minkCage.OnFirstUpdate(): You've found piece 4") + respCageSymbol.run(self.key, state="4") + symbolCount += 1 + + if ageSDL["minkSymbolPart05"][0]: + PtDebugPrint("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]: + PtDebugPrint("minkCage.OnFirstUpdate(): You've found all the Pieces, enabling link") + regCageSymbol.enable() + + ########################### + def OnNotify(self,state,id,events): + PtDebugPrint("minkCage.OnNotify(): state=%s id=%d events=" % (state, id), events) + + if id == regCageSymbol.id and PtFindAvatar(events) == PtGetLocalAvatar(): + PtDebugPrint("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/Scripts/Python/minkDayClicks.py b/Scripts/Python/minkDayClicks.py new file mode 100644 index 0000000000..e4c091b0c6 --- /dev/null +++ b/Scripts/Python/minkDayClicks.py @@ -0,0 +1,140 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__minkDayClicks v.", version,".0") + + ########################### + def OnFirstUpdate(self): + ageSDL = PtGetAgeSDL() + + if not len(PtGetPlayerList()) and ageSDL["minkIsDayTime"][0]: + PtDebugPrint("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): + PtDebugPrint("minkDayClicks.OnNotify(): state=%s id=%d events=" % (state, id), events) + + if id in ClickToResponder.viewkeys() and state and PtFindAvatar(events) == PtGetLocalAvatar(): + PtDebugPrint("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: + PtDebugPrint("minkDayClicks.OnNotify(): Responder Finished, Updating SDL") + ageSDL = PtGetAgeSDL() + ageSDL["minkIsDayTime"] = (not ageSDL["minkIsDayTime"][0],) + + if id != behRespCage.id: + num = ResponderId.index(id) + 1 + PtDebugPrint("minkDayClicks.OnNotify(): Should show %d" % (num)) + code = "ageSDL[\"minkSymbolShow0%d\"] = (1,)" % (num) + exec(code) diff --git a/Scripts/Python/minkDayNight.py b/Scripts/Python/minkDayNight.py new file mode 100644 index 0000000000..48bd850b55 --- /dev/null +++ b/Scripts/Python/minkDayNight.py @@ -0,0 +1,161 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__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: + PtDebugPrint("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]: + PtDebugPrint("minkDayNight.OnServerInitComplete(): It's Day Time, Loading Day Page") + PtPageInNode("minkExteriorDay") + else: + PtDebugPrint("minkDayNight.OnServerInitComplete(): It's Night Time, Loading Night Page") + PtPageInNode("minkExteriorNight") + + ########################### + def OnSDLNotify(self,VARname,SDLname,playerID,tag): + ageSDL = PtGetAgeSDL() + PtDebugPrint("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: + PtDebugPrint("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]: + PtDebugPrint("minkDayNight.OnTimer(): Paging in Day Page") + PtPageInNode("minkExteriorDay") + else: + PtDebugPrint("minkDayNight.OnTimer(): Paging in Night Page") + PtPageInNode("minkExteriorNight") + + elif id == 2: + PtDebugPrint("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 + PtDebugPrint(u"minkDayNight.OnPageLoad(): what={} who={}".format(what, who), level=kDebugDumpLevel) + + if what == kLoaded: + if who in {u"Minkata_District_minkExteriorDay", u"Minkata_minkExteriorDay"}: + if HackIt: + HackIt = 0 + return + PtDebugPrint("minkDayNight.OnPageLoad(): Day Page loaded, unloading Night") + PtPageOutNode("minkExteriorNight") + elif who in {u"Minkata_District_minkExteriorNight", u"Minkata_minkExteriorNight"}: + if HackIt: + HackIt = 0 + return + PtDebugPrint("minkDayNight.OnPageLoad(): Night Page loaded, unloading Day") + PtPageOutNode("minkExteriorDay") + + elif what == kUnloaded: + if who in {u"Minkata_District_minkExteriorDay", u"Minkata_District_minkExteriorNight", + u"Minkata_minkExteriorDay", u"Minkata_minkExteriorNight"}: + PtDebugPrint("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/Scripts/Python/minkSymbols.py b/Scripts/Python/minkSymbols.py new file mode 100644 index 0000000000..0eaa6018d0 --- /dev/null +++ b/Scripts/Python/minkSymbols.py @@ -0,0 +1,213 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__minkSymbols v.", version,".0") + + ########################### + def OnFirstUpdate(self): + # set flags on age SDL vars we'll be changing + try: + ageSDL = PtGetAgeSDL() + except: + PtDebugPrint("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]: + PtDebugPrint("minkSymbols.OnFirstUpdate(): You already found piece 1") + respDisableCave01.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolPart02"][0] or not ageSDL["minkSymbolShow02"][0]: + PtDebugPrint("minkSymbols.OnFirstUpdate(): You already found piece 2") + respDisableCave02.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolPart03"][0] or not ageSDL["minkSymbolShow03"][0]: + PtDebugPrint("minkSymbols.OnFirstUpdate(): You already found piece 3") + respDisableCave03.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolPart04"][0] or not ageSDL["minkSymbolShow04"][0]: + PtDebugPrint("minkSymbols.OnFirstUpdate(): You already found piece 4") + respDisableCave04.run(self.key, netPropagate=0) + + if ageSDL["minkSymbolPart05"][0] or not ageSDL["minkSymbolShow05"][0]: + PtDebugPrint("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]: + PtDebugPrint("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]: + PtDebugPrint("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]: + PtDebugPrint("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]: + PtDebugPrint("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]: + PtDebugPrint("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): + PtDebugPrint("minkSymbols.OnNotify(): state=%s id=%d events=" % (state, id), events) + + if id in RegionToResponder.viewkeys(): + PtDebugPrint("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/Scripts/Python/mymod.py b/Scripts/Python/mymod.py new file mode 100644 index 0000000000..f804f28b2c --- /dev/null +++ b/Scripts/Python/mymod.py @@ -0,0 +1,195 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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" + PtDebugPrint("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" + PtDebugPrint("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: + PtDebugPrint("%s is finished loading" % (who)) + elif what == kUnloaded: + PtDebugPrint("%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/Scripts/Python/mystFireplace.py b/Scripts/Python/mystFireplace.py new file mode 100644 index 0000000000..bc358930c4 --- /dev/null +++ b/Scripts/Python/mystFireplace.py @@ -0,0 +1,434 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__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.viewitems(): + #PtDebugPrint(key) + #p = value.getParentKey() + #if p: + #PtDebugPrint("\t", p.getName()) + #actPanelButtons.enable(objectName=key) + + + def OnNotify(self,state,id,events): + global IgnorePanelClick + + PtDebugPrint("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.viewitems(): + 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.viewitems(): + 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) + + PtDebugPrint(panelName, bstate) + + for rkey,rvalue in respMorphButtons.byObject.viewitems(): + parent = rvalue.getParentKey() + if parent: + pname = parent.getName() + #pnum = 8*(int(pname[-2:]) - 1) + (ord(pname[-3]) - ord("A")) + #PtDebugPrint(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() + + PtDebugPrint("CheckedButtons:", CheckedButtons) + PtDebugPrint("solution :", solution) + + return CheckedButtons == solution + + def ResetPanel(self): + global CheckedButtons + global IgnorePanelClick + + #respResetPanel.run(self.key, fastforward=1) + #for rkey,rvalue in respResetPanel.byObject.viewitems(): + # respResetPanel.run(self.key,objectName=rkey, fastforward=0) + + for but in CheckedButtons: + id = but[-3:] + for rkey,rvalue in respMorphButtons.byObject.viewitems(): + 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/Scripts/Python/nb01DRCImager.py b/Scripts/Python/nb01DRCImager.py new file mode 100644 index 0000000000..8e886169d2 --- /dev/null +++ b/Scripts/Python/nb01DRCImager.py @@ -0,0 +1,217 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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 imagerdevice is not 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 self.inbox is not 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 element is not 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/Scripts/Python/nb01Easel.py b/Scripts/Python/nb01Easel.py new file mode 100644 index 0000000000..0eaab17758 --- /dev/null +++ b/Scripts/Python/nb01Easel.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +"""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.drawText(0,0,text) + dyna_map.textmap.flush() + diff --git a/Scripts/Python/nb01EmgrPhase0.py b/Scripts/Python/nb01EmgrPhase0.py new file mode 100644 index 0000000000..4f0f7b9030 --- /dev/null +++ b/Scripts/Python/nb01EmgrPhase0.py @@ -0,0 +1,333 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +from Plasma import * +from PlasmaTypes import * +import random + +# These are helper functions for the special state variables that need custom code. +def Ayhoheek5Man1State(VARname, NewSDLValue): + PtDebugPrint("nb01EmgrPhase0.Ayhoheek5Man1State(): Attempting to set '{}' to a value of {}".format(VARname, NewSDLValue)) + + nb01Ayhoheek5Man1StateMaxINT = 2 + + if NewSDLValue > nb01Ayhoheek5Man1StateMaxINT: + PtDebugPrint("ERROR: nb01EmgrPhase0.Ayhoheek5Man1State:\tERROR: Variable '{}'' expected range from 0-{}. Received value of {}.".format(VARname, nb01Ayhoheek5Man1StateMaxINT, NewSDLValue)) + return + + elif NewSDLValue == 0: + PtDebugPrint("DEBUG: nb01EmgrPhase0.Ayhoheek5Man1State:\tPaging out 5 Man Heek table completely.") + PtPageOutNode("nb01Ayhoheek5Man1State") + PtPageOutNode("nb01Ayhoheek5Man1Dead") + + elif NewSDLValue == 1: + PtDebugPrint("DEBUG: nb01EmgrPhase0.Ayhoheek5Man1State:\tPaging in broken 5 Man Heek table.") + PtPageInNode("nb01Ayhoheek5Man1Dead") + PtPageOutNode("nb01Ayhoheek5Man1State") + + elif NewSDLValue == 2: + PtDebugPrint("DEBUG: nb01EmgrPhase0.Ayhoheek5Man1State:\tPaging in functional 5 Man Heek table.") + PtPageInNode("nb01Ayhoheek5Man1State") + PtPageOutNode("nb01Ayhoheek5Man1Dead") + + else: + PtDebugPrint("ERROR: nb01EmgrPhase0.Ayhoheek5Man1State:\tERROR: Invalid value ({}) for variable '{}'.".format(NewSDLValue, VARname)) + return + + +class nb01EmgrPhase0(ptResponder): + + # State options for Neighborhood decoration randomization + HoodDecorations = { + "nb01ClockVis": (0, 1), + "nb01GardenFungusVis": (0, 1), + "nb01DestructionCracksVis": (0, 1), + "nb01LanternsVis": (0, 1), + "nb01LampOption01Vis": (0, 1), + "nb01OldImager01Vis": (0, 1), + "nb01OldImager02Vis": (0, 1), + "nb01WaterfallTorchesVis": (0, 1), + "nb01ResidenceAdditionsVis": (0, 1), + "nb01StainedWindowOption": (0, 1, 2) + } + + # These booleans will page in/out the page sharing their name. + SimplePagingVars = [ + "nb01LinkBookGarrisonVis", + ] + + # This maps a state variable to a helper function which + # will be called on updates to that variable. + # Calling convention is func(varName, newValue) + SpecialPagingVars = { + 'nb01Ayhoheek5Man1State': Ayhoheek5Man1State, + } + + # Link Room Pedestal randomization options + Pedestals = { + "Left": { + # ---- + #"sdlState": "nb01LinkBookGarrisonVis", + #"sdlGlass": "nb01StainedWindowOption", + #"Books" : { + # 1: {"Name": "Gahreesen", "Glasses": (1, 2)}, + #} + # ---- + # The Gahreesen Stained Glass doesn't observe the proper on/off rules + # So we won't try to regulate the Left position + }, + "Center": { + "sdlState": "nb01LinkBookEderToggle", + "sdlGlass": "nb01StainedGlassEders", + "Books" : { + #1: Kemo -- deprecated + 2: {"Name": "EderDelin", "Glasses": (1, 2, 3)}, + 3: {"Name": "EderTsogal", "Glasses": (4, 5, 6)}, + } + }, + "Right": { + "sdlState": "nb01LinkBookGZVis", + "sdlGlass": "nb01StainedGlassGZ", + "Books" : { + 1: {"Name": "GreatZero", "Glasses": (1, 2, 3)}, + } + } + } + + def __init__(self): + ptResponder.__init__(self) + random.seed() + self.id = 5222 + + self.version = 7 + PtDebugPrint("__init__nb01EmgrPhase0 v.{}".format(self.version)) + + self.PedestalSDL = [] + self._pedestalSDLValues = {} + self._ageVault = None + self._updateAgeSDL = False + + # Store these in a list for convenience + for position in self.Pedestals: + if self.Pedestals[position]: + self.PedestalSDL.append(self.Pedestals[position]["sdlState"]) + self.PedestalSDL.append(self.Pedestals[position]["sdlGlass"]) + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + if not ageSDL: + PtDebugPrint("nb01EmgrPhase0.OnServerInitComplete:\tNo ageSDL. We're done here.") + return + + for sdlVar in self.PedestalSDL: + ageSDL.setFlags(sdlVar, 1, 1) + ageSDL.sendToClients(sdlVar) + ageSDL.setNotify(self.key, sdlVar, 0.0) + self._pedestalSDLValues[sdlVar] = ageSDL[sdlVar][0] + PtDebugPrint("nb01EmgrPhase0.OnServerInitComplete(): Pedestal SDL variable {} = {}".format(sdlVar, self._pedestalSDLValues[sdlVar])) + + for sdlVar in self.SimplePagingVars: + ageSDL.setFlags(sdlVar, 1, 1) + ageSDL.sendToClients(sdlVar) + ageSDL.setNotify(self.key, sdlVar, 0.0) + self.IManageSimplePagingVar(sdlVar) + + for sdlVar in self.SpecialPagingVars: + ageSDL.setFlags(sdlVar, 1, 1) + ageSDL.sendToClients(sdlVar) + ageSDL.setNotify(self.key, sdlVar, 0.0) + self.SpecialPagingVars[sdlVar](sdlVar, ageSDL[sdlVar][0]) + + # Set up the linking room pedestals. + if self.sceneobject.isLocallyOwned(): + PtDebugPrint("nb01EmgrPhase0.OnServerInitComplete(): Check all pedestal books and stained glasses for sanity.") + for position in self.Pedestals: + if self.Pedestals[position]: + self.IManageLinkPedestal(position) + + # Age State Randomization + # This used to be in the Nexus, but that would never affect server-generated hoods + if self.sceneobject.isLocallyOwned(): + self._RandomizeNeighborhood() + + # Save the AgeVaultSDL if we need to... + self._SaveSDL() + + def OnSDLNotify(self, VARname, SDLname, PlayerID, tag): + ageSDL = PtGetAgeSDL() + PtDebugPrint("nb01EmgrPhase0.OnSDLNotify():\tVARname: {}, SDLname: {}, tag: {}, value: {}".format(VARname, SDLname, tag, ageSDL[VARname][0])) + + if VARname in self.SimplePagingVars: + self.IManageSimplePagingVar(VARname) + + elif VARname in self.SpecialPagingVars.viewkeys(): + NewSDLValue = ageSDL[VARname][0] + self.SpecialPagingVars[VARname](VARname, NewSDLValue) + + elif VARname in self.PedestalSDL: + self._pedestalSDLValues[VARname] = ageSDL[VARname][0] + PtDebugPrint("nb01EmgrPhase0.OnSDLNotify():\t{} = {}".format(VARname, self._pedestalSDLValues[VARname])) + + else: + PtDebugPrint("ERROR: nb01EmgrPhase0.OnSDLNotify():\tVariable '{}' was not recognized.".format(VARname)) + return + + def IManageLinkPedestal(self, position): + """Manage Pedestal link books and stained glass""" + PtDebugPrint("nb01EmgrPhase0.IManageLinkPedestal(): PedestalPosition = {}".format(position)) + if position in self.Pedestals: + pedInfo = self.Pedestals[position] + state = self._pedestalSDLValues[pedInfo["sdlState"]] + if state: + if state in pedInfo["Books"]: + # We have this book... + book = pedInfo["Books"][state] + if self._pedestalSDLValues[pedInfo["sdlGlass"]] not in book["Glasses"]: + # ...but the glass is wrong. + self.IPickPedestalGlass(position, book) + else: + # This is not a valid book for this pedestal. Get a new one. + self.IPickPedestalBook(position) + else: + # No book, clear the glass if it's set. + self.IPickPedestalGlass(position, 0) + else: + PtDebugPrint("nb01EmgrPhase0.IManageLinkPedestal(): No pedestal named '{}'. Ignoring.".format(position)) + + def IPickPedestalBook(self, position): + if position in self.Pedestals: + # Select a random book from this pedestal's list. + newBookChoice = random.choice(list(self.Pedestals[position]["Books"].keys())) + self._UpdateVaultSDL(self.Pedestals[position]["sdlState"], newBookChoice) + + newBook = self.Pedestals[position]["Books"][newBookChoice] + PtDebugPrint("nb01EmgrPhase0.IPickPedestalBook():\tSelecting {} as new book for pedestal.".format(newBook["Name"])) + + # Update the stained glass to match. + self.IPickPedestalGlass(position, newBook) + else: + PtDebugPrint("nb01EmgrPhase0.IPickPedestalBook(): No pedestal named '{}'. Ignoring.".format(position)) + + def IPickPedestalGlass(self, position, bookInfo): + if position in self.Pedestals: + newGlass = 0 + if bookInfo: + # Select a random glass from this book's list. + newGlass = bookInfo["Glasses"][random.randint(0, len(bookInfo["Glasses"]) - 1)] + PtDebugPrint("nb01EmgrPhase0.IPickPedestalGlass():\tSelecting stained glass #{} to match book for {}.".format(newGlass, bookInfo["Name"])) + else: + PtDebugPrint("nb01EmgrPhase0.IPickPedestalGlass():\tNo book. Clearing stained glass.") + self._UpdateVaultSDL(self.Pedestals[position]["sdlGlass"], newGlass) + else: + PtDebugPrint("nb01EmgrPhase0.IPickPedestalGlass(): No pedestal named '{}'. Ignoring.".format(position)) + + def _SaveSDL(self): + if self._updateAgeSDL: + self._ageVault.updateAgeSDL(self._ageSDL) + del self._ageSDL + self._updateAgeSDL = False + + def _UpdateSimpleStateVar(self, ageSDL, sdlName, value, overwrite=True): + if isinstance(ageSDL, ptSDLStateDataRecord): + var = ageSDL.findVar(sdlName) + if var is None: + PtDebugPrint("nb01EmgrPhase0._UpdateSimpleStateVar(): '{}' not found!".format(sdlName)) + return + elif isinstance(ageSDL, ptSimpleStateVariable): + var = ageSDL + else: + raise TypeError("ageSDL must be a ptSDLStateDataRecord or a ptSimpleStateVariable") + + if not overwrite and var.isUsed(): + PtDebugPrint("nb01EmgrPhase0._UpdateSimpleStateVar(): Skipping update of '{}'".format(sdlName), level=kDebugDumpLevel) + return + + if var.getType() == PtSDLVarType.kBool: + var.setBool(value) + elif var.getType() in (PtSDLVarType.kInt, PtSDLVarType.kByte): + var.setInt(value) + elif var.getType() == PtSDLVarType.kString32: + var.setString(value) + else: + PtDebugPrint("nb01EmgrPhase0._UpdateSimpleStateVar(): '{}' has an unknown type!".format(sdlName)) + return + PtDebugPrint("nb01EmgrPhase0._UpdateSimpleStateVar(): '{}' = {}".format(sdlName, value)) + self._updateAgeSDL = True + + def _UpdateVaultSDL(self, sdlVar, value, overwrite=True): + if not self._ageVault: + self._ageVault = ptAgeVault() + if not self._ageVault: + PtDebugPrint("nb01EmgrPhase0._UpdateVaultSDL():\tNo AgeVault?!") + return + self._ageSDL = self._ageVault.getAgeSDL() + if not self._ageSDL: + PtDebugPrint("nb01EmgrPhase0._UpdateVaultSDL():\tVaultSDL is null?!") + return + + if sdlVar and value: + self._UpdateSimpleStateVar(self._ageSDL, sdlVar, value, overwrite) + + def _RandomizeNeighborhood(self): + """Does initial state scrambling for the Neighborhood. + This makes all hoods have a slightly different appearance (hopefully)""" + PtDebugPrint("nb01EmgrPhase0._RandomizeNeighborhood(): ---Attempting to Randomize SDL---") + for name, values in self.HoodDecorations.iteritems(): + self._UpdateVaultSDL(name, random.choice(values), overwrite=False) + PtDebugPrint("nb01EmgrPhase0._RandomizeNeighborhood(): ---SDL Randomized!---") + + def IManageSimplePagingVar(self, VARname): + """Load or unload a page based on the value of the specified SDL""" + ageSDL = PtGetAgeSDL() + try: + if ageSDL[VARname][0] == 1: # Are we paging things in? + PtDebugPrint("DEBUG: nb01EmgrPhase0.IManageSimplePagingVar:\tPaging in {}".format(VARname)) + PtPageInNode(VARname) + elif ageSDL[VARname][0] == 0: # Are we paging things out? + PtDebugPrint("DEBUG: nb01EmgrPhase0.IManageSimplePagingVar:\tPaging out {}".format(VARname)) + PtPageOutNode(VARname) + else: + PtDebugPrint("ERROR: nb01EmgrPhase0.IManageSimplePagingVar:\tVariable '{}' had unexpected value of {} (should be a boolean).".format(VARname, ageSDL[VARname][0])) + except: + PtDebugPrint("ERROR: nb01EmgrPhase0.IManageSimplePagingVar:\tError managing variable '{}'".format(VARname)) + return diff --git a/Scripts/Python/nb01RPSGame.py b/Scripts/Python/nb01RPSGame.py new file mode 100644 index 0000000000..f8be57cf3a --- /dev/null +++ b/Scripts/Python/nb01RPSGame.py @@ -0,0 +1,972 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ + +from Plasma import * +from PlasmaConstants import * +from PlasmaKITypes import * +from PlasmaTypes import * + +# detectors +detButtonRock = ptAttribActivatorList(1, "Rock ButtonClick det", netForce=True) +detButtonPaper = ptAttribActivatorList(2, "Paper ButtonClick det", netForce=True) +detButtonScissors = ptAttribActivatorList(3, "Scissors ButtonClick det", netForce=True) + +detSitting0 = ptAttribActivator(50, "Player1 Sit det", netForce=True) +detSitting1 = ptAttribActivator(51, "Player2 Sit det", netForce=True) +detSitting2 = ptAttribActivator(52, "Player3 Sit det", netForce=True) +detSitting3 = ptAttribActivator(53, "Player4 Sit det", netForce=True) +detSitting4 = ptAttribActivator(54, "Player5 Sit det", netForce=True) + +# Player 1 responders +respRock0 = ptAttribResponder(70, "Rock1 round win/lose resp", ['lose','win'], netForce=True) +respPaper0 = ptAttribResponder(71, "Paper1 round win/lose resp", ['lose','win'], netForce=True) +respScissors0 = ptAttribResponder(72, "Scissors1 round win/lose resp", ['lose','win'], netForce=True) + +# Player 2 responders +respRock1 = ptAttribResponder(90, "Rock2 round win/lose resp", ['lose','win'], netForce=True) +respPaper1 = ptAttribResponder(91, "Paper2 round win/lose resp", ['lose','win'], netForce=True) +respScissors1 = ptAttribResponder(92, "Scissors2 round win/lose resp", ['lose','win'], netForce=True) + +# Player 3 responders +respRock2 = ptAttribResponder(110, "Rock3 round win/lose resp", ['lose','win'], netForce=True) +respPaper2 = ptAttribResponder(111, "Paper3 round win/lose resp", ['lose','win'], netForce=True) +respScissors2 = ptAttribResponder(112, "Scissors3 round win/lose resp", ['lose','win'], netForce=True) + +# Player 4 responders +respRock3 = ptAttribResponder(130, "Rock4 round win/lose resp", ['lose','win'], netForce=True) +respPaper3 = ptAttribResponder(131, "Paper4 round win/lose resp", ['lose','win'], netForce=True) +respScissors3 = ptAttribResponder(132, "Scissors4 round win/lose resp", ['lose','win'], netForce=True) + +# Player 5 responders +respRock4 = ptAttribResponder(150, "Rock5 round win/lose resp", ['lose','win'], netForce=True) +respPaper4 = ptAttribResponder(151, "Paper5 round win/lose resp", ['lose','win'], netForce=True) +respScissors4 = ptAttribResponder(152, "Scissors5 round win/lose resp", ['lose','win'], netForce=True) + +# Standing cam responder +respStandCam = ptAttribResponder(170, "Standing cam resp", ['0','1','2','3','4'], netForce=True) + +# This is the main display responder... +GAME_WIN_STATES = ['rock', 'paper', 'scissors', 'stop'] +respCountdown = ptAttribResponder(180, "Countdown Responder", ['countdown','stop','attractmode'], netForce=True) +respGame = ptAttribResponder(73, "Game win/lose resp", GAME_WIN_STATES, netForce=True) + +lightAnimsOn = ptAttribAnimation(200, "lights", byObject=True, netForce=True) +clamshellAnim = ptAttribAnimation(201, "clamshells", byObject=True) + +# init +initTable = ptAttribResponder(202, "Init table responder") + +# cameras +camera0 = ptAttribSceneobject(203, "seat 1 camera") +camera1 = ptAttribSceneobject(204, "seat 2 camera") +camera2 = ptAttribSceneobject(205, "seat 3 camera") +camera3 = ptAttribSceneobject(206, "seat 4 camera") +camera4 = ptAttribSceneobject(207, "seat 5 camera") + +# seat clickables (so we can disable them while someone is sitting on them) +seatButton0 = ptAttribActivator(210, "Seat 1 clickable") +seatButton1 = ptAttribActivator(211, "Seat 2 clickable") +seatButton2 = ptAttribActivator(212, "Seat 3 clickable") +seatButton3 = ptAttribActivator(213, "Seat 4 clickable") +seatButton4 = ptAttribActivator(214, "Seat 5 clickable") + +# light sounds (for win and turn on animations) +respSeat0Sounds = ptAttribResponder(220, "Seat 1 sound resp", ['on','win'], netForce=True) +respSeat1Sounds = ptAttribResponder(221, "Seat 2 sound resp", ['on','win'], netForce=True) +respSeat2Sounds = ptAttribResponder(222, "Seat 3 sound resp", ['on','win'], netForce=True) +respSeat3Sounds = ptAttribResponder(223, "Seat 4 sound resp", ['on','win'], netForce=True) +respSeat4Sounds = ptAttribResponder(224, "Seat 5 sound resp", ['on','win'], netForce=True) + +# SDL Variable Konstants +SDL_PLAYERS = "intSDLPlayers" +SDL_GAME_STATE = "intSDLState" + +SDL_ROCKS = "intSDLPlayerNumRocks" +SDL_PAPERS = "intSDLPlayerNumPaper" +SDL_SCISSORS = "intSDLPlayerNumScissors" +SDL_CUR_SELECTION = "intSDLPlayerCurSelection" +SDL_WINNING_SELECTION = "intSDLGameWinner" + +NUM_SEATS = 5 + +# Game States (logic) +GAME_ATTRACT_PLAYERS = 0 +GAME_AWAIT_MOVES = 1 +GAME_MOVE_COUNTDOWN = 2 +GAME_SHOW_MOVES = 3 + +# Selections +SEL_NONE = 0 +SEL_ROCK = 1 # Beetle +SEL_PAPER = 2 # Book +SEL_SCISSORS = 3 # Pen +SEL_NUM = 4 + +# Potential win/lose states +ROUND_SCORES = { + SEL_ROCK: { + SEL_SCISSORS: 1, + SEL_NONE: 0, + SEL_ROCK: 0, + SEL_PAPER: -1, + }, + SEL_PAPER: { + SEL_ROCK: 1, + SEL_NONE: 0, + SEL_PAPER: 0, + SEL_SCISSORS: -1, + }, + SEL_SCISSORS: { + SEL_PAPER: 1, + SEL_NONE: 0, + SEL_SCISSORS: 0, + SEL_ROCK: -1, + }, +} + +# Selection to round score +SCORE_VAR = { + SEL_ROCK: SDL_ROCKS, + SEL_PAPER: SDL_PAPERS, + SEL_SCISSORS: SDL_SCISSORS, +} + +# The name of our Heek Score +SCORE_NAME = "HeekPoints" +SCORE_DEFAULT = 100 # we track wins as points +SCORE_TYPE = PtGameScoreTypes.kAccumulative +SCORE_OP_NONE = 0 +SCORE_OP_MINE = 1 +SCORE_OP_HIGH = 2 + +# Imager Note Schtuff +# Unfortunately, there is no translation :( +IMAGER_NAME = "D'ni Imager Right" # [sic] +IMAGER_NOTE_TITLE = "Neighborhood Heek Scores" +IMAGER_NOTE_PREFIX = "Top 10 Heek Players:\n" +MAX_NUM_HIGH_SCORES = 10 + +# Python Notifications +NOTIFY_HELLO = 0 +NOTIFY_JOINLEAVE = 1 +NOTIFY_SCORE_UPDATE = 2 + +# Rank stuff +RANK_UP = 100 + +# Delay leaderboard generation in the case of slow tail clients +LEADERBOARD_TIME = 5.0 +CB_LEADERBOARD = 0 + +# Ugh. This is the time at which the clamshell anims are "open" +CLAMSHELL_OPEN = 25.0 / 30.0 # 25 frames + +# Even more animation crap +LIGHT_FLASH_START = 10.0 +LIGHT_FLASH_END = 25.0 +LIGHT_ON_START = 0.0 +LIGHT_ON_END = 10.0 + + +class nb01RPSGame(ptResponder, object): + """NG Ayoheek game logic. This uses normal Plasma facilities, such as SDL instead of the Game Mgr.""" + + def _get_game_state(self): + try: + return self.SDL[SDL_GAME_STATE][0] + except IndexError: + return GAME_ATTRACT_PLAYERS + def _set_game_state(self, value): + self.SDL[SDL_GAME_STATE] = (value,) + game_state = property(_get_game_state, _set_game_state) + + @property + def num_players(self): + """Gets the number of folks playing the game.""" + unique = set(self.SDL[SDL_PLAYERS]) - {0} + return len(unique) + + @property + def players(self): + """Gets the folks playing the game.""" + return self.SDL[SDL_PLAYERS] + + @property + def playing(self): + """Gets if we are sitting at the table with a KI.""" + return PtGetLocalClientID() in self.SDL[SDL_PLAYERS] + + @property + def points(self): + """Gets our current Heek score""" + if self._score is None: + return SCORE_DEFAULT + else: + return max(0, self._score.getPoints()) + + @property + def seat_id(self): + """Gets my seat ID or raise a ValueError""" + return self.SDL[SDL_PLAYERS].index(PtGetLocalClientID()) + + @property + def seats_playing(self): + """Gets a sequence of seats that are playing the game""" + return (i for i, ki in enumerate(self.players) if ki != 0) + + @property + def selections(self): + """Gets a sequence of tuples (seat, selection)""" + return ((i, selection) for i, selection in enumerate(self.SDL[SDL_CUR_SELECTION])) + + def _get_winning_selection(self): + return self.SDL[SDL_WINNING_SELECTION][0] + def _set_winning_selection(self, value): + self.SDL[SDL_WINNING_SELECTION] = (value,) + winning_selection = property(_get_winning_selection, _set_winning_selection) + +######### + def __init__(self): + super(nb01RPSGame, self).__init__() + self.id = 20000 + self.version = 10 + PtDebugPrint("nb01RPSGame.__init__():\tversion={}".format(self.version), level=kDebugDumpLevel) + + # This holds my Heek score. This prevents server-spamming. + self._score = None # will get it from a CB + + # Because I designed the game score retrieval in a sucky way + self._wantHighScores = False + self._wantMyScore = False + self._waitingOnScoreOp = SCORE_OP_NONE + + # Are the game buttons enabled or disabled? + self._buttons_enabled = False + + # Have we played any rounds in the current game? + self._round_played = False + + # These are manual (variable event) notify handlers. + self._event_handlers = { + NOTIFY_HELLO: self._OnHello, + NOTIFY_JOINLEAVE: self._OnJoinLeave, + NOTIFY_SCORE_UPDATE: self._OnGameOver, + } + + # These get called when an SDL variable touches itself. + self._sdl_cbs = { + SDL_GAME_STATE: self._AdvanceGame, + SDL_PLAYERS: self._IsTheGameAfoot, + } + + def OnServerInitComplete(self): + # Notification/logic helpers + self._MakeAttribHelpers() + initTable.run(self.key) + + # Request my score. It's OK if it doesn't exist yet. We'll create it when I finish a game + self._RequestGameScore(mine=True) + + # Subscribe to SDL changes + def notify_me(sdl, key): + sdl.sendToClients(key) + sdl.setFlags(key, True, True) + sdl.setNotify(self.key, key, 0.0) + notify_me(self.SDL, SDL_GAME_STATE) + notify_me(self.SDL, SDL_PLAYERS) + + # If we don't skip the ownership check, folks will be wondering why their clicks do nothing... + self.SDL.setFlags(SDL_CUR_SELECTION, True, True) + self.SDL.setFlags(SDL_WINNING_SELECTION, True, True) + + # Make sure we start out sane + if not PtGetPlayerList(): + self._KillEverything() + self.SDL[SDL_PLAYERS] = tuple([0] * NUM_SEATS) + self.game_state = GAME_ATTRACT_PLAYERS + else: + self._FFwdLights(SDL_ROCKS, SEL_ROCK) + self._FFwdLights(SDL_PAPERS, SEL_PAPER) + self._FFwdLights(SDL_SCISSORS, SEL_SCISSORS) + for seat in self.seats_playing: + self._seats[seat].disable() + if self.game_state != GAME_ATTRACT_PLAYERS: + for seat in self.seats_playing: + self._ChangeButtonState(seat, ff=True) + respCountdown.run(self.key, "stop", fastforward=True) + +######### + def OnAvatarPage(self, avatar, loading, lastOut): + if lastOut or loading: + return + + if self.sceneobject.isLocallyOwned(): + kinum = PtGetClientIDFromAvatarKey(avatar.getKey()) + try: + seat = self.players.index(kinum) + except ValueError: + return + PtDebugPrint("nb01RPSGame.OnAvatarPage():\tPlayer #{} is leaving during the game!".format(kinum), level=kWarningLevel) + self._CleanupPosition(seat) + self.SDL.setIndex(SDL_PLAYERS, seat, 0) + + def OnGameScoreMsg(self, msg): + if isinstance(msg, ptGameScoreListMsg): + try: + scores = msg.getScores() + except: + scores = None + + if self._waitingOnScoreOp == SCORE_OP_MINE: + if scores: + self._GotMyScore(scores[0]) + self._wantMyScore = False + elif self._waitingOnScoreOp == SCORE_OP_HIGH: + if scores: + self._GotHoodHeekScores(scores) + else: + PtDebugPrint("nb01RPSGame.OnGameScoreMsg():\tProblem fetching leaderboard") + self._wantHighScores = False + else: + raise RuntimeError("Invalid score operation: {}".format(self._waitingOnScoreOp)) + self._waitingOnScoreOp = SCORE_OP_NONE + self._RequestGameScore() + elif isinstance(msg, ptGameScoreUpdateMsg): + self._GotMyScore(msg.getScore()) + + def OnSDLNotify(self, VARname, SDLname, playerID, tag): + if VARname in self._sdl_cbs: + self._sdl_cbs[VARname](playerID) + else: + raise RuntimeError("Got an SDL notify for {}, but no CB".format(VARname)) + + def OnNotify(self, state, id, events): + """Handle Plasma Notification Messages""" + + # Clicked on the chair or clicked to get up. + if self._HandleNotify(state, id, events, self._seats, self._OnWantToSit): + return + + # Finished sitting down. + if self._HandleNotify(state, id, events, self._sitting, self._OnSitDown): + return + + # A rock/paper/sics button was mashed + if self._HandleNotify(state, id, events, self._buttons, self._OnRPSChoice): + return + + # The countdown ended. It's time to do stuff... + if id == respCountdown.id and self.game_state == GAME_MOVE_COUNTDOWN: + if self.sceneobject.isLocallyOwned(): + respCountdown.run(self.key, "stop") + self.game_state = GAME_SHOW_MOVES + return + + # The choice animation finished... Time to reenable the junk. + if self._HandleNotify(state, id, events, self._allBoardResps, self._OnChoiceAnimFinished): + return + + # Done spinning the victory. Let them rematch... + if id == respGame.id: + if self.sceneobject.isLocallyOwned(): + self.game_state = GAME_AWAIT_MOVES + self._KillEverything() + return + + # If we got here, then this might be a variable event. Let's proc those. + if events: + if self._HandleVariableNotify(events): + return + + def OnTimer(self, id): + if id == CB_LEADERBOARD and self.sceneobject.isLocallyOwned(): + self._UpdateImager() + + +######### + def _OnWantToSit(self, state, seat, events): + """Someone wants to sit down""" + self._seats[seat].disable() + + def _OnSitDown(self, state, seat, events): + """We have started the sit/stand animation.""" + + # Adjust the cutscene camera as appropriate + if PtWasLocallyNotified(self.key): + if state: + self._cameras[seat].value.pushCutsceneCamera(1, PtGetLocalAvatar().getKey()) + else: + self._cameras[seat].value.popCutsceneCamera(PtGetLocalAvatar().getKey()) + + # Manage game state if standing up + if state: + if PtWasLocallyNotified(self.key): + PtSendKIMessage(kDisableEntireYeeshaBook, 0) + self._JoinTheGame(seat) + else: + self._seats[seat].enable() + if PtWasLocallyNotified(self.key): + respStandCam.run(self.key, str(seat)) + PtSendKIMessage(kEnableEntireYeeshaBook, 0) + self._LeaveTheGame(seat) + + def _OnRPSChoice(self, state, which, events): + """We picked a thingo!""" + if PtWasLocallyNotified(self.key): + self._round_played = True + if self.sceneobject.isLocallyOwned(): + avatar = PtFindAvatar(events) + seat = self.players.index(PtGetClientIDFromAvatarKey(avatar.getKey())) + self.SDL.setIndex(SDL_CUR_SELECTION, seat, which + 1) + # Waiting on moves? You just got one. COUNTDOWN! + if self.game_state == GAME_AWAIT_MOVES: + self.game_state = GAME_MOVE_COUNTDOWN + + def _OnChoiceAnimFinished(self, state, which, events): + """The choice animation completed. It's time to proceed...""" + if self.sceneobject.isLocallyOwned(): + if self.winning_selection == SEL_NONE: + self.game_state = GAME_AWAIT_MOVES + else: + respGame.run(self.key, GAME_WIN_STATES[self.winning_selection - 1]) + + +######### + def _AdvanceGame(self, playerID): + """Handles game state changes.""" + + # Synchronize the clamshell state + enable_buttons = self.game_state in (GAME_AWAIT_MOVES, GAME_MOVE_COUNTDOWN) + if self._buttons_enabled != enable_buttons: + for i in self.seats_playing: + self._ChangeButtonState(i, enable_buttons) + self._buttons_enabled = enable_buttons + + # From henceforth, the game master is the only one who does anything + if not self.sceneobject.isLocallyOwned(): + return + + # Not enough players? Bail. This is not valid anymore... + elif not self.num_players > 1: + return + + # If we're waiting for moves, show the attract loop because it flashes once someone starts + # the actual countdown + if self.game_state == GAME_AWAIT_MOVES: + respCountdown.run(self.key, "attractmode") + + # Is it time to count down? + elif self.game_state == GAME_MOVE_COUNTDOWN: + respCountdown.run(self.key, "countdown") + + # Time to show da moves? + elif self.game_state == GAME_SHOW_MOVES: + self._FinishRound() + + def _FinishRound(self): + """Determine round winners and display the round selections""" + # Calculate round scores. Remember this can be 5 on 5, so special scoring abound... + scores = { i: 0 for i, selection in self.selections if selection != SEL_NONE } + for seat in scores: + my_selection = self.SDL[SDL_CUR_SELECTION][seat] + for their_selection in self.SDL[SDL_CUR_SELECTION]: + scores[seat] += ROUND_SCORES[my_selection][their_selection] + + # The highest scores are winners -- if it's over 0 + high_score = max(scores.itervalues()) + if high_score > 0: + winners = [seat for seat, score in scores.viewitems() if score == high_score] + game_winners = [] + else: + winners, game_winners = [], [] + + PtDebugPrint("nb01RPSGame._FinishRound():\tGetting ready to show moves...", level=kWarningLevel) + for seat, selection in self.selections: + if selection == SEL_NONE: + continue + + win = seat in winners + state = "win" if win else "lose" + PtDebugPrint("nb01RPSGame._FinishRound():\t- Position {}: {}".format(seat, state), level=kWarningLevel) + if win: + var = SCORE_VAR[selection] + old_score = self.SDL[var][seat] + new_score = old_score + high_score + won_game = new_score > 2 + if won_game: + game_winners.append(seat) + self.winning_selection = selection + self._UpdateScoreLights(seat, selection, old_score, new_score, win=won_game) + self.SDL.setIndex(var, seat, new_score) + self._boardResps[selection - 1][seat].run(self.key, state) + PtDebugPrint("nb01RPSGame._FinishRound():\tAnd that's it!", level=kWarningLevel) + + # To prevent weird issues, send out a notify spec'ing which seats won the game. Let them + # fool around with their scores... + if game_winners: + win_points = len(list(self.seats_playing)) - len(game_winners) + notify = { "type": NOTIFY_SCORE_UPDATE } + for seat, kinum in enumerate(self.players): + if kinum != 0: + notify[str(kinum)] = win_points if seat in game_winners else -1 + self._SendPyNotifyMsg(notify) + + # Done with that shit. Nuke the selections for sanity. + self.SDL[SDL_CUR_SELECTION] = tuple([0] * NUM_SEATS) + + def _IsTheGameAfoot(self, playerID): + """Detects how many players are at the table and starts/kills the game as appropriate.""" + players = self.num_players + PtDebugPrint("nb01RPSGame._IsTheGameAfoot():\tThere are now {} player(s)".format(players), level=kWarningLevel) + if players < 2: + # There's not enough players to continue playing, so we need to murder the game state. + self._round_played = False + self._KillEverything() + self.game_state = GAME_ATTRACT_PLAYERS + else: + # We have enough folks to begin playing. If we were previously in attract mode, it's + # time to enable the board. We'll do this per-player in their SDL callback. + if self.sceneobject.isLocallyOwned() and self.game_state == GAME_ATTRACT_PLAYERS: + self.game_state = GAME_AWAIT_MOVES + + +######### + def _CleanupPosition(self, seat): + self._seats[seat].enable() + if self.sceneobject.isLocallyOwned(): + self.SDL.setIndex(SDL_ROCKS, seat, 0) + self.SDL.setIndex(SDL_PAPERS, seat, 0) + self.SDL.setIndex(SDL_SCISSORS, seat, 0) + self.SDL.setIndex(SDL_CUR_SELECTION, seat, 0) + + for i in xrange(SEL_NUM): + self._ToggleScoreLight(seat, i, 0, off=True) + self._ToggleScoreLight(seat, i, 1, off=True) + + if self._buttons_enabled: + self._ChangeButtonState(seat, enable=False) + + def _FFwdLights(self, sdlvar, rps): + for i in xrange(NUM_SEATS): + if self.SDL[sdlvar]: + count = min(self.SDL[sdlvar][i], 2) + for j in xrange(count): + self._ToggleScoreLight(i, rps, j, ff=True) + + def _OnGameOver(self, **kwargs): + """The game is over--update our score""" + if not len(kwargs) > 1: + PtDebugPrint("nb01RPSGame._OnGameOver(): Received a suspicious game over message. Ignoring...") + return + + points = kwargs.get(str(PtGetLocalClientID()), None) + if points is not None: + PtDebugPrint("nb01RPSGame._OnGameOver():\tAdding {} points to our Heek score".format(points), level=kWarningLevel) + self._ChangeMyScore(points) + self._round_played = False + + def _GetRank(self, points): + if points == 0: + return 0 + rank = 1 + neededToRankUp = RANK_UP + while True: + neededToRankUp += rank * RANK_UP + if points <= neededToRankUp: + return rank + rank += 1 + + def _GotMyScore(self, score): + self._score = score + + # Clearly, something interesting happened. Update the imager. + if self.sceneobject.isLocallyOwned(): + PtAtTimeCallback(self.key, LEADERBOARD_TIME, CB_LEADERBOARD) + + # If we're playing the game we need to crow about the new score + if self.playing: + points = max(0, score.getPoints()) + loc = "Heek.Messages.Rank" if points == 1 else "Heek.Messages.RankPlural" + rank = self._GetRank(points) + self._SendLocalStatusMsg(PtGetLocalizedString(loc, [str(rank), str(points)])) + + def _JoinTheGame(self, seat): + """Joins the local player to the game""" + # To play heek, you need to have a KI from Gahreesen + if PtDetermineKILevel() > kMicroKI: + join = { + "type": NOTIFY_JOINLEAVE, + "join": 1, + "seat": seat, + "client": PtGetLocalClientID(), + } + self._SendPyNotifyMsg(join) + + if self.num_players == 0: + self._SendLocalStatusMsg(PtGetLocalizedString("Heek.Messages.SinglePlayerWarn")) + elif self.num_players > 1 and self.game_state != GAME_ATTRACT_PLAYERS: + self._ChangeButtonState(seat, force=True) + hello = { + "type": NOTIFY_HELLO, + "client": PtGetLocalClientID(), + "points": self.points, + } + self._SendPyNotifyMsg(hello) + else: + self._SendLocalStatusMsg(PtGetLocalizedString("Heek.Messages.NoKI")) + + def _KillEverything(self): + """Resets the game state to the beginning. Note that we do not touch the game mode.""" + self._NukeLights() + + if self.sceneobject.isLocallyOwned(): + respCountdown.run(self.key, "attractmode") + self.winning_selection = SEL_NONE + + def reset_sdl(sdl, name): + """Resets a player/seat SDL value to zero.""" + sdl[name] = tuple([0] * NUM_SEATS) + reset_sdl(self.SDL, SDL_ROCKS) + reset_sdl(self.SDL, SDL_PAPERS) + reset_sdl(self.SDL, SDL_SCISSORS) + reset_sdl(self.SDL, SDL_CUR_SELECTION) + + def _LeaveTheGame(self, seat): + # To play heek, you need to have a KI from Gahreesen + if PtDetermineKILevel() > kMicroKI: + notify = { + "type": NOTIFY_JOINLEAVE, + "join": 0, + "seat": seat, + "client": PtGetLocalClientID(), + } + self._SendPyNotifyMsg(notify) + + # If we're actively playing, and we left before game over, then we deduct a point. + if self.num_players > 1 and self._round_played: + PtDebugPrint("nb01RPSGame._LeaveTheGame():\tYou lose because you gave up!") + self._ChangeMyScore(-1) + self._round_played = False + + def _OnHello(self, client, points): + """We have a new player joining us!""" + + if self.playing: + loc = "Heek.Messages.Welcome" if points == 1 else "Heek.Messages.WelcomePlural" + rank = self._GetRank(points) + player = PtGetClientName(PtGetAvatarKeyFromClientID(client)) + self._SendLocalStatusMsg(PtGetLocalizedString(loc, [player, str(rank), str(points)])) + + def _OnJoinLeave(self, seat, client, join): + """Synchronizes access to the players SDL variable""" + if self.sceneobject.isLocallyOwned(): + value = client if join else 0 + self.SDL.setIndex(SDL_PLAYERS, seat, value) + + if not join: + self._CleanupPosition(seat) + + def _SendLocalStatusMsg(self, msg): + """Sends a status chat message (purple text) to the local player's KI.""" + PtSendKIMessage(kKILocalChatStatusMsg, msg) + + +######### + def _ChangeButtonState(self, seat, enable=True, ff=False, force=False): + clamshell = self._shutters[seat] + if enable: + begin, end = 0.0, CLAMSHELL_OPEN + dCall = "enable" + else: + begin, end = CLAMSHELL_OPEN, 0.0 + dCall = "disable" + + # Beware the cleverness! + for anim in clamshell: + if ff: + anim.skipToTime(end) + else: + anim.playRange(begin, end) + if (self.playing and seat == self.seat_id) or force: + for button in self._buttons: + getattr(button.value[seat], dCall)() + + def _NukeLights(self): + for i in self._lights: + for j in i: + for k in j: + k.playRange(0.0, 0.0) + + def _ToggleScoreLight(self, seat, selection, light, win=False, off=False, ff=False): + if win: + start, end = LIGHT_FLASH_START, LIGHT_FLASH_END + elif off: + start, end = LIGHT_ON_START, LIGHT_ON_START + else: + start, end = LIGHT_ON_START, LIGHT_ON_END + if ff: + self._lights[seat][selection - 1][light].playRange(end, end) + else: + self._lights[seat][selection - 1][light].playRange(start, end) + + def _UpdateScoreLights(self, seat, selection, old_score, new_score, win): + PtDebugPrint("nb01RPSGame._UpdateScoreLights():\tOld: {}, New: {}".format(old_score, new_score), level=kWarningLevel) + start = 0 if win else min(2, old_score) + end = min(2, new_score) + for i in xrange(start, end): + self._ToggleScoreLight(seat, selection, i, win=win) + + state = "win" if win else "on" + self._sounds[seat].run(self.key, state) + + +######### + def _ChangeMyScore(self, points): + if self._score is None: + ptGameScore.createPlayerScore(SCORE_NAME, SCORE_TYPE, SCORE_DEFAULT + points, self.key) + else: + self._score.addPoints(points, self.key) + + def _FixupScores(self, scores): + """There can actually be multiple scores of the same name for one player. I blame eap.""" + score_dict = {} + for score in scores: + owner = score.getOwnerID() + try: + score_dict[owner] += score.getPoints() + except LookupError: + score_dict[owner] = score.getPoints() + return score_dict + + def _FindCreateHeekScoreNote(self): + vault = ptAgeVault() + if vault is None: + PtDebugPrint("nb01RPSGame._FindCreateHeekScoreNote():\tAin't got no age vault!") + return None + inbox = vault.getDeviceInbox(IMAGER_NAME) + if inbox is None: + # The age is probably initing. It's not a huge loss for us to not create this note yet. + return None + + for i in inbox.getChildNodeRefList(): + note = i.getChild().upcastToTextNoteNode() + if note is None: + continue + if note.getTitle() == IMAGER_NOTE_TITLE: + return note + else: + note = ptVaultTextNoteNode(0) + note.setTitle(IMAGER_NOTE_TITLE) + inbox.addNode(note) + return note + + def _GetPlayerNameFromPlayerInfoID(self, infoID): + """Use this if the player is an age owner, but may not be in the age atm""" + vault = ptAgeVault() + if vault is None: + PtDebugPrint("nb01RPSGame._GetPlayerNameFromPlayerInfoID():\tAin't got no age vault!") + return None + owners = vault.getAgeInfo().getAgeOwnersFolder() + + # REMEMBER: game scores use the player info ID. Therefore, we have to manually search through + # all of the child nodes + for i in owners.getChildNodeRefList(): + info = i.getChild().upcastToPlayerInfoNode() + if info is None: + continue + if infoID == info.getID(): + return info.playerGetName() + else: + PtDebugPrint("nb01RPSGame._GetPlayerNameFromPlayerInfoID():\tFailed to find PlayerInfo {}".format(infoID)) + return "" + + def _GotHoodHeekScores(self, scores): + if not scores: + PtDebugPrint("nb01RPSGame._GotHoodHeekScores():\tHmmm... No scores. Oh well.") + return + + note = self._FindCreateHeekScoreNote() + if note is not None: + text = IMAGER_NOTE_PREFIX + num = 1 + fixed_scores = self._FixupScores(scores) + for owner in sorted(fixed_scores, key=lambda x: fixed_scores[x], reverse=True): + owner_name = self._GetPlayerNameFromPlayerInfoID(owner) + if not owner_name: + continue + score = fixed_scores[owner] + if score < 1: + break + text += " {} - {} has {} points\n".format(num, owner_name, score) + num += 1 + if num > MAX_NUM_HIGH_SCORES: + break + note.setText(text) + note.save() + + def _RequestGameScore(self, mine=None, high=None): + if mine is not None: + self._wantMyScore = mine + if high is not None: + self._wantHighScores = high + + if self._wantMyScore: + if self._waitingOnScoreOp == SCORE_OP_NONE: + self._waitingOnScoreOp = SCORE_OP_MINE + ptGameScore.findPlayerScores(SCORE_NAME, self.key) + if self._wantHighScores: + if self._waitingOnScoreOp == SCORE_OP_NONE: + self._waitingOnScoreOp = SCORE_OP_HIGH + ptGameScore.findAgeHighScores(SCORE_NAME, MAX_NUM_HIGH_SCORES * 2, self.key) + + def _UpdateImager(self): + """Begins the process of updating the Top 10 Heek Scores thingy""" + self._RequestGameScore(high=True) + + +######### + def _MakeAttribHelpers(self): + # Let's make some tuples of logic objects. We'll use these to figure out which player did the deed. + self._sitting = self._MakeAttribTuple("detSitting") # you are done sitting down + + self._buttons = (detButtonRock, detButtonPaper, detButtonScissors) # offset -1 from the indices above + self._rocks = self._MakeAttribTuple("respRock") + self._papers = self._MakeAttribTuple("respPaper") + self._scissors = self._MakeAttribTuple("respScissors") + self._boardResps = (self._rocks, self._papers, self._scissors) + self._allBoardResps = self._rocks + self._papers + self._scissors + + self._cameras = self._MakeAttribTuple("camera") + self._seats = self._MakeAttribTuple("seatButton") # you clicked to sit down + self._sounds = self._MakeAttribTuple("respSeat", "Sounds") + + # These are the various shutters that we have to (ugh) manually animate. + self._shutters = self._MakeShutterAnimTuple(clamshellAnim) + + # And the terrible indicator lights + self._lights = self._MakeLightAnimTuple(lightAnimsOn) + + def _MakeAttribTuple(self, prefix, suffix=""): + """This dirty method makes a tuple of game logic attributes, given a prefix and an + optional suffix. + """ + temp = [None] * 5 + for i in xrange(len(temp)): + temp[i] = globals()["{}{}{}".format(prefix, i, suffix)] + return tuple(temp) + + def _MakeShutterAnimTuple(self, anim): + temp = [None] * 5 + for i in xrange(len(temp)): + seat_shutters = [None] * 3 + for j in xrange(len(seat_shutters)): + name = "buttonshutter{0}{1}".format(i+1, j+1) + seat_shutters[j] = anim.byObject[name] + temp[i] = tuple(seat_shutters) + return tuple(temp) + + def _MakeLightAnimTuple(self, anim): + temp = [] + for i in xrange(NUM_SEATS): + seat_categories = [] + cat_names = ('B', 'G', 'R') + for j in xrange(SEL_NUM - 1): + category = [] + for k in xrange(2): + light = (i + 1) * 10 + k + 1 + name = "GTdummy{}Glare{}".format(cat_names[j], light) + category.append(anim.byObject[name]) + seat_categories.append(category) + temp.append(seat_categories) + return tuple(temp) + + +######### + def _HandleNotify(self, state, id, events, attribs, call): + """If a notify is in attribs, fire off call with the state, seat ID, events""" + seat = self._WasAttribs(id, attribs) + if seat != -1: + call(bool(state), seat, events) + return True + else: + return False + + def _HandleVariableNotify(self, events): + if not events[0][0] == kVariableEvent: + # not what we want. go away... + return + + # let's make a kwargs dict + args = {} + for event in events: + args[event[1]] = event[3] + + # Now, let's fire it off! + type = args["type"] + del args["type"] + if type not in self._event_handlers: + PtDebugPrint("nb01RPSGame._HandleVariableNotify():\tPyEvent '{}' doesn't have a handler!".format(type)) + return False + try: + self._event_handlers[type](**args) + except TypeError: + PtDebugPrint("nb01RPSGame._HandleVariableNotify():\tPyEvent '{}' has bad kwargs".format(type)) + return True + + def _SendPyNotifyMsg(self, contents): + """Sends variable events to everyone. The contents will be unpacked as method arguments.""" + notify = ptNotify(self.key) + notify.clearReceivers() + notify.addReceiver(self.key) + notify.netForce(True) + notify.netPropagate(True) + notify.setActivate(True) + for key, value in contents.iteritems(): + notify.addVarNumber(key, value) + notify.send() # whoosh... off it goes + + def _WasAttribs(self, id, attribs): + for i in xrange(len(attribs)): + if attribs[i].id == id: + return i + return -1 diff --git a/Scripts/Python/nb01RegisterNexusLink.py b/Scripts/Python/nb01RegisterNexusLink.py new file mode 100644 index 0000000000..afb5f17e12 --- /dev/null +++ b/Scripts/Python/nb01RegisterNexusLink.py @@ -0,0 +1,173 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__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() + PtDebugPrint("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 hoodMgr is None: +# PtDebugPrint("nb01RegisterNexusLink:\thood manager type is None") +# return +# ageVault = ptAgeVault() +# if ageVault is None: +# PtDebugPrint("nb01RegisterNexusLink:\tage vault type is None") +# return +# hoodNode = ageVault.getNeighborhood() +# if hoodNode is 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 ageVault is not 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/Scripts/Python/nb01UpdateHoodInfoImager.py b/Scripts/Python/nb01UpdateHoodInfoImager.py new file mode 100644 index 0000000000..8dc519b497 --- /dev/null +++ b/Scripts/Python/nb01UpdateHoodInfoImager.py @@ -0,0 +1,302 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__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) + 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 IUpdatePublicHoodDate(self): + # The MOULa server sorts the public hood list by date last set public. + # We want to have it sorted by date last linked to, so that hoods that + # are in active use don't drop off the list. Since we can't modify the + # server we fake this by updating the 'set public' timestamp every time + # someone links in. + # On all known servers, setting from true to true is sufficient to + # update the timestamp even though it's not an actual change. + infoNode = ptAgeVault().getAgeInfo() + if infoNode.isPublic(): + ptVault().setAgePublic(infoNode, True) + + 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): + ptGameScore.findAgeScores("PelletDrop", self.key) + + def OnGameScoreMsg(self, msg): + if isinstance(msg, ptGameScoreListMsg): + try: + score = msg.getScores()[0] + if msg.getName() == "PelletDrop": + self.IUpdateHoodPelletScore(score) + except Exception as detail: + PtDebugPrint("nb01UpdateHoodInfoImager.OnGameScoreMsg(): " + detail) + + def IUpdateHoodPelletScore(self, score): + hoodpoints = score.getPoints() + hoodpelletscore = 0 + deviceInbox = self.IGetDeviceInbox() + if deviceInbox is not 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 deviceInbox is not 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 = "%s\t%i\n" % (newplayername, pelletscore) + pelletscores = ptVaultTextNoteNode(0) + pelletscores.setTitle("Pellet Scores") + pelletscores.setText(thetext) + deviceInbox.addNode(pelletscores) + + if pelletscores and pelletscores.getID() > 0: + sname = "Update=%d" % (pelletscores.getID()) + PtDebugPrint("Sending notify to update node: ", pelletscores.getID()) + self.ISendNotify(HoodInfoImagerScript.value, sname, 1.0) + else: + PtDebugPrint("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 isinstance(receiver, list): + 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): + PtDebugPrint("nb01UpdateHoodInfoImager.OnServerInitComplete()") + + try: + AmCCR = ptCCRMgr().getLevel() + except: + AmCCR = 0 + + if not AmCCR: + self.IUpdatePublicHoodDate() + + sname = "Join=%s" % (PtGetLocalPlayer().getPlayerName()) + self.ISendNotify(self.key, sname, 1.0) + + PtDebugPrint("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(): + PtDebugPrint("nb01UpdateHoodInfoImager.OnNotify: I am owner so I'll update the imager") + if event[1][:5] == "Join=": + playername = event[1][5:] + self.IUpdatePlayerList(playername) + PtDebugPrint("nb01UpdateHoodInfoImager.OnNotify: Updated player list") + elif event[1][:6] == "Score=": + playername = event[1][6:] + score = int(event[3]) + self.IUpdatePelletScores(playername, score) + PtDebugPrint("nb01UpdateHoodInfoImager.OnNotify: Updated pellet scores") diff --git a/Scripts/Python/nglnFogTweener.py b/Scripts/Python/nglnFogTweener.py new file mode 100644 index 0000000000..f8f75932f1 --- /dev/null +++ b/Scripts/Python/nglnFogTweener.py @@ -0,0 +1,347 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__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]) + + PtDebugPrint("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)) + PtDebugPrint("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 + + + #~ PtDebugPrint("nglnFogTweener.CalculateNewFogValues: The battery was updated. Time to update the Fog.") + + AgeTimeOfDayPercent = PtGetAgeTimeOfDayPercent() + + PtDebugPrint("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) + + PtDebugPrint("\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) + PtDebugPrint("\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) + PtDebugPrint("\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) + PtDebugPrint("\tIt's after Midnight and before Sunrise. (%.2f%% this quadrant)" % (TweenPct*100)) + + else: + PtDebugPrint("ERROR: I can't tell what time it is.") + + #~ PtDebugPrint("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): + #~ PtDebugPrint("TweenPct = ", TweenPct) + PtDebugPrint("UpdateFog: StartR=%s, EndR=%s, StartG=%s, EndG=%s, StartB=%s, EndB=%s" % (StartR, EndR, StartG, EndG, StartB, EndB)) + PtDebugPrint("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) + + PtDebugPrint("UpdateFog: The new fog RGB is (%.3f, %.3f, %.3f)" % (NewR, NewG, NewB)) + PtDebugPrint("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/Scripts/Python/nglnTreeMonkey.py b/Scripts/Python/nglnTreeMonkey.py new file mode 100644 index 0000000000..18759e9e90 --- /dev/null +++ b/Scripts/Python/nglnTreeMonkey.py @@ -0,0 +1,299 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 random + +# 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 + PtDebugPrint("__init__nglnTreeMonkey v.", version,".0") + random.seed() + + ########################### + def OnServerInitComplete(self): + try: + ageSDL = PtGetAgeSDL() + except: + PtDebugPrint("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: + PtDebugPrint("nglnTreeMonkey: It's been at least a day since the last update, running new numbers now.") + self.InitNewSDLVars() + else: + PtDebugPrint("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 + PtDebugPrint("nglnTreeMonkey.OnNotify: state=%f id=%d events=" % (state,id),events) + + if id == (-1): + PtDebugPrint("Need to store event: %s" % (events[0][1])) + stackList.append(events[0][1]) + PtDebugPrint("New list is: %s" % (str(stackList))) + if len(stackList) == 1: + PtDebugPrint("List is only one command long, so I'm playing it") + code = stackList[0] + PtDebugPrint("Playing command: %s" % (code)) + self.ExecCode(code) + + elif id == respMonkeyAct.id and self.sceneobject.isLocallyOwned(): + PtDebugPrint("Callback was from responder, and I own the age, so Logic Time") + old = stackList.pop(0) + PtDebugPrint("Popping off: %s" % (old)) + self.RandomBehavior() + + elif id == respMonkeyOff.id and self.sceneobject.isLocallyOwned(): + PtDebugPrint("Callback was from 'Off' responder") + old = stackList.pop(0) + PtDebugPrint("Popping off: %s" % (old)) + + elif (id == respMonkeyAct.id or id == respMonkeyOff.id) and not self.sceneobject.isLocallyOwned(): + PtDebugPrint("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) + PtDebugPrint("Popping off: %s" % (old)) + if len(stackList): + PtDebugPrint("List has at least one item ready to play") + code = stackList[0] + PtDebugPrint("Playing command: %s" % (code)) + self.ExecCode(code) + + else: + PtDebugPrint("Callback from something else?") + + ########################### + def RandomBehavior(self): + ageSDL = PtGetAgeSDL() + PickABehavior = random.randint(1,100) + #~ PtDebugPrint("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") + else: + respString = ("respMonkeyAct;%s" % (MonkeyState)) + self.SendNote(respString) + PtDebugPrint("nglnTreeMonkey: Attempting Tree Monkey Anim: %s" % (MonkeyState)) + if LightsOn: + respMonkeySfx.run(self.key, state=str(MonkeyState)) + PtDebugPrint("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 = random.randint(0,2) + respSpawnPt.run(self.key, state=str(whichtree)) + self.SendNote("respMonkeyAct;Up") + PtDebugPrint("nglnTreeMonkey: Tree Monkey is climbing Tree: %d" % (whichtree)) + + ########################### + def OnTimer(self,TimerID): + PtDebugPrint("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 + #PtDebugPrint("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(random.randint(0,318)) + firstTime = int((randnum / 1000.0) * kDayLengthInSeconds) + beginningOfToday + PtDebugPrint("nglnTreeMonkey: Generated a valid spawn time: %d" % (firstTime)) + spawnTimes = [firstTime] + + while isinstance(spawnTimes[-1], long): + randnum = random.randint(kMinimumTimeBetweenSpawns, kMaximumTimeBetweenSpawns) + newTime = spawnTimes[-1] + randnum + if newTime < endOfToday: + PtDebugPrint("nglnTreeMonkey: Generated a valid spawn time: %d" % (newTime)) + spawnTimes.append(newTime) + else: + PtDebugPrint("nglnTreeMonkey: Generated a spawn time after dusk, exiting loop: %d" % (newTime)) + break + else: + PtDebugPrint("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() + PtDebugPrint("timer: %d time: %d timeTillSpawn: %d" % (timer,PtGetDniTime(),timeTillSpawn)) + if timeTillSpawn > 0: + PtDebugPrint("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 + PtDebugPrint("nglnTreeMonkey: Setting EndOfDay timer for %d seconds" % (timeLeftToday)) + PtAtTimeCallback(self.key, timeLeftToday, 2) + else: + PtDebugPrint("nglnTreeMonkey: Timer array was empty!") + + ########################### + def OnBackdoorMsg(self, target, param): + if target == "monkey": + if self.sceneobject.isLocallyOwned(): + PtDebugPrint("nglnTreeMonkey.OnBackdoorMsg: Work!") + if param == "up": + self.SendNote("respMonkeyAct;Up") + elif param == "tree": + self.MonkeyAppears() + + def ExecCode(self, code): + if code == "respMonkeyOff": + respMonkeyOff.run(self.key) + elif code.find("respMonkeyAct") != -1: + try: + chunks = code.split(';') + ecMonkeyState = chunks[1] + respMonkeyAct.run(self.key, state=ecMonkeyState) + except: + PtDebugPrint("nglnTreeMonkey.ExecCode(): ERROR! Invalid code '%s'." % (code)) + stackList.pop(0) + else: + PtDebugPrint("nglnTreeMonkey.ExecCode(): ERROR! Invalid code '%s'." % (code)) + stackList.pop(0) diff --git a/Scripts/Python/nglnUrwinBrain.py b/Scripts/Python/nglnUrwinBrain.py new file mode 100644 index 0000000000..9947978986 --- /dev/null +++ b/Scripts/Python/nglnUrwinBrain.py @@ -0,0 +1,413 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 random + +# 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 + PtDebugPrint("__init__nglnUrwinBrain v.", version,".0") + random.seed() + + ############################ + def OnServerInitComplete(self): + try: + ageSDL = PtGetAgeSDL() + except: + PtDebugPrint("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: + PtDebugPrint("nglnUrwinBrain: It's been at least a day since the last update, running new numbers now.") + self.InitNewSDLVars() + else: + PtDebugPrint("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() + PtDebugPrint("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): + PtDebugPrint("Need to store event: %s" % (events[0][1])) + stackList.append(events[0][1]) + PtDebugPrint("New list is: %s" % (str(stackList))) + if len(stackList) == 1: + PtDebugPrint("List is only one command long, so I'm playing it") + code = stackList[0] + PtDebugPrint("Playing command: %s" % (code)) + self.ExecCode(code) + + elif state and self.sceneobject.isLocallyOwned() and ageSDL["UrwinOnTheProwl"][0]: + if id == respUrwinSfx.id: + PtDebugPrint("Callback was from Appearance SFX, and I own the age, so start walking") + self.StartToWalk() + + else: + PtDebugPrint("Callback was from responder, and I own the age, so Logic Time") + old = stackList.pop(0) + PtDebugPrint("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 random.randint(0,9): + PtDebugPrint("Urwin will take %d more steps..." % (StepsToTake)) + self.SendNote("respUrwinWalkLoop") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="WalkLoop") + # 10% to eat + else: + PtDebugPrint("Urwin is hungry and decides to eat") + self.SendNote("respUrwinEat") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat") + else: + PtDebugPrint("Urwin is tired and stops walking") + PtAtTimeCallback(self.key, 0.666, 3) + self.SendNote("respUrwinWalkToIdle") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="WalkToIdle") + + elif id == respUrwinEat.id: + PtDebugPrint("Urwin is done eating and continues walking") + self.SendNote("respUrwinWalkLoop") + 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 random.randint(0,2): + self.RandomBehavior() + # 33% to go back to walking + else: + PtDebugPrint("Urwin is rested and goes back to walking") + self.SendNote("respUrwinIdleToWalk") + UrwinMasterAnim.animation.resume() + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="IdleToWalk") + + elif id == actUrwinPathEnd.id: + PtDebugPrint("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(): + PtDebugPrint("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) + PtDebugPrint("Popping off: %s" % (old)) + if len(stackList): + PtDebugPrint("List has at least one item ready to play") + code = stackList[0] + PtDebugPrint("Playing command: %s" % (code)) + self.ExecCode(code) + + else: + PtDebugPrint("Callback from something else?") + + ############################ + def RandomBehavior(self): + ageSDL = PtGetAgeSDL() + + boolBatteryChargedAndOn = ageSDL["nglnPodLights"][0] + + # 66% chance of idling + if random.randint(0,2): + PtDebugPrint("Urwin is being lazy and just idling") + self.SendNote("respUrwinIdle") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle") + # 33% to vocalize + else: + PtDebugPrint("Urwin is calling home.") + self.SendNote("respUrwinVocalize") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Vocalize") + + ############################ + def StartToWalk(self): + global StepsToTake + + ageSDL = PtGetAgeSDL() + boolBatteryChargedAndOn = ageSDL["nglnPodLights"][0] + + StepsToTake = random.randint(minsteps, maxsteps) + PtDebugPrint("Urwin has decided to take %d steps." % (StepsToTake)) + + self.SendNote("respUrwinWalkLoop") + 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: + PtDebugPrint("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: + PtDebugPrint("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 + #PtDebugPrint("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(random.randint(0,kFirstMorningSpawn)) + firstTime = int((randnum / 1000.0) * kDayLengthInSeconds) + beginningOfToday + PtDebugPrint("nglnUrwinBrain: Generated a valid spawn time: %d" % (firstTime)) + spawnTimes = [firstTime] + + while isinstance(spawnTimes[-1], long): + randnum = random.randint(kMinimumTimeBetweenSpawns, kMaximumTimeBetweenSpawns) + newTime = spawnTimes[-1] + randnum + if newTime < endOfToday: + PtDebugPrint("nglnUrwinBrain: Generated a valid spawn time: %d" % (newTime)) + spawnTimes.append(newTime) + else: + PtDebugPrint("nglnUrwinBrain: Generated a spawn time after dusk, exiting loop: %d" % (newTime)) + break + else: + PtDebugPrint("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() + PtDebugPrint("timer: %d time: %d timeTillSpawn: %d" % (timer,PtGetDniTime(),timeTillSpawn)) + if timeTillSpawn > 0: + PtDebugPrint("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 + PtDebugPrint("nglnUrwinBrain: Setting EndOfDay timer for %d seconds" % (timeLeftToday)) + PtAtTimeCallback(self.key, timeLeftToday, 2) + else: + PtDebugPrint("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(): + PtDebugPrint("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 isinstance(param, str): + newTimes = param.split(";") + kMinimumTimeBetweenSpawns = int(newTimes[0]) + kMaximumTimeBetweenSpawns = int(newTimes[1]) + kFirstMorningSpawn = 1 + self.InitNewSDLVars() + + def ExecCode(self, code): + global stackList + if code == "respUrwinIdle": + respUrwinIdle.run(self.key) + elif code == "respUrwinIdleToWalk": + respUrwinIdleToWalk.run(self.key) + elif code == "respUrwinWalkLoop": + respUrwinWalkLoop.run(self.key) + elif code == "respUrwinWalkToIdle": + respUrwinWalkToIdle.run(self.key) + elif code == "respUrwinEat": + respUrwinEat.run(self.key) + elif code == "respUrwinVocalize": + respUrwinVocalize.run(self.key) + else: + PtDebugPrint("nglnUrwinBrain.ExecCode(): ERROR! Invalid code '%s'." % (code)) + stackList.pop(0) diff --git a/Scripts/Python/nxusBookMachine.py b/Scripts/Python/nxusBookMachine.py new file mode 100644 index 0000000000..a4aa8253d7 --- /dev/null +++ b/Scripts/Python/nxusBookMachine.py @@ -0,0 +1,1643 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +Module: nxusBookMachine +Age: nexus +Date: September, 2002 +Author: Bill Slease +Handler for the nexus book machine. +""" + +from Plasma import * +from PlasmaKITypes import * +from PlasmaNetConstants import * +from PlasmaTypes import * +from PlasmaVaultConstants import * +from xPsnlVaultSDL import * + +import xLocTools + +import PlasmaControlKeys +import datetime +import random + +# 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") + +#------nexus machine GUI tags +kNexusDialogName = "NexusAgeDialog" + +kIDBtnLinkCategory01 = 100 +kIDTxtLinkCategory01 = 101 +kIDBtnLinkCategory02 = 110 +kIDTxtLinkCategory02 = 111 +kIDBtnLinkCategory03 = 120 +kIDTxtLinkCategory03 = 121 +kIDBtnLinkCategory04 = 130 +kIDTxtLinkCategory04 = 131 + +kCategoryCity = kIDBtnLinkCategory01 +kCategoryPrivate = kIDBtnLinkCategory02 +kCategoryPublic = kIDBtnLinkCategory03 +kCategoryPersonal = kIDBtnLinkCategory04 + +kGUICategoryControls = ((kIDTxtLinkCategory01, kIDBtnLinkCategory01), + (kIDTxtLinkCategory02, kIDBtnLinkCategory02), + (kIDTxtLinkCategory03, kIDBtnLinkCategory03), + (kIDTxtLinkCategory04, kIDBtnLinkCategory04)) + +kIDBtnNeighborhoodCreate = 400 +kIDBtnNeighborhoodSelect = 401 +kIDTxtNeighborhoodName = 402 +kIDTxtNeighborhoodInfo = 403 + +kIDBtnNeighborhoodPublic = 404 +kIDTxtNeighborhoodPublic = 405 + +kIDBtnScrollUp = 500 +kIDBtnScrollDn = 501 + +kIDTxtLinkDescription = 200 + +kIDBtnLinkSelectFirst = 210 +kIDBtnLinkSelectLast = 280 + +kIDTxtLinkNameFirst = 211 +kIDTxtLinkNameLast = 281 + +kIDBtnDeleteLinkFirst = 310 +kIDBtnDeleteLinkLast = 380 + +#id for 8 link list controls +#for any row: (select button, name txt, info txt, delete button) +kGUILinkControls = [(210, 211, 212, 310), + (220, 221, 222, 320), + (230, 231, 232, 330), + (240, 241, 242, 340), + (250, 251, 252, 350), + (260, 261, 262, 360), + (270, 271, 272, 370), + (280, 281, 282, 380), + ] + +kIDNameHeaderText = 600 +kIDPopHeaderText = 601 +kIDNameHeaderBtn = 610 +kIDPopHeaderBtn = 611 +kIDNameAscArrow = 620 +kIDPopAscArrow = 621 +kIDNameDescArrow = 630 +kIDPopDescArrow = 631 + +#currently unused language controls +kIDEngCheckBox = 700 +kIDFreCheckBox = 701 +kIDGerCheckBox = 702 +kIDEngCheck = 710 +kIDFreCheck = 711 +kIDGerCheck = 712 +kIDEngText = 720 +kIDFreText = 721 +kIDGerText = 722 + +kLanguageControls = {kIDEngCheckBox: PtLanguage.kEnglish, + kIDEngCheck: PtLanguage.kEnglish, + + kIDFreCheckBox: PtLanguage.kFrench, + kIDFreCheck: PtLanguage.kFrench, + + kIDGerCheckBox: PtLanguage.kGerman, + kIDGerCheck: PtLanguage.kGerman, + } +#------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 + +kNumDisplayFields = 8 +kMaxDisplayableChars = 24 # the avg number of chars to display before tacking on an ellipsis: "..." + +#special named link panels (other then 'LinkPanel_' + Age Filename) +kLinkPanels = { +'city' : {'LinkInPointFerry' : U'LinkPanel_Ferry Terminal', + 'LinkInPointDakotahAlley' : U'LinkPanel_Dakotah Alley', + 'LinkInPointPalace' : U'LinkPanel_Palace Alcove', + 'LinkInPointConcertHallFoyer' : U'LinkPanel_Concert Hall Foyer', + 'LinkInPointLibrary' : U'LinkPanel_Library Courtyard' + }, +'Cleft' : { + #That would be conspicious, if Nexus allowed to link to rainy cleft, unless we belive in great Nexus-Maintainers-Bahro conspiracy + 'SpawnPointTomahna01' : U'LinkPanel_Tomahna', + #Umm, why Nexus even has entry for some boring hole in ground on surface? + '' : U'LinkPanel_Cleft', + }, + +'GreatZero' : {'' : U'LinkPanel_Great Zero Observation', + 'BigRoomLinkInPoint' : U'LinkPanel_GreatZero' + }, +'Neighborhood02' : {'' : U'LinkPanel_Kirel' + }, +} + + +kHiddenPersonalAges = ["Personal", "Nexus", "Neighborhood", "city", "AvatarCustomization", "Cleft", "BaronCityOffice", "BahroCave", "PelletBahroCave", "Kveer", "Myst", "LiveBahroCaves", "LiveBahroCave"] +kHiddenCityLinks = ["islmPalaceBalcony03", "KadishGallery", "islmPalaceBalcony02", "islmDakotahRoof", ] +kHiddenAgesIfInvited = ["BahroCave", "PelletBahroCave", "Pellet Cave", "LiveBahroCave", "LiveBahroCaves", "Myst"] + +#public ages SDL variables to be read from Vault on start (max. population, is link visible) +kAgeSdlVariables = { +'city' : ('MaxCityPop', 'nxusCityLinksVis'), +'GreatTreePub' : ('MaxPubPop', 'nxusShowPub'), +'guildPub' : ('MaxGuildPubPop', None), +'Neighborhood02' : ('MaxKirelPop', 'nxusShowKirel'), +'Kveer' : ('MaxKveerPublicPop', None), +} + +kGuildPubs = ["Cartographers", "Greeters", "Maintainers", "Messengers", "Writers"] + +#if possible, game will try to use those instances +kHardcodedInstances = {"GuildPub-Cartographers" : "35624301-841e-4a07-8db6-b735cf8f1f53", + "GuildPub-Greeters" : "381fb1ba-20a0-45fd-9bcb-fd5922439d05", + "GuildPub-Maintainers" : "e8306311-56d3-4954-a32d-3da01712e9b5", + "GuildPub-Messengers" : "9420324e-11f8-41f9-b30b-c896171a8712", + "GuildPub-Writers" : "5cf4f457-d546-47dc-80eb-a07cdfefa95d", + "Kveer" : "68e219e0-ee25-4df0-b855-0435584e29e2"} + +#id for ages descriptions +kPublicAgesDescription = { + 'city' : ("Nexus.Messages.CityFull", "Nexus.Messages.CityPopulation"), + 'GreatTreePub' : ("Nexus.Messages.PubFull", "Nexus.Messages.PubPopulation"), + 'Neighborhood02' : ("Nexus.Messages.KirelFull", "Nexus.Messages.KirelPopulation"), + 'GuildPub-Cartographers' : ("Nexus.Messages.GuildPubFull", "Nexus.Messages.GuildPubPopulation"), + 'GuildPub-Greeters' : ("Nexus.Messages.GuildPubFull", "Nexus.Messages.GuildPubPopulation"), + 'GuildPub-Maintainers' : ("Nexus.Messages.GuildPubFull", "Nexus.Messages.GuildPubPopulation"), + 'GuildPub-Messengers' : ("Nexus.Messages.GuildPubFull", "Nexus.Messages.GuildPubPopulation"), + 'GuildPub-Writers' : ("Nexus.Messages.GuildPubFull", "Nexus.Messages.GuildPubPopulation"), +} + +# hood sorting vars +kSortNone = 0 +kSortNameAsc = 1 +kSortNameDesc = 2 +kSortPopAsc = 3 +kSortPopDesc = 4 + +#controls for hood sorting var +kSortControlId = { + kSortNameAsc : kIDNameAscArrow, + kSortNameDesc : kIDNameDescArrow, + kSortPopAsc : kIDPopAscArrow, + kSortPopDesc : kIDPopDescArrow +} + +#GUI state +kGUIDeactivated = 0 +kWaitingOnGUIAnim = 1 +kGUIActivated = 2 + +kChronicleVarType = 0 + +def Uni(string): + "Converts a string to unicode, using latin-1 encoding if necessary" + try: + retVal = unicode(string) + return retVal + except UnicodeDecodeError: + retVal = unicode(string, "latin-1") + return retVal + +class AgeInstance(): + def __init__(self, ageData): + self.ageInfo = ageData[0] + self.population = ageData[1] + self.owners = ageData[2] + +class AgeData(): + def __init__(self, ageFilename, defaultMaxPop, linkVisible): + self.ageFilename = ageFilename + self.maxPop = defaultMaxPop + self.linkVisible = linkVisible + self.instances = list() + +class LinkListEntry(): + def __init__(self, displayName, displayInfo, description = U"", canDelete = False, isEnabled = True): + self.untranslatedName = Uni(displayName) + self.displayName = xLocTools.LocalizeAgeName(displayName) + self.displayInfo = displayInfo + self.description = description + self.canDelete = canDelete + self.isEnabled = isEnabled + self.als = None + + def setLinkStruct(self, ageInfo, spawnPoint = None, linkRule = PtLinkingRules.kBasicLink): + if isinstance(ageInfo, ptVaultAgeInfoNode): + ageInfo = ageInfo.asAgeInfoStruct() + + self.als = ptAgeLinkStruct() + self.als.setAgeInfo(ageInfo) + self.als.setLinkingRules(linkRule) + if spawnPoint is not None: + self.als.setSpawnPoint(spawnPoint) + + def setChildAgeLinkStruct(self, ageInfo, parentFilename, spawnPoint = None): + if isinstance(ageInfo, ptVaultAgeInfoNode): + ageInfo = ageInfo.asAgeInfoStruct() + + self.als = ptAgeLinkStruct() + self.als.setAgeInfo(ageInfo) + self.als.setLinkingRules(PtLinkingRules.kChildAgeBook) + self.als.setParentAgeFilename(parentFilename) + if spawnPoint is not None: + self.als.setSpawnPoint(spawnPoint) + +class nxusBookMachine(ptModifier): + "The Nexus python code" + def __init__(self): + ptModifier.__init__(self) + self.id = 5017 + version = 5 + self.version = version + PtDebugPrint("__init__nxusBookMachine v.", version) + random.seed() + + self.guiState = kGUIDeactivated + self.getBookBtnUp = False + self.gettingBook = False + self.controlsEnabled = False + self.animCount = 0 + self.dialogVisible = False + + self.currentStatusBarText = U"" + + self.publicHoodSort = kSortNone #current hood list sorting method + + self.deleteCandidateId = None #id for hood to delete + + self.controlIdToAgeEntry = dict() #list of LinkListEntry entries assigned to control + + self.idCategorySelected = kIDBtnLinkCategory01 + self.idLinkSelected = None + + self.presentedBookAls = None + + self.indexDisplayStart = 0 + + self.publicHoods = list() + self.neighborhoodEntry = None + self.publicAges = { + 'city' : AgeData(ageFilename = 'city', defaultMaxPop = 20, linkVisible = 1), + 'GreatTreePub' : AgeData(ageFilename = 'GreatTreePub', defaultMaxPop = 100, linkVisible = 0), + 'guildPub' : AgeData(ageFilename = '', defaultMaxPop = 0, linkVisible = 0), + 'Neighborhood02' : AgeData(ageFilename = 'Neighborhood02', defaultMaxPop = 100, linkVisible = 0), + 'Kveer' : AgeData(ageFilename = 'Kveer', defaultMaxPop = 100, linkVisible = 0), + } + + self.categoryLinksList = { + kCategoryCity : list(), #city links + kCategoryPrivate : list(), #private + kCategoryPublic : list(), #public + kCategoryPersonal : list() #personal + } + + self.showHoodLanguages = { + PtLanguage.kEnglish : True, + PtLanguage.kFrench : True, + PtLanguage.kGerman : True + } + + 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: + objPanel.draw.disable() + + def OnServerInitComplete(self): + ageSDL = PtGetAgeSDL() + for (ageName, (maxPopVar, linkVisibleVar)) in kAgeSdlVariables.iteritems(): + #updating maximum population + if maxPopVar is not None: + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing variable '%s'" % maxPopVar) + try: + pop = ageSDL[maxPopVar][0] + self.publicAges[ageName].maxPop = pop + except (KeyError, IndexError): + PtDebugPrint("Unable to get '%s' from SDL, defaulting to %d" % (maxPopVar, self.publicAges[ageName].maxPop)) + + #checking if link is visible + if linkVisibleVar is not None: + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing variable '%s'" % linkVisibleVar) + try: + visible = ageSDL[linkVisibleVar][0] + self.publicAges[ageName].linkVisible = visible + except (KeyError, IndexError): + PtDebugPrint("Unable to get '%s' from SDL, defaulting to %d" % (linkVisibleVar, self.publicAges[ageName].linkVisible)) + + #special cases + + #GZ + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing the show great zero toggle") + try: + self.showGreatZero = ageSDL["nxusShowGZ"][0] + except (KeyError, IndexError): + PtDebugPrint("Unable to get show great zero toggle from SDL, defaulting to false") + self.showGreatZero = False + + #Guild Pub + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): Grabbing the show GuildPub var") + guildPubEntry = self.publicAges['guildPub'] + + psnlSDL = xPsnlVaultSDL() + showGuildPub = psnlSDL["guildAlliance"][0] + if showGuildPub: + if PtIsInternalRelease(): + for guild in kGuildPubs: + filename = "GuildPub-%s" % guild + data = AgeData(filename, 0, 1) + data.guild = guild # for name formatting + self.publicAges[filename] = data + PtDebugPrint("nxusBookMachine.OnServerInitComplete() - showing guild pub: %s" % guild) + else: + guild = kGuildPubs[showGuildPub - 1] + filename = "GuildPub-" + guild + PtDebugPrint("nxusBookMachine.OnServerInitComplete() - member of guild: %s" % (guild)) + guildPubEntry.linkVisible = 1 + guildPubEntry.guild = guild + guildPubEntry.ageFilename = filename + #rename old entry + self.publicAges[filename] = guildPubEntry + + del self.publicAges['guildPub'] + + vault = ptVault() + entry = vault.findChronicleEntry("GotLinkToKveerPublic") + if entry is not None: + entryValue = entry.chronicleGetValue() + if entryValue == "yes": + PtDebugPrint("nxusBookMachine.OnServerInitComplete(): chron says you have the link to public Kveer, woo hoo") + self.publicAges['Kveer'].linkVisible = True + else: + PtDebugPrint("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) + + def ICanCreateHood(self): + hoodLink = self.IGetHoodLinkNode() + if not hoodLink.getVolatile(): + return False # only let the player create a new hood if their book is volatile + if PtIsInternalRelease(): + return True # we don't have the 1 day limitation on internal clients + vault = ptVault() + entry = vault.findChronicleEntry("LastHoodCreationTime") + if entry is None: + return True # we haven't created a hood before, so let them! + + temp = float(entry.chronicleGetValue()) + lastTime = datetime.date.fromtimestamp(temp) + temp = PtGetDniTime() + curTime = datetime.date.fromtimestamp(temp) + + oneDay = datetime.timedelta(days = 1) + + return curTime - lastTime > oneDay + + def gotPublicAgeList(self, ages): + if not ages: + PtDebugPrint("nxusBookMachine.gotPublicAgeList() - got an empty list, which we assume are hoods, clearing hood list") + self.publicHoods = list() + self.IUpdateLinks(kCategoryPublic) + return + + hoods = list() + tempInstances = dict() + + for age in ages: + ageFilename = age[0].getAgeFilename() + if ageFilename == "Neighborhood": + # if the current population and number of owners is zero then don't display it + #looks like it doesn't work (at least on Dirtsand) + if age[2] != 0 or age[1] != 0: + hoods.append(AgeInstance(age)) + else: + PtDebugPrint("nxusBookMachine.gotPublicAgeList() - got the list of %s instances" % ageFilename) + try: + instances = tempInstances[ageFilename] + except KeyError: + instances = list() + tempInstances[ageFilename] = instances + + instances.append(AgeInstance(age)) + + if tempInstances: + for (ageFilename, instances) in tempInstances.iteritems(): + try: + self.publicAges[ageFilename].instances = sorted(instances, key = lambda entry : entry.ageInfo.getAgeSequenceNumber()) + except KeyError: + PtDebugPrint("nxusBookMachine.gotPublicAgeList(): got age '%s', that wasn't expected" % ageFilename) + self.IUpdateLinks(kCategoryCity) + + if hoods: + self.publicHoods = hoods + self.IUpdateLinks(kCategoryPublic) + + def ISortPublicHoods(self, hoods, hoodSort = kSortNone): + # if the language is not English, French, or German, we assume it is English and treat it as such + hoodsToSort = list() + for hood in hoods: + hoodLanguage = hood.ageInfo.getAgeLanguage() + allowLanguage = self.showHoodLanguages.get(hoodLanguage, True) + if allowLanguage: + hoodsToSort.append(hood) + + if hoodSort == kSortNone: + return hoodsToSort + + reverse = (hoodSort in (kSortNameDesc, kSortPopDesc)) + if hoodSort in (kSortNameAsc, kSortNameDesc): + return sorted(hoodsToSort, key = lambda hood: hood.ageInfo.getDisplayName(), reverse = reverse) + else: + return sorted(hoodsToSort, key = lambda hood: hood.population, reverse = reverse) + + def IFindAgeLinkInFolder(self, folder, ageName): + ageName = ageName.lower() + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild().upcastToAgeLinkNode() + if link is not None: + info = link.getAgeInfo() + else: + link = content.getChild() + info = link.upcastToAgeInfoNode() + + if info.getAgeFilename().lower() == ageName: + return link + return None + + def IFindAgeInfoInFolder(self, folder, ageName): + ageName = ageName.lower() + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if link is not None: + info = link.getAgeInfo() + else: + link = content.getChild() + info = link.upcastToAgeInfoNode() + + if info.getAgeFilename().lower() == ageName: + return info + return None + + def IGetHoodLinkNode(self): + vault = ptVault() + folder = vault.getAgesIOwnFolder() + return self.IFindAgeLinkInFolder(folder, 'Neighborhood') + + def IGetHoodInfoNode(self): + vault = ptVault() + folder = vault.getAgesIOwnFolder() + return self.IFindAgeInfoInFolder(folder, 'Neighborhood') + + def IIsMyHoodPublic(self): + hoodInfo = self.IGetHoodInfoNode() + if hoodInfo is not None: + return hoodInfo.isPublic() + + def IMakeHoodPublic(self): + hoodInfo = self.IGetHoodInfoNode() + if hoodInfo is not None: + infoStruct = hoodInfo.asAgeInfoStruct() + PtCreatePublicAge(infoStruct, self) + + + def IMakeHoodPrivate(self): + hoodInfo = self.IGetHoodInfoNode() + if hoodInfo is not None: + guid = hoodInfo.getAgeInstanceGuid() + PtRemovePublicAge(guid, self) + + def IPublicAgeCreated(self, ageName): + PtDebugPrint("IPublicAgeCreated: " + ageName) + PtGetPublicAgeList(ageName, self) + + def IPublicAgeRemoved(self, ageName): + PtDebugPrint("IPublicAgeRemoved: " + ageName) + PtGetPublicAgeList(ageName, self) + + def IHoodCreated(self, ageInfo): + PtDebugPrint("OnVaultNotify: Setting the new hood's language to %d " % 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 entry is None: + # not found... add current level chronicle + vault.addChronicleEntry("LastHoodCreationTime", kChronicleVarType, str(PtGetDniTime())) + else: + entry.chronicleSetValue(str(PtGetDniTime())) + entry.save() + + def IPushGetBookBtn(self): + if self.getBookBtnUp: + self.animCount += 1 + respButtonPress.run(self.key) + self.getBookBtnUp = False + + def IRetractGetBookBtn(self): + if not self.getBookBtnUp: + self.animCount += 1 + respBookSelect.run(self.key) #retract button + self.getBookBtnUp = True + + def IBookRetract(self): + actLink.disable() + self.animCount += 1 + respBookRetract.run(self.key) + self.presentedBookAls = None + + def OnVaultNotify(self, event, tupdata): + if event == PtVaultNotifyTypes.kRegisteredOwnedAge: + ageLinkNode = tupdata[0] # should be a ptVaultAgeLinkNode + ageInfo = ageLinkNode.getAgeInfo() # ptAgeInfoNode + ageFilename = ageInfo.getAgeFilename() + if (ageFilename == "Neighborhood"): + self.IHoodCreated(ageInfo) + self.IUpdateHoodLink() + else: + self.IUpdateLinks(kCategoryPrivate) + + elif event in (PtVaultNotifyTypes.kUnRegisteredOwnedAge, PtVaultNotifyTypes.kUnRegisteredVisitAge): + PtDebugPrint("OnVaultNotify: A link was deleted, checking if we need to retract the book") + ageInfo = tupdata[0].getAgeInfo() + #is there any book presented + if self.presentedBookAls is not None: + presentedInfo = self.presentedBookAls.getAgeInfo() + if ageInfo.getAgeInstanceGuid() == presentedInfo.getAgeInstanceGuid(): + PtDebugPrint("OnVaultNotify: The currently displayed link was deleted, retracting book") + self.IBookRetract() + + if self.getBookBtnUp and self.idLinkSelected is not None: + selectedInfo = self.controlIdToAgeEntry[self.idLinkSelected].als.getAgeInfo() + if ageInfo.getAgeInstanceGuid() == selectedInfo.getAgeInstanceGuid(): + PtDebugPrint("OnVaultNotify: The currently selected link was deleted, pushing button") + self.IPushGetBookBtn() + + self.IUpdateLinks() + + elif event == PtVaultNotifyTypes.kPublicAgeCreated: + ageName = tupdata[0] + self.IPublicAgeCreated(ageName) + + elif event == PtVaultNotifyTypes.kPublicAgeRemoved: + ageName = tupdata[0] + self.IPublicAgeRemoved(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.IUpdateHoodLink() + + def IOnYesNoNotify(self, state, events): + if self.deleteCandidateId is None: # user wants to create a new hood + if state: # user answered yes + self.IHideDisableButton(kIDBtnNeighborhoodCreate) + 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() + #no need to update, it will happen on vault notify + + else: # user wants to delete a link + if state: + self.IDeleteLink() + #links will be updated on vault notify + + def IOnActKISlot(self, state, events): #click on KI Slot + kiLevel = PtDetermineKILevel() + PtDebugPrint("nxusBookMachine.OnNotify:\tplayer ki level is %d" % kiLevel) + if kiLevel < kNormalKI: + respKISlot.run(self.key, events = events) #Insert KI + elif state: + for ageFilename in self.publicAges.viewkeys(): + # Crummy server software (eg Cyan) might discard requests for hardcoded public ages, + # leaving us dead in the water. BUT we would like to get information about that + # age from the vault, if possible. Therefore, we ask anyway but don't rely on it. + hardcoded = kHardcodedInstances.get(ageFilename) + if hardcoded is not None: + ageData = self.publicAges[ageFilename] + if not ageData.instances: + ageInfo = ptAgeInfoStruct() + ageInfo.setAgeFilename(ageFilename) + ageInfo.setAgeInstanceGuid(hardcoded) + ageData.instances.append(AgeInstance((ageInfo, 0, 0))) + PtGetPublicAgeList(ageFilename, 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) # insert hand, light slot, remove hand, notify triggerer and move KI slot, send notify + + def IOnKISlotGlow(self, state, events): # KI slot activated + # switch to machine ops cam, fix player in idle behavior, show GUI + avatar = PtGetLocalAvatar() + behMachineOps.run(avatar) + virtCam = ptCamera() + virtCam.save(camMachineOps.sceneobject.getKey()) + avatar.draw.disable() + if PtIsDialogLoaded(kNexusDialogName): + NexusGUI.dialog.show() + respGUIOn.run(self.key) + self.guiState = kWaitingOnGUIAnim + else: + PtDebugPrint("nxusBookMachine.IOnKISlotGlow(): Nexus GUI not loaded") + return + PtEnableControlKeyEvents(self.key) + PtSendKIMessage(kDisableKIandBB, 0) + + def IOnRespGUIOn(self, state, events): + self.guiState = kGUIActivated + + def IOnRespGUIOff(self, state, events): + self.guiState = kGUIDeactivated + avatar = PtGetLocalAvatar() + NexusGUI.dialog.hide() + virtCam = ptCamera() + virtCam.restore(camMachineOps.sceneobject.getKey()) + virtCam.enableFirstPersonOverride() + avatar.draw.enable() + behMachineOps.gotoStage(avatar, -1) # exit behavior + PtDisableControlKeyEvents(self.key) + PtSendKIMessage(kEnableKIandBB, 0) + respKISlotReturn.run(self.key) + self.controlsEnabled = True + self.animCount = 0 + + if self.presentedBookAls is not None: + self.IBookRetract() + + if self.idLinkSelected is not None: + self.ICancelLinkChoice() + + def IOnGetBookBtn(self, state, events): + if self.animCount == 0: + self.gettingBook = True + self.IPushGetBookBtn() + + def IOnRespButtonPress(self, state, events): + self.animCount -= 1 + if self.gettingBook: + #if there is already book presented, so we need to retract it + if self.presentedBookAls is not None: + respBookRetract.run(self.key) + actLink.disable() + #book already retracted, get new book + else: + respGetBook.run(self.key) + selectedAls = self.controlIdToAgeEntry[self.idLinkSelected].als + self.presentedBookAls = selectedAls + self.IDrawLinkPanel() + + self.animCount += 1 + + + def IOnRespBookRetract(self, state, events): + if self.gettingBook: + self.getBookAfterRetract = False + selectedAls = self.controlIdToAgeEntry[self.idLinkSelected].als + self.presentedBookAls = selectedAls + self.IDrawLinkPanel() + respGetBook.run(self.key) + else: + self.animCount -= 1 + self.gettingBook = False + + def IOnRespGetBook(self, state, events): + actLink.enable() + self.gettingBook = False + self.animCount -= 1 + + def IOnRespBookSelect(self, state, events): + self.animCount -= 1 + self.getBookBtnUp = True + + def IOnActLink(self, state, events): + if self.presentedBookAls is None: + PtDebugPrint("Ignoring book link click, since no book is shown") + else: + respGUIOff.run(self.key) + actGetBook.disable() + self.controlsEnabled = False + self.IDoLink() + + def OnNotify(self, state, id, events): + "main non-GUI message handler" + + if not hasattr(self, 'onNotifyActions'): + self.onNotifyActions = { + - 1: self.IOnYesNoNotify, # callback from delete yes/no dialog (hopefully) + ################## + # Engage Machine Interface # + ################## + actKISlot.id : self.IOnActKISlot, # click on KI Slot + respKISlotGlow.id: self.IOnKISlotGlow, #KI slot activated. + respGUIOn.id: self.IOnRespGUIOn, + ################## + # Exit Machine Interface # + ################## + respGUIOff.id: self.IOnRespGUIOff, # catch callback from shut down GUI anim responder run by OnControlKeyEvent() + ################## + # Machine Operations # + ################## + actGetBook.id: self.IOnGetBookBtn, + respButtonPress.id: self.IOnRespButtonPress, + respBookRetract.id: self.IOnRespBookRetract, + respGetBook.id: self.IOnRespGetBook, + respBookSelect.id: self.IOnRespBookSelect, # reenable GUI buttons now that getBookBtn is done animating + ################## + # Link Me # + ################## + actLink.id: self.IOnActLink, + respLink.id: None, + } + + action = self.onNotifyActions.get(id) + if action is not None: + action(state, events) + + + ################## + # Exit Machine Interface # + ################## + + def OnControlKeyEvent(self, controlKey, activeFlag): + "exit machine op mode" + if controlKey in (PlasmaControlKeys.kKeyExitMode, PlasmaControlKeys.kKeyMoveBackward, PlasmaControlKeys.kKeyRotateLeft, PlasmaControlKeys.kKeyRotateRight): + if self.guiState == kGUIActivated and self.controlsEnabled and self.animCount == 0: + actGetBook.disable() + respGUIOff.run(self.key) + + ############## + # Handle GUI Clicks # + ############## + + def OnGUINotify(self, id, control, event): + "Events from the Nexus GUI.." + + if id != NexusGUI.id: + PtDebugPrint("nxusBookMachine.OnGUINotify():\tunexpected message id") + + ################## + # Init Machine GUI # + ################## + + elif event == kShowHide: + if not self.dialogVisible: + self.dialogVisible = True + self.IClearGUI() + self.IUpdateHoodLink() + self.IUpdateLinks() + self.controlsEnabled = True + + #don't allow any click while self.controlsEnabled is false or there are any animations playing) + elif event == kAction and self.controlsEnabled and self.animCount == 0: + ctrlID = control.getTagID() + ################## + # Link Select Buttons # + ################## + if (ctrlID >= kIDBtnLinkSelectFirst and ctrlID <= kIDBtnLinkSelectLast) or ctrlID == kIDBtnNeighborhoodSelect: + self.IRetractGetBookBtn() + self.IChangeSelectedLink(ctrlID) + + ################## + # Category Select Buttons # + ################## + + elif ctrlID >= kIDBtnLinkCategory01 and ctrlID <= kIDBtnLinkCategory04: + #after category change currently selected link id is invalid, so disable button + if self.idLinkSelected != kIDBtnNeighborhoodSelect: + self.IPushGetBookBtn() + + self.IChangeCategory(ctrlID) + + ############# + # Scroll Buttons # + ############# + + elif ctrlID == kIDBtnScrollUp and self.indexDisplayStart > 0: + self.indexDisplayStart -= 1 + if self.idLinkSelected is not None and self.idLinkSelected != kIDBtnNeighborhoodSelect: + self.idLinkSelected += 10 + if self.idLinkSelected > kIDBtnLinkSelectLast: + # selected link scrolled off screen + self.ICancelLinkChoice() + + self.IUpdateGUILinkList() + + elif ctrlID == kIDBtnScrollDn: + entryCount = len(self.categoryLinksList[self.idCategorySelected]) + #rhs value can be negative - but this shouldn't happen, since button should be disabled + if self.indexDisplayStart < entryCount - kNumDisplayFields: + self.indexDisplayStart = self.indexDisplayStart + 1 + if self.idLinkSelected is not None and self.idLinkSelected != kIDBtnNeighborhoodSelect: + self.idLinkSelected -= 10 + if self.idLinkSelected < kIDBtnLinkSelectFirst: + # selected link scrolled off screen + self.ICancelLinkChoice() + self.IUpdateGUILinkList() + else: + PtDebugPrint("nxusBookMachine.OnGUINotify(): Tried to scroll to empty positions") + + ############# + # Create a Hood # + ############# + + elif ctrlID == kIDBtnNeighborhoodCreate: + self.deleteCandidateId = None + PtYesNoDialog(self.key, PtGetLocalizedString("Nexus.Messages.HoodCreate")) + + elif ctrlID == kIDBtnNeighborhoodPublic: + if self.IIsMyHoodPublic(): + self.IMakeHoodPrivate() + else: + self.IMakeHoodPublic() + # IUpdateLinks should be called automatically when the public age list updates + + ################## + # Delete Link Buttons # + ################## + + elif ctrlID >= kIDBtnDeleteLinkFirst and ctrlID <= kIDBtnDeleteLinkLast: + self.deleteCandidateId = ctrlID - 100 + entry = self.controlIdToAgeEntry[self.deleteCandidateId] + stringConfirm = PtGetLocalizedString("Nexus.Messages.LinkDelete", [entry.displayName]) + PtYesNoDialog(self.key, stringConfirm) + + ############# + # Header sort buttons # + ############# + + elif ctrlID == kIDNameHeaderBtn or ctrlID == kIDNameAscArrow or ctrlID == kIDNameDescArrow: + if self.publicHoodSort == kSortNameAsc: + self.publicHoodSort = kSortNameDesc + else: + self.publicHoodSort = kSortNameAsc + self.IUpdateLinks() + + elif ctrlID == kIDPopHeaderBtn or ctrlID == kIDPopAscArrow or ctrlID == kIDPopDescArrow: + if self.publicHoodSort == kSortPopAsc: + self.publicHoodSort = kSortPopDesc + else: + self.publicHoodSort = kSortPopAsc + self.IUpdateLinks() + + ############# + # Language checkboxes # + ############# + + elif ctrlID in kLanguageControls: + try: + language = kLanguageControls[ctrlID] + self.showHoodLanguages[language] = not self.showHoodLanguages[language] + self.IUpdateLinks() + except KeyError: + pass + + elif event == kInterestingEvent: + if control is not None: + if control.isInteresting(): + ctrlID = control.getTagID() + try: + description = self.controlIdToAgeEntry[ctrlID].description + self.ISetDescriptionText(description, False) + except KeyError: + pass + else: + self.ISetDescriptionText(self.currentStatusBarText, False) + + def IShowEnableButton(self, controlId): + btn = ptGUIControlButton(NexusGUI.dialog.getControlFromTag(controlId)) + btn.show() + btn.enable() + + def IHideDisableButton(self, controlId): + btn = ptGUIControlButton(NexusGUI.dialog.getControlFromTag(controlId)) + btn.hide() + btn.disable() + + def ISetDescriptionText(self, description, permanent = True): + descrTxt = ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtLinkDescription)) + descrTxt.setStringW(description) + if permanent: + self.currentStatusBarText = description + + + def IChangeSelection(self, oldSelection, newSelection, description = U""): + #reenable old entry + if oldSelection is not None: + btnId = oldSelection + txtId = oldSelection + 1 + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(btnId)).enable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(txtId)).setForeColor(colorNormal) + + #disable and highlight new entry + btnId = newSelection + txtId = newSelection + 1 + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(btnId)).disable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(txtId)).setForeColor(colorSelected) + + self.ISetDescriptionText(description) + + def IChangeCategory(self, newCategory): + if newCategory == self.idCategorySelected: + return + + self.IChangeSelection(self.idCategorySelected, newCategory) + self.idCategorySelected = newCategory + #update links with entries from new category + self.IUpdateLinks() + + if self.presentedBookAls is not None and self.idLinkSelected != kIDBtnNeighborhoodSelect: + self.IBookRetract() + + def IChangeSelectedLink(self, newSelection): + if newSelection == self.idLinkSelected: + return + + description = self.controlIdToAgeEntry[newSelection].description + self.IChangeSelection(self.idLinkSelected, newSelection, description) + self.idLinkSelected = newSelection + + if self.presentedBookAls is not None: + self.IBookRetract() + + + def IGetControlColor(self, controlId, enabled = True): + if not enabled: + return colorDisabled + elif self.idLinkSelected == controlId: + return colorSelected + else: + return colorNormal + + def IUpdateGuiEntry(self, idButton, idTxtName, idTxtInfo, linkEntry): + self.controlIdToAgeEntry[idButton] = linkEntry + # set color of name and info + + if self.idLinkSelected == idButton or not linkEntry.isEnabled: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idButton)).disable() + else: + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(idButton)).enable() + + if self.idLinkSelected == idButton: + self.ISetDescriptionText(linkEntry.description) + + + displayName = linkEntry.displayName + if len(displayName) > kMaxDisplayableChars: + displayName = displayName[:kMaxDisplayableChars] + U"..." + + color = self.IGetControlColor(idButton, linkEntry.isEnabled) + + txtName = ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTxtName)) + txtName.setForeColor(color) + txtName.setStringW(displayName) + + txtInfo = ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(idTxtInfo)) + txtInfo.setForeColor(color) + txtInfo.setStringW(linkEntry.displayInfo) + + def IUpdateDeleteButton(self, idButton, enable): + if enable: + self.IShowEnableButton(idButton) + else: + self.IHideDisableButton(idButton) + + def IDisableLanguageControls(self): + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDEngText)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDFreText)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDGerText)).setString("") + for id in kLanguageControls.viewkeys(): + ptGUIControlButton(NexusGUI.dialog.getControlFromTag(id)).hide() + + def IToggleSortControls(self, enabled): + active = kSortControlId.get(self.publicHoodSort) + for id in kSortControlId.viewvalues(): + control = ptGUIControlButton(NexusGUI.dialog.getControlFromTag(id)) + if enabled and id == active: + control.show() + control.enable() + else: + control.hide() + control.disable() + + def ICancelLinkChoice(self): + self.IPushGetBookBtn() + self.idLinkSelected = None + self.ISetDescriptionText(U"") + + if self.presentedBookAls is not None: + self.IBookRetract() + + def IClearGUI(self): + # 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() + + self.IDisableLanguageControls() + self.IClearEntryList() + self.IToggleSortControls(False) + + # 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) + + self.ISetDescriptionText(U"") + + #highlight selected category + for (txtId, btnId) in kGUICategoryControls: + btn = ptGUIControlButton(NexusGUI.dialog.getControlFromTag(btnId)) + if self.idCategorySelected == btnId: + color = colorSelected + btn.disable() + else: + color = colorNormal + btn.enable() + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(txtId)).setForeColor(color) + + def IClearEntryList(self): + #reset scrolling + self.indexDisplayStart = 0 + + if self.idLinkSelected is not None and self.idLinkSelected != kIDBtnNeighborhoodSelect: + self.ICancelLinkChoice() + self.IHideDisableButton(kIDBtnScrollUp) + self.IHideDisableButton(kIDBtnScrollDn) + + for (btnSelectId, txtNameId, txtInfoId, btnDeleteId) in kGUILinkControls: + try: + del self.controlIdToAgeEntry[btnSelectId] + except KeyError: + pass + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(txtNameId)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(txtInfoId)).setString("") + + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(btnSelectId)).setNotifyOnInteresting(1) + + self.IHideDisableButton(btnSelectId) + self.IHideDisableButton(btnDeleteId) + + def IFormatGZCreateCoords(self, linkNode): + dniCoords = linkNode.getCreateAgeCoords() + if dniCoords is not None: + coords = (dniCoords.getTorans(), dniCoords.getHSpans(), dniCoords.getVSpans()) + else: + coords = (0, 0, 0) + return U"%05d% 04d% 04d" % coords + + def IDeleteLink(self): + if self.deleteCandidateId is None: + PtDebugPrint("nxusBookMachine.IDeleteLink(): Tried to delete nothing. Should not happen") + return + + vault = ptVault() + cityLink = vault.getLinkToCity() + linkInfo = self.controlIdToAgeEntry[self.deleteCandidateId].als + ageInfo = linkInfo.getAgeInfo() + #currently, we can only delete two types of entries: + #city entry points and age invites + if ageInfo.getAgeFilename() == 'city': + spawnPoint = linkInfo.getSpawnPoint() + PtDebugPrint("Deleting city link to %s:%s" % (spawnPoint.getName(), spawnPoint.getTitle())) + cityLink.removeSpawnPoint(spawnPoint) + cityLink.save() + + #we deleted selected link + if self.deleteCandidateId == self.idLinkSelected: + self.ICancelLinkChoice() + self.IUpdateLinks(kCategoryCity) + + if self.presentedBookAls is not None: + presentedAgeGuid = self.presentedBookAls.getAgeInfo().getAgeInstanceGuid() + presentedAgeSpawnName = self.presentedBookAls.getSpawnPoint().getName() + PtDebugPrint("Trying to delete city link (%s,%s)" % (presentedAgeGuid, presentedAgeSpawnName)) + if (presentedAgeGuid == ageInfo.getAgeInstanceGuid() and + presentedAgeSpawnName == spawnPoint.getName()): + self.IBookRetract() + else: + guid = ageInfo.getAgeInstanceGuid() + vault.unRegisterVisitAge(guid) + #if link was presented, it will be retracted on vault notify + + self.IUpdateLinks() + return + + def IDrawLinkPanel(self): + if self.presentedBookAls is None: + PtDebugPrint("nxusBookMachine.IDrawLinkPanel: trying to draw panel without selected book!") + else: + panelName = self.IGetLinkPanelName(self.presentedBookAls) + PtDebugPrint("drawing link panel: %s" % (panelName)) + for objPanel in objlistLinkPanels.value: + if objPanel.getName() == panelName: + objPanel.draw.enable() + else: + objPanel.draw.disable() + + def IChoosePublicInstances(self): + for (ageFilename, entry) in self.publicAges.iteritems(): + if entry.instances: + #instance with lowest population (minimal load ballancing, if multiple public instanes ever go back) + #minPop = min(entry.instances, key = lambda age: age.population) + #but for now, lets just stick to oldest instance (with lowest node id) + entry.selected = entry.instances[0] + else: + entry.selected = None + + ####################################### + # Methods for generating link list + ####################################### + + def IGetAeguraEntries(self): + vault = ptVault() + + playerCityLink = vault.getLinkToCity() #link saved in player's vault + publicCityData = self.publicAges['city'].selected #selected info for public city (AgeData) + + stringLinkInfo = self.IFormatGZCreateCoords(playerCityLink) + + spawnPoints = playerCityLink.getSpawnPoints() + for spawnPoint in spawnPoints: + displayName = spawnPoint.getTitle() + # Don't display spawn points that shouldn't be shown + if displayName in kHiddenCityLinks: + continue + + + if displayName == "Ferry Terminal": + canDelete = False + else: + canDelete = True + + newEntry = LinkListEntry(displayName, stringLinkInfo, U"", canDelete, None) + newEntry.setLinkStruct(publicCityData.ageInfo, spawnPoint) #create link to instance, set spawnPoint + yield newEntry + + def IUpdateCityLinksList(self): + self.IChoosePublicInstances() #make sure, that we selected prefered instances + + cityLinks = list() + for ageData in self.publicAges.itervalues(): + if ageData.selected is None or not ageData.linkVisible: + continue + + if ageData.maxPop == 0: + # maxPop == 0 means don't show it + description = U"" + else: + #check if selected instance is full + entryEnabled = (ageData.selected.population <= ageData.maxPop) + + #try to find translated description + try: + (textFull, textPopulation) = kPublicAgesDescription[ageData.ageFilename] + if entryEnabled: + description = PtGetLocalizedString(textPopulation, [str(ageData.selected.population), str(ageData.maxPop)]) + else: + description = PtGetLocalizedString(textFull) + except KeyError: + description = U"" + + #special case: Ae'gura multiple link points + if ageData.ageFilename == 'city': + for entry in self.IGetAeguraEntries(): + entry.description = description + entry.isEnabled = entryEnabled + cityLinks.append(entry) + continue + + #ptAgeInfoStruct for selected instance + selectedInfo = ageData.selected.ageInfo + + #special case: ugly hack for K'veer + if ageData.ageFilename == 'Kveer': + displayName = "K'veer" + #special case: and another one for GuildPub name + elif hasattr(ageData, 'guild'): + displayName = "The %s' Pub" % (ageData.guild) + else: + displayName = selectedInfo.getDisplayName() + + # just in case: no display name, use the filename + if not displayName: + PtDebugPrint("nxusBookMachine.IUpdateCityLinksList(): Empty display name for age '{}'".format(ageData.ageFilename)) + displayName = ageData.ageFilename + + #normal cases: just add link with default link spot + stringLinkInfo = U"%05d% 04d% 04d" %(0,0,0) #temporary consistency hack. fixme + newEntry = LinkListEntry(displayName, stringLinkInfo, description, False, entryEnabled) + newEntry.setLinkStruct(selectedInfo) #create link to instance, use default spawnPoint + cityLinks.append(newEntry) + + self.categoryLinksList[kCategoryCity] = cityLinks + + def IUpdatePublicLinksList(self): + sortedHoods = self.ISortPublicHoods(self.publicHoods, self.publicHoodSort) + + hoodLinks = list() + for hood in sortedHoods: + displayName = hood.ageInfo.getDisplayName() + stringLinkInfo = str(hood.population) #TODO: i10n + description = hood.ageInfo.getAgeDescription() + + newEntry = LinkListEntry(displayName, stringLinkInfo, description) + newEntry.setLinkStruct(hood.ageInfo) #create link to instance, use default spawnPoint + hoodLinks.append(newEntry) + + self.categoryLinksList[kCategoryPublic] = hoodLinks + + def IGetGZLinkNode(self): + childAgeFolder = self.IGetHoodInfoNode().getChildAgesFolder() + contents = childAgeFolder.getChildNodeRefList() + 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 IGetGZLinks(self): + if 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") + return + + GZLinkNode = self.IGetGZLinkNode() + if GZLinkNode is None: + PtDebugPrint("nxusBookMachine.IGetGZLinks:\tCouldn't find GZ link node, preventing it from showing") + elif self.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 + displayName = spawnPoint.getTitle() + stringLinkInfo = self.IFormatGZCreateCoords(GZLinkNode) + if 'default' in displayName.lower() or 'default' in spawnPoint.getName().lower(): + continue # we hide the default spawn point, since they don't want it showing in our list + else: + entry = LinkListEntry(displayName, stringLinkInfo) + entry.setChildAgeLinkStruct(GZLinkNode.getAgeInfo(), 'Neighborhood', spawnPoint) #create link to child age + yield entry + + def IUpdatePrivateLinksList(self): + vault = ptVault() + folder = vault.getAgesICanVisitFolder() + privateList = list(self.IGetAgesFromFolder(folder, kHiddenAgesIfInvited, True)) + self.categoryLinksList[kCategoryPrivate] = privateList + + + def IUpdatePersonalLinksList(self): + vault = ptVault() + + personalList = list() + if self.showGreatZero: + personalList.extend(self.IGetGZLinks()) + folder = vault.getAgesIOwnFolder() + personalList.extend(self.IGetAgesFromFolder(folder, kHiddenPersonalAges, False)) + self.categoryLinksList[kCategoryPersonal] = personalList + + def IGetAgesFromFolder(self, folder, hidden, private): + if folder is None: + PtDebugPrint("nxusBookMachine.IGetAgesFromFolder:\tlink folder type None") + return + + contents = folder.getChildNodeRefList() + for content in contents: + link = content.getChild() + link = link.upcastToAgeLinkNode() + if link is not None: + info = link.getAgeInfo() + else: + # it might be an AgeInfoNode + link = link.getChild() + info = link.upcastToAgeInfoNode() + + if info is None: + PtDebugPrint("nxusBookMachine: Can't find ageInfo from link", level = kErrorLevel) + continue + + if isinstance(link, ptVaultAgeLinkNode) and link.getVolatile(): + continue + + name = link.getAgeInfo().getAgeFilename() + + #remove hidden entries + if name in hidden: + PtDebugPrint("Removing link for " + name + " since it's in our hidden list") + continue + + #check, if default spawnPoint exists + #spawnPoints = link.getSpawnPoints() + #for spawnPoint in spawnPoints: + # if spawnPoint.getName().lower() == "linkinpointdefault": + # break + #else: + # if name.lower() != "greatzero": + # PtDebugPrint("Removing link for " + name + " since you don't have the default link-in point") + # continue # if it doesn't have the default link-in point, don't let it show + + displayName = info.getDisplayName() + + stringLinkInfo = self.IFormatGZCreateCoords(link) + + entry = LinkListEntry(displayName, stringLinkInfo, canDelete = private) + if private: + entry.setLinkStruct(info, spawnPoint = None, linkRule = PtLinkingRules.kVisitBook) + else: + #if (thisAge == "Ercana" or thisAge == "AhnonayCathedral" or thisAge == "Ahnonay") #do some crazy stuff + entry.setLinkStruct(info, spawnPoint = None, linkRule = PtLinkingRules.kOwnedBook) #create link to instance, use default spawnPoint + yield entry + + ####################################### + # GUI Updates + ####################################### + + def IShowCreateHoodControls(self): + if self.ICanCreateHood(): + self.IShowEnableButton(kIDBtnNeighborhoodCreate) + else: + self.IHideDisableButton(kIDBtnNeighborhoodCreate) + + self.IHideDisableButton(kIDBtnNeighborhoodPublic) + self.IHideDisableButton(kIDBtnNeighborhoodSelect) + + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodName)).setString("") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodInfo)).setString("") + self.ISetDescriptionText(U"") + + def IUpdateHoodLink(self): + hoodLink = self.IGetHoodLinkNode() + if hoodLink is None: + self.IShowCreateHoodControls() + return + + info = hoodLink.getAgeInfo() + if info is None or hoodLink.getVolatile(): + self.IShowCreateHoodControls() + return + + displayName = info.getDisplayName() + + description = Uni(info.getAgeDescription()) + infoTxt = self.IFormatGZCreateCoords(hoodLink) + self.IShowEnableButton(kIDBtnNeighborhoodPublic) + self.IShowEnableButton(kIDBtnNeighborhoodSelect) + + self.hoodEntry = LinkListEntry(displayName, infoTxt, description, True, True) + self.hoodEntry.setLinkStruct(info, spawnPoint = None, linkRule = PtLinkingRules.kOwnedBook) #create link to instance, use default spawnPoint + + self.IUpdateGuiEntry(kIDBtnNeighborhoodSelect, kIDTxtNeighborhoodName, kIDTxtNeighborhoodInfo, self.hoodEntry) + + if info.isPublic(): + hoodPubPriv = PtGetLocalizedString("Nexus.Neighborhood.MakePrivate") + else: + hoodPubPriv = PtGetLocalizedString("Nexus.Neighborhood.MakePublic") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDTxtNeighborhoodPublic)).setStringW(hoodPubPriv) + + def IUpdateGUILinkList(self): + if self.idCategorySelected == kCategoryPublic: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDNameHeaderText)).setStringW(PtGetLocalizedString("Nexus.Headers.Name")) + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDPopHeaderText)).setStringW(PtGetLocalizedString("Nexus.Headers.Population")) + # show our header sorting buttons + self.IShowEnableButton(kIDNameHeaderBtn) + self.IShowEnableButton(kIDPopHeaderBtn) + #show current sort direction + self.IToggleSortControls(True) + else: + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDNameHeaderText)).setStringW(U"") + ptGUIControlTextBox(NexusGUI.dialog.getControlFromTag(kIDPopHeaderText)).setStringW(U"") + self.IToggleSortControls(False) + + ageList = self.categoryLinksList[self.idCategorySelected] + + if not ageList: + return + + indexDisplayEnd = self.indexDisplayStart + min(len(ageList) - self.indexDisplayStart, kNumDisplayFields) + + if self.indexDisplayStart > 0: + self.IShowEnableButton(kIDBtnScrollUp) + else: + self.IHideDisableButton(kIDBtnScrollUp) + + if len(ageList) > indexDisplayEnd: + self.IShowEnableButton(kIDBtnScrollDn) + else: + self.IHideDisableButton(kIDBtnScrollDn) + + idTextbox = kIDTxtLinkNameFirst + for i in range(self.indexDisplayStart, indexDisplayEnd): + entry = ageList[i] + self.IUpdateGuiEntry(idButton = idTextbox - 1 , idTxtName = idTextbox, idTxtInfo = idTextbox + 1, + linkEntry = entry) + self.IShowEnableButton(idTextbox - 1) + self.IUpdateDeleteButton(idButton = idTextbox + 99, enable = entry.canDelete) + idTextbox += 10 + + def IUpdateLinks(self, categoryId = None): + if not PtIsDialogLoaded(kNexusDialogName): + PtDebugPrint("nxusBookMachine.IUpdateLinks: called without loaded dialog") + return + + #return, if we update list, that is currently not displayed (list will be updated on display) + if categoryId is not None and categoryId != self.idCategorySelected: + return + + if self.idCategorySelected == kCategoryCity: # city links + self.IUpdateCityLinksList() + elif self.idCategorySelected == kCategoryPrivate: # private links + self.IUpdatePrivateLinksList() + elif self.idCategorySelected == kCategoryPublic: # public links + self.IUpdatePublicLinksList() + else: + self.IUpdatePersonalLinksList() + + #assume that list have changed - clear it + self.IClearEntryList() + self.IUpdateGUILinkList() + + def IGetLinkPanelName(self, als): + filename = als.getAgeInfo().getAgeFilename() + PtDebugPrint("nxusBookMachine.getLinkPanelName(): Looking for link panel for '%s'" % filename) + try: + panels = kLinkPanels[filename] + linkName = als.getSpawnPoint().getName() + PtDebugPrint("nxusBookMachine.getLinkPanelName(): Found special case, trying for spawn point '%s'" % linkName) + try: + return panels[linkName] + except KeyError: + panel = panels[''] + PtDebugPrint("nxusBookMachine.getLinkPanelName(): Defaulting to '%s'" % panel) + return panel + except KeyError: + panel = U"LinkPanel_" + filename + PtDebugPrint("nxusBookMachine.getLinkPanelName(): Defaulting to '%s'" % panel) + return panel + + def IDoLink(self): + if self.presentedBookAls is None: + ptDebugPrint("nxusBookMachine.IDoLink(): Tried to link without chosen book. This Is Bad Thing (R)") + else: + linkMgr = ptNetLinkingMgr() + linkMgr.linkToAge(self.presentedBookAls) + + #TODO: Not revised. I'm not sure about this stuff... Is it needed? + def DoErcanaAndAhnonayStuff(self, panel): + PtDebugPrint("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): + PtDebugPrint("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 + PtDebugPrint("found pellet cave GUID: ", chron.getValue()) + return + + pelletCaveGUID = "" + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename("PelletBahroCave") + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + ageInfoNode = ageLinkNode.getAgeInfo() + pelletCaveGUID = ageInfoNode.getAgeInstanceGuid() + PtDebugPrint("found pelletCaveGUID age chron, = ", pelletCaveGUID) + + if not ageDataFolder: + PtDebugPrint("no ageDataFolder...") + ageStruct = ptAgeInfoStruct() + ageStruct.setAgeFilename(ageFileName) + ageLinkNode = vault.getOwnedAgeLink(ageStruct) + if ageLinkNode: + PtDebugPrint("got ageLinkNode, created AgeData folder") + ageInfoNode = ageLinkNode.getAgeInfo() + ageDataFolder = ptVaultFolderNode(0) + ageDataFolder.folderSetName("AgeData") + ageInfoNode.addNode(ageDataFolder) + + if not GUIDChronFound: + PtDebugPrint("creating PelletCave GUID chron") + newNode = ptVaultChronicleNode(0) + newNode.chronicleSetName("PelletCaveGUID") + newNode.chronicleSetValue(pelletCaveGUID) + ageDataFolder.addNode(newNode) + PtDebugPrint("created pelletCaveGUID age chron, = ", pelletCaveGUID) diff --git a/Scripts/Python/payiBahroSymbol.py b/Scripts/Python/payiBahroSymbol.py new file mode 100644 index 0000000000..e78ce90faf --- /dev/null +++ b/Scripts/Python/payiBahroSymbol.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("__init__payiBahroSymbol v.", version,".0") + + ########################### + def OnServerInitComplete(self): + timeIntoMasterAnim = PtGetAgeTimeOfDayPercent() * (DayFrameSize.value / 30.0) + PtDebugPrint("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/Scripts/Python/payiUrwinBrain.py b/Scripts/Python/payiUrwinBrain.py new file mode 100644 index 0000000000..4ef8d3f8c9 --- /dev/null +++ b/Scripts/Python/payiUrwinBrain.py @@ -0,0 +1,567 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 random + +# 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 + PtDebugPrint("__init__payiUrwinBrain v.", version,".0") + + ############################ + def OnFirstUpdate(self): + random.seed() + + ############################ + def OnServerInitComplete(self): + try: + ageSDL = PtGetAgeSDL() + except: + PtDebugPrint("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: + PtDebugPrint("payiUrwinBrain: It's been at least a day since the last update, running new numbers now.") + self.InitNewSDLVars() + else: + PtDebugPrint("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() + PtDebugPrint("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): + PtDebugPrint("Need to store event: %s" % (events[0][1])) + stackList.append(events[0][1]) + PtDebugPrint("New list is: %s" % (str(stackList))) + if len(stackList) == 1: + PtDebugPrint("List is only one command long, so I'm playing it") + code = stackList[0] + PtDebugPrint("Playing command: %s" % (code)) + self.ExecCode(code) + + elif state and self.sceneobject.isLocallyOwned() and ageSDL["UrwinOnTheProwl"][0]: + if id == respUrwinSfx.id: + PtDebugPrint("Callback was from Appearance SFX, and I own the age, so start walking") + self.StartToWalk() + + else: + PtDebugPrint("Callback was from responder, and I own the age, so Logic Time") + old = stackList.pop(0) + PtDebugPrint("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 = random.randint(minsteps, maxsteps) + PtDebugPrint("We should have steps, so Urwin has decided to take %d steps." % (StepsToTake)) + + StepsToTake = StepsToTake - 1 + if StepsToTake: + if random.randint(0,9): # 90% chance of continuing walk loop + PtDebugPrint("Urwin will take %d more steps..." % (StepsToTake)) + if random.randint(0,2): + PtDebugPrint("Urwin walks one way.") + self.SendNote("respUrwin_Walk_Loop01") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk01") + else: + PtDebugPrint("Urwin walks the other way.") + self.SendNote("respUrwin_Walk_Loop02") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk02") + + else: # 10% to Sniff + PtDebugPrint("Urwin smells something...") + self.SendNote("respUrwin_Walk_ToWalkSniff") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk2Sniff") + + else: + PtDebugPrint("Urwin is tired and stops walking") + self.SendNote("respUrwin_Walk_ToIdle") + 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 = random.randint(0,2) + if pct == 2: + PtDebugPrint("Urwin smells something good!") + self.SendNote("respUrwin_WalkSniff") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Sniff") + + elif pct == 1: + PtDebugPrint("Urwin found food!") + self.SendNote("respUrwin_WalkSniff_ToEat") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Sniff2Eat") + + else: + PtDebugPrint("Urwin says nevermind, back to walking.") + self.SendNote("respUrwin_WalkSniff_ToWalk") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Sniff2Walk") + + elif id == respUrwin_WalkSniff_ToEat.id or id == respUrwin_Idle_ToEat.id: + UrwinMasterAnim.animation.stop() + pct = random.randint(0,2) + if pct == 2: + PtDebugPrint("Urwin lost interest in the food.") + self.SendNote("respUrwin_Eat_ToIdle") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat2Idle") + + elif pct == 1: + PtDebugPrint("Urwin is still searching for the food.") + self.SendNote("respUrwin_Eat_ToWalkSniff") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat2Sniff") + + else: + PtDebugPrint("Urwin scoops up the food!") + self.SendNote("respUrwin_Eat_Scoop") + 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 = random.randint(0,4) + if pct == 4: + PtDebugPrint("Urwin scoops up the food!") + self.SendNote("respUrwin_Eat_Scoop") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Scoop") + + elif pct == 3: + PtDebugPrint("Urwin shakes the food!") + self.SendNote("respUrwin_Eat_Shake") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Shake") + + elif pct == 2: + PtDebugPrint("Urwin swallows the food!") + self.SendNote("respUrwin_Eat_Swallow") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Swallow") + + elif pct == 1: + PtDebugPrint("Urwin lost interest in the food.") + self.SendNote("respUrwin_Eat_ToIdle") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Eat2Idle") + + else: + PtDebugPrint("Urwin is still searching for the food.") + self.SendNote("respUrwin_Eat_ToWalkSniff") + 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 = random.randint(0,4) + if pct == 4: + PtDebugPrint("Urwin idles one way.") + self.SendNote("respUrwin_Idle_01") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle01") + + elif pct == 3: + PtDebugPrint("Urwin idles the other way.") + self.SendNote("respUrwin_Idle_02") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle02") + + elif pct == 2: + PtDebugPrint("Urwin calls home!") + self.SendNote("respUrwin_Idle_Vocalize") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Vocalize") + + elif pct == 1: + PtDebugPrint("Urwin gets hungry.") + self.SendNote("respUrwin_Idle_ToEat") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle2Eat") + + else: + PtDebugPrint("Urwin is done resting, back to walking.") + self.SendNote("respUrwin_Idle_ToWalk") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Idle2Walk") + + elif id == actUrwinPathEnd.id: + PtDebugPrint("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,21) and not self.sceneobject.isLocallyOwned(): + PtDebugPrint("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) + PtDebugPrint("Popping off: %s" % (old)) + if len(stackList): + PtDebugPrint("List has at least one item ready to play") + code = stackList[0] + PtDebugPrint("Playing command: %s" % (code)) + self.ExecCode(code) + + else: + PtDebugPrint("Callback from something else?") + + ############################ + def StartToWalk(self): + global StepsToTake + + ageSDL = PtGetAgeSDL() + boolBatteryChargedAndOn = ageSDL["payiPodLights"][0] + + StepsToTake = random.randint(minsteps, maxsteps) + PtDebugPrint("Urwin has decided to take %d steps." % (StepsToTake)) + + if random.randint(0,1): + self.SendNote("respUrwin_Walk_Loop01") + if boolBatteryChargedAndOn: + respUrwinSfx.run(self.key, state="Walk01") + else: + self.SendNote("respUrwin_Walk_Loop02") + 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: + PtDebugPrint("UrwinBrain.OnTimer: Time for the Urwin to return.") + ageSDL["UrwinOnTheProwl"] = (1,) + + if random.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: + PtDebugPrint("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 + #PtDebugPrint("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(random.randint(0,kFirstMorningSpawn)) + firstTime = int((randnum / 1000.0) * kDayLengthInSeconds) + beginningOfToday + PtDebugPrint("payiUrwinBrain: Generated a valid spawn time: %d" % (firstTime)) + spawnTimes = [firstTime] + + while isinstance(spawnTimes[-1], long): + randnum = random.randint(kMinimumTimeBetweenSpawns, kMaximumTimeBetweenSpawns) + newTime = spawnTimes[-1] + randnum + if newTime < endOfToday: + PtDebugPrint("payiUrwinBrain: Generated a valid spawn time: %d" % (newTime)) + spawnTimes.append(newTime) + else: + PtDebugPrint("payiUrwinBrain: Generated a spawn time after dusk, exiting loop: %d" % (newTime)) + break + else: + PtDebugPrint("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() + PtDebugPrint("timer: %d time: %d timeTillSpawn: %d" % (timer,PtGetDniTime(),timeTillSpawn)) + if timeTillSpawn > 0: + PtDebugPrint("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 + PtDebugPrint("payiUrwinBrain: Setting EndOfDay timer for %d seconds" % (timeLeftToday)) + PtAtTimeCallback(self.key, timeLeftToday, 2) + else: + PtDebugPrint("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(): + PtDebugPrint("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 isinstance(param, str): + newTimes = param.split(";") + kMinimumTimeBetweenSpawns = int(newTimes[0]) + kMaximumTimeBetweenSpawns = int(newTimes[1]) + kFirstMorningSpawn = 1 + self.InitNewSDLVars() + + def ExecCode(self, code): + global stackList + try: + if code.find("respUrwin") != -1: + chunks = code.split('_') + ecState = chunks[1] + if len(chunks) > 2: + ecAction = chunks[2] + else: + ecAction = "" + if ecState == "Idle": + if ecAction == "01": + respUrwin_Idle_01.run(self.key) + elif ecAction == "02": + respUrwin_Idle_02.run(self.key) + elif ecAction == "Vocalize": + respUrwin_Idle_Vocalize.run(self.key) + elif ecAction == "ToEat": + respUrwin_Idle_ToEat.run(self.key) + elif ecAction == "ToWalk": + respUrwin_Idle_ToWalk.run(self.key) + else: + PtDebugPrint("payiUrwinBrain.ExecCode(): ERROR! Invalid ecAction '%s'." % (ecAction)) + stackList.pop(0) + elif ecState == "Walk": + if ecAction == "Loop01": + respUrwin_Walk_Loop01.run(self.key) + elif ecAction == "Loop02": + respUrwin_Walk_Loop02.run(self.key) + elif ecAction == "ToWalkSniff": + respUrwin_Walk_ToWalkSniff.run(self.key) + elif ecAction == "ToIdle": + respUrwin_Walk_ToIdle.run(self.key) + else: + PtDebugPrint("payiUrwinBrain.ExecCode(): ERROR! Invalid ecAction '%s'." % (ecAction)) + stackList.pop(0) + elif ecState == "WalkSniff": + if ecAction == "ToEat": + respUrwin_WalkSniff_ToEat.run(self.key) + elif ecAction == "ToWalk": + respUrwin_WalkSniff_ToWalk.run(self.key) + else: + respUrwin_WalkSniff.run(self.key) + elif ecState == "Eat": + if ecAction == "ToIdle": + respUrwin_Eat_ToIdle.run(self.key) + elif ecAction == "ToWalkSniff": + respUrwin_Eat_ToWalkSniff.run(self.key) + elif ecAction == "Scoop": + respUrwin_Eat_Scoop.run(self.key) + elif ecAction == "Shake": + respUrwin_Eat_Shake.run(self.key) + elif ecAction == "Swallow": + respUrwin_Eat_Swallow.run(self.key) + else: + PtDebugPrint("payiUrwinBrain.ExecCode(): ERROR! Invalid ecAction '%s'." % (ecAction)) + stackList.pop(0) + else: + PtDebugPrint("payiUrwinBrain.ExecCode(): ERROR! Invalid ecState '%s'." % (ecState)) + stackList.pop(0) + else: + PtDebugPrint("payiUrwinBrain.ExecCode(): ERROR! Invalid code '%s'." % (code)) + stackList.pop(0) + except: + PtDebugPrint("payiUrwinBrain.ExecCode(): ERROR! Invalid code '%s'." % (code)) + stackList.pop(0) diff --git a/Scripts/Python/philBookshelf.py b/Scripts/Python/philBookshelf.py new file mode 100644 index 0000000000..27422d42de --- /dev/null +++ b/Scripts/Python/philBookshelf.py @@ -0,0 +1,208 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + minor = 1 + PtDebugPrint(('__init__philBookshelf v. %d.%d' % (self.version, minor))) + + + + def OnServerInitComplete(self): + global LocalAvatar + + respMoveShelf.run(self.key, state = "lower", fastforward = 1) + actBookshelfExit.disable() + + LocalAvatar = PtGetLocalAvatar() + + + def OnNotify(self,state,id,events): + boolLinkerIsMe = PtWasLocallyNotified(self.key) + PtDebugPrint(('philBookshelf.OnNotify(): state = %d, id = %d, me = %s' % (state, id, boolLinkerIsMe))) + + if id == actBookshelfExit.id: + self.IDisengageShelf(boolLinkerIsMe) + 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) + PtDebugPrint("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) + + # no linking book in MOUL but fix it anyway + elif ((id == respPresentBook.id) and boolLinkerIsMe): + 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(boolLinkerIsMe) + respLinkOut.run(self.key) + + elif event[1] == PtBookEventTypes.kNotifyHide: + PtDebugPrint("philBookshelf:Book: NotifyHide") + + respShelveBook.run(self.key) + + + def IDisengageShelf(self, boolLinkerIsMe = False): + PtDebugPrint(('philBookshelf.IDisengageShelf(): me = %s' % boolLinkerIsMe)) + actBookshelfExit.disable() + # fastforward removed because it disables netPropagate + respMoveShelf.run(self.key, state = "lower") + if boolLinkerIsMe: + 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() + PtGetControlEvents(False,self.key) + PtSendKIMessage(kEnableKIandBB,0) + + + + def OnControlKeyEvent(self,controlKey,activeFlag): + if controlKey == PlasmaControlKeys.kKeyExitMode or controlKey == PlasmaControlKeys.kKeyMoveBackward: + self.IDisengageShelf(True) + + + 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/Scripts/Python/plasma/Plasma.py b/Scripts/Python/plasma/Plasma.py new file mode 100644 index 0000000000..f37a3f3050 --- /dev/null +++ b/Scripts/Python/plasma/Plasma.py @@ -0,0 +1,9949 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +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 PtAvatarEnterAnimMode(animName): + """Enter a custom anim 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 PtAvatarExitAnimMode(animName): + """Exit custom anim 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 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 PtDebugPrint(*msgs, **kwargs): + """Prints msgs to the Python log given the message's level""" + 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 PtFlashWindow(): + """Flashes the client window if it is not focused""" + 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 PtGetNPCCount(): + """This will return the number of NPCs in the current age""" + pass + +def PtGetNPCByID(npcID): + """This will return the NPC with a specific ID""" + 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 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 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 loadClothingFromFile(self,filename): + """Load avatar clothing from a file""" + 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 runCoopAnim(self,targetKey,activeAvatarAnim,targetAvatarAnim,range=6,dist=3,move=1): + """Seek near another avatar and run animations on both.""" + pass + + def saveClothing(self): + """Saves the current clothing options (including morphs) to the vault""" + pass + + def saveClothingToFile(self,filename): + """Save avatar clothing to a file""" + 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 getSceneObject(self): + """Returns the ptSceneObject this brain controls.""" + 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 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 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 ptGameScore: + """Plasma Game Score""" + def __init__(self): + """None""" + pass + + def addPoints(self, points, key=None): + """Adds points to the score""" + pass + + @staticmethod + def createAgeScore(scoreName, type, points=0, key=None): + """Creates a new score associated with this age""" + pass + + @staticmethod + def createGlobalScore(scoreName, type, points=0, key=None): + """Creates a new global score""" + pass + + @staticmethod + def createPlayerScore(scoreName, type, points=0, key=None): + """Creates a new score associated with this player""" + pass + + @staticmethod + def createScore(ownerID, scoreName, type, points=0, key=None): + """Creates a new score for an arbitrary owner""" + pass + + @staticmethod + def findAgeScores(scoreName, key): + """Finds matching scores for this age""" + pass + + @staticmethod + def findAgeHighScores(name, maxScores, key): + """Finds the highest matching scores for the current age's owners""" + pass + + @staticmethod + def findGlobalScores(scoreName, key): + """Finds matching global scores""" + pass + + @staticmethod + def findGlobalHighScores(name, maxScores, key): + """Finds the highest matching scores""" + pass + + @staticmethod + def findPlayerScores(scoreName, key): + """Finds matching player scores""" + pass + + @staticmethod + def findScores(ownerID, scoreName, key): + """Finds matching scores for an arbitrary owner""" + pass + + def getGameType(self): + """Returns the score game type.""" + pass + + def getName(self): + """Returns the score game name.""" + pass + + def getOwnerID(self): + """Returns the score game owner.""" + pass + + def getPoints(self): + """Returns the number of points in this score""" + pass + + def remove(self): + """Removes this score from the server""" + pass + + def setPoints(self): + """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, points=0, key=None): + """Transfers points from this score to another""" + pass + +class ptGameScoreMsg: + """Game Score operation callback message""" + def __init__(self): + """None""" + pass + +class ptGameScoreListMsg(ptGameScoreMsg): + """Game Score message for scores found on the server""" + def __init__(self): + """None""" + pass + + def getName(self): + """Returns the template score name""" + pass + + def getOwnerID(self): + """Returns the template score ownerID""" + pass + + def getScores(self): + """Returns a list of scores found by the server""" + pass + +class ptGameScoreTransferMsg(ptGameScoreMsg): + """Game Score message indicating a score point transfer""" + def __init__(self): + """None""" + pass + + def getDestination(self): + """Returns the score points were transferred to""" + pass + + def getSource(self): + """Returns the score points were transferred from""" + pass + +class ptGameScoreUpdateMsg(ptGameScoreMsg): + """Game Score message for a score update operation""" + def __init__(self): + """None""" + pass + + def getScore(self): + """Returns the updated game score""" + 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 beginUpdate(self): + """Signifies that the control will be updated heavily starting now, so suppress all redraws""" + + 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 endUpdate(self, redraw=True): + """Signifies that the massive updates are over. We can now redraw.""" + 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 getScrollPosition(self): + """Returns what line is the top line.""" + 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 isAtEnd(self): + """Returns whether the cursor is at the end.""" + 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 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 +Method will try to pick appropriate variable type +This event record is used to pass a number variable to another python program""" + pass + + def addVarFloat(self,name,number): + """Add a float variable event record to the Notify message +This event record is used to pass a number variable to another python program""" + pass + + def addVarInt(self,name,number): + """Add a integer variable event record to the Notify message +This event record is used to pass a number variable to another python program""" + pass + + def addVarNull(self,name): + """Add a null (no data) 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 getPlayerNameW(self): + """Returns the name of the player as Unicode""" + 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 + + def volumeSensorNoArbitration(self, noArbitration): + """Tells the volume sensor attached to this object whether or not to negotiate exclusive locks with the server.""" + 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 isUsed(self): + """Is this variable used?""" + 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 getAllPlayersFolder(self): + """Returns a ptVaultPlayerInfoListNode of the all players folder.""" + 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 getReward(self): + """Returns a string representing the reward for completing this game""" + 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 setReward(self,reward): + """Sets the reward for completing this marker game""" + 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/Scripts/Python/plasma/PlasmaConstants.py b/Scripts/Python/plasma/PlasmaConstants.py new file mode 100644 index 0000000000..f1e9d99089 --- /dev/null +++ b/Scripts/Python/plasma/PlasmaConstants.py @@ -0,0 +1,281 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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 PtFontFlags: + """(none)""" + kFontBold = 1 + kFontItalic = 2 + kFontShadowed = 4 + +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 + diff --git a/Scripts/Python/plasma/PlasmaControlKeys.py b/Scripts/Python/plasma/PlasmaControlKeys.py new file mode 100644 index 0000000000..fb64e8bd75 --- /dev/null +++ b/Scripts/Python/plasma/PlasmaControlKeys.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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 diff --git a/Scripts/Python/plasma/PlasmaKITypes.py b/Scripts/Python/plasma/PlasmaKITypes.py new file mode 100644 index 0000000000..f5f751ac60 --- /dev/null +++ b/Scripts/Python/plasma/PlasmaKITypes.py @@ -0,0 +1,320 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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 +kKIShowOptionsMenu=31 # show the options menu 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 Unused KI level. +kMicroKI = 1 +kNormalKI = 2 +kLowestKILevel = kMicroKI +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 entry is not 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 kMicroKI + +def PtDetermineCensorLevel(): + "Get the KILevel" + # assume that they have none... + import Plasma + import string + vault = Plasma.ptVault() + entry = vault.findChronicleEntry(kChronicleCensorLevel) + if entry is not 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 entry is not None: + level = string.atoi(entry.chronicleGetValue()) + return level + # if couldn't be determine... just assume lowest form + return kKIMarkerNotUpgraded + + +def PtAmPlayingCGZM(): + chron = PtGetMarkerGameChronicle() + if chron is None: + return False + return chron.getValue() == "cgz" + +def PtFindCreateMarkerChronicle(name, subchron=None, default=None): + import Plasma + def _GetChron(needle, haystack): + for i in haystack.getChildNodeRefList(): + child = i.getChild().upcastToChronicleNode() + if child is None: + continue + if child.getName() == needle: + return child + else: + chron = Plasma.ptVaultChronicleNode() + chron.setName(needle) + if default is not None: + chron.setValue(str(default)) + haystack.addNode(chron) + return chron + + chron = _GetChron(name, PtGetMarkerGameChronicle()) + if subchron is None: + return chron + return _GetChron(subchron, chron) + +def PtGetCGZM(): + chron = PtFindCreateMarkerChronicle("CGZ-Mission") + mission = chron.getValue() + if mission: + return int(mission) + return -1 + +def PtGetCGZStartTime(): + chron = PtFindCreateMarkerChronicle("CGZ-StartTime") + time = chron.getValue() + if time: + return int(time) + return 0 + +def PtGetMarkerQuestCaptures(name): + chron = PtFindCreateMarkerChronicle("Quest", name) + caps = chron.getValue().split(',') + if caps: + return { int(i): True for i in caps if i.isdigit() } + else: + return {} + +def PtGetMarkerGameChronicle(): + import Plasma + vault = Plasma.ptVault() + chron = vault.findChronicleEntry("MarkerBrain") + if chron is None: + vault.addChronicleEntry("MarkerBrain", 0, "") + return vault.findChronicleEntry("MarkerBrain") + return chron + +def PtGetTimePlayingCGZ(): + import Plasma + return Plasma.PtGetServerTime() - PtGetCGZStartTime() + +def PtIsCGZMComplete(): + if PtAmPlayingCGZM(): + captures = PtGetMarkerQuestCaptures("cgz") + if not captures: + return False + for i in captures.itervalues(): + if not i: + return False + return True + else: + return False + +def PtSetCGZM(mission): + chron = PtGetMarkerGameChronicle() + chron.setValue("" if mission == -1 else "cgz") + chron.save() + + chron = PtFindCreateMarkerChronicle("CGZ-Mission") + chron.setValue(str(mission)) + chron.save() + +def PtSetMarkerQuestCaptures(name, captures): + chron = PtFindCreateMarkerChronicle("Quest", name) + if captures: + chron.setValue(','.join(( str(key) for key, value in captures.iteritems() if value ))) + else: + chron.setValue("") + chron.save() + +def PtUpdateCGZStartTime(time=None): + chron = PtFindCreateMarkerChronicle("CGZ-StartTime") + if time is None: + import Plasma + time = Plasma.PtGetServerTime() + chron.setValue(str(time)) + chron.save() + +# OnRTChat flags (see pfKIMsg.h) +kRTChatPrivate = 0x01 +kRTChatAdmin = 0x02 +kRTChatPrivateAdmin= kRTChatPrivate | kRTChatAdmin +kRTChatGlobal = 0x04 +kRTChatInterAge = 0x08 +kRTChatStatusMsg = 0x10 +kRTChatNeighborsMsg = 0x20 + +# flags channel mask +kRTChatFlagMask = 65535 +kRTChatChannelMask = 65280 +kRTChatNoChannel = 255 + +# OnCCRMsg flags +kCCRBeginCommunication=1 +kCCRChat=2 +kCCREndCommunication=3 +kCCRReturnChatMsg=4 diff --git a/Scripts/Python/plasma/PlasmaNetConstants.py b/Scripts/Python/plasma/PlasmaNetConstants.py new file mode 100644 index 0000000000..d969c770cc --- /dev/null +++ b/Scripts/Python/plasma/PlasmaNetConstants.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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 + diff --git a/Scripts/Python/plasma/PlasmaTypes.py b/Scripts/Python/plasma/PlasmaTypes.py new file mode 100644 index 0000000000..b411b3a27d --- /dev/null +++ b/Scripts/Python/plasma/PlasmaTypes.py @@ -0,0 +1,903 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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 +#################################### + +# 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 +kSpecialAction = 8 # special action ( kEditBox tab press) +kMessageHistoryUp = 9 # chat history up key pressed +kMessageHistoryDown = 10 # chat history down key pressed + +# 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 + +kRandomExcludeClothing = ["Icon","Suit","DniHelmet","DniFace","Atrus","Catherine","Santa","PattysHat"] + +kRandomHairColors = [ptColor(0,0,0),ptColor(1,1,1), + ptColor(0.46,0.15,0.15),ptColor(0.60,0.25,0.11), + ptColor(0.48,0.22,0.12),ptColor(0.68,0.37,0.15), + ptColor(0.98,0.81,0.58),ptColor(0.5,0.5,0.5)] +kRandomSkinColors = [ptColor(0.94,0.83,0.64),ptColor(0.94,0.77,0.59), + ptColor(0.88,0.66,0.49),ptColor(0.61,0.41,0.31), + ptColor(0.26,0.18,0.14)] +kRandomPantColors = [ptColor(0,0.27,0.74),ptColor(0.53,0.75,1), + ptColor(0.85,1,0.57),ptColor(0.38,0.16,0)] + +#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 PtGetObjectName(obj): + "Given a ptSceneobject, return its name" + if isinstance(obj,ptSceneobject): + if obj.getKey() is not 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 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: + PtDebugPrint("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" + 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 + +def PtWearRandomOutfit(avatar, seed=None): + """Randomizes avatar's outfit. seed is a hashable object, used to initalize the random number generator. +If seed is None, the system time is used.""" + import random + random.seed(seed) + + Hair = avatar.avatar.getClosetClothingList(kHairClothingItem) + Shirt = avatar.avatar.getClosetClothingList(kShirtClothingItem) + Pants = avatar.avatar.getClosetClothingList(kPantsClothingItem) + Shoes = avatar.avatar.getClosetClothingList(kLeftFootClothingItem) + Acc = avatar.avatar.getClosetClothingList(kAccessoryClothingItem) + + for group in Hair,Shirt,Pants,Shoes,Acc: + r = [] + for item in group: + for ex in kRandomExcludeClothing: + if(item[0].find(ex) >= 0): + r.append(item) + break + for item in r: + group.pop(group.index(item)) + + a = random.randint(0,len(Hair)-1) + hItem = Hair[a][0] + a = random.randint(0,len(Shirt)-1) + sItem = Shirt[a][0] + a = random.randint(0,len(Pants)-1) + pItem = Pants[a][0] + a = random.randint(0,len(Shoes)-1) + shItem = Shoes[a][0] + match = avatar.avatar.getMatchingClothingItem(shItem) + a = random.randint(0,len(Acc)-1) + aItem = Acc[a][0] + + avatar.avatar.wearClothingItem(hItem) + avatar.avatar.wearClothingItem(sItem) + avatar.avatar.wearClothingItem(pItem) + avatar.avatar.wearClothingItem(shItem) + avatar.avatar.wearClothingItem(match[0]) + avatar.avatar.wearClothingItem(aItem) + + a = random.randint(0,len(kRandomHairColors)-1) + hColor = kRandomHairColors[a] + a = random.randint(0,len(kRandomSkinColors)-1) + fColor = kRandomSkinColors[a] + a = random.randint(0,len(kRandomPantColors)-1) + pColor = kRandomPantColors[a] + sColor = ptColor(random.randint(0,255)/255.,random.randint(0,255)/255.,random.randint(0,255)/255.) + + avatar.avatar.tintSkin(fColor) + avatar.avatar.tintClothingItem(hItem,hColor) + avatar.avatar.tintClothingItem(sItem,sColor) + avatar.avatar.tintClothingItem(pItem,pColor) + + morph = 2*random.random() - 1 + + if (avatar.avatar.getAvatarClothingGroup() == kMaleClothingGroup): + avatar.avatar.setMorph("MFace",0,morph) + else: + avatar.avatar.setMorph("FFace",0,morph) + +#################################### +# Exceptions +#################################### +class ptResponderStateError(Exception): + def __init__(self,args=None): + Exception.__init__(self, 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 isinstance(self.byObject, dict): + 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 objectName is not None and self.byObject is not None: + pkey = self.byObject[objectName] + if self.netForce: + pkey.netForce(1) + pkey.enable() + elif isinstance(self.value, list): + 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 objectName is not None and self.byObject is not None: + pkey = self.byObject[objectName] + if self.netForce: + pkey.netForce(1) + pkey.disable() + elif isinstance(self.value, list): + 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 isinstance(self.byObject, dict): + 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) + def volumeSensorNoArbitration(self, noArbitration=True): + for key in self.value: + key.getSceneObject().volumeSensorNoArbitration(noArbitration) + +# 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,netPropagate=1): + ptAttributeKeyList.__init__(self,id,name,byObject,netForce) + self.state_list = statelist + self.netPropagate = netPropagate + def getdef(self): + return (self.id,self.name,9) + def run(self,key,state=None,events=None,avatar=None,objectName=None,netForce=0,netPropagate=None,fastforward=0): + # has the value been set? + if self.value is not None: + nt = ptNotify(key) + nt.clearReceivers() + # see if the value is a list or byObject or a single + if objectName is not None and self.byObject is not None: + nt.addReceiver(self.byObject[objectName]) + elif isinstance(self.value, list): + for resp in self.value: + nt.addReceiver(resp) + else: + nt.addReceiver(self.value) + if netPropagate is None: + nt.netPropagate(self.netPropagate) + else: + nt.netPropagate(netPropagate) + if netForce or self.netForce: + nt.netForce(1) + # see if the state is specified + if isinstance(state, int): + raise ptResponderStateError("Specifying state as a number is no longer supported") + elif isinstance(state, str): + if self.state_list is not 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 events is not None: + PtAddEvents(nt,events) + if avatar is not 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=None): + # has the value been set? + if self.value is not None: + nt = ptNotify(key) + nt.clearReceivers() + # see if the value is a list or byObject or a single + if objectName is not None and self.byObject is not None: + nt.addReceiver(self.byObject[objectName]) + elif isinstance(self.value, list): + for resp in self.value: + nt.addReceiver(resp) + else: + nt.addReceiver(self.value) + if netPropagate is None: + nt.netPropagate(self.netPropagate) + else: + nt.netPropagate(netPropagate) + if netForce or self.netForce: + nt.netForce(1) + # see if the state is specified + if isinstance(state, int): + raise ptResponderStateError("Specifying state as a number is no longer supported") + elif isinstance(state, str): + if self.state_list is not 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 (self.value is not None): + if isinstance(self.value, list): + 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 self.value is not None: + PtExcludeRegionSet(sender,self.value,kExRegClear) + def release(self,sender): + if self.value is not 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 self.value is not None: + PtExcludeRegionSetNow(sender,self.value,kExRegClear) + def releaseNow(self,sender): + if self.value is not 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 isinstance(value, str): + 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.viewvalues(): + 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 self.value is not 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 self.value is not 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 self.value is not 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 self.value is not 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 self.value is not 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 self.animation is 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 isinstance(self.byObject, dict): + 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/Scripts/Python/plasma/PlasmaVaultConstants.py b/Scripts/Python/plasma/PlasmaVaultConstants.py new file mode 100644 index 0000000000..85970a17f2 --- /dev/null +++ b/Scripts/Python/plasma/PlasmaVaultConstants.py @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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 + diff --git a/Scripts/Python/plasma/glue.py b/Scripts/Python/plasma/glue.py new file mode 100644 index 0000000000..9cf5440ffa --- /dev/null +++ b/Scripts/Python/plasma/glue.py @@ -0,0 +1,225 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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 = globals()[glue_name] + if issubclass(cl,ptModifier): + glue_cl = cl + else: + if glue_verbose: + PtDebugPrint("Class %s is not derived from modifier" % (cl.__name__)) + except: + if glue_verbose: + try: + PtDebugPrint("Could not find class %s" % (glue_name)) + except NameError: + PtDebugPrint("Filename/classname not set!") + return glue_cl +def glue_getInst(): + global glue_inst + if glue_inst is 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 glue_inst is not 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 obj.id in glue_params: + if glue_verbose: + PtDebugPrint("WARNING: Duplicate attribute ids!") + PtDebugPrint("%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 isinstance(obj, list): + for o in obj: + glue_findAndAddAttribs(o, glue_params) + elif isinstance(obj, dict): + for o in obj.viewvalues(): + glue_findAndAddAttribs(o, glue_params) + elif isinstance(obj, tuple): + for o in obj: + glue_findAndAddAttribs(o, glue_params) + +def glue_getParamDict(): + global glue_params + global glue_paramKeys + if glue_params is None: + glue_params = {} + gd = globals() + for obj in gd.viewvalues(): + 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: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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 isinstance(glue_paramKeys, list): + if number >= 0 and number < len(glue_paramKeys): + return pd[glue_paramKeys[number]].getdef() + else: + PtDebugPrint("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: + PtDebugPrint("glue_getParam: Error! %d out of range of attribute list" % (number)) + if glue_verbose: + PtDebugPrint("GLUE: Attribute list error") + return None +def glue_setParam(id,value): + pd = glue_getParamDict() + if pd != None: + if id in pd: + # 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 not isinstance(pd[id].value, list): + 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: + PtDebugPrint("setParam: can't find id=",id) + else: + PtDebugPrint("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: + PtDebugPrint("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 isinstance(glue_paramKeys, list): + if number >= 0 and number < len(glue_paramKeys): + return pd[glue_paramKeys[number]].getVisInfo() + else: + PtDebugPrint("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: + PtDebugPrint("glue_getVisInfo: Error! %d out of range of attribute list" % (number)) + if glue_verbose: + PtDebugPrint("GLUE: Attribute list error") + return None diff --git a/Scripts/Python/plasma/pch.py b/Scripts/Python/plasma/pch.py new file mode 100644 index 0000000000..acb600e4d8 --- /dev/null +++ b/Scripts/Python/plasma/pch.py @@ -0,0 +1,303 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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.viewkeys(): + 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 idx is None: + idx = __sel + elif isinstance(idx, str): + # 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__.viewkeys(): + 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 id is None: + id = __selattr + for name in __pmods[__sel][1].__dict__.viewkeys(): + 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__.viewkeys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptAttribute): + if __selattr == ist.id: + if ist.value is None or isinstance(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__.viewkeys(): + 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 not isinstance(ist, type(sys)) and not isinstance(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 name not in __pmods[__sel][1].__dict__: + 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__.viewkeys(): + 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__.viewkeys(): + 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__.viewkeys(): + 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__.viewkeys(): + 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.__code__.co_argcount): + args += mist.__code__.co_varnames[i] + if i+1 < mist.__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.__code__.co_varnames[:f.__code__.co_argcount]: + argstr += arg + argcount += 1 + if argcount < f.__code__.co_argcount: + argstr += "," + argstr += ")" + print("%s%s" % (f.__name__,argstr)) + print(" Doc:",f.__doc__) + decompyle.decompyle(f.__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__.viewkeys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptModifier): + # first see if there is already a glabal by that name + if vname not in ist.__dict__: + 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__.viewkeys(): + ist = __pmods[__sel][1].__dict__[name] + if isinstance(ist,PlasmaTypes.ptModifier): + return ist.__dict__[vname] diff --git a/Scripts/Python/plasma/ptWordFilter.py b/Scripts/Python/plasma/ptWordFilter.py new file mode 100644 index 0000000000..29d55b643a --- /dev/null +++ b/Scripts/Python/plasma/ptWordFilter.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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 diff --git a/Scripts/Python/psnlBahroPoles.py b/Scripts/Python/psnlBahroPoles.py new file mode 100644 index 0000000000..8b729156e2 --- /dev/null +++ b/Scripts/Python/psnlBahroPoles.py @@ -0,0 +1,1269 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + +# 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 + + + PtDebugPrint("DEBUG: psnlBahroPoles.OnServerInitComplete():\tEverything ok so far") + + ageVault = ptAgeVault() + if ageVault is not 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] + PtDebugPrint("psnlBahroPoles.OnServerInitComplete(): boolCleftSolved = ",boolCleftSolved) + except: + PtDebugPrint("ERROR: psnlBahroPoles.OnServerInitComplete():\tNo SDL for boolCleftSolved, using 0") + + if not boolCleftSolved: + vault = ptVault() + if ptVault().amOwnerOfCurrentAge(): + entry = vault.findChronicleEntry("CleftSolved") + if entry is not None: + if entry.chronicleGetValue() == "yes": + boolCleftSolved = 1 + ageSDL["psnlCleftSolved"] = (1,) + + if boolCleftTotem: + if boolCleftSolved: + ageSDL[sdlCleftTotem.value] = (0,) + PtDebugPrint("psnlBahroPoles.OnServerInitComplete(): Cleft totem was open but Cleft is solved, setting SDL to closed") + else: + PtDebugPrint("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: + PtDebugPrint("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: + PtDebugPrint("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) + PtDebugPrint("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: + PtDebugPrint("psnlBahroPoles.OnSDLNotify(): now opening Cleft totem...") + respChangeCleftTotem.run(self.key,state="open") + #PtAtTimeCallback(self.key,10.7,kTimerCleftTotemClk) + else: + PtDebugPrint("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: + PtDebugPrint("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) ) + PtDebugPrint("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: + PtDebugPrint("psnlBahroPoles.OnNotify(): touch responder done, but have no JCs so no glow") + PtAtTimeCallback(self.key,1,kTimerCleftTotemClk) + else: + PtDebugPrint("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) + PtDebugPrint("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): + PtDebugPrint("psnlBahroPoles.UpdatePoleStates()") + try: + #ageSDL = PtGetAgeSDL() + ageSDL = xPsnlVaultSDL(1) + + if ageSDL is not 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): + PtDebugPrint("psnlBahroPoles.SetCurrentState()") + #ageSDL = PtGetAgeSDL() + ageSDL = xPsnlVaultSDL(1) + + ageSDL[age + "PoleState"] = (state, ) + + + def GetJCProgress(self, age): + if age == "Garden": + age = "Eder" + + vault = ptVault() + + chron = vault.findChronicleEntry("JourneyClothProgress") + + if chron is not 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): + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("psnlBahroPoles.PostOneShot()") + vault = ptVault() + IamOwner = vault.amOwnerOfCurrentAge() + + PtDebugPrint("Oneshot finished on age %s" % age) + + if 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.viewkeys(): + val = self.Poles[var]["State"] + PtDebugPrint(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() + + chron = vault.findChronicleEntry("JourneyClothProgress") + + if chron is not 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): + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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): + PtDebugPrint("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: + PtDebugPrint("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 entry is 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 entry is None: + #PtDebugPrint("DEBUG: psnlBahroPoles.OnServerInitComplete: Did not find BahroCave chronicle...creating") + vault.addChronicleEntry("BahroCave",0,"0") + + agelist = ["Teledahn", "Garden", "Garrison", "Kadish"] + PtDebugPrint("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) + PtDebugPrint("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)) + PtDebugPrint("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): + PtDebugPrint("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) + + PtDebugPrint("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/Scripts/Python/psnlBookshelf.py b/Scripts/Python/psnlBookshelf.py new file mode 100644 index 0000000000..7faf8e2460 --- /dev/null +++ b/Scripts/Python/psnlBookshelf.py @@ -0,0 +1,1962 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 * + +# 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 + PtDebugPrint("__init__psnlBookshelf v.", version) + + + 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 = not PtGetPlayerList() + + 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() + PtDebugPrint("psnlBookshelf.Load():\tShelfABoolOperated=%d, disabling shelf clickable" % ShelfABoolOperated) + else: + PtDebugPrint("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]: + PtDebugPrint("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: + PtDebugPrint("psnlBookshelf: kVaultConnected event") + # tupdata is () + #~ pass + elif event == PtVaultCallbackTypes.kVaultNodeSaved: + PtDebugPrint("psnlBookshelf.OnAgeVaultEvent()\t: kVaultNodeSaved event (id=%d,type=%d)" % (tupdata[0].getID(),tupdata[0].getType())) + # tupdata is ( ptVaultNode ) + #~ pass + elif event == PtVaultCallbackTypes.kVaultNodeRefAdded: + PtDebugPrint("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: + PtDebugPrint("psnlBookshelf.OnAgeVaultEvent()\t: kVaultRemovingNodeRef event (childID=%d,parentID=%d)" % (tupdata[0].getChildID(),tupdata[0].getParentID())) + # tupdata is ( ptVaultNodeRef ) + #~ pass + elif event == PtVaultCallbackTypes.kVaultNodeRefRemoved: + PtDebugPrint("psnlBookshelf.OnAgeVaultEvent()\t: kVaultNodeRefRemoved event (childID,parentID) ",tupdata) + # tupdata is ( childID, parentID ) + #~ pass + elif event == PtVaultCallbackTypes.kVaultNodeInitialized: + PtDebugPrint("psnlBookshelf.OnAgeVaultEvent()\t: kVaultNodeInitialized event (id=%d,type=%d)", (tupdata[0].getID(),tupdata[0].getType())) + # tupdata is ( ptVaultNode ) + #~ pass + elif event == PtVaultCallbackTypes.kVaultOperationFailed: + PtDebugPrint("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 ageSDL is not 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 + + #~ PtDebugPrint("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) + PtDebugPrint("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()) +## #~ PtDebugPrint("psnlBookshelf.OnNotify: Avatar %s walked away from the shelf." % (AvatarWhoWalkedAway)) +## +## if AgeStartedIn == PtGetAgeName(): +## ageSDL = PtGetAgeSDL() +## CurrentBookshelfUser = ageSDL["ShelfAUserID"][0] +## #~ PtDebugPrint("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()) +## +## #~ PtDebugPrint("I think my ID is: ", myID) +## +## if myID == AvatarWhoWalkedAway: +## PtDebugPrint("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: + PtDebugPrint("psnlBookshelf: Received a message from the Book GUI: ", event[1]) + if event[1] == "IShelveBook" and objBookPicked is not 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") + if event[3] < 0: #legacy check (if > 0 then it's from old code and, therefore, not ours) + self.IShelveBook() + + avatar = PtGetLocalAvatar() + #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] + + PtDebugPrint("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': + PtDebugPrint("psnlBookShelf: Notified about bookshelf use.") + boolShelfInUse = events[0][3] + else: + for event in events: + if event[0] == kVariableEvent: + PtDebugPrint(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 + PtDebugPrint("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.viewitems(): + 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) + PtDebugPrint("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.viewitems(): + 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) + PtDebugPrint("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 + PtDebugPrint("psnlBookshelf: disabling clickable") + PtDebugPrint("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 + PtDebugPrint("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() + PtDebugPrint("psnlBookshelf.OnNotify():\tplayer picked book named ", bookName) + try: + index = objLibrary.value.index(objBookPicked) + except: + PtDebugPrint("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 ( citylinklocked is None or citylinklocked) and ( bcolinklocked is 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.viewitems(): + 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.viewitems(): + 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.viewitems(): + 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.viewitems(): + 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() + # Do not use the age link node of a Hood child age for the city book clasp! + if IsChildLink: + link = self.GetOwnedAgeLink(ptAgeVault(), "city") + if link is None: + return + if not isinstance(link, 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.viewitems(): + 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.viewitems(): + 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 objBookPicked is not 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 ( citylinklocked is None or citylinklocked) and ( bcolinklocked is None or bcolinklocked): + lockName = objLockPicked.getName() + # find the corresponding responder modifier + for rkey,rvalue in respCloseLock.byObject.viewitems(): + 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() + # Do not use the age link node of a Hood child age for the city book clasp! + if IsChildLink: + link = self.GetOwnedAgeLink(ptAgeVault(), "city") + if link is None: + return + + if 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() + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to locked: ",lockName) + for rkey,rvalue in respCloseLock.byObject.viewitems(): + 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 isinstance(link, ptAgeLinkStruct) or link.getLocked(): #close the clasp + lockName = objLockPicked.getName() + # find the corresponding responder modifier + for rkey,rvalue in respCloseLock.byObject.viewitems(): + 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: + PtDebugPrint("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 ( citylinklocked is None or citylinklocked) and ( bcolinklocked is None or bcolinklocked): + for rkey,rvalue in respOpenLock.byObject.viewitems(): + 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.viewitems(): + 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() + # Do not use the age link node of a Hood child age for the city book clasp! + if IsChildLink: + link = self.GetOwnedAgeLink(ptAgeVault(), "city") + if link is None: + return + lockName = objLockPicked.getName() + + if 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 + + PtDebugPrint(locked) + if locked: + # find the corresponding open clasp responder modifier + for rkey,rvalue in respOpenLock.byObject.viewitems(): + 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() ): + PtDebugPrint("setting lock to 0") + chron.setValue("0") + else: + # find the corresponding close clasp responder modifier + for rkey,rvalue in respCloseLock.byObject.viewitems(): + 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() ): + PtDebugPrint("setting lock to 1") + chron.setValue("1") + + if not vault.inMyPersonalAge(): + stupidHackForLock = not stupidHackForLock + + return + + if not isinstance(link, ptVaultAgeLinkNode): + self.IUpdateLinks() + return + if link.getLocked(): + # find the corresponding open clasp responder modifier + for rkey,rvalue in respOpenLock.byObject.viewitems(): + 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.viewitems(): + 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.viewitems(): + 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: + PtDebugPrint("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 + PtDebugPrint("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.viewitems(): + 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.viewitems(): + parent = rvalue.getParentKey() + if parent: + if bookName == parent.getName(): + respReturnTray.run(self.key,objectName=rkey) + break + objBookPicked = None + elif vault.inMyPersonalAge(): + if bookAge == "Neighborhood": + 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.viewitems(): +## 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 + + # better set this to 0 by default now that we're using it to correct the city book clasp + IsChildLink = 0 + + + ageName = self.IGetAgeFromBook() + PtDebugPrint("psnlBookshelf.IGetLinkFromBook(): before city lookup, ageName = ",ageName) + + isCityLink = 0 + if ageName == "city": + isCityLink = 1 + for age, splist in CityBookAges.viewitems(): + if spTitle in splist: + ageName = age + break + PtDebugPrint("psnlBookshelf.IGetLinkFromBook(): after city lookup, ageName = ",ageName) + + if ageName is None: + PtDebugPrint("psnlBookshelf.IGetLinkFromBook():\tERROR -- conversion from book to link element failed") + return None + + if ageName == "Ahnonay": + PtDebugPrint("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() + if not link: # Don't break if it's not what you expect... + continue + + info = link.getAgeInfo() + if info and info.getAgeFilename() == ageName: + if ageName == "Garrison": + continue + else: + # found our link + PtDebugPrint("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 + PtDebugPrint("psnlBookshelf.IGetLinkFromBook():\tfound Owned link", info.getAgeFilename()) + IsChildLink = 0 + return link + + PtDebugPrint("psnlBookshelf.IGetLinkFromBook():\tERROR -- couldn't find link to", ageName) + PtDebugPrint("info = ",info) + PtDebugPrint("info.getAgeFilename() = ",info.getAgeFilename()) + PtDebugPrint("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 ( citylinklocked is None or citylinklocked) and ( bcolinklocked is None or bcolinklocked): + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting city book clasp to locked: ",lockName) + for rkey,rvalue in respCloseLock.byObject.viewitems(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey,fastforward=1) + else: + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting city book clasp to unlocked: ",lockName) + for rkey,rvalue in respOpenLock.byObject.viewitems(): + 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: + PtDebugPrint("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.viewkeys()): + 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(): + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to locked: ",lockName) + for rkey,rvalue in respCloseLock.byObject.viewitems(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey,fastforward=1) + else: + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to unlocked: ",lockName) + for rkey,rvalue in respOpenLock.byObject.viewitems(): + 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(): + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting booktray to VOLATILE: ",bookName) + for rkey,rvalue in respDeleteBook.byObject.viewitems(): + parent = rvalue.getParentKey() + if parent: + #~ PtDebugPrint(trayName,"==",rkey#[:len(trayName)]) + if bookName == parent.getName(): + respDeleteBook.run(self.key,objectName=rkey,fastforward=1) + #~ PtDebugPrint("got here") + else: + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting booktray to NOT volatile: ",bookName) + for rkey,rvalue in respReturnTray.byObject.viewitems(): + 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: + PtDebugPrint("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): + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to locked: ",lockName) + for rkey,rvalue in respCloseLock.byObject.viewitems(): + parent = rvalue.getParentKey() + if parent: + if lockName == parent.getName(): + respCloseLock.run(self.key,objectName=rkey,fastforward=1) + else: + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting clasp to unlocked: ",lockName) + for rkey,rvalue in respOpenLock.byObject.viewitems(): + 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): + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting booktray to VOLATILE: ",bookName) + for rkey,rvalue in respDeleteBook.byObject.viewitems(): + parent = rvalue.getParentKey() + if parent: + #~ PtDebugPrint(trayName,"==",rkey#[:len(trayName)]) + if bookName == parent.getName(): + respDeleteBook.run(self.key,objectName=rkey,fastforward=1) + #~ PtDebugPrint("got here") + else: + PtDebugPrint("psnlBookshelf.IUpdateLocksAndTrays():\tsetting booktray to NOT volatile: ",bookName) + for rkey,rvalue in respReturnTray.byObject.viewitems(): + 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.viewitems(): + 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.viewitems(): + parent = value.getParentKey() + if parent: + if lockName == parent.getName(): + actLock.enable(objectName=key) + break + + ageVault = ptAgeVault() + PAL = ageVault.getAgesIOwnFolder() + if PAL is not 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.viewkeys()): + continue + +# if (ageName == "Garrison"): +# parent = info.getParentAgeLink() +# parentinfo = parent.getAgeInfo() +# parentname = parentinfo.getAgeFilename() +# if parentname == "Neighborhood": +# PtDebugPrint("psnlBookshelf.IUpdateLinks(): link found for public Garrison, ignoring...") +# continue + + try: + index = linkLibrary.index(ageName) + except: + PtDebugPrint("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 + PtDebugPrint("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.viewitems(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + PtDebugPrint("%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.viewitems(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + PtDebugPrint("%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.viewitems(): + parent = value.getParentKey() + if parent: + if lockName == parent.getName(): + actLock.enable(objectName=key) + break + + for key,value in actTray.byObject.viewitems(): + parent = value.getParentKey() + if parent: + if trayName == parent.getName(): + actTray.enable(objectName=key) + break + + else: + PtDebugPrint("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: + PtDebugPrint("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.viewitems(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + PtDebugPrint("%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.viewitems(): + parent = value.getParentKey() + if parent: + if bookName == parent.getName(): + PtDebugPrint("%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.viewitems(): + parent = value.getParentKey() + if parent: + if lockName == parent.getName(): + actLock.enable(objectName=key) + break + + for key,value in actTray.byObject.viewitems(): + 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.viewkeys(): + splist = CityBookAges[agefilename] + if sptitle in splist: + return 1 + return 0 + + + def ILink(self): + global SpawnPointName + global SpawnPointTitle + + link = self.IGetLinkFromBook(SpawnPointTitle) + if link is None: + PtDebugPrint("psnlBookshelf.ILink():\tERROR -- conversion from book to link failed -- aborting") + return + elif 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() + PtDebugPrint(guid) + break + break + info.setAgeInstanceGuid(guid) + + link = ptAgeLinkStruct() + link.setAgeInfo(info) + + info = link.getAgeInfo() + ageName = info.getAgeFilename() + + # do the link + PtDebugPrint("psnlBookshelf.ILink():\tattempting link to %s(%s)" % (info.getAgeFilename(),info.getAgeInstanceName())) + + PtDebugPrint("Ilink: SpawnPointTitle = ", SpawnPointTitle, "; SpawnPointName = ", SpawnPointName) + spnpnt = None + + if isinstance(link, 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): + PtDebugPrint("found spawn point: %s, %s" % (sp.getTitle(), sp.getName())) + if sp.getName() == "BigRoomLinkInPoint": + PtDebugPrint("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) + + PtDebugPrint("spnpnt.getTitle() = ",spnpnt.getTitle()) + PtDebugPrint("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": + als.setLinkingRules( PtLinkingRules.kBasicLink ) + elif IsChildLink: + PtDebugPrint("psnlBookshelf.ILink(): using kChildAgeBook rules for link to: ",ageName) + als.setLinkingRules( PtLinkingRules.kChildAgeBook ) + als.setParentAgeFilename("Neighborhood") + else: + PtDebugPrint("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) + PtDebugPrint("ILink Done") + + + def IShelveBook(self): + "returns a picked book to the shelf" + global objBookPicked + bookName = objBookPicked.getName() + for rkey,rvalue in respShelveBook.byObject.viewitems(): + 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: + PtDebugPrint("psnlBookshelf.IUpdateLinks():\tERROR -- couldn't find ", objBookPicked, " in objLibrary") + return None + PtDebugPrint("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] + #~ PtDebugPrint("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()) + + #~ PtDebugPrint("I think my ID is: ", myID) + + if myID == CurrentBookshelfUser: + PtDebugPrint("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 link is not 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 link is None: + return None + info = link.getAgeInfo() + return info + + + def IGetHoodChildLink(self, age): + hoodInfo = self.IGetHoodInfoNode() + if hoodInfo: + childAgeFolder = hoodInfo.getChildAgesFolder() + if childAgeFolder is not None: + contents = childAgeFolder.getChildNodeRefList() + #childAgeLinkNodes = [] + #GZLinkNode = None + for content in contents: + link = content.getChild().upcastToAgeLinkNode() + if not link: # Don't break if corrupt/not agelink + continue + + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + #PtDebugPrint("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: + PtDebugPrint("psnlBookshelf.HasCityBook(): owner has the city book") + return 1 + else: + PtDebugPrint("psnlBookshelf.HasCityBook(): owner does NOT have city book") + return 0 + + CityLinks = [] + vault = ptVault() + entryCityLinks = vault.findChronicleEntry("CityBookLinks") + if entryCityLinks is not None: + valCityLinks = entryCityLinks.chronicleGetValue() + PtDebugPrint("valCityLinks = ",valCityLinks) + CityLinks = valCityLinks.split(",") + PtDebugPrint("CityLinks = ",CityLinks) + for tmpLink in CityLinks: + if tmpLink in xLinkingBookDefs.CityBookLinks: + return 1 + else: + PtDebugPrint("can't find CityBookLinks chron entry") + return 0 + + vault = ptAgeVault() + # look for city book age links + for age, splist in CityBookAges.viewitems(): + #agelink = self.GetOwnedAgeLink(vault, age) + agelink = self.IGetHoodChildLink(age) + PtDebugPrint("age = ",age) + PtDebugPrint("agelink = ",agelink) + + if agelink is not None: + spawnPoints = agelink.getSpawnPoints() + + for sp in spawnPoints: + PtDebugPrint("sp = ",sp) + PtDebugPrint("sp.getTitle = ",sp.getTitle()) + PtDebugPrint("sp.getName = ",sp.getName()) + if sp.getTitle() in splist: + PtDebugPrint("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) + PtDebugPrint("age = the city") + PtDebugPrint("agelink = ",agelink) + + if agelink is not None: + spawnPoints = agelink.getSpawnPoints() + + for sp in spawnPoints: + PtDebugPrint("sp = ",sp) + PtDebugPrint("sp.getTitle = ",sp.getTitle()) + PtDebugPrint("sp.getName = ",sp.getName()) + if sp.getTitle() in xLinkingBookDefs.CityBookLinks: + PtDebugPrint("found a city book link: city", sp.getTitle()) + return 1 + + # no BCO or city treasure link + PtDebugPrint("found no city book links") + return 0 + + + def GetOwnedAgeLink(self, vault, age): + PAL = vault.getAgesIOwnFolder() + if PAL is not None: + contents = PAL.getChildNodeRefList() + for content in contents: + link = content.getChild().upcastToAgeLinkNode() + info = link.getAgeInfo() + if not info: + continue + ageName = info.getAgeFilename() + PtDebugPrint("found %s, looking for %s" % (ageName, age)) + if ageName == age: + return link + + return None + diff --git a/Scripts/Python/psnlBugs.py b/Scripts/Python/psnlBugs.py new file mode 100644 index 0000000000..fcc0aad841 --- /dev/null +++ b/Scripts/Python/psnlBugs.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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() + entry = vault.findChronicleEntry(chronicleEntryName) + if entry is None: + # not found... add chronicle + vault.addChronicleEntry(chronicleEntryName,0,str(count)) + else: + entry.chronicleSetValue(str(count)) + entry.save() + + def IGetBugCount(self): + vault = ptVault() + entry = vault.findChronicleEntry(chronicleEntryName) + if entry is not None: + return int(entry.chronicleGetValue()) + return 0 # no chronicle var + + def OnServerInitComplete(self): + avatar = 0 + try: + avatar = PtGetLocalAvatar() + except: + PtDebugPrint("failed to get local avatar") + return + + self.bugCount = self.IGetBugCount() + PtDebugPrint("psnl Bugs: ", self.bugCount) + + thisAge = PtGetAgeName() + #PtDebugPrint("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) + PtDebugPrint("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): + PtDebugPrint("turning off bugs") + if bugState != 0: + sdl["psnlBugsVis"] = (0,) + else: + if self.bugCount > 0: + PtDebugPrint("turning on bugs") + if bugState != 1: + sdl["psnlBugsVis"] = (1,) + +## def AvatarPage(self, avatar, pageIn, lastOut): +## PtDebugPrint("in avatar page") +## self.bugCount = PtGetNumParticles(avatar.getKey()) +## PtDebugPrint("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) +## PtDebugPrint("kill all bugs in psnl age") +## self.ISaveBugCount(0) diff --git a/Scripts/Python/psnlCalendarStones.py b/Scripts/Python/psnlCalendarStones.py new file mode 100644 index 0000000000..f2dfd0fd5e --- /dev/null +++ b/Scripts/Python/psnlCalendarStones.py @@ -0,0 +1,227 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 = ptAgeVault().getAgeSDL() + if not ageSDL: + PtDebugPrint("psnlCalendarStones.OnServerInitComplete():\tAgeVaultSDL nil. Bad things have happened!") + respCalStoneFire.run(self.key,state="off",fastforward=1) + return + + # 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) + if not ageSDL.findVar(sdl).getBool(): + fire = 0 + break + if fire: + 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]: + PtDebugPrint("psnlCalendarStones.OnServerInitComplete(): don't have YeeshaPage20 on, no FIRE for you!") + respCalStoneFire.run(self.key,state="off",fastforward=1) + else: + PtDebugPrint("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: + PtDebugPrint("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) + #PtDebugPrint("launch rocket 1") + self.DoFireworks(1,2) + elif id == 2: + respFireworksExplode1.run(self.key) + #PtDebugPrint("explode rocket 1") + if not fireworksTestMode: + self.DoFireworks(1,1) + elif id == 3: + respFireworksLaunch2.run(self.key) + #PtDebugPrint("launch rocket 2") + self.DoFireworks(3,2) + elif id == 4: + respFireworksExplode2.run(self.key) + #PtDebugPrint("explode rocket 2") + if not fireworksTestMode: + self.DoFireworks(3,1) + elif id == 5: + respFireworksLaunch3.run(self.key) + #PtDebugPrint("launch rocket 3") + self.DoFireworks(5,2) + elif id == 6: + respFireworksExplode3.run(self.key) + #PtDebugPrint("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) + PtDebugPrint("launch rocket 1") + PtAtTimeCallback(self.key,timer,2) + elif target == "fireworks2": + respFireworksLaunch2.run(self.key) + PtDebugPrint("launch rocket 2") + PtAtTimeCallback(self.key,timer,4) + elif target == "fireworks3": + respFireworksLaunch3.run(self.key) + PtDebugPrint("launch rocket 3") + PtAtTimeCallback(self.key,timer,6) + elif target == "fireworksall": + respFireworksLaunch1.run(self.key) + PtDebugPrint("launch rocket 1") + PtAtTimeCallback(self.key,timer,2) + respFireworksLaunch2.run(self.key) + PtDebugPrint("launch rocket 2") + PtAtTimeCallback(self.key,timer,4) + respFireworksLaunch3.run(self.key) + PtDebugPrint("launch rocket 3") + PtAtTimeCallback(self.key,timer,6) + + diff --git a/Scripts/Python/psnlMyCloset.py b/Scripts/Python/psnlMyCloset.py new file mode 100644 index 0000000000..590e7da537 --- /dev/null +++ b/Scripts/Python/psnlMyCloset.py @@ -0,0 +1,214 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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/Scripts/Python/psnlVaultSDLBoolRespond.py b/Scripts/Python/psnlVaultSDLBoolRespond.py new file mode 100644 index 0000000000..62e81ececf --- /dev/null +++ b/Scripts/Python/psnlVaultSDLBoolRespond.py @@ -0,0 +1,142 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 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 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/Scripts/Python/psnlVaultSDLBoolShowHide.py b/Scripts/Python/psnlVaultSDLBoolShowHide.py new file mode 100644 index 0000000000..c8c1c216e0 --- /dev/null +++ b/Scripts/Python/psnlVaultSDLBoolShowHide.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 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 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 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 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/Scripts/Python/psnlYeeshaPageChanges.py b/Scripts/Python/psnlYeeshaPageChanges.py new file mode 100644 index 0000000000..858eaca9b0 --- /dev/null +++ b/Scripts/Python/psnlYeeshaPageChanges.py @@ -0,0 +1,287 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 AgeVault is not 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 ageSDL is not 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 + PtDebugPrint("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": + PtDebugPrint("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 FoundValue is not 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): + #~ PtDebugPrint("No one else is here. Affecting any YP changes you've queued.") + if state == 3: + state = 2 + PtDebugPrint("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 + PtDebugPrint("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/Scripts/Python/stupStartUp.py b/Scripts/Python/stupStartUp.py new file mode 100644 index 0000000000..cbde12715b --- /dev/null +++ b/Scripts/Python/stupStartUp.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +""" *==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 . + +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==* """ +""" +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 + PtDebugPrint("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 playerList[0] or len(playerList) > 1: + PtShowDialog("GUIDialog04b") + else: + PtShowDialog("GUIDialog06") diff --git a/Scripts/Python/system/Bastion.py b/Scripts/Python/system/Bastion.py new file mode 100644 index 0000000000..d0dddbfdef --- /dev/null +++ b/Scripts/Python/system/Bastion.py @@ -0,0 +1,180 @@ +"""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. + +""" +from warnings import warnpy3k +warnpy3k("the Bastion module has been removed in Python 3.0", stacklevel=2) +del warnpy3k + +__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 later" + + # 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 = repr(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/Scripts/Python/system/ConfigParser.py b/Scripts/Python/system/ConfigParser.py new file mode 100644 index 0000000000..dc7398841b --- /dev/null +++ b/Scripts/Python/system/ConfigParser.py @@ -0,0 +1,711 @@ +"""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; + its 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. Return list of successfully read files. + + 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 +""" + +try: + from collections import OrderedDict as _default_dict +except ImportError: + # fallback for setup.py which hasn't yet built _collections + _default_dict = dict + +import re + +__all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError", + "InterpolationError", "InterpolationDepthError", + "InterpolationSyntaxError", "ParsingError", + "MissingSectionHeaderError", + "ConfigParser", "SafeConfigParser", "RawConfigParser", + "DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"] + +DEFAULTSECT = "DEFAULT" + +MAX_INTERPOLATION_DEPTH = 10 + + + +# exception classes +class Error(Exception): + """Base class for ConfigParser exceptions.""" + + def _get_message(self): + """Getter for 'message'; needed only to override deprecation in + BaseException.""" + return self.__message + + def _set_message(self, value): + """Setter for 'message'; needed only to override deprecation in + BaseException.""" + self.__message = value + + # BaseException.message has been deprecated since Python 2.6. To prevent + # DeprecationWarning from popping up over this pre-existing attribute, use + # a new property that takes lookup precedence. + message = property(_get_message, _set_message) + + 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: %r' % (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%r' % + (filename, lineno, line)) + self.filename = filename + self.lineno = lineno + self.line = line + + +class RawConfigParser: + def __init__(self, defaults=None, dict_type=_default_dict, + allow_no_value=False): + self._dict = dict_type + self._sections = self._dict() + self._defaults = self._dict() + if allow_no_value: + self._optcre = self.OPTCRE_NV + else: + self._optcre = self.OPTCRE + if defaults: + for key, value in defaults.items(): + self._defaults[self.optionxform(key)] = value + + 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. Raise ValueError if name is DEFAULT or any of it's + case-insensitive variants. + """ + if section.lower() == "default": + raise ValueError, 'Invalid section name: %s' % section + + if section in self._sections: + raise DuplicateSectionError(section) + self._sections[section] = self._dict() + + 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. + + Return list of successfully read files. + """ + if isinstance(filenames, basestring): + filenames = [filenames] + read_ok = [] + for filename in filenames: + try: + fp = open(filename) + except IOError: + continue + self._read(fp, filename) + fp.close() + read_ok.append(filename) + return read_ok + + 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 = self._dict() + 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=None): + """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__": + continue + if (value is not None) or (self._optcre == self.OPTCRE): + key = " = ".join((key, str(value).replace('\n', '\n\t'))) + fp.write("%s\n" % (key)) + 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