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/
backups/
contentpacks/
toondata/
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.

View file

@ -70,9 +70,9 @@ from toontown.estate import DistributedHouse/AI
from toontown.estate import DistributedHouseInterior/AI
from toontown.estate import DistributedGarden/AI
from toontown.shtiker import DeleteManager/AI
from toontown.shtiker import GroupManager/AI
from toontown.ai import NewsManager/AI
from toontown.shtiker import PurchaseManager/AI
from toontown.shtiker import GroupManager/AI
from toontown.shtiker import NewbiePurchaseManager/AI
from toontown.safezone import SafeZoneManager/AI
from toontown.tutorial import TutorialManager/AI
@ -288,7 +288,7 @@ from toontown.uberdog.DistributedPartyManager/AI/UD import DistributedPartyManag
from toontown.rpc.AwardManager/UD import AwardManager/UD
from toontown.uberdog.DistributedCpuInfoMgr/AI/UD import DistributedCpuInfoMgr/AI/UD
from toontown.uberdog.DistributedInGameNewsMgr/AI/UD import DistributedInGameNewsMgr/AI/UD
from toontown.coderedemption.TTCodeRedemptionMgr/AI/UD import TTCodeRedemptionMgr/AI/UD
from toontown.coderedemption.TTCodeRedemptionMgr/AI import TTCodeRedemptionMgr/AI
from toontown.distributed.NonRepeatableRandomSourceAI import NonRepeatableRandomSourceAI
from toontown.distributed.NonRepeatableRandomSourceUD import NonRepeatableRandomSourceUD
from toontown.ai.DistributedPhaseEventMgr/AI import DistributedPhaseEventMgr/AI
@ -627,6 +627,7 @@ dclass DistributedToon : DistributedPlayer {
flagAv(uint32, uint16, string []) airecv ownsend;
setAnimalSound(uint8 index) ram broadcast ownrecv;
setBuffs(uint32[] = []) required ownrecv db;
setRedeemedCodes(string [] = []) required ownrecv db;
};
dclass DistributedCCharBase : DistributedObject {
@ -1265,7 +1266,7 @@ dclass DistributedPartyActivity : DistributedObject {
exitRequestDenied(uint8);
setToonsPlaying(uint32 []) broadcast ram;
setState(string, int16) broadcast ram;
showJellybeanReward(uint32, uint8, string);
showJellybeanReward(uint32, uint32, string);
};
dclass DistributedPartyTeamActivity : DistributedPartyActivity {
@ -1417,6 +1418,16 @@ dclass DeleteManager : DistributedObject {
setInventory(blob) airecv clsend;
};
dclass GroupManager : DistributedObject {
createGroup(uint32, uint32, string) clsend airecv;
closeGroup(uint32, uint32) clsend airecv;
addPlayerId(uint32, uint32, uint32) clsend airecv;
removePlayerId(uint32, uint32, uint32) clsend airecv;
getInfo(uint32) clsend airecv;
setInfo(string) clsend airecv;
info(string);
};
struct weeklyCalendarHoliday {
uint8 holidayId;
uint8 dayOfTheWeek;
@ -1489,16 +1500,6 @@ dclass PurchaseManager : DistributedObject {
setPurchaseExit() broadcast;
};
dclass GroupManager : DistributedObject {
createGroup(uint32, uint32, string) clsend airecv;
closeGroup(uint32, uint32) clsend airecv;
addPlayerId(uint32, uint32, uint32) clsend airecv;
removePlayerId(uint32, uint32, uint32) clsend airecv;
getInfo(uint32) clsend airecv;
setInfo(string) clsend airecv;
info(string);
};
dclass NewbiePurchaseManager : PurchaseManager {
setOwnedNewbieId(uint32) required broadcast ram;
};
@ -1703,72 +1704,6 @@ dclass DistCogdoFlyingGame : DistCogdoGame {
dclass DistCogdoBoardroomGame : DistCogdoLevelGame {
};
dclass DistCogdoCraneGame : DistCogdoLevelGame {
};
dclass DistCogdoCrane : DistributedObject {
setCraneGameId(uint32) required broadcast ram;
setIndex(uint8) required broadcast ram;
setState(char, uint32) broadcast ram;
clearSmoothing(int8) broadcast clsend;
setCablePos(uint8, int16/100, uint16%360/100, LinkPosition [3], int16) broadcast clsend;
};
dclass DistCogdoCraneObject : DistributedObject {
setCraneGameId(uint32) required broadcast ram;
setObjectState(char, uint32, uint32) broadcast ram;
requestGrab() airecv clsend;
rejectGrab();
requestDrop() airecv clsend;
hitFloor() clsend;
requestFree(int16/10, int16/10, int16/10, uint16%360/100) airecv clsend;
hitBoss(uint16/255) airecv clsend;
setX(int16/10) broadcast ram clsend airecv;
setY(int16/10) broadcast ram clsend airecv;
setZ(int16/10) broadcast ram clsend airecv;
setH(int16%360/10) broadcast ram clsend airecv;
setP(int16%360/10) broadcast ram clsend airecv;
setR(int16%360/10) broadcast ram clsend airecv;
setPos : setX, setY, setZ;
setHpr : setH, setP, setR;
setPosHpr : setX, setY, setZ, setH, setP, setR;
setXY : setX, setY;
setXZ : setX, setZ;
setXYH : setX, setY, setH;
setXYZH : setX, setY, setZ, setH;
setComponentL(uint64) broadcast ram clsend airecv;
setComponentX(int16/10) broadcast ram clsend airecv;
setComponentY(int16/10) broadcast ram clsend airecv;
setComponentZ(int16/10) broadcast ram clsend airecv;
setComponentH(int16%360/10) broadcast ram clsend airecv;
setComponentP(int16%360/10) broadcast ram clsend airecv;
setComponentR(int16%360/10) broadcast ram clsend airecv;
setComponentT(int16) broadcast ram clsend airecv;
setSmStop : setComponentT;
setSmH : setComponentH, setComponentT;
setSmZ : setComponentZ, setComponentT;
setSmXY : setComponentX, setComponentY, setComponentT;
setSmXZ : setComponentX, setComponentZ, setComponentT;
setSmPos : setComponentX, setComponentY, setComponentZ, setComponentT;
setSmHpr : setComponentH, setComponentP, setComponentR, setComponentT;
setSmXYH : setComponentX, setComponentY, setComponentH, setComponentT;
setSmXYZH : setComponentX, setComponentY, setComponentZ, setComponentH, setComponentT;
setSmPosHpr : setComponentX, setComponentY, setComponentZ, setComponentH, setComponentP, setComponentR, setComponentT;
setSmPosHprL : setComponentL, setComponentX, setComponentY, setComponentZ, setComponentH, setComponentP, setComponentR, setComponentT;
clearSmoothing(int8) broadcast clsend;
};
dclass DistCogdoCraneMoneyBag : DistCogdoCraneObject {
setIndex(uint8) required broadcast ram;
requestInitial() airecv clsend;
};
dclass DistCogdoCraneCog : DistributedObject {
setGameId(uint32) required broadcast ram;
setDNAString(blob) required broadcast ram;
setSpawnInfo(uint8, int16) required broadcast ram;
};
dclass DistributedHQInterior : DistributedObject {
setZoneIdAndBlock(uint32, uint16) required broadcast ram;
setLeaderBoard(blob) required broadcast ram;
@ -3321,10 +3256,7 @@ dclass NonRepeatableRandomSourceClient {
};
dclass TTCodeRedemptionMgr : DistributedObject, NonRepeatableRandomSourceClient {
giveAwardToToonResult(uint32, uint32);
redeemCode(uint32, char [0-256]) airecv clsend;
redeemCodeAiToUd(uint32, DoId, uint32, string, uint32);
redeemCodeResultUdToAi(uint32, uint32, uint32, uint32, uint32) airecv;
redeemCodeResult(uint32, uint32, uint32);
};

View file

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

View file

@ -108,6 +108,11 @@ want-resistance-dance #f
# Cog battles:
base-xp-multiplier 1.0
# Cog Dominiums
want-emblems #t
cogdo-want-barrel-room #t
want-lawbot-cogdo #t
# Cog buildings:
want-cogbuildings #t

View file

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

View file

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

View file

@ -2,7 +2,7 @@
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
@ -11,7 +11,7 @@ from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, Dis
from toontown.uberdog.DistributedPartyManager import DistributedPartyManager
from otp.friends import FriendManager, AvatarFriendsManager, PlayerFriendsManager, GuildManager, FriendInfo, AvatarFriendInfo
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.uberdog.ClientServicesManager import ClientServicesManager
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.ToontownDistrictStatsAI import ToontownDistrictStatsAI
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
from toontown.coderedemption.TTCodeRedemptionMgrAI import TTCodeRedemptionMgrAI
from toontown.dna.DNAParser import loadDNAFileAI
from toontown.estate.EstateManagerAI import EstateManagerAI
from toontown.hood import BRHoodAI
@ -117,6 +118,8 @@ class ToontownAIRepository(ToontownInternalRepository):
self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
self.bankManager = BankManagerAI.BankManagerAI(self)
self.holidayManager = HolidayManagerAI(self)
self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self)
self.codeRedemptionMgr.generateWithRequired(2)
self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self)
self.buildingQueryMgr.generateWithRequired(2)
self.groupManager.generateWithRequired(2)

View file

@ -290,7 +290,8 @@ ClothingTypes = {101: (ABoysShirt, 'bss1', 40),
1817: (AGirlsSkirt, 'sa_gs19', 5000),
1818: (AGirlsSkirt, 'sa_gs20', 5000),
1819: (AGirlsSkirt, 'sa_gs21', 5000),
1820: (AShirt, 'sa_ss55', 5000)}
1820: (AShirt, 'sa_ss55', 5000),
1821: (AShirt, 'weed', 5000)}
LoyaltyClothingItems = (1600,
1601,
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):
DistributedObject.announceGenerate(self)
base.codeRedemptionMgr = self
base.cr.codeRedemptionMgr = self
self._contextGen = SerialMaskedGen(4294967295L)
self._context2callback = {}
def delete(self):
if hasattr(base, 'codeRedemptionMgr'):
if base.codeRedemptionMgr is self:
del base.codeRedemptionMgr
if hasattr(base.cr, 'codeRedemptionMgr'):
if base.cr.codeRedemptionMgr is self:
del base.cr.codeRedemptionMgr
self._context2callback = None
self._contextGen = None
DistributedObject.delete(self)

View file

@ -1,21 +1,93 @@
from direct.directnotify import DirectNotifyGlobal
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):
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):
pass
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
def redeemCode(self, todo0, todo1):
pass
def getMailboxCount(self, items):
count = 0
def redeemCodeAiToUd(self, todo0, todo1, todo2, todo3, todo4):
pass
for item in items:
if item.getDeliveryTime() > 0:
count += 1
def redeemCodeResultUdToAi(self, todo0, todo1, todo2, todo3, todo4):
pass
return count
def redeemCodeResult(self, todo0, todo1, todo2):
pass
def redeemCode(self, context, code):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
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.reparentTo(render)
self.model.stash()
self.dummyElevInNode = self.model.attachNewNode('elevator-in')
self.dummyElevInNode.hide()
self.entranceNode = self.model.attachNewNode('door-entrance')
self.entranceNode.setPos(0, -65, 0)
self.nearBattleNode = self.model.attachNewNode('near-battle')
@ -49,6 +47,11 @@ class CogdoBarrelRoom:
self.fog = Fog('barrel-room-fog')
self.fog.setColor(CogdoBarrelRoomConsts.BarrelRoomFogColor)
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
def unload(self):
@ -61,9 +64,10 @@ class CogdoBarrelRoom:
if self.rewardUi:
self.rewardUi.destroy()
self.rewardUi = None
if self.fog:
render.setFogOff()
del self.fog
if hasattr(self, 'fog'):
if self.fog:
render.setFogOff()
del self.fog
taskMgr.remove(self.rewardUiTaskName)
taskMgr.remove(self.rewardCameraTaskName)
self._isLoaded = False
@ -75,8 +79,9 @@ class CogdoBarrelRoom:
def show(self):
if not self.cogdoBarrelsNode:
self.cogdoBarrelsNode = render.find('**/@@CogdoBarrels')
self.cogdoBarrelsNode.reparentTo(self.model)
self.cogdoBarrelsNode.unstash()
if not self.cogdoBarrelsNode.isEmpty():
self.cogdoBarrelsNode.reparentTo(self.model)
self.cogdoBarrelsNode.unstash()
self.defaultFar = base.camLens.getFar()
base.camLens.setFar(CogdoBarrelRoomConsts.BarrelRoomCameraFar)
self.showBattleAreaLight(True)
@ -85,7 +90,7 @@ class CogdoBarrelRoom:
def hide(self):
self.model.stash()
render.setFogOff()
#render.setFogOff()
if self.defaultFar is not None:
base.camLens.setFar(self.defaultFar)
return
@ -103,11 +108,11 @@ class CogdoBarrelRoom:
self.timer.stash()
def placeToonsAtEntrance(self, toons):
for i in xrange(len(toons)):
for i in range(len(toons)):
toons[i].setPosHpr(self.entranceNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i])
def placeToonsNearBattle(self, toons):
for i in xrange(len(toons)):
for i in range(len(toons)):
toons[i].setPosHpr(self.nearBattleNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i])
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)
return (track, trackName)
def showRewardUi(self, results, callback = None):
def showRewardUi(self, callback = None):
track, trackName = self.__rewardCamera()
if CogdoBarrelRoomConsts.ShowRewardUI:
self.rewardUi.setRewards(results)
self.rewardUi.setRewards()
self.rewardUi.unstash()
taskMgr.doMethodLater(CogdoBarrelRoomConsts.RewardUiTime, self.__rewardUiTimeout, self.rewardUiTaskName, extraArgs=[callback])
return (track, trackName)

