Fixed Tug-o-War, removed Trolley Tracks and temp minigame AI

This commit is contained in:
DenialMC 2015-05-05 21:43:30 +03:00
parent 2f528c1aa6
commit dd0b4fdbbe
20 changed files with 22 additions and 2306 deletions

View file

@ -450,7 +450,6 @@ from toontown.estate import DistributedChangingStatuary/AI
from toontown.estate import DistributedAnimatedStatuary/AI
from toontown.estate import DistributedPlantBase/AI
from toontown.estate import DistributedLawnDecor/AI
from toontown.minigame import DistributedTravelGame/AI
from toontown.minigame import DistributedVineGame/AI
from toontown.golf import DistributedPhysicsWorld/AI
from toontown.golf import DistributedGolfHole/AI
@ -1184,8 +1183,6 @@ dclass DistributedTarget : DistributedObject {
dclass DistributedMinigame : DistributedObject {
setParticipants(uint32[]) broadcast ram required;
setTrolleyZone(uint32) broadcast ram required;
setStartingVotes(uint16[]) broadcast ram required;
setMetagameRound(int8) broadcast ram required;
setDifficultyOverrides(int32, int32) broadcast ram required;
setAvatarJoined() airecv clsend;
setAvatarReady() airecv clsend;
@ -1648,8 +1645,6 @@ dclass PurchaseManager : DistributedObject {
setPlayerMoney(uint16, uint16, uint16, uint16) required broadcast ram;
setPlayerStates(uint8, uint8, uint8, uint8) required broadcast ram;
setCountdown(int16) required broadcast ram;
setMetagameRound(int8) required broadcast ram;
setVotesArray(int16[]) required broadcast ram;
requestExit() airecv clsend;
requestPlayAgain() airecv clsend;
setInventory(blob, int16, uint8) airecv clsend;
@ -2779,17 +2774,6 @@ dclass DistributedGagTree : DistributedPlantBase {
requestHarvest() airecv clsend;
};
dclass DistributedTravelGame : DistributedMinigame {
setTimerStartTime(int16) broadcast;
setAvatarChoice(uint16, uint8) airecv clsend;
setAvatarVotes(uint32, uint16) broadcast;
setAvatarChose(uint32) broadcast;
setServerChoices(int16[], uint8[], uint8, uint8) broadcast;
setMinigames(uint8[], uint8[]) broadcast;
setBonuses(uint8[], uint8[]) broadcast;
setBoardIndex(uint8) required broadcast ram;
};
struct golfData {
int16 frame;
int32/100000 x;

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import *
hashVal = 1036327477
hashVal = 229492426
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
@ -24,7 +24,7 @@ from toontown.distributed import ToontownDistrict, ToontownDistrictStats, Distri
from toontown.effects import DistributedFireworkShow
from toontown.safezone import DistributedTrolley, DistributedPartyGate, DistributedBoat, DistributedButterfly, DistributedMMPiano, DistributedDGFlower, DistributedFishingSpot, SafeZoneManager, DistributedTreasure, DistributedGolfKart, DistributedPicnicBasket, DistributedPicnicTable, DistributedChineseCheckers, DistributedCheckers, DistributedFindFour
from toontown.fishing import DistributedFishingPond, DistributedFishingTarget, DistributedPondBingoManager
from toontown.minigame import DistributedMinigame, DistributedMinigameTemplate, DistributedRaceGame, DistributedCannonGame, DistributedPhotoGame, DistributedPatternGame, DistributedRingGame, DistributedTagGame, DistributedMazeGame, DistributedTugOfWarGame, DistributedCatchGame, DistributedDivingGame, DistributedTargetGame, DistributedTravelGame, DistributedVineGame, DistributedIceGame, DistributedCogThiefGame, DistributedTwoDGame
from toontown.minigame import DistributedMinigame, DistributedMinigameTemplate, DistributedRaceGame, DistributedCannonGame, DistributedPhotoGame, DistributedPatternGame, DistributedRingGame, DistributedTagGame, DistributedMazeGame, DistributedTugOfWarGame, DistributedCatchGame, DistributedDivingGame, DistributedTargetGame, DistributedVineGame, DistributedIceGame, DistributedCogThiefGame, DistributedTwoDGame
from toontown.racing import DistributedVehicle, DistributedStartingBlock, DistributedRace, DistributedKartPad, DistributedRacePad, DistributedViewPad, DistributedStartingBlock, DistributedLeaderBoard, DistributedGag, DistributedProjectile
from toontown.catalog import CatalogManager, AccountDate
from toontown.rpc.AwardManager import AwardManager

View file

@ -118,13 +118,13 @@ class ToonHood(Hood):
self.doneStatus = doneStatus
messenger.send(self.doneEvent)
def enterPurchase(self, pointsAwarded, playerMoney, avIds, playerStates, remain, metagameRound = -1, votesArray = None):
def enterPurchase(self, pointsAwarded, playerMoney, avIds, playerStates, remain):
messenger.send('enterSafeZone')
DistributedAvatar.DistributedAvatar.HpTextEnabled = 0
base.localAvatar.laffMeter.start()
self.purchaseDoneEvent = 'purchaseDone'
self.accept(self.purchaseDoneEvent, self.handlePurchaseDone)
self.purchase = Purchase.Purchase(base.localAvatar, pointsAwarded, playerMoney, avIds, playerStates, remain, self.purchaseDoneEvent, metagameRound, votesArray)
self.purchase = Purchase.Purchase(base.localAvatar, pointsAwarded, playerMoney, avIds, playerStates, remain, self.purchaseDoneEvent)
self.purchase.load()
self.purchase.enter()

View file

@ -51,8 +51,6 @@ class DistributedMinigame(DistributedObject.DistributedObject):
self.trolleyZoneOverride = None
self.hasLocalToon = 0
self.frameworkFSM.enterInitialState()
self.startingVotes = {}
self.metagameRound = -1
self._telemLimiter = None
return
@ -428,17 +426,4 @@ class DistributedMinigame(DistributedObject.DistributedObject):
Emote.globalEmote.disableAll(base.localAvatar)
def unsetEmotes(self):
Emote.globalEmote.releaseAll(base.localAvatar)
def setStartingVotes(self, startingVotesArray):
if not len(startingVotesArray) == len(self.avIdList):
self.notify.error('length does not match, startingVotes=%s, avIdList=%s' % (startingVotesArray, self.avIdList))
return
for index in xrange(len(self.avIdList)):
avId = self.avIdList[index]
self.startingVotes[avId] = startingVotesArray[index]
self.notify.debug('starting votes = %s' % self.startingVotes)
def setMetagameRound(self, metagameRound):
self.metagameRound = metagameRound
Emote.globalEmote.releaseAll(base.localAvatar)

View file

@ -11,7 +11,6 @@ from direct.task import Task
import random
import MinigameGlobals
from direct.showbase import PythonUtil
import TravelGameGlobals
from toontown.toonbase import ToontownGlobals
EXITED = 0
EXPECTED = 1
@ -45,8 +44,6 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI):
self.scoreDict = {}
self.difficultyOverride = None
self.trolleyZoneOverride = None
self.metagameRound = -1
self.startingVotes = {}
return
@ -76,9 +73,6 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI):
self.trolleyZoneOverride = trolleyZoneOverride
return
def setMetagameRound(self, roundNum):
self.metagameRound = roundNum
def _playing(self):
if not hasattr(self, 'gameFSM'):
return False
@ -320,67 +314,9 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI):
scoreList.append(score)
self.requestDelete()
if self.metagameRound > -1:
self.handleMetagamePurchaseManager(scoreList)
else:
self.handleRegularPurchaseManager(scoreList)
self.handleRegularPurchaseManager(scoreList)
self.frameworkFSM.request('frameworkOff')
def handleMetagamePurchaseManager(self, scoreList):
self.notify.debug('self.newbieIdList = %s' % self.newbieIdList)
votesToUse = self.startingVotes
if hasattr(self, 'currentVotes'):
votesToUse = self.currentVotes
votesArray = []
for avId in self.avIdList:
if avId in votesToUse:
votesArray.append(votesToUse[avId])
else:
self.notify.warning('votesToUse=%s does not have avId=%d' % (votesToUse, avId))
votesArray.append(0)
if self.metagameRound < TravelGameGlobals.FinalMetagameRoundIndex:
newRound = self.metagameRound
if not self.minigameId == ToontownGlobals.TravelGameId:
for index in xrange(len(scoreList)):
votesArray[index] += scoreList[index]
self.notify.debug('votesArray = %s' % votesArray)
desiredNextGame = None
if hasattr(self, 'desiredNextGame'):
desiredNextGame = self.desiredNextGame
numToons = 0
lastAvId = 0
for avId in self.avIdList:
av = simbase.air.doId2do.get(avId)
if av:
numToons += 1
lastAvId = avId
doNewbie = False
if numToons == 1 and lastAvId in self.newbieIdList:
doNewbie = True
if doNewbie:
pm = NewbiePurchaseManagerAI.NewbiePurchaseManagerAI(self.air, lastAvId, self.avIdList, scoreList, self.minigameId, self.trolleyZone)
MinigameCreatorAI.acquireMinigameZone(self.zoneId)
pm.generateWithRequired(self.zoneId)
else:
pm = PurchaseManagerAI.PurchaseManagerAI(self.air, self.avIdList, scoreList, self.minigameId, self.trolleyZone, self.newbieIdList, votesArray, newRound, desiredNextGame)
pm.generateWithRequired(self.zoneId)
else:
self.notify.debug('last minigame, handling newbies')
if ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY in simbase.air.holidayManager.currentHolidays or ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH in simbase.air.holidayManager.currentHolidays:
votesArray = map(lambda x: MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier * x, votesArray)
for id in self.newbieIdList:
pm = NewbiePurchaseManagerAI.NewbiePurchaseManagerAI(self.air, id, self.avIdList, scoreList, self.minigameId, self.trolleyZone)
MinigameCreatorAI.acquireMinigameZone(self.zoneId)
pm.generateWithRequired(self.zoneId)
if len(self.avIdList) > len(self.newbieIdList):
pm = PurchaseManagerAI.PurchaseManagerAI(self.air, self.avIdList, scoreList, self.minigameId, self.trolleyZone, self.newbieIdList, votesArray=votesArray, metagameRound=self.metagameRound)
pm.generateWithRequired(self.zoneId)
return
def handleRegularPurchaseManager(self, scoreList):
for id in self.newbieIdList:
pm = NewbiePurchaseManagerAI.NewbiePurchaseManagerAI(self.air, id, self.avIdList, scoreList, self.minigameId, self.trolleyZone)
@ -426,22 +362,4 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI):
def logAllPerfect(self):
for avId in self.avIdList:
self.logPerfectGame(avId)
def getStartingVotes(self):
retval = []
for avId in self.avIdList:
if avId in self.startingVotes:
retval.append(self.startingVotes[avId])
else:
self.notify.warning('how did this happen? avId=%d not in startingVotes %s' % (avId, self.startingVotes))
retval.append(0)
return retval
def setStartingVote(self, avId, startingVote):
self.startingVotes[avId] = startingVote
self.notify.debug('setting starting vote of avId=%d to %d' % (avId, startingVote))
def getMetagameRound(self):
return self.metagameRound
self.logPerfectGame(avId)

