merge thing

This commit is contained in:
Zach 2015-03-07 02:56:06 -06:00
commit e52dbdb2ff
82 changed files with 7650 additions and 5938 deletions

3
.gitignore vendored
View file

@ -21,6 +21,5 @@ logs/
screenshots/ screenshots/
backups/ backups/
contentpacks/ contentpacks/
toondata/
resources/ resources/
panel_save.mp save.dat

4
astron/.gitignore vendored
View file

@ -1,4 +0,0 @@
astrond
astrond_debug
astrond.exe
astrond_debug.exe

BIN
astron/astrond.exe Normal file

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -32,7 +32,7 @@ punchline-place-building-chance 100.0
want-fishing #f want-fishing #f
want-housing #f want-housing #f
want-pets #f want-pets #f
want-parties #f want-parties #t
# Optional: # Optional:
want-talkative-tyler #f want-talkative-tyler #f

View file

@ -1,130 +1,135 @@
# Window settings: # Window settings:
window-title Toontown Unlimited window-title Toontown Unlimited
win-origin -1 -1 win-origin -1 -1
icon-filename phase_3/etc/icon.ico icon-filename phase_3/etc/icon.ico
cursor-filename phase_3/etc/toonmono.cur cursor-filename phase_3/etc/toonmono.cur
# Audio: # Audio:
audio-library-name p3fmod_audio audio-library-name p3fmod_audio
# Graphics: # Graphics:
aux-display pandagl aux-display pandagl
aux-display pandadx9 aux-display pandadx9
aux-display p3tinydisplay aux-display p3tinydisplay
# Models: # Models:
model-cache-models #f model-cache-models #f
model-cache-textures #f model-cache-textures #f
default-model-extension .bam default-model-extension .bam
# Textures: # Textures:
texture-anisotropic-degree 16 texture-anisotropic-degree 16
# Preferences: # Preferences:
preferences-filename preferences.json preferences-filename preferences.json
# Content packs: # Content packs:
content-packs-filepath contentpacks/ content-packs-filepath contentpacks/
content-packs-sort-filename sort.yaml content-packs-sort-filename sort.yaml
# Backups: # Backups:
backups-filepath backups/ backups-filepath backups/
backups-extension .json backups-extension .json
# Server: # Server:
server-timezone EST/EDT/-5 server-timezone EST/EDT/-5
server-port 7199 server-port 7199
account-server-endpoint https://toontownunlimited.com/api/ account-server-endpoint https://toontownunlimited.com/api/
account-bridge-filename astron/databases/account-bridge.db account-bridge-filename astron/databases/account-bridge.db
# Performance: # Performance:
sync-video #f sync-video #f
texture-power-2 none texture-power-2 none
gl-check-errors #f gl-check-errors #f
garbage-collect-states #f garbage-collect-states #f
# Egg object types: # Egg object types:
egg-object-type-barrier <Scalar> collide-mask { 0x01 } <Collide> { Polyset descend } egg-object-type-barrier <Scalar> collide-mask { 0x01 } <Collide> { Polyset descend }
egg-object-type-trigger <Scalar> collide-mask { 0x01 } <Collide> { Polyset descend intangible } egg-object-type-trigger <Scalar> collide-mask { 0x01 } <Collide> { Polyset descend intangible }
egg-object-type-sphere <Scalar> collide-mask { 0x01 } <Collide> { Sphere descend } egg-object-type-sphere <Scalar> collide-mask { 0x01 } <Collide> { Sphere descend }
egg-object-type-trigger-sphere <Scalar> collide-mask { 0x01 } <Collide> { Sphere descend intangible } egg-object-type-trigger-sphere <Scalar> collide-mask { 0x01 } <Collide> { Sphere descend intangible }
egg-object-type-floor <Scalar> collide-mask { 0x02 } <Collide> { Polyset descend } egg-object-type-floor <Scalar> collide-mask { 0x02 } <Collide> { Polyset descend }
egg-object-type-dupefloor <Scalar> collide-mask { 0x02 } <Collide> { Polyset keep descend } egg-object-type-dupefloor <Scalar> collide-mask { 0x02 } <Collide> { Polyset keep descend }
egg-object-type-camera-collide <Scalar> collide-mask { 0x04 } <Collide> { Polyset descend } egg-object-type-camera-collide <Scalar> collide-mask { 0x04 } <Collide> { Polyset descend }
egg-object-type-camera-collide-sphere <Scalar> collide-mask { 0x04 } <Collide> { Sphere descend } egg-object-type-camera-collide-sphere <Scalar> collide-mask { 0x04 } <Collide> { Sphere descend }
egg-object-type-camera-barrier <Scalar> collide-mask { 0x05 } <Collide> { Polyset descend } egg-object-type-camera-barrier <Scalar> collide-mask { 0x05 } <Collide> { Polyset descend }
egg-object-type-camera-barrier-sphere <Scalar> collide-mask { 0x05 } <Collide> { Sphere descend } egg-object-type-camera-barrier-sphere <Scalar> collide-mask { 0x05 } <Collide> { Sphere descend }
egg-object-type-model <Model> { 1 } egg-object-type-model <Model> { 1 }
egg-object-type-dcs <DCS> { 1 } egg-object-type-dcs <DCS> { 1 }
# Safe zones: # Safe zones:
want-safe-zones #t want-safe-zones #t
want-toontown-central #t want-toontown-central #t
want-donalds-dock #t want-donalds-dock #t
want-daisys-garden #t want-daisys-garden #t
want-minnies-melodyland #t want-minnies-melodyland #t
want-the-burrrgh #t want-the-burrrgh #t
want-donalds-dreamland #t want-donalds-dreamland #t
want-goofy-speedway #t want-goofy-speedway #t
want-outdoor-zone #t want-outdoor-zone #t
want-golf-zone #t want-golf-zone #t
# Safe zone settings: # Safe zone settings:
want-treasure-planners #t want-treasure-planners #t
want-suit-planners #t want-suit-planners #t
want-butterflies #f want-butterflies #f
# Classic characters: # Classic characters:
want-classic-chars #t want-classic-chars #t
want-mickey #t want-mickey #t
want-donald-dock #t want-donald-dock #t
want-daisy #t want-daisy #t
want-minnie #t want-minnie #t
want-pluto #t want-pluto #t
want-donald-dreamland #t want-donald-dreamland #t
want-chip-and-dale #t want-chip-and-dale #t
want-goofy #t want-goofy #t
# Trolley minigames: # Trolley minigames:
want-minigames #t want-minigames #t
want-photo-game #f want-photo-game #f
want-travel-game #f want-travel-game #f
# Picnic table board games: # Picnic table board games:
want-game-tables #f want-game-tables #f
# Cog headquarters: # Cog headquarters:
want-cog-headquarters #t want-cog-headquarters #t
want-sellbot-headquarters #t want-sellbot-headquarters #t
want-cashbot-headquarters #t want-cashbot-headquarters #t
want-lawbot-headquarters #t want-lawbot-headquarters #t
want-bossbot-headquarters #t want-bossbot-headquarters #t
# Cashbot boss: # Cashbot boss:
want-resistance-toonup #t want-resistance-toonup #t
want-resistance-restock #t want-resistance-restock #t
want-resistance-dance #f want-resistance-dance #f
# Cog battles: # Cog battles:
base-xp-multiplier 1.0 base-xp-multiplier 1.0
# Cog buildings: # Cog Dominiums
want-cogbuildings #t want-emblems #t
cogdo-want-barrel-room #t
# Optional: want-lawbot-cogdo #t
show-total-population #t
want-mat-all-tailors #t # Cog buildings:
want-long-pattern-game #f want-cogbuildings #t
want-talkative-tyler #f
want-yin-yang #f # Optional:
show-total-population #t
# Developer options: want-mat-all-tailors #t
want-dev #f want-long-pattern-game #f
want-pstats 0 want-talkative-tyler #f
want-yin-yang #f
# Temporary:
smooth-lag 0.4 # Developer options:
want-old-fireworks #t want-dev #f
want-pstats 0
# Live updates:
# Temporary:
smooth-lag 0.4
want-old-fireworks #t
# Live updates:
want-live-updates #t want-live-updates #t

View file

@ -21,7 +21,7 @@ dc-file astron/dclass/otp.dc
# Core features: # Core features:
want-pets #f want-pets #f
want-parties #f want-parties #t
want-cogdominiums #f want-cogdominiums #f
want-achievements #f want-achievements #f

View file

@ -10,7 +10,7 @@ shard-mid-pop 150
# Core features: # Core features:
want-housing #t want-housing #t
want-pets #f want-pets #f
want-parties #f want-parties #t
want-cogdominiums #f want-cogdominiums #f
want-achievements #f want-achievements #f
boarding-group-merges #t boarding-group-merges #t

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import * from pandac.PandaModules import *
hashVal = 3179828763L hashVal = 1403862015
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, 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
@ -11,7 +11,7 @@ from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, Dis
from toontown.uberdog.DistributedPartyManager import DistributedPartyManager from toontown.uberdog.DistributedPartyManager import DistributedPartyManager
from otp.friends import FriendManager, AvatarFriendsManager, PlayerFriendsManager, GuildManager, FriendInfo, AvatarFriendInfo from otp.friends import FriendManager, AvatarFriendsManager, PlayerFriendsManager, GuildManager, FriendInfo, AvatarFriendInfo
from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiveEntity from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiveEntity
from toontown.shtiker import DeleteManager, PurchaseManager, GroupManager, NewbiePurchaseManager from toontown.shtiker import DeleteManager, GroupManager, PurchaseManager, NewbiePurchaseManager
from toontown.pets import DistributedPetProxy from toontown.pets import DistributedPetProxy
from toontown.uberdog.ClientServicesManager import ClientServicesManager from toontown.uberdog.ClientServicesManager import ClientServicesManager
from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedPolarBearMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedSillyMeterMgr from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedPolarBearMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedSillyMeterMgr

View file

@ -27,6 +27,7 @@ from toontown.coghq import MintManagerAI
from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
from toontown.distributed.ToontownDistrictStatsAI import ToontownDistrictStatsAI from toontown.distributed.ToontownDistrictStatsAI import ToontownDistrictStatsAI
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
from toontown.coderedemption.TTCodeRedemptionMgrAI import TTCodeRedemptionMgrAI
from toontown.dna.DNAParser import loadDNAFileAI from toontown.dna.DNAParser import loadDNAFileAI
from toontown.estate.EstateManagerAI import EstateManagerAI from toontown.estate.EstateManagerAI import EstateManagerAI
from toontown.hood import BRHoodAI from toontown.hood import BRHoodAI
@ -117,6 +118,8 @@ class ToontownAIRepository(ToontownInternalRepository):
self.cogPageManager = CogPageManagerAI.CogPageManagerAI() self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
self.bankManager = BankManagerAI.BankManagerAI(self) self.bankManager = BankManagerAI.BankManagerAI(self)
self.holidayManager = HolidayManagerAI(self) self.holidayManager = HolidayManagerAI(self)
self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self)
self.codeRedemptionMgr.generateWithRequired(2)
self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self) self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self)
self.buildingQueryMgr.generateWithRequired(2) self.buildingQueryMgr.generateWithRequired(2)
self.groupManager.generateWithRequired(2) self.groupManager.generateWithRequired(2)

View file

@ -290,7 +290,8 @@ ClothingTypes = {101: (ABoysShirt, 'bss1', 40),
1817: (AGirlsSkirt, 'sa_gs19', 5000), 1817: (AGirlsSkirt, 'sa_gs19', 5000),
1818: (AGirlsSkirt, 'sa_gs20', 5000), 1818: (AGirlsSkirt, 'sa_gs20', 5000),
1819: (AGirlsSkirt, 'sa_gs21', 5000), 1819: (AGirlsSkirt, 'sa_gs21', 5000),
1820: (AShirt, 'sa_ss55', 5000)} 1820: (AShirt, 'sa_ss55', 5000),
1821: (AShirt, 'weed', 5000)}
LoyaltyClothingItems = (1600, LoyaltyClothingItems = (1600,
1601, 1601,
1602, 1602,

View file

@ -1,10 +0,0 @@
DefaultDbName = 'tt_code_redemption'
RedeemErrors = Enum('Success, CodeDoesntExist, CodeIsInactive, CodeAlreadyRedeemed, AwardCouldntBeGiven, TooManyAttempts, SystemUnavailable, ')
RedeemErrorStrings = {RedeemErrors.Success: 'Success',
RedeemErrors.CodeDoesntExist: 'Invalid code',
RedeemErrors.CodeIsInactive: 'Code is inactive',
RedeemErrors.CodeAlreadyRedeemed: 'Code has already been redeemed',
RedeemErrors.AwardCouldntBeGiven: 'Award could not be given',
RedeemErrors.TooManyAttempts: 'Too many attempts, code ignored',
RedeemErrors.SystemUnavailable: 'Code redemption is currently unavailable'}
MaxCustomCodeLen = config.GetInt('tt-max-custom-code-len', 16)

View file

@ -10,14 +10,14 @@ class TTCodeRedemptionMgr(DistributedObject):
def announceGenerate(self): def announceGenerate(self):
DistributedObject.announceGenerate(self) DistributedObject.announceGenerate(self)
base.codeRedemptionMgr = self base.cr.codeRedemptionMgr = self
self._contextGen = SerialMaskedGen(4294967295L) self._contextGen = SerialMaskedGen(4294967295L)
self._context2callback = {} self._context2callback = {}
def delete(self): def delete(self):
if hasattr(base, 'codeRedemptionMgr'): if hasattr(base.cr, 'codeRedemptionMgr'):
if base.codeRedemptionMgr is self: if base.cr.codeRedemptionMgr is self:
del base.codeRedemptionMgr del base.cr.codeRedemptionMgr
self._context2callback = None self._context2callback = None
self._contextGen = None self._contextGen = None
DistributedObject.delete(self) DistributedObject.delete(self)

View file

@ -1,21 +1,93 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.catalog import CatalogClothingItem
from toontown.catalog import CatalogNametagItem
from toontown.catalog import CatalogChatItem
from toontown.catalog import CatalogEmoteItem
from toontown.catalog import CatalogGardenItem
from toontown.catalog import CatalogGardenStarterItem
from toontown.catalog import CatalogMouldingItem
from toontown.catalog import CatalogRentalItem
from toontown.catalog import CatalogFurnitureItem
from toontown.catalog import CatalogFlooringItem
from toontown.toonbase import ToontownGlobals
from datetime import datetime, timedelta
import time
"""
Code example:
'codeName': {
'items': [
CatalogTypeItem.CatalogTypeItem(arguments)
]
'expirationDate': datetime(2020, 1, 30),
'month': 1,
'day': 30
}
Expiration date, month and day are optional fields.
"""
class TTCodeRedemptionMgrAI(DistributedObjectAI): class TTCodeRedemptionMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("TTCodeRedemptionMgrAI") notify = DirectNotifyGlobal.directNotify.newCategory("TTCodeRedemptionMgrAI")
codes = {
'weed': {
'items': [
CatalogClothingItem.CatalogClothingItem(1821, 0)
],
'expirationDate': datetime(2016, 3, 30) # temporary expiration until release
}
}
def giveAwardToToonResult(self, todo0, todo1): def announceGenerate(self):
pass DistributedObjectAI.announceGenerate(self)
def redeemCode(self, todo0, todo1): def getMailboxCount(self, items):
pass count = 0
def redeemCodeAiToUd(self, todo0, todo1, todo2, todo3, todo4): for item in items:
pass if item.getDeliveryTime() > 0:
count += 1
def redeemCodeResultUdToAi(self, todo0, todo1, todo2, todo3, todo4): return count
pass
def redeemCode(self, context, code):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
def redeemCodeResult(self, todo0, todo1, todo2): if not av:
pass return
if code in self.codes:
if av.isCodeRedeemed(code):
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 3, 2])
return
codeInfo = self.codes[code]
date = datetime.now()
if ('month' in codeInfo and date.month is not codeInfo['month']) or ('day' in codeInfo and date.day is not codeInfo['day']) or ('expirationDate' in codeInfo and codeInfo['expirationDate'] - date < timedelta(hours = 1)):
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 2, 0])
return
av.redeemCode(code)
self.requestCodeRedeem(context, avId, av, codeInfo['items'])
else:
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 1, 0])
def requestCodeRedeem(self, context, avId, av, items):
count = self.getMailboxCount(items)
if len(av.onOrder) + count > 5 or len(av.mailboxContents) + len(av.onOrder) + count >= ToontownGlobals.MaxMailboxContents:
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 3, 1])
return
for item in items:
if item in av.onOrder or item.reachedPurchaseLimit:
continue
item.deliveryDate = int(time.time() / 60) + 0.01
av.onOrder.append(item)
av.b_setDeliverySchedule(av.onOrder)
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 0, 0])

View file

@ -1,21 +0,0 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectUD import DistributedObjectUD
class TTCodeRedemptionMgrUD(DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory("TTCodeRedemptionMgrUD")
def giveAwardToToonResult(self, todo0, todo1):
pass
def redeemCode(self, todo0, todo1):
pass
def redeemCodeAiToUd(self, todo0, todo1, todo2, todo3, todo4):
pass
def redeemCodeResultUdToAi(self, todo0, todo1, todo2, todo3, todo4):
pass
def redeemCodeResult(self, todo0, todo1, todo2):
pass

View file

@ -37,8 +37,6 @@ class CogdoBarrelRoom:
self.model.setPos(*CogdoBarrelRoomConsts.BarrelRoomModelPos) self.model.setPos(*CogdoBarrelRoomConsts.BarrelRoomModelPos)
self.model.reparentTo(render) self.model.reparentTo(render)
self.model.stash() self.model.stash()
self.dummyElevInNode = self.model.attachNewNode('elevator-in')
self.dummyElevInNode.hide()
self.entranceNode = self.model.attachNewNode('door-entrance') self.entranceNode = self.model.attachNewNode('door-entrance')
self.entranceNode.setPos(0, -65, 0) self.entranceNode.setPos(0, -65, 0)
self.nearBattleNode = self.model.attachNewNode('near-battle') self.nearBattleNode = self.model.attachNewNode('near-battle')
@ -49,6 +47,11 @@ class CogdoBarrelRoom:
self.fog = Fog('barrel-room-fog') self.fog = Fog('barrel-room-fog')
self.fog.setColor(CogdoBarrelRoomConsts.BarrelRoomFogColor) self.fog.setColor(CogdoBarrelRoomConsts.BarrelRoomFogColor)
self.fog.setLinearRange(*CogdoBarrelRoomConsts.BarrelRoomFogLinearRange) self.fog.setLinearRange(*CogdoBarrelRoomConsts.BarrelRoomFogLinearRange)
self.brBarrel = render.attachNewNode('@@CogdoBarrels')
for i in range(len(CogdoBarrelRoomConsts.BarrelProps)):
self.bPath = self.brBarrel.attachNewNode('%s%s'% (CogdoBarrelRoomConsts.BarrelPathName, i))
self.bPath.setPos(CogdoBarrelRoomConsts.BarrelProps[i]['pos'])
self.bPath.setH(CogdoBarrelRoomConsts.BarrelProps[i]['heading'])
self._isLoaded = True self._isLoaded = True
def unload(self): def unload(self):
@ -61,9 +64,10 @@ class CogdoBarrelRoom:
if self.rewardUi: if self.rewardUi:
self.rewardUi.destroy() self.rewardUi.destroy()
self.rewardUi = None self.rewardUi = None
if self.fog: if hasattr(self, 'fog'):
render.setFogOff() if self.fog:
del self.fog render.setFogOff()
del self.fog
taskMgr.remove(self.rewardUiTaskName) taskMgr.remove(self.rewardUiTaskName)
taskMgr.remove(self.rewardCameraTaskName) taskMgr.remove(self.rewardCameraTaskName)
self._isLoaded = False self._isLoaded = False
@ -75,8 +79,9 @@ class CogdoBarrelRoom:
def show(self): def show(self):
if not self.cogdoBarrelsNode: if not self.cogdoBarrelsNode:
self.cogdoBarrelsNode = render.find('**/@@CogdoBarrels') self.cogdoBarrelsNode = render.find('**/@@CogdoBarrels')
self.cogdoBarrelsNode.reparentTo(self.model) if not self.cogdoBarrelsNode.isEmpty():
self.cogdoBarrelsNode.unstash() self.cogdoBarrelsNode.reparentTo(self.model)
self.cogdoBarrelsNode.unstash()
self.defaultFar = base.camLens.getFar() self.defaultFar = base.camLens.getFar()
base.camLens.setFar(CogdoBarrelRoomConsts.BarrelRoomCameraFar) base.camLens.setFar(CogdoBarrelRoomConsts.BarrelRoomCameraFar)
self.showBattleAreaLight(True) self.showBattleAreaLight(True)
@ -85,7 +90,7 @@ class CogdoBarrelRoom:
def hide(self): def hide(self):
self.model.stash() self.model.stash()
render.setFogOff() #render.setFogOff()
if self.defaultFar is not None: if self.defaultFar is not None:
base.camLens.setFar(self.defaultFar) base.camLens.setFar(self.defaultFar)
return return
@ -103,11 +108,11 @@ class CogdoBarrelRoom:
self.timer.stash() self.timer.stash()
def placeToonsAtEntrance(self, toons): def placeToonsAtEntrance(self, toons):
for i in xrange(len(toons)): for i in range(len(toons)):
toons[i].setPosHpr(self.entranceNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i]) toons[i].setPosHpr(self.entranceNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i])
def placeToonsNearBattle(self, toons): def placeToonsNearBattle(self, toons):
for i in xrange(len(toons)): for i in range(len(toons)):
toons[i].setPosHpr(self.nearBattleNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i]) toons[i].setPosHpr(self.nearBattleNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i])
def showBattleAreaLight(self, visible = True): def showBattleAreaLight(self, visible = True):
@ -158,10 +163,10 @@ class CogdoBarrelRoom:
track = Sequence(Func(camera.reparentTo, render), Func(camera.setPosHpr, self.model, 0, 0, 11.0, 0, -14, 0), Func(self.showBattleAreaLight, False), name=trackName) track = Sequence(Func(camera.reparentTo, render), Func(camera.setPosHpr, self.model, 0, 0, 11.0, 0, -14, 0), Func(self.showBattleAreaLight, False), name=trackName)
return (track, trackName) return (track, trackName)
def showRewardUi(self, results, callback = None): def showRewardUi(self, callback = None):
track, trackName = self.__rewardCamera() track, trackName = self.__rewardCamera()
if CogdoBarrelRoomConsts.ShowRewardUI: if CogdoBarrelRoomConsts.ShowRewardUI:
self.rewardUi.setRewards(results) self.rewardUi.setRewards()
self.rewardUi.unstash() self.rewardUi.unstash()
taskMgr.doMethodLater(CogdoBarrelRoomConsts.RewardUiTime, self.__rewardUiTimeout, self.rewardUiTaskName, extraArgs=[callback]) taskMgr.doMethodLater(CogdoBarrelRoomConsts.RewardUiTime, self.__rewardUiTimeout, self.rewardUiTaskName, extraArgs=[callback])
return (track, trackName) return (track, trackName)

View file