View file

@ -1,9 +1,9 @@
from pandac.PandaModules import *
CollectionTime = 30
BarrelRoomIntroTimeout = 15.0
BarrelRoomIntroTimeout = 12.0
RewardUiTime = 5.0
EndWithAllBarrelsCollected = False
ShowRewardUI = False
EndWithAllBarrelsCollected = True
ShowRewardUI = True
AllBarrelsCollectedTime = 5.0
ToonUp = (2, 4)
BarrelProps = [{'pos': (-10, -66, 0),
@ -26,7 +26,7 @@ BarrelProps = [{'pos': (-10, -66, 0),
'heading': 141},
{'pos': (10, -14.4, 0),
'heading': 2}]
StomperProps = [{'path': '**/stomper_GRP_01/stomper_cylinder_01',
StomperProps = [{'path': '**/stomper_GRP_01/stomper_cylinder_034',
'motion': 'up'},
{'path': '**/stomper_GRP_02/stomper_cylinder_034',
'motion': 'down'},
@ -55,6 +55,7 @@ StomperSound = 'phase_9/audio/sfx/CHQ_FACT_stomper_raise.ogg'
MaxToons = 4
BarrelRoomModel = 'phase_5/models/cogdominium/tt_m_ara_cbr_barrelRoom'
BarrelRoomModelPos = (0, 0, 0)
BarrelRoomElevatorInPath = '**/elevatorIn_locator'
BarrelRoomElevatorOutPath = '**/elevatorOut_locator'
BarrelRoomPlayerSpawnPoints = [(-4,
0,
@ -83,6 +84,7 @@ BarrelRoomPlayerSpawnPoints = [(-4,
BarrelRoomCameraFar = 525.0
BarrelRoomFogColor = Vec4(0.65, 0.21, 0, 1.0)
BarrelRoomFogLinearRange = (0.0, 800.0)
BarrelPathName = 'CogdoBarrel_'
BarrelModel = 'phase_5/models/cogdominium/tt_m_ara_cbr_laughBarrel'
BarrelModelScale = 1.0
BarrelCollParams = (0,
@ -91,6 +93,8 @@ BarrelCollParams = (0,
2.0)
BarrelBumpSound = 'phase_4/audio/sfx/Golf_Hit_Barrier_2.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)
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 direct.gui.DirectGui import *
from toontown.toon import DistributedToon
from toontown.toonbase import ToontownGlobals, TTLocalizer
from toontown.cogdominium import CogdoBarrelRoomConsts
class CogdoBarrelRoomRewardPanel(DirectFrame):
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.avNameLabel = DirectLabel(parent=self, relief=None, pos=(0, 0, 0.3), text='Toon Ups', text_scale=0.08)
self.rewardLines = []
@ -22,15 +23,15 @@ class CogdoBarrelRoomRewardPanel(DirectFrame):
return
def setRewards(self, results):
for p in xrange(len(results[0])):
doId = results[0][p]
laff = results[1][p]
if doId > 0 and doId in base.cr.doId2do:
toon = base.cr.doId2do[doId]
self.rewardLines[p]['name'].setProp('text', toon.getName())
self.rewardLines[p]['laff'].setProp('text', str(laff))
def setRewards(self):
RewardLineIndex = 0
for doId in base.cr.doId2do:
toon = base.cr.doId2do.get(doId)
if isinstance(toon, DistributedToon.DistributedToon):
self.rewardLines[RewardLineIndex]['name'].setProp('text', toon.getName())
self.rewardLines[RewardLineIndex]['laff'].setProp('text', '%s/%s' % (str(toon.hp), str(toon.maxHp)))
if doId == base.localAvatar.getDoId():
self.rewardLines[p]['frame'].setProp('relief', DGG.RIDGE)
self.rewardLines[p]['frame'].setProp('borderWidth', (0.01, 0.01))
self.rewardLines[p]['frame'].setProp('frameColor', (1, 1, 1, 0.5))
self.rewardLines[RewardLineIndex]['frame'].setProp('relief', DGG.RIDGE)
self.rewardLines[RewardLineIndex]['frame'].setProp('borderWidth', (0.01, 0.01))
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 otp.level.EntityStateVarSet import EntityStateVarSet
from CogdoUtil import VariableContainer
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)
CogSettings = EntityStateVarSet(CogdoCraneCogSettings)
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.suit import Suit, SuitDNA
from toontown.toon import Toon, ToonHead, ToonDNA
from DistributedCogdoInterior import *
from CogdoUtil import CogdoGameMovie
import CogdoUtil
@ -82,17 +83,17 @@ class CogdoElevatorMovie(CogdoGameMovie):
self._toonDialogueSfx = loader.loadSfx('phase_3.5/audio/dial/AV_dog_long.ogg')
self._camHelperNode = NodePath('CamHelperNode')
self._camHelperNode.reparentTo(render)
dialogue = TTLocalizer.CogdoElevatorRewardLaff
dialogue = TTLocalizer.CogdoMazeGameElevatorRewardLaff
def start():
self.frame.show()
base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0)
base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0)
def end():
self._dialogueLabel.reparentTo(hidden)
self.toonHead.reparentTo(hidden)
self.frame.hide()
base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1)
base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1)
self._stopUpdateTask()
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():
self.frame.show()
base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0)
base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0)
def showShopOwner():
self._setCamTarget(self._shopOwner, -10, offset=Point3(0, 0, 5))
@ -100,7 +100,7 @@ class CogdoExecutiveSuiteIntro(CogdoGameMovie):
self._dialogueLabel.reparentTo(hidden)
self.toonHead.reparentTo(hidden)
self.frame.hide()
base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1)
base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1)
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))