File diff suppressed because it is too large Load diff

View file

@ -1,325 +0,0 @@
from toontown.minigame.DistributedMinigameAI import *
from direct.fsm import ClassicFSM, State
from direct.fsm import State
import TravelGameGlobals
from toontown.toonbase import ToontownGlobals
class DistributedTravelGameAI(DistributedMinigameAI):
notify = directNotify.newCategory('DistributedTravelGameAI')
def __init__(self, air, minigameId):
try:
self.DistributedTravelGameAI_initialized
except:
self.DistributedTravelGameAI_initialized = 1
DistributedMinigameAI.__init__(self, air, minigameId)
self.gameFSM = ClassicFSM.ClassicFSM('DistributedTravelGameAI', [State.State('inactive', self.enterInactive, self.exitInactive, ['waitClientsChoices']),
State.State('waitClientsChoices', self.enterWaitClientsChoices, self.exitWaitClientsChoices, ['processChoices', 'cleanup']),
State.State('processChoices', self.enterProcessChoices, self.exitProcessChoices, ['waitClientsChoices', 'cleanup']),
State.State('cleanup', self.enterCleanup, self.exitCleanup, ['inactive'])], 'inactive', 'inactive')
self.addChildGameFSM(self.gameFSM)
self.currentVotes = {}
self.avatarChoices = {}
self.currentSwitch = 0
self.destSwitch = 0
self.gotBonus = {}
self.desiredNextGame = -1
self.boardIndex = random.choice(range(len(TravelGameGlobals.BoardLayouts)))
def generate(self):
self.notify.debug('generate')
DistributedMinigameAI.generate(self)
def delete(self):
self.notify.debug('delete')
del self.gameFSM
DistributedMinigameAI.delete(self)
def setGameReady(self):
self.notify.debug('setGameReady')
DistributedMinigameAI.setGameReady(self)
self.calcMinigames()
self.calcBonusBeans()
def setGameStart(self, timestamp):
self.notify.debug('setGameStart')
DistributedMinigameAI.setGameStart(self, timestamp)
self.gameFSM.request('waitClientsChoices')
def setGameAbort(self):
self.notify.debug('setGameAbort')
if self.gameFSM.getCurrentState():
self.gameFSM.request('cleanup')
DistributedMinigameAI.setGameAbort(self)
def gameOver(self):
self.notify.debug('gameOver')
scoreList = []
curVotesList = []
bonusesList = []
for avId in self.avIdList:
scoreList.append(self.scoreDict[avId])
curVotesList.append(self.currentVotes[avId])
bonusesList.append((self.avIdBonuses[avId][0], self.avIdBonuses[avId][1]))
self.air.writeServerEvent('minigame_travel', self.doId, '%s|%s|%s|%s|%s|%s|%s|%s' % (ToontownGlobals.TravelGameId,
self.getSafezoneId(),
self.avIdList,
scoreList,
self.boardIndex,
curVotesList,
bonusesList,
self.desiredNextGame))
self.gameFSM.request('cleanup')
DistributedMinigameAI.gameOver(self)
def enterInactive(self):
self.notify.debug('enterInactive')
def exitInactive(self):
pass
def enterWaitClientsChoices(self):
self.notify.debug('enterWaitClientsChoices')
self.resetChoices()
taskMgr.doMethodLater(TravelGameGlobals.InputTimeout, self.waitClientsChoicesTimeout, self.taskName('input-timeout'))
self.sendUpdate('setTimerStartTime', [globalClockDelta.getFrameNetworkTime()])
def exitWaitClientsChoices(self):
taskMgr.remove(self.taskName('input-timeout'))
def enterProcessChoices(self):
self.directionVotes = []
for dir in xrange(TravelGameGlobals.MaxDirections):
self.directionVotes.append([dir, 0])
for key in self.avatarChoices:
choice = self.avatarChoices[key]
numVotes = choice[0]
direction = choice[1]
self.directionVotes[direction][1] += numVotes
def voteCompare(directionVoteA, directionVoteB):
if directionVoteA[1] < directionVoteB[1]:
return -1
elif directionVoteA[1] == directionVoteB[1]:
return 0
else:
return 1
self.directionVotes.sort(voteCompare, reverse=True)
winningVotes = self.directionVotes[0][1]
self.winningDirections = []
self.notify.debug('self.directionVotes = %s' % self.directionVotes)
for vote in self.directionVotes:
if vote[1] == winningVotes:
self.winningDirections.append(vote[0])
self.notify.debug('add direction %d to winning directions' % vote[0])
self.directionReason = TravelGameGlobals.ReasonVote
if len(self.winningDirections) > 1:
self.notify.debug('multiple winningDirections=%s' % self.winningDirections)
self.directionReason = TravelGameGlobals.ReasonRandom
self.directionToGo = random.choice(self.winningDirections)
self.notify.debug('self.directionToGo =%d' % self.directionToGo)
self.votesArray = []
self.directionArray = []
for avId in self.avIdList:
vote = self.avatarChoices[avId][0]
direction = self.avatarChoices[avId][1]
if vote < 0:
vote = 0
self.votesArray.append(vote)
self.directionArray.append(direction)
curSwitch = TravelGameGlobals.BoardLayouts[self.boardIndex][self.currentSwitch]
self.destSwitch = curSwitch['links'][self.directionToGo]
self.checkForEndGame()
def exitProcessChoices(self):
taskMgr.remove(self.taskName('move-timeout'))
def enterCleanup(self):
self.notify.debug('enterCleanup')
self.gameFSM.request('inactive')
def exitCleanup(self):
pass
def setExpectedAvatars(self, avIds):
DistributedMinigameAI.setExpectedAvatars(self, avIds)
def createDefaultStartingVotes(self):
for avId in self.avIdList:
self.startingVotes[avId] = TravelGameGlobals.DefaultStartingVotes
self.currentVotes[avId] = TravelGameGlobals.DefaultStartingVotes
def waitClientsChoicesTimeout(self, task):
self.notify.debug('waitClientsChoicesTimeout: did not hear from all clients')
for avId in self.avatarChoices.keys():
if self.avatarChoices[avId] == (-1, 0):
self.avatarChoices[avId] = (0, 0)
self.gameFSM.request('processChoices')
return Task.done
def resetChoices(self):
for avId in self.avIdList:
self.avatarChoices[avId] = (-1, 0)
def setAvatarChoice(self, votes, direction):
avatarId = self.air.getAvatarIdFromSender()
self.notify.debug('setAvatarChoice: avatar: ' + str(avatarId) + ' votes: ' + str(votes) + ' direction: ' + str(direction))
self.avatarChoices[avatarId] = self.checkChoice(avatarId, votes, direction)
self.currentVotes[avatarId] -= self.avatarChoices[avatarId][0]
if self.currentVotes[avatarId] < 0:
self.notify.warning('currentVotes < 0 avId=%s, currentVotes=%s' % (avatarId, self.currentVotes[avatarId]))
self.currentVotes[avatarId] = 0
self.avatarChoices[avatarId] = (0, 0)
self.sendUpdate('setAvatarVotes', [avatarId, self.currentVotes[avatarId]])
self.notify.debug('currentVotes = %s' % self.currentVotes)
self.notify.debug('avatarChoices = %s' % self.avatarChoices)
self.sendUpdate('setAvatarChose', [avatarId])
if self.allAvatarsChosen():
self.notify.debug('setAvatarChoice: all avatars have chosen')
self.gameFSM.request('processChoices')
else:
self.notify.debug('setAvatarChoice: still waiting for more choices')
def checkChoice(self, avId, votes, direction):
retDir = direction
if direction < 0 or direction >= TravelGameGlobals.MaxDirections:
self.notify.debug('invalid direction %d. Using 0.' % direction)
retDir = 0
availableVotes = self.currentVotes[avId]
retVotes = min(votes, availableVotes)
retVotes = max(votes, 0)
return (retVotes, retDir)
def allAvatarsChosen(self):
for avId in self.avatarChoices.keys():
choice = self.avatarChoices[avId]
if choice[0] == -1 and not self.stateDict[avId] == EXITED:
return False
return True
def isLeaf(self, switchIndex):
retval = False
links = TravelGameGlobals.BoardLayouts[self.boardIndex][switchIndex]['links']
if len(links) == 0:
retval = True
return retval
def giveBonusBeans(self, endingSwitch):
noOneGotBonus = True
for avId in self.avIdBonuses.keys():
self.scoreDict[avId] = 0
if self.avIdBonuses[avId][0] == endingSwitch and not self.stateDict[avId] == EXITED:
noOneGotBonus = False
self.scoreDict[avId] = self.avIdBonuses[avId][1]
self.gotBonus[avId] = self.avIdBonuses[avId][1]
if noOneGotBonus:
for avId in self.avIdBonuses.keys():
self.scoreDict[avId] = 1
def checkForEndGame(self):
self.notify.debug('checkForEndgame: ')
self.currentSwitch = self.destSwitch
didWeReachMiniGame = self.isLeaf(self.currentSwitch)
numPlayers = len(self.avIdList)
if TravelGameGlobals.SpoofFour:
numPlayers = 4
delay = TravelGameGlobals.DisplayVotesTimePerPlayer * (numPlayers + 1) + TravelGameGlobals.MoveTrolleyTime + TravelGameGlobals.FudgeTime
if didWeReachMiniGame:
self.desiredNextGame = self.switchToMinigameDict[self.currentSwitch]
taskMgr.doMethodLater(delay, self.moveTimeoutTaskGameOver, self.taskName('move-timeout'))
self.giveBonusBeans(self.currentSwitch)
else:
taskMgr.doMethodLater(delay, self.moveTimeoutTask, self.taskName('move-timeout'))
self.sendUpdate('setServerChoices', [self.votesArray,
self.directionArray,
self.directionToGo,
self.directionReason])
def moveTimeoutTask(self, task):
self.notify.debug('Done waiting for trolley move')
self.gameFSM.request('waitClientsChoices')
return Task.done
def moveTimeoutTaskGameOver(self, task):
self.notify.debug('Done waiting for trolley move, gmae over')
self.gameOver()
return Task.done
def calcMinigames(self):
numPlayers = len(self.avIdList)
allowedGames = list(ToontownGlobals.MinigamePlayerMatrix[numPlayers])
from toontown.minigame import MinigameCreatorAI
allowedGames = MinigameCreatorAI.removeUnreleasedMinigames(allowedGames)
self.switchToMinigameDict = {}
for switch in TravelGameGlobals.BoardLayouts[self.boardIndex].keys():
if self.isLeaf(switch):
if len(allowedGames) == 0:
allowedGames = list(ToontownGlobals.MinigamePlayerMatrix[numPlayers])
allowedGames = MinigameCreatorAI.removeUnreleasedMinigames(allowedGames)
minigame = random.choice(allowedGames)
self.switchToMinigameDict[switch] = minigame
allowedGames.remove(minigame)
switches = []
minigames = []
for key in self.switchToMinigameDict.keys():
switches.append(key)
minigames.append(self.switchToMinigameDict[key])
self.sendUpdate('setMinigames', [switches, minigames])
def calcBonusBeans(self):
possibleLeaves = []
for switch in TravelGameGlobals.BoardLayouts[self.boardIndex].keys():
if self.isLeaf(switch):
possibleLeaves.append(switch)
self.avIdBonuses = {}
for avId in self.avIdList:
switch = random.choice(possibleLeaves)
possibleLeaves.remove(switch)
beans = TravelGameGlobals.BoardLayouts[self.boardIndex][switch]['baseBonus']
baseBeans = TravelGameGlobals.BaseBeans
numPlayerMultiplier = len(self.avIdList) / 4.0
roundMultiplier = self.metagameRound / 2.0 + 1.0
beans *= baseBeans * numPlayerMultiplier * roundMultiplier
self.avIdBonuses[avId] = (switch, beans)
switches = []
beans = []
for avId in self.avIdList:
switches.append(self.avIdBonuses[avId][0])
beans.append(self.avIdBonuses[avId][1])
self.sendUpdate('setBonuses', [switches, beans])
def setStartingVote(self, avId, startingVote):
DistributedMinigameAI.setStartingVote(self, avId, startingVote)
self.currentVotes[avId] = startingVote
self.notify.debug('setting current vote of avId=%d to %d' % (avId, startingVote))
def handleExitedAvatar(self, avId):
self.notify.warning('DistrbutedTravelGameAI: handleExitedAvatar: avatar id exited: ' + str(avId))
self.stateDict[avId] = EXITED
allExited = True
for avId in self.avIdList:
if avId in self.stateDict.keys() and self.stateDict[avId] != EXITED:
allExited = False
break
if allExited:
self.setGameAbort()
def getBoardIndex(self):
return self.boardIndex
def hasScoreMult(self):
return 0