@ -1,9 +1,9 @@
from pandac.PandaModules import * from pandac.PandaModules import *
CollectionTime = 30 CollectionTime = 30
BarrelRoomIntroTimeout = 15.0 BarrelRoomIntroTimeout = 12.0
RewardUiTime = 5.0 RewardUiTime = 5.0
EndWithAllBarrelsCollected = False EndWithAllBarrelsCollected = True
ShowRewardUI = False ShowRewardUI = True
AllBarrelsCollectedTime = 5.0 AllBarrelsCollectedTime = 5.0
ToonUp = (2, 4) ToonUp = (2, 4)
BarrelProps = [{'pos': (-10, -66, 0), BarrelProps = [{'pos': (-10, -66, 0),
@ -26,7 +26,7 @@ BarrelProps = [{'pos': (-10, -66, 0),
'heading': 141}, 'heading': 141},
{'pos': (10, -14.4, 0), {'pos': (10, -14.4, 0),
'heading': 2}] 'heading': 2}]
StomperProps = [{'path': '**/stomper_GRP_01/stomper_cylinder_01', StomperProps = [{'path': '**/stomper_GRP_01/stomper_cylinder_034',
'motion': 'up'}, 'motion': 'up'},
{'path': '**/stomper_GRP_02/stomper_cylinder_034', {'path': '**/stomper_GRP_02/stomper_cylinder_034',
'motion': 'down'}, 'motion': 'down'},
@ -55,6 +55,7 @@ StomperSound = 'phase_9/audio/sfx/CHQ_FACT_stomper_raise.ogg'
MaxToons = 4 MaxToons = 4
BarrelRoomModel = 'phase_5/models/cogdominium/tt_m_ara_cbr_barrelRoom' BarrelRoomModel = 'phase_5/models/cogdominium/tt_m_ara_cbr_barrelRoom'
BarrelRoomModelPos = (0, 0, 0) BarrelRoomModelPos = (0, 0, 0)
BarrelRoomElevatorInPath = '**/elevatorIn_locator'
BarrelRoomElevatorOutPath = '**/elevatorOut_locator' BarrelRoomElevatorOutPath = '**/elevatorOut_locator'
BarrelRoomPlayerSpawnPoints = [(-4, BarrelRoomPlayerSpawnPoints = [(-4,
0, 0,
@ -83,6 +84,7 @@ BarrelRoomPlayerSpawnPoints = [(-4,
BarrelRoomCameraFar = 525.0 BarrelRoomCameraFar = 525.0
BarrelRoomFogColor = Vec4(0.65, 0.21, 0, 1.0) BarrelRoomFogColor = Vec4(0.65, 0.21, 0, 1.0)
BarrelRoomFogLinearRange = (0.0, 800.0) BarrelRoomFogLinearRange = (0.0, 800.0)
BarrelPathName = 'CogdoBarrel_'
BarrelModel = 'phase_5/models/cogdominium/tt_m_ara_cbr_laughBarrel' BarrelModel = 'phase_5/models/cogdominium/tt_m_ara_cbr_laughBarrel'
BarrelModelScale = 1.0 BarrelModelScale = 1.0
BarrelCollParams = (0, BarrelCollParams = (0,
@ -91,6 +93,8 @@ BarrelCollParams = (0,
2.0) 2.0)
BarrelBumpSound = 'phase_4/audio/sfx/Golf_Hit_Barrier_2.ogg' BarrelBumpSound = 'phase_4/audio/sfx/Golf_Hit_Barrier_2.ogg'
BarrelGrabSound = 'phase_4/audio/sfx/SZ_DD_treasure.ogg' BarrelGrabSound = 'phase_4/audio/sfx/SZ_DD_treasure.ogg'
BarrelAvailableTexture = 'phase_5/maps/tt_t_ara_cbr_Barrel_notUsed.jpg'
BarrelUsedTexture = 'phase_5/maps/tt_t_ara_cbr_Barrel_Used.jpg'
StateHidden, StateAvailable, StateUsed, StateCrushed = range(4) StateHidden, StateAvailable, StateUsed, StateCrushed = range(4)
def numBarrels(): def numBarrels():

View file

@ -0,0 +1,118 @@
from pandac.PandaModules import NodePath, Point3, PlaneNode, TextNode
from direct.interval.IntervalGlobal import *
from direct.showbase.ShowBase import Plane
from direct.directnotify import DirectNotifyGlobal
from direct.showbase.RandomNumGen import RandomNumGen
from direct.interval.MetaInterval import Sequence, Parallel
from direct.interval.FunctionInterval import Func, Wait
from direct.gui.DirectGui import *
from toontown.toonbase.ToontownGlobals import *
from toontown.toonbase import TTLocalizer
from toontown.suit import Suit, SuitDNA
from toontown.toon import Toon, ToonHead, ToonDNA
from DistributedCogdoInterior import *
from CogdoUtil import CogdoGameMovie
import CogdoBarrelRoomConsts, CogdoUtil
class CogdoBarrelRoomIntro(CogdoGameMovie):
notify = DirectNotifyGlobal.directNotify.newCategory('CogdoElevatorMovie')
def __init__(self):
CogdoGameMovie.__init__(self)
self._toonDialogueSfx = None
self.toonHead = None
self.frame = None
return
def displayLine(self, text):
self.notify.debug('displayLine')
self._dialogueLabel.node().setText(text)
self.toonHead.reparentTo(aspect2d)
self._toonDialogueSfx.play()
self.toonHead.setClipPlane(self.clipPlane)
def makeSuit(self, suitType):
self.notify.debug('makeSuit()')
suit = Suit.Suit()
dna = SuitDNA.SuitDNA()
dna.newSuit(suitType)
suit.setStyle(dna)
suit.isDisguised = 1
suit.generateSuit()
suit.setScale(1, 1, 2)
suit.setPos(0, 0, -4.4)
suit.reparentTo(self.toonHead)
for part in suit.getHeadParts():
part.hide()
suit.loop('neutral')
def load(self):
self.notify.debug('load()')
CogdoGameMovie.load(self)
backgroundGui = loader.loadModel('phase_5/models/cogdominium/tt_m_gui_csa_flyThru')
self.bg = backgroundGui.find('**/background')
self.chatBubble = backgroundGui.find('**/chatBubble')
self.chatBubble.setScale(6.5, 6.5, 7.3)
self.chatBubble.setPos(0.32, 0, -0.78)
self.bg.setScale(5.2)
self.bg.setPos(0.14, 0, -0.6667)
self.bg.reparentTo(aspect2d)
self.chatBubble.reparentTo(aspect2d)
self.frame = DirectFrame(geom=self.bg, relief=None, pos=(0.2, 0, -0.6667))
self.bg.wrtReparentTo(self.frame)
self.gameTitleText = DirectLabel(parent=self.frame, text=TTLocalizer.CogdoBarrelRoomTitle, scale=TTLocalizer.MRPgameTitleText * 0.8, text_align=TextNode.ACenter, text_font=getSignFont(), text_fg=(1.0, 0.33, 0.33, 1.0), pos=TTLocalizer.MRgameTitleTextPos, relief=None)
self.chatBubble.wrtReparentTo(self.frame)
self.frame.hide()
backgroundGui.removeNode()
self.toonDNA = ToonDNA.ToonDNA()
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14)
self.toonHead = Toon.Toon()
self.toonHead.setDNA(self.toonDNA)
self.makeSuit('sc')
self.toonHead.getGeomNode().setDepthWrite(1)
self.toonHead.getGeomNode().setDepthTest(1)
self.toonHead.loop('neutral')
self.toonHead.setPosHprScale(-0.73, 0, -1.27, 180, 0, 0, 0.18, 0.18, 0.18)
self.toonHead.reparentTo(hidden)
self.toonHead.startBlink()
self.clipPlane = self.toonHead.attachNewNode(PlaneNode('clip'))
self.clipPlane.node().setPlane(Plane(0, 0, 1, 0))
self.clipPlane.setPos(0, 0, 2.45)
self._toonDialogueSfx = loader.loadSfx('phase_3.5/audio/dial/AV_dog_long.ogg')
self._camHelperNode = NodePath('CamHelperNode')
self._camHelperNode.reparentTo(render)
dialogue = TTLocalizer.CogdoBarrelRoomIntroDialog
def start():
self.frame.show()
base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0)
def end():
self._dialogueLabel.reparentTo(hidden)
self.toonHead.reparentTo(hidden)
self.frame.hide()
base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1)
self._stopUpdateTask()
self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Wait(CogdoBarrelRoomConsts.BarrelRoomIntroTimeout), Func(end))
self._startUpdateTask()
return
def _updateTask(self, task):
dt = globalClock.getDt()
return task.cont
def unload(self):
self.frame.destroy()
del self.frame
self.bg.removeNode()
del self.bg
self.chatBubble.removeNode()
del self.chatBubble
self.toonHead.stopBlink()
self.toonHead.stop()
self.toonHead.removeNode()
self.toonHead.delete()
del self.toonHead
CogdoGameMovie.unload(self)

View file

@ -1,12 +1,13 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from toontown.toon import DistributedToon
from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.toonbase import ToontownGlobals, TTLocalizer
from toontown.cogdominium import CogdoBarrelRoomConsts from toontown.cogdominium import CogdoBarrelRoomConsts
class CogdoBarrelRoomRewardPanel(DirectFrame): class CogdoBarrelRoomRewardPanel(DirectFrame):
def __init__(self): def __init__(self):
DirectFrame.__init__(self, relief=None, geom=DGG.getDefaultDialogGeom(), geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=TTLocalizer.RPdirectFrame, pos=(0, 0, 0.587)) DirectFrame.__init__(self, relief=None, geom=DGG.getDefaultDialogGeom(), geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=TTLocalizer.RPdirectFrame, pos=(0, 0, -0.587))
self.initialiseoptions(CogdoBarrelRoomRewardPanel) self.initialiseoptions(CogdoBarrelRoomRewardPanel)
self.avNameLabel = DirectLabel(parent=self, relief=None, pos=(0, 0, 0.3), text='Toon Ups', text_scale=0.08) self.avNameLabel = DirectLabel(parent=self, relief=None, pos=(0, 0, 0.3), text='Toon Ups', text_scale=0.08)
self.rewardLines = [] self.rewardLines = []
@ -22,15 +23,15 @@ class CogdoBarrelRoomRewardPanel(DirectFrame):
return return
def setRewards(self, results): def setRewards(self):
for p in xrange(len(results[0])): RewardLineIndex = 0
doId = results[0][p] for doId in base.cr.doId2do:
laff = results[1][p] toon = base.cr.doId2do.get(doId)
if doId > 0 and doId in base.cr.doId2do: if isinstance(toon, DistributedToon.DistributedToon):
toon = base.cr.doId2do[doId] self.rewardLines[RewardLineIndex]['name'].setProp('text', toon.getName())
self.rewardLines[p]['name'].setProp('text', toon.getName()) self.rewardLines[RewardLineIndex]['laff'].setProp('text', '%s/%s' % (str(toon.hp), str(toon.maxHp)))
self.rewardLines[p]['laff'].setProp('text', str(laff))
if doId == base.localAvatar.getDoId(): if doId == base.localAvatar.getDoId():
self.rewardLines[p]['frame'].setProp('relief', DGG.RIDGE) self.rewardLines[RewardLineIndex]['frame'].setProp('relief', DGG.RIDGE)
self.rewardLines[p]['frame'].setProp('borderWidth', (0.01, 0.01)) self.rewardLines[RewardLineIndex]['frame'].setProp('borderWidth', (0.01, 0.01))
self.rewardLines[p]['frame'].setProp('frameColor', (1, 1, 1, 0.5)) self.rewardLines[RewardLineIndex]['frame'].setProp('frameColor', (1, 1, 1, 0.5))
RewardLineIndex += 1

View file

@ -0,0 +1,74 @@
import CogdoCraneGameConsts as Globals
from CogdoGameAudioManager import CogdoGameAudioManager
class CogdoCraneGame(DirectObject):
notify = directNotify.newCategory('CogdoFlyingGame')
def __init__(self, distGame):
self.distGame = distGame
self.toonId2Player = {}
self.players = []
def _initAudio(self):
self._audioMgr = CogdoGameAudioManager(Globals.MusicFiles, Globals.SfxFiles, camera, cutoff=Globals.AudioCutoff)
def _destroyAudio(self):
self._audioMgr.destroy()
del self._audioMgr
def load(self):
self._initAudio()
def unload(self):
self._destroyAudio()
del self.toonId2Player
def onstage(self):
pass
def offstage(self):
pass
def startIntro(self):
self._audioMgr.playMusic('normal')
def endIntro(self):
for player in self.players:
self.placePlayer(player)
if player.toon is localAvatar:
localAvatar.sendCurrentPosition()
player.request('Ready')
def startFinish(self):
pass
def endFinish(self):
pass
def start(self):
for player in self.players:
player.handleGameStart()
player.request('Normal')
def exit(self):
for player in self.players:
player.request('Done')
def _addPlayer(self, player):
self.players.append(player)
self.toonId2Player[player.toon.doId] = player
def _removePlayer(self, player):
if player in self.players:
self.players.remove(player)
else:
for cPlayer in self.players:
if cPlayer.toon == player.toon:
self.players.remove(cPlayer)
break
if self.toonId2Player.has_key(player.toon.doId):
del self.toonId2Player[player.toon.doId]
def handleToonLeft(self, toonId):
self._removePlayer(self.toonId2Player[toonId])

View file

@ -1,6 +1,14 @@
from direct.fsm.StatePush import StateVar from direct.fsm.StatePush import StateVar
from otp.level.EntityStateVarSet import EntityStateVarSet from otp.level.EntityStateVarSet import EntityStateVarSet
from CogdoUtil import VariableContainer
from toontown.cogdominium.CogdoEntityTypes import CogdoCraneGameSettings, CogdoCraneCogSettings from toontown.cogdominium.CogdoEntityTypes import CogdoCraneGameSettings, CogdoCraneCogSettings
Gameplay = VariableContainer()
Gameplay.SecondsUntilGameOver = 60.0 * 3.0
Gameplay.TimeRunningOutSeconds = 45.0
Audio = VariableContainer()
Audio.MusicFiles = {'normal': 'phase_9/audio/bgm/CHQ_FACT_bg.ogg',
'end': 'phase_7/audio/bgm/encntr_toon_winning_indoor.ogg',
'timeRunningOut': 'phase_7/audio/bgm/encntr_suit_winning_indoor.ogg'}
Settings = EntityStateVarSet(CogdoCraneGameSettings) Settings = EntityStateVarSet(CogdoCraneGameSettings)
CogSettings = EntityStateVarSet(CogdoCraneCogSettings) CogSettings = EntityStateVarSet(CogdoCraneCogSettings)
CranePosHprs = [(13.4, -136.6, 6, -45, 0, 0), CranePosHprs = [(13.4, -136.6, 6, -45, 0, 0),

View file

@ -10,6 +10,7 @@ from toontown.toonbase.ToontownGlobals import *
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.suit import Suit, SuitDNA from toontown.suit import Suit, SuitDNA
from toontown.toon import Toon, ToonHead, ToonDNA from toontown.toon import Toon, ToonHead, ToonDNA
from DistributedCogdoInterior import *
from CogdoUtil import CogdoGameMovie from CogdoUtil import CogdoGameMovie
import CogdoUtil import CogdoUtil
@ -82,17 +83,17 @@ class CogdoElevatorMovie(CogdoGameMovie):
self._toonDialogueSfx = loader.loadSfx('phase_3.5/audio/dial/AV_dog_long.ogg') self._toonDialogueSfx = loader.loadSfx('phase_3.5/audio/dial/AV_dog_long.ogg')
self._camHelperNode = NodePath('CamHelperNode') self._camHelperNode = NodePath('CamHelperNode')
self._camHelperNode.reparentTo(render) self._camHelperNode.reparentTo(render)
dialogue = TTLocalizer.CogdoElevatorRewardLaff dialogue = TTLocalizer.CogdoMazeGameElevatorRewardLaff
def start(): def start():
self.frame.show() self.frame.show()
base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0) base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0)
def end(): def end():
self._dialogueLabel.reparentTo(hidden) self._dialogueLabel.reparentTo(hidden)
self.toonHead.reparentTo(hidden) self.toonHead.reparentTo(hidden)
self.frame.hide() self.frame.hide()
base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1) base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1)
self._stopUpdateTask() self._stopUpdateTask()
self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Wait(self.elevatorDuration), Func(end)) self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Wait(self.elevatorDuration), Func(end))

View file

@ -91,7 +91,7 @@ class CogdoExecutiveSuiteIntro(CogdoGameMovie):
def start(): def start():
self.frame.show() self.frame.show()
base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0) base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0)
def showShopOwner(): def showShopOwner():
self._setCamTarget(self._shopOwner, -10, offset=Point3(0, 0, 5)) self._setCamTarget(self._shopOwner, -10, offset=Point3(0, 0, 5))
@ -100,7 +100,7 @@ class CogdoExecutiveSuiteIntro(CogdoGameMovie):
self._dialogueLabel.reparentTo(hidden) self._dialogueLabel.reparentTo(hidden)
self.toonHead.reparentTo(hidden) self.toonHead.reparentTo(hidden)
self.frame.hide() self.frame.hide()
base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1) base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1)
self._stopUpdateTask() self._stopUpdateTask()
self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Func(showShopOwner), ParallelEndTogether(camera.posInterval(self.cameraMoveDuration, Point3(8, 0, 13), blendType='easeInOut'), camera.hprInterval(0.5, self._camHelperNode.getHpr(), blendType='easeInOut')), Wait(self.introDuration), Func(end)) self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Func(showShopOwner), ParallelEndTogether(camera.posInterval(self.cameraMoveDuration, Point3(8, 0, 13), blendType='easeInOut'), camera.hprInterval(0.5, self._camHelperNode.getHpr(), blendType='easeInOut')), Wait(self.introDuration), Func(end))

View file

@ -161,26 +161,30 @@ class CogdoFlyingCameraManager:
name = entry.getIntoNode().getName() name = entry.getIntoNode().getName()
if name.find('col_') >= 0: if name.find('col_') >= 0:
np = entry.getIntoNodePath().getParent() np = entry.getIntoNodePath().getParent()
if np not in nodesInBetween: if not nodesInBetween.has_key(np):
nodesInBetween[np] = np.getParent() nodesInBetween[np] = np.getParent()
for np in nodesInBetween.keys(): for np in nodesInBetween.keys():
if np in self._betweenCamAndToon: if self._betweenCamAndToon.has_key(np):
del self._betweenCamAndToon[np] del self._betweenCamAndToon[np]
else: else:
np.setTransparency(True) np.setTransparency(True)
np.wrtReparentTo(self._transNP) np.wrtReparentTo(self._transNP)
if np.getName().find('lightFixture') >= 0: if np.getName().find('lightFixture') >= 0:
np.find('**/*floor_mesh').hide() if not np.find('**/*floor_mesh').isEmpty():
np.find('**/*floor_mesh').hide()
elif np.getName().find('platform') >= 0: elif np.getName().find('platform') >= 0:
np.find('**/*Floor').hide() if not np.find('**/*Floor').isEmpty():
np.find('**/*Floor').hide()
for np, parent in self._betweenCamAndToon.items(): for np, parent in self._betweenCamAndToon.items():
np.wrtReparentTo(parent) np.wrtReparentTo(parent)
np.setTransparency(False) np.setTransparency(False)
if np.getName().find('lightFixture') >= 0: if np.getName().find('lightFixture') >= 0:
np.find('**/*floor_mesh').show() if not np.find('**/*floor_mesh').isEmpty():
np.find('**/*floor_mesh').show()
elif np.getName().find('platform') >= 0: elif np.getName().find('platform') >= 0:
np.find('**/*Floor').show() if not np.find('**/*Floor').isEmpty():
np.find('**/*Floor').show()
self._betweenCamAndToon = nodesInBetween self._betweenCamAndToon = nodesInBetween

View file

@ -160,13 +160,7 @@ class CogdoFlyingGame(DirectObject):
self.acceptOnce(CogdoFlyingLocalPlayer.RanOutOfTimeEventName, self.handleLocalPlayerRanOutOfTime) self.acceptOnce(CogdoFlyingLocalPlayer.RanOutOfTimeEventName, self.handleLocalPlayerRanOutOfTime)
self.__startUpdateTask() self.__startUpdateTask()
self.isGameComplete = False self.isGameComplete = False
if __debug__ and base.config.GetBool('schellgames-dev', True):
self.acceptOnce('end', self.guiMgr.forceTimerDone)
def toggleFog():
self.levelFog.setVisible(not self.levelFog.isVisible())
self.accept('home', toggleFog)
for eagle in self.legalEagles: for eagle in self.legalEagles:
eagle.gameStart(self.distGame.getStartTime()) eagle.gameStart(self.distGame.getStartTime())
@ -299,20 +293,22 @@ class CogdoFlyingGame(DirectObject):
if gatherable.type in [Globals.Level.GatherableTypes.InvulPowerup]: if gatherable.type in [Globals.Level.GatherableTypes.InvulPowerup]:
if player.toon.isLocal(): if player.toon.isLocal():
self.audioMgr.playMusic('invul') self.audioMgr.playMusic('invul')
taskMgr.doMethodLater(30, lambda task: self.debuffPowerup(toonId, gatherable.type, elapsedTime), 'gatherable-timeout')
else: else:
self.notify.warning('Trying to pickup gatherable nonetype:%s' % pickupNum) self.notify.warning('Trying to pickup gatherable nonetype:%s' % pickupNum)
return return
def debuffPowerup(self, toonId, pickupType, elapsedTime): def debuffPowerup(self, toonId, pickupType, elapsedTime):
self.notify.debugCall() self.notify.debugCall()
player = self.toonId2Player[toonId] if toonId in self.toonId2Player:
if player.isBuffActive(pickupType): player = self.toonId2Player[toonId]
if pickupType in [Globals.Level.GatherableTypes.InvulPowerup]: if player.isBuffActive(pickupType):
if self.guiMgr.isTimeRunningOut(): if pickupType in [Globals.Level.GatherableTypes.InvulPowerup]:
self.audioMgr.playMusic('timeRunningOut') if self.guiMgr.isTimeRunningOut():
else: self.audioMgr.playMusic('timeRunningOut')
self.audioMgr.playMusic('normal') else:
player.handleDebuffPowerup(pickupType, elapsedTime) self.audioMgr.playMusic('normal')
player.handleDebuffPowerup(pickupType, elapsedTime)
def handleLocalToonEnterLegalEagle(self, eagle, collEntry): def handleLocalToonEnterLegalEagle(self, eagle, collEntry):
if not self.localPlayer.isEnemyHitting() and not self.localPlayer.isInvulnerable(): if not self.localPlayer.isEnemyHitting() and not self.localPlayer.isInvulnerable():

View file