View file

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

View file

@ -160,13 +160,7 @@ class CogdoFlyingGame(DirectObject):
self.acceptOnce(CogdoFlyingLocalPlayer.RanOutOfTimeEventName, self.handleLocalPlayerRanOutOfTime)
self.__startUpdateTask()
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:
eagle.gameStart(self.distGame.getStartTime())
@ -299,20 +293,22 @@ class CogdoFlyingGame(DirectObject):
if gatherable.type in [Globals.Level.GatherableTypes.InvulPowerup]:
if player.toon.isLocal():
self.audioMgr.playMusic('invul')
taskMgr.doMethodLater(30, lambda task: self.debuffPowerup(toonId, gatherable.type, elapsedTime), 'gatherable-timeout')
else:
self.notify.warning('Trying to pickup gatherable nonetype:%s' % pickupNum)
return
def debuffPowerup(self, toonId, pickupType, elapsedTime):
self.notify.debugCall()
player = self.toonId2Player[toonId]
if player.isBuffActive(pickupType):
if pickupType in [Globals.Level.GatherableTypes.InvulPowerup]:
if self.guiMgr.isTimeRunningOut():
self.audioMgr.playMusic('timeRunningOut')
else:
self.audioMgr.playMusic('normal')
player.handleDebuffPowerup(pickupType, elapsedTime)
if toonId in self.toonId2Player:
player = self.toonId2Player[toonId]
if player.isBuffActive(pickupType):
if pickupType in [Globals.Level.GatherableTypes.InvulPowerup]:
if self.guiMgr.isTimeRunningOut():
self.audioMgr.playMusic('timeRunningOut')
else:
self.audioMgr.playMusic('normal')
player.handleDebuffPowerup(pickupType, elapsedTime)
def handleLocalToonEnterLegalEagle(self, eagle, collEntry):
if not self.localPlayer.isEnemyHitting() and not self.localPlayer.isInvulnerable():

View file

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

View file

@ -57,7 +57,10 @@ class CogdoFlyingProgressGui(DirectFrame):
return
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):
for toon, marker in self._toonMarkers.items():
@ -144,13 +147,13 @@ class CogdoFlyingFuelGui(DirectFrame):
return
numBlades = fuelState - 1
if len(self.activeBlades) != numBlades:
for i in xrange(len(self.activeBlades)):
for i in range(len(self.activeBlades)):
blade = self.activeBlades.pop()
blade.stash()
if numBlades > len(self.blades):
numBlades = len(self.blades)
for i in xrange(numBlades):
for i in range(numBlades):
blade = self.blades[i]
self.activeBlades.append(blade)
blade.unstash()

View file

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

View file

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

View file

@ -7,7 +7,7 @@ import CogdoUtil
import CogdoFlyingGameGlobals as Globals
from CogdoFlyingLevelQuadrant import CogdoFlyingLevelQuadrant
from CogdoFlyingObjects import CogdoFlyingGatherableFactory, CogdoFlyingPlatform, CogdoFlyingLevelFog
from CogdoFlyingObstacles import CogdoFlyingObtacleFactory
from CogdoFlyingObstacles import CogdoFlyingObstacleFactory
from CogdoGameExit import CogdoGameExit
from otp.otpbase import OTPGlobals
@ -51,7 +51,7 @@ class CogdoFlyingLevel(DirectObject):
self.forwardLimit = self.quadLengthUnits * 20
self._frameModel.flattenStrong()
self.gatherableFactory = CogdoFlyingGatherableFactory()
self.obstacleFactory = CogdoFlyingObtacleFactory()
self.obstacleFactory = CogdoFlyingObstacleFactory()
return
def getExit(self):
@ -159,7 +159,7 @@ class CogdoFlyingLevel(DirectObject):
if quadNum >= 0:
if quadNum > 0:
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.visibleQuadIndices.append(i)
if i == 0:
@ -168,7 +168,7 @@ class CogdoFlyingLevel(DirectObject):
self.endPlatform.onstage()
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()
if i == 0:
self.startPlatform.offstage()
@ -193,6 +193,7 @@ class CogdoFlyingLevelFactory:
self.quadVisibiltyAhead = quadVisibilityAhead
self.quadVisibiltyBehind = quadVisibiltyBehind
self._rng = rng or RandomNumGen(1)
self.isOrg = self._rng.randint(0, 1)
self._level = None
return
@ -200,7 +201,8 @@ class CogdoFlyingLevelFactory:
levelNode = NodePath('level')
frameModel = CogdoUtil.loadFlyingModel('level')
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'):
fan.flattenStrong()
@ -211,7 +213,8 @@ class CogdoFlyingLevelFactory:
frameModel.find('**/wallL').setBin('opaque', 2)
frameModel.find('**/fogTranslucent_top').setBin('fixed', 2)
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)
if Globals.Dev.WantTempLevel:
quads = Globals.Dev.DevQuadsOrder
@ -223,7 +226,8 @@ class CogdoFlyingLevelFactory:
quads.append(quadList[self._rng.randint(0, len(quadList) - 1)])
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)
for np in quadModel.findAllMatches('**/*lightCone*'):
CogdoUtil.initializeLightCone(np, 'fixed', 3)
@ -240,4 +244,7 @@ class CogdoFlyingLevelFactory:
def createLevelFog(self):
if self._level is None:
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*'):
np.wrtReparentTo(self._model)
for np in self._model.find('**/static').getChildren():
np.wrtReparentTo(self._model)
if not self._model.find('**/static').isEmpty():
for np in self._model.find('**/static').getChildren():
np.wrtReparentTo(self._model)
self._model.flattenMedium()
@ -138,8 +139,6 @@ class CogdoFlyingLevelQuadrant:
def generatePowerUps():
for powerupType, locName in Globals.Level.PowerupType2Loc.iteritems():
if powerupType == Globals.Level.GatherableTypes.LaffPowerup and Globals.Level.IgnoreLaffPowerups:
continue
gatherables = gatherableModel.findAllMatches('**/%s' % locName)
for gatherable in gatherables:
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 = clamp(power, min, max)
blowVec *= power
fanVelocity = self.fanIndex2ToonVelocity[fan.index]
fanVelocity += blowVec
if fan.index in self.fanIndex2ToonVelocity:
fanVelocity = self.fanIndex2ToonVelocity[fan.index]
fanVelocity += blowVec
removeList = []
for fan in self.fansStillHavingEffect:
if fan not in self.activeFans:
blowVec = fan.getBlowDirection()
blowVec *= Globals.Gameplay.ToonDeceleration['fan'] * dt
fanVelocity = Vec3(self.fanIndex2ToonVelocity[fan.index])
lastLen = fanVelocity.length()
fanVelocity -= blowVec
if fanVelocity.length() > lastLen:
removeList.append(fan)
else:
self.fanIndex2ToonVelocity[fan.index] = fanVelocity
if fan.index in self.fanIndex2ToonVelocity:
fanVelocity = Vec3(self.fanIndex2ToonVelocity[fan.index])
lastLen = fanVelocity.length()
fanVelocity -= blowVec
if fanVelocity.length() > lastLen:
removeList.append(fan)
else:
self.fanIndex2ToonVelocity[fan.index] = fanVelocity
for fan in removeList:
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)
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']
maxVal = Globals.Gameplay.ToonVelMax['fan']
@ -1073,10 +1077,9 @@ class CogdoFlyingLocalPlayer(CogdoFlyingPlayer):
elif gatherable.type == Globals.Level.GatherableTypes.Propeller:
self.handleEnterPropeller(gatherable)
elif gatherable.type == Globals.Level.GatherableTypes.LaffPowerup:
self._getLaffSfx.play()
self.handleEnterLaffPowerup(gatherable)
elif gatherable.type == Globals.Level.GatherableTypes.InvulPowerup:
self._getRedTapeSfx.play()
messenger.send(CogdoFlyingGuiManager.InvulnerableEventName)
self.handleEnterInvulPowerup(gatherable)
def handleEnterMemo(self, gatherable):
self.score += 1
@ -1097,3 +1100,10 @@ class CogdoFlyingLocalPlayer(CogdoFlyingPlayer):
self._guiMgr.update()
self._refuelSfx.play()
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)
if Globals.Level.AddSparkleToPowerups:
self.f = self.find('**/particleEffect_sparkles')
self.f.hide()
if not self.f.isEmpty():
self.f.hide()
def pickUp(self, toon, elapsedSeconds = 0.0):
if self.wasPickedUpByToon(toon) == True:
@ -339,6 +340,7 @@ class CogdoFlyingLevelFog:
def __init__(self, level, color = Globals.Level.FogColor):
self._level = level
self.color = color
self.defaultFar = None
fogDistance = self._level.quadLengthUnits * max(1, self._level.quadVisibiltyAhead * 0.2)
self.fog = Fog('RenderFog')
self.fog.setColor(self.color)
@ -346,11 +348,16 @@ class CogdoFlyingLevelFog:
self._visible = False
self._clearColor = Vec4(base.win.getClearColor())
self._clearColor.setW(1.0)
self.defaultFar = base.camLens.getFar()
base.camLens.setFar(Globals.Camera.GameCameraFar)
base.setBackgroundColor(self.color)
def destroy(self):
self.setVisible(False)
if hasattr(self, 'fog'):
del self.fog
if self.defaultFar is not None:
base.camLens.setFar(self.defaultFar)
def isVisible(self):
return self._visible