View file

@ -10,18 +10,15 @@ import DistributedDivingGameAI
import DistributedIceGameAI
import DistributedMazeGameAI
import DistributedMinigameTemplateAI
import DistributedPairingGameAI
import DistributedPatternGameAI
import DistributedPhotoGameAI
import DistributedRaceGameAI
import DistributedRingGameAI
import DistributedTagGameAI
import DistributedTargetGameAI
import DistributedTravelGameAI
import DistributedTugOfWarGameAI
import DistributedTwoDGameAI
import DistributedVineGameAI
import TravelGameGlobals
from otp.ai.MagicWordGlobal import *
from toontown.minigame.TempMinigameAI import *
from toontown.toonbase import ToontownGlobals
@ -30,21 +27,9 @@ from toontown.toonbase import ToontownGlobals
simbase.forcedMinigameId = simbase.config.GetInt('force-minigame', 0)
RequestMinigame = {}
MinigameZoneRefs = {}
DisabledMinigames = []
def getDisabledMinigames():
if not DisabledMinigames:
for name, minigameId in ToontownGlobals.MinigameNames.items():
if not simbase.config.GetBool('want-%s-game' % name, True):
if minigameId not in DisabledMinigames:
DisabledMinigames.append(minigameId)
return DisabledMinigames[:]
def createMinigame(air, playerArray, trolleyZone, minigameZone=None,
previousGameId=ToontownGlobals.NoPreviousGameId, newbieIds=[],
startingVotes=None, metagameRound=-1, desiredNextGame=None):
previousGameId=ToontownGlobals.NoPreviousGameId, newbieIds=[]):
if minigameZone is None:
minigameZone = air.allocateZone()
acquireMinigameZone(minigameZone)
@ -66,18 +51,10 @@ def createMinigame(air, playerArray, trolleyZone, minigameZone=None,
randomList = list(copy.copy(ToontownGlobals.MinigamePlayerMatrix[len(playerArray)]))
if len(playerArray) > 1:
randomList = list(copy.copy(ToontownGlobals.MinigameIDs))
for gameId in [ToontownGlobals.TravelGameId] + getDisabledMinigames():
if gameId in randomList:
randomList.remove(gameId)
if previousGameId != ToontownGlobals.NoPreviousGameId:
if randomList.count(previousGameId) != 0 and len(randomList) > 1:
randomList.remove(previousGameId)
mgId = random.choice(randomList)
if metagameRound > -1:
if (metagameRound%2) == 0:
mgId = ToontownGlobals.TravelGameId
elif desiredNextGame:
mgId = desiredNextGame
mgCtors = {
ToontownGlobals.RaceGameId: DistributedRaceGameAI.DistributedRaceGameAI,
ToontownGlobals.CannonGameId: DistributedCannonGameAI.DistributedCannonGameAI,
@ -90,17 +67,12 @@ def createMinigame(air, playerArray, trolleyZone, minigameZone=None,
ToontownGlobals.DivingGameId: DistributedDivingGameAI.DistributedDivingGameAI,
ToontownGlobals.TargetGameId: DistributedTargetGameAI.DistributedTargetGameAI,
ToontownGlobals.MinigameTemplateId: DistributedMinigameTemplateAI.DistributedMinigameTemplateAI,
ToontownGlobals.PairingGameId: DistributedPairingGameAI.DistributedPairingGameAI,
ToontownGlobals.VineGameId: DistributedVineGameAI.DistributedVineGameAI,
ToontownGlobals.IceGameId: DistributedIceGameAI.DistributedIceGameAI,
ToontownGlobals.CogThiefGameId: DistributedCogThiefGameAI.DistributedCogThiefGameAI,
ToontownGlobals.TwoDGameId: DistributedTwoDGameAI.DistributedTwoDGameAI,
ToontownGlobals.TravelGameId: DistributedTravelGameAI.DistributedTravelGameAI,
ToontownGlobals.PhotoGameId: DistributedPhotoGameAI.DistributedPhotoGameAI
}
from TempMinigameAI import TempMgCtors
for key, value in TempMgCtors.items():
mgCtors[key] = value
try:
mg = mgCtors[mgId](air, mgId)
except KeyError:
@ -109,18 +81,6 @@ def createMinigame(air, playerArray, trolleyZone, minigameZone=None,
mg.setNewbieIds(newbieIds)
mg.setTrolleyZone(trolleyZone)
mg.setDifficultyOverrides(mgDiff, mgSzId)
if startingVotes == None:
for avId in playerArray:
mg.setStartingVote(avId, TravelGameGlobals.DefaultStartingVotes)
else:
for index in xrange(len(startingVotes)):
avId = playerArray[index]
votes = startingVotes[index]
if votes < 0:
print 'createMinigame negative votes, avId=%s votes=%s' % (avId, votes)
votes = 0
mg.setStartingVote(avId, votes)
mg.setMetagameRound(metagameRound)
mg.generateWithRequired(minigameZone)
toons = []
for doId in playerArray:

View file

@ -13,8 +13,8 @@ class MinigamePowerMeter(DirectFrame):
if label == None:
label = TTLocalizer.MinigamePowerMeterLabel
self.powerText = DirectLabel(self, relief=None, text=label, text_scale=TTLocalizer.MPMpowerText, pos=(0.01, 0.0, 0.29))
self.tooSlow = DirectLabel(parent=self, relief=None, text=TTLocalizer.MinigamePowerMeterTooSlow, scale=TTLocalizer.MPMtooSlow, pos=(-.15, 0, 0.05), color=(0.1, 0.3, 0.6))
self.tooFast = DirectLabel(parent=self, relief=None, text=TTLocalizer.MinigamePowerMeterTooFast, scale=TTLocalizer.MPMtooFast, pos=(0.15, 0, 0.05), color=(0.1, 0.3, 0.6))
self.tooSlow = DirectLabel(parent=self, relief=None, text=TTLocalizer.MinigamePowerMeterTooSlow, scale=TTLocalizer.MPMtooSlow, pos=(-.15, 0, 0.05), color=(0.1, 0.3, 0.6, 1.0))
self.tooFast = DirectLabel(parent=self, relief=None, text=TTLocalizer.MinigamePowerMeterTooFast, scale=TTLocalizer.MPMtooFast, pos=(0.15, 0, 0.05), color=(0.1, 0.3, 0.6, 1.0))
self.tooSlow.hide()
self.tooFast.hide()
self.largeGauge = []

View file

@ -6,7 +6,6 @@ from direct.task.Task import Task
import MinigameGlobals
from PurchaseBase import *
from toontown.distributed import DelayDelete
from toontown.minigame import TravelGameGlobals
from toontown.nametag import NametagGlobals
from toontown.nametag.NametagFloat2d import *
from toontown.toon import ToonHead
@ -30,7 +29,7 @@ OVERMAX_SFX_START_T = 0.021
class Purchase(PurchaseBase):
notify = DirectNotifyGlobal.directNotify.newCategory('Purchase')
def __init__(self, toon, pointsArray, playerMoney, ids, states, remain, doneEvent, metagameRound = -1, votesArray = None):
def __init__(self, toon, pointsArray, playerMoney, ids, states, remain, doneEvent):
PurchaseBase.__init__(self, toon, doneEvent)
self.ids = ids
self.pointsArray = pointsArray
@ -38,9 +37,6 @@ class Purchase(PurchaseBase):
self.states = states
self.remain = remain
self.tutorialMode = 0
self.metagameRound = metagameRound
self.votesArray = votesArray
self.voteMultiplier = 1
self.fsm.addState(State.State('reward', self.enterReward, self.exitReward, ['purchase']))
doneState = self.fsm.getStateNamed('done')
doneState.addTransition('reward')
@ -149,8 +145,6 @@ class Purchase(PurchaseBase):
self.door.setScale(1.5, 1.5, 2.0)
self.door.setColor(1.0, 0.8, 0, 1)
doors.removeNode()
self.convertingVotesToBeansLabel = DirectLabel(text=TTLocalizer.TravelGameConvertingVotesToBeans, text_fg=VBase4(1, 1, 1, 1), relief=None, pos=(0.0, 0, -0.58), scale=0.075)
self.convertingVotesToBeansLabel.hide()
self.rewardDoubledJellybeanLabel = DirectLabel(text=TTLocalizer.PartyRewardDoubledJellybean, text_fg=(1.0, 0.125, 0.125, 1.0), text_shadow=(0, 0, 0, 1), relief=None, pos=(0.0, 0, -0.67), scale=0.08)
self.rewardDoubledJellybeanLabel.hide()
self.countSound = base.loadSfx('phase_3.5/audio/sfx/tick_counter.ogg')
@ -191,9 +185,7 @@ class Purchase(PurchaseBase):
loader.unloadModel('phase_3.5/models/modules/street_modules')
loader.unloadModel('phase_4/models/modules/doors')
taskMgr.remove('countUpTask')
taskMgr.remove('countVotesUpTask')
taskMgr.remove('countDownTask')
taskMgr.remove('countVotesDownTask')
taskMgr.remove('celebrate')
taskMgr.remove('purchase-trans')
taskMgr.remove('delayAdd')
@ -216,9 +208,7 @@ class Purchase(PurchaseBase):
del self.collisionFloor
del self.countSound
del self.celebrateSound
self.convertingVotesToBeansLabel.removeNode()
self.rewardDoubledJellybeanLabel.removeNode()
del self.convertingVotesToBeansLabel
del self.rewardDoubledJellybeanLabel
def showStatusText(self, text):
@ -355,14 +345,6 @@ class Purchase(PurchaseBase):
pos += 1
self.maxPoints = max(self.pointsArray)
if self.votesArray:
self.maxVotes = max(self.votesArray)
numToons = len(self.toons)
self.voteMultiplier = TravelGameGlobals.PercentOfVotesConverted[numToons] / 100.0
self.maxBeansFromVotes = int(self.voteMultiplier * self.maxVotes)
else:
self.maxVotes = 0
self.maxBeansFromVotes = 0
def reqCountUp(state):
self.countUp()
@ -400,22 +382,6 @@ class Purchase(PurchaseBase):
celebrateTask.ids = self.ids
celebrateTask.celebrateSound = self.celebrateSound
def reqCountVotesUp(state):
self.countVotesUp()
return Task.done
def reqCountVotesDown(state):
self.countVotesDown()
return Task.done
if self.metagameRound == TravelGameGlobals.FinalMetagameRoundIndex:
countVotesUpDelay = celebrateDelay + DELAY_AFTER_CELEBRATE
taskMgr.doMethodLater(countVotesUpDelay, reqCountVotesUp, 'countVotesUpTask')
countVotesUpTime = self.maxVotes * COUNT_UP_RATE + DELAY_AFTER_COUNT_UP
countVotesDownDelay = countVotesUpDelay + countVotesUpTime
taskMgr.doMethodLater(countVotesDownDelay, reqCountVotesDown, 'countVotesDownTask')
celebrateDelay += countVotesUpTime + self.maxVotes * COUNT_DOWN_RATE + DELAY_AFTER_COUNT_DOWN
def reqPurchase(state):
self.fsm.request('purchase')
return Task.done
@ -512,75 +478,10 @@ class Purchase(PurchaseBase):
countDownTask.overMaxSound = self.overMaxSound
countDownTask.lastSfxT = 0
def countVotesUp(self):
totalDelay = 0
self.convertingVotesToBeansLabel.show()
if base.cr.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY) or base.cr.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH):
self.rewardDoubledJellybeanLabel.show()
counterIndex = 0
for index in xrange(len(self.ids)):
avId = self.ids[index]
if self.states[index] != PURCHASE_NO_CLIENT_STATE and self.states[index] != PURCHASE_DISCONNECTED_STATE and avId in base.cr.doId2do:
self.counters[counterIndex].count = 0
self.counters[counterIndex].max = self.votesArray[index]
self.counters[counterIndex].show()
counterIndex += 1
def delayAdd(state):
state.counter.count += 1
state.counter['text'] = str(state.counter.count)
if state.toonId == base.localAvatar.doId:
base.playSfx(state.countSound)
return Task.done
for count in xrange(0, self.maxVotes):
for counter in self.counters:
index = self.counters.index(counter)
if count < counter.max:
addTask = taskMgr.doMethodLater(totalDelay, delayAdd, 'delayAdd')
addTask.counter = counter
addTask.toonId = self.ids[index]
addTask.countSound = self.countSound
totalDelay += COUNT_UP_RATE
def countVotesDown(self):
totalDelay = 0
def delaySubtract(state):
state.counter.count -= 1
state.counter['text'] = str(state.counter.count)
state.total.count += 1 * self.voteMultiplier
if state.total.count <= state.total.max:
state.total['text'] = str(int(state.total.count))
if state.total.count == state.total.max + 1:
state.total['text_fg'] = (1, 0, 0, 1)
if state.toonId == base.localAvatar.doId:
if state.total.count <= state.total.max:
base.playSfx(state.countSound)
else:
base.playSfx(state.overMaxSound)
return Task.done
for count in xrange(0, self.maxVotes):
for counter in self.counters:
if count < counter.max:
index = self.counters.index(counter)
subtractTask = taskMgr.doMethodLater(totalDelay, delaySubtract, 'delaySubtract')
subtractTask.counter = counter
subtractTask.total = self.totalCounters[index]
subtractTask.toonId = self.ids[index]
subtractTask.countSound = self.countSound
subtractTask.overMaxSound = self.overMaxSound
totalDelay += COUNT_DOWN_RATE
def exitReward(self):
self.ignore('clientCleanup')
taskMgr.remove('countUpTask')
taskMgr.remove('countVotesUpTask')
taskMgr.remove('countDownTask')
taskMgr.remove('countVotesDownTask')
taskMgr.remove('celebrate')
taskMgr.remove('purchase-trans')
taskMgr.remove('delayAdd')
@ -608,7 +509,6 @@ class Purchase(PurchaseBase):
self.sidewalkR.reparentTo(hidden)
self.door.reparentTo(hidden)
self.title.reparentTo(self.frame)
self.convertingVotesToBeansLabel.hide()
self.rewardDoubledJellybeanLabel.hide()
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
NametagGlobals.setForceOnscreenChat(False)
@ -623,7 +523,6 @@ class Purchase(PurchaseBase):
def enterPurchase(self):
PurchaseBase.enterPurchase(self)
self.convertingVotesToBeansLabel.hide()
self.rewardDoubledJellybeanLabel.hide()
self.bg.reparentTo(render)
base.setBackgroundColor(0.78, 0.65, 0.53)
@ -640,9 +539,6 @@ class Purchase(PurchaseBase):
if not config.GetBool('disable-purchase-timer', 0):
self.timer.show()
self.timer.countdown(self.remain, self.__timerExpired)
if config.GetBool('metagame-disable-playAgain', 0):
if self.metagameRound > -1:
self.disablePlayAgain()
else:
self.timer.hide()
self.disablePlayAgain()
@ -655,7 +551,7 @@ class Purchase(PurchaseBase):
headFrame.hide()
messenger.send('gagScreenIsUp')
if base.autoPlayAgain or self.doMetagamePlayAgain():
if base.autoPlayAgain:
base.transitions.fadeOut(0)
self.__handlePlayAgain()
@ -672,7 +568,7 @@ class Purchase(PurchaseBase):
self.statusLabel.reparentTo(self.frame)
self.ignore('purchaseStateChange')
base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
if base.autoPlayAgain or self.doMetagamePlayAgain():
if base.autoPlayAgain:
base.transitions.fadeIn()
def disableBackToPlayground(self):
@ -698,20 +594,6 @@ class Purchase(PurchaseBase):
def handleGagTutorialDone(self):
self.enableBackToPlayground()
def doMetagamePlayAgain(self):
if hasattr(self, 'metagamePlayAgainResult'):
return self.metagamePlayAgainResult
numToons = 0
for avId in self.ids:
if avId in base.cr.doId2do and avId not in self.unexpectedExits:
numToons += 1
self.metagamePlayAgainResult = False
if numToons > 1:
if self.metagameRound > -1 and self.metagameRound < TravelGameGlobals.FinalMetagameRoundIndex:
self.metagamePlayAgainResult = True
return self.metagamePlayAgainResult
def setupUnexpectedExitHooks(self):
for avId in self.ids:
if avId in base.cr.doId2do:

View file

@ -1,26 +0,0 @@
from toontown.toonbase import ToontownGlobals
ALLOW_TEMP_MINIGAMES = simbase.config.GetBool('allow-temp-minigames', False)
TEMP_MG_ID_COUNTER = ToontownGlobals.TravelGameId - 1
TempMgCtors = {}
def _printMessage(message):
print '\n\n!!!', message, '\n\n'
def _registerTempMinigame(name, Class, id, minPlayers = 1, maxPlayers = 4):
if not ALLOW_TEMP_MINIGAMES:
_printMessage('registerTempMinigame WARNING: allow-temp-minigames config is set to false, but we are trying to register temp minigame ' + name)
import traceback
traceback.print_stack()
return
ToontownGlobals.MinigameIDs += (id,)
ToontownGlobals.MinigameNames[name] = id
TempMgCtors[id] = Class
for i in xrange(minPlayers, maxPlayers):
ToontownGlobals.MinigamePlayerMatrix[i] += (id,)
_printMessage('registerTempMinigame: ' + name)
if ALLOW_TEMP_MINIGAMES:
pass

View file

@ -1,184 +0,0 @@
DefaultStartingVotes = 5
FinalMetagameRoundIndex = 5
BaseBeans = 10
PercentOfVotesConverted = {1: 50,
2: 33,
3: 66,
4: 100}
InputTimeout = 15
MaxDirections = 2
ReasonVote = 0
ReasonPlaceDecider = 1
ReasonRandom = 2
DisplayVotesTimePerPlayer = 2
MoveTrolleyTime = 5
FudgeTime = 0
SpoofFour = False
ReverseWin = False
xInc = 60
yInc = 15
BoardLayout4VotingRounds = {0: {'links': (1, 2),
'pos': (0, 0, 0)},
1: {'links': (3, 4),
'pos': (xInc, yInc, 0)},
2: {'links': (4, 5),
'pos': (xInc, -yInc, 0)},
3: {'links': (6, 7),
'pos': (2 * xInc, 2 * yInc, 0)},
4: {'links': (7, 8),
'pos': (2 * xInc, 0, 0)},
5: {'links': (8, 9),
'pos': (2 * xInc, -2 * yInc, 0)},
6: {'links': (10, 11),
'pos': (3 * xInc, 3 * yInc, 0)},
7: {'links': (11, 12),
'pos': (3 * xInc, yInc, 0)},
8: {'links': (12, 13),
'pos': (3 * xInc, -yInc, 0)},
9: {'links': (13, 14),
'pos': (3 * xInc, -3 * yInc, 0)},
10: {'links': (),
'pos': (4 * xInc, 4 * yInc, 0),
'baseBonus': 3},
11: {'links': (),
'pos': (4 * xInc, 2 * yInc, 0),
'baseBonus': 2},
12: {'links': (),
'pos': (4 * xInc, 0, 0),
'baseBonus': 1},
13: {'links': (),
'pos': (4 * xInc, -2 * yInc, 0),
'baseBonus': 2},
14: {'links': (),
'pos': (4 * xInc, -4 * yInc, 0),
'baseBonus': 3}}
BoardLayout0 = {0: {'links': (1, 2),
'pos': (0, 0, 0)},
1: {'links': (3, 4),
'pos': (xInc, 2 * yInc, 0)},
2: {'links': (4, 5),
'pos': (xInc, -2 * yInc, 0)},
3: {'links': (6, 7),
'pos': (2 * xInc, 4 * yInc, 0)},
4: {'links': (8, 9),
'pos': (2 * xInc, 0, 0)},
5: {'links': (10, 11),
'pos': (2 * xInc, -4 * yInc, 0)},
6: {'links': (),
'pos': (3 * xInc, 5 * yInc, 0),
'baseBonus': 2},
7: {'links': (),
'pos': (3 * xInc, 3 * yInc, 0),
'baseBonus': 2},
8: {'links': (),
'pos': (3 * xInc, 1 * yInc, 0),
'baseBonus': 1},
9: {'links': (),
'pos': (3 * xInc, -1 * yInc, 0),
'baseBonus': 1},
10: {'links': (),
'pos': (3 * xInc, -3 * yInc, 0),
'baseBonus': 2},
11: {'links': (),
'pos': (3 * xInc, -5 * yInc, 0),
'baseBonus': 2}}
BoardLayout1 = {0: {'links': (1, 2),
'pos': (0, 0, 0)},
1: {'links': (3, 4),
'pos': (xInc, 3 * yInc, 0)},
2: {'links': (5, 6),
'pos': (xInc, -3 * yInc, 0)},
3: {'links': (7, 8),
'pos': (2 * xInc, 4 * yInc, 0)},
4: {'links': (8, 9),
'pos': (2 * xInc, 2 * yInc, 0)},
5: {'links': (10, 11),
'pos': (2 * xInc, -2 * yInc, 0)},
6: {'links': (11, 12),
'pos': (2 * xInc, -4 * yInc, 0)},
7: {'links': (),
'pos': (3 * xInc, 5 * yInc, 0),
'baseBonus': 2},
8: {'links': (),
'pos': (3 * xInc, 3 * yInc, 0),
'baseBonus': 1},
9: {'links': (),
'pos': (3 * xInc, 1 * yInc, 0),
'baseBonus': 2},
10: {'links': (),
'pos': (3 * xInc, -1 * yInc, 0),
'baseBonus': 2},
11: {'links': (),
'pos': (3 * xInc, -3 * yInc, 0),
'baseBonus': 1},
12: {'links': (),
'pos': (3 * xInc, -5 * yInc, 0),
'baseBonus': 2}}
BoardLayout2 = {0: {'links': (1, 2),
'pos': (0, 0, 0)},
1: {'links': (3, 4),
'pos': (xInc, 3 * yInc, 0)},
2: {'links': (5, 6),
'pos': (xInc, -3 * yInc, 0)},
3: {'links': (7, 8),
'pos': (2 * xInc, 4 * yInc, 0)},
4: {'links': (8, 9),
'pos': (2 * xInc, 2 * yInc, 0)},
5: {'links': (9, 10),
'pos': (2 * xInc, 0 * yInc, 0)},
6: {'links': (11, 12),
'pos': (2 * xInc, -4 * yInc, 0)},
7: {'links': (),
'pos': (3 * xInc, 5 * yInc, 0),
'baseBonus': 2},
8: {'links': (),
'pos': (3 * xInc, 3 * yInc, 0),
'baseBonus': 1},
9: {'links': (),
'pos': (3 * xInc, 1 * yInc, 0),
'baseBonus': 1},
10: {'links': (),
'pos': (3 * xInc, -1 * yInc, 0),
'baseBonus': 2},
11: {'links': (),
'pos': (3 * xInc, -3 * yInc, 0),
'baseBonus': 2},
12: {'links': (),
'pos': (3 * xInc, -5 * yInc, 0),
'baseBonus': 2}}
BoardLayout3 = {0: {'links': (1, 2),
'pos': (0, 0, 0)},
1: {'links': (3, 4),
'pos': (xInc, 2 * yInc, 0)},
2: {'links': (5, 6),
'pos': (xInc, -3 * yInc, 0)},
3: {'links': (7, 8),
'pos': (2 * xInc, 4 * yInc, 0)},
4: {'links': (9, 10),
'pos': (2 * xInc, 0 * yInc, 0)},
5: {'links': (10, 11),
'pos': (2 * xInc, -2 * yInc, 0)},
6: {'links': (11, 12),
'pos': (2 * xInc, -4 * yInc, 0)},
7: {'links': (),
'pos': (3 * xInc, 5 * yInc, 0),
'baseBonus': 2},
8: {'links': (),
'pos': (3 * xInc, 3 * yInc, 0),
'baseBonus': 2},
9: {'links': (),
'pos': (3 * xInc, 1 * yInc, 0),
'baseBonus': 2},
10: {'links': (),
'pos': (3 * xInc, -1 * yInc, 0),
'baseBonus': 1},
11: {'links': (),
'pos': (3 * xInc, -3 * yInc, 0),
'baseBonus': 1},
12: {'links': (),
'pos': (3 * xInc, -5 * yInc, 0),
'baseBonus': 2}}
BoardLayouts = (BoardLayout0,
BoardLayout1,
BoardLayout2,
BoardLayout3)

View file

@ -1,108 +0,0 @@
from direct.gui.DirectGui import DirectFrame, DGG, DirectLabel
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
from pandac.PandaModules import Point3, TextNode
from toontown.minigame import TravelGameGlobals
from toontown.toonbase import TTLocalizer
from direct.interval.IntervalGlobal import Parallel, Sequence, LerpFunc, Func, Wait
class VoteResultsPanel(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('VoteResultsPanel')
def __init__(self, numPlayers, avIdList, votes, directions, namesList, disconnectedList, directionToGo, directionReason, directionTotals, *args, **kwargs):
opts = {'relief': None,
'geom': DGG.getDefaultDialogGeom(),
'geom_color': ToontownGlobals.GlobalDialogColor[:3] + (0.8,),
'geom_scale': (1.75, 1, 0.75),
'pos': (0, 0, 0.525)}
opts.update(kwargs)
DirectFrame.__init__(self, *args, **opts)
self.initialiseoptions(VoteResultsPanel)
listMultiplier = 1
if TravelGameGlobals.SpoofFour:
listMultiplier = 4
self.avIdList = avIdList * listMultiplier
self.numPlayers = numPlayers * listMultiplier
self.votes = votes * listMultiplier
self.directions = directions * listMultiplier
self.namesList = namesList * listMultiplier
self.disconnectedList = disconnectedList * listMultiplier
self.directionToGo = directionToGo
self.directionReason = directionReason
self.directionTotals = directionTotals
self.entryList = []
self.rowFrame = []
self.upDownFrame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(-1))
self.upLabel = DirectLabel(parent=self.upDownFrame, relief=None, pos=(1.2, 0, 0.0), text=TTLocalizer.TravelGameDirections[0], text_fg=(0.0, 0.0, 1.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.downLabel = DirectLabel(parent=self.upDownFrame, relief=None, pos=(1.43, 0, 0.0), text=TTLocalizer.TravelGameDirections[1], text_fg=(1.0, 0.0, 0.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.totalFrame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(self.numPlayers))
self.totalText = DirectLabel(parent=self.totalFrame, relief=None, pos=(1.0, 0, 0.0), text='Total', text_fg=(0.0, 0.0, 0.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.totalVotesUpLabel = DirectLabel(parent=self.totalFrame, relief=None, pos=(1.2, 0, 0.0), text='', text_fg=(0.0, 0.0, 1.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.totalVotesDownLabel = DirectLabel(parent=self.totalFrame, relief=None, pos=(1.43, 0, 0.0), text='', text_fg=(1.0, 0.0, 0.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.totalVotesLabels = [self.totalVotesUpLabel, self.totalVotesDownLabel]
self.resultFrame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(5))
self.resultLabel = DirectLabel(parent=self.resultFrame, text='', text_scale=0.06, pos=(0.7, 0, 0.0), text_align=TextNode.ACenter)
self.setupResultLabel()
for index in xrange(self.numPlayers):
frame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(index))
self.rowFrame.append(frame)
nameLabel = DirectFrame(parent=frame, relief=None, pos=(0.46, 0.0, 0.0), text=self.namesList[index], text_fg=(0.0, 0.0, 0.0, 1.0), text_scale=0.05, text_align=TextNode.ACenter, text_font=DGG.getDefaultFont())
votesUpLabel = DirectLabel(parent=frame, relief=None, pos=(1.2, 0.0, 0.0), text='', text_fg=(0, 0, 1, 1), text_scale=0.05, text_align=TextNode.ARight, text_font=DGG.getDefaultFont())
votesDownLabel = DirectLabel(parent=frame, relief=None, pos=(1.43, 0.0, 0.0), text='', text_fg=(1, 0, 0, 1), text_scale=0.05, text_align=TextNode.ARight, text_font=DGG.getDefaultFont())
nameLabel.hide()
self.entryList.append((nameLabel, votesUpLabel, votesDownLabel))
return
def getRowPos(self, place):
return Point3(-0.72, -0.01, 0.2 - place * 0.1)
def setupResultLabel(self):
reasonStr = ''
if self.directionReason == TravelGameGlobals.ReasonVote:
reasonStr = TTLocalizer.TravelGameReasonVotes % {'dir': TTLocalizer.TravelGameDirections[self.directionToGo],
'numVotes': self.directionTotals[self.directionToGo]}
elif self.directionReason == TravelGameGlobals.ReasonRandom:
reasonStr = TTLocalizer.TravelGameReasonRandom % {'dir': TTLocalizer.TravelGameDirections[self.directionToGo],
'numVotes': self.directionTotals[self.directionToGo]}
elif self.directionReason == TravelGameGlobals.ReasonPlaceDecider:
reasonStr = TravelGameReasonPlace % {'name': 'TODO NAME',
'dir': TTLocalizer.TravelGameDirections[self.directionToGo]}
self.resultLabel['text'] = reasonStr
self.resultLabel.hide()
def createOnePlayerSequence(self, index, duration):
numVotes = self.votes[index]
direction = self.directions[index]
def ticketTicker(t, label = self.entryList[index][direction + 1], startVotes = 0, endVotes = numVotes):
label['text'] = str(int(t * endVotes + startVotes))
track = Parallel()
track.append(Func(self.entryList[index][0].show, name='showName %d' % index))
track.append(LerpFunc(ticketTicker, duration=duration, name='countVotes %d' % index))
startVotes = 0
for prev in xrange(index):
if self.directions[prev] == direction:
startVotes += self.votes[prev]
def totalTicker(t, label = self.totalVotesLabels[direction], startVotes = startVotes, additionalVotes = numVotes):
label['text'] = str(int(t * additionalVotes + startVotes))
track.append(LerpFunc(totalTicker, duration=duration, name='countTotal %d' % index))
return track
def startMovie(self):
self.movie = Sequence()
for index in xrange(self.numPlayers):
track = self.createOnePlayerSequence(index, 1.25)
self.movie.append(track)
self.movie.append(Wait(0.75))
self.movie.append(Func(self.resultLabel.show))
self.movie.append(Wait(2.0))
self.movie.start()
def destroy(self):
self.movie.finish()
DirectFrame.destroy(self)

View file

@ -1,225 +0,0 @@
from direct.gui.DirectGui import DirectFrame, DGG, DirectLabel
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
from pandac.PandaModules import Point3, TextNode, Vec4
from toontown.minigame import TravelGameGlobals
from toontown.toonbase import TTLocalizer
from direct.interval.IntervalGlobal import Parallel, Sequence, LerpFunc, Func, Wait, SoundInterval
from direct.showbase.PythonUtil import pdir
class VoteResultsTrolleyPanel(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('VoteResultsTrolleyPanel')
def __init__(self, numPlayers, avIdList, votes, directions, namesList, disconnectedList, directionToGo, directionReason, directionTotals, *args, **kwargs):
opts = {'relief': None,
'geom': DGG.getDefaultDialogGeom(),
'geom_color': ToontownGlobals.GlobalDialogColor[:3] + (0.8,),
'geom_scale': (1.75, 1, 0.25),
'pos': (0, 0, 0.825)}
opts.update(kwargs)
DirectFrame.__init__(self, *args, **opts)
self.initialiseoptions(VoteResultsTrolleyPanel)
listMultiplier = 1
if TravelGameGlobals.SpoofFour:
listMultiplier = 4
self.avIdList = avIdList * listMultiplier
self.numPlayers = numPlayers * listMultiplier
self.votes = votes * listMultiplier
self.directions = directions * listMultiplier
self.namesList = namesList * listMultiplier
self.disconnectedList = disconnectedList * listMultiplier
self.directionToGo = directionToGo
self.directionReason = directionReason
self.directionTotals = directionTotals
self.entryList = []
self.rowFrame = []
self.upDownFrame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(-1))
self.upLabel = DirectLabel(parent=self, relief=None, pos=(-0.5, 0, 0.06), text=TTLocalizer.TravelGameDirections[0] + ':', text_fg=(0.0, 0.0, 1.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.downLabel = DirectLabel(parent=self, relief=None, pos=(0.5, 0, 0.06), text=TTLocalizer.TravelGameDirections[1] + ':', text_fg=(1.0, 0.0, 0.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.totalVotesUpLabel = DirectLabel(parent=self.upLabel, relief=None, pos=(0.2, 0, 0.0), text='0', text_fg=(0.0, 0.0, 1.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.totalVotesDownLabel = DirectLabel(parent=self.downLabel, relief=None, pos=(0.2, 0, 0.0), text='0', text_fg=(1.0, 0.0, 0.0, 1.0), text_scale=0.05, text_align=TextNode.ARight)
self.totalFrame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(self.numPlayers))
self.totalVotesLabels = [self.totalVotesUpLabel, self.totalVotesDownLabel]
self.resultFrame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(0.5))
self.resultLabel = DirectLabel(parent=self.resultFrame, text='', text_scale=0.06, pos=(0.7, 0, 0.0), text_align=TextNode.ACenter)
self.setupResultLabel()
for index in xrange(self.numPlayers):
frame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(index))
self.rowFrame.append(frame)
nameLabel = DirectFrame(parent=frame, relief=None, pos=(0.46, 0.0, 0.0), text=self.namesList[index], text_fg=(0.0, 0.0, 0.0, 1.0), text_scale=0.05, text_align=TextNode.ACenter, text_font=DGG.getDefaultFont())
votesUpLabel = DirectLabel(parent=frame, relief=None, pos=(1.2, 0.0, 0.0), text='', text_fg=(0, 0, 1, 1), text_scale=0.05, text_align=TextNode.ARight, text_font=DGG.getDefaultFont())
votesDownLabel = DirectLabel(parent=frame, relief=None, pos=(1.43, 0.0, 0.0), text='', text_fg=(1, 0, 0, 1), text_scale=0.05, text_align=TextNode.ARight, text_font=DGG.getDefaultFont())
nameLabel.hide()
self.entryList.append((nameLabel, votesUpLabel, votesDownLabel))
self.avVotesLabel = {}
self.avArrows = {}
matchingGameGui = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
minnieArrow = matchingGameGui.find('**/minnieArrow')
from toontown.minigame.DistributedTravelGame import map3dToAspect2d
for index in xrange(self.numPlayers):
avId = self.avIdList[index]
av = base.cr.doId2do.get(avId)
if av:
height = av.getHeight()
avPos = av.getPos(render)
avPos.setZ(av.getZ() + 5)
labelPos = map3dToAspect2d(render, avPos)
if not labelPos:
continue
labelPos.setZ(labelPos.getZ() + 0.3)
arrow = None
if self.votes[index] > 0:
arrow = aspect2d.attachNewNode('avArrow')
minnieArrow.copyTo(arrow)
arrow.setScale(1.1, 1, 1.15)
arrow.setPos(labelPos)
if self.directions[index] == 0:
arrow.setR(-90)
arrow.setColorScale(0, 0, 1, 1)
else:
arrow.setR(90)
arrow.setColorScale(1, 0, 0, 1)
arrow.wrtReparentTo(self.resultFrame)
arrow.hide()
self.avArrows[index] = arrow
fgColor = Vec4(0, 0, 0, 1)
if self.votes[index] > 0:
if self.directions[index] == 0:
fgColor = Vec4(0, 0, 1, 1)
else:
fgColor = Vec4(1, 0, 0, 1)
if self.votes[index] > 0:
newLabel = DirectLabel(parent=aspect2d, relief=None, pos=labelPos, text='test', text_fg=(1, 1, 1, 1), text_scale=0.1, text_align=TextNode.ACenter, text_font=ToontownGlobals.getSignFont(), text_pos=(0, -0.01, 0))
else:
newLabel = DirectLabel(parent=aspect2d, geom=DGG.getDefaultDialogGeom(), geom_scale=(0.2, 1, 0.2), relief=None, pos=labelPos, text='test', text_fg=(0.5, 0.5, 0.5, 1), text_scale=0.1, text_align=TextNode.ACenter, text_font=ToontownGlobals.getSignFont(), text_pos=(0, -0.035, 0))
newLabel.wrtReparentTo(self.resultFrame)
newLabel.hide()
self.avVotesLabel[index] = newLabel
matchingGameGui.removeNode()
self.curArrowSfxIndex = 0
self.upArrowSfx = []
self.downArrowSfx = []
for i in xrange(5):
self.upArrowSfx.append(base.loadSfx('phase_4/audio/sfx/MG_sfx_travel_game_blue_arrow.ogg'))
self.downArrowSfx.append(base.loadSfx('phase_4/audio/sfx/MG_sfx_travel_game_red_arrow.ogg'))
self.winVoteSfx = base.loadSfx('phase_4/audio/sfx/MG_sfx_travel_game_win_vote.ogg')
self.noVoteSfx = base.loadSfx('phase_4/audio/sfx/MG_sfx_travel_game_square_no_vote_1.ogg')
self.loseVoteSfx = base.loadSfx('phase_4/audio/sfx/MG_sfx_travel_game_lose_vote.ogg')
self.localAvatarWon = False
self.localAvatarLost = False
localIndex = self.avIdList.index(base.localAvatar.doId)
localDirection = self.directions[localIndex]
localVotes = self.votes[localIndex]
if localVotes:
if localDirection == self.directionToGo:
if not TravelGameGlobals.ReverseWin:
self.localAvatarWon = True
else:
self.localAvatarLost = True
elif not TravelGameGlobals.ReverseWin:
self.localAvatarLost = True
else:
self.localAvatarWon = True
return
def getRowPos(self, place):
return Point3(-0.72, -0.01, 0.0 - place * 0.1)
def setupResultLabel(self):
reasonStr = ''
if self.directionReason == TravelGameGlobals.ReasonVote:
if self.directionToGo == 0:
losingDirection = 1
else:
losingDirection = 0
diffVotes = self.directionTotals[self.directionToGo] - self.directionTotals[losingDirection]
if diffVotes > 1:
reasonStr = TTLocalizer.TravelGameReasonVotesPlural % {'dir': TTLocalizer.TravelGameDirections[self.directionToGo],
'numVotes': diffVotes}
else:
reasonStr = TTLocalizer.TravelGameReasonVotesSingular % {'dir': TTLocalizer.TravelGameDirections[self.directionToGo],
'numVotes': diffVotes}
elif self.directionReason == TravelGameGlobals.ReasonRandom:
reasonStr = TTLocalizer.TravelGameReasonRandom % {'dir': TTLocalizer.TravelGameDirections[self.directionToGo],
'numVotes': self.directionTotals[self.directionToGo]}
elif self.directionReason == TravelGameGlobals.ReasonPlaceDecider:
reasonStr = TravelGameReasonPlace % {'name': 'TODO NAME',
'dir': TTLocalizer.TravelGameDirections[self.directionToGo]}
self.resultLabel['text'] = reasonStr
self.resultLabel.hide()
def createOnePlayerSequence(self, index, duration):
numVotes = self.votes[index]
direction = self.directions[index]
def ticketTicker(t, label = self.entryList[index][direction + 1], startVotes = 0, endVotes = numVotes):
label['text'] = str(int(t * endVotes + startVotes))
track = Parallel()
startVotes = 0
for prev in xrange(index):
if self.directions[prev] == direction:
startVotes += self.votes[prev]
def totalTicker(t, label = self.totalVotesLabels[direction], startVotes = startVotes, additionalVotes = numVotes):
label['text'] = str(int(t * additionalVotes + startVotes))
track.append(LerpFunc(totalTicker, duration=duration, name='countTotal %d' % index))
if index in self.avVotesLabel:
def avVotesTicker(t, label = self.avVotesLabel[index], startVotes = 0, endVotes = numVotes, direction = direction):
oldValue = label['text']
newValue = int(t * endVotes + startVotes)
label['text'] = str(newValue)
if not oldValue == label['text']:
if newValue:
if direction == 0:
self.upArrowSfx[self.curArrowSfxIndex].play()
else:
self.downArrowSfx[self.curArrowSfxIndex].play()
self.curArrowSfxIndex += 1
if self.curArrowSfxIndex >= len(self.upArrowSfx):
self.curArrowSfxIndex = 0
label = self.avVotesLabel[index]
track.append(Func(self.avVotesLabel[index].show, name='showName %d' % index))
if index in self.avArrows:
track.append(Func(self.avArrows[index].show, name='showArrow %d' % index))
if direction == 0 and numVotes:
pass
elif direction == 1 and numVotes:
pass
else:
track.append(SoundInterval(self.noVoteSfx))
track.append(LerpFunc(avVotesTicker, duration=duration, name='countAvVotes %d' % index))
return track
def startMovie(self):
self.movie = Sequence()
for index in xrange(self.numPlayers):
track = self.createOnePlayerSequence(index, 1.25)
self.movie.append(track)
self.movie.append(Wait(0.75))
self.movie.append(Func(self.resultLabel.show))
soundAndWait = Parallel()
soundAndWait.append(Wait(2.0))
if self.localAvatarWon:
soundAndWait.append(SoundInterval(self.winVoteSfx))
elif self.localAvatarLost:
soundAndWait.append(SoundInterval(self.loseVoteSfx, duration=0.43))
self.movie.append(soundAndWait)
self.movie.start()
def destroy(self):
self.movie.finish()
del self.movie
del self.winVoteSfx
del self.noVoteSfx
del self.upArrowSfx
del self.loseVoteSfx
del self.downArrowSfx
DirectFrame.destroy(self)

View file

@ -270,18 +270,8 @@ class DistributedTrolleyAI(DistributedObjectAI.DistributedObjectAI):
for i in self.seats:
if i not in [None, 0]:
playerArray.append(i)
startingVotes = None
metagameRound = -1
trolleyGoesToMetagame = simbase.config.GetBool('want-travel-game', 0)
trolleyHoliday = bboard.get(TrolleyHolidayMgrAI.TrolleyHolidayMgrAI.PostName)
trolleyWeekend = bboard.get(TrolleyWeekendMgrAI.TrolleyWeekendMgrAI.PostName)
if trolleyGoesToMetagame and (trolleyHoliday or trolleyWeekend):
metagameRound = 0
if len(playerArray) == 1:
metagameRound = -1
mgDict = MinigameCreatorAI.createMinigame(
self.air, playerArray, self.zoneId, newbieIds=newbieIds,
startingVotes=startingVotes, metagameRound=metagameRound)
self.air, playerArray, self.zoneId, newbieIds=newbieIds)
minigameZone = mgDict['minigameZone']
minigameId = mgDict['minigameId']
for seatIndex in xrange(len(self.seats)):

View file

@ -3,7 +3,6 @@ from PurchaseManagerConstants import *
from direct.distributed.ClockDelta import *
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from toontown.minigame import TravelGameGlobals
class PurchaseManager(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('PurchaseManager')
@ -59,14 +58,10 @@ class PurchaseManager(DistributedObject.DistributedObject):
self.moneyArray,
self.avIds,
self.playerStates,
remain,
self.metagameRound,
self.votesArray])
remain])
def calcHasLocalToon(self):
retval = base.localAvatar.doId not in self.newbieIds and base.localAvatar.doId in self.avIds
if self.metagameRound > -1 and self.metagameRound < TravelGameGlobals.FinalMetagameRoundIndex:
retval = base.localAvatar.doId in self.avIds
self.notify.debug('calcHasLocalToon returning %s' % retval)
return retval
@ -97,12 +92,4 @@ class PurchaseManager(DistributedObject.DistributedObject):
if self.hasLocalToon:
self.ignore('boughtGag')
self.d_setInventory(base.localAvatar.inventory.makeNetString(), base.localAvatar.getMoney(), 1)
messenger.send('purchaseOver', [self.playAgain])
def setMetagameRound(self, round):
self.notify.debug('setMetagameRound: %s' % (round,))
self.metagameRound = round
def setVotesArray(self, votesArray):
self.notify.debug('setVotesArray: %s' % votesArray)
self.votesArray = votesArray
messenger.send('purchaseOver', [self.playAgain])

View file

@ -6,14 +6,13 @@ import copy
from direct.task.Task import Task
from direct.distributed import DistributedObjectAI
from direct.directnotify import DirectNotifyGlobal
from toontown.minigame import TravelGameGlobals
from toontown.toonbase import ToontownGlobals
from toontown.minigame import MinigameGlobals
class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('PurchaseManagerAI')
def __init__(self, air, avArray, mpArray, previousMinigameId, trolleyZone, newbieIdList = [], votesArray = None, metagameRound = -1, desiredNextGame = None):
def __init__(self, air, avArray, mpArray, previousMinigameId, trolleyZone, newbieIdList = []):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.avIds = copy.deepcopy(avArray)
self.minigamePoints = copy.deepcopy(mpArray)
@ -21,12 +20,6 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI):
self.trolleyZone = trolleyZone
self.newbieIds = copy.deepcopy(newbieIdList)
self.isShutdown = 0
if votesArray:
self.votesArray = copy.deepcopy(votesArray)
else:
self.votesArray = []
self.metagameRound = metagameRound
self.desiredNextGame = desiredNextGame
for i in xrange(len(self.avIds), 4):
self.avIds.append(0)
@ -79,16 +72,6 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI):
self.trolleyZone,
self.avIds,
self.minigamePoints[avIndex]))
if self.metagameRound == TravelGameGlobals.FinalMetagameRoundIndex:
numPlayers = len(self.votesArray)
extraBeans = self.votesArray[avIndex] * TravelGameGlobals.PercentOfVotesConverted[numPlayers] / 100.0
if self.air.holidayManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY) or self.air.holidayManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH):
extraBeans *= MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier
av.addMoney(extraBeans)
self.air.writeServerEvent('minigame_extraBeans', avId, '%s|%s|%s|%s' % (self.previousMinigameId,
self.trolleyZone,
self.avIds,
extraBeans))
self.receivingInventory = 1
self.receivingButtons = 1
@ -104,15 +87,13 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI):
for avId in self.avIds:
if avId not in self.newbieIds:
avIds.append(avId)
elif self.metagameRound > -1 and self.metagameRound < TravelGameGlobals.FinalMetagameRoundIndex:
avIds.append(avId)
return avIds
def getMinigamePoints(self):
return self.minigamePoints
def getavIds(self):
def getAvIds(self):
return self.avIds
def getNewbieIds(self):
@ -255,18 +236,6 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI):
self.receivingInventory = 1
return None
def getVotesArrayMatchingPlayAgainList(self, playAgainList):
retval = []
for playAgainIndex in xrange(len(playAgainList)):
avId = playAgainList[playAgainIndex]
origIndex = self.avIds.index(avId)
if self.votesArray and origIndex < len(self.votesArray):
retval.append(self.votesArray[origIndex])
else:
retval.append(0)
return retval
def shutDown(self):
if self.isShutdown:
self.notify.warning('Got shutDown twice')
@ -275,20 +244,7 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI):
from toontown.minigame import MinigameCreatorAI
playAgainNum = self.getNumPlayAgain()
if playAgainNum > 0:
playAgainList = self.getPlayAgainList()
newVotesArray = self.getVotesArrayMatchingPlayAgainList(playAgainList)
newRound = self.metagameRound
newbieIdsToPass = []
if newRound > -1:
newbieIdsToPass = self.newbieIds
if newRound < TravelGameGlobals.FinalMetagameRoundIndex:
newRound += 1
else:
newRound = 0
newVotesArray = [TravelGameGlobals.DefaultStartingVotes] * len(playAgainList)
if len(playAgainList) == 1 and simbase.config.GetBool('metagame-min-2-players', 1):
newRound = -1
MinigameCreatorAI.createMinigame(self.air, playAgainList, self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=newbieIdsToPass, startingVotes=newVotesArray, metagameRound=newRound, desiredNextGame=self.desiredNextGame)
MinigameCreatorAI.createMinigame(self.air, self.getPlayAgainList(), self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=self.newbieIds)
else:
MinigameCreatorAI.releaseMinigameZone(self.zoneId)
self.requestDelete()
@ -358,10 +314,4 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI):
return
def handlePlayerLeaving(self, avId):
pass
def getMetagameRound(self):
return self.metagameRound
def getVotesArray(self):
return self.votesArray
pass