@ -9,25 +9,29 @@ AI.SafezoneId2DeathDamage = {2000: 1,
5000: 4, 5000: 4,
4000: 8, 4000: 8,
3000: 12, 3000: 12,
9000: 16} 9000: 16,
7000: 20}
AI.SafezoneId2WhirlwindDamage = {2000: 1, AI.SafezoneId2WhirlwindDamage = {2000: 1,
1000: 2, 1000: 2,
5000: 4, 5000: 4,
4000: 8, 4000: 8,
3000: 12, 3000: 12,
9000: 16} 9000: 16,
7000: 20}
AI.SafezoneId2LegalEagleDamage = {2000: 2, AI.SafezoneId2LegalEagleDamage = {2000: 2,
1000: 4, 1000: 4,
5000: 8, 5000: 8,
4000: 16, 4000: 16,
3000: 24, 3000: 24,
9000: 32} 9000: 32,
7000: 36}
AI.SafezoneId2MinionDamage = {2000: 1, AI.SafezoneId2MinionDamage = {2000: 1,
1000: 2, 1000: 2,
5000: 4, 5000: 4,
4000: 8, 4000: 8,
3000: 12, 3000: 12,
9000: 16} 9000: 16,
7000: 20}
Camera = VariableContainer() Camera = VariableContainer()
Camera.Angle = 12.5 Camera.Angle = 12.5
Camera.Distance = 20 Camera.Distance = 20
@ -41,6 +45,7 @@ Camera.AlphaBetweenToon = 0.35
Camera.SpinRadius = 9.0 Camera.SpinRadius = 9.0
Camera.MaxSpinAngle = 20.0 Camera.MaxSpinAngle = 20.0
Camera.MaxSpinX = 16.0 Camera.MaxSpinX = 16.0
Camera.GameCameraFar = 400.0
Gameplay = VariableContainer() Gameplay = VariableContainer()
Gameplay.SecondsUntilGameOver = 60.0 * 3.0 Gameplay.SecondsUntilGameOver = 60.0 * 3.0
Gameplay.TimeRunningOutSeconds = 45.0 Gameplay.TimeRunningOutSeconds = 45.0
@ -95,7 +100,8 @@ Gameplay.SafezoneId2LaffPickupHealAmount = {2000: 1,
5000: 4, 5000: 4,
4000: 8, 4000: 8,
3000: 12, 3000: 12,
9000: 16} 9000: 16,
7000: 20}
Gameplay.InvulBuffTime = 15.0 Gameplay.InvulBuffTime = 15.0
Gameplay.InvulBlinkTime = 5.0 Gameplay.InvulBlinkTime = 5.0
Gameplay.InvulSingleBlinkTime = 0.5 Gameplay.InvulSingleBlinkTime = 0.5
@ -167,15 +173,15 @@ LegalEagle.PostCooldownHeightOffNest = 40.0
Dev = DevVariableContainer('cogdoflying') Dev = DevVariableContainer('cogdoflying')
Dev.DisableDeath = False Dev.DisableDeath = False
Dev.InfiniteFuel = False Dev.InfiniteFuel = False
Dev.InfiniteTimeLimit = True Dev.InfiniteTimeLimit = False
Dev.Invincibility = False Dev.Invincibility = False
Dev.NoLegalEagleAttacks = False Dev.NoLegalEagleAttacks = False
Audio = VariableContainer() Audio = VariableContainer()
Audio.Cutoff = 75.0 Audio.Cutoff = 75.0
Audio.MusicFiles = {'normal': 'phase_4/audio/bgm/MG_cannon_game.ogg', Audio.MusicFiles = {'normal': 'phase_9/audio/bgm/CHQ_FACT_bg.ogg',
'end': 'phase_4/audio/bgm/FF_safezone.ogg', 'end': 'phase_7/audio/bgm/encntr_toon_winning_indoor.ogg',
'waiting': 'phase_4/audio/bgm/m_match_bg2.ogg', 'waiting': 'phase_7/audio/bgm/encntr_toon_winning_indoor.ogg',
'invul': 'phase_4/audio/bgm/MG_CogThief.ogg', 'invul': 'phase_9/audio/bgm/encntr_toon_winning.ogg',
'timeRunningOut': 'phase_7/audio/bgm/encntr_suit_winning_indoor.ogg'} 'timeRunningOut': 'phase_7/audio/bgm/encntr_suit_winning_indoor.ogg'}
Audio.SfxFiles = {'propeller': 'phase_4/audio/sfx/TB_propeller.ogg', Audio.SfxFiles = {'propeller': 'phase_4/audio/sfx/TB_propeller.ogg',
'propeller_damaged': 'phase_5/audio/sfx/tt_s_ara_cfg_propellers_damaged.ogg', 'propeller_damaged': 'phase_5/audio/sfx/tt_s_ara_cfg_propellers_damaged.ogg',
@ -226,7 +232,8 @@ Level.DifficultyOrder = {2000: (1, 1, 1, 2, 1),
5000: (1, 2, 1, 2, 2), 5000: (1, 2, 1, 2, 2),
4000: (1, 2, 1, 2, 3, 2), 4000: (1, 2, 1, 2, 3, 2),
3000: (1, 2, 2, 3, 2, 3), 3000: (1, 2, 2, 3, 2, 3),
9000: (2, 3, 2, 3, 2, 3, 2)} 9000: (2, 3, 2, 3, 2, 3, 2),
7000: (2, 3, 2, 3, 2, 3, 2)}
Dev.WantTempLevel = True Dev.WantTempLevel = True
Dev.DevQuadsOrder = (1, 2, 3, 4, 5, 6, 7, 8) Dev.DevQuadsOrder = (1, 2, 3, 4, 5, 6, 7, 8)
Level.AddSparkleToPowerups = True Level.AddSparkleToPowerups = True

View file

@ -57,7 +57,10 @@ class CogdoFlyingProgressGui(DirectFrame):
return return
def _getToonMarker(self, toon): def _getToonMarker(self, toon):
return self._laffMeterModel.find('**/' + toon.style.getType() + 'head') type = self._laffMeterModel.find('**/' + toon.style.getType() + 'head')
if type.isEmpty():
type = self._laffMeterModel.find('**/bunnyhead')
return type
def update(self): def update(self):
for toon, marker in self._toonMarkers.items(): for toon, marker in self._toonMarkers.items():
@ -144,13 +147,13 @@ class CogdoFlyingFuelGui(DirectFrame):
return return
numBlades = fuelState - 1 numBlades = fuelState - 1
if len(self.activeBlades) != numBlades: if len(self.activeBlades) != numBlades:
for i in xrange(len(self.activeBlades)): for i in range(len(self.activeBlades)):
blade = self.activeBlades.pop() blade = self.activeBlades.pop()
blade.stash() blade.stash()
if numBlades > len(self.blades): if numBlades > len(self.blades):
numBlades = len(self.blades) numBlades = len(self.blades)
for i in xrange(numBlades): for i in range(numBlades):
blade = self.blades[i] blade = self.blades[i]
self.activeBlades.append(blade) self.activeBlades.append(blade)
blade.unstash() blade.unstash()

View file

@ -28,7 +28,7 @@ class CogdoFlyingGuiManager:
self._progressGui = CogdoFlyingProgressGui(self.root, self._level) self._progressGui = CogdoFlyingProgressGui(self.root, self._level)
def _initHud(self): def _initHud(self):
self._memoGui = CogdoMemoGui(self.root) self._memoGui = CogdoMemoGui(self.root, 'memo_card')
self._memoGui.posNextToLaffMeter() self._memoGui.posNextToLaffMeter()
def _initTimer(self): def _initTimer(self):

View file

@ -70,6 +70,8 @@ class CogdoFlyingLegalEagle(DirectObject, FSM):
audioMgr = base.cogdoGameAudioMgr audioMgr = base.cogdoGameAudioMgr
self._screamSfx = audioMgr.createSfx('legalEagleScream', self.suit) self._screamSfx = audioMgr.createSfx('legalEagleScream', self.suit)
self.initIntervals() self.initIntervals()
self.suit.nametag3d.stash()
self.suit.nametag.destroy()
return return
def attachPropeller(self): def attachPropeller(self):

View file

@ -7,7 +7,7 @@ import CogdoUtil
import CogdoFlyingGameGlobals as Globals import CogdoFlyingGameGlobals as Globals
from CogdoFlyingLevelQuadrant import CogdoFlyingLevelQuadrant from CogdoFlyingLevelQuadrant import CogdoFlyingLevelQuadrant
from CogdoFlyingObjects import CogdoFlyingGatherableFactory, CogdoFlyingPlatform, CogdoFlyingLevelFog from CogdoFlyingObjects import CogdoFlyingGatherableFactory, CogdoFlyingPlatform, CogdoFlyingLevelFog
from CogdoFlyingObstacles import CogdoFlyingObtacleFactory from CogdoFlyingObstacles import CogdoFlyingObstacleFactory
from CogdoGameExit import CogdoGameExit from CogdoGameExit import CogdoGameExit
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
@ -51,7 +51,7 @@ class CogdoFlyingLevel(DirectObject):
self.forwardLimit = self.quadLengthUnits * 20 self.forwardLimit = self.quadLengthUnits * 20
self._frameModel.flattenStrong() self._frameModel.flattenStrong()
self.gatherableFactory = CogdoFlyingGatherableFactory() self.gatherableFactory = CogdoFlyingGatherableFactory()
self.obstacleFactory = CogdoFlyingObtacleFactory() self.obstacleFactory = CogdoFlyingObstacleFactory()
return return
def getExit(self): def getExit(self):
@ -159,7 +159,7 @@ class CogdoFlyingLevel(DirectObject):
if quadNum >= 0: if quadNum >= 0:
if quadNum > 0: if quadNum > 0:
self.quadrants[max(quadNum - self.quadVisibiltyBehind, 0)].onstage() self.quadrants[max(quadNum - self.quadVisibiltyBehind, 0)].onstage()
for i in xrange(quadNum, min(quadNum + self.quadVisibiltyAhead + 1, self._numQuads)): for i in range(quadNum, min(quadNum + self.quadVisibiltyAhead + 1, self._numQuads)):
self.quadrants[i].onstage() self.quadrants[i].onstage()
self.visibleQuadIndices.append(i) self.visibleQuadIndices.append(i)
if i == 0: if i == 0:
@ -168,7 +168,7 @@ class CogdoFlyingLevel(DirectObject):
self.endPlatform.onstage() self.endPlatform.onstage()
self._currentQuadNum = quadNum self._currentQuadNum = quadNum
for i in xrange(0, max(self._currentQuadNum - self.quadVisibiltyBehind, 0)) + range(min(self._currentQuadNum + self.quadVisibiltyAhead + 1, self._numQuads), self._numQuads): for i in range(0, max(self._currentQuadNum - self.quadVisibiltyBehind, 0)) + range(min(self._currentQuadNum + self.quadVisibiltyAhead + 1, self._numQuads), self._numQuads):
self.quadrants[i].offstage() self.quadrants[i].offstage()
if i == 0: if i == 0:
self.startPlatform.offstage() self.startPlatform.offstage()
@ -193,6 +193,7 @@ class CogdoFlyingLevelFactory:
self.quadVisibiltyAhead = quadVisibilityAhead self.quadVisibiltyAhead = quadVisibilityAhead
self.quadVisibiltyBehind = quadVisibiltyBehind self.quadVisibiltyBehind = quadVisibiltyBehind
self._rng = rng or RandomNumGen(1) self._rng = rng or RandomNumGen(1)
self.isOrg = self._rng.randint(0, 1)
self._level = None self._level = None
return return
@ -200,7 +201,8 @@ class CogdoFlyingLevelFactory:
levelNode = NodePath('level') levelNode = NodePath('level')
frameModel = CogdoUtil.loadFlyingModel('level') frameModel = CogdoUtil.loadFlyingModel('level')
startPlatformModel = CogdoUtil.loadFlyingModel('levelStart') startPlatformModel = CogdoUtil.loadFlyingModel('levelStart')
endPlatformModel = CogdoUtil.loadFlyingModel('levelEnd') ver = '_org' if self.isOrg else ''
endPlatformModel = CogdoUtil.loadFlyingModel('levelEnd%s' % ver)
for fan in frameModel.findAllMatches('**/*wallFan'): for fan in frameModel.findAllMatches('**/*wallFan'):
fan.flattenStrong() fan.flattenStrong()
@ -211,7 +213,8 @@ class CogdoFlyingLevelFactory:
frameModel.find('**/wallL').setBin('opaque', 2) frameModel.find('**/wallL').setBin('opaque', 2)
frameModel.find('**/fogTranslucent_top').setBin('fixed', 2) frameModel.find('**/fogTranslucent_top').setBin('fixed', 2)
frameModel.getChildren().reparentTo(levelNode) frameModel.getChildren().reparentTo(levelNode)
levelNode.hide() if not self.isOrg:
levelNode.hide()
self._level = CogdoFlyingLevel(self.parent, levelNode, startPlatformModel, endPlatformModel, self.quadLengthUnits, self.quadVisibiltyAhead, self.quadVisibiltyBehind) self._level = CogdoFlyingLevel(self.parent, levelNode, startPlatformModel, endPlatformModel, self.quadLengthUnits, self.quadVisibiltyAhead, self.quadVisibiltyBehind)
if Globals.Dev.WantTempLevel: if Globals.Dev.WantTempLevel:
quads = Globals.Dev.DevQuadsOrder quads = Globals.Dev.DevQuadsOrder
@ -223,7 +226,8 @@ class CogdoFlyingLevelFactory:
quads.append(quadList[self._rng.randint(0, len(quadList) - 1)]) quads.append(quadList[self._rng.randint(0, len(quadList) - 1)])
for i in quads: for i in quads:
filePath = CogdoUtil.getModelPath('quadrant%i' % i, 'flying') ver = '_org' if self.isOrg else ''
filePath = CogdoUtil.getModelPath('quadrant%i%s' % (i, ver), 'flying')
quadModel = loader.loadModel(filePath) quadModel = loader.loadModel(filePath)
for np in quadModel.findAllMatches('**/*lightCone*'): for np in quadModel.findAllMatches('**/*lightCone*'):
CogdoUtil.initializeLightCone(np, 'fixed', 3) CogdoUtil.initializeLightCone(np, 'fixed', 3)
@ -240,4 +244,7 @@ class CogdoFlyingLevelFactory:
def createLevelFog(self): def createLevelFog(self):
if self._level is None: if self._level is None:
self.loadAndBuildLevel() self.loadAndBuildLevel()
return CogdoFlyingLevelFog(self._level) if self.isOrg:
return CogdoFlyingLevelFog(self._level, (0,0,0,1))
else:
return CogdoFlyingLevelFog(self._level)

View file

@ -52,8 +52,9 @@ class CogdoFlyingLevelQuadrant:
for np in self._model.findAllMatches('**/*LayerStack*'): for np in self._model.findAllMatches('**/*LayerStack*'):
np.wrtReparentTo(self._model) np.wrtReparentTo(self._model)
for np in self._model.find('**/static').getChildren(): if not self._model.find('**/static').isEmpty():
np.wrtReparentTo(self._model) for np in self._model.find('**/static').getChildren():
np.wrtReparentTo(self._model)
self._model.flattenMedium() self._model.flattenMedium()
@ -138,8 +139,6 @@ class CogdoFlyingLevelQuadrant:
def generatePowerUps(): def generatePowerUps():
for powerupType, locName in Globals.Level.PowerupType2Loc.iteritems(): for powerupType, locName in Globals.Level.PowerupType2Loc.iteritems():
if powerupType == Globals.Level.GatherableTypes.LaffPowerup and Globals.Level.IgnoreLaffPowerups:
continue
gatherables = gatherableModel.findAllMatches('**/%s' % locName) gatherables = gatherableModel.findAllMatches('**/%s' % locName)
for gatherable in gatherables: for gatherable in gatherables:
pickup = self._level.gatherableFactory.createPowerup(powerupType) pickup = self._level.gatherableFactory.createPowerup(powerupType)

View file

@ -555,29 +555,33 @@ class CogdoFlyingLocalPlayer(CogdoFlyingPlayer):
power = math.fabs(distance / fanHeight - 1.0) * powerRange + min power = math.fabs(distance / fanHeight - 1.0) * powerRange + min
power = clamp(power, min, max) power = clamp(power, min, max)
blowVec *= power blowVec *= power
fanVelocity = self.fanIndex2ToonVelocity[fan.index] if fan.index in self.fanIndex2ToonVelocity:
fanVelocity += blowVec fanVelocity = self.fanIndex2ToonVelocity[fan.index]
fanVelocity += blowVec
removeList = [] removeList = []
for fan in self.fansStillHavingEffect: for fan in self.fansStillHavingEffect:
if fan not in self.activeFans: if fan not in self.activeFans:
blowVec = fan.getBlowDirection() blowVec = fan.getBlowDirection()
blowVec *= Globals.Gameplay.ToonDeceleration['fan'] * dt blowVec *= Globals.Gameplay.ToonDeceleration['fan'] * dt
fanVelocity = Vec3(self.fanIndex2ToonVelocity[fan.index]) if fan.index in self.fanIndex2ToonVelocity:
lastLen = fanVelocity.length() fanVelocity = Vec3(self.fanIndex2ToonVelocity[fan.index])
fanVelocity -= blowVec lastLen = fanVelocity.length()
if fanVelocity.length() > lastLen: fanVelocity -= blowVec
removeList.append(fan) if fanVelocity.length() > lastLen:
else: removeList.append(fan)
self.fanIndex2ToonVelocity[fan.index] = fanVelocity else:
self.fanIndex2ToonVelocity[fan.index] = fanVelocity
for fan in removeList: for fan in removeList:
self.fansStillHavingEffect.remove(fan) self.fansStillHavingEffect.remove(fan)
del self.fanIndex2ToonVelocity[fan.index] if fan.index in self.fanIndex2ToonVelocity:
del self.fanIndex2ToonVelocity[fan.index]
self.fanVelocity = Vec3(0.0, 0.0, 0.0) self.fanVelocity = Vec3(0.0, 0.0, 0.0)
for fan in self.fansStillHavingEffect: for fan in self.fansStillHavingEffect:
self.fanVelocity += self.fanIndex2ToonVelocity[fan.index] if fan.index in self.fanIndex2ToonVelocity:
self.fanVelocity += self.fanIndex2ToonVelocity[fan.index]
minVal = -Globals.Gameplay.ToonVelMax['fan'] minVal = -Globals.Gameplay.ToonVelMax['fan']
maxVal = Globals.Gameplay.ToonVelMax['fan'] maxVal = Globals.Gameplay.ToonVelMax['fan']
@ -1073,10 +1077,9 @@ class CogdoFlyingLocalPlayer(CogdoFlyingPlayer):
elif gatherable.type == Globals.Level.GatherableTypes.Propeller: elif gatherable.type == Globals.Level.GatherableTypes.Propeller:
self.handleEnterPropeller(gatherable) self.handleEnterPropeller(gatherable)
elif gatherable.type == Globals.Level.GatherableTypes.LaffPowerup: elif gatherable.type == Globals.Level.GatherableTypes.LaffPowerup:
self._getLaffSfx.play() self.handleEnterLaffPowerup(gatherable)
elif gatherable.type == Globals.Level.GatherableTypes.InvulPowerup: elif gatherable.type == Globals.Level.GatherableTypes.InvulPowerup:
self._getRedTapeSfx.play() self.handleEnterInvulPowerup(gatherable)
messenger.send(CogdoFlyingGuiManager.InvulnerableEventName)
def handleEnterMemo(self, gatherable): def handleEnterMemo(self, gatherable):
self.score += 1 self.score += 1
@ -1097,3 +1100,10 @@ class CogdoFlyingLocalPlayer(CogdoFlyingPlayer):
self._guiMgr.update() self._guiMgr.update()
self._refuelSfx.play() self._refuelSfx.play()
self._refuelSpinSfx.play(volume=0.15) self._refuelSpinSfx.play(volume=0.15)
def handleEnterLaffPowerup(self, gatherable):
self._getLaffSfx.play()
def handleEnterInvulPowerup(self, gatherable):
messenger.send(CogdoFlyingGuiManager.InvulnerableEventName)
self._getRedTapeSfx.play()

View file

@ -242,7 +242,8 @@ class CogdoFlyingPowerup(CogdoFlyingGatherable):
self._model.setAlphaScale(0.5) self._model.setAlphaScale(0.5)
if Globals.Level.AddSparkleToPowerups: if Globals.Level.AddSparkleToPowerups:
self.f = self.find('**/particleEffect_sparkles') self.f = self.find('**/particleEffect_sparkles')
self.f.hide() if not self.f.isEmpty():
self.f.hide()
def pickUp(self, toon, elapsedSeconds = 0.0): def pickUp(self, toon, elapsedSeconds = 0.0):
if self.wasPickedUpByToon(toon) == True: if self.wasPickedUpByToon(toon) == True:
@ -339,6 +340,7 @@ class CogdoFlyingLevelFog:
def __init__(self, level, color = Globals.Level.FogColor): def __init__(self, level, color = Globals.Level.FogColor):
self._level = level self._level = level
self.color = color self.color = color
self.defaultFar = None
fogDistance = self._level.quadLengthUnits * max(1, self._level.quadVisibiltyAhead * 0.2) fogDistance = self._level.quadLengthUnits * max(1, self._level.quadVisibiltyAhead * 0.2)
self.fog = Fog('RenderFog') self.fog = Fog('RenderFog')
self.fog.setColor(self.color) self.fog.setColor(self.color)
@ -346,11 +348,16 @@ class CogdoFlyingLevelFog:
self._visible = False self._visible = False
self._clearColor = Vec4(base.win.getClearColor()) self._clearColor = Vec4(base.win.getClearColor())
self._clearColor.setW(1.0) self._clearColor.setW(1.0)
self.defaultFar = base.camLens.getFar()
base.camLens.setFar(Globals.Camera.GameCameraFar)
base.setBackgroundColor(self.color)
def destroy(self): def destroy(self):
self.setVisible(False) self.setVisible(False)
if hasattr(self, 'fog'): if hasattr(self, 'fog'):
del self.fog del self.fog
if self.defaultFar is not None:
base.camLens.setFar(self.defaultFar)
def isVisible(self): def isVisible(self):
return self._visible return self._visible

View file

@ -16,7 +16,7 @@ from direct.particles import ParticleEffect
from direct.particles import Particles from direct.particles import Particles
from direct.particles import ForceGroup from direct.particles import ForceGroup
class CogdoFlyingObtacleFactory: class CogdoFlyingObstacleFactory:
def __init__(self): def __init__(self):
self._index = -1 self._index = -1
@ -29,8 +29,9 @@ class CogdoFlyingObtacleFactory:
self._fanModel.removeNode() self._fanModel.removeNode()
del self._fanModel del self._fanModel
if Globals.Level.AddParticlesToStreamers: if Globals.Level.AddParticlesToStreamers:
self.f.cleanup() if hasattr(self, 'f'):
del self.f self.f.cleanup()
del self.f
def createFan(self): def createFan(self):
self._index += 1 self._index += 1
@ -237,6 +238,8 @@ class CogdoFlyingMinion(CogdoFlyingObstacle):
d.newSuit(Globals.Gameplay.MinionDnaName) d.newSuit(Globals.Gameplay.MinionDnaName)
self.suit.setDNA(d) self.suit.setDNA(d)
self.suit.setScale(Globals.Gameplay.MinionScale) self.suit.setScale(Globals.Gameplay.MinionScale)
self.suit.nametag3d.stash()
self.suit.nametag.destroy()
swapAvatarShadowPlacer(self.suit, 'minion-%sShadowPlacer' % index) swapAvatarShadowPlacer(self.suit, 'minion-%sShadowPlacer' % index)
self.mopathNodePath = NodePath('mopathNodePath') self.mopathNodePath = NodePath('mopathNodePath')
self.suit.reparentTo(self.mopathNodePath) self.suit.reparentTo(self.mopathNodePath)

View file

@ -233,14 +233,14 @@ class CogdoFlyingPlayer(FSM):
return return
numBlades = fuelState - 1 numBlades = fuelState - 1
if len(self.activeBlades) != numBlades: if len(self.activeBlades) != numBlades:
for i in xrange(len(self.activeBlades)): for i in range(len(self.activeBlades)):
blade = self.activeBlades.pop() blade = self.activeBlades.pop()
blade.stash() blade.stash()
if numBlades > len(self.blades): if numBlades > len(self.blades):
numBlades = len(self.blades) numBlades = len(self.blades)
if numBlades > 0: if numBlades > 0:
for i in xrange(numBlades): for i in range(numBlades):
blade = self.blades[i] blade = self.blades[i]
self.activeBlades.append(blade) self.activeBlades.append(blade)
blade.unstash() blade.unstash()

View file

@ -102,10 +102,7 @@ class CogdoMemo(CogdoGameGatherable):
def __init__(self, serialNum, model = None, pitch = 0, triggerRadius = 1.0, spinRate = 60): def __init__(self, serialNum, model = None, pitch = 0, triggerRadius = 1.0, spinRate = 60):
if model is None: if model is None:
node = CogdoUtil.loadModel('memo', 'shared') model = CogdoUtil.loadModel('joke', 'shared')
model = node.find('**/memo')
model.detachNode()
node.removeNode()
model.setP(pitch) model.setP(pitch)
self._spinRate = spinRate self._spinRate = spinRate
CogdoGameGatherable.__init__(self, serialNum, model, triggerRadius, name='CogdoMemo') CogdoGameGatherable.__init__(self, serialNum, model, triggerRadius, name='CogdoMemo')

View file

@ -76,7 +76,7 @@ class CogdoInterior(Place.Place):
self.parentFSM.getStateNamed('cogdoInterior').addChild(self.fsm) self.parentFSM.getStateNamed('cogdoInterior').addChild(self.fsm)
self.townBattle = TownBattle.TownBattle('town-battle-done') self.townBattle = TownBattle.TownBattle('town-battle-done')
self.townBattle.load() self.townBattle.load()
for i in xrange(1, 3): for i in range(1, 3):
Suit.loadSuits(i) Suit.loadSuits(i)
def unload(self): def unload(self):
@ -90,7 +90,7 @@ class CogdoInterior(Place.Place):
self.townBattle.unload() self.townBattle.unload()
self.townBattle.cleanup() self.townBattle.cleanup()
del self.townBattle del self.townBattle
for i in xrange(1, 3): for i in range(1, 3):
Suit.unloadSuits(i) Suit.unloadSuits(i)
def setState(self, state, battleEvent = None): def setState(self, state, battleEvent = None):

View file

@ -109,8 +109,8 @@ class CogdoMazeFactory:
quadrantKeys = self._cogdoMazeData.QuadrantCollisions.keys() quadrantKeys = self._cogdoMazeData.QuadrantCollisions.keys()
self._rng.shuffle(quadrantKeys) self._rng.shuffle(quadrantKeys)
i = 0 i = 0
for y in xrange(self.height): for y in range(self.height):
for x in xrange(self.width): for x in range(self.width):
key = quadrantKeys[i] key = quadrantKeys[i]
collTable = self._cogdoMazeData.QuadrantCollisions[key] collTable = self._cogdoMazeData.QuadrantCollisions[key]
angle = self._cogdoMazeData.QuadrantAngles[self._rng.randint(0, len(self._cogdoMazeData.QuadrantAngles) - 1)] angle = self._cogdoMazeData.QuadrantAngles[self._rng.randint(0, len(self._cogdoMazeData.QuadrantAngles) - 1)]
@ -121,9 +121,9 @@ class CogdoMazeFactory:
def _generateBarrierData(self): def _generateBarrierData(self):
data = [] data = []
for y in xrange(self.height): for y in range(self.height):
data.append([]) data.append([])
for x in xrange(self.width): for x in range(self.width):
if x == self.width - 1: if x == self.width - 1:
ax = -1 ax = -1
else: else:
@ -204,12 +204,12 @@ class CogdoMazeFactory:
self._data['originX'] = int(self._data['width'] / 2) self._data['originX'] = int(self._data['width'] / 2)
self._data['originY'] = int(self._data['height'] / 2) self._data['originY'] = int(self._data['height'] / 2)
collisionTable = [] collisionTable = []
horizontalWall = [ 1 for x in xrange(self._data['width']) ] horizontalWall = [ 1 for x in range(self._data['width']) ]
collisionTable.append(horizontalWall) collisionTable.append(horizontalWall)
for i in xrange(0, len(self.quadrantData), self.width): for i in range(0, len(self.quadrantData), self.width):
for y in xrange(self.quadrantSize): for y in range(self.quadrantSize):
row = [1] row = [1]
for x in xrange(i, i + self.width): for x in range(i, i + self.width):
if x == 1 and y < self.quadrantSize / 2 - 2: if x == 1 and y < self.quadrantSize / 2 - 2:
newData = [] newData = []
for j in self.quadrantData[x][1][y]: for j in self.quadrantData[x][1][y]:
@ -227,17 +227,17 @@ class CogdoMazeFactory:
collisionTable.append(horizontalWall[:]) collisionTable.append(horizontalWall[:])
barriers = Globals.MazeBarriers barriers = Globals.MazeBarriers
for i in xrange(len(barriers)): for i in range(len(barriers)):
for coords in barriers[i]: for coords in barriers[i]:
collisionTable[coords[1]][coords[0]] = 0 collisionTable[coords[1]][coords[0]] = 0
y = self._data['originY'] y = self._data['originY']
for x in xrange(len(collisionTable[y])): for x in range(len(collisionTable[y])):
if collisionTable[y][x] == 0: if collisionTable[y][x] == 0:
collisionTable[y][x] = 2 collisionTable[y][x] = 2
x = self._data['originX'] x = self._data['originX']
for y in xrange(len(collisionTable)): for y in range(len(collisionTable)):
if collisionTable[y][x] == 0: if collisionTable[y][x] == 0:
collisionTable[y][x] = 2 collisionTable[y][x] = 2
@ -254,8 +254,8 @@ class CogdoMazeFactory:
halfWidth = int(self.width / 2) halfWidth = int(self.width / 2)
halfHeight = int(self.height / 2) halfHeight = int(self.height / 2)
i = 0 i = 0
for y in xrange(self.height): for y in range(self.height):
for x in xrange(self.width): for x in range(self.width):
ax = (x - halfWidth) * size ax = (x - halfWidth) * size
ay = (y - halfHeight) * size ay = (y - halfHeight) * size
extension = '' extension = ''
@ -272,7 +272,7 @@ class CogdoMazeFactory:
quadrantHalfUnitSize = quadrantUnitSize * 0.5 quadrantHalfUnitSize = quadrantUnitSize * 0.5
barrierModel = CogdoUtil.loadMazeModel('grouping_blockerDivider').find('**/divider') barrierModel = CogdoUtil.loadMazeModel('grouping_blockerDivider').find('**/divider')
y = 3 y = 3
for x in xrange(self.width): for x in range(self.width):
if x == (self.width - 1) / 2: if x == (self.width - 1) / 2:
continue continue
ax = (x - halfWidth) * size ax = (x - halfWidth) * size
@ -284,7 +284,7 @@ class CogdoMazeFactory:
offset = self.cellWidth - 0.5 offset = self.cellWidth - 0.5
for x in (0, 3): for x in (0, 3):
for y in xrange(self.height): for y in range(self.height):
ax = (x - halfWidth) * size - quadrantHalfUnitSize - frameActualSize + offset ax = (x - halfWidth) * size - quadrantHalfUnitSize - frameActualSize + offset
ay = (y - halfHeight) * size ay = (y - halfHeight) * size
b = NodePath('barrier') b = NodePath('barrier')

View file

@ -49,20 +49,20 @@ class CogdoMazeGame(DirectObject):
self.lastBalloonTimestamp = None self.lastBalloonTimestamp = None
difficulty = self.distGame.getDifficulty() difficulty = self.distGame.getDifficulty()
serialNum = 0 serialNum = 0
for i in xrange(numSuits[0]): for i in range(numSuits[0]):
suitRng = RandomNumGen(self.distGame.doId + serialNum * 10) suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
suit = CogdoMazeBossSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[0][i]) suit = CogdoMazeBossSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[0][i])
self.addSuit(suit) self.addSuit(suit)
self.guiMgr.mazeMapGui.addSuit(suit.suit) self.guiMgr.mazeMapGui.addSuit(suit.suit)
serialNum += 1 serialNum += 1
for i in xrange(numSuits[1]): for i in range(numSuits[1]):
suitRng = RandomNumGen(self.distGame.doId + serialNum * 10) suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
suit = CogdoMazeFastMinionSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[1][i]) suit = CogdoMazeFastMinionSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[1][i])
self.addSuit(suit) self.addSuit(suit)
serialNum += 1 serialNum += 1
for i in xrange(numSuits[2]): for i in range(numSuits[2]):
suitRng = RandomNumGen(self.distGame.doId + serialNum * 10) suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
suit = CogdoMazeSlowMinionSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[2][i]) suit = CogdoMazeSlowMinionSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[2][i])
self.addSuit(suit) self.addSuit(suit)
@ -269,7 +269,7 @@ class CogdoMazeGame(DirectObject):
self.players.remove(cPlayer) self.players.remove(cPlayer)
break break
if player.toon.doId in self.toonId2Player: if self.toonId2Player.has_key(player.toon.doId):
del self.toonId2Player[player.toon.doId] del self.toonId2Player[player.toon.doId]
self.guiMgr.mazeMapGui.removeToon(player.toon) self.guiMgr.mazeMapGui.removeToon(player.toon)
@ -302,7 +302,7 @@ class CogdoMazeGame(DirectObject):
def __updateGags(self): def __updateGags(self):
remove = [] remove = []
for i in xrange(len(self.gags)): for i in range(len(self.gags)):
balloon = self.gags[i] balloon = self.gags[i]
if balloon.isSingleton(): if balloon.isSingleton():
remove.append(i) remove.append(i)
@ -353,7 +353,7 @@ class CogdoMazeGame(DirectObject):
start = math.radians(random.randint(0, 360)) start = math.radians(random.randint(0, 360))
step = math.radians(360.0 / numDrops) step = math.radians(360.0 / numDrops)
radius = 2.0 radius = 2.0
for i in xrange(numDrops): for i in range(numDrops):
angle = start + i * step angle = start + i * step
x = radius * math.cos(angle) + suit.suit.getX() x = radius * math.cos(angle) + suit.suit.getX()
y = radius * math.sin(angle) + suit.suit.getY() y = radius * math.sin(angle) + suit.suit.getY()

View file

@ -188,7 +188,7 @@ class CogdoMazeBossGui(DirectFrame):
self._openDoor.stash() self._openDoor.stash()
spacingX = codeFrameWidth + codeFrameGap spacingX = codeFrameWidth + codeFrameGap
startX = -0.5 * ((self._codeLength - 1) * spacingX - codeFrameGap) startX = -0.5 * ((self._codeLength - 1) * spacingX - codeFrameGap)
for i in xrange(self._codeLength): for i in range(self._codeLength):
marker = CogdoMazeBossCodeFrame(i, self._code[i], bossCard) marker = CogdoMazeBossCodeFrame(i, self._code[i], bossCard)
marker.reparentTo(self) marker.reparentTo(self)
marker.setPos(bossCard, startX + spacingX * i, 0, 0) marker.setPos(bossCard, startX + spacingX * i, 0, 0)

View file

@ -123,7 +123,7 @@ class CogdoMazeGameIntro(CogdoGameMovie):
def end(): def end():
self._stopUpdateTask() self._stopUpdateTask()
self._ival = Sequence(Func(start), Func(self.displayLine, 'toon', self._getRandomLine(dialogue[0])), showExitIval, Func(showWaterCooler), Func(self.displayLine, 'toon', self._getRandomLine(dialogue[1])), Wait(waitDuration), Func(showBoss), bossSuit.hprInterval(1.0, bossSuit.getHpr() + Point3(180, 0, 0), blendType='easeInOut'), Func(self.displayLine, 'toon', self._getRandomLine(dialogue[2])), Wait(waitDuration - 1.0), Func(end)) self._ival = Sequence(Func(start), Func(self.displayLine, 'cog', self._getRandomLine(dialogue[0])), showExitIval, Func(showWaterCooler), Func(self.displayLine, 'toon', self._getRandomLine(dialogue[1])), Wait(waitDuration), Func(showBoss), bossSuit.hprInterval(1.0, bossSuit.getHpr() + Point3(180, 0, 0), blendType='easeInOut'), Func(self.displayLine, 'cog', self._getRandomLine(dialogue[2])), Wait(waitDuration - 1.0), Func(end))
self._startUpdateTask() self._startUpdateTask()
def _setCamTarget(self, targetNP, distance, offset = Point3(0, 0, 0), angle = Point3(0, 0, 0)): def _setCamTarget(self, targetNP, distance, offset = Point3(0, 0, 0), angle = Point3(0, 0, 0)):

View file

@ -102,6 +102,7 @@ class CogdoMazeGuiManager:
self._initTimer() self._initTimer()
self._timer.setTime(duration) self._timer.setTime(duration)
self._timer.countdown(duration, timerExpiredCallback) self._timer.countdown(duration, timerExpiredCallback)
self._timer.show()
self._presentTimerIval = ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._timer, 'present_timer', startPos=(0, 0, 0.35))) self._presentTimerIval = ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._timer, 'present_timer', startPos=(0, 0, 0.35)))
return return

View file

@ -19,7 +19,7 @@ class CogdoMazeSuit(MazeSuit, FSM, CogdoMazeSplattable):
MazeSuit.__init__(self, serialNum, maze, randomNumGen, data['cellWalkPeriod'], difficulty, data['dnaName'], startTile=startTile, walkSameDirectionProb=Globals.SuitWalkSameDirectionProb, walkTurnAroundProb=Globals.SuitWalkTurnAroundProb, uniqueRandomNumGen=False, walkAnimName=walkAnimName) MazeSuit.__init__(self, serialNum, maze, randomNumGen, data['cellWalkPeriod'], difficulty, data['dnaName'], startTile=startTile, walkSameDirectionProb=Globals.SuitWalkSameDirectionProb, walkTurnAroundProb=Globals.SuitWalkTurnAroundProb, uniqueRandomNumGen=False, walkAnimName=walkAnimName)
FSM.__init__(self, 'CogdoMazeSuit') FSM.__init__(self, 'CogdoMazeSuit')
CogdoMazeSplattable.__init__(self, self.suit, '%s-%i' % (Globals.SuitCollisionName, self.serialNum), 1.5) CogdoMazeSplattable.__init__(self, self.suit, '%s-%i' % (Globals.SuitCollisionName, self.serialNum), 1.5)
if 'scale' in data: if data.has_key('scale'):
self.suit.setScale(data['scale']) self.suit.setScale(data['scale'])
self.hp = data['hp'] self.hp = data['hp']
self.type = cogdoSuitType self.type = cogdoSuitType
@ -228,8 +228,8 @@ class CogdoMazeBossSuit(CogdoMazeSuit):
def pickRandomValidSpot(self, r = 5): def pickRandomValidSpot(self, r = 5):
validSpots = [] validSpots = []
for x in xrange(self.TX - r, self.TX + r): for x in range(self.TX - r, self.TX + r):
for y in xrange(self.TY - r, self.TY + r): for y in range(self.TY - r, self.TY + r):
if self.maze.isWalkable(x, y): if self.maze.isWalkable(x, y):
validSpots.append([x, y]) validSpots.append([x, y])

View file

@ -9,9 +9,9 @@ MEMOICON_SCALE = 0.2
class CogdoMemoGui(DirectFrame): class CogdoMemoGui(DirectFrame):
def __init__(self, parent): def __init__(self, parent, type='joke_card'):
DirectFrame.__init__(self, parent=parent, relief=None, state=DGG.NORMAL, sortOrder=DGG.BACKGROUND_SORT_INDEX) DirectFrame.__init__(self, parent=parent, relief=None, state=DGG.NORMAL, sortOrder=DGG.BACKGROUND_SORT_INDEX)
self._initModel() self._initModel(type)
self.hide() self.hide()
return return
@ -26,9 +26,9 @@ class CogdoMemoGui(DirectFrame):
def posNextToLaffMeter(self): def posNextToLaffMeter(self):
self.setPos(-0.975, 0, -0.875) self.setPos(-0.975, 0, -0.875)
def _initModel(self): def _initModel(self, type='joke_card'):
self._countLabel = DirectLabel(parent=self, relief=None, pos=(0.0625, 0, -0.025), scale=CogdoGameConsts.MemoGuiTextScale, text=str(0), text_fg=CogdoGameConsts.MemoGuiTextColor, text_shadow=(0.2, 0.2, 0.2, 1), text_align=TextNode.ALeft, text_font=ToontownGlobals.getToonFont()) self._countLabel = DirectLabel(parent=self, relief=None, pos=(0.0625, 0, -0.025), scale=CogdoGameConsts.MemoGuiTextScale, text=str(0), text_fg=CogdoGameConsts.MemoGuiTextColor, text_shadow=(0.2, 0.2, 0.2, 1), text_align=TextNode.ALeft, text_font=ToontownGlobals.getToonFont())
self._memoIcon = CogdoUtil.loadModel('memo_card', game='shared', group='gui') self._memoIcon = CogdoUtil.loadModel(type, game='shared', group='gui')
self._memoIcon.reparentTo(self) self._memoIcon.reparentTo(self)
self._memoIcon.setScale(MEMOICON_SCALE) self._memoIcon.setScale(MEMOICON_SCALE)
return return

View file

@ -69,7 +69,7 @@ class CogdoGameMovie:
textNode.setFont(ToontownGlobals.getToonFont()) textNode.setFont(ToontownGlobals.getToonFont())
self._dialogueLabel = aspect2d.attachNewNode(textNode) self._dialogueLabel = aspect2d.attachNewNode(textNode)
self._dialogueLabel.setScale(0.06, 0.06, 0.06) self._dialogueLabel.setScale(0.06, 0.06, 0.06)
self._dialogueLabel.setPos(0.32, 0, -0.75) self._dialogueLabel.setPos(0.32, 0, -0.7325)
self._dialogueLabel.reparentTo(hidden) self._dialogueLabel.reparentTo(hidden)
def unload(self): def unload(self):
@ -120,9 +120,9 @@ def rotateTable(table, angle):
t = [] t = []
width = len(table[0]) width = len(table[0])
height = len(table) height = len(table)
for j in xrange(width): for j in range(width):
row = [] row = []
for i in xrange(height): for i in range(height):
row.append(table[height - 1 - i][j]) row.append(table[height - 1 - i][j])
t.append(row) t.append(row)
@ -137,9 +137,9 @@ def rotateTable(table, angle):
t = [] t = []
width = len(table[0]) width = len(table[0])
height = len(table) height = len(table)
for j in xrange(width): for j in range(width):
row = [] row = []
for i in xrange(height): for i in range(height):
row.append(table[i][width - 1 - j]) row.append(table[i][width - 1 - j])
t.append(row) t.append(row)

View file

@ -1,20 +1,17 @@
from direct.distributed import DistributedObject from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.fsm import FSM from direct.fsm import FSM
from direct.gui.DirectGui import * from direct.distributed import DistributedObject
from direct.interval.IntervalGlobal import *
from direct.showbase import PythonUtil
from direct.showutil import Rope from direct.showutil import Rope
from direct.showbase import PythonUtil
from direct.task import Task from direct.task import Task
from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals
import random from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
from toontown.cogdominium import CogdoCraneGameConsts as GameConsts from toontown.cogdominium import CogdoCraneGameConsts as GameConsts
from toontown.nametag import NametagGlobals import random
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM): class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
notify = DirectNotifyGlobal.directNotify.newCategory('DistCogdoCrane') notify = DirectNotifyGlobal.directNotify.newCategory('DistCogdoCrane')
@ -235,7 +232,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.physicsActivated = 0 self.physicsActivated = 0
def __straightenCable(self): def __straightenCable(self):
for linkNum in xrange(self.numLinks): for linkNum in range(self.numLinks):
an, anp, cnp = self.activeLinks[linkNum] an, anp, cnp = self.activeLinks[linkNum]
an.getPhysicsObject().setVelocity(0, 0, 0) an.getPhysicsObject().setVelocity(0, 0, 0)
z = float(linkNum + 1) / float(self.numLinks) * self.cableLength z = float(linkNum + 1) / float(self.numLinks) * self.cableLength
@ -258,7 +255,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.links = [] self.links = []
self.links.append((self.topLink, Point3(0, 0, 0))) self.links.append((self.topLink, Point3(0, 0, 0)))
anchor = self.topLink anchor = self.topLink
for linkNum in xrange(self.numLinks): for linkNum in range(self.numLinks):
anchor = self.__makeLink(anchor, linkNum) anchor = self.__makeLink(anchor, linkNum)
self.collisions.stash() self.collisions.stash()
@ -401,7 +398,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
taskMgr.add(self.__watchControls, 'watchCraneControls') taskMgr.add(self.__watchControls, 'watchCraneControls')
taskMgr.doMethodLater(5, self.__displayCraneAdvice, self.craneAdviceName) taskMgr.doMethodLater(5, self.__displayCraneAdvice, self.craneAdviceName)
taskMgr.doMethodLater(10, self.__displayMagnetAdvice, self.magnetAdviceName) taskMgr.doMethodLater(10, self.__displayMagnetAdvice, self.magnetAdviceName)
NametagGlobals.setForceOnscreenChat(True) NametagGlobals.setOnscreenChatForced(1)
self.arrowVert = 0 self.arrowVert = 0
self.arrowHorz = 0 self.arrowHorz = 0
@ -418,7 +415,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.ignore('InputState-turnRight') self.ignore('InputState-turnRight')
self.arrowVert = 0 self.arrowVert = 0
self.arrowHorz = 0 self.arrowHorz = 0
NametagGlobals.setForceOnscreenChat(False) NametagGlobals.setOnscreenChatForced(0)
taskMgr.remove('watchCraneControls') taskMgr.remove('watchCraneControls')
self.__setMoveSound(None) self.__setMoveSound(None)
return return
@ -554,7 +551,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
def startFlicker(self): def startFlicker(self):
self.magnetSoundInterval.start() self.magnetSoundInterval.start()
self.lightning = [] self.lightning = []
for i in xrange(4): for i in range(4):
t = float(i) / 3.0 - 0.5 t = float(i) / 3.0 - 0.5
l = self.craneGame.lightning.copyTo(self.gripper) l = self.craneGame.lightning.copyTo(self.gripper)
l.setScale(random.choice([1, -1]), 1, 5) l.setScale(random.choice([1, -1]), 1, 5)
@ -683,7 +680,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.armSmoother.setPos(self.crane.getPos()) self.armSmoother.setPos(self.crane.getPos())
self.armSmoother.setHpr(self.arm.getHpr()) self.armSmoother.setHpr(self.arm.getHpr())
self.armSmoother.setPhonyTimestamp() self.armSmoother.setPhonyTimestamp()
for linkNum in xrange(self.numLinks): for linkNum in range(self.numLinks):
smoother = self.linkSmoothers[linkNum] smoother = self.linkSmoothers[linkNum]
an, anp, cnp = self.activeLinks[linkNum] an, anp, cnp = self.activeLinks[linkNum]
smoother.clearPositions(0) smoother.clearPositions(0)
@ -692,7 +689,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
def doSmoothTask(self, task): def doSmoothTask(self, task):
self.armSmoother.computeAndApplySmoothPosHpr(self.crane, self.arm) self.armSmoother.computeAndApplySmoothPosHpr(self.crane, self.arm)
for linkNum in xrange(self.numLinks): for linkNum in range(self.numLinks):
smoother = self.linkSmoothers[linkNum] smoother = self.linkSmoothers[linkNum]
anp = self.activeLinks[linkNum][1] anp = self.activeLinks[linkNum][1]
smoother.computeAndApplySmoothPos(anp) smoother.computeAndApplySmoothPos(anp)
@ -719,7 +716,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.armSmoother.applySmoothPos(self.crane) self.armSmoother.applySmoothPos(self.crane)
self.armSmoother.applySmoothHpr(self.arm) self.armSmoother.applySmoothHpr(self.arm)
self.armSmoother.clearPositions(1) self.armSmoother.clearPositions(1)
for linkNum in xrange(self.numLinks): for linkNum in range(self.numLinks):
smoother = self.linkSmoothers[linkNum] smoother = self.linkSmoothers[linkNum]
an, anp, cnp = self.activeLinks[linkNum] an, anp, cnp = self.activeLinks[linkNum]
if smoother.getLatestPosition(): if smoother.getLatestPosition():
@ -735,7 +732,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.armSmoother.setH(h) self.armSmoother.setH(h)
self.armSmoother.setTimestamp(local) self.armSmoother.setTimestamp(local)
self.armSmoother.markPosition() self.armSmoother.markPosition()
for linkNum in xrange(self.numLinks): for linkNum in range(self.numLinks):
smoother = self.linkSmoothers[linkNum] smoother = self.linkSmoothers[linkNum]
lp = links[linkNum] lp = links[linkNum]
smoother.setPos(*lp) smoother.setPos(*lp)
@ -749,7 +746,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
def d_sendCablePos(self): def d_sendCablePos(self):
timestamp = globalClockDelta.getFrameNetworkTime() timestamp = globalClockDelta.getFrameNetworkTime()
links = [] links = []
for linkNum in xrange(self.numLinks): for linkNum in range(self.numLinks):
an, anp, cnp = self.activeLinks[linkNum] an, anp, cnp = self.activeLinks[linkNum]
p = anp.getPos() p = anp.getPos()
links.append((p[0], p[1], p[2])) links.append((p[0], p[1], p[2]))