View file

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

View file

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

View file

@ -102,10 +102,7 @@ class CogdoMemo(CogdoGameGatherable):
def __init__(self, serialNum, model = None, pitch = 0, triggerRadius = 1.0, spinRate = 60):
if model is None:
node = CogdoUtil.loadModel('memo', 'shared')
model = node.find('**/memo')
model.detachNode()
node.removeNode()
model = CogdoUtil.loadModel('joke', 'shared')
model.setP(pitch)
self._spinRate = spinRate
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.townBattle = TownBattle.TownBattle('town-battle-done')
self.townBattle.load()
for i in xrange(1, 3):
for i in range(1, 3):
Suit.loadSuits(i)
def unload(self):
@ -90,7 +90,7 @@ class CogdoInterior(Place.Place):
self.townBattle.unload()
self.townBattle.cleanup()
del self.townBattle
for i in xrange(1, 3):
for i in range(1, 3):
Suit.unloadSuits(i)
def setState(self, state, battleEvent = None):

View file

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

View file

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

View file

@ -188,7 +188,7 @@ class CogdoMazeBossGui(DirectFrame):
self._openDoor.stash()
spacingX = codeFrameWidth + 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.reparentTo(self)
marker.setPos(bossCard, startX + spacingX * i, 0, 0)

View file

@ -123,7 +123,7 @@ class CogdoMazeGameIntro(CogdoGameMovie):
def end():
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()
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._timer.setTime(duration)
self._timer.countdown(duration, timerExpiredCallback)
self._timer.show()
self._presentTimerIval = ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._timer, 'present_timer', startPos=(0, 0, 0.35)))
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)
FSM.__init__(self, 'CogdoMazeSuit')
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.hp = data['hp']
self.type = cogdoSuitType
@ -228,8 +228,8 @@ class CogdoMazeBossSuit(CogdoMazeSuit):
def pickRandomValidSpot(self, r = 5):
validSpots = []
for x in xrange(self.TX - r, self.TX + r):
for y in xrange(self.TY - r, self.TY + r):
for x in range(self.TX - r, self.TX + r):
for y in range(self.TY - r, self.TY + r):
if self.maze.isWalkable(x, y):
validSpots.append([x, y])

View file

@ -9,9 +9,9 @@ MEMOICON_SCALE = 0.2
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)
self._initModel()
self._initModel(type)
self.hide()
return
@ -26,9 +26,9 @@ class CogdoMemoGui(DirectFrame):
def posNextToLaffMeter(self):
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._memoIcon = CogdoUtil.loadModel('memo_card', game='shared', group='gui')
self._memoIcon = CogdoUtil.loadModel(type, game='shared', group='gui')
self._memoIcon.reparentTo(self)
self._memoIcon.setScale(MEMOICON_SCALE)
return

View file

@ -69,7 +69,7 @@ class CogdoGameMovie:
textNode.setFont(ToontownGlobals.getToonFont())
self._dialogueLabel = aspect2d.attachNewNode(textNode)
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)
def unload(self):
@ -120,9 +120,9 @@ def rotateTable(table, angle):
t = []
width = len(table[0])
height = len(table)
for j in xrange(width):
for j in range(width):
row = []
for i in xrange(height):
for i in range(height):
row.append(table[height - 1 - i][j])
t.append(row)
@ -137,9 +137,9 @@ def rotateTable(table, angle):
t = []
width = len(table[0])
height = len(table)
for j in xrange(width):
for j in range(width):
row = []
for i in xrange(height):
for i in range(height):
row.append(table[i][width - 1 - j])
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.fsm import FSM
from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import *
from direct.showbase import PythonUtil
from direct.distributed import DistributedObject
from direct.showutil import Rope
from direct.showbase import PythonUtil
from direct.task import Task
from pandac.PandaModules import *
import random
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPGlobals
from toontown.cogdominium import CogdoCraneGameConsts as GameConsts
from toontown.nametag import NametagGlobals
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
import random
class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
notify = DirectNotifyGlobal.directNotify.newCategory('DistCogdoCrane')
@ -235,7 +232,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.physicsActivated = 0
def __straightenCable(self):
for linkNum in xrange(self.numLinks):
for linkNum in range(self.numLinks):
an, anp, cnp = self.activeLinks[linkNum]
an.getPhysicsObject().setVelocity(0, 0, 0)
z = float(linkNum + 1) / float(self.numLinks) * self.cableLength
@ -258,7 +255,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.links = []
self.links.append((self.topLink, Point3(0, 0, 0)))
anchor = self.topLink
for linkNum in xrange(self.numLinks):
for linkNum in range(self.numLinks):
anchor = self.__makeLink(anchor, linkNum)
self.collisions.stash()
@ -401,7 +398,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
taskMgr.add(self.__watchControls, 'watchCraneControls')
taskMgr.doMethodLater(5, self.__displayCraneAdvice, self.craneAdviceName)
taskMgr.doMethodLater(10, self.__displayMagnetAdvice, self.magnetAdviceName)
NametagGlobals.setForceOnscreenChat(True)
NametagGlobals.setOnscreenChatForced(1)
self.arrowVert = 0
self.arrowHorz = 0
@ -418,7 +415,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.ignore('InputState-turnRight')
self.arrowVert = 0
self.arrowHorz = 0
NametagGlobals.setForceOnscreenChat(False)
NametagGlobals.setOnscreenChatForced(0)
taskMgr.remove('watchCraneControls')
self.__setMoveSound(None)
return
@ -554,7 +551,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
def startFlicker(self):
self.magnetSoundInterval.start()
self.lightning = []
for i in xrange(4):
for i in range(4):
t = float(i) / 3.0 - 0.5
l = self.craneGame.lightning.copyTo(self.gripper)
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.setHpr(self.arm.getHpr())
self.armSmoother.setPhonyTimestamp()
for linkNum in xrange(self.numLinks):
for linkNum in range(self.numLinks):
smoother = self.linkSmoothers[linkNum]
an, anp, cnp = self.activeLinks[linkNum]
smoother.clearPositions(0)
@ -692,7 +689,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
def doSmoothTask(self, task):
self.armSmoother.computeAndApplySmoothPosHpr(self.crane, self.arm)
for linkNum in xrange(self.numLinks):
for linkNum in range(self.numLinks):
smoother = self.linkSmoothers[linkNum]
anp = self.activeLinks[linkNum][1]
smoother.computeAndApplySmoothPos(anp)
@ -719,7 +716,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.armSmoother.applySmoothPos(self.crane)
self.armSmoother.applySmoothHpr(self.arm)
self.armSmoother.clearPositions(1)
for linkNum in xrange(self.numLinks):
for linkNum in range(self.numLinks):
smoother = self.linkSmoothers[linkNum]
an, anp, cnp = self.activeLinks[linkNum]
if smoother.getLatestPosition():
@ -735,7 +732,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
self.armSmoother.setH(h)
self.armSmoother.setTimestamp(local)
self.armSmoother.markPosition()
for linkNum in xrange(self.numLinks):
for linkNum in range(self.numLinks):
smoother = self.linkSmoothers[linkNum]
lp = links[linkNum]
smoother.setPos(*lp)
@ -749,7 +746,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
def d_sendCablePos(self):
timestamp = globalClockDelta.getFrameNetworkTime()
links = []
for linkNum in xrange(self.numLinks):
for linkNum in range(self.numLinks):
an, anp, cnp = self.activeLinks[linkNum]
p = anp.getPos()
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))
break
newCollideMask = newCollideMask | cn.getIntoCollideMask()
for i in xrange(cn.getNumSolids()):
for i in range(cn.getNumSolids()):
solid = cn.getSolid(i)
if isinstance(solid, PM.CollisionPolygon):
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.DistCogdoCraneAI import DistCogdoCraneAI
from toontown.cogdominium import CogdoCraneGameConsts as GameConsts
from toontown.cogdominium.CogdoCraneGameBase import CogdoCraneGameBase
class DistCogdoCraneGameAI(DistCogdoLevelGameAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoCraneGameAI")
class DistCogdoCraneGameAI(DistCogdoLevelGameAI, CogdoCraneGameBase):
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()
impact = vel[1]
if impact >= self.getMinImpact():
print 'hit! %s' % impact
self.hitBossSoundInterval.start()
self.doHitBoss(impact)
else:
self.touchedBossSoundInterval.start()
print '--not hard enough: %s' % impact
def doHitBoss(self, impact):
self.d_hitBoss(impact)

View file

@ -10,8 +10,6 @@ class DistCogdoFlyingGame(DistCogdoGame):
def __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)
def delete(self):