View file

@ -3473,13 +3473,11 @@ MusicCreateAToon = 'The New Toon in Town'
MusicTtuTheme = 'The Toontown United Theme'
MusicTtTheme = 'The Toontown Theme'
MusicMinigameRace = 'Slow and Steady'
MusicMgPairing = 'Remember Me?'
MusicTcNbrhood = 'Toontown Central'
MusicMgDiving = 'Treasure Lullaby'
MusicMgCannonGame = 'Fire the Cannons!'
MusicMgTwodgame = 'Running Toon'
MusicMgCogthief = 'Catch That Cog!'
MusicMgTravel = 'Traveling Music'
MusicMgTugOWar = 'Tug-of-War'
MusicMgVine = 'The Jungle Swing'
MusicMgIcegame = 'Slippery Situation'
@ -8275,32 +8273,6 @@ def getResultPlantedSomethingSentence(flowerName):
retval = ResultPlantedSomething % flowerName
return retval
TravelGameTitle = 'Trolley Tracks'
TravelGameInstructions = 'Click up or down to set your number of votes. Click the vote button to cast it. Reach your secret goal to get bonus beans. Earn more votes by doing well in the other games.'
TravelGameRemainingVotes = 'Remaining Votes:'
TravelGameUse = 'Use'
TravelGameVotesWithPeriod = 'votes.'
TravelGameVotesToGo = 'votes to go'
TravelGameVoteToGo = 'vote to go'
TravelGameUp = 'UP.'
TravelGameDown = 'DOWN.'
TravelGameVoteWithExclamation = 'Vote!'
TravelGameWaitingChoices = 'Waiting for other toons to vote...'
TravelGameDirections = ['UP', 'DOWN']
TravelGameTotals = 'Totals '
TravelGameReasonVotes = 'The trolley is moving %(dir)s, winning by %(numVotes)d votes.'
TravelGameReasonVotesPlural = 'The trolley is moving %(dir)s, winning by %(numVotes)d votes.'
TravelGameReasonVotesSingular = 'The trolley is moving %(dir)s, winning by %(numVotes)d vote.'
TravelGameReasonPlace = '%(name)s breaks the tie. The trolley is moving %(dir)s.'
TravelGameReasonRandom = 'The trolley is randomly moving %(dir)s.'
TravelGameOneToonVote = '%(name)s used %(numVotes)s votes to go %(dir)s\n'
TravelGameBonusBeans = '%(numBeans)d Beans'
TravelGamePlaying = 'Up next, the %(game)s trolley game.'
TravelGameGotBonus = '%(name)s got a bonus of %(numBeans)s Jellybeans!'
TravelGameNoOneGotBonus = 'No one reached their secret goal. Everyone gets 1 Jellybean.'
TravelGameConvertingVotesToBeans = 'Converting some votes to Jellybeans...'
TravelGameGoingBackToShop = "Only 1 toon left. Going to Goofy's Gag Shop."
TrolleyHolidayStart = 'Trolley Tracks is about to begin! Board any trolley with 2 or more toons to play.'
TrolleyHolidayOngoing = 'Welcome! Trolley Tracks is currently in progress.'
TrolleyHolidayEnd = "That's all for today's Trolley Tracks. See you next week!"