View file

@ -102,7 +102,7 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
self.notify.warning('Not a collision node: %s' % repr(cnp)) self.notify.warning('Not a collision node: %s' % repr(cnp))
break break
newCollideMask = newCollideMask | cn.getIntoCollideMask() newCollideMask = newCollideMask | cn.getIntoCollideMask()
for i in xrange(cn.getNumSolids()): for i in range(cn.getNumSolids()):
solid = cn.getSolid(i) solid = cn.getSolid(i)
if isinstance(solid, PM.CollisionPolygon): if isinstance(solid, PM.CollisionPolygon):
plane = PM.Plane(solid.getPlane()) plane = PM.Plane(solid.getPlane())

View file

@ -1,6 +1,70 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify.DirectNotifyGlobal import directNotify
from toontown.cogdominium.DistCogdoLevelGameAI import DistCogdoLevelGameAI from toontown.cogdominium.DistCogdoLevelGameAI import DistCogdoLevelGameAI
from toontown.cogdominium.DistCogdoCraneAI import DistCogdoCraneAI
from toontown.cogdominium import CogdoCraneGameConsts as GameConsts
from toontown.cogdominium.CogdoCraneGameBase import CogdoCraneGameBase
class DistCogdoCraneGameAI(DistCogdoLevelGameAI): class DistCogdoCraneGameAI(DistCogdoLevelGameAI, CogdoCraneGameBase):
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoCraneGameAI") notify = directNotify.newCategory('DistCogdoCraneGameAI')
def __init__(self, air, interior):
DistCogdoLevelGameAI.__init__(self, air, interior)
self._cranes = [
None] * self.MaxPlayers
def enterLoaded(self):
DistCogdoLevelGameAI.enterLoaded(self)
for i in xrange(self.MaxPlayers):
crane = DistCogdoCraneAI(self.air, self, i)
crane.generateWithRequired(self.zoneId)
self._cranes[i] = crane
def exitLoaded(self):
for i in xrange(self.MaxPlayers):
if self._cranes[i]:
self._cranes[i].requestDelete()
self._cranes[i] = None
continue
DistCogdoLevelGameAI.exitLoaded(self)
def enterGame(self):
DistCogdoLevelGameAI.enterGame(self)
for i in xrange(self.getNumPlayers()):
self._cranes[i].request('Controlled', self.getToonIds()[i])
self._scheduleGameDone()
def _scheduleGameDone(self):
timeLeft = GameConsts.Settings.GameDuration.get() - globalClock.getRealTime() - self.getStartTime()
if timeLeft > 0:
self._gameDoneEvent = taskMgr.doMethodLater(timeLeft, self._gameDoneDL, self.uniqueName('boardroomGameDone'))
else:
self._gameDoneDL()
def exitGame(self):
taskMgr.remove(self._gameDoneEvent)
self._gameDoneEvent = None
def _gameDoneDL(self, task = None):
self._handleGameFinished()
return task.done
def enterFinish(self):
DistCogdoLevelGameAI.enterFinish(self)
self._finishDoneEvent = taskMgr.doMethodLater(10.0, self._finishDoneDL, self.uniqueName('boardroomFinishDone'))
def exitFinish(self):
taskMgr.remove(self._finishDoneEvent)
self._finishDoneEvent = None
def _finishDoneDL(self, task):
self.announceGameDone()
return task.done
if __dev__:
def _handleGameDurationChanged(self, gameDuration):
if hasattr(self, '_gameDoneEvent') and self._gameDoneEvent != None:
taskMgr.remove(self._gameDoneEvent)
self._scheduleGameDone()

View file

@ -126,10 +126,12 @@ class DistCogdoCraneObject(DistributedSmoothNode.DistributedSmoothNode, FSM.FSM)
vel.normalize() vel.normalize()
impact = vel[1] impact = vel[1]
if impact >= self.getMinImpact(): if impact >= self.getMinImpact():
print 'hit! %s' % impact
self.hitBossSoundInterval.start() self.hitBossSoundInterval.start()
self.doHitBoss(impact) self.doHitBoss(impact)
else: else:
self.touchedBossSoundInterval.start() self.touchedBossSoundInterval.start()
print '--not hard enough: %s' % impact
def doHitBoss(self, impact): def doHitBoss(self, impact):
self.d_hitBoss(impact) self.d_hitBoss(impact)

View file

@ -10,8 +10,6 @@ class DistCogdoFlyingGame(DistCogdoGame):
def __init__(self, cr): def __init__(self, cr):
DistCogdoGame.__init__(self, cr) DistCogdoGame.__init__(self, cr)
if __debug__ and base.config.GetBool('schellgames-dev', True):
self.accept('onCodeReload', self.__sgOnCodeReload)
self.game = CogdoFlyingGame(self) self.game = CogdoFlyingGame(self)
def delete(self): def delete(self):

View file