View file

@ -1,42 +1,129 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import *
from toontown.cogdominium.DistCogdoGameAI import DistCogdoGameAI
import CogdoFlyingGameGlobals as Globals
class DistCogdoFlyingGameAI(DistCogdoGameAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoFlyingGameAI")
def requestAction(self, todo0, todo1):
pass
def __init__(self, air):
DistCogdoGameAI.__init__(self, air)
self.completed = []
self.eagles = {}
self.totalMemos = 0
def requestPickUp(self, todo0, todo1):
pass
def requestAction(self, action, data):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
def pickUp(self, todo0, todo1, todo2):
pass
if action == Globals.AI.GameActions.LandOnWinPlatform:
self.completed.append(avId)
for toon in self.toons:
if toon not in self.completed:
return
def debuffPowerup(self, todo0, todo1, todo2):
pass
self.gameDone()
def doAction(self, todo0, todo1):
pass
elif action == Globals.AI.GameActions.BladeLost:
self.sendUpdate("toonBladeLost", [avId])
def eagleExitCooldown(self, todo0, todo1):
pass
elif action == Globals.AI.GameActions.SetBlades:
self.sendUpdate("toonSetBlades", [avId, data])
def toonSetAsEagleTarget(self, todo0, todo1, todo2):
pass
elif action == Globals.AI.GameActions.Died:
damage = Globals.AI.SafezoneId2DeathDamage[self.getSafezoneId()]
self.__damage(av, damage)
self.sendUpdate("toonDied", [avId, globalClockDelta.getRealNetworkTime()])
def toonClearAsEagleTarget(self, todo0, todo1, todo2):
pass
elif action == Globals.AI.GameActions.Spawn:
self.sendUpdate("toonSpawn", [avId, globalClockDelta.getRealNetworkTime()])
def toonDied(self, todo0, todo1):
pass
elif action == Globals.AI.GameActions.RequestEnterEagleInterest:
if not self.eagles.get(data):
self.eagles[data] = avId
self.sendUpdate("toonSetAsEagleTarget", [avId, data, globalClockDelta.getRealNetworkTime()])
def toonSpawn(self, todo0, todo1):
pass
elif action == Globals.AI.GameActions.RequestExitEagleInterest:
if self.eagles.get(data) == avId:
self.eagles[data] = 0
self.sendUpdate("toonClearAsEagleTarget", [avId, data, globalClockDelta.getRealNetworkTime()])
def toonSetBlades(self, todo0, todo1):
pass
elif action == Globals.AI.GameActions.HitLegalEagle:
damage = Globals.AI.SafezoneId2LegalEagleDamage[self.getSafezoneId()]
self.__damage(av, damage)
def toonBladeLost(self, todo0):
pass
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 requestPickUp(self, pickupNum, pickupType):
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 handleStart(self):
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
from otp.ai.MagicWordGlobal import *
@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.minigame import MinigameGlobals
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):
notify = directNotify.newCategory('DistCogdoGame')
@ -19,6 +19,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
def __init__(self, cr):
DistributedObject.__init__(self, cr)
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.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')
@ -71,7 +72,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
return
def getToon(self, toonId):
if toonId in self.cr.doId2do:
if self.cr.doId2do.has_key(toonId):
return self.cr.doId2do[toonId]
else:
return None
@ -88,8 +89,8 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
def announceGenerate(self):
DistributedObject.announceGenerate(self)
self._requestInterior()
self.loadFSM.request('Loaded')
self._requestInterior()
self.notify.info('difficulty: %s, safezoneId: %s' % (self.getDifficulty(), self.getSafezoneId()))
def _requestInterior(self):
@ -116,6 +117,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
def disable(self):
base.cogdoGame = None
self.cr.cogdoGame = None
self.fsm.requestFinalState()
self.loadFSM.requestFinalState()
self.fsm = None
@ -230,7 +232,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
def enterGame(self):
if SCHELLGAMES_DEV:
self.acceptOnce('escape', messenger.send, ['magicWord', ['~endgame']])
self.acceptOnce('escape', messenger.send, ['magicWord', ['~endMaze']])
def exitGame(self):
if SCHELLGAMES_DEV:

View file