View file

@ -99,13 +99,6 @@ MPMgaugeTargetTop = 0.35
MPMgaugeTargetBot = 0.35
PstatusLabel = 0.08
PBstatusLabel = 0.08
DTGvoteButton = 0.07
DTGuseLabel = 0.1
DTGvotesPeriodLabel = 0.1
DTGvotesToGoLabel = 0.1
DTGupLabel = 0.125
DTGdownLabel = 0.125
DTGremainingVotesFrame = 0.7
CStoonFrame = 0.0575
NSmaxNameWidth = 8.0
NSdirectScrolleList = 0.1

View file

@ -347,7 +347,6 @@ IceGameId = 12
CogThiefGameId = 13
TwoDGameId = 14
PhotoGameId = 15
TravelGameId = 100
MinigameNames = {'race': RaceGameId,
'cannon': CannonGameId,
'tag': TagGameId,
@ -366,7 +365,7 @@ MinigameNames = {'race': RaceGameId,
'thief': CogThiefGameId,
'2d': TwoDGameId,
'photo': PhotoGameId,
'travel': TravelGameId}
'template': MinigameTemplateId}
MinigameTemplateId = -1
MinigameIDs = (RaceGameId,
CannonGameId,
@ -382,8 +381,7 @@ MinigameIDs = (RaceGameId,
IceGameId,
CogThiefGameId,
TwoDGameId,
PhotoGameId,
TravelGameId)
PhotoGameId)
MinigamePlayerMatrix = {
1: (CannonGameId, MazeGameId, TugOfWarGameId, RingGameId, VineGameId, CogThiefGameId, TwoDGameId, DivingGameId, CatchGameId, TargetGameId, PhotoGameId),
2: (CannonGameId, MazeGameId, TugOfWarGameId, PatternGameId, TagGameId, RingGameId, VineGameId, IceGameId, CogThiefGameId, TwoDGameId, DivingGameId, CatchGameId, TargetGameId, PhotoGameId),