@ -1,42 +1,129 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import *
from toontown.cogdominium.DistCogdoGameAI import DistCogdoGameAI from toontown.cogdominium.DistCogdoGameAI import DistCogdoGameAI
import CogdoFlyingGameGlobals as Globals
class DistCogdoFlyingGameAI(DistCogdoGameAI): class DistCogdoFlyingGameAI(DistCogdoGameAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoFlyingGameAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoFlyingGameAI")
def __init__(self, air):
DistCogdoGameAI.__init__(self, air)
self.completed = []
self.eagles = {}
self.totalMemos = 0
def requestAction(self, action, data):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
if action == Globals.AI.GameActions.LandOnWinPlatform:
self.completed.append(avId)
for toon in self.toons:
if toon not in self.completed:
return
self.gameDone()
elif action == Globals.AI.GameActions.BladeLost:
self.sendUpdate("toonBladeLost", [avId])
elif action == Globals.AI.GameActions.SetBlades:
self.sendUpdate("toonSetBlades", [avId, data])
elif action == Globals.AI.GameActions.Died:
damage = Globals.AI.SafezoneId2DeathDamage[self.getSafezoneId()]
self.__damage(av, damage)
self.sendUpdate("toonDied", [avId, globalClockDelta.getRealNetworkTime()])
elif action == Globals.AI.GameActions.Spawn:
self.sendUpdate("toonSpawn", [avId, globalClockDelta.getRealNetworkTime()])
elif action == Globals.AI.GameActions.RequestEnterEagleInterest:
if not self.eagles.get(data):
self.eagles[data] = avId
self.sendUpdate("toonSetAsEagleTarget", [avId, data, globalClockDelta.getRealNetworkTime()])
elif action == Globals.AI.GameActions.RequestExitEagleInterest:
if self.eagles.get(data) == avId:
self.eagles[data] = 0
self.sendUpdate("toonClearAsEagleTarget", [avId, data, globalClockDelta.getRealNetworkTime()])
elif action == Globals.AI.GameActions.HitLegalEagle:
damage = Globals.AI.SafezoneId2LegalEagleDamage[self.getSafezoneId()]
self.__damage(av, damage)
elif action == Globals.AI.GameActions.HitMinion:
damage = Globals.AI.SafezoneId2MinionDamage[self.getSafezoneId()]
self.__damage(av, damage)
elif action == Globals.AI.GameActions.HitWhirlwind:
damage = Globals.AI.SafezoneId2WhirlwindDamage[self.getSafezoneId()]
self.__damage(av, damage)
elif action == Globals.AI.GameActions.RanOutOfTimePenalty:
damage = int(20 * self.getDifficulty())
self.__damage(av, damage)
else:
self.notify.warning('Client requested unknown action \'%s\'' %action)
def requestAction(self, todo0, todo1): def requestPickUp(self, pickupNum, pickupType):
pass avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
if pickupType <= len(Globals.Level.GatherableTypes):
self.sendUpdate("pickUp", [avId, pickupNum, globalClockDelta.getRealNetworkTime()])
if pickupType == Globals.Level.GatherableTypes.LaffPowerup:
av.toonUp(int(27 * self.getDifficulty()) + 3)
if pickupType == Globals.Level.GatherableTypes.Memo:
self.totalMemos += 1
else:
self.notify.warning('Client requested unknown pickup \'%s\'' % pickupType)
def requestPickUp(self, todo0, todo1): def handleStart(self):
pass for toon in self.toons:
self.acceptOnce(self.air.getAvatarExitEvent(toon), self.__handleAvExit, [toon])
def __handleAvExit(self, toon):
if self.air:
if toon in self.toons:
self.toons.remove(toon)
self.ignore(self.air.getAvatarExitEvent(toon))
if not self.toons:
self.gameDone(failed=True)
def requestDelete(self):
DistCogdoGameAI.requestDelete(self)
self.ignoreAll()
def __removeToon(self, avId):
if avId not in self.toons:
return
self.toons.pop(self.toons.index(avId))
if len(self.toons) == 0:
self.gameDone(failed=True)
def __damage(self, av, damage):
av.takeDamage(damage)
if av.getHp() < 1:
self.__removeToon(av.doId)
def getTotalMemos(self):
return self.totalMemos
def pickUp(self, todo0, todo1, todo2): from otp.ai.MagicWordGlobal import *
pass
def debuffPowerup(self, todo0, todo1, todo2):
pass
def doAction(self, todo0, todo1):
pass
def eagleExitCooldown(self, todo0, todo1):
pass
def toonSetAsEagleTarget(self, todo0, todo1, todo2):
pass
def toonClearAsEagleTarget(self, todo0, todo1, todo2):
pass
def toonDied(self, todo0, todo1):
pass
def toonSpawn(self, todo0, todo1):
pass
def toonSetBlades(self, todo0, todo1):
pass
def toonBladeLost(self, todo0):
pass
@magicWord(category=CATEGORY_MODERATOR)
def endFly():
if hasattr(simbase.air, 'cogdoGame'):
game = simbase.air.cogdoGame
game.requestAction(Globals.AI.GameActions.LandOnWinPlatform, 0)
return 'Finished cogdo flying game!'

View file

@ -11,7 +11,7 @@ from toontown.minigame.MinigameRulesPanel import MinigameRulesPanel
from toontown.cogdominium.CogdoGameRulesPanel import CogdoGameRulesPanel from toontown.cogdominium.CogdoGameRulesPanel import CogdoGameRulesPanel
from toontown.minigame import MinigameGlobals from toontown.minigame import MinigameGlobals
from toontown.toonbase import TTLocalizer as TTL from toontown.toonbase import TTLocalizer as TTL
SCHELLGAMES_DEV = __debug__ and base.config.GetBool('schellgames-dev', False) SCHELLGAMES_DEV = __debug__ and base.config.GetBool('cogdo-enable-cheat', True)
class DistCogdoGame(DistCogdoGameBase, DistributedObject): class DistCogdoGame(DistCogdoGameBase, DistributedObject):
notify = directNotify.newCategory('DistCogdoGame') notify = directNotify.newCategory('DistCogdoGame')
@ -19,6 +19,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
def __init__(self, cr): def __init__(self, cr):
DistributedObject.__init__(self, cr) DistributedObject.__init__(self, cr)
base.cogdoGame = self base.cogdoGame = self
cr.cogdoGame = self
self._waitingStartLabel = DirectLabel(text=TTL.MinigameWaitingForOtherPlayers, text_fg=VBase4(1, 1, 1, 1), relief=None, pos=(-0.6, 0, -0.75), scale=0.075) self._waitingStartLabel = DirectLabel(text=TTL.MinigameWaitingForOtherPlayers, text_fg=VBase4(1, 1, 1, 1), relief=None, pos=(-0.6, 0, -0.75), scale=0.075)
self._waitingStartLabel.hide() self._waitingStartLabel.hide()
self.loadFSM = ClassicFSM.ClassicFSM('DistCogdoGame.loaded', [State.State('NotLoaded', self.enterNotLoaded, self.exitNotLoaded, ['Loaded']), State.State('Loaded', self.enterLoaded, self.exitLoaded, ['NotLoaded'])], 'NotLoaded', 'NotLoaded') self.loadFSM = ClassicFSM.ClassicFSM('DistCogdoGame.loaded', [State.State('NotLoaded', self.enterNotLoaded, self.exitNotLoaded, ['Loaded']), State.State('Loaded', self.enterLoaded, self.exitLoaded, ['NotLoaded'])], 'NotLoaded', 'NotLoaded')
@ -71,7 +72,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
return return
def getToon(self, toonId): def getToon(self, toonId):
if toonId in self.cr.doId2do: if self.cr.doId2do.has_key(toonId):
return self.cr.doId2do[toonId] return self.cr.doId2do[toonId]
else: else:
return None return None
@ -88,8 +89,8 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
def announceGenerate(self): def announceGenerate(self):
DistributedObject.announceGenerate(self) DistributedObject.announceGenerate(self)
self._requestInterior()
self.loadFSM.request('Loaded') self.loadFSM.request('Loaded')
self._requestInterior()
self.notify.info('difficulty: %s, safezoneId: %s' % (self.getDifficulty(), self.getSafezoneId())) self.notify.info('difficulty: %s, safezoneId: %s' % (self.getDifficulty(), self.getSafezoneId()))
def _requestInterior(self): def _requestInterior(self):
@ -116,6 +117,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
def disable(self): def disable(self):
base.cogdoGame = None base.cogdoGame = None
self.cr.cogdoGame = None
self.fsm.requestFinalState() self.fsm.requestFinalState()
self.loadFSM.requestFinalState() self.loadFSM.requestFinalState()
self.fsm = None self.fsm = None
@ -230,7 +232,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
def enterGame(self): def enterGame(self):
if SCHELLGAMES_DEV: if SCHELLGAMES_DEV:
self.acceptOnce('escape', messenger.send, ['magicWord', ['~endgame']]) self.acceptOnce('escape', messenger.send, ['magicWord', ['~endMaze']])
def exitGame(self): def exitGame(self):
if SCHELLGAMES_DEV: if SCHELLGAMES_DEV:

View file

@ -1,36 +1,108 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import *
import CogdoGameConsts
class DistCogdoGameAI(DistributedObjectAI): class DistCogdoGameAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoGameAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoGameAI")
delayIntro = .1
def setInteriorId(self, todo0):
pass def __init__(self, air):
DistributedObjectAI.__init__(self, air)
def setExteriorZone(self, todo0): air.cogdoGame = self
pass self.interiorId = 0
self.exteriorZone = 0
def setDifficultyOverrides(self, todo0, todo1): self.difficultyOverrides = [2147483647, -1]
pass self.requests = {}
self.toons = []
def setVisible(self):
pass def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
def setIntroStart(self):
pass self.finishEvent = self.uniqueName('CogdoMazeGameDone')
self.gameOverEvent = self.uniqueName('CogdoMazeGameLose')
def setToonSad(self, todo0):
pass self.resetRequests()
def setToonDisconnect(self, todo0): def d_startIntro(self):
pass self.sendUpdate('setVisible', [])
taskMgr.doMethodLater(self.delayIntro, self.__startIntro, self.taskName('CogdoStartIntro'))
def getInterior(self):
return self.air.doId2do.get(self.interiorId)
def resetRequests(self):
interior = self.getInterior()
toons = interior.getToons()[0]
for toon in toons:
self.requests[toon] = 0
def __startIntro(self, task = None):
self.sendUpdate('setIntroStart', [])
if task:
return task.done
def setAvatarReady(self): def setAvatarReady(self):
avId = self.air.getAvatarIdFromSender()
self.requests[avId] = 1
if not avId in self.toons: self.toons.append(avId)
if self.allToonsReady():
self.handleStart()
self.sendUpdate('setGameStart', [globalClockDelta.getRealNetworkTime()])
def allToonsReady(self):
interior = self.getInterior()
toons = interior.getToons()[0]
for toon in toons:
if self.requests.get(toon, 0) == 0:
return 0
return 1
def handleStart(self):
pass pass
def setGameStart(self, todo0): def setInteriorId(self, id):
pass self.interiorId = id
def getInteriorId(self):
return self.interiorId
def setGameFinish(self, todo0): def setExteriorZone(self, zone):
pass self.exteriorZone = zone
def getExteriorZone(self):
return self.exteriorZone
def setDifficultyOverrides(self, difficulty, exteriorDifficulty):
self.difficultyOverrides = [difficulty, exteriorDifficulty]
def getDifficultyOverrides(self):
return self.difficultyOverrides
def toonWentSad(self, avId):
self.sendUpdate('setToonSad', [avId])
def setToons(self, toons):
self.toons = toons
def disable(self):
DistributedObjectAI.disable(self)
self.air.cogdoGame = None
del self.air.cogdoGame
def gameDone(self, failed=False):
if not failed:
if len(self.toons) == 0:
failed = True
if not failed:
messenger.send(self.finishEvent, [self.toons])
else:
messenger.send(self.gameOverEvent)
def getDifficulty(self):
return CogdoGameConsts.getDifficulty(self.getSafezoneId())
def getSafezoneId(self):
return CogdoGameConsts.getSafezoneId(self.exteriorZone)

View file

@ -14,8 +14,6 @@ class DistCogdoMazeGame(DistCogdoGame, DistCogdoMazeGameBase):
DistCogdoGame.__init__(self, cr) DistCogdoGame.__init__(self, cr)
self.game = CogdoMazeGame(self) self.game = CogdoMazeGame(self)
self._numSuits = (0, 0, 0) self._numSuits = (0, 0, 0)
if __debug__ and base.config.GetBool('schellgames-dev', True):
self.accept('onCodeReload', self.__sgOnCodeReload)
def delete(self): def delete(self):
del self.randomNumGen del self.randomNumGen
@ -45,7 +43,7 @@ class DistCogdoMazeGame(DistCogdoGame, DistCogdoMazeGameBase):
bossCode = None bossCode = None
if self._numSuits[0] > 0: if self._numSuits[0] > 0:
bossCode = '' bossCode = ''
for u in xrange(self._numSuits[0]): for u in range(self._numSuits[0]):
bossCode += '%X' % self.randomNumGen.randint(0, 15) bossCode += '%X' % self.randomNumGen.randint(0, 15)
self.game.load(mazeFactory, self._numSuits, bossCode) self.game.load(mazeFactory, self._numSuits, bossCode)
@ -230,3 +228,12 @@ class DistCogdoMazeGame(DistCogdoGame, DistCogdoMazeGameBase):
def setToonDisconnect(self, toonId): def setToonDisconnect(self, toonId):
DistCogdoGame.setToonDisconnect(self, toonId) DistCogdoGame.setToonDisconnect(self, toonId)
self.game.handleToonDisconnected(toonId) self.game.handleToonDisconnected(toonId)
from otp.ai.MagicWordGlobal import *
@magicWord(category=CATEGORY_MODERATOR)
def revealMap():
if hasattr(base.cr, 'cogdoGame'):
game = base.cr.cogdoGame
game.game.guiMgr.mazeMapGui.showExit()
game.game.guiMgr.mazeMapGui.revealAll()

View file

@ -1,51 +1,249 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.cogdominium.DistCogdoGameAI import DistCogdoGameAI from toontown.cogdominium.DistCogdoGameAI import DistCogdoGameAI
import CogdoMazeGameGlobals
from direct.distributed.ClockDelta import *
from direct.task import Timer
from toontown.battle import BattleBase
from toontown.building.ElevatorConstants import *
ALL_ABOARD_LAG = .7
BASE_TOON_UP = 10
JOKE_TOON_UP = 5
class DistCogdoMazeGameAI(DistCogdoGameAI): class DistCogdoMazeGameAI(DistCogdoGameAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoMazeGameAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoMazeGameAI")
delayIntro = BattleBase.ELEVATOR_T + ElevatorData[ELEVATOR_NORMAL]['openTime'] + BattleBase.SERVER_BUFFER_TIME
def requestAction(self, todo0, todo1):
pass def __init__(self, air):
DistCogdoGameAI.__init__(self, air)
def doAction(self, todo0, todo1, todo2): self.numSuits = (0,0,0)
pass self.timer = Timer.Timer()
self.doorRevealed = False
def setNumSuits(self, todo0): self.toonsInDoor = []
pass self.bosses = {}
self.fastMinions = {}
def requestUseGag(self, todo0, todo1, todo2, todo3): self.slowMinions = {}
pass self.suitTypes = [self.bosses, self.fastMinions, self.slowMinions]
self.numJokes = {}
def toonUsedGag(self, todo0, todo1, todo2, todo3, todo4):
pass def announceGenerate(self):
DistCogdoGameAI.announceGenerate(self)
def requestSuitHitByGag(self, todo0, todo1): self.setupSuitsAI()
pass
def setupSuitsAI(self):
def suitHitByGag(self, todo0, todo1, todo2): bossHp = CogdoMazeGameGlobals.SuitData[0]['hp']
pass fastMiniHp = CogdoMazeGameGlobals.SuitData[1]['hp']
slowMiniHp = CogdoMazeGameGlobals.SuitData[2]['hp']
def requestHitBySuit(self, todo0, todo1, todo2):
pass serialNum = 0
for i in range(self.numSuits[0]):
def toonHitBySuit(self, todo0, todo1, todo2, todo3): self.bosses[serialNum] = bossHp
pass serialNum += 1
for i in range(self.numSuits[1]):
self.fastMinions[serialNum] = fastMiniHp
serialNum += 1
for i in range(self.numSuits[2]):
self.slowMinions[serialNum] = slowMiniHp
serialNum += 1
def setNumSuits(self, num):
self.numSuits = num
def getNumSuits(self):
return self.numSuits
def requestUseGag(self, x, y, h, timestamp):
avId = self.air.getAvatarIdFromSender()
self.sendUpdate('toonUsedGag', [avId, x, y, h, globalClockDelta.getRealNetworkTime()])
def requestSuitHitByGag(self, suitType, suitNum):
hitAI = self.hitSuitAI(suitType, suitNum)
if not hitAI:
self.notify.warning('Cannot hit suit!')
return
avId = self.air.getAvatarIdFromSender()
self.sendUpdate('suitHitByGag', [avId, suitType, suitNum])
def requestHitBySuit(self, suitType, suitNum, nettime):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if av:
lostHp = CogdoMazeGameGlobals.SuitData[suitType]['toonDamage'] * self.getDifficulty() * 10
av.takeDamage(lostHp)
networkTime = globalClockDelta.getRealNetworkTime()
self.sendUpdate('toonHitBySuit', [avId, suitType, suitNum, networkTime])
if av.getHp() < 1:
self.toonWentSad(avId)
def requestHitByDrop(self): def requestHitByDrop(self):
pass avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if av:
lostHp = CogdoMazeGameGlobals.DropDamage
av.takeDamage(lostHp)
self.sendUpdate('toonHitByDrop', [avId])
def requestPickUp(self, pickupNum):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if av:
now = globalClockDelta.getRealNetworkTime()
if avId in self.numJokes:
self.numJokes[avId] += 1
else:
self.numJokes[avId] = 1
self.sendUpdate('pickUp', [avId, pickupNum, now])
def requestGag(self, coolerIndex):
avId = self.air.getAvatarIdFromSender()
self.sendUpdate('hasGag', [avId, globalClockDelta.getRealNetworkTime()])
def hitSuitAI(self, suitType, suitNum):
cogKey = None
for cogNum in self.suitTypes[suitType].keys():
if cogNum == suitNum:
cogKey = cogNum
break
if cogKey == None:
return 0
cogHp = self.suitTypes[suitType][cogKey]
cogHp -= 1
self.suitTypes[suitType][cogKey] = cogHp
if cogHp <= 0:
del self.suitTypes[suitType][cogKey]
return 1
def handleStart(self):
taskMgr.add(self.__checkGameDone, self.taskName('check-game-done'))
taskMgr.add(self.__checkPlayersTask, self.taskName('check-players-task'))
serverDelay = 1.0
self.timer.startCallback(CogdoMazeGameGlobals.SecondsUntilTimeout + serverDelay, self.__handleGameOver)
taskMgr.doMethodLater(serverDelay, self.clientCountdown, self.taskName('client_countdown'))
taskMgr.add(self.__timeWarningTask, self.taskName('time-warning-task'))
def clientCountdown(self, task):
self.doAction(CogdoMazeGameGlobals.GameActions.Countdown, 0)
return task.done
def __handleGameOver(self):
self.removeAll()
self.gameDone(failed=True)
def __checkGameDone(self, task):
bossesLeft = self.bosses
if len(bossesLeft) == 0:
self.timer.stop()
self.doAction(CogdoMazeGameGlobals.GameActions.OpenDoor, 0)
self.__startTimeout()
return task.done
return task.again
def __startTimeout(self):
self.timer.startCallback(CogdoMazeGameGlobals.SecondsUntilGameEnds, self.__handleTimeout)
def __handleTimeout(self):
for toon in self.toons:
if not toon in self.toonsInDoor:
self.killToon(toon)
self.removeAll()
self.gameDone()
def __timeWarningTask(self, task):
if self.timer.getT() <= CogdoMazeGameGlobals.SecondsForTimeAlert:
self.doAction(CogdoMazeGameGlobals.GameActions.TimeAlert, 0)
return task.done
return task.again
def killToon(self, avId):
av = self.air.doId2do.get(avId)
if av:
if av.getHp() > 0:
av.takeDamage(av.getHp())
self.toonWentSad(avId)
self.__playerDisconnected(avId)
def __checkPlayersTask(self, task):
for toonId in self.toons:
toon = self.air.doId2do.get(toonId)
if not toon:
self.__playerDisconnected(toonId)
return task.again
def __playerDisconnected(self, avId):
self.sendUpdate('setToonDisconnect', [avId])
self.toons.pop(self.toons.index(avId))
if len(self.toons) == 0:
self.removeAll()
self.gameDone(failed=True)
def doAction(self, action, data):
self.sendUpdate('doAction', [action, data, globalClockDelta.getRealNetworkTime()])
def requestAction(self, action, data):
Globals = CogdoMazeGameGlobals
avId = self.air.getAvatarIdFromSender()
if action == Globals.GameActions.RevealDoor:
if not self.doorRevealed:
self.doAction(action, avId)
self.doorRevealed = True
else:
self.notify.warning('Toon tried to reveal door but it\'s already revealed! Ignoring.')
elif action == Globals.GameActions.EnterDoor:
if not avId in self.toonsInDoor:
self.doAction(action, avId)
self.toonsInDoor.append(avId)
self.toonUpToon(avId)
else:
self.notify.warning('Toon tried to enter into door but already entered! Ignoring.')
return
if len(self.toonsInDoor) >= len(self.toons):
self.__handleAllAboard()
else:
self.notify.warning('Client requested unknown action \'%s\'' %action)
def __handleAllAboard(self):
if len(self.toonsInDoor) != len(self.toons):
self.notify.warning('__handleAllAboard expect all toons aboard!')
return
self.removeAll()
taskMgr.doMethodLater(ALL_ABOARD_LAG, lambda t: self.gameDone(), self.taskName('all-aboard-delay'))
def toonUpToon(self, toonId):
if toonId in self.toonsInDoor:
toon = self.air.doId2do.get(toonId)
if toon:
val = min(BASE_TOON_UP + JOKE_TOON_UP * self.numJokes.get(toonId, 0), toon.getMaxHp())
toon.toonUp(val)
def removeAll(self):
taskMgr.remove(self.taskName('check-game-done'))
taskMgr.remove(self.taskName('check-players-task'))
taskMgr.remove(self.taskName('time-warning-task'))
taskMgr.remove(self.taskName('all-aboard-delay'))
self.timer.stop()
def disable(self):
DistCogdoGameAI.disable(self)
self.removeAll()
def toonHitByDrop(self, todo0): from otp.ai.MagicWordGlobal import *
pass
def requestPickUp(self, todo0):
pass
def pickUp(self, todo0, todo1, todo2):
pass
def requestGag(self, todo0):
pass
def hasGag(self, todo0, todo1):
pass
@magicWord(category=CATEGORY_MODERATOR)
def endMaze():
if hasattr(simbase.air, 'cogdoGame'):
maze = simbase.air.cogdoGame
maze.doAction(CogdoMazeGameGlobals.GameActions.OpenDoor, 0)
return 'Finished cogdo maze game!'

View file

@ -3,12 +3,15 @@ from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
from toontown.toonbase import ToontownGlobals, ToontownIntervals from toontown.toonbase import ToontownGlobals, ToontownIntervals
from toontown.cogdominium import CogdoBarrelRoomConsts from toontown.cogdominium import CogdoBarrelRoomConsts
from toontown.cogdominium import CogdoBarrelRoom
import random
class DistributedCogdoBarrel(DistributedObject.DistributedObject): class DistributedCogdoBarrel(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogdoBarrel') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogdoBarrel')
def __init__(self, cr): def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr) DistributedObject.DistributedObject.__init__(self, cr)
self.barrelRoom = CogdoBarrelRoom.CogdoBarrelRoom()
self.index = None self.index = None
self.state = None self.state = None
self.model = None self.model = None
@ -17,6 +20,7 @@ class DistributedCogdoBarrel(DistributedObject.DistributedObject):
self.collNodePath = None self.collNodePath = None
self.availableTex = None self.availableTex = None
self.usedTex = None self.usedTex = None
self.brLaff = 0
return return
def generate(self): def generate(self):
@ -32,7 +36,6 @@ class DistributedCogdoBarrel(DistributedObject.DistributedObject):
cogdoBarrelsNode = render.find('@@CogdoBarrels') cogdoBarrelsNode = render.find('@@CogdoBarrels')
if not cogdoBarrelsNode or cogdoBarrelsNode.isEmpty(): if not cogdoBarrelsNode or cogdoBarrelsNode.isEmpty():
cogdoBarrelsNode = render.attachNewNode('CogdoBarrels') cogdoBarrelsNode = render.attachNewNode('CogdoBarrels')
cogdoBarrelsNode.stash()
self.model.reparentTo(cogdoBarrelsNode) self.model.reparentTo(cogdoBarrelsNode)
self.availableTex = loader.loadTexture('phase_5/maps/tt_t_ara_cbr_Barrel_notUsed.jpg') self.availableTex = loader.loadTexture('phase_5/maps/tt_t_ara_cbr_Barrel_notUsed.jpg')
self.usedTex = loader.loadTexture('phase_5/maps/tt_t_ara_cbr_Barrel_Used.jpg') self.usedTex = loader.loadTexture('phase_5/maps/tt_t_ara_cbr_Barrel_Used.jpg')
@ -110,13 +113,18 @@ class DistributedCogdoBarrel(DistributedObject.DistributedObject):
self.sendUpdate('requestGrab', []) self.sendUpdate('requestGrab', [])
def setGrab(self, avId): def setGrab(self, avId):
toonup = CogdoBarrelRoomConsts.ToonUp
if avId == base.localAvatar.doId: if avId == base.localAvatar.doId:
ToontownIntervals.start(ToontownIntervals.getPulseIval(self.model, self.__pulseIvalName(), 1.15, duration=0.2)) ToontownIntervals.start(ToontownIntervals.getPulseIval(self.model, self.__pulseIvalName(), 1.15, duration=0.2))
self.setState(CogdoBarrelRoomConsts.StateUsed) self.setState(CogdoBarrelRoomConsts.StateUsed)
self.brLaff = random.randint(toonup[0], toonup[1])
def setReject(self): def setReject(self):
pass pass
def getBarrelLaff(self):
return self.brLaff
def __pulseIvalName(self): def __pulseIvalName(self):
return 'DistributedCogdoBarrelPulse%s' % self.doId return 'DistributedCogdoBarrelPulse%s' % self.doId

View file

@ -1,21 +1,36 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed import DistributedObjectAI
import CogdoBarrelRoomConsts
import random
class DistributedCogdoBarrelAI(DistributedObjectAI): class DistributedCogdoBarrelAI(DistributedObjectAI.DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedCogdoBarrelAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedCogdoBarrelAI")
def __init__(self, air, index):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.index = index
self.state = CogdoBarrelRoomConsts.StateAvailable
self.brLaff = 0
def requestGrab(self): def requestGrab(self):
pass toonup = CogdoBarrelRoomConsts.ToonUp
if self.state == CogdoBarrelRoomConsts.StateAvailable:
def setIndex(self, todo0): self.state = CogdoBarrelRoomConsts.StateUsed
pass self.sendUpdate("setState", [CogdoBarrelRoomConsts.StateUsed])
self.sendUpdate("setGrab", [self.air.getAvatarIdFromSender()])
def setState(self, todo0): self.brLaff = random.randint(toonup[0], toonup[1])
pass self.recieveToonUp()
def setGrab(self, todo0): def getIndex(self):
pass return self.index
def setReject(self): def getState(self):
pass return self.state
def recieveToonUp(self):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
av.toonUp(self.brLaff)

View file

@ -1,17 +1,22 @@
# File: D (Python 2.4)
from toontown.building.DistributedElevatorExt import DistributedElevatorExt from toontown.building.DistributedElevatorExt import DistributedElevatorExt
from toontown.building.ElevatorConstants import *
from toontown.building.ElevatorUtils import *
from toontown.toonbase import ToontownGlobals
class DistributedCogdoElevatorExt(DistributedElevatorExt): class DistributedCogdoElevatorExt(DistributedElevatorExt):
def __init__(self, cr):
def setupElevator(self): DistributedElevatorExt.__init__(self, cr)
DistributedElevatorExt.setupElevator(self) self.type = ELEVATOR_FIELD
self.elevatorSphereNodePath.setY(-1.0)
self.elevatorSphereNodePath.setZ(1.5)
def getElevatorModel(self): def getElevatorModel(self):
return self.bldg.getCogdoElevatorNodePath() return self.bldg.getCogdoElevatorNodePath()
def getBldgDoorOrigin(self): def getBldgDoorOrigin(self):
return self.bldg.getCogdoDoorOrigin() return self.bldg.getCogdoDoorOrigin()
def _getDoorsClosedInfo(self): def _getDoorsClosedInfo(self):
return ('cogdoInterior', 'cogdoInterior') return ('cogdoInterior', 'cogdoInterior')

View file

@ -1,6 +1,12 @@
# File: D (Python 2.4)
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.building.DistributedElevatorExtAI import DistributedElevatorExtAI from toontown.building.DistributedElevatorExtAI import DistributedElevatorExtAI
class DistributedCogdoElevatorExtAI(DistributedElevatorExtAI): class DistributedCogdoElevatorExtAI(DistributedElevatorExtAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedCogdoElevatorExtAI") notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogdoElevatorExtAI')
def _createInterior(self):
self.bldg.createCogdoInterior()

View file

@ -1,34 +1,37 @@
from direct.directnotify import DirectNotifyGlobal import random
from direct.distributed import DistributedObject from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from toontown.building.ElevatorConstants import *
from toontown.toon import NPCToons
from pandac.PandaModules import NodePath
from toontown.building import ElevatorUtils
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import ToontownBattleGlobals
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.distributed import DistributedObject
from direct.fsm import State from direct.fsm import State
from direct.fsm.StatePush import StateVar, FunctionCall from direct.fsm.StatePush import StateVar, FunctionCall
from direct.interval.IntervalGlobal import *
from pandac.PandaModules import NodePath
import random
from CogdoElevatorMovie import CogdoElevatorMovie
from CogdoExecutiveSuiteMovies import CogdoExecutiveSuiteIntro
from toontown.battle import BattleBase from toontown.battle import BattleBase
from toontown.building import ElevatorUtils
from toontown.building.ElevatorConstants import *
from toontown.chat.ChatGlobals import *
from toontown.cogdominium import CogdoBarrelRoom, CogdoBarrelRoomConsts
from toontown.cogdominium import CogdoGameConsts
from toontown.cogdominium.CogdoLayout import CogdoLayout
from toontown.distributed import DelayDelete
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.toon import NPCToons from toontown.cogdominium.CogdoLayout import CogdoLayout
from toontown.cogdominium import CogdoGameConsts
from toontown.cogdominium import CogdoBarrelRoom, CogdoBarrelRoomConsts
from toontown.distributed import DelayDelete
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownBattleGlobals from CogdoExecutiveSuiteMovies import CogdoExecutiveSuiteIntro
from toontown.toonbase import ToontownGlobals from CogdoBarrelRoomMovies import CogdoBarrelRoomIntro
from CogdoElevatorMovie import CogdoElevatorMovie
SUITE_DICT = {'s': 'tt_m_ara_crg_penthouse_sell',
'l': 'tt_m_ara_crg_penthouse_law',
'm': 'tt_m_ara_crg_penthouse_sell',
'c': 'tt_m_ara_crg_penthouse_sell'}
PAINTING_DICT = {'s': 'tt_m_ara_crg_paintingMoverShaker', PAINTING_DICT = {'s': 'tt_m_ara_crg_paintingMoverShaker',
'l': 'tt_m_ara_crg_paintingLegalEagle', 'l': 'tt_m_ara_crg_paintingLegalEagle',
'm': 'tt_m_ara_crg_paintingMoverShaker', 'm': 'tt_m_ara_crg_paintingMoverShaker',
'c': 'tt_m_ara_crg_paintingMoverShaker'} 'c': 'tt_m_ara_crg_paintingMoverShaker'}
from toontown.nametag.NametagGlobals import *
class DistributedCogdoInterior(DistributedObject.DistributedObject): class DistributedCogdoInterior(DistributedObject.DistributedObject):
id = 0 id = 0
@ -73,7 +76,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
120, 120,
12, 12,
38] 38]
self._wantBarrelRoom = config.GetBool('cogdo-want-barrel-room', 0) self._wantBarrelRoom = config.GetBool('cogdo-want-barrel-room', 1)
self.barrelRoom = CogdoBarrelRoom.CogdoBarrelRoom() self.barrelRoom = CogdoBarrelRoom.CogdoBarrelRoom()
self.brResults = [[], []] self.brResults = [[], []]
self.barrelRoomIntroTrack = None self.barrelRoomIntroTrack = None
@ -83,8 +86,8 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.waitMusic = base.loadMusic('phase_7/audio/bgm/encntr_toon_winning_indoor.ogg') self.waitMusic = base.loadMusic('phase_7/audio/bgm/encntr_toon_winning_indoor.ogg')
self.elevatorMusic = base.loadMusic('phase_7/audio/bgm/tt_elevator.ogg') self.elevatorMusic = base.loadMusic('phase_7/audio/bgm/tt_elevator.ogg')
self.fsm = ClassicFSM.ClassicFSM('DistributedCogdoInterior', [State.State('WaitForAllToonsInside', self.enterWaitForAllToonsInside, self.exitWaitForAllToonsInside, ['Elevator']), self.fsm = ClassicFSM.ClassicFSM('DistributedCogdoInterior', [State.State('WaitForAllToonsInside', self.enterWaitForAllToonsInside, self.exitWaitForAllToonsInside, ['Elevator']),
State.State('Elevator', self.enterElevator, self.exitElevator, ['Game']), State.State('Elevator', self.enterElevator, self.exitElevator, ['Game', 'BattleIntro', 'BarrelRoomIntro']),
State.State('Game', self.enterGame, self.exitGame, ['Resting', 'Failed', 'BattleIntro']), State.State('Game', self.enterGame, self.exitGame, ['Resting', 'Failed', 'BattleIntro', 'BarrelRoomIntro', 'Elevator']),
State.State('BarrelRoomIntro', self.enterBarrelRoomIntro, self.exitBarrelRoomIntro, ['CollectBarrels', 'Off']), State.State('BarrelRoomIntro', self.enterBarrelRoomIntro, self.exitBarrelRoomIntro, ['CollectBarrels', 'Off']),
State.State('CollectBarrels', self.enterCollectBarrels, self.exitCollectBarrels, ['BarrelRoomReward', 'Off']), State.State('CollectBarrels', self.enterCollectBarrels, self.exitCollectBarrels, ['BarrelRoomReward', 'Off']),
State.State('BarrelRoomReward', self.enterBarrelRoomReward, self.exitBarrelRoomReward, ['Battle', State.State('BarrelRoomReward', self.enterBarrelRoomReward, self.exitBarrelRoomReward, ['Battle',
@ -121,6 +124,9 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def setFOType(self, typeId): def setFOType(self, typeId):
self.FOType = chr(typeId) self.FOType = chr(typeId)
def getFOType(self):
return self.FOType
def __uniqueName(self, name): def __uniqueName(self, name):
DistributedCogdoInterior.id += 1 DistributedCogdoInterior.id += 1
return name + '%d' % DistributedCogdoInterior.id return name + '%d' % DistributedCogdoInterior.id
@ -132,7 +138,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.elevatorModelIn = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_csa_elevatorB') self.elevatorModelIn = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_csa_elevatorB')
self.leftDoorIn = self.elevatorModelIn.find('**/left_door') self.leftDoorIn = self.elevatorModelIn.find('**/left_door')
self.rightDoorIn = self.elevatorModelIn.find('**/right_door') self.rightDoorIn = self.elevatorModelIn.find('**/right_door')
self.elevatorModelOut = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_csa_elevatorB') self.elevatorModelOut = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_csa_elevator')
self.leftDoorOut = self.elevatorModelOut.find('**/left_door') self.leftDoorOut = self.elevatorModelOut.find('**/left_door')
self.rightDoorOut = self.elevatorModelOut.find('**/right_door') self.rightDoorOut = self.elevatorModelOut.find('**/right_door')
@ -152,12 +158,13 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def setElevatorLights(self, elevatorModel): def setElevatorLights(self, elevatorModel):
npc = elevatorModel.findAllMatches('**/floor_light_?;+s') npc = elevatorModel.findAllMatches('**/floor_light_?;+s')
for i in xrange(npc.getNumPaths()): for i in range(npc.getNumPaths()):
np = npc.getPath(i) np = npc.getPath(i)
np.setDepthOffset(120)
floor = int(np.getName()[-1:]) - 1 floor = int(np.getName()[-1:]) - 1
if floor == self.currentFloor: if floor == self.currentFloor:
np.setColor(LIGHT_ON_COLOR) np.setColor(LIGHT_ON_COLOR)
elif floor < self.layout.getNumGameFloors(): elif floor < self.layout.getNumGameFloors() + (1 if self.FOType != "s" else 0):
if self.isBossFloor(self.currentFloor): if self.isBossFloor(self.currentFloor):
np.setColor(LIGHT_ON_COLOR) np.setColor(LIGHT_ON_COLOR)
else: else:
@ -219,10 +226,10 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
return return
def isBossFloor(self, floorNum): def isBossFloor(self, floorNum):
if self.layout.hasBossBattle(): if not self.layout.hasBossBattle():
if self.layout.getBossBattleFloor() == floorNum: return False
return True
return False return (self.layout.getBossBattleFloor() + 0) == floorNum
def __cleanup(self): def __cleanup(self):
self.toons = [] self.toons = []
@ -259,7 +266,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.ignore(toon.uniqueName('disable')) self.ignore(toon.uniqueName('disable'))
def __finishInterval(self, name): def __finishInterval(self, name):
if name in self.activeIntervals: if self.activeIntervals.has_key(name):
interval = self.activeIntervals[name] interval = self.activeIntervals[name]
if interval.isPlaying(): if interval.isPlaying():
interval.finish() interval.finish()
@ -308,7 +315,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.toons = [] self.toons = []
for toonId in toonIds: for toonId in toonIds:
if toonId != 0: if toonId != 0:
if toonId in self.cr.doId2do: if self.cr.doId2do.has_key(toonId):
toon = self.cr.doId2do[toonId] toon = self.cr.doId2do[toonId]
toon.stopSmooth() toon.stopSmooth()
self.toons.append(toon) self.toons.append(toon)
@ -326,7 +333,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.suits = [] self.suits = []
self.joiningReserves = [] self.joiningReserves = []
for suitId in suitIds: for suitId in suitIds:
if suitId in self.cr.doId2do: if self.cr.doId2do.has_key(suitId):
suit = self.cr.doId2do[suitId] suit = self.cr.doId2do[suitId]
self.suits.append(suit) self.suits.append(suit)
suit.fsm.request('Battle') suit.fsm.request('Battle')
@ -334,13 +341,20 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
suit.reparentTo(render) suit.reparentTo(render)
if oldsuits.count(suit) == 0: if oldsuits.count(suit) == 0:
self.joiningReserves.append(suit) self.joiningReserves.append(suit)
if 'Elevator' in repr(self.fsm):
# fix the pos
pos, h = BattleBase.BattleBase.suitPoints[len(suitIds) - 1][suitIds.index(suitId)]
suit.setPos(pos)
suit.setH(h)
else: else:
self.notify.warning('setSuits() - no suit: %d' % suitId) self.notify.warning('setSuits() - no suit: %d' % suitId)
self.reserveSuits = [] self.reserveSuits = []
for index in xrange(len(reserveIds)): for index in range(len(reserveIds)):
suitId = reserveIds[index] suitId = reserveIds[index]
if suitId in self.cr.doId2do: if self.cr.doId2do.has_key(suitId):
suit = self.cr.doId2do[suitId] suit = self.cr.doId2do[suitId]
self.reserveSuits.append((suit, values[index])) self.reserveSuits.append((suit, values[index]))
else: else:
@ -405,17 +419,26 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def __playElevator(self, ts, name, callback): def __playElevator(self, ts, name, callback):
SuitHs = [] SuitHs = []
SuitPositions = [] SuitPositions = []
if self.floorModel: if self.floorModel:
self.floorModel.removeNode() self.floorModel.removeNode()
self.floorModel = None self.floorModel = None
if self.cage: if self.cage:
self.cage = None self.cage = None
if self.currentFloor == 0: if self.currentFloor == 0:
SuitHs = self.BottomFloor_SuitHs SuitHs = self.BottomFloor_SuitHs
SuitPositions = self.BottomFloor_SuitPositions SuitPositions = self.BottomFloor_SuitPositions
if self.isBossFloor(self.currentFloor): if self.isBossFloor(self.currentFloor):
self.notify.info('__playElevator: currentFloor %s is boss' % self.currentFloor)
self.barrelRoom.unload() self.barrelRoom.unload()
self.floorModel = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_penthouse') if self.FOType:
penthouseName = SUITE_DICT.get(self.FOType)
for i in range(4):
self.floorModel = loader.loadModel('phase_5/models/cogdominium/%s' % penthouseName)
self.cage = self.floorModel.find('**/cage') self.cage = self.floorModel.find('**/cage')
pos = self.cage.getPos() pos = self.cage.getPos()
self.cagePos = [] self.cagePos = []
@ -426,57 +449,79 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.cageDoor.wrtReparentTo(self.cage) self.cageDoor.wrtReparentTo(self.cage)
if self.FOType: if self.FOType:
paintingModelName = PAINTING_DICT.get(self.FOType) paintingModelName = PAINTING_DICT.get(self.FOType)
for i in xrange(4): for i in range(4):
paintingModel = loader.loadModel('phase_5/models/cogdominium/%s' % paintingModelName) paintingModel = loader.loadModel('phase_5/models/cogdominium/%s' % paintingModelName)
loc = self.floorModel.find('**/loc_painting%d' % (i + 1)) loc = self.floorModel.find('**/loc_painting%d' % (i + 1))
paintingModel.reparentTo(loc) paintingModel.reparentTo(loc)
if not self.floorModel.find('**/trophyCase').isEmpty():
for i in range(4):
goldEmblem = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_goldTrophy.bam')
loc = self.floorModel.find('**/gold_0%d' % (i + 1))
goldEmblem.reparentTo(loc)
for i in range(20):
silverEmblem = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_silverTrophy.bam')
loc = self.floorModel.find('**/silver_0%d' % (i + 1))
silverEmblem.reparentTo(loc)
SuitHs = self.BossOffice_SuitHs SuitHs = self.BossOffice_SuitHs
SuitPositions = self.BossOffice_SuitPositions SuitPositions = self.BossOffice_SuitPositions
self.__makeShopOwnerNpc() self.__makeShopOwnerNpc()
else: else:
if self._wantBarrelRoom: if self._wantBarrelRoom:
self.barrelRoom.load() self.barrelRoom.load()
self.barrelRoom.hide() self.barrelRoom.hide()
SuitHs = self.Cubicle_SuitHs SuitHs = self.Cubicle_SuitHs
SuitPositions = self.Cubicle_SuitPositions SuitPositions = self.Cubicle_SuitPositions
if self.floorModel: if self.floorModel:
self.floorModel.reparentTo(render) self.floorModel.reparentTo(render)
if self.isBossFloor(self.currentFloor): if self.isBossFloor(self.currentFloor):
self.notify.debug('Load boss_suit_office') self.notify.info('Load boss_suit_office')
elevIn = self.floorModel.find(CogdoGameConsts.PenthouseElevatorInPath).copyTo(render) elevIn = self.floorModel.find(CogdoGameConsts.PenthouseElevatorInPath).copyTo(render)
elevOut = self.floorModel.find(CogdoGameConsts.PenthouseElevatorOutPath) elevOut = self.floorModel.find(CogdoGameConsts.PenthouseElevatorOutPath)
frame = self.elevatorModelOut.find('**/frame') frame = self.elevatorModelOut.find('**/frame')
if not frame.isEmpty(): if not frame.isEmpty():
frame.hide() frame.hide()
frame = self.elevatorModelIn.find('**/frame') frame = self.elevatorModelIn.find('**/frame')
if not frame.isEmpty(): if not frame.isEmpty():
frame.hide() frame.hide()
self.elevatorModelOut.reparentTo(elevOut) self.elevatorModelOut.reparentTo(elevOut)
self.elevatorModelOut.setY(0)
else: else:
elevIn = self.floorModel.find('**/elevator-in') elevIn = self.floorModel.find('**/elevator-in')
elevOut = self.floorModel.find('**/elevator-out') elevOut = self.floorModel.find('**/elevator-out')
elif self._wantBarrelRoom and self.barrelRoom.isLoaded():
elevIn = self.barrelRoom.dummyElevInNode elif self._wantBarrelRoom and self.barrelRoom.isLoaded() and self.currentFloor == 2 and self.FOType == 'l': #i know this is really ugly
elevIn = self.barrelRoom.model.find(CogdoBarrelRoomConsts.BarrelRoomElevatorInPath)
elevOut = self.barrelRoom.model.find(CogdoBarrelRoomConsts.BarrelRoomElevatorOutPath) elevOut = self.barrelRoom.model.find(CogdoBarrelRoomConsts.BarrelRoomElevatorOutPath)
y = elevOut.getY(render) y = elevOut.getY(render)
elevOut = elevOut.copyTo(render) elevOut = elevOut.copyTo(render)
elevOut.setY(render, y - 0.75) elevOut.setY(render, y - 0.75)
else: else:
floorModel = loader.loadModel('phase_7/models/modules/boss_suit_office') floorModel = loader.loadModel('phase_7/models/modules/boss_suit_office')
elevIn = floorModel.find('**/elevator-in').copyTo(render) elevIn = floorModel.find('**/elevator-in').copyTo(render)
elevOut = floorModel.find('**/elevator-out').copyTo(render) elevOut = floorModel.find('**/elevator-out').copyTo(render)
floorModel.removeNode() floorModel.removeNode()
self.elevIn = elevIn self.elevIn = elevIn
self.elevOut = elevOut self.elevOut = elevOut
self._haveEntranceElevator.set(True) self._haveEntranceElevator.set(True)
for index in xrange(len(self.suits)): for index in range(len(self.suits)):
self.suits[index].setPos(SuitPositions[index]) if not self.suits[index].isEmpty():
if len(self.suits) > 2: self.suits[index].setPos(SuitPositions[index])
self.suits[index].setH(SuitHs[index]) if len(self.suits) > 2:
else: self.suits[index].setH(SuitHs[index])
self.suits[index].setH(170) else:
self.suits[index].loop('neutral') self.suits[index].setH(170)
self.suits[index].loop('neutral')
for toon in self.toons: for toon in self.toons:
toon.reparentTo(self.elevatorModelIn) toon.reparentTo(self.elevatorModelIn)
@ -500,7 +545,6 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
track.append(Func(callback)) track.append(Func(callback))
track.start(ts) track.start(ts)
self.activeIntervals[name] = track self.activeIntervals[name] = track
return
def enterElevator(self, ts = 0): def enterElevator(self, ts = 0):
if not self._CogdoGameRepeat: if not self._CogdoGameRepeat:
@ -512,9 +556,10 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.elevatorModelOut.detachNode() self.elevatorModelOut.detachNode()
messenger.send('sellbotFieldOfficeChanged', [True]) messenger.send('sellbotFieldOfficeChanged', [True])
else: else:
self._movie = CogdoElevatorMovie() if self.FOType == 's':
self._movie.load() self._movie = CogdoElevatorMovie()
self._movie.play() self._movie.load()
self._movie.play()
self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone) self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone)
mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor)
base.localAvatar.inventory.setBattleCreditMultiplier(mult) base.localAvatar.inventory.setBattleCreditMultiplier(mult)
@ -531,12 +576,16 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
return None return None
def __setupBarrelRoom(self): def __setupBarrelRoom(self):
base.cr.playGame.getPlace().fsm.request('stopped') self.currentFloor += 1
base.transitions.irisOut(0.0) base.transitions.irisOut(0.0)
self.elevatorModelIn.detachNode() self.elevatorModelOut.setY(-12)
self.elevatorModelIn.reparentTo(self.barrelRoom.model.find(CogdoBarrelRoomConsts.BarrelRoomElevatorInPath))
self.leftDoorIn.setPos(3.5, 0, 0)
self.rightDoorIn.setPos(-3.5, 0, 0)
self._showExitElevator() self._showExitElevator()
self.barrelRoom.show() self.barrelRoom.show()
self.barrelRoom.placeToonsAtEntrance(self.toons) self.barrelRoom.placeToonsAtEntrance(self.toons)
self.setElevatorLights(self.elevatorModelOut)
def barrelRoomIntroDone(self): def barrelRoomIntroDone(self):
self.sendUpdate('toonBarrelRoomIntroDone', []) self.sendUpdate('toonBarrelRoomIntroDone', [])
@ -550,6 +599,9 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.accept(self.barrelRoomIntroDoneEvent, self.barrelRoomIntroDone) self.accept(self.barrelRoomIntroDoneEvent, self.barrelRoomIntroDone)
self.activeIntervals[trackName] = self.barrelRoomIntroTrack self.activeIntervals[trackName] = self.barrelRoomIntroTrack
self.barrelRoomIntroTrack.start(ts) self.barrelRoomIntroTrack.start(ts)
self._movie = CogdoBarrelRoomIntro()
self._movie.load()
self._movie.play()
else: else:
self._showExitElevator() self._showExitElevator()
@ -583,16 +635,13 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def __brRewardDone(self, task = None): def __brRewardDone(self, task = None):
self.notify.info('Toon finished watching the barrel room reward.') self.notify.info('Toon finished watching the barrel room reward.')
self.sendUpdate('toonBarrelRoomRewardDone', []) self.sendUpdate('toonBarrelRoomRewardDone', [])
self.fsm.request('Battle')
def setBarrelRoomReward(self, avIds, laffs):
self.brResults = [avIds, laffs]
self.barrelRoom.setRewardResults(self.brResults)
def enterBarrelRoomReward(self, ts = 0): def enterBarrelRoomReward(self, ts = 0):
if self._wantBarrelRoom and not self.isBossFloor(self.currentFloor): if self._wantBarrelRoom and not self.isBossFloor(self.currentFloor):
base.cr.playGame.getPlace().fsm.request('stopped') base.cr.playGame.getPlace().fsm.request('stopped')
self.startAlertElevatorLightIval(self.elevatorModelOut) self.startAlertElevatorLightIval(self.elevatorModelOut)
track, trackName = self.barrelRoom.showRewardUi(self.brResults, callback=self.__brRewardDone) track, trackName = self.barrelRoom.showRewardUi(callback=self.__brRewardDone)
self.activeIntervals[trackName] = track self.activeIntervals[trackName] = track
track.start() track.start()
self.barrelRoom.placeToonsNearBattle(self.toons) self.barrelRoom.placeToonsNearBattle(self.toons)
@ -680,7 +729,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self._stashEntranceElevator.set(False) self._stashEntranceElevator.set(False)
def _setAvPosToExit(self): def _setAvPosToExit(self):
base.localAvatar.setPos(self.elevOut, 0, -10, 0) base.localAvatar.setPos(self.elevOut, 0, -22, 0)
base.localAvatar.setHpr(self.elevOut, 0, 0, 0) base.localAvatar.setHpr(self.elevOut, 0, 0, 0)
base.cr.playGame.getPlace().fsm.request('walk') base.cr.playGame.getPlace().fsm.request('walk')
@ -739,12 +788,12 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
pass pass
else: else:
self.notify.warning('Invalid floor number for display badges.') self.notify.warning('Invalid floor number for display badges.')
for player in xrange(len(self.toons)): for player in range(len(self.toons)):
goldBadge = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_goldTrophy') goldBadge = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_goldTrophy')
goldBadge.setScale(1.2) goldBadge.setScale(1.2)
goldNode = render.find('**/gold_0' + str(player + 1)) goldNode = render.find('**/gold_0' + str(player + 1))
goldBadge.reparentTo(goldNode) goldBadge.reparentTo(goldNode)
for floor in xrange(numFloors): for floor in range(numFloors):
silverBadge = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_silverTrophy.bam') silverBadge = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_silverTrophy.bam')
silverBadge.setScale(1.2) silverBadge.setScale(1.2)
silverNode = render.find('**/silver_0' + str(floor * 4 + (player + 1))) silverNode = render.find('**/silver_0' + str(floor * 4 + (player + 1)))
@ -755,7 +804,13 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
trackName = '__outroPenthouse-%d' % avatar.doId trackName = '__outroPenthouse-%d' % avatar.doId
track = Parallel(name=trackName) track = Parallel(name=trackName)
base.cr.playGame.getPlace().fsm.request('stopped') base.cr.playGame.getPlace().fsm.request('stopped')
speech = TTLocalizer.CogdoExecutiveSuiteToonThankYou % self.SOSToonName
if self.FOType == "l":
speech = TTLocalizer.CogdoExecutiveSuiteToonThankYouLawbot
else:
speech = TTLocalizer.CogdoExecutiveSuiteToonThankYou % self.SOSToonName
track.append(Sequence(Func(camera.wrtReparentTo, localAvatar), Func(camera.setPos, 0, -9, 9), Func(camera.lookAt, Point3(5, 15, 0)), Parallel(self.cage.posInterval(0.75, self.cagePos[1], blendType='easeOut'), SoundInterval(self.cageLowerSfx, duration=0.5)), Parallel(self.cageDoor.hprInterval(0.5, VBase3(0, 90, 0), blendType='easeOut'), Sequence(SoundInterval(self.cageDoorSfx), duration=0)), Wait(0.25), Func(self.shopOwnerNpc.wrtReparentTo, render), Func(self.shopOwnerNpc.setScale, 1), Func(self.shopOwnerNpc.loop, 'walk'), Func(self.shopOwnerNpc.headsUp, Point3(0, 10, 0)), ParallelEndTogether(self.shopOwnerNpc.posInterval(1.5, Point3(0, 10, 0)), self.shopOwnerNpc.hprInterval(0.5, VBase3(180, 0, 0), blendType='easeInOut')), Func(self.shopOwnerNpc.setChatAbsolute, TTLocalizer.CagedToonYippee, CFSpeech), ActorInterval(self.shopOwnerNpc, 'jump'), Func(self.shopOwnerNpc.loop, 'neutral'), Func(self.shopOwnerNpc.headsUp, localAvatar), Func(self.shopOwnerNpc.setLocalPageChat, speech, 0), Func(camera.lookAt, self.shopOwnerNpc, Point3(0, 0, 2)))) track.append(Sequence(Func(camera.wrtReparentTo, localAvatar), Func(camera.setPos, 0, -9, 9), Func(camera.lookAt, Point3(5, 15, 0)), Parallel(self.cage.posInterval(0.75, self.cagePos[1], blendType='easeOut'), SoundInterval(self.cageLowerSfx, duration=0.5)), Parallel(self.cageDoor.hprInterval(0.5, VBase3(0, 90, 0), blendType='easeOut'), Sequence(SoundInterval(self.cageDoorSfx), duration=0)), Wait(0.25), Func(self.shopOwnerNpc.wrtReparentTo, render), Func(self.shopOwnerNpc.setScale, 1), Func(self.shopOwnerNpc.loop, 'walk'), Func(self.shopOwnerNpc.headsUp, Point3(0, 10, 0)), ParallelEndTogether(self.shopOwnerNpc.posInterval(1.5, Point3(0, 10, 0)), self.shopOwnerNpc.hprInterval(0.5, VBase3(180, 0, 0), blendType='easeInOut')), Func(self.shopOwnerNpc.setChatAbsolute, TTLocalizer.CagedToonYippee, CFSpeech), ActorInterval(self.shopOwnerNpc, 'jump'), Func(self.shopOwnerNpc.loop, 'neutral'), Func(self.shopOwnerNpc.headsUp, localAvatar), Func(self.shopOwnerNpc.setLocalPageChat, speech, 0), Func(camera.lookAt, self.shopOwnerNpc, Point3(0, 0, 2))))
self.activeIntervals[trackName] = track self.activeIntervals[trackName] = track
self.accept('doneChatPage', self.__outroPenthouseChatDone) self.accept('doneChatPage', self.__outroPenthouseChatDone)
@ -764,6 +819,6 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def __outroPenthouseChatDone(self, elapsed = None): def __outroPenthouseChatDone(self, elapsed = None):
self.shopOwnerNpc.setChatAbsolute(TTLocalizer.CogdoExecutiveSuiteToonBye, CFSpeech) self.shopOwnerNpc.setChatAbsolute(TTLocalizer.CogdoExecutiveSuiteToonBye, CFSpeech)
self.ignore('doneChatPage') self.ignore('doneChatPage')
track = Parallel(Sequence(ActorInterval(self.shopOwnerNpc, 'wave'), Func(self.shopOwnerNpc.loop, 'neutral')), Sequence(Wait(2.0), Func(self.exitCogdoBuilding), Func(base.camLens.setMinFov, ToontownGlobals.DefaultCameraFov/(4./3.)))) track = Parallel(Sequence(ActorInterval(self.shopOwnerNpc, 'wave'), Func(self.shopOwnerNpc.loop, 'neutral')), Sequence(Wait(2.0), Func(self.exitCogdoBuilding), Func(base.camLens.setFov, ToontownGlobals.DefaultCameraFov)))
track.start() track.start()
self.penthouseOutroChatDoneTrack = track self.penthouseOutroChatDoneTrack = track

View file

@ -1,57 +1,559 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import *
from direct.fsm import FSM
from direct.task import Timer
from toontown.battle import BattleBase
from toontown.building.ElevatorConstants import *
from toontown.toonbase.ToontownGlobals import *
from toontown.toonbase.ToontownBattleGlobals import *
import DistCogdoMazeGameAI, CogdoMazeGameGlobals, DistributedCogdoElevatorIntAI
import DistCogdoFlyingGameAI, DistributedCogdoBarrelAI
from DistributedCogdoBattleBldgAI import DistributedCogdoBattleBldgAI
from SuitPlannerCogdoInteriorAI import SuitPlannerCogdoInteriorAI
from toontown.cogdominium import CogdoBarrelRoomConsts
class DistributedCogdoInteriorAI(DistributedObjectAI): from toontown.toon import NPCToons
import random, math
NUM_FLOORS_DICT = {
's': 1,
'l': 2,
'm':1,
'c': 1
}
BATTLE_INTRO_DURATION = 10
BARREL_INTRO_DURATION = 12
BARREL_ROOM_DURATION = 30
BARREL_ROOM_REWARD_DURATION = 7
class DistributedCogdoInteriorAI(DistributedObjectAI, FSM.FSM):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedCogdoInteriorAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedCogdoInteriorAI")
def __init__(self, air, exterior):
DistributedObjectAI.__init__(self, air)
FSM.FSM.__init__(self, 'CogdoInteriorAIFSM')
self.toons = filter(None, exterior.elevator.seats[:])
self.responses = {}
self.bldgDoId = exterior.doId
self.numFloors = NUM_FLOORS_DICT[exterior.track]
self.sosNPC = self.__generateSOS(exterior.difficulty)
self.shopOwnerNpcId = 0
self.extZoneId, self.zoneId = exterior.getExteriorAndInteriorZoneId()
npcIdList = NPCToons.zone2NpcDict.get(self.zoneId, [])
if len(npcIdList) == 0:
self.notify.info('No NPC in taken cogdo at %s' % self.zoneId)
else:
if len(npcIdList) > 1:
self.notify.warning('Multiple NPCs in taken cogdo at %s' % self.zoneId)
self.shopOwnerNpcId = npcIdList[0]
def setZoneId(self, todo0): self.gameDone = 0
pass self.bossBattleDone = 0
self.curFloor = 0
self.topFloor = 2
self.timer = Timer.Timer()
self.exterior = exterior
self.planner = self.exterior.planner
self.savedByMap = { }
self.battle = None
self.FOType = exterior.track
def setExtZoneId(self, todo0): self.gameFloor = 1
pass self.battleFloor = 2
self.barrelFloor = -1
if self.FOType == 'l':
self.battleFloor = 3
self.barrelFloor = 2
self.topFloor += 1
self.toonSkillPtsGained = { }
self.toonExp = { }
self.toonOrigQuests = { }
self.toonItems = { }
self.toonOrigMerits = { }
self.toonMerits = { }
self.toonParts = { }
self.helpfulToons = []
self.barrels = []
self.suits = []
self.activeSuits = []
self.reserveSuits = []
self.joinedReserves = []
self.suitsKilled = []
self.suitsKilledPerFloor = []
self.ignoreResponses = 0
self.ignoreElevatorDone = 0
self.ignoreReserveJoinDone = 0
def __generateSOS(self, difficulty):
g = lambda: random.choice(NPCToons.FOnpcFriends.keys())
v = g()
getStars = lambda x: NPCToons.getNPCTrackLevelHpRarity(x)[-1]
maxStars = min(2, int(math.ceil(difficulty / 5.)))
minStars = max(0, maxStars - 1)
while not (minStars <= getStars(v) <= maxStars):
v = g()
self.notify.info('selected SOS %s (stars = %s)' % (v, getStars(v)))
return v
def setZoneId(self, zoneId):
self.zoneId = zoneId
def getZoneId(self):
return self.zoneId
def setDistBldgDoId(self, todo0): def setExtZoneId(self, extZoneId):
pass self.extZoneId = extZoneId
def getExtZoneId(self):
return self.extZoneId
def setDistBldgDoId(self, bldgDoId):
self.bldgDoId = bldgDoId
def getDistBldgDoId(self):
return self.bldgDoId
def setNumFloors(self, todo0): def setNumFloors(self, numFloors):
pass self.numFloors = numFloors
def getNumFloors(self):
return self.numFloors
def setShopOwnerNpcId(self, todo0): def setShopOwnerNpcId(self, id):
pass self.shopOwnerNpcId = id
def setSOSNpcId(self, todo0): def getShopOwnerNpcId(self):
pass return self.shopOwnerNpcId
def setFOType(self, todo0): def setState(self, state, timestamp):
pass self.request(state)
def setToons(self, todo0, todo1): def getState(self):
pass timestamp = globalClockDelta.getRealNetworkTime()
return [self.state, timestamp]
def setSuits(self, todo0, todo1, todo2):
pass def b_setState(self, state):
self.setState(state, 0)
def setState(self, todo0, todo1): self.d_setState(state)
pass
def d_setState(self, state):
def setAvatarJoined(self): timestamp = globalClockDelta.getRealNetworkTime()
pass self.sendUpdate('setState', [state, timestamp])
def elevatorDone(self):
pass
def reserveJoinDone(self): def reserveJoinDone(self):
pass toonId = self.air.getAvatarIdFromSender()
if self.ignoreResponses == 1:
return None
elif self.toons.count(toonId) == 0:
self.notify.warning('reserveJoinDone() - toon not in list: %d' % toonId)
return None
self.b_setState('Battle')
def elevatorDone(self):
toonId = self.air.getAvatarIdFromSender()
if self.ignoreResponses == 1:
return None
elif self.toons.count(toonId) == 0:
self.notify.warning('elevatorDone() - toon not in toon list: %d' % toonId)
def enterWaitForAllToonsInside(self):
self.resetResponses()
if self.FOType == "s":
self.game = DistCogdoMazeGameAI.DistCogdoMazeGameAI(self.air)
self.game.setNumSuits(CogdoMazeGameGlobals.NumSuits)
elif self.FOType == "l":
self.game = DistCogdoFlyingGameAI.DistCogdoFlyingGameAI(self.air)
elif self.FOType == "m":
self.game = DistCogdoCraneGameAI.DistCogdoCraneGameAI(self.air)
def toonLeftBarrelRoom(self): self.sendUpdate("setSOSNpcId", [self.sosNPC])
pass self.sendUpdate("setFOType", [ord(self.FOType)])
def resetResponses(self):
for toon in self.toons:
self.responses[toon] = 0
def setAvatarJoined(self):
avId = self.air.getAvatarIdFromSender()
self.responses[avId] = 1
avatar = self.air.doId2do.get(avId)
if avatar != None:
self.savedByMap[avId] = (avatar.getName(), avatar.dna.asTuple())
self.addToon(avId)
if self.allToonsJoined():
self.request('Elevator')
def addToon(self, avId):
if not avId in self.toons:
self.toons.append(avId)
if self.air.doId2do.has_key(avId):
event = self.air.getAvatarExitEvent(avId)
self.accept(event, self.__handleUnexpectedExit, [avId])
def __handleUnexpectedExit(self, avId):
self.removeToon(avId)
if len(self.toons) == 0:
self.exterior.deleteSuitInterior()
if self.battle:
self.battle.requestDelete()
self.battle = None
def removeToon(self, avId):
if avId in self.toons: self.toons.pop(avId)
def enterElevator(self):
self.curFloor += 1
self.d_setToons()
self.resetResponses()
if self.curFloor == self.gameFloor:
self.enterGame()
self.d_setState('Elevator')
self.timer.stop()
self.timer.startCallback(BattleBase.ELEVATOR_T + ElevatorData[ELEVATOR_NORMAL]['openTime'] + BattleBase.SERVER_BUFFER_TIME, self.serverElevatorDone)
if self.curFloor == self.battleFloor:
self.planner.myPrint()
suitHandles = self.planner.genFloorSuits(0)
self.suits = suitHandles['activeSuits']
self.activeSuits = self.suits[:]
self.reserveSuits = suitHandles['reserveSuits']
self.d_setSuits()
def exitElevator(self):
self.timer.stop()
def serverElevatorDone(self):
if self.curFloor == self.gameFloor:
self.d_setState('Game')
elif self.curFloor == self.battleFloor:
self.b_setState('BattleIntro')
self.timer.startCallback(BATTLE_INTRO_DURATION, self.battleIntroDone)
else:
self.notify.warning('Unknown floor %s (track=%s)' % (self.curFloor, self.FOType))
def battleIntroDone(self):
if self.air:
self.createBattle()
self.b_setState('Battle')
def barrelIntroDone(self):
if not self.air:
return
self.b_setState('CollectBarrels')
for i in xrange(len(CogdoBarrelRoomConsts.BarrelProps)):
barrel = DistributedCogdoBarrelAI.DistributedCogdoBarrelAI(self.air, i)
barrel.generateWithRequired(self.zoneId)
self.barrels.append(barrel)
self.timer.startCallback(BARREL_ROOM_DURATION, self.barrelReward)
def toonBarrelRoomIntroDone(self): def barrelReward(self):
pass if not self.air:
return
self.b_setState('BarrelRoomReward')
for i in self.barrels:
i.requestDelete()
self.timer.startCallback(BARREL_ROOM_REWARD_DURATION, self.barrelRewardDone)
def barrelRewardDone(self):
if not self.air:
return
barrelPlanner = SuitPlannerCogdoInteriorAI(self.exterior._cogdoLayout, max(0, self.exterior.difficulty - 5),
self.FOType, self.exterior.getExteriorAndInteriorZoneId()[1])
barrelPlanner.myPrint()
suitHandles = barrelPlanner.genFloorSuits(0)
self.suits = suitHandles['activeSuits']
self.activeSuits = self.suits[:]
self.reserveSuits = suitHandles['reserveSuits']
self.d_setSuits()
self.battleIntroDone()
def handleAllAboard(self, seats):
if not hasattr(self, 'air') or not self.air:
return None
numOfEmptySeats = seats.count(None)
if numOfEmptySeats == 4:
self.exterior.deleteSuitInterior()
return
elif not 0 <= numOfEmptySeats <= 3:
self.notify.error('Bad number of empty seats: %s' % numOfEmptySeats)
for toon in self.toons:
if toon not in seats:
self.removeToon(toon)
self.toons = filter(None, seats)
self.d_setToons()
def setBarrelRoomReward(self, todo0, todo1): self.request('Elevator')
pass
def enterGame(self):
self.game.setToons(self.toons)
self.game.setInteriorId(self.doId)
self.game.setExteriorZone(self.exterior.zoneId)
self.game.setDifficultyOverrides(2147483647, -1)
self.game.generateWithRequired(self.zoneId)
self.game.d_startIntro()
self.accept(self.game.finishEvent, self.__handleGameDone)
self.accept(self.game.gameOverEvent, self.__handleGameOver)
def __handleGameDone(self, toons):
self.game.requestDelete()
self.gameDone = 1
self.toons = toons
if self.curFloor == self.barrelFloor - 1:
self.curFloor += 1
self.d_setToons()
self.resetResponses()
self.b_setState('BarrelRoomIntro')
self.timer.startCallback(BARREL_INTRO_DURATION, self.barrelIntroDone)
else:
self.request('Elevator')
def __handleGameOver(self):
self.game.requestDelete()
self.exterior.deleteSuitInterior()
def createBattle(self):
isBoss = self.curFloor == self.topFloor
self.battle = DistributedCogdoBattleBldgAI(self.air, self.zoneId, self.__handleRoundDone, self.__handleBattleDone, bossBattle = isBoss)
self.battle.suitsKilled = self.suitsKilled
self.battle.suitsKilledPerFloor = self.suitsKilledPerFloor
self.battle.battleCalc.toonSkillPtsGained = self.toonSkillPtsGained
self.battle.toonExp = self.toonExp
self.battle.toonOrigQuests = self.toonOrigQuests
self.battle.toonItems = self.toonItems
self.battle.toonOrigMerits = self.toonOrigMerits
self.battle.toonMerits = self.toonMerits
self.battle.toonParts = self.toonParts
self.battle.helpfulToons = self.helpfulToons
self.battle.setInitialMembers(self.toons, self.suits)
self.battle.generateWithRequired(self.zoneId)
mult = getCreditMultiplier(self.curFloor)
self.battle.battleCalc.setSkillCreditMultiplier(self.battle.battleCalc.getSkillCreditMultiplier() * mult)
def enterBattleDone(self, toonIds):
toonIds = toonIds[0]
if len(toonIds) != len(self.toons):
deadToons = []
for toon in self.toons:
if toonIds.count(toon) == 0:
deadToons.append(toon)
continue
for toon in deadToons:
self.removeToon(toon)
self.d_setToons()
if len(self.toons) == 0:
self.exterior.deleteSuitInterior()
elif self.curFloor == self.topFloor:
self.battle.resume(self.curFloor, topFloor = 1)
else:
self.battle.resume(self.curFloor, topFloor = 0)
def __doDeleteInterior(self, task):
self.exterior.deleteSuitInterior()
return task.done
def exitBattleDone(self):
self.cleanupFloorBattle()
def cleanupFloorBattle(self):
for suit in self.suits:
if suit.isDeleted():
continue
suit.requestDelete()
self.suits = []
self.reserveSuits = []
self.activeSuits = []
if self.battle != None:
self.battle.requestDelete()
self.battle = None
def __handleRoundDone(self, toonIds, totalHp, deadSuits):
totalMaxHp = 0
for suit in self.suits:
totalMaxHp += suit.maxHP
for suit in deadSuits:
self.activeSuits.remove(suit)
if len(self.reserveSuits) > 0 and len(self.activeSuits) < 4:
self.joinedReserves = []
hpPercent = 100 - (totalHp / totalMaxHp) * 100.0
for info in self.reserveSuits:
if info[1] <= hpPercent and len(self.activeSuits) < 4:
self.suits.append(info[0])
self.activeSuits.append(info[0])
self.joinedReserves.append(info)
continue
for info in self.joinedReserves:
self.reserveSuits.remove(info)
if len(self.joinedReserves) > 0:
self.d_setSuits()
self.request('ReservesJoining')
return
if len(self.activeSuits) == 0:
self.request('BattleDone', [
toonIds])
else:
self.battle.resume()
def enterReservesJoining(self):
self.resetResponses()
self.timer.startCallback(ElevatorData[ELEVATOR_NORMAL]['openTime'] + SUIT_HOLD_ELEVATOR_TIME + BattleBase.SERVER_BUFFER_TIME, self.serverReserveJoinDone)
def toonBarrelRoomRewardDone(self): def exitReservesJoining(self):
pass self.timer.stop()
self.resetResponses()
for info in self.joinedReserves:
self.battle.suitRequestJoin(info[0])
self.battle.resume()
self.joinedReserves = []
def serverReserveJoinDone(self):
self.ignoreReserveJoinDone = 1
self.b_setState('Battle')
def __handleBattleDone(self, zoneId, toonIds):
if len(toonIds) == 0:
taskMgr.doMethodLater(10, self.__doDeleteInterior, self.taskName('deleteInterior'))
elif self.curFloor == self.topFloor:
self.request('Reward')
else:
self.b_setState('Resting')
def enterResting(self):
self.intElevator = DistributedCogdoElevatorIntAI.DistributedCogdoElevatorIntAI(self.air, self, self.toons)
self.intElevator.generateWithRequired(self.zoneId)
def exitResting(self):
self.intElevator.requestDelete()
def enterReward(self):
victors = self.toons[:]
savedBy = []
for v in victors:
tuple = self.savedByMap.get(v)
if tuple:
savedBy.append([
v,
tuple[0],
tuple[1]])
toon = self.air.doId2do.get(v)
if toon:
if self.FOType == 's':
if not toon.attemptAddNPCFriend(self.sosNPC, numCalls=1):
self.notify.info('%s unable to add NPCFriend %s to %s.' % (self.doId, self.sosNPC, v))
elif self.FOType == 'l':
reward = self.getEmblemsReward()
toon.addEmblems(reward)
else:
self.notify.warning('%s unable to reward %s: unknown reward for track %s' % (self.doId, v, self.FOType))
self.exterior.fsm.request('waitForVictorsFromCogdo', [
victors,
savedBy])
self.d_setState('Reward')
def removeToon(self, toonId):
if self.toons.count(toonId):
self.toons.remove(toonId)
def d_setToons(self):
self.sendUpdate('setToons', self.getToons())
def getToons(self):
return [self.toons, 0]
def d_setSuits(self):
self.sendUpdate('setSuits', self.getSuits())
def getSuits(self):
suitIds = []
for suit in self.activeSuits:
suitIds.append(suit.doId)
reserveIds = []
values = []
for info in self.reserveSuits:
reserveIds.append(info[0].doId)
values.append(info[1])
return [
suitIds,
reserveIds,
values]
def allToonsJoined(self):
for toon in self.toons:
if self.responses[toon] == 0:
return 0
return 1
def delete(self):
DistributedObjectAI.delete(self)
self.timer.stop()
def getEmblemsReward(self):
hoodIdMap = {2: .5, # ttc
1: 1., # dd
5: 1.5, # dg
4: 2., # mm
3: 2.7, # br
9: 3.5, # dl
7: 4 # ff
}
hoodValue = hoodIdMap[int(self.exterior.zoneId // 1000)]
diff = max(self.exterior.difficulty, 1)
memos = self.game.getTotalMemos()
E = (hoodValue * max(memos, 1) * diff) / 2.5
return divmod(E, 100)[::-1]

View file

@ -1,10 +1,206 @@
from toontown.building.SuitPlannerInteriorAI import SuitPlannerInteriorAI from otp.ai.AIBaseGlobal import *
from toontown.suit import SuitDNA
from direct.directnotify import DirectNotifyGlobal
from toontown.suit import DistributedSuitAI
from toontown.building import SuitBuildingGlobals
import types, math, random
BASE_RESERVE = 10
class SuitPlannerCogdoInteriorAI(SuitPlannerInteriorAI): MAX_RESERVES = {
def __init__(self, cogdoLayout, bldgLevel, bldgTrack, zone): 's': BASE_RESERVE * .9,
self._cogdoLayout = cogdoLayout 'm': BASE_RESERVE * 1.1,
SuitPlannerInteriorAI.__init__(self, self._cogdoLayout.getNumGameFloors(), bldgLevel, bldgTrack, zone) 'l': BASE_RESERVE * 1.25,
'c': BASE_RESERVE * 1.5,
}
def _genSuitInfos(self, numFloors, bldgLevel, bldgTrack): def filterReviveChance(track, revive):
SuitPlannerInteriorAI._genSuitInfos(self, self._cogdoLayout.getNumFloors(), bldgLevel, bldgTrack) if revive >= 0:
return revive
return random.randint(config.GetInt('min-lt-vs', 0), config.GetInt('max-lt-vs', 2))
# implements difficulty 19 / LT
def getMaxReserves(track):
return int(math.ceil(MAX_RESERVES[track]))
class SuitPlannerCogdoInteriorAI:
notify = DirectNotifyGlobal.directNotify.newCategory('SuitPlannerCogdoInteriorAI')
def __init__(self, layout, difficulty, track, zoneId, numFloors = 1):
self.zoneId = zoneId
self.numFloors = layout.getNumFloors()
difficulty = min(difficulty + 4, len(SuitBuildingGlobals.SuitBuildingInfo) - 1)
self.respectInvasions = 1
if isinstance(difficulty, types.StringType):
self.notify.warning('difficulty is a string!')
difficulty = int(difficulty)
self._genSuitInfos(numFloors, difficulty, track)
def __genJoinChances(self, num):
joinChances = []
for currChance in range(num):
joinChances.append(random.randint(1, 100))
joinChances.sort(cmp)
return joinChances
def _genSuitInfos(self, numFloors, difficulty, bldgTrack):
self.suitInfos = []
self.notify.debug('\n\ngenerating suitsInfos with numFloors (' + str(numFloors) + ') difficulty (' + str(difficulty) + '+1) and bldgTrack (' + str(bldgTrack) + ')')
for currFloor in range(numFloors):
infoDict = {}
lvls = self.__genLevelList(difficulty, currFloor, numFloors)
activeDicts = []
numActive = random.randint(1, min(4, len(lvls)))
if currFloor + 1 == numFloors and len(lvls) > 1:
origBossSpot = len(lvls) - 1
if numActive == 1:
newBossSpot = numActive - 1
else:
newBossSpot = numActive - 2
tmp = lvls[newBossSpot]
lvls[newBossSpot] = lvls[origBossSpot]
lvls[origBossSpot] = tmp
bldgInfo = SuitBuildingGlobals.SuitBuildingInfo[difficulty]
if len(bldgInfo) > SuitBuildingGlobals.SUIT_BLDG_INFO_REVIVES:
revives = bldgInfo[SuitBuildingGlobals.SUIT_BLDG_INFO_REVIVES][0]
else:
revives = 0
for currActive in range(numActive - 1, -1, -1):
level = lvls[currActive]
type = self.__genNormalSuitType(level)
activeDict = {}
activeDict['type'] = type
activeDict['track'] = bldgTrack
activeDict['level'] = level
activeDict['revives'] = filterReviveChance(bldgTrack, revives)
activeDicts.append(activeDict)
infoDict['activeSuits'] = activeDicts
reserveDicts = []
numReserve = min(len(lvls) - numActive, getMaxReserves(bldgTrack))
joinChances = self.__genJoinChances(numReserve)
for currReserve in range(numReserve):
level = lvls[currReserve + numActive]
type = self.__genNormalSuitType(level)
reserveDict = {}
reserveDict['type'] = type
reserveDict['track'] = bldgTrack
reserveDict['level'] = level
reserveDict['revives'] = filterReviveChance(bldgTrack, revives)
reserveDict['joinChance'] = joinChances[currReserve]
reserveDicts.append(reserveDict)
infoDict['reserveSuits'] = reserveDicts
self.suitInfos.append(infoDict)
def __genNormalSuitType(self, lvl):
return SuitDNA.getRandomSuitType(lvl)
def __genLevelList(self, difficulty, currFloor, numFloors):
bldgInfo = SuitBuildingGlobals.SuitBuildingInfo[difficulty]
lvlPoolRange = bldgInfo[SuitBuildingGlobals.SUIT_BLDG_INFO_LVL_POOL]
maxFloors = bldgInfo[SuitBuildingGlobals.SUIT_BLDG_INFO_FLOORS][1]
lvlPoolMults = bldgInfo[SuitBuildingGlobals.SUIT_BLDG_INFO_LVL_POOL_MULTS]
floorIdx = min(currFloor, maxFloors - 1)
lvlPoolMin = lvlPoolRange[0] * lvlPoolMults[floorIdx]
lvlPoolMax = lvlPoolRange[1] * lvlPoolMults[floorIdx]
lvlPool = random.randint(int(lvlPoolMin), int(lvlPoolMax))
lvlMin = bldgInfo[SuitBuildingGlobals.SUIT_BLDG_INFO_SUIT_LVLS][0]
lvlMax = bldgInfo[SuitBuildingGlobals.SUIT_BLDG_INFO_SUIT_LVLS][1]
self.notify.debug('Level Pool: ' + str(lvlPool))
lvlList = []
while lvlPool >= lvlMin:
newLvl = random.randint(lvlMin, min(lvlPool, lvlMax))
lvlList.append(newLvl)
lvlPool -= newLvl
if currFloor + 1 == numFloors:
bossLvlRange = bldgInfo[SuitBuildingGlobals.SUIT_BLDG_INFO_BOSS_LVLS]
newLvl = random.randint(bossLvlRange[0], bossLvlRange[1])
lvlList.append(newLvl)
lvlList.sort(cmp)
self.notify.debug('LevelList: ' + repr(lvlList))
return lvlList
def __setupSuitInfo(self, suit, bldgTrack, suitLevel, suitType):
suitName, skeleton = simbase.air.suitInvasionManager.getInvadingCog()
if suitName and self.respectInvasions:
suitType = SuitDNA.getSuitType(suitName)
bldgTrack = SuitDNA.getSuitDept(suitName)
suitLevel = min(max(suitLevel, suitType), suitType + 4)
dna = SuitDNA.SuitDNA()
dna.newSuitRandom(suitType, bldgTrack)
suit.dna = dna
self.notify.debug('Creating suit type ' + suit.dna.name + ' of level ' + str(suitLevel) + ' from type ' + str(suitType) + ' and track ' + str(bldgTrack))
suit.setLevel(suitLevel)
return skeleton
def __genSuitObject(self, suitZone, suitType, bldgTrack, suitLevel, revives = 0):
newSuit = DistributedSuitAI.DistributedSuitAI(simbase.air, None)
skel = self.__setupSuitInfo(newSuit, bldgTrack, suitLevel, suitType)
if skel:
newSuit.setSkelecog(1)
newSuit.setSkeleRevives(revives)
newSuit.generateWithRequired(suitZone)
newSuit.node().setName('suit-%s' % newSuit.doId)
return newSuit
def myPrint(self):
print 'Generated suits for cogdo: '
for floor, currInfo in enumerate(self.suitInfos):
floor += 1
actives = currInfo['activeSuits']
reserves = currInfo['reserveSuits']
print ' Floor %d has %d active suits.' % (floor, len(actives))
print ' Floor %d has %d reserve suits.' % (floor, len(reserves))
for idx, currActive in enumerate(actives):
type, track, level, revives = map(lambda x: currActive[x], ('type', 'track', 'level', 'revives'))
print '-- Active suit %d is %s, %s and level %d and revives is %d' % (idx, type, track, level, revives)
for idx, currReserve in enumerate(reserves):
type, track, level, revives, res = map(lambda x: currReserve[x], ('type', 'track', 'level', 'revives', 'joinChance'))
print '- Reserve suit %d is %s, %s and level %d and JC = %d and revives is %d' % (idx, type, track, level, res, revives)
def genFloorSuits(self, floor):
suitHandles = {}
floorInfo = self.suitInfos[floor]
activeSuits = []
for activeSuitInfo in floorInfo['activeSuits']:
suit = self.__genSuitObject(self.zoneId, activeSuitInfo['type'], activeSuitInfo['track'], activeSuitInfo['level'], activeSuitInfo['revives'])
activeSuits.append(suit)
suitHandles['activeSuits'] = activeSuits
reserveSuits = []
for reserveSuitInfo in floorInfo['reserveSuits']:
suit = self.__genSuitObject(self.zoneId, reserveSuitInfo['type'], reserveSuitInfo['track'], reserveSuitInfo['level'], reserveSuitInfo['revives'])
reserveSuits.append((suit, reserveSuitInfo['joinChance']))
suitHandles['reserveSuits'] = reserveSuits
return suitHandles
def genSuits(self):
suitHandles = []
for floor in range(len(self.suitInfos)):
floorSuitHandles = self.genFloorSuits(floor)
suitHandles.append(floorSuitHandles)
return suitHandles

View file

@ -94,8 +94,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager') self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager')
self.ttuFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTU_FRIENDS_MANAGER, 'TTUFriendsManager') self.ttuFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTU_FRIENDS_MANAGER, 'TTUFriendsManager')
self.deliveryManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager') self.deliveryManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager')
if config.GetBool('want-code-redemption', 1):
self.codeRedemptionManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_CODE_REDEMPTION_MANAGER, 'TTCodeRedemptionMgr')
self.streetSign = None self.streetSign = None
self.furnitureManager = None self.furnitureManager = None