@ -1,36 +1,108 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import *
import CogdoGameConsts
class DistCogdoGameAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoGameAI")
delayIntro = .1
def setInteriorId(self, todo0):
pass
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
air.cogdoGame = self
self.interiorId = 0
self.exteriorZone = 0
self.difficultyOverrides = [2147483647, -1]
self.requests = {}
self.toons = []
def setExteriorZone(self, todo0):
pass
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
def setDifficultyOverrides(self, todo0, todo1):
pass
self.finishEvent = self.uniqueName('CogdoMazeGameDone')
self.gameOverEvent = self.uniqueName('CogdoMazeGameLose')
def setVisible(self):
pass
self.resetRequests()
def setIntroStart(self):
pass
def d_startIntro(self):
self.sendUpdate('setVisible', [])
taskMgr.doMethodLater(self.delayIntro, self.__startIntro, self.taskName('CogdoStartIntro'))
def setToonSad(self, todo0):
pass
def getInterior(self):
return self.air.doId2do.get(self.interiorId)
def setToonDisconnect(self, todo0):
pass
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):
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
def setGameStart(self, todo0):
pass
def setInteriorId(self, id):
self.interiorId = id
def setGameFinish(self, todo0):
pass
def getInteriorId(self):
return self.interiorId
def setExteriorZone(self, zone):
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)
self.game = CogdoMazeGame(self)
self._numSuits = (0, 0, 0)
if __debug__ and base.config.GetBool('schellgames-dev', True):
self.accept('onCodeReload', self.__sgOnCodeReload)
def delete(self):
del self.randomNumGen
@ -45,7 +43,7 @@ class DistCogdoMazeGame(DistCogdoGame, DistCogdoMazeGameBase):
bossCode = None
if self._numSuits[0] > 0:
bossCode = ''
for u in xrange(self._numSuits[0]):
for u in range(self._numSuits[0]):
bossCode += '%X' % self.randomNumGen.randint(0, 15)
self.game.load(mazeFactory, self._numSuits, bossCode)
@ -230,3 +228,12 @@ class DistCogdoMazeGame(DistCogdoGame, DistCogdoMazeGameBase):
def setToonDisconnect(self, toonId):
DistCogdoGame.setToonDisconnect(self, 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 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):
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)
self.numSuits = (0,0,0)
self.timer = Timer.Timer()
self.doorRevealed = False
self.toonsInDoor = []
self.bosses = {}
self.fastMinions = {}
self.slowMinions = {}
self.suitTypes = [self.bosses, self.fastMinions, self.slowMinions]
self.numJokes = {}
def doAction(self, todo0, todo1, todo2):
pass
def announceGenerate(self):
DistCogdoGameAI.announceGenerate(self)
self.setupSuitsAI()
def setNumSuits(self, todo0):
pass
def setupSuitsAI(self):
bossHp = CogdoMazeGameGlobals.SuitData[0]['hp']
fastMiniHp = CogdoMazeGameGlobals.SuitData[1]['hp']
slowMiniHp = CogdoMazeGameGlobals.SuitData[2]['hp']
def requestUseGag(self, todo0, todo1, todo2, todo3):
pass
serialNum = 0
for i in range(self.numSuits[0]):
self.bosses[serialNum] = bossHp
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 toonUsedGag(self, todo0, todo1, todo2, todo3, todo4):
pass
def setNumSuits(self, num):
self.numSuits = num
def requestSuitHitByGag(self, todo0, todo1):
pass
def getNumSuits(self):
return self.numSuits
def suitHitByGag(self, todo0, todo1, todo2):
pass
def requestUseGag(self, x, y, h, timestamp):
avId = self.air.getAvatarIdFromSender()
self.sendUpdate('toonUsedGag', [avId, x, y, h, globalClockDelta.getRealNetworkTime()])
def requestHitBySuit(self, todo0, todo1, todo2):
pass
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 toonHitBySuit(self, todo0, todo1, todo2, todo3):
pass
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):
pass
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if av:
lostHp = CogdoMazeGameGlobals.DropDamage
av.takeDamage(lostHp)
self.sendUpdate('toonHitByDrop', [avId])
def toonHitByDrop(self, todo0):
pass
def requestPickUp(self, pickupNum):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if av:
now = globalClockDelta.getRealNetworkTime()
def requestPickUp(self, todo0):
pass
if avId in self.numJokes:
self.numJokes[avId] += 1
def pickUp(self, todo0, todo1, todo2):
pass
else:
self.numJokes[avId] = 1
def requestGag(self, todo0):
pass
self.sendUpdate('pickUp', [avId, pickupNum, now])
def hasGag(self, todo0, todo1):
pass
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()
from otp.ai.MagicWordGlobal import *
@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 toontown.toonbase import ToontownGlobals, ToontownIntervals
from toontown.cogdominium import CogdoBarrelRoomConsts
from toontown.cogdominium import CogdoBarrelRoom
import random
class DistributedCogdoBarrel(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogdoBarrel')
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
self.barrelRoom = CogdoBarrelRoom.CogdoBarrelRoom()
self.index = None
self.state = None
self.model = None
@ -17,6 +20,7 @@ class DistributedCogdoBarrel(DistributedObject.DistributedObject):
self.collNodePath = None
self.availableTex = None
self.usedTex = None
self.brLaff = 0
return
def generate(self):
@ -32,7 +36,6 @@ class DistributedCogdoBarrel(DistributedObject.DistributedObject):
cogdoBarrelsNode = render.find('@@CogdoBarrels')
if not cogdoBarrelsNode or cogdoBarrelsNode.isEmpty():
cogdoBarrelsNode = render.attachNewNode('CogdoBarrels')
cogdoBarrelsNode.stash()
self.model.reparentTo(cogdoBarrelsNode)
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')
@ -110,13 +113,18 @@ class DistributedCogdoBarrel(DistributedObject.DistributedObject):
self.sendUpdate('requestGrab', [])
def setGrab(self, avId):
toonup = CogdoBarrelRoomConsts.ToonUp
if avId == base.localAvatar.doId:
ToontownIntervals.start(ToontownIntervals.getPulseIval(self.model, self.__pulseIvalName(), 1.15, duration=0.2))
self.setState(CogdoBarrelRoomConsts.StateUsed)
self.brLaff = random.randint(toonup[0], toonup[1])
def setReject(self):
pass
def getBarrelLaff(self):
return self.brLaff
def __pulseIvalName(self):
return 'DistributedCogdoBarrelPulse%s' % self.doId

View file

@ -1,21 +1,36 @@
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")
def __init__(self, air, index):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.index = index
self.state = CogdoBarrelRoomConsts.StateAvailable
self.brLaff = 0
def requestGrab(self):
pass
toonup = CogdoBarrelRoomConsts.ToonUp
if self.state == CogdoBarrelRoomConsts.StateAvailable:
self.state = CogdoBarrelRoomConsts.StateUsed
self.sendUpdate("setState", [CogdoBarrelRoomConsts.StateUsed])
self.sendUpdate("setGrab", [self.air.getAvatarIdFromSender()])
self.brLaff = random.randint(toonup[0], toonup[1])
self.recieveToonUp()
def setIndex(self, todo0):
pass
def getIndex(self):
return self.index
def setState(self, todo0):
pass
def getState(self):
return self.state
def setGrab(self, todo0):
pass
def setReject(self):
pass
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.ElevatorConstants import *
from toontown.building.ElevatorUtils import *
from toontown.toonbase import ToontownGlobals
class DistributedCogdoElevatorExt(DistributedElevatorExt):
def setupElevator(self):
DistributedElevatorExt.setupElevator(self)
self.elevatorSphereNodePath.setY(-1.0)
self.elevatorSphereNodePath.setZ(1.5)
def __init__(self, cr):
DistributedElevatorExt.__init__(self, cr)
self.type = ELEVATOR_FIELD
def getElevatorModel(self):
return self.bldg.getCogdoElevatorNodePath()
def getBldgDoorOrigin(self):
return self.bldg.getCogdoDoorOrigin()
def _getDoorsClosedInfo(self):
return ('cogdoInterior', 'cogdoInterior')

View file

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

View file

@ -1,35 +1,38 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject
import random
from direct.interval.IntervalGlobal 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.distributed import DistributedObject
from direct.fsm import State
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.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.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 ToontownBattleGlobals
from toontown.toonbase import ToontownGlobals
from CogdoExecutiveSuiteMovies import CogdoExecutiveSuiteIntro
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',
'l': 'tt_m_ara_crg_paintingLegalEagle',
'm': 'tt_m_ara_crg_paintingMoverShaker',
'c': 'tt_m_ara_crg_paintingMoverShaker'}
from toontown.nametag.NametagGlobals import *
class DistributedCogdoInterior(DistributedObject.DistributedObject):
id = 0
cageHeights = [11.36, 0.01]
@ -73,7 +76,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
120,
12,
38]
self._wantBarrelRoom = config.GetBool('cogdo-want-barrel-room', 0)
self._wantBarrelRoom = config.GetBool('cogdo-want-barrel-room', 1)
self.barrelRoom = CogdoBarrelRoom.CogdoBarrelRoom()
self.brResults = [[], []]
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.elevatorMusic = base.loadMusic('phase_7/audio/bgm/tt_elevator.ogg')
self.fsm = ClassicFSM.ClassicFSM('DistributedCogdoInterior', [State.State('WaitForAllToonsInside', self.enterWaitForAllToonsInside, self.exitWaitForAllToonsInside, ['Elevator']),
State.State('Elevator', self.enterElevator, self.exitElevator, ['Game']),
State.State('Game', self.enterGame, self.exitGame, ['Resting', 'Failed', 'BattleIntro']),
State.State('Elevator', self.enterElevator, self.exitElevator, ['Game', 'BattleIntro', 'BarrelRoomIntro']),
State.State('Game', self.enterGame, self.exitGame, ['Resting', 'Failed', 'BattleIntro', 'BarrelRoomIntro', 'Elevator']),
State.State('BarrelRoomIntro', self.enterBarrelRoomIntro, self.exitBarrelRoomIntro, ['CollectBarrels', 'Off']),
State.State('CollectBarrels', self.enterCollectBarrels, self.exitCollectBarrels, ['BarrelRoomReward', 'Off']),
State.State('BarrelRoomReward', self.enterBarrelRoomReward, self.exitBarrelRoomReward, ['Battle',
@ -121,6 +124,9 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def setFOType(self, typeId):
self.FOType = chr(typeId)
def getFOType(self):
return self.FOType
def __uniqueName(self, name):
DistributedCogdoInterior.id += 1
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.leftDoorIn = self.elevatorModelIn.find('**/left_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.rightDoorOut = self.elevatorModelOut.find('**/right_door')
@ -152,12 +158,13 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def setElevatorLights(self, elevatorModel):
npc = elevatorModel.findAllMatches('**/floor_light_?;+s')
for i in xrange(npc.getNumPaths()):
for i in range(npc.getNumPaths()):
np = npc.getPath(i)
np.setDepthOffset(120)
floor = int(np.getName()[-1:]) - 1
if floor == self.currentFloor:
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):
np.setColor(LIGHT_ON_COLOR)
else:
@ -219,10 +226,10 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
return
def isBossFloor(self, floorNum):
if self.layout.hasBossBattle():
if self.layout.getBossBattleFloor() == floorNum:
return True
return False
if not self.layout.hasBossBattle():
return False
return (self.layout.getBossBattleFloor() + 0) == floorNum
def __cleanup(self):
self.toons = []
@ -259,7 +266,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.ignore(toon.uniqueName('disable'))
def __finishInterval(self, name):
if name in self.activeIntervals:
if self.activeIntervals.has_key(name):
interval = self.activeIntervals[name]
if interval.isPlaying():
interval.finish()
@ -308,7 +315,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.toons = []
for toonId in toonIds:
if toonId != 0:
if toonId in self.cr.doId2do:
if self.cr.doId2do.has_key(toonId):
toon = self.cr.doId2do[toonId]
toon.stopSmooth()
self.toons.append(toon)
@ -326,7 +333,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.suits = []
self.joiningReserves = []
for suitId in suitIds:
if suitId in self.cr.doId2do:
if self.cr.doId2do.has_key(suitId):
suit = self.cr.doId2do[suitId]
self.suits.append(suit)
suit.fsm.request('Battle')
@ -334,13 +341,20 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
suit.reparentTo(render)
if oldsuits.count(suit) == 0:
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:
self.notify.warning('setSuits() - no suit: %d' % suitId)
self.reserveSuits = []
for index in xrange(len(reserveIds)):
for index in range(len(reserveIds)):
suitId = reserveIds[index]
if suitId in self.cr.doId2do:
if self.cr.doId2do.has_key(suitId):
suit = self.cr.doId2do[suitId]
self.reserveSuits.append((suit, values[index]))
else:
@ -405,17 +419,26 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def __playElevator(self, ts, name, callback):
SuitHs = []
SuitPositions = []
if self.floorModel:
self.floorModel.removeNode()
self.floorModel = None
if self.cage:
self.cage = None
if self.currentFloor == 0:
SuitHs = self.BottomFloor_SuitHs
SuitPositions = self.BottomFloor_SuitPositions
if self.isBossFloor(self.currentFloor):
self.notify.info('__playElevator: currentFloor %s is boss' % self.currentFloor)
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')
pos = self.cage.getPos()
self.cagePos = []
@ -426,57 +449,79 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.cageDoor.wrtReparentTo(self.cage)
if 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)
loc = self.floorModel.find('**/loc_painting%d' % (i + 1))
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
SuitPositions = self.BossOffice_SuitPositions
self.__makeShopOwnerNpc()
else:
if self._wantBarrelRoom:
self.barrelRoom.load()
self.barrelRoom.hide()
SuitHs = self.Cubicle_SuitHs
SuitPositions = self.Cubicle_SuitPositions
if self.floorModel:
self.floorModel.reparentTo(render)
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)
elevOut = self.floorModel.find(CogdoGameConsts.PenthouseElevatorOutPath)
frame = self.elevatorModelOut.find('**/frame')
if not frame.isEmpty():
frame.hide()
frame = self.elevatorModelIn.find('**/frame')
if not frame.isEmpty():
frame.hide()
self.elevatorModelOut.reparentTo(elevOut)
self.elevatorModelOut.setY(0)
else:
elevIn = self.floorModel.find('**/elevator-in')
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)
y = elevOut.getY(render)
elevOut = elevOut.copyTo(render)
elevOut.setY(render, y - 0.75)
else:
floorModel = loader.loadModel('phase_7/models/modules/boss_suit_office')
elevIn = floorModel.find('**/elevator-in').copyTo(render)
elevOut = floorModel.find('**/elevator-out').copyTo(render)
floorModel.removeNode()
self.elevIn = elevIn
self.elevOut = elevOut
self._haveEntranceElevator.set(True)
for index in xrange(len(self.suits)):
self.suits[index].setPos(SuitPositions[index])
if len(self.suits) > 2:
self.suits[index].setH(SuitHs[index])
else:
self.suits[index].setH(170)
self.suits[index].loop('neutral')
for index in range(len(self.suits)):
if not self.suits[index].isEmpty():
self.suits[index].setPos(SuitPositions[index])
if len(self.suits) > 2:
self.suits[index].setH(SuitHs[index])
else:
self.suits[index].setH(170)
self.suits[index].loop('neutral')
for toon in self.toons:
toon.reparentTo(self.elevatorModelIn)
@ -500,7 +545,6 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
track.append(Func(callback))
track.start(ts)
self.activeIntervals[name] = track
return
def enterElevator(self, ts = 0):
if not self._CogdoGameRepeat:
@ -512,9 +556,10 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.elevatorModelOut.detachNode()
messenger.send('sellbotFieldOfficeChanged', [True])
else:
self._movie = CogdoElevatorMovie()
self._movie.load()
self._movie.play()
if self.FOType == 's':
self._movie = CogdoElevatorMovie()
self._movie.load()
self._movie.play()
self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone)
mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor)
base.localAvatar.inventory.setBattleCreditMultiplier(mult)
@ -531,12 +576,16 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
return None
def __setupBarrelRoom(self):
base.cr.playGame.getPlace().fsm.request('stopped')
self.currentFloor += 1
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.barrelRoom.show()
self.barrelRoom.placeToonsAtEntrance(self.toons)
self.setElevatorLights(self.elevatorModelOut)
def barrelRoomIntroDone(self):
self.sendUpdate('toonBarrelRoomIntroDone', [])
@ -550,6 +599,9 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self.accept(self.barrelRoomIntroDoneEvent, self.barrelRoomIntroDone)
self.activeIntervals[trackName] = self.barrelRoomIntroTrack
self.barrelRoomIntroTrack.start(ts)
self._movie = CogdoBarrelRoomIntro()
self._movie.load()
self._movie.play()
else:
self._showExitElevator()
@ -583,16 +635,13 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def __brRewardDone(self, task = None):
self.notify.info('Toon finished watching the barrel room reward.')
self.sendUpdate('toonBarrelRoomRewardDone', [])
def setBarrelRoomReward(self, avIds, laffs):
self.brResults = [avIds, laffs]
self.barrelRoom.setRewardResults(self.brResults)
self.fsm.request('Battle')
def enterBarrelRoomReward(self, ts = 0):
if self._wantBarrelRoom and not self.isBossFloor(self.currentFloor):
base.cr.playGame.getPlace().fsm.request('stopped')
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
track.start()
self.barrelRoom.placeToonsNearBattle(self.toons)
@ -680,7 +729,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
self._stashEntranceElevator.set(False)
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.cr.playGame.getPlace().fsm.request('walk')
@ -739,12 +788,12 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
pass
else:
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.setScale(1.2)
goldNode = render.find('**/gold_0' + str(player + 1))
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.setScale(1.2)
silverNode = render.find('**/silver_0' + str(floor * 4 + (player + 1)))
@ -755,7 +804,13 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
trackName = '__outroPenthouse-%d' % avatar.doId
track = Parallel(name=trackName)
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))))
self.activeIntervals[trackName] = track
self.accept('doneChatPage', self.__outroPenthouseChatDone)
@ -764,6 +819,6 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def __outroPenthouseChatDone(self, elapsed = None):
self.shopOwnerNpc.setChatAbsolute(TTLocalizer.CogdoExecutiveSuiteToonBye, CFSpeech)
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()
self.penthouseOutroChatDoneTrack = track

