cog hq doors and lobbies

This commit is contained in:
Zach 2015-05-27 08:07:12 -05:00
parent 2631dd1391
commit 0425544dfc
6 changed files with 223 additions and 5 deletions

View file

@ -320,6 +320,7 @@ from toontown.building import DistributedKartShopInterior/AI
from toontown.building import DistributedDoor/AI from toontown.building import DistributedDoor/AI
from toontown.estate import DistributedHouseDoor/AI from toontown.estate import DistributedHouseDoor/AI
from toontown.coghq import DistributedCogHQDoor/AI from toontown.coghq import DistributedCogHQDoor/AI
from toontown.coghq import DistributedCogHQExteriorDoor/AI
from toontown.coghq import DistributedSellbotHQDoor/AI from toontown.coghq import DistributedSellbotHQDoor/AI
from toontown.toon import DistributedNPCToonBase/AI from toontown.toon import DistributedNPCToonBase/AI
from toontown.toon import DistributedNPCToon/AI from toontown.toon import DistributedNPCToon/AI
@ -1873,9 +1874,14 @@ dclass DistributedHouseDoor : DistributedDoor {
dclass DistributedCogHQDoor : DistributedDoor { dclass DistributedCogHQDoor : DistributedDoor {
}; };
dclass DistributedCogHQExteriorDoor : DistributedCogHQDoor {
selectLobby(uint32) broadcast ram;
confirmEntrance(uint32, bool) airecv clsend;
};
dclass DistributedSellbotHQDoor : DistributedCogHQDoor { dclass DistributedSellbotHQDoor : DistributedCogHQDoor {
informPlayer(uint8) broadcast ram; informPlayer(uint8) broadcast ram;
}; }
dclass DistributedNPCToonBase : DistributedNode { dclass DistributedNPCToonBase : DistributedNode {
setName(string) required broadcast ram; setName(string) required broadcast ram;

View file

@ -2,10 +2,10 @@
from pandac.PandaModules import * from pandac.PandaModules import *
hashVal = 4186269798L hashVal = 210530844
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedCogHQExteriorDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot
from toontown.golf import DistributedPhysicsWorld, DistributedGolfHole, DistributedGolfCourse from toontown.golf import DistributedPhysicsWorld, DistributedGolfHole, DistributedGolfCourse
from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, DistributedBuilding, DistributedBuildingQueryMgr, DistributedToonInterior, DistributedToonHallInterior, DistributedSuitInterior, DistributedHQInterior, DistributedGagshopInterior, DistributedPetshopInterior, DistributedKartShopInterior, DistributedDoor, DistributedKnockKnockDoor, DistributedElevator, DistributedElevatorFSM, DistributedElevatorExt, DistributedElevatorInt, DistributedElevatorFloor, DistributedBossElevator, DistributedVPElevator, DistributedCFOElevator, DistributedCJElevator, DistributedBBElevator, DistributedBoardingParty, DistributedTutorialInterior, DistributedClubElevator from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, DistributedBuilding, DistributedBuildingQueryMgr, DistributedToonInterior, DistributedToonHallInterior, DistributedSuitInterior, DistributedHQInterior, DistributedGagshopInterior, DistributedPetshopInterior, DistributedKartShopInterior, DistributedDoor, DistributedKnockKnockDoor, DistributedElevator, DistributedElevatorFSM, DistributedElevatorExt, DistributedElevatorInt, DistributedElevatorFloor, DistributedBossElevator, DistributedVPElevator, DistributedCFOElevator, DistributedCJElevator, DistributedBBElevator, DistributedBoardingParty, DistributedTutorialInterior, DistributedClubElevator
from toontown.uberdog.DistributedPartyManager import DistributedPartyManager from toontown.uberdog.DistributedPartyManager import DistributedPartyManager

View file

@ -0,0 +1,147 @@
from pandac.PandaModules import *
from direct.gui.DirectGui import *
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
class BossLobbyGui(DirectFrame):
class InitialFrame(DirectFrame):
frame = 0
class LobbySelection(DirectButton):
def __init__(self, parent, **kw):
optiondefs = (
('relief', None, None),
('image_scale', 0.55, None),
('text_pos', (0.3, -0.0225), None),
('text_scale', 0.075, None),
)
self.defineoptions(kw, optiondefs)
DirectButton.__init__(self, relief=None)
self.initialiseoptions(BossLobbyGui.InitialFrame.LobbySelection)
def __init__(self, parent, callback, **kw):
optiondefs = (
('relief', None, None),
('state', DGG.NORMAL, None),
('image', DGG.getDefaultDialogGeom(), None),
('image_scale', (1.0, 1.0, 0.75), None),
('image_color', ToontownGlobals.GlobalDialogColor, None),
('pos', (0, 0, 0), None),
)
self.defineoptions(kw, optiondefs)
DirectFrame.__init__(self, relief=None)
self.initialiseoptions(BossLobbyGui.InitialFrame)
self.callback = callback
self.load()
self.selection = -1
def destroy(self):
self.title.destroy()
for button in self.buttons:
button.destroy()
self.okButton.destroy()
self.cancelButton.destroy()
DirectFrame.destroy(self)
def load(self):
empty = loader.loadModel("phase_3.5/models/gui/matching_game_gui.bam")
check = loader.loadModel("phase_3.5/models/gui/name_star")
buttons = loader.loadModel("phase_3/models/gui/dialog_box_buttons_gui")
self.emptyList = (empty.find("**/minnieCircle"), empty.find("**/minnieCircle"), empty.find("**/minnieCircle"))
self.checkList = (check.find("**/*"), check.find("**/*"), check.find("**/*"))
okImageList = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
cancelImageList = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr'))
empty.removeNode()
check.removeNode()
buttons.removeNode()
self.title = DirectLabel(parent=self, relief=None, text="Select a Lobby", textMayChange=1, text_scale=0.1, pos=(0, 0, 0.25))
self.okButton = DirectButton(parent=self, relief=None, image=okImageList, pos=(-0.1, 0, -0.275), command=self.nextFrame, extraArgs=[True])
self.cancelButton = DirectButton(parent=self, relief=None, image=cancelImageList, pos=(0.1, 0, -0.275), command=self.nextFrame, extraArgs=[False])
self.buttons = []
public = BossLobbyGui.InitialFrame.LobbySelection(self, image=self.emptyList, pos=(-0.35, 0, 0.075), text="Public", command=self.setSelection, extraArgs=[0])
private = BossLobbyGui.InitialFrame.LobbySelection(self, image=self.emptyList, pos=(-0.3475, 0, -0.075), text="Private", command=self.setSelection, extraArgs=[1])
self.buttons.extend([
public,
private
])
def unload(self):
self.title.destroy()
self.public.destroy()
self.private.destroy()
self.okButton.destroy()
self.cancelButton.destroy()
del self.title
del self.public
del self.private
del self.okButton
del self.cancelButton
def setSelection(self, buttonId):
newSelection = self.buttons[buttonId]
if newSelection:
for button in self.buttons:
button['image'] = self.emptyList
button['image_scale'] = 0.55
button.setColor(1, 1, 1, 1)
newSelection['image'] = self.checkList
newSelection['image_scale'] = 0.11
newSelection.setColor(0, 1, 0, 1)
self.selection = buttonId
def getSelection(self):
return self.selection
def nextFrame(self, status):
if status and self.getSelection() >= 0:
options = {
'lobbyType': self.getSelection()
}
self.callback(self.frame + 1, options)
else:
self.callback(-1)
def __init__(self, callback, av):
DirectFrame.__init__(self)
self.callback = callback
self.avatar = av
self.frame = None
self.loadFrame(0)
def destroy(self):
if hasattr(self, 'frame') and self.frame:
self.frame.destroy()
DirectFrame.destroy(self)
def loadFrame(self, frameNum, args={}):
if hasattr(self, 'frame') and self.frame:
self.frame.destroy()
if frameNum == -1:
self.callback(self.avatar, False)
elif frameNum == 0:
self.frame = BossLobbyGui.InitialFrame(self, self.loadFrame)
elif frameNum == 1 and args.get('lobbyType') is not None:
lobby = args.get('lobbyType')
if lobby == 0:
self.callback(self.avatar, True)
elif lobby == 1:
self.callback(self.avatar, True)
# Use the following to run with the Gui Editor.
"""
from pandac.PandaModules import *
from direct.gui import DirectGuiGlobals
from direct.gui.DirectGui import *
from toontown.coghq.BossLobbyGui import BossLobbyGui
from toontown.toonbase import ToontownGlobals
DirectGuiGlobals.setDefaultFontFunc(ToontownGlobals.getInterfaceFont)
DirectGuiGlobals.setDefaultRolloverSound(base.loadSfx('phase_3/audio/sfx/GUI_rollover.ogg'))
DirectGuiGlobals.setDefaultClickSound(base.loadSfx('phase_3/audio/sfx/GUI_create_toon_fwd.ogg'))
DirectGuiGlobals.setDefaultDialogGeom(loader.loadModel('phase_3/models/gui/dialog_box_gui'))
test = BossLobbyGui(None, None)
"""

View file

@ -0,0 +1,21 @@
from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import *
from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM
import DistributedCogHQDoor
from toontown.hood import ZoneUtil
from BossLobbyGui import BossLobbyGui
class DistributedCogHQExteriorDoor(DistributedCogHQDoor.DistributedCogHQDoor):
def __init__(self, cr):
DistributedCogHQDoor.DistributedCogHQDoor.__init__(self, cr)
def selectLobby(self, avId):
self.lobbyGui = BossLobbyGui(self.sendConfirmation, avId)
def sendConfirmation(self, avId, status):
self.lobbyGui.destroy()
del self.lobbyGui
self.sendUpdate('confirmEntrance', [avId, status])

View file

@ -0,0 +1,40 @@
from otp.ai.AIBaseGlobal import *
from direct.distributed.ClockDelta import *
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM
import DistributedCogHQDoorAI
from direct.fsm import State
from toontown.toonbase import ToontownGlobals
import CogDisguiseGlobals
from toontown.building import FADoorCodes
class DistributedCogHQExteriorDoorAI(DistributedCogHQDoorAI.DistributedCogHQDoorAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogHQExteriorDoorAI')
def __init__(self, air, blockNumber, doorType, destinationZone, doorIndex = 0, lockValue = FADoorCodes.SB_DISGUISE_INCOMPLETE, swing = 3):
DistributedCogHQDoorAI.DistributedCogHQDoorAI.__init__(self, air, blockNumber, doorType, doorIndex, lockValue, swing)
def requestEnter(self):
avId = self.air.getAvatarIdFromSender()
dept = ToontownGlobals.cogHQZoneId2deptIndex(self.destinationZone)
av = self.air.doId2do.get(avId)
if av:
if self.doorType == DoorTypes.EXT_COGHQ and self.isLockedDoor():
parts = av.getCogParts()
if CogDisguiseGlobals.isSuitComplete(parts, dept):
allowed = 1
else:
allowed = 0
else:
allowed = 1
if not allowed:
self.sendReject(avId, self.isLockedDoor())
else:
self.sendUpdate('selectLobby', [avId])
def confirmEntrance(self, avId, status):
if status:
self.enqueueAvatarIdEnter(avId)
self.sendUpdateToAvatarId(avId, 'setOtherZoneIdAndDoId', [self.destinationZone, self.otherDoor.getDoId()])
else:
self.sendReject(avId, 0)

View file

@ -1,6 +1,6 @@
from toontown.building import DoorTypes from toontown.building import DoorTypes
from toontown.building.DistributedBoardingPartyAI import DistributedBoardingPartyAI from toontown.building.DistributedBoardingPartyAI import DistributedBoardingPartyAI
from toontown.coghq import DistributedCogHQDoorAI, LobbyManagerAI from toontown.coghq import DistributedCogHQDoorAI, DistributedCogHQExteriorDoorAI, LobbyManagerAI
from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.toon import NPCToons from toontown.toon import NPCToons
@ -61,7 +61,11 @@ class CogHQAI:
doorIndex=intDoorIndex, lockValue=lock) doorIndex=intDoorIndex, lockValue=lock)
intDoor.zoneId = destinationZone intDoor.zoneId = destinationZone
extDoor = DistributedCogHQDoorAI.DistributedCogHQDoorAI( # it works with
# DistributedCogHQDoorAI.DistributedCogHQDoorAI
# so idfk
# figure it out
extDoor = DistributedCogHQExteriorDoorAI.DistributedCogHQExteriorDoorAI(
self.air, 0, DoorTypes.EXT_COGHQ, destinationZone, self.air, 0, DoorTypes.EXT_COGHQ, destinationZone,
doorIndex=extDoorIndex, lockValue=lock) doorIndex=extDoorIndex, lockValue=lock)