View file

@ -104,7 +104,7 @@ class FireworkShowMixin:
else: else:
FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId) FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId)
return None return None
self.showMusic = loader.loadMusic(musicFile) self.showMusic = loader.loadMusic(musicFile)
self.showMusic.setVolume(1) self.showMusic.setVolume(1)
@ -132,6 +132,19 @@ class FireworkShowMixin:
if self.fireworkShow and not self.fireworkShow.isEmpty(): if self.fireworkShow and not self.fireworkShow.isEmpty():
self.fireworkShow.setColorScaleOff(0) self.fireworkShow.setColorScaleOff(0)
return return
# Election Only
self.electionFloor = base.render.find('**/ShowFloor')
self.slappyBalloon = base.render.find('**/airballoon.egg')
if self.__checkHoodValidity() and hasattr(base.cr.playGame, 'hood') and base.cr.playGame.hood and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky:
# Election Only
hood = self.getHood()
if hood.id == ToontownCentral:
preShow = Sequence(Func(base.localAvatar.setSystemMessage, 0, startMessage), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(0.0, 0.0, 0.0, 1.0)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(0.25, 0.25, 0.35, 1)), LerpColorScaleInterval(self.electionFloor, 2.5, Vec4(0.25, 0.25, 0.35, 1)), LerpColorScaleInterval(self.slappyBalloon, 2.5, Vec4(0.55, 0.55, 0.65, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(0.85, 0.85, 0.85, 1)), Func(__lightDecorationOn__)), Func(base.setBackgroundColor, Vec4(0, 0, 0, 1)), Func(self.__checkDDFog), Func(base.camLens.setFar, 1000.0), Func(base.cr.playGame.hood.sky.hide), Func(base.localAvatar.setSystemMessage, 0, instructionMessage), Func(self.getLoader().music.stop), Wait(2.0), Func(base.playMusic, self.showMusic, 0, 1, 0.8, max(0, startT)))
else:
preShow = Sequence(Func(base.localAvatar.setSystemMessage, 0, startMessage), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(0.0, 0.0, 0.0, 1.0)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(0.25, 0.25, 0.35, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(0.85, 0.85, 0.85, 1)), Func(__lightDecorationOn__)), Func(base.setBackgroundColor, Vec4(0, 0, 0, 1)), Func(self.__checkDDFog), Func(base.camLens.setFar, 1000.0), Func(base.cr.playGame.hood.sky.hide), Func(base.localAvatar.setSystemMessage, 0, instructionMessage), Func(self.getLoader().music.stop), Wait(2.0), Func(base.playMusic, self.showMusic, 0, 1, 0.8, max(0, startT)))
#preShow = Sequence(Func(base.localAvatar.setSystemMessage, 0, startMessage), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(0.0, 0.0, 0.0, 1.0)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(0.25, 0.25, 0.35, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(0.85, 0.85, 0.85, 1)), Func(__lightDecorationOn__)), Func(base.setBackgroundColor, Vec4(0, 0, 0, 1)), Func(self.__checkDDFog), Func(base.camLens.setFar, 1000.0), Func(base.cr.playGame.hood.sky.hide), Func(base.localAvatar.setSystemMessage, 0, instructionMessage), Func(self.getLoader().music.stop), Wait(2.0), Func(base.playMusic, self.showMusic, 0, 1, 0.8, max(0, startT)))
return preShow
return None
def restoreCameraLens(self): def restoreCameraLens(self):
hood = self.getHood() hood = self.getHood()
@ -153,9 +166,15 @@ class FireworkShowMixin:
else: else:
FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId) FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId)
return None return None
if self.__checkHoodValidity() and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky: if self.__checkHoodValidity() and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky:
postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage)) # Election Only
hood = self.getHood()
if hood.id == ToontownCentral:
postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(self.electionFloor, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(self.slappyBalloon, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage))
else:
postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage))
#postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage))
if self.restorePlaygroundMusic: if self.restorePlaygroundMusic:
postShow.append(Wait(2.0)) postShow.append(Wait(2.0))
postShow.append(Func(base.playMusic, self.getLoader().music, 1, 1, 0.8)) postShow.append(Func(base.playMusic, self.getLoader().music, 1, 1, 0.8))