View file

@ -1,57 +1,559 @@
from direct.directnotify import DirectNotifyGlobal
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")
def setZoneId(self, todo0):
pass
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)
def setExtZoneId(self, todo0):
pass
self.shopOwnerNpcId = 0
def setDistBldgDoId(self, todo0):
pass
self.extZoneId, self.zoneId = exterior.getExteriorAndInteriorZoneId()
npcIdList = NPCToons.zone2NpcDict.get(self.zoneId, [])
def setNumFloors(self, todo0):
pass
if len(npcIdList) == 0:
self.notify.info('No NPC in taken cogdo at %s' % self.zoneId)
def setShopOwnerNpcId(self, todo0):
pass
else:
if len(npcIdList) > 1:
self.notify.warning('Multiple NPCs in taken cogdo at %s' % self.zoneId)
def setSOSNpcId(self, todo0):
pass
self.shopOwnerNpcId = npcIdList[0]
def setFOType(self, todo0):
pass
self.gameDone = 0
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
def setToons(self, todo0, todo1):
pass
self.FOType = exterior.track
def setSuits(self, todo0, todo1, todo2):
pass
self.gameFloor = 1
self.battleFloor = 2
self.barrelFloor = -1
def setState(self, todo0, todo1):
pass
if self.FOType == 'l':
self.battleFloor = 3
self.barrelFloor = 2
self.topFloor += 1
def setAvatarJoined(self):
pass
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 elevatorDone(self):
pass
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 setExtZoneId(self, extZoneId):
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, numFloors):
self.numFloors = numFloors
def getNumFloors(self):
return self.numFloors
def setShopOwnerNpcId(self, id):
self.shopOwnerNpcId = id
def getShopOwnerNpcId(self):
return self.shopOwnerNpcId
def setState(self, state, timestamp):
self.request(state)
def getState(self):
timestamp = globalClockDelta.getRealNetworkTime()
return [self.state, timestamp]
def b_setState(self, state):
self.setState(state, 0)
self.d_setState(state)
def d_setState(self, state):
timestamp = globalClockDelta.getRealNetworkTime()
self.sendUpdate('setState', [state, timestamp])
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 toonLeftBarrelRoom(self):
pass
def elevatorDone(self):
toonId = self.air.getAvatarIdFromSender()
if self.ignoreResponses == 1:
return None
def toonBarrelRoomIntroDone(self):
pass
elif self.toons.count(toonId) == 0:
self.notify.warning('elevatorDone() - toon not in toon list: %d' % toonId)
def setBarrelRoomReward(self, todo0, todo1):
pass
def enterWaitForAllToonsInside(self):
self.resetResponses()
def toonBarrelRoomRewardDone(self):
pass
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)
self.sendUpdate("setSOSNpcId", [self.sosNPC])
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 barrelReward(self):
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()
self.request('Elevator')
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 exitReservesJoining(self):
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):
def __init__(self, cogdoLayout, bldgLevel, bldgTrack, zone):
self._cogdoLayout = cogdoLayout
SuitPlannerInteriorAI.__init__(self, self._cogdoLayout.getNumGameFloors(), bldgLevel, bldgTrack, zone)
MAX_RESERVES = {
's': BASE_RESERVE * .9,
'm': BASE_RESERVE * 1.1,
'l': BASE_RESERVE * 1.25,
'c': BASE_RESERVE * 1.5,
}
def _genSuitInfos(self, numFloors, bldgLevel, bldgTrack):
SuitPlannerInteriorAI._genSuitInfos(self, self._cogdoLayout.getNumFloors(), bldgLevel, bldgTrack)
def filterReviveChance(track, revive):
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.ttuFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTU_FRIENDS_MANAGER, 'TTUFriendsManager')
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.furnitureManager = None

View file