View file

@ -74,6 +74,7 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.loadFlowerSellBox() self.loadFlowerSellBox()
self.oldClear = base.win.getClearColor() self.oldClear = base.win.getClearColor()
base.win.setClearColor(Vec4(0.09, 0.55, 0.21, 1.0)) base.win.setClearColor(Vec4(0.09, 0.55, 0.21, 1.0))
self.startGame()
def unload(self): def unload(self):
self.ignoreAll() self.ignoreAll()
@ -100,6 +101,7 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.flowerSellBox.removeNode() self.flowerSellBox.removeNode()
del self.flowerSellBox del self.flowerSellBox
self.flowerSellBox = None self.flowerSellBox = None
GardenDropGame.GardenDropGame().endGame()
return return
def announceGenerate(self): def announceGenerate(self):
@ -107,7 +109,7 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.accept('gardenGame', self.startGame) self.accept('gardenGame', self.startGame)
def startGame(self): def startGame(self):
self.game = GardenDropGame.GardenDropGame() self.game = GardenDropGame.GardenDropGame().playGardenDrop()
def loadAirplane(self): def loadAirplane(self):
self.airplane = loader.loadModel('phase_4/models/props/airplane.bam') self.airplane = loader.loadModel('phase_4/models/props/airplane.bam')

View file

@ -34,8 +34,8 @@ class DistributedFurnitureManager(DistributedObject.DistributedObject):
if self.ownerId == base.localAvatar.doId: if self.ownerId == base.localAvatar.doId:
self.cr.furnitureManager = self self.cr.furnitureManager = self
if self.cr.objectManager == None: if self.cr.objectManager == None:
import HouseDesign import houseDesign
self.cr.objectManager = HouseDesign.ObjectManager() self.cr.objectManager = houseDesign.ObjectManager()
return return
def setOwnerName(self, name): def setOwnerName(self, name):

View file

@ -1,14 +1,30 @@
########################## TOONTOWN ADVENTURE ##########################
# Filename: GameSprite.py
# Created by: sillypeppymacspeed
# Date: March 28th, 2014
####
# Description:
#
# This codes the sprites for the Garden Drop estate game.
####
### DEFINITELY NOT COPIED FROM TOONTOWN HOUSE
import math import math
class GameSprite: class GameSprite:
colorRed = (1, 0, 0, 1) colorRed = (1, 0, 0, 1)
colorBlue = (0, 0, 1, 1) colorBlue = (0, 0, 1, 1)
colorGreen = (0, 1, 0, 1) colorGreen = (0, 1, 0, 1)
colorYellow = (1, 1, 0, 1)
colorPurple = (1, 0, 1, 1)
colorGhostRed = (1, 0, 0, 0.5) colorGhostRed = (1, 0, 0, 0.5)
colorGhostBlue = (0, 0, 1, 0.5) colorGhostBlue = (0, 0, 1, 0.5)
colorGhostGreen = (0, 1, 0, 0.5) colorGhostGreen = (0, 1, 0, 0.5)
colorGhostYellow = (1, 1, 0, 0.5)
colorGhostPurple = (1, 0, 1, 0.5)
colorWhite = (1, 1, 1, 1) colorWhite = (1, 1, 1, 1)
colorBlack = (0, 0, 0, 1.0) colorBlack = (0.5, 0.5, 0.5, 1.0)
colorShadow = (0, 0, 0, 0.5) colorShadow = (0, 0, 0, 0.5)
def __init__(self, nodeObj, colorType = 0, foundation = 0): def __init__(self, nodeObj, colorType = 0, foundation = 0):
@ -29,12 +45,20 @@ class GameSprite:
self.setColor(GameSprite.colorGhostBlue) self.setColor(GameSprite.colorGhostBlue)
elif colorType == 2: elif colorType == 2:
self.setColor(GameSprite.colorGhostGreen) self.setColor(GameSprite.colorGhostGreen)
elif colorType == 3:
self.setColor(GameSprite.colorGhostYellow)
elif colorType == 4:
self.setColor(GameSprite.colorGhostPurple)
elif colorType == 0: elif colorType == 0:
self.setColor(GameSprite.colorRed) self.setColor(GameSprite.colorRed)
elif colorType == 1: elif colorType == 1:
self.setColor(GameSprite.colorBlue) self.setColor(GameSprite.colorBlue)
elif colorType == 2: elif colorType == 2:
self.setColor(GameSprite.colorGreen) self.setColor(GameSprite.colorGreen)
elif colorType == 3:
self.setColor(GameSprite.colorYellow)
elif colorType == 4:
self.setColor(GameSprite.colorPurple)
self.markedForDeath = 0 self.markedForDeath = 0
def delete(self): def delete(self):

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,36 @@
acceptErrorDialog = 0
doneEvent = 'game Done'
colorRed = (1, 0, 0, 1)
colorBlue = (0, 0, 1, 1)
colorGreen = (0, 1, 0, 1)
colorGhostRed = (1, 0, 0, 0.5)
colorGhostGreen = (0, 1, 0, 0.5)
colorWhite = (1, 1, 1, 1)
colorBlack = (0.5, 0.5, 0.5, 1.0)
colorShadow = (0, 0, 0, 0.5)
running = 0
maxX = 0.46999999999999997
minX = -0.46999999999999997
maxZ = 0.75000000000000002
minZ = -0.00000000000000001
newBallX = 0.0
newBallZ = 0.69999999999999998
rangeX = (maxX - minX)
rangeZ = (maxZ - minZ)
size = 0.085000000000000006
sizeZ = (size * 0.80000000000000004)
gX = int((rangeX / size))
gZ = int((rangeZ / sizeZ))
maxX = (minX + (gX * size))
maxZ = (minZ + (gZ * sizeZ))
controlOffsetX = 0.0
controlOffsetZ = 0.0
queExtent = 3
gridDimX = gX
gridDimZ = gZ
gridBrick = False
newBallTime = 1.0
newBallCountUp = 0.0
cogX = 0
cogZ = 0
controlSprite = None

View file

@ -231,7 +231,7 @@ PlayGroundToPartyClockColors = {'the_burrrgh': (53.0 / 255.0,
PartyGridUnitLength = [14.4, 14.6] PartyGridUnitLength = [14.4, 14.6]
PartyGridHeadingConverter = 15.0 PartyGridHeadingConverter = 15.0
PartyGridToPandaOffset = (-PartyGridUnitLength[0] * PartyEditorGridSize[0] / 2.0, -PartyGridUnitLength[1] * PartyEditorGridSize[1] / 2.0) PartyGridToPandaOffset = (-PartyGridUnitLength[0] * PartyEditorGridSize[0] / 2.0, -PartyGridUnitLength[1] * PartyEditorGridSize[1] / 2.0)
PartyCostMultiplier = 0 # ALPHA ONLY - remove after parties are legit PartyCostMultiplier = 1
MinimumPartyCost = 100 * PartyCostMultiplier MinimumPartyCost = 100 * PartyCostMultiplier
ActivityInformationDict = {ActivityIds.PartyJukebox: {'cost': int(50 * PartyCostMultiplier), ActivityInformationDict = {ActivityIds.PartyJukebox: {'cost': int(50 * PartyCostMultiplier),
'gridsize': (1, 1), 'gridsize': (1, 1),

View file

@ -15,7 +15,7 @@ from otp.otpbase import OTPLocalizer
from toontown.friends.FriendsListPanel import determineFriendName from toontown.friends.FriendsListPanel import determineFriendName
from toontown.nametag.Nametag import Nametag from toontown.nametag.Nametag import Nametag
from toontown.nametag.NametagFloat2d import * from toontown.nametag.NametagFloat2d import *
from toontown.nametag.NametagGlobals import * from toontown.nametag import NametagGlobals
from toontown.nametag.NametagGroup import NametagGroup from toontown.nametag.NametagGroup import NametagGroup
from toontown.parties import PartyGlobals from toontown.parties import PartyGlobals
from toontown.parties import PartyUtils from toontown.parties import PartyUtils

View file

@ -1,336 +1,336 @@
class CheckersBoard: class CheckersBoard:
def __init__(self): def __init__(self):
self.squareList = [] self.squareList = []
for x in xrange(32): for x in range(32):
self.squareList.append(CheckersTile(x)) self.squareList.append(CheckersTile(x))
self.squareList[0].setAdjacent([None, self.squareList[0].setAdjacent([None,
None, None,
4, 4,
None]) None])
self.squareList[1].setAdjacent([None, self.squareList[1].setAdjacent([None,
4, 4,
5, 5,
None]) None])
self.squareList[2].setAdjacent([None, self.squareList[2].setAdjacent([None,
5, 5,
6, 6,
None]) None])
self.squareList[3].setAdjacent([None, self.squareList[3].setAdjacent([None,
6, 6,
7, 7,
None]) None])
self.squareList[4].setAdjacent([0, self.squareList[4].setAdjacent([0,
8, 8,
9, 9,
1]) 1])
self.squareList[5].setAdjacent([1, self.squareList[5].setAdjacent([1,
9, 9,
10, 10,
2]) 2])
self.squareList[6].setAdjacent([2, self.squareList[6].setAdjacent([2,
10, 10,
11, 11,
3]) 3])
self.squareList[7].setAdjacent([3, self.squareList[7].setAdjacent([3,
11, 11,
None, None,
None]) None])
self.squareList[8].setAdjacent([None, self.squareList[8].setAdjacent([None,
None, None,
12, 12,
4]) 4])
self.squareList[9].setAdjacent([4, self.squareList[9].setAdjacent([4,
12, 12,
13, 13,
5]) 5])
self.squareList[10].setAdjacent([5, self.squareList[10].setAdjacent([5,
13, 13,
14, 14,
6]) 6])
self.squareList[11].setAdjacent([6, self.squareList[11].setAdjacent([6,
14, 14,
15, 15,
7]) 7])
self.squareList[12].setAdjacent([8, self.squareList[12].setAdjacent([8,
16, 16,
17, 17,
9]) 9])
self.squareList[13].setAdjacent([9, self.squareList[13].setAdjacent([9,
17, 17,
18, 18,
10]) 10])
self.squareList[14].setAdjacent([10, self.squareList[14].setAdjacent([10,
18, 18,
19, 19,
11]) 11])
self.squareList[15].setAdjacent([11, self.squareList[15].setAdjacent([11,
19, 19,
None, None,
None]) None])
self.squareList[16].setAdjacent([None, self.squareList[16].setAdjacent([None,
None, None,
20, 20,
12]) 12])
self.squareList[17].setAdjacent([12, self.squareList[17].setAdjacent([12,
20, 20,
21, 21,
13]) 13])
self.squareList[18].setAdjacent([13, self.squareList[18].setAdjacent([13,
21, 21,
22, 22,
14]) 14])
self.squareList[19].setAdjacent([14, self.squareList[19].setAdjacent([14,
22, 22,
23, 23,
15]) 15])
self.squareList[20].setAdjacent([16, self.squareList[20].setAdjacent([16,
24, 24,
25, 25,
17]) 17])
self.squareList[21].setAdjacent([17, self.squareList[21].setAdjacent([17,
25, 25,
26, 26,
18]) 18])
self.squareList[22].setAdjacent([18, self.squareList[22].setAdjacent([18,
26, 26,
27, 27,
19]) 19])
self.squareList[23].setAdjacent([19, self.squareList[23].setAdjacent([19,
27, 27,
None, None,
None]) None])
self.squareList[24].setAdjacent([None, self.squareList[24].setAdjacent([None,
None, None,
28, 28,
20]) 20])
self.squareList[25].setAdjacent([20, self.squareList[25].setAdjacent([20,
28, 28,
29, 29,
21]) 21])
self.squareList[26].setAdjacent([21, self.squareList[26].setAdjacent([21,
29, 29,
30, 30,
22]) 22])
self.squareList[27].setAdjacent([22, self.squareList[27].setAdjacent([22,
30, 30,
31, 31,
23]) 23])
self.squareList[28].setAdjacent([24, self.squareList[28].setAdjacent([24,
None, None,
None, None,
25]) 25])
self.squareList[29].setAdjacent([25, self.squareList[29].setAdjacent([25,
None, None,
None, None,
26]) 26])
self.squareList[30].setAdjacent([26, self.squareList[30].setAdjacent([26,
None, None,
None, None,
27]) 27])
self.squareList[31].setAdjacent([27, self.squareList[31].setAdjacent([27,
None, None,
None, None,
None]) None])
self.squareList[0].setJumps([None, self.squareList[0].setJumps([None,
None, None,
9, 9,
None]) None])
self.squareList[1].setJumps([None, self.squareList[1].setJumps([None,
8, 8,
10, 10,
None]) None])
self.squareList[2].setJumps([None, self.squareList[2].setJumps([None,
9, 9,
11, 11,
None]) None])
self.squareList[3].setJumps([None, self.squareList[3].setJumps([None,
10, 10,
None, None,
None]) None])
self.squareList[4].setJumps([None, self.squareList[4].setJumps([None,
None, None,
13, 13,
None]) None])
self.squareList[5].setJumps([None, self.squareList[5].setJumps([None,
12, 12,
14, 14,
None]) None])
self.squareList[6].setJumps([None, self.squareList[6].setJumps([None,
13, 13,
15, 15,
None]) None])
self.squareList[7].setJumps([None, self.squareList[7].setJumps([None,
14, 14,
None, None,
None]) None])
self.squareList[8].setJumps([None, self.squareList[8].setJumps([None,
None, None,
17, 17,
1]) 1])
self.squareList[9].setJumps([0, self.squareList[9].setJumps([0,
16, 16,
18, 18,
2]) 2])
self.squareList[10].setJumps([1, self.squareList[10].setJumps([1,
17, 17,
19, 19,
3]) 3])
self.squareList[11].setJumps([2, self.squareList[11].setJumps([2,
18, 18,
None, None,
None]) None])
self.squareList[12].setJumps([None, self.squareList[12].setJumps([None,
None, None,
21, 21,
5]) 5])
self.squareList[13].setJumps([4, self.squareList[13].setJumps([4,
20, 20,
22, 22,
6]) 6])
self.squareList[14].setJumps([5, self.squareList[14].setJumps([5,
21, 21,
23, 23,
7]) 7])
self.squareList[15].setJumps([6, self.squareList[15].setJumps([6,
22, 22,
None, None,
None]) None])
self.squareList[16].setJumps([None, self.squareList[16].setJumps([None,
None, None,
25, 25,
9]) 9])
self.squareList[17].setJumps([8, self.squareList[17].setJumps([8,
24, 24,
26, 26,
10]) 10])
self.squareList[18].setJumps([9, self.squareList[18].setJumps([9,
25, 25,
27, 27,
11]) 11])
self.squareList[19].setJumps([10, self.squareList[19].setJumps([10,
26, 26,
None, None,
None]) None])
self.squareList[20].setJumps([None, self.squareList[20].setJumps([None,
None, None,
29, 29,
13]) 13])
self.squareList[21].setJumps([12, self.squareList[21].setJumps([12,
28, 28,
30, 30,
14]) 14])
self.squareList[22].setJumps([13, self.squareList[22].setJumps([13,
29, 29,
31, 31,
15]) 15])
self.squareList[23].setJumps([14, self.squareList[23].setJumps([14,
30, 30,
None, None,
None]) None])
self.squareList[24].setJumps([None, self.squareList[24].setJumps([None,
None, None,
None, None,
17]) 17])
self.squareList[25].setJumps([16, self.squareList[25].setJumps([16,
None, None,
None, None,
18]) 18])
self.squareList[26].setJumps([17, self.squareList[26].setJumps([17,
None, None,
None, None,
19]) 19])
self.squareList[27].setJumps([18, self.squareList[27].setJumps([18,
None, None,
None, None,
None]) None])
self.squareList[28].setJumps([None, self.squareList[28].setJumps([None,
None, None,
None, None,
21]) 21])
self.squareList[29].setJumps([20, self.squareList[29].setJumps([20,
None, None,
None, None,
22]) 22])
self.squareList[30].setJumps([21, self.squareList[30].setJumps([21,
None, None,
None, None,
23]) 23])
self.squareList[31].setJumps([22, self.squareList[31].setJumps([22,
None, None,
None, None,
None]) None])
return return
def delete(self): def delete(self):
for x in self.squareList: for x in self.squareList:
x.delete() x.delete()
del self.squareList del self.squareList
def getSquare(self, arrayLoc): def getSquare(self, arrayLoc):
return self.squareList[arrayLoc] return self.squareList[arrayLoc]
def getState(self, squareNum): def getState(self, squareNum):
return self.squareList[squareNum].getState() return self.squareList[squareNum].getState()
def setState(self, squareNum, newState): def setState(self, squareNum, newState):
self.squareList[squareNum].setState(newState) self.squareList[squareNum].setState(newState)
def getAdjacent(self, squareNum): def getAdjacent(self, squareNum):
return self.squareList[squareNum].adjacent return self.squareList[squareNum].adjacent
def getStates(self): def getStates(self):
retList = [] retList = []
for x in xrange(32): for x in range(32):
retList.append(self.squareList[x].getState()) retList.append(self.squareList[x].getState())
return retList return retList
def setStates(self, squares): def setStates(self, squares):
y = 0 y = 0
for x in xrange(32): for x in range(32):
self.squareList[x].setState(squares[x]) self.squareList[x].setState(squares[x])
def getJumps(self, squareNum): def getJumps(self, squareNum):
return self.squareList[squareNum].jumps return self.squareList[squareNum].jumps
class CheckersTile: class CheckersTile:
def __init__(self, tileNum): def __init__(self, tileNum):
self.tileNum = tileNum self.tileNum = tileNum
self.state = 0 self.state = 0
self.adjacent = [] self.adjacent = []
self.jumps = [] self.jumps = []
def delete(self): def delete(self):
del self.tileNum del self.tileNum
del self.state del self.state
del self.adjacent del self.adjacent
def setJumps(self, jumpList): def setJumps(self, jumpList):
for x in jumpList: for x in jumpList:
self.jumps.append(x) self.jumps.append(x)
def getJumps(self): def getJumps(self):
return self.jumps return self.jumps
def setAdjacent(self, adjList): def setAdjacent(self, adjList):
for x in adjList: for x in adjList:
self.adjacent.append(x) self.adjacent.append(x)
def getAdjacent(self): def getAdjacent(self):
return self.adjacent return self.adjacent
def setState(self, newState): def setState(self, newState):
self.state = newState self.state = newState
def getState(self): def getState(self):
return self.state return self.state
def getNum(self): def getNum(self):
return self.tileNum return self.tileNum

File diff suppressed because it is too large Load diff

View file

@ -1,259 +1,259 @@
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from direct.fsm import FSM from direct.fsm import FSM
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
class ChineseTutorial(DirectFrame, FSM.FSM): class ChineseTutorial(DirectFrame, FSM.FSM):
def __init__(self, doneFunction, doneEvent = None, callback = None): def __init__(self, doneFunction, doneEvent = None, callback = None):
FSM.FSM.__init__(self, 'ChineseTutorial') FSM.FSM.__init__(self, 'ChineseTutorial')
self.doneFunction = doneFunction self.doneFunction = doneFunction
base.localAvatar.startSleepWatch(self.handleQuit) base.localAvatar.startSleepWatch(self.handleQuit)
self.doneEvent = doneEvent self.doneEvent = doneEvent
self.callback = callback self.callback = callback
self.setStateArray(['Page1', 'Page2', 'Quit']) self.setStateArray(['Page1', 'Page2', 'Quit'])
base.localAvatar.startSleepWatch(self.handleQuit) base.localAvatar.startSleepWatch(self.handleQuit)
DirectFrame.__init__(self, pos=(-0.7, 0.0, 0.0), image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.0, 1.5, 1.0), text='', text_scale=0.06) DirectFrame.__init__(self, pos=(-0.7, 0.0, 0.0), image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.0, 1.5, 1.0), text='', text_scale=0.06)
self.accept('stoppedAsleep', self.handleQuit) self.accept('stoppedAsleep', self.handleQuit)
self['image'] = DGG.getDefaultDialogGeom() self['image'] = DGG.getDefaultDialogGeom()
self.title = DirectLabel(self, relief=None, text='', text_pos=(0.0, 0.4), text_fg=(1, 0, 0, 1), text_scale=0.13, text_font=ToontownGlobals.getSignFont()) self.title = DirectLabel(self, relief=None, text='', text_pos=(0.0, 0.4), text_fg=(1, 0, 0, 1), text_scale=0.13, text_font=ToontownGlobals.getSignFont())
images = loader.loadModel('phase_6/models/golf/checker_tutorial.bam') images = loader.loadModel('phase_6/models/golf/checker_tutorial')
images.setTransparency(1) images.setTransparency(1)
self.iPage1 = images.find('**/tutorialPage1*') self.iPage1 = images.find('**/tutorialPage1*')
self.iPage1.reparentTo(aspect2d) self.iPage1.reparentTo(aspect2d)
self.iPage1.setPos(0.43, -0.1, 0.0) self.iPage1.setPos(0.43, -0.1, 0.0)
self.iPage1.setScale(13.95) self.iPage1.setScale(13.95)
self.iPage1.setTransparency(1) self.iPage1.setTransparency(1)
self.iPage1.hide() self.iPage1.hide()
self.iPage1.getChildren()[1].hide() self.iPage1.getChildren()[1].hide()
self.iPage2 = images.find('**/tutorialPage3*') self.iPage2 = images.find('**/tutorialPage3*')
self.iPage2.reparentTo(aspect2d) self.iPage2.reparentTo(aspect2d)
self.iPage2.setPos(0.43, -0.1, 0.5) self.iPage2.setPos(0.43, -0.1, 0.5)
self.iPage2.setScale(13.95) self.iPage2.setScale(13.95)
self.iPage2.setTransparency(1) self.iPage2.setTransparency(1)
self.iPage2.hide() self.iPage2.hide()
self.iPage3 = images.find('**/tutorialPage2*') self.iPage3 = images.find('**/tutorialPage2*')
self.iPage3.reparentTo(aspect2d) self.iPage3.reparentTo(aspect2d)
self.iPage3.setPos(0.43, -0.1, -0.5) self.iPage3.setPos(0.43, -0.1, -0.5)
self.iPage3.setScale(13.95) self.iPage3.setScale(13.95)
self.iPage3.setTransparency(1) self.iPage3.setTransparency(1)
self.iPage3.hide() self.iPage3.hide()
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui') buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
self.bNext = DirectButton(self, image=(gui.find('**/Horiz_Arrow_UP'), self.bNext = DirectButton(self, image=(gui.find('**/Horiz_Arrow_UP'),
gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_DN'),
gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_Rllvr'),
gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), relief=None, text=TTLocalizer.ChineseTutorialNext, text3_fg=Vec4(0, 0, 0, 0.5), text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.35, -0.3, -0.33), command=self.requestNext) gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), relief=None, text=TTLocalizer.ChineseTutorialNext, text3_fg=Vec4(0, 0, 0, 0.5), text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.35, -0.3, -0.33), command=self.requestNext)
self.bPrev = DirectButton(self, image=(gui.find('**/Horiz_Arrow_UP'), self.bPrev = DirectButton(self, image=(gui.find('**/Horiz_Arrow_UP'),
gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_DN'),
gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_Rllvr'),
gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), image_scale=(-1.0, 1.0, 1.0), relief=None, text=TTLocalizer.ChineseTutorialPrev, text3_fg=Vec4(0, 0, 0, 0.5), text_scale=0.05, text_pos=(0.0, -0.1), pos=(-0.35, -0.3, -0.33), command=self.requestPrev) gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), image_scale=(-1.0, 1.0, 1.0), relief=None, text=TTLocalizer.ChineseTutorialPrev, text3_fg=Vec4(0, 0, 0, 0.5), text_scale=0.05, text_pos=(0.0, -0.1), pos=(-0.35, -0.3, -0.33), command=self.requestPrev)
self.bQuit = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=TTLocalizer.ChineseTutorialDone, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.0, -0.3, -0.33), command=self.handleQuit) self.bQuit = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=TTLocalizer.ChineseTutorialDone, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.0, -0.3, -0.33), command=self.handleQuit)
self.bQuit.hide() self.bQuit.hide()
buttons.removeNode() buttons.removeNode()
gui.removeNode() gui.removeNode()
self.request('Page1') self.request('Page1')
return return
def __del__(self): def __del__(self):
self.cleanup() self.cleanup()
def enterPage1(self, *args): def enterPage1(self, *args):
self.bNext.show() self.bNext.show()
self.title['text'] = (TTLocalizer.ChineseTutorialTitle1,) self.title['text'] = (TTLocalizer.ChineseTutorialTitle1,)
self['text'] = TTLocalizer.ChinesePage1 self['text'] = TTLocalizer.ChinesePage1
self['text_pos'] = (0.0, 0.23) self['text_pos'] = (0.0, 0.23)
self['text_wordwrap'] = 13.5 self['text_wordwrap'] = 13.5
self.bPrev['state'] = DGG.DISABLED self.bPrev['state'] = DGG.DISABLED
self.bPrev.hide() self.bPrev.hide()
self.bNext['state'] = DGG.NORMAL self.bNext['state'] = DGG.NORMAL
self.iPage1.show() self.iPage1.show()
self.blinker = Sequence() self.blinker = Sequence()
obj = self.iPage1.getChildren()[1] obj = self.iPage1.getChildren()[1]
self.iPage1.getChildren()[1].show() self.iPage1.getChildren()[1].show()
self.blinker.append(LerpColorInterval(obj, 0.5, Vec4(0.5, 0.5, 0, 0.0), Vec4(0.2, 0.2, 0.2, 1))) self.blinker.append(LerpColorInterval(obj, 0.5, Vec4(0.5, 0.5, 0, 0.0), Vec4(0.2, 0.2, 0.2, 1)))
self.blinker.append(LerpColorInterval(obj, 0.5, Vec4(0.2, 0.2, 0.2, 1), Vec4(0.5, 0.5, 0, 0.0))) self.blinker.append(LerpColorInterval(obj, 0.5, Vec4(0.2, 0.2, 0.2, 1), Vec4(0.5, 0.5, 0, 0.0)))
self.blinker.loop() self.blinker.loop()
def exitPage1(self, *args): def exitPage1(self, *args):
self.bPrev['state'] = DGG.NORMAL self.bPrev['state'] = DGG.NORMAL
self.iPage1.hide() self.iPage1.hide()
self.iPage1.getChildren()[1].hide() self.iPage1.getChildren()[1].hide()
self.blinker.finish() self.blinker.finish()
def enterPage2(self, *args): def enterPage2(self, *args):
self.bPrev.show() self.bPrev.show()
self.title['text'] = (TTLocalizer.ChineseTutorialTitle2,) self.title['text'] = (TTLocalizer.ChineseTutorialTitle2,)
self['text'] = TTLocalizer.ChinesePage2 self['text'] = TTLocalizer.ChinesePage2
self['text_pos'] = (0.0, 0.28) self['text_pos'] = (0.0, 0.28)
self['text_wordwrap'] = 12.5 self['text_wordwrap'] = 12.5
self.bNext['state'] = DGG.DISABLED self.bNext['state'] = DGG.DISABLED
self.bNext.hide() self.bNext.hide()
self.iPage2.show() self.iPage2.show()
self.iPage3.show() self.iPage3.show()
self.bQuit.show() self.bQuit.show()
def exitPage2(self, *args): def exitPage2(self, *args):
self.iPage2.hide() self.iPage2.hide()
self.bQuit.hide() self.bQuit.hide()
self.iPage3.hide() self.iPage3.hide()
def enterQuit(self, *args): def enterQuit(self, *args):
self.iPage1.removeNode() self.iPage1.removeNode()
self.iPage2.removeNode() self.iPage2.removeNode()
self.iPage3.removeNode() self.iPage3.removeNode()
self.bNext.destroy() self.bNext.destroy()
self.bPrev.destroy() self.bPrev.destroy()
self.bQuit.destroy() self.bQuit.destroy()
DirectFrame.destroy(self) DirectFrame.destroy(self)
def exitQuit(self, *args): def exitQuit(self, *args):
pass pass
def handleQuit(self, task = None): def handleQuit(self, task = None):
base.cr.playGame.getPlace().setState('walk') base.cr.playGame.getPlace().setState('walk')
self.forceTransition('Quit') self.forceTransition('Quit')
self.doneFunction() self.doneFunction()
if task != None: if task != None:
task.done task.done
return return
class CheckersTutorial(DirectFrame, FSM.FSM): class CheckersTutorial(DirectFrame, FSM.FSM):
def __init__(self, doneFunction, doneEvent = None, callback = None): def __init__(self, doneFunction, doneEvent = None, callback = None):
FSM.FSM.__init__(self, 'CheckersTutorial') FSM.FSM.__init__(self, 'CheckersTutorial')
self.doneFunction = doneFunction self.doneFunction = doneFunction
base.localAvatar.startSleepWatch(self.handleQuit) base.localAvatar.startSleepWatch(self.handleQuit)
self.doneEvent = doneEvent self.doneEvent = doneEvent
self.callback = callback self.callback = callback
self.setStateArray(['Page1', self.setStateArray(['Page1',
'Page2', 'Page2',
'Page3', 'Page3',
'Quit']) 'Quit'])
DirectFrame.__init__(self, pos=(-0.7, 0.0, 0.0), image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.0, 1.5, 1.0), text='', text_scale=0.06) DirectFrame.__init__(self, pos=(-0.7, 0.0, 0.0), image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.0, 1.5, 1.0), text='', text_scale=0.06)
self.accept('stoppedAsleep', self.handleQuit) self.accept('stoppedAsleep', self.handleQuit)
self['image'] = DGG.getDefaultDialogGeom() self['image'] = DGG.getDefaultDialogGeom()
self.title = DirectLabel(self, relief=None, text='', text_pos=(0.0, 0.4), text_fg=(1, 0, 0, 1), text_scale=0.13, text_font=ToontownGlobals.getSignFont()) self.title = DirectLabel(self, relief=None, text='', text_pos=(0.0, 0.4), text_fg=(1, 0, 0, 1), text_scale=0.13, text_font=ToontownGlobals.getSignFont())
images = loader.loadModel('phase_6/models/golf/regularchecker_tutorial.bam') images = loader.loadModel('phase_6/models/golf/regularchecker_tutorial')
images.setTransparency(1) images.setTransparency(1)
self.iPage1 = images.find('**/tutorialPage1*') self.iPage1 = images.find('**/tutorialPage1*')
self.iPage1.reparentTo(aspect2d) self.iPage1.reparentTo(aspect2d)
self.iPage1.setPos(0.43, -0.1, 0.0) self.iPage1.setPos(0.43, -0.1, 0.0)
self.iPage1.setScale(0.4) self.iPage1.setScale(0.4)
self.iPage1.setTransparency(1) self.iPage1.setTransparency(1)
self.iPage1.hide() self.iPage1.hide()
self.iPage2 = images.find('**/tutorialPage2*') self.iPage2 = images.find('**/tutorialPage2*')
self.iPage2.reparentTo(aspect2d) self.iPage2.reparentTo(aspect2d)
self.iPage2.setPos(0.43, -0.1, 0.0) self.iPage2.setPos(0.43, -0.1, 0.0)
self.iPage2.setScale(0.4) self.iPage2.setScale(0.4)
self.iPage2.setTransparency(1) self.iPage2.setTransparency(1)
self.iPage2.hide() self.iPage2.hide()
self.iPage3 = images.find('**/tutorialPage3*') self.iPage3 = images.find('**/tutorialPage3*')
self.iPage3.reparentTo(aspect2d) self.iPage3.reparentTo(aspect2d)
self.iPage3.setPos(0.6, -0.1, 0.5) self.iPage3.setPos(0.6, -0.1, 0.5)
self.iPage3.setScale(0.4) self.iPage3.setScale(0.4)
self.iPage3.setTransparency(1) self.iPage3.setTransparency(1)
self.obj = self.iPage3.find('**/king*') self.obj = self.iPage3.find('**/king*')
self.iPage3.hide() self.iPage3.hide()
self.iPage4 = images.find('**/tutorialPage4*') self.iPage4 = images.find('**/tutorialPage4*')
self.iPage4.reparentTo(aspect2d) self.iPage4.reparentTo(aspect2d)
self.iPage4.setPos(0.6, -0.1, -0.5) self.iPage4.setPos(0.6, -0.1, -0.5)
self.iPage4.setScale(0.4) self.iPage4.setScale(0.4)
self.iPage4.setTransparency(1) self.iPage4.setTransparency(1)
self.iPage4.hide() self.iPage4.hide()
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui') buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
self.bNext = DirectButton(self, image=(gui.find('**/Horiz_Arrow_UP'), self.bNext = DirectButton(self, image=(gui.find('**/Horiz_Arrow_UP'),
gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_DN'),
gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_Rllvr'),
gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), relief=None, text=TTLocalizer.ChineseTutorialNext, text3_fg=Vec4(0, 0, 0, 0.5), text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.35, -0.3, -0.33), command=self.requestNext) gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), relief=None, text=TTLocalizer.ChineseTutorialNext, text3_fg=Vec4(0, 0, 0, 0.5), text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.35, -0.3, -0.33), command=self.requestNext)
self.bPrev = DirectButton(self, image=(gui.find('**/Horiz_Arrow_UP'), self.bPrev = DirectButton(self, image=(gui.find('**/Horiz_Arrow_UP'),
gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_DN'),
gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_Rllvr'),
gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), image_scale=(-1.0, 1.0, 1.0), relief=None, text=TTLocalizer.ChineseTutorialPrev, text3_fg=Vec4(0, 0, 0, 0.5), text_scale=0.05, text_pos=(0.0, -0.1), pos=(-0.35, -0.3, -0.33), command=self.requestPrev) gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), image_scale=(-1.0, 1.0, 1.0), relief=None, text=TTLocalizer.ChineseTutorialPrev, text3_fg=Vec4(0, 0, 0, 0.5), text_scale=0.05, text_pos=(0.0, -0.1), pos=(-0.35, -0.3, -0.33), command=self.requestPrev)
self.bQuit = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=TTLocalizer.ChineseTutorialDone, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.0, -0.3, -0.33), command=self.handleQuit) self.bQuit = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=TTLocalizer.ChineseTutorialDone, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.0, -0.3, -0.33), command=self.handleQuit)
self.bQuit.hide() self.bQuit.hide()
buttons.removeNode() buttons.removeNode()
gui.removeNode() gui.removeNode()
self.request('Page1') self.request('Page1')
return return
def __del__(self): def __del__(self):
self.cleanup() self.cleanup()
def enterPage1(self, *args): def enterPage1(self, *args):
self.bNext.show() self.bNext.show()
self.title['text'] = (TTLocalizer.ChineseTutorialTitle1,) self.title['text'] = (TTLocalizer.ChineseTutorialTitle1,)
self['text'] = TTLocalizer.CheckersPage1 self['text'] = TTLocalizer.CheckersPage1
self['text_pos'] = (0.0, 0.23) self['text_pos'] = (0.0, 0.23)
self['text_wordwrap'] = 13.5 self['text_wordwrap'] = 13.5
self['text_scale'] = 0.06 self['text_scale'] = 0.06
self.bPrev['state'] = DGG.DISABLED self.bPrev['state'] = DGG.DISABLED
self.bPrev.hide() self.bPrev.hide()
self.bNext['state'] = DGG.NORMAL self.bNext['state'] = DGG.NORMAL
self.iPage1.show() self.iPage1.show()
def exitPage1(self, *args): def exitPage1(self, *args):
self.bPrev['state'] = DGG.NORMAL self.bPrev['state'] = DGG.NORMAL
self.iPage1.hide() self.iPage1.hide()
def enterPage2(self, *args): def enterPage2(self, *args):
self.bPrev.show() self.bPrev.show()
self.bNext.show() self.bNext.show()
self.title['text'] = (TTLocalizer.ChineseTutorialTitle2,) self.title['text'] = (TTLocalizer.ChineseTutorialTitle2,)
self['text'] = TTLocalizer.CheckersPage2 self['text'] = TTLocalizer.CheckersPage2
self['text_pos'] = (0.0, 0.28) self['text_pos'] = (0.0, 0.28)
self['text_wordwrap'] = 12.5 self['text_wordwrap'] = 12.5
self['text_scale'] = 0.06 self['text_scale'] = 0.06
self.bNext['state'] = DGG.NORMAL self.bNext['state'] = DGG.NORMAL
self.iPage2.show() self.iPage2.show()
def exitPage2(self, *args): def exitPage2(self, *args):
self.iPage2.hide() self.iPage2.hide()
def enterPage3(self, *args): def enterPage3(self, *args):
self.bPrev.show() self.bPrev.show()
self.title['text'] = (TTLocalizer.ChineseTutorialTitle2,) self.title['text'] = (TTLocalizer.ChineseTutorialTitle2,)
self['text'] = TTLocalizer.CheckersPage3 + '\n\n' + TTLocalizer.CheckersPage4 self['text'] = TTLocalizer.CheckersPage3 + '\n\n' + TTLocalizer.CheckersPage4
self['text_pos'] = (0.0, 0.32) self['text_pos'] = (0.0, 0.32)
self['text_wordwrap'] = 19 self['text_wordwrap'] = 19
self['text_scale'] = 0.05 self['text_scale'] = 0.05
self.bNext['state'] = DGG.DISABLED self.bNext['state'] = DGG.DISABLED
self.blinker = Sequence() self.blinker = Sequence()
self.blinker.append(LerpColorInterval(self.obj, 0.5, Vec4(0.5, 0.5, 0, 0.0), Vec4(0.9, 0.9, 0, 1))) self.blinker.append(LerpColorInterval(self.obj, 0.5, Vec4(0.5, 0.5, 0, 0.0), Vec4(0.9, 0.9, 0, 1)))
self.blinker.append(LerpColorInterval(self.obj, 0.5, Vec4(0.9, 0.9, 0, 1), Vec4(0.5, 0.5, 0, 0.0))) self.blinker.append(LerpColorInterval(self.obj, 0.5, Vec4(0.9, 0.9, 0, 1), Vec4(0.5, 0.5, 0, 0.0)))
self.blinker.loop() self.blinker.loop()
self.bNext.hide() self.bNext.hide()
self.iPage3.show() self.iPage3.show()
self.iPage4.show() self.iPage4.show()
self.bQuit.show() self.bQuit.show()
def exitPage3(self, *args): def exitPage3(self, *args):
self.blinker.finish() self.blinker.finish()
self.iPage3.hide() self.iPage3.hide()
self.bQuit.hide() self.bQuit.hide()
self.iPage4.hide() self.iPage4.hide()
def enterQuit(self, *args): def enterQuit(self, *args):
self.iPage1.removeNode() self.iPage1.removeNode()
self.iPage2.removeNode() self.iPage2.removeNode()
self.iPage3.removeNode() self.iPage3.removeNode()
self.bNext.destroy() self.bNext.destroy()
self.bPrev.destroy() self.bPrev.destroy()
self.bQuit.destroy() self.bQuit.destroy()
DirectFrame.destroy(self) DirectFrame.destroy(self)
def exitQuit(self, *args): def exitQuit(self, *args):
pass pass
def handleQuit(self, task = None): def handleQuit(self, task = None):
self.forceTransition('Quit') self.forceTransition('Quit')
base.cr.playGame.getPlace().setState('walk') base.cr.playGame.getPlace().setState('walk')
self.doneFunction() self.doneFunction()
if task != None: if task != None:
task.done task.done
return return