@ -132,6 +132,19 @@ class FireworkShowMixin:
if self.fireworkShow and not self.fireworkShow.isEmpty():
self.fireworkShow.setColorScaleOff(0)
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):
hood = self.getHood()
@ -155,7 +168,13 @@ class FireworkShowMixin:
return None
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:
postShow.append(Wait(2.0))
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.oldClear = base.win.getClearColor()
base.win.setClearColor(Vec4(0.09, 0.55, 0.21, 1.0))
self.startGame()
def unload(self):
self.ignoreAll()
@ -100,6 +101,7 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.flowerSellBox.removeNode()
del self.flowerSellBox
self.flowerSellBox = None
GardenDropGame.GardenDropGame().endGame()
return
def announceGenerate(self):
@ -107,7 +109,7 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.accept('gardenGame', self.startGame)
def startGame(self):
self.game = GardenDropGame.GardenDropGame()
self.game = GardenDropGame.GardenDropGame().playGardenDrop()
def loadAirplane(self):
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:
self.cr.furnitureManager = self
if self.cr.objectManager == None:
import HouseDesign
self.cr.objectManager = HouseDesign.ObjectManager()
import houseDesign
self.cr.objectManager = houseDesign.ObjectManager()
return
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
class GameSprite:
colorRed = (1, 0, 0, 1)
colorBlue = (0, 0, 1, 1)
colorGreen = (0, 1, 0, 1)
colorYellow = (1, 1, 0, 1)
colorPurple = (1, 0, 1, 1)
colorGhostRed = (1, 0, 0, 0.5)
colorGhostBlue = (0, 0, 1, 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)
colorBlack = (0, 0, 0, 1.0)
colorBlack = (0.5, 0.5, 0.5, 1.0)
colorShadow = (0, 0, 0, 0.5)
def __init__(self, nodeObj, colorType = 0, foundation = 0):
@ -29,12 +45,20 @@ class GameSprite:
self.setColor(GameSprite.colorGhostBlue)
elif colorType == 2:
self.setColor(GameSprite.colorGhostGreen)
elif colorType == 3:
self.setColor(GameSprite.colorGhostYellow)
elif colorType == 4:
self.setColor(GameSprite.colorGhostPurple)
elif colorType == 0:
self.setColor(GameSprite.colorRed)
elif colorType == 1:
self.setColor(GameSprite.colorBlue)
elif colorType == 2:
self.setColor(GameSprite.colorGreen)
elif colorType == 3:
self.setColor(GameSprite.colorYellow)
elif colorType == 4:
self.setColor(GameSprite.colorPurple)
self.markedForDeath = 0
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]
PartyGridHeadingConverter = 15.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
ActivityInformationDict = {ActivityIds.PartyJukebox: {'cost': int(50 * PartyCostMultiplier),
'gridsize': (1, 1),

View file

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

View file

@ -4,7 +4,7 @@ class CheckersBoard:
def __init__(self):
self.squareList = []
for x in xrange(32):
for x in range(32):
self.squareList.append(CheckersTile(x))
self.squareList[0].setAdjacent([None,
@ -285,14 +285,14 @@ class CheckersBoard:
def getStates(self):
retList = []
for x in xrange(32):
for x in range(32):
retList.append(self.squareList[x].getState())
return retList
def setStates(self, squares):
y = 0
for x in xrange(32):
for x in range(32):
self.squareList[x].setState(squares[x])
def getJumps(self, squareNum):

View file

@ -4,7 +4,7 @@ class ChineseCheckersBoard:
def __init__(self):
self.squareList = []
for x in xrange(121):
for x in range(121):
self.squareList.append(CheckersSquare(x))
self.squareList[0].setAdjacent([None,
@ -767,14 +767,14 @@ class ChineseCheckersBoard:
def getStates(self):
retList = []
for x in xrange(121):
for x in range(121):
retList.append(self.squareList[x].getState())
return retList
def setStates(self, squares):
y = 0
for x in xrange(121):
for x in range(121):
self.squareList[x].setState(squares[x])

View file

@ -20,7 +20,7 @@ class ChineseTutorial(DirectFrame, FSM.FSM):
self.accept('stoppedAsleep', self.handleQuit)
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())
images = loader.loadModel('phase_6/models/golf/checker_tutorial.bam')
images = loader.loadModel('phase_6/models/golf/checker_tutorial')
images.setTransparency(1)
self.iPage1 = images.find('**/tutorialPage1*')
self.iPage1.reparentTo(aspect2d)
@ -138,7 +138,7 @@ class CheckersTutorial(DirectFrame, FSM.FSM):
self.accept('stoppedAsleep', self.handleQuit)
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())
images = loader.loadModel('phase_6/models/golf/regularchecker_tutorial.bam')
images = loader.loadModel('phase_6/models/golf/regularchecker_tutorial')
images.setTransparency(1)
self.iPage1 = images.find('**/tutorialPage1*')
self.iPage1.reparentTo(aspect2d)

View file

@ -568,6 +568,7 @@ class CodesTabPage(DirectFrame):
return
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')
instructionGui = cdrGui.find('**/tt_t_gui_sbk_cdrPresent')
flippyGui = cdrGui.find('**/tt_t_gui_sbk_cdrFlippy')
@ -633,8 +634,8 @@ class CodesTabPage(DirectFrame):
if input == '':
return
messenger.send('wakeup')
if hasattr(base, 'codeRedemptionMgr'):
base.codeRedemptionMgr.redeemCode(input, self.__getCodeResult)
if hasattr(base.cr, 'codeRedemptionMgr'):
base.cr.codeRedemptionMgr.redeemCode(input, self.__getCodeResult)
self.codeInput.enterText('')
self.__disableCodeEntry()
return
@ -646,36 +647,18 @@ class CodesTabPage(DirectFrame):
if result == 0:
self.resultPanel['image'] = self.resultPanelSuccessGui
self.resultPanel['text'] = TTLocalizer.CdrResultSuccess
elif result == 1 or result == 3:
elif result == 1:
self.resultPanel['image'] = self.resultPanelFailureGui
self.resultPanel['text'] = TTLocalizer.CdrResultInvalidCode
elif result == 2:
self.resultPanel['image'] = self.resultPanelFailureGui
self.resultPanel['text'] = TTLocalizer.CdrResultExpiredCode
elif result == 4:
elif result == 3:
self.resultPanel['image'] = self.resultPanelErrorGui
if awardMgrResult == 0:
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:
if awardMgrResult == 1:
self.resultPanel['text'] = TTLocalizer.CdrResultMailboxFull
elif awardMgrResult == 5 or awardMgrResult == 10:
self.resultPanel['text'] = TTLocalizer.CdrResultAlreadyInMailbox
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()
elif awardMgrResult == 2:
self.resultPanel['text'] = TTLocalizer.CdrResultAlreadyRedeemed
if result == 0:
self.successSfx.play()
else:

View file

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

View file

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

View file

@ -193,6 +193,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self._gmDisabled = False
self.promotionStatus = [0, 0, 0, 0]
self.buffs = []
self.redeemedCodes = []
def generate(self):
DistributedPlayerAI.DistributedPlayerAI.generate(self)
@ -4278,6 +4279,27 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.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])
def cheesyEffect(value, hood=0, expire=0):

View file

@ -543,3 +543,6 @@ class DistributedToonUD(DistributedObjectUD):
def setAchievements(self, achievements):
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_saveBuilding4.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),
(1, 1),
(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.972549, 0.094117, 0.094117, 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),
(1, 1),
(2, 2),
@ -1225,7 +1227,8 @@ ShirtStyles = {'bss1': [0, 0, [(0, 0),
'jb_1': [112, 99, [(27, 27)]],
'jb_2': [113, 100, [(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,
1,
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!'
CdrResultInvalidCode = "You've entered an invalid code. Please check the code and try again."
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.'
CdrResultAlreadyInMailbox = "You've already received this item. Check your mailbox to confirm."
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."
CdrResultAlreadyRedeemed = "You've already redeemed this item!"
TrackPageTitle = 'Gag Track Training'
TrackPageShortTitle = 'Gag Training'
TrackPageSubtitle = 'Complete ToonTasks to learn how to use new gags!'
@ -6135,7 +6128,8 @@ ShirtStylesDescriptions = {'bss1': 'solid',
'lb_1': 'Lawbot Icon Shirt',
'jb_1': 'Jellybean Shirt',
'jb_2': 'Doodle Shirt',
'ugcms': 'Get Connected Mover & Shaker'}
'ugcms': 'Get Connected Mover & Shaker',
'weed': '420 BlazeIt Shirt'}
BottomStylesDescriptions = {'bbs1': 'plain w/ pockets',
'bbs2': 'belt',
'bbs3': 'cargo',
@ -6675,7 +6669,8 @@ ClothingTypeNames = {1001: 'Ghost Shirt',
1783: 'Racing Shorts 1',
1784: 'Racing Skirt 1',
1801: 'Batty Moon Shirt',
1802: 'Mittens Shirt'}
1802: 'Mittens Shirt',
1821: '420 BlazeIt Shirt'}
AccessoryArticleNames = ('Hat',
'Glasses',
'Backpack',
@ -9609,6 +9604,16 @@ CheckersObserver = 'You are Observing'
RegularCheckers = 'Checkers.'
RegularCheckersGameOf = ' has just won a game of '
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!"
MailNewMailButton = 'Mail'
MailSimpleMail = 'Note'

View file

@ -44,6 +44,21 @@ class ToontownLoadingScreen:
ToontownGlobals.LawbotHQ : 'phase_3.5/maps/loading/lbhq.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):
self.__expectedCount = 0
@ -82,9 +97,10 @@ class ToontownLoadingScreen:
if gui:
if base.localAvatarStyle:
from toontown.toon import Toon
emote = random.choice(self.emotes)
self.toon = Toon.Toon()
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().setDepthTest(1)
self.toon.setHpr(205, 0, 0)