View file

@ -568,6 +568,7 @@ class CodesTabPage(DirectFrame):
return return
def load(self): def load(self):
self.notice = DirectLabel(parent=self, relief=None, text='NOTICE: All codes can only be entered once!', text_scale=0.06, pos=(0.0, 0, 0.53), text_fg=Vec4(1.0, 0, 0, 1))
cdrGui = loader.loadModel('phase_3.5/models/gui/tt_m_gui_sbk_codeRedemptionGui') cdrGui = loader.loadModel('phase_3.5/models/gui/tt_m_gui_sbk_codeRedemptionGui')
instructionGui = cdrGui.find('**/tt_t_gui_sbk_cdrPresent') instructionGui = cdrGui.find('**/tt_t_gui_sbk_cdrPresent')
flippyGui = cdrGui.find('**/tt_t_gui_sbk_cdrFlippy') flippyGui = cdrGui.find('**/tt_t_gui_sbk_cdrFlippy')
@ -633,8 +634,8 @@ class CodesTabPage(DirectFrame):
if input == '': if input == '':
return return
messenger.send('wakeup') messenger.send('wakeup')
if hasattr(base, 'codeRedemptionMgr'): if hasattr(base.cr, 'codeRedemptionMgr'):
base.codeRedemptionMgr.redeemCode(input, self.__getCodeResult) base.cr.codeRedemptionMgr.redeemCode(input, self.__getCodeResult)
self.codeInput.enterText('') self.codeInput.enterText('')
self.__disableCodeEntry() self.__disableCodeEntry()
return return
@ -646,36 +647,18 @@ class CodesTabPage(DirectFrame):
if result == 0: if result == 0:
self.resultPanel['image'] = self.resultPanelSuccessGui self.resultPanel['image'] = self.resultPanelSuccessGui
self.resultPanel['text'] = TTLocalizer.CdrResultSuccess self.resultPanel['text'] = TTLocalizer.CdrResultSuccess
elif result == 1 or result == 3: elif result == 1:
self.resultPanel['image'] = self.resultPanelFailureGui self.resultPanel['image'] = self.resultPanelFailureGui
self.resultPanel['text'] = TTLocalizer.CdrResultInvalidCode self.resultPanel['text'] = TTLocalizer.CdrResultInvalidCode
elif result == 2: elif result == 2:
self.resultPanel['image'] = self.resultPanelFailureGui self.resultPanel['image'] = self.resultPanelFailureGui
self.resultPanel['text'] = TTLocalizer.CdrResultExpiredCode self.resultPanel['text'] = TTLocalizer.CdrResultExpiredCode
elif result == 4: elif result == 3:
self.resultPanel['image'] = self.resultPanelErrorGui self.resultPanel['image'] = self.resultPanelErrorGui
if awardMgrResult == 0: if awardMgrResult == 1:
self.resultPanel['text'] = TTLocalizer.CdrResultSuccess
elif awardMgrResult == 1 or awardMgrResult == 2 or awardMgrResult == 15 or awardMgrResult == 16:
self.resultPanel['text'] = TTLocalizer.CdrResultUnknownError
elif awardMgrResult == 3 or awardMgrResult == 4:
self.resultPanel['text'] = TTLocalizer.CdrResultMailboxFull self.resultPanel['text'] = TTLocalizer.CdrResultMailboxFull
elif awardMgrResult == 5 or awardMgrResult == 10: elif awardMgrResult == 2:
self.resultPanel['text'] = TTLocalizer.CdrResultAlreadyInMailbox self.resultPanel['text'] = TTLocalizer.CdrResultAlreadyRedeemed
elif awardMgrResult == 6 or awardMgrResult == 7 or awardMgrResult == 11:
self.resultPanel['text'] = TTLocalizer.CdrResultAlreadyInQueue
elif awardMgrResult == 8:
self.resultPanel['text'] = TTLocalizer.CdrResultAlreadyInCloset
elif awardMgrResult == 9:
self.resultPanel['text'] = TTLocalizer.CdrResultAlreadyBeingWorn
elif awardMgrResult == 12 or awardMgrResult == 13 or awardMgrResult == 14:
self.resultPanel['text'] = TTLocalizer.CdrResultAlreadyReceived
elif result == 5:
self.resultPanel['text'] = TTLocalizer.CdrResultTooManyFails
self.__disableCodeEntry()
elif result == 6:
self.resultPanel['text'] = TTLocalizer.CdrResultServiceUnavailable
self.__disableCodeEntry()
if result == 0: if result == 0:
self.successSfx.play() self.successSfx.play()
else: else:

View file

@ -577,7 +577,6 @@ class ShardPage(ShtikerPage.ShtikerPage):
for shardId, buttonTuple in self.shardButtonMap.items(): for shardId, buttonTuple in self.shardButtonMap.items():
buttonTuple[1]['state'] = DGG.NORMAL buttonTuple[1]['state'] = DGG.NORMAL
buttonTuple[2]['state'] = DGG.NORMAL buttonTuple[2]['state'] = DGG.NORMAL
self.removeRightBrain()
self.ignore('shardInfoUpdated') self.ignore('shardInfoUpdated')
self.ignore('ShardPageConfirmDone') self.ignore('ShardPageConfirmDone')
taskMgr.remove('ShardPageUpdateTask-doLater') taskMgr.remove('ShardPageUpdateTask-doLater')

View file

@ -185,6 +185,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
self.canEarnAchievements = False self.canEarnAchievements = False
self.promotionStatus = [0, 0, 0, 0] self.promotionStatus = [0, 0, 0, 0]
self.buffs = [] self.buffs = []
self.redeemedCodes = []
def disable(self): def disable(self):
for soundSequence in self.soundSequenceList: for soundSequence in self.soundSequenceList:
@ -2635,6 +2636,9 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
self.buffs = buffs self.buffs = buffs
self.applyBuffs() self.applyBuffs()
def setRedeemedCodes(self, redeemedCodes):
self.redeemedCodes = redeemedCodes
def applyBuffs(self): def applyBuffs(self):
for id, timestamp in enumerate(self.buffs): for id, timestamp in enumerate(self.buffs):
if id == ToontownGlobals.BMovementSpeed: if id == ToontownGlobals.BMovementSpeed:

View file

@ -193,6 +193,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self._gmDisabled = False self._gmDisabled = False
self.promotionStatus = [0, 0, 0, 0] self.promotionStatus = [0, 0, 0, 0]
self.buffs = [] self.buffs = []
self.redeemedCodes = []
def generate(self): def generate(self):
DistributedPlayerAI.DistributedPlayerAI.generate(self) DistributedPlayerAI.DistributedPlayerAI.generate(self)
@ -4278,6 +4279,27 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.setBuffs(buffs) self.setBuffs(buffs)
self.d_setBuffs(buffs) self.d_setBuffs(buffs)
def setRedeemedCodes(self, redeemedCodes):
self.redeemedCodes = redeemedCodes
def d_setRedeemedCodes(self, redeemedCodes):
self.sendUpdate('setRedeemedCodes', [redeemedCodes])
def b_setRedeemedCodes(self, redeemedCodes):
self.setRedeemedCodes(redeemedCodes)
self.d_setRedeemedCodes(redeemedCodes)
def getRedeemedCodes(self, redeemedCodes):
return self.redeemedCodes
def isCodeRedeemed(self, code):
return code in self.redeemedCodes
def redeemCode(self, code):
if not self.isCodeRedeemed(code):
self.redeemedCodes.append(code)
self.b_setRedeemedCodes(self.redeemedCodes)
@magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int]) @magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int])
def cheesyEffect(value, hood=0, expire=0): def cheesyEffect(value, hood=0, expire=0):

View file

@ -543,3 +543,6 @@ class DistributedToonUD(DistributedObjectUD):
def setAchievements(self, achievements): def setAchievements(self, achievements):
pass pass
def setRedeemedCodes(self, redeemedCodes):
pass

View file

@ -322,7 +322,8 @@ Shirts = ['phase_3/maps/desat_shirt_1.jpg',
'phase_4/maps/tt_t_chr_avt_shirt_trolley05.jpg', 'phase_4/maps/tt_t_chr_avt_shirt_trolley05.jpg',
'phase_4/maps/tt_t_chr_avt_shirt_saveBuilding4.jpg', 'phase_4/maps/tt_t_chr_avt_shirt_saveBuilding4.jpg',
'phase_4/maps/tt_t_chr_avt_shirt_saveBuilding05.jpg', 'phase_4/maps/tt_t_chr_avt_shirt_saveBuilding05.jpg',
'phase_4/maps/tt_t_chr_avt_shirt_anniversary.jpg'] 'phase_4/maps/tt_t_chr_avt_shirt_anniversary.jpg',
'phase_4/maps/WeedShirt.jpg']
BoyShirts = [(0, 0), BoyShirts = [(0, 0),
(1, 1), (1, 1),
(2, 2), (2, 2),
@ -657,7 +658,8 @@ ClothesColors = [VBase4(0.933594, 0.265625, 0.28125, 1.0),
VBase4(0.0, 0.2, 0.956862, 1.0), VBase4(0.0, 0.2, 0.956862, 1.0),
VBase4(0.972549, 0.094117, 0.094117, 1.0), VBase4(0.972549, 0.094117, 0.094117, 1.0),
VBase4(0.447058, 0.0, 0.90196, 1.0), VBase4(0.447058, 0.0, 0.90196, 1.0),
VBase4(0.3, 0.3, 0.35, 1.0)] VBase4(0.3, 0.3, 0.35, 1.0),
VBase4(0.196078, 0.803921, 0.196078, 1.0)]
ShirtStyles = {'bss1': [0, 0, [(0, 0), ShirtStyles = {'bss1': [0, 0, [(0, 0),
(1, 1), (1, 1),
(2, 2), (2, 2),
@ -1225,7 +1227,8 @@ ShirtStyles = {'bss1': [0, 0, [(0, 0),
'jb_1': [112, 99, [(27, 27)]], 'jb_1': [112, 99, [(27, 27)]],
'jb_2': [113, 100, [(27, 27)]], 'jb_2': [113, 100, [(27, 27)]],
'ugcms': [117, 104, [(27, 27)]], 'ugcms': [117, 104, [(27, 27)]],
'lb_1': [119, 106, [(27, 27)]]} 'lb_1': [119, 106, [(27, 27)]],
'weed': [148, 0, [(27, 32)]]}
BottomStyles = {'bbs1': [0, [0, BottomStyles = {'bbs1': [0, [0,
1, 1,
2, 2,

View file

@ -4698,15 +4698,8 @@ CdrInstructions = 'Enter your code to receive a special item in your mailbox.'
CdrResultSuccess = 'Congratulations! Check your mailbox to claim your item!' CdrResultSuccess = 'Congratulations! Check your mailbox to claim your item!'
CdrResultInvalidCode = "You've entered an invalid code. Please check the code and try again." CdrResultInvalidCode = "You've entered an invalid code. Please check the code and try again."
CdrResultExpiredCode = "We're sorry. This code has expired." CdrResultExpiredCode = "We're sorry. This code has expired."
CdrResultUnknownError = "We're sorry. This code cannot be applied to your Toon."
CdrResultMailboxFull = 'Your mailbox is full. Please remove an item, then enter your code again.' CdrResultMailboxFull = 'Your mailbox is full. Please remove an item, then enter your code again.'
CdrResultAlreadyInMailbox = "You've already received this item. Check your mailbox to confirm." CdrResultAlreadyRedeemed = "You've already redeemed this item!"
CdrResultAlreadyInQueue = 'Your item is on its way. Check your mailbox in a few minutes to receive it.'
CdrResultAlreadyInCloset = "You've already received this item. Check your closet to confirm."
CdrResultAlreadyBeingWorn = "You've already received this item, and you are wearing it!"
CdrResultAlreadyReceived = "You've already received this item."
CdrResultTooManyFails = "We're sorry. You've tried to enter an incorrect code too many times. Please try again after some time."
CdrResultServiceUnavailable = "We're sorry. This feature is temporarily unavailable. Please try again during your next login."
TrackPageTitle = 'Gag Track Training' TrackPageTitle = 'Gag Track Training'
TrackPageShortTitle = 'Gag Training' TrackPageShortTitle = 'Gag Training'
TrackPageSubtitle = 'Complete ToonTasks to learn how to use new gags!' TrackPageSubtitle = 'Complete ToonTasks to learn how to use new gags!'
@ -6135,7 +6128,8 @@ ShirtStylesDescriptions = {'bss1': 'solid',
'lb_1': 'Lawbot Icon Shirt', 'lb_1': 'Lawbot Icon Shirt',
'jb_1': 'Jellybean Shirt', 'jb_1': 'Jellybean Shirt',
'jb_2': 'Doodle Shirt', 'jb_2': 'Doodle Shirt',
'ugcms': 'Get Connected Mover & Shaker'} 'ugcms': 'Get Connected Mover & Shaker',
'weed': '420 BlazeIt Shirt'}
BottomStylesDescriptions = {'bbs1': 'plain w/ pockets', BottomStylesDescriptions = {'bbs1': 'plain w/ pockets',
'bbs2': 'belt', 'bbs2': 'belt',
'bbs3': 'cargo', 'bbs3': 'cargo',
@ -6675,7 +6669,8 @@ ClothingTypeNames = {1001: 'Ghost Shirt',
1783: 'Racing Shorts 1', 1783: 'Racing Shorts 1',
1784: 'Racing Skirt 1', 1784: 'Racing Skirt 1',
1801: 'Batty Moon Shirt', 1801: 'Batty Moon Shirt',
1802: 'Mittens Shirt'} 1802: 'Mittens Shirt',
1821: '420 BlazeIt Shirt'}
AccessoryArticleNames = ('Hat', AccessoryArticleNames = ('Hat',
'Glasses', 'Glasses',
'Backpack', 'Backpack',
@ -9609,6 +9604,16 @@ CheckersObserver = 'You are Observing'
RegularCheckers = 'Checkers.' RegularCheckers = 'Checkers.'
RegularCheckersGameOf = ' has just won a game of ' RegularCheckersGameOf = ' has just won a game of '
RegularCheckersYouWon = 'You just won a game of Checkers!' RegularCheckersYouWon = 'You just won a game of Checkers!'
GardenDropTitle = 'Garden Drop'
GardenDropExitGame = 'Exit Mini Game'
GardenDropHelpTitle = 'Instructions:'
GardenDropInstructions = "Match the ghost balls with the normal balls! But beware of the cog ball, it will try to block you off!"
GardenDropBackToGame = "Back to Game"
GardenDropButtonTitle = 'Garden\nDrop'
GardenDropCongradulations = 'Super Congratulations!!'
GardenDropProgressLevels = "Click 'Next' to go to the next level!"
GardenDropWinGame = 'You have won the Garden Drop Game!'
GardenDropExit = 'Exit'
MailNotifyNewItems = "You've got mail!" MailNotifyNewItems = "You've got mail!"
MailNewMailButton = 'Mail' MailNewMailButton = 'Mail'
MailSimpleMail = 'Note' MailSimpleMail = 'Note'

View file

@ -44,6 +44,21 @@ class ToontownLoadingScreen:
ToontownGlobals.LawbotHQ : 'phase_3.5/maps/loading/lbhq.jpg', ToontownGlobals.LawbotHQ : 'phase_3.5/maps/loading/lbhq.jpg',
ToontownGlobals.BossbotHQ : 'phase_3.5/maps/loading/bbhq.jpg' ToontownGlobals.BossbotHQ : 'phase_3.5/maps/loading/bbhq.jpg'
} }
emotes = [
{'emote': 'bored', 'frame': 135},
{'emote': 'run', 'frame': 7},
{'emote': 'victory', 'frame': 10},
{'emote': 'applause', 'frame': 23},
{'emote': 'sprinkle-dust', 'frame': 40},
{'emote': 'hypnotize', 'frame': 25},
{'emote': 'cringe', 'frame': 25},
{'emote': 'wave', 'frame': 25},
{'emote': 'shrug', 'frame': 30},
{'emote': 'duck', 'frame': 40},
{'emote': 'up', 'frame': 60},
{'emote': 'down', 'frame': 23},
{'emote': 'bow', 'frame': 45}
]
def __init__(self): def __init__(self):
self.__expectedCount = 0 self.__expectedCount = 0
@ -82,9 +97,10 @@ class ToontownLoadingScreen:
if gui: if gui:
if base.localAvatarStyle: if base.localAvatarStyle:
from toontown.toon import Toon from toontown.toon import Toon
emote = random.choice(self.emotes)
self.toon = Toon.Toon() self.toon = Toon.Toon()
self.toon.setDNA(base.localAvatarStyle) self.toon.setDNA(base.localAvatarStyle)
self.toon.loop('bored', fromFrame=135, toFrame=135) self.toon.loop(emote['emote'], fromFrame=emote['frame'], toFrame=emote['frame'])
self.toon.getGeomNode().setDepthWrite(1) self.toon.getGeomNode().setDepthWrite(1)
self.toon.getGeomNode().setDepthTest(1) self.toon.getGeomNode().setDepthTest(1)
self.toon.setHpr(205, 0, 0) self.toon.setHpr(205, 0, 0)