Merge branch 'features/dan' into 'master'

Features/dan



See merge request !2
This commit is contained in:
Alexander Behrhof 2015-08-13 18:20:28 -04:00
commit 1ea800b4bd
79 changed files with 1616 additions and 12900 deletions

View file

@ -32,6 +32,7 @@ dclass Account {
string ACCOUNT_ID db;
uint16 ACCESS_LEVEL db;
uint32 LAST_LOGIN_TS db;
uint8[] CHAT_SETTINGS db;
};
struct BarrierData {
@ -237,6 +238,7 @@ from toontown.safezone import SafeZoneManager/AI
from toontown.tutorial import TutorialManager/AI
from toontown.catalog import CatalogManager/AI
from toontown.safezone import DistributedTreasure/AI
from toontown.safezone import DistributedEFlyingTreasure/AI
from toontown.coghq import DistributedCashbotBossTreasure/AI
from toontown.building import DistributedTrophyMgr/AI
from toontown.building import DistributedBuilding/AI
@ -1522,6 +1524,9 @@ dclass DistributedTreasure : DistributedObject {
setReject() broadcast;
};
dclass DistributedEFlyingTreasure : DistributedTreasure {
};
dclass DistributedCashbotBossTreasure : DistributedTreasure {
setGoonId(uint32) required broadcast ram;
setFinalPosition(int16/10, int16/10, int16/10) required broadcast ram;
@ -3150,7 +3155,7 @@ dclass ClientServicesManager : DistributedObjectGlobal {
acceptLogin(uint32 timestamp);
requestAvatars() clsend;
setAvatars(PotentialToon[]);
setAvatars(uint8[], PotentialToon[]);
createAvatar(blob dna, uint8 index) clsend;
createAvatarResp(uint32 avId);
@ -3197,7 +3202,7 @@ dclass TTSFriendsManager : DistributedObjectGlobal {
goingOffline(uint32 avId);
getAvatarDetails(uint32) clsend;
friendDetails(uint32, blob, uint16[], uint16, int16, int16, uint32, uint32, blob, blob, int8[]);
friendDetails(uint32, blob, uint16[], int16, int16, uint32, uint32, blob, blob, int8[]);
getPetDetails(uint32) clsend;
petDetails(uint32, uint32, string, uint32, uint32, uint16/1000[], PetTrait[], int8[], uint32);

View file

@ -33,7 +33,8 @@ want-gifting #t
want-top-toons #f
# Chat:
want-whitelist #t
want-whitelist #f
want-sequence-list #f
# Developer options:
show-population #t

View file

@ -1,12 +1,9 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject
from otp.ai.MagicWordGlobal import *
lastClickedNametag = None
class MagicWordManager(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('MagicWordManager')
neverDisable = 1
@ -20,6 +17,9 @@ class MagicWordManager(DistributedObject.DistributedObject):
DistributedObject.DistributedObject.disable(self)
def handleMagicWord(self, magicWord):
if not base.localAvatar.isAdmin():
return
if magicWord.startswith('~~'):
if lastClickedNametag == None:
target = base.localAvatar
@ -32,6 +32,7 @@ class MagicWordManager(DistributedObject.DistributedObject):
targetId = target.doId
self.sendUpdate('sendMagicWord', [magicWord, targetId])
if target == base.localAvatar:
response = spellbook.process(base.localAvatar, target, magicWord)
if response:

View file

@ -116,16 +116,16 @@ class Avatar(Actor, ShadowCaster):
elif self.playerType not in (NametagGroup.CCNormal, NametagGroup.CCSpeedChat):
self.understandable = 1
self.setPlayerType(NametagGroup.CCNonPlayer)
elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId):
elif base.localAvatar.isTrueFriends(self.doId):
self.understandable = 2
self.setPlayerType(NametagGroup.CCNormal)
elif settings['speedchatPlus']:
elif base.cr.wantSpeedchatPlus():
self.understandable = 1
self.setPlayerType(NametagGroup.CCSpeedChat)
else:
self.understandable = 0
self.setPlayerType(NametagGroup.CCSpeedChat)
if hasattr(self, 'adminAccess') and self.isAdmin():
if base.cr.wantSpeedchatPlus() and hasattr(self, 'adminAccess') and self.isAdmin() and self != base.localAvatar:
self.understandable = 2
if not hasattr(self, 'nametag'):
self.notify.warning('no nametag attributed, but would have been used')

View file

@ -29,7 +29,11 @@ class WhiteList:
return i != self.numWords and self.words[i].startswith(text)
def getReplacement(self, text, av=None, garbler=None):
return '\x01WLRed\x01%s\x02' % text if not garbler else garbler.garble(av, len(text.split(' ')))
if av and av == base.localAvatar:
return '\x01WLDisplay\x01%s\x02' % text
elif not garbler:
return '\x01WLRed\x01%s\x02' % text
return garbler.garble(av, len(text.split(' ')))
def processText(self, text, av=None, garbler=None):
if not self.words:

View file

@ -693,6 +693,18 @@ class OTPClientRepository(ClientRepositoryBase):
def handleAvatarsList(self, avatars):
self.avList = avatars
self.loginFSM.request('chooseAvatar', [self.avList])
def handleChatSettings(self, chatSettings):
self.chatSettings = chatSettings
def wantSpeedchatPlus(self):
return self.chatSettings[0]
def wantTrueFriends(self):
return self.chatSettings[1]
def wantTypedChat(self):
return self.wantSpeedchatPlus() or self.wantTrueFriends()
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterChooseAvatar(self, avList):

View file

@ -202,4 +202,4 @@ WHISPER_COLORS = {
}
def getFriendColor(handle):
return CCNormal if settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat
return CCNormal if base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat

View file

@ -1,6 +1,7 @@
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import globalClockDelta
from direct.task import Task
from otp.ai.MagicWordGlobal import *
from toontown.effects.DistributedFireworkShowAI import DistributedFireworkShowAI
from toontown.effects import FireworkShows
from toontown.toonbase import ToontownGlobals
@ -18,19 +19,21 @@ class NewsManagerAI(DistributedObjectAI):
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
self.__checkHolidays()
self.checkTask = taskMgr.doMethodLater(15, self.__checkHolidays, 'holidayCheckTask')
self.accept('avatarEntered', self.__handleAvatarEntered)
taskMgr.doMethodLater(15, self.__checkHolidays, 'holidayCheckTask')
def delete(self):
DistributedObjectAI.delete(self)
taskMgr.remove(self.checkTask)
self.deleteTasks()
def deleteTasks(self):
taskMgr.remove('holidayCheckTask')
self.deleteFireworkTasks()
def deleteFireworkTasks(self):
if self.fireworkTasks:
for task in self.fireworkTasks:
taskMgr.remove(task)
self.fireworkTasks = []
for task in self.fireworkTasks:
taskMgr.remove(task)
self.fireworkTasks = []
def __handleAvatarEntered(self, av):
avId = av.getDoId()
@ -64,41 +67,44 @@ class NewsManagerAI(DistributedObjectAI):
else:
return HolidayGlobals.getStartDate(holiday) <= date <= HolidayGlobals.getEndDate(holiday)
def isHolidayRunning(self, id):
return id in self.activeHolidays
def isHolidayRunning(self, *args):
for id in args:
if id in self.activeHolidays:
return True
def startHoliday(self, id):
if id in self.activeHolidays or id not in HolidayGlobals.Holidays:
return
return False
self.activeHolidays.append(id)
self.startSpecialHoliday(id)
self.sendUpdate('startHoliday', [id])
return True
def endHoliday(self, id):
if id not in self.activeHolidays or id not in HolidayGlobals.Holidays:
return
return False
self.activeHolidays.remove(id)
self.endSpecialHoliday(id)
self.sendUpdate('endHoliday', [id])
return True
def startSpecialHoliday(self, id):
if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY:
messenger.send('checkBingoState')
messenger.send('startBingo')
elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]:
self.fireworkTasks.append(taskMgr.doMethodLater((60 - datetime.datetime.now().minute) * 60, self.startFireworkTask, 'initialFireworkTask-%s' % id, extraArgs=[id]))
def endSpecialHoliday(self, id):
if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY:
messenger.send('checkBingoState')
messenger.send('stopBingo')
elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]:
self.deleteFireworkTasks()
def startFireworkTask(self, id, task=None):
self.startFireworks(id)
self.fireworkTasks.append(taskMgr.doMethodLater(3600, self.startFireworks, 'fireworkTask-%s' % id, extraArgs=[id]))
return Task.done
def startFireworks(self, type, task=None):
maxShow = len(FireworkShows.shows.get(type, [])) - 1
@ -112,3 +118,31 @@ class NewsManagerAI(DistributedObjectAI):
fireworkShow.b_startShow(type, random.randint(0, maxShow), globalClockDelta.getRealNetworkTime())
return Task.again
@magicWord(category=CATEGORY_PROGRAMMER)
def newsShutdown():
"""
Shutdown the news manager tasks.
"""
simbase.air.newsManager.deleteTasks()
return 'News manager shut down!'
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
def startHoliday(holiday):
"""
Start a holiday.
"""
if simbase.air.newsManager.startHoliday(holiday):
return 'Started holiday %s!' % holiday
return 'Holiday %s is already running!' % holiday
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
def stopHoliday(holiday):
"""
Stop a holiday.
"""
if simbase.air.newsManager.endHoliday(holiday):
return 'Stopped holiday %s!' % holiday
return 'Holiday %s is not running!' % holiday

View file

@ -15,12 +15,12 @@ class PromotionManagerAI:
def getPercentChance(self):
return 100.0
def recoverMerits(self, av, cogList, zoneId, multiplier = 1, extraMerits = None):
def recoverMerits(self, av, cogList, zoneId, multiplier = 1, extraMerits = None, addInvasion = True):
avId = av.getDoId()
meritsRecovered = [0, 0, 0, 0]
if extraMerits is None:
extraMerits = [0, 0, 0, 0]
if self.air.suitInvasionManager.getInvading():
if addInvasion and self.air.suitInvasionManager.getInvading():
multiplier *= getInvasionMultiplier()
for i in xrange(len(extraMerits)):
if CogDisguiseGlobals.isSuitComplete(av.getCogParts(), i):

View file

@ -47,7 +47,7 @@ class FireCogPanel(StateData.StateData):
del self.backButton
self.loaded = 0
def enter(self, numAvatars, localNum = None, luredIndices = None, trappedIndices = None, track = None, fireCosts = None):
def enter(self, numAvatars, localNum = None, luredIndices = None, trappedIndices = None, track = None):
if not self.loaded:
self.load()
self.frame.show()
@ -59,7 +59,7 @@ class FireCogPanel(StateData.StateData):
if len(trappedIndices) > 0:
if track == BattleBase.TRAP:
invalidTargets += trappedIndices
self.__placeButtons(numAvatars, invalidTargets, localNum, fireCosts)
self.__placeButtons(numAvatars, invalidTargets, localNum)
def exit(self):
self.frame.hide()
@ -87,23 +87,24 @@ class FireCogPanel(StateData.StateData):
def adjustToons(self, numToons, localNum):
self.__placeButtons(numToons, [], localNum)
def __placeButtons(self, numAvatars, invalidTargets, localNum, fireCosts):
canfire = 0
def __placeButtons(self, numAvatars, invalidTargets, localNum):
canFire = 0
for i in xrange(4):
if numAvatars > i and i not in invalidTargets and i != localNum:
self.avatarButtons[i].show()
self.avatarButtons[i]['text'] = ''
if fireCosts[i] <= localAvatar.getPinkSlips():
if localAvatar.getPinkSlips():
self.avatarButtons[i]['state'] = DGG.NORMAL
self.avatarButtons[i]['text_fg'] = (0, 0, 0, 1)
canfire = 1
canFire = 1
else:
self.avatarButtons[i]['state'] = DGG.DISABLED
self.avatarButtons[i]['text_fg'] = (1.0, 0, 0, 1)
else:
self.avatarButtons[i].hide()
if canfire:
if canFire:
self.textFrame['text'] = TTLocalizer.FireCogTitle % localAvatar.getPinkSlips()
else:
self.textFrame['text'] = TTLocalizer.FireCogLowTitle % localAvatar.getPinkSlips()

View file

@ -200,7 +200,7 @@ def removeReviveSuit(suit, deathSuit):
if not deathSuit.isEmpty():
deathSuit.detachNode()
suit.cleanupLoseActor()
suit.healthBar.show()
suit.healthBar.geom.show()
suit.resetHealthBarForSkele()

View file

@ -145,7 +145,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
if removedMember:
removedMemberName = removedMember.name
messageText = TTLocalizer.BoardingMessageLeftGroup % removedMemberName
localAvatar.setSystemMessage(0, messageText, WTToontownBoardingGroup)
localAvatar.setSystemMessage(removedMemberId, messageText, WTToontownBoardingGroup)
elif localAvatar.doId in oldMemberList and localAvatar.doId not in memberList:
messenger.send('updateGroupStatus')
@ -172,7 +172,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
def postKick(self, leaderId):
self.notify.debug('%s was kicked out of the Boarding Group by %s' % (localAvatar.doId, leaderId))
localAvatar.setSystemMessage(0, TTLocalizer.BoardingMessageKickedOut, WTToontownBoardingGroup)
localAvatar.setSystemMessage(leaderId, TTLocalizer.BoardingMessageKickedOut, WTToontownBoardingGroup)
def postSizeReject(self, leaderId, inviterId, inviteeId):
self.notify.debug('%s was not invited because the group is full' % inviteeId)
@ -252,7 +252,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
if invitee:
inviteeName = invitee.name
messageText = TTLocalizer.BoardingMessageInvited % (inviterName, inviteeName)
localAvatar.setSystemMessage(0, messageText, WTToontownBoardingGroup)
localAvatar.setSystemMessage(inviteeId, messageText, WTToontownBoardingGroup)
def postMessageInvitationFailed(self, inviterId):
inviterName = ''
@ -261,7 +261,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
inviterName = inviter.name
if self.invitationFailedMessageOk(inviterId):
messageText = TTLocalizer.BoardingMessageInvitationFailed % inviterName
localAvatar.setSystemMessage(0, messageText, WTToontownBoardingGroup)
localAvatar.setSystemMessage(inviterId, messageText, WTToontownBoardingGroup)
def postMessageAcceptanceFailed(self, inviteeId, reason):
inviteeName = ''
@ -271,7 +271,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
inviteeName = invitee.name
if reason == BoardingPartyBase.INVITE_ACCEPT_FAIL_GROUP_FULL:
messageText = TTLocalizer.BoardingMessageGroupFull % inviteeName
localAvatar.setSystemMessage(0, messageText, WTToontownBoardingGroup)
localAvatar.setSystemMessage(inviteeId, messageText, WTToontownBoardingGroup)
if self.inviterPanels.isInvitingPanelIdCorrect(inviteeId):
self.inviterPanels.destroyInvitingPanel()
@ -364,17 +364,17 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
if groupFormed:
if leaderId == quitterId:
if not localAvatar.doId == leaderId:
localAvatar.setSystemMessage(0, TTLocalizer.BoardingMessageGroupDissolved, WTToontownBoardingGroup)
localAvatar.setSystemMessage(leaderId, TTLocalizer.BoardingMessageGroupDissolved, WTToontownBoardingGroup)
elif not kick:
if not localAvatar.doId == quitterId:
quitter = base.cr.doId2do.get(quitterId)
if quitter:
quitterName = quitter.name
messageText = TTLocalizer.BoardingMessageLeftGroup % quitterName
localAvatar.setSystemMessage(0, messageText, WTToontownBoardingGroup)
localAvatar.setSystemMessage(quitterId, messageText, WTToontownBoardingGroup)
else:
messageText = TTLocalizer.BoardingMessageGroupDisbandedGeneric
localAvatar.setSystemMessage(0, messageText, WTToontownBoardingGroup)
localAvatar.setSystemMessage(quitterId, messageText, WTToontownBoardingGroup)
return
def requestInvite(self, inviteeId):

View file

@ -1,4 +1,5 @@
from direct.directnotify.DirectNotifyGlobal import *
import cPickle
from otp.ai.AIBaseGlobal import *
from toontown.building import DistributedBuildingAI
@ -19,6 +20,7 @@ class DistributedBuildingMgrAI:
self.dnaStore = dnaStore
self.trophyMgr = trophyMgr
self.__buildings = {}
self.tableName = 'buildings_%s' % self.branchId
self.findAllLandmarkBuildings()
def cleanup(self):
@ -105,10 +107,10 @@ class DistributedBuildingMgrAI:
return (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks)
def findAllLandmarkBuildings(self):
backups = simbase.backups.load('block-info', (self.air.districtId, self.branchId), default={})
buildings = self.load()
(blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks) = self.getDNABlockLists()
for blockNumber in blocks:
self.newBuilding(blockNumber, backup=backups.get(blockNumber, None))
self.newBuilding(blockNumber, buildings.get(blockNumber, None))
for blockNumber in hqBlocks:
self.newHQBuilding(blockNumber)
for blockNumber in gagshopBlocks:
@ -118,25 +120,21 @@ class DistributedBuildingMgrAI:
for block in kartshopBlocks:
self.newKartShopBuilding(block)
def newBuilding(self, blockNumber, backup=None):
building = DistributedBuildingAI.DistributedBuildingAI(
self.air, blockNumber, self.branchId, self.trophyMgr)
def newBuilding(self, blockNumber, blockData = None):
building = DistributedBuildingAI.DistributedBuildingAI(self.air, blockNumber, self.branchId, self.trophyMgr)
building.generateWithRequired(self.branchId)
if backup is not None:
state = backup.get('state', 'toon')
if ((state == 'suit') and simbase.air.wantCogbuildings) or (
(state == 'cogdo') and simbase.air.wantCogdominiums):
building.track = backup.get('track', 'c')
building.difficulty = backup.get('difficulty', 1)
building.numFloors = backup.get('numFloors', 1)
building.updateSavedBy(backup.get('savedBy'))
building.becameSuitTime = backup.get('becameSuitTime', time.time())
if (state == 'suit') and simbase.air.wantCogbuildings:
building.setState('suit')
elif (state == 'cogdo') and simbase.air.wantCogdominiums:
if blockData:
building.track = blockData.get('track', 'c')
building.realTrack = blockData.get('track', 'c')
building.difficulty = int(blockData.get('difficulty', 1))
building.numFloors = int(blockData.get('numFloors', 1))
building.numFloors = max(1, min(5, building.numFloors))
building.becameSuitTime = blockData.get('becameSuitTime', time.time())
if blockData['state'] == 'suit':
building.setState('suit')
elif blockData['state'] == 'cogdo':
if simbase.air.wantCogdominiums:
building.setState('cogdo')
else:
building.setState('toon')
else:
building.setState('toon')
else:
@ -181,17 +179,59 @@ class DistributedBuildingMgrAI:
return building
def save(self):
if self.air.dbConn:
buildings = []
for i in self.__buildings.values():
if isinstance(i, HQBuildingAI.HQBuildingAI):
continue
buildings.append(i.getPickleData())
street = {'ai': self.air.districtId, 'branch': self.branchId}
try:
self.air.dbGlobalCursor.streets.update(street,
{'$setOnInsert': street,
'$set': {'buildings': buildings}},
upsert=True)
except: # Something happened to our DB, but we can reconnect and retry.
taskMgr.doMethodLater(config.GetInt('mongodb-retry-time', 2), self.save, 'retrySave', extraArgs=[])
else:
self.saveDev()
def saveDev(self):
backups = {}
for blockNumber in self.getSuitBlocks():
building = self.getBuilding(blockNumber)
backup = {
'state': building.fsm.getCurrentState().getName(),
'block': building.block,
'track': building.track,
'difficulty': building.difficulty,
'numFloors': building.numFloors,
'savedBy': building.savedBy,
'becameSuitTime': building.becameSuitTime
}
backups[blockNumber] = backup
backups[blockNumber] = building.getPickleData()
simbase.backups.save('block-info', (self.air.districtId, self.branchId), backups)
def load(self):
if self.air.dbConn:
blocks = {}
# Ensure that toontown.streets is indexed. Doing this at loading time
# is a fine way to make sure that we won't upset players with a
# lagspike while we wait for the backend to handle the index request.
self.air.dbGlobalCursor.streets.ensure_index([('ai', 1),
('branch', 1)])
street = {'ai': self.air.districtId, 'branch': self.branchId}
try:
doc = self.air.dbGlobalCursor.streets.find_one(street)
except: # We're failing over - normally we'd wait to retry, but this is on AI startup so we might want to retry (or refactor the bldgMgr so we can sanely retry).
return blocks
if not doc:
return blocks
for building in doc.get('buildings', []):
blocks[int(building['block'])] = building
return blocks
else:
blocks = simbase.backups.load('block-info', (self.air.districtId, self.branchId), default={})
return blocks

View file

@ -11,7 +11,7 @@ class DistributedBuildingQueryMgrAI(DistributedObjectAI.DistributedObjectAI):
def isSuit(self, context, zoneId):
avId = self.air.getAvatarIdFromSender()
building = self.buildings.get(zoneId)
if building is None:
return
self.sendUpdateToAvatarId(avId, 'response', [context, building.isSuitBlock()])
if zoneId not in self.buildings:
self.sendUpdateToAvatarId(avId, 'response', [context, False])
else:
self.sendUpdateToAvatarId(avId, 'response', [context, self.buildings[zoneId].isSuitBlock()])

View file

@ -233,9 +233,9 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
self.setupNametag()
def getBuilding(self):
if not hasattr(self, 'building'):
if not hasattr(self, 'building') or not self.building:
if self.doorType == DoorTypes.INT_STANDARD:
door = render.find('**/leftDoor;+s')
door = render.find('**/*leftDoor*')
self.building = door.getParent()
elif self.doorType == DoorTypes.INT_HQ:
door = render.find('**/door_0')

View file

@ -59,8 +59,8 @@ class ToonInterior(Place.Place):
State.State('NPCFAReject', self.enterNPCFAReject, self.exitNPCFAReject, ['walk']),
State.State('HFA', self.enterHFA, self.exitHFA, ['HFAReject', 'teleportOut', 'tunnelOut']),
State.State('HFAReject', self.enterHFAReject, self.exitHFAReject, ['walk']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk', 'stopped']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk', 'stopped']),
State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']),
State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn']),
State.State('quest', self.enterQuest, self.exitQuest, ['walk', 'doorOut']),
@ -176,7 +176,9 @@ class ToonInterior(Place.Place):
def enterTeleportIn(self, requestStatus):
modelType = DistributedToonInterior.DistributedToonInterior(base.cr).getModelType(self.getZoneId())
if ZoneUtil.isPetshop(self.zoneId):
if ZoneUtil.isHQ(self.zoneId):
base.localAvatar.setPosHpr(-5.5, -1.5, ToontownGlobals.FloorOffset, 0.0, 0.0, 0.0)
elif ZoneUtil.isPetshop(self.zoneId):
base.localAvatar.setPosHpr(0, 0, ToontownGlobals.FloorOffset, 45.0, 0.0, 0.0)
else:
if modelType in InteriorTypes:

View file

@ -20,17 +20,17 @@ class ToontownChatManager(ChatManager.ChatManager):
self.openScSfx.setVolume(0.6)
self.scButton = DirectButton(image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=TTLocalizer.TCMscButtonPos, parent=base.a2dTopLeft, scale=1.179, relief=None, image_color=Vec4(0.75, 1, 0.6, 1), text=('', OTPLocalizer.GlobalSpeedChatName, OTPLocalizer.GlobalSpeedChatName), text_scale=TTLocalizer.TCMscButton, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, sortOrder=DGG.FOREGROUND_SORT_INDEX, command=self.__scButtonPressed, clickSound=self.openScSfx)
self.scButton.hide()
self.whisperFrame = DirectFrame(parent=base.a2dTopLeft, relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(0.45, 0.45, 0.45), image_color=OTPGlobals.GlobalDialogColor, pos=(1.25, 0, -0.269), text=OTPLocalizer.ChatManagerWhisperTo, text_wordwrap=7.0, text_scale=TTLocalizer.TCMwhisperFrame, text_fg=Vec4(0, 0, 0, 1), text_pos=(0, 0.14), textMayChange=1, sortOrder=DGG.FOREGROUND_SORT_INDEX)
self.whisperFrame = DirectFrame(parent=base.a2dTopLeft, relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(0.77, 0.70, 0.20), image_color=OTPGlobals.GlobalDialogColor, pos=(0.40, 0, -0.105), text=OTPLocalizer.ChatManagerWhisperTo, text_wordwrap=6.5, text_scale=TTLocalizer.TCMwhisperFrame, text_fg=Vec4(0, 0, 0, 1), text_pos=(0.18, 0.01), textMayChange=1, sortOrder=DGG.FOREGROUND_SORT_INDEX)
self.whisperFrame.hide()
self.whisperButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(-0.125, 0, -0.1), scale=1.179, relief=None, image_color=Vec4(1, 1, 1, 1), text=('',
self.whisperButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(-0.33, 0, 0.033), scale=1.179, relief=None, image_color=Vec4(1, 1, 1, 1), text=('',
OTPLocalizer.ChatManagerChat,
OTPLocalizer.ChatManagerChat,
''), image3_color=Vec4(0.6, 0.6, 0.6, 0.6), text_scale=TTLocalizer.TCMwhisperButton, text_fg=(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.__whisperButtonPressed)
self.whisperScButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(0.0, 0, -0.1), scale=1.179, relief=None, image_color=Vec4(0.75, 1, 0.6, 1), text=('',
self.whisperScButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(-0.195, 0, 0.033), scale=1.179, relief=None, image_color=Vec4(0.75, 1, 0.6, 1), text=('',
OTPLocalizer.GlobalSpeedChatName,
OTPLocalizer.GlobalSpeedChatName,
''), image3_color=Vec4(0.6, 0.6, 0.6, 0.6), text_scale=TTLocalizer.TCMwhisperScButton, text_fg=(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.__whisperScButtonPressed)
self.whisperCancelButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/CloseBtn_UP'), gui.find('**/CloseBtn_DN'), gui.find('**/CloseBtn_Rllvr')), pos=(0.125, 0, -0.1), scale=1.179, relief=None, text=('', OTPLocalizer.ChatManagerCancel, OTPLocalizer.ChatManagerCancel), text_scale=0.05, text_fg=(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.__whisperCancelPressed)
self.whisperCancelButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/CloseBtn_UP'), gui.find('**/CloseBtn_DN'), gui.find('**/CloseBtn_Rllvr')), pos=(-0.06, 0, 0.033), scale=1.179, relief=None, text=('', OTPLocalizer.ChatManagerCancel, OTPLocalizer.ChatManagerCancel), text_scale=0.05, text_fg=(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.__whisperCancelPressed)
gui.removeNode()
ChatManager.ChatManager.__init__(self, cr, localAvatar)
self.chatInputSpeedChat = TTChatInputSpeedChat(self)
@ -45,7 +45,6 @@ class ToontownChatManager(ChatManager.ChatManager):
self.chatInputWhiteList.setPos(self.speedChatPlusPos)
self.chatInputWhiteList.reparentTo(base.a2dTopLeft)
self.chatInputWhiteList.desc = 'chatInputWhiteList'
return
def delete(self):
ChatManager.ChatManager.delete(self)
@ -111,7 +110,7 @@ class ToontownChatManager(ChatManager.ChatManager):
if base.config.GetBool('want-qa-regression', 0):
self.notify.info('QA-REGRESSION: CHAT: Speedchat Plus')
messenger.send('wakeup')
if not settings['trueFriends'] and not settings['speedchatPlus']:
if not base.cr.wantTypedChat():
self.fsm.request('noSpeedchatPlus')
return
self.fsm.request('normalChat')
@ -125,7 +124,7 @@ class ToontownChatManager(ChatManager.ChatManager):
def __whisperButtonPressed(self, avatarName, avatarId):
messenger.send('wakeup')
if not settings['trueFriends'] and not settings['speedchatPlus']:
if not base.cr.wantTypedChat():
self.fsm.request('noSpeedchatPlus')
return
if avatarId:
@ -134,7 +133,7 @@ class ToontownChatManager(ChatManager.ChatManager):
return
def enterNormalChat(self):
if not settings['trueFriends'] and not settings['speedchatPlus']:
if not base.cr.wantTypedChat():
self.fsm.request('mainMenu')
return
result = ChatManager.ChatManager.enterNormalChat(self)
@ -143,11 +142,10 @@ class ToontownChatManager(ChatManager.ChatManager):
self.fsm.request('mainMenu')
def enterWhisperChat(self, avatarName, avatarId):
if not settings['trueFriends'] and not settings['speedchatPlus']:
if not base.cr.wantTypedChat():
self.fsm.request('mainMenu')
return
result = ChatManager.ChatManager.enterWhisperChat(self, avatarName, avatarId)
self.chatInputNormal.reparentTo(base.a2dTopCenter)
self.chatInputNormal.setPos(self.whisperPos)
if result == None:
self.notify.warning('something went wrong in enterWhisperChat, falling back to main menu')

View file

@ -22,8 +22,8 @@ class CogHQLobby(Place.Place):
'doorOut',
'stopped']),
State.State('stopped', self.enterStopped, self.exitStopped, ['walk', 'teleportOut', 'elevator']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk', 'stopped']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk', 'stopped']),
State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']),
State.State('elevator', self.enterElevator, self.exitElevator, ['walk', 'stopped']),
State.State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final')

View file

@ -29,7 +29,7 @@ class DistributedBattleFactoryAI(DistributedLevelBattleAI.DistributedLevelBattle
self.toonItems[toon.doId][1].extend(notRecovered)
meritArray = self.air.promotionMgr.recoverMerits(
toon, self.suitsKilled, self.getTaskZoneId(),
getFactoryMeritMultiplier(self.getTaskZoneId()))
getFactoryMeritMultiplier(self.getTaskZoneId()) * 2.0, addInvasion=False)
if toon.doId in self.helpfulToons:
self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray)
else:

View file

@ -34,7 +34,7 @@ class DistributedCountryClubBattleAI(DistributedLevelBattleAI.DistributedLevelBa
recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId())
self.toonItems[toon.doId][0].extend(recovered)
self.toonItems[toon.doId][1].extend(notRecovered)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getCountryClubCreditMultiplier(self.getTaskZoneId()), extraMerits=extraMerits)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getCountryClubCreditMultiplier(self.getTaskZoneId()) * 2.0, extraMerits=extraMerits, addInvasion=False)
if toon.doId in self.helpfulToons:
self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray)
else:

View file

@ -33,7 +33,7 @@ class DistributedMintBattleAI(DistributedLevelBattleAI.DistributedLevelBattleAI)
recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId())
self.toonItems[toon.doId][0].extend(recovered)
self.toonItems[toon.doId][1].extend(notRecovered)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getMintCreditMultiplier(self.getTaskZoneId()), extraMerits=extraMerits)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getMintCreditMultiplier(self.getTaskZoneId()) * 2.0, extraMerits=extraMerits, addInvasion=False)
if toon.doId in self.helpfulToons:
self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray)
else:

View file

@ -301,6 +301,6 @@ class DistributedStage(DistributedObject.DistributedObject):
self.titleText.setText('')
def elevatorAlert(self, avId):
if base.localAvatar.doId != avId:
if base.localAvatar.doId != avId and avId in base.cr.doId2do:
name = base.cr.doId2do[avId].getName()
self.showInfoText(TTLocalizer.stageToonEnterElevator % name)
self.showInfoText(TTLocalizer.StageToonEnterElevator % name)

View file

@ -41,7 +41,7 @@ class DistributedStageBattleAI(DistributedLevelBattleAI.DistributedLevelBattleAI
recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId())
self.toonItems[toon.doId][0].extend(recovered)
self.toonItems[toon.doId][1].extend(notRecovered)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getStageCreditMultiplier(self.level.getFloorNum()), extraMerits=extraMerits)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getStageCreditMultiplier(self.level.getFloorNum()) * 2.0, extraMerits=extraMerits, addInvasion=False)
if toon.doId in self.helpfulToons:
self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray)
else:

View file

@ -43,8 +43,8 @@ class FactoryExterior(BattlePlace.BattlePlace):
State.State('battle', self.enterBattle, self.exitBattle, ['walk', 'teleportOut', 'died']),
State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']),
State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn', 'final', 'WaitForBattle']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk', 'stopped']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk', 'stopped']),
State.State('died', self.enterDied, self.exitDied, ['quietZone']),
State.State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn, ['walk']),
State.State('tunnelOut', self.enterTunnelOut, self.exitTunnelOut, ['final']),

View file

@ -637,15 +637,13 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
if doId in self.friendsMap:
teleportNotify.debug('friend %s in friendsMap' % doId)
return self.friendsMap[doId]
avatar = None
if doId in self.doId2do:
teleportNotify.debug('found friend %s in doId2do' % doId)
avatar = self.doId2do[doId]
return self.doId2do[doId]
elif self.cache.contains(doId):
teleportNotify.debug('found friend %s in cache' % doId)
avatar = self.cache.dict[doId]
return self.cache.dict[doId]
self.notify.warning("Don't know who friend %s is." % doId)
return
def identifyAvatar(self, doId):
if doId in self.doId2do:
@ -661,6 +659,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
if base.wantPets and base.localAvatar.hasPet():
if base.localAvatar.getPetId() not in self.friendsMap:
return 0
return 1
def removeFriend(self, avatarId):
@ -736,16 +735,14 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
def handleFriendOnline(self, doId):
self.notify.debug('Friend %d now online.' % doId)
if doId not in self.friendsOnline:
self.friendsOnline[doId] = self.identifyFriend(doId)
self.friendsOnline[doId] = self.identifyAvatar(doId)
messenger.send('friendOnline', [doId])
def handleFriendOffline(self, doId):
self.notify.debug('Friend %d now offline.' % doId)
try:
if doId in self.friendsOnline:
del self.friendsOnline[doId]
messenger.send('friendOffline', [doId])
except:
pass
def handleGenerateWithRequiredOtherOwner(self, di):
# Toontown only makes use of OwnerViews for LocalToon.

View file

@ -14,10 +14,12 @@ class ToontownInternalRepository(AstronInternalRepository):
AstronInternalRepository.__init__(
self, baseChannel, serverId=serverId, dcFileNames=dcFileNames,
dcSuffix=dcSuffix, connectMethod=connectMethod, threadedNet=threadedNet)
self.wantMongo = config.GetBool('want-mongo', False)
def handleConnected(self):
self.__messenger = ToontownNetMessengerAI(self)
if config.GetBool('want-mongo', False):
if self.wantMongo:
import pymongo
self.dbConn = pymongo.MongoClient(config.GetString('mongodb-url', 'localhost'))
self.dbGlobalCursor = self.dbConn.toontownstride

View file

@ -5,11 +5,10 @@ import HouseGlobals
import time, random
from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI
from toontown.fishing.DistributedPondBingoManagerAI import DistributedPondBingoManagerAI
from toontown.fishing import FishingTargetGlobals, FishGlobals
from toontown.safezone import TreasureGlobals
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
from toontown.safezone import DistributedTreasureAI
from toontown.safezone import DistributedEFlyingTreasureAI
from toontown.safezone import ButterflyGlobals
from toontown.safezone import DistributedButterflyAI
from toontown.safezone.DistributedFishingSpotAI import DistributedFishingSpotAI
@ -432,7 +431,7 @@ class CannonRental(Rental):
for i in xrange(20):
x = random.randint(100, 300) - 200
y = random.randint(100, 300) - 200
treasure = DistributedTreasureAI.DistributedTreasureAI(self.estate.air, self, 7, x, y, z)
treasure = DistributedEFlyingTreasureAI.DistributedEFlyingTreasureAI(self.estate.air, self, 7, x, y, z)
treasure.generateWithRequired(self.estate.zoneId)
self.objects.add(treasure)
doIds.append(treasure.doId)
@ -506,11 +505,6 @@ class DistributedEstateAI(DistributedObjectAI):
self.pond.generateWithRequired(self.zoneId)
self.pond.start()
self.pond.bingoMgr = DistributedPondBingoManagerAI(simbase.air)
self.pond.bingoMgr.setPondDoId(self.pond.getDoId())
self.pond.bingoMgr.generateWithRequired(self.zoneId)
self.pond.bingoMgr.initTasks()
treasureType, healAmount, spawnPoints, spawnRate, maxTreasures = TreasureGlobals.SafeZoneTreasureSpawns[ToontownGlobals.MyEstate]
self.treasurePlanner = SZTreasurePlannerAI(self.zoneId, treasureType, healAmount, spawnPoints, spawnRate, maxTreasures)
self.treasurePlanner.start()

View file

@ -84,14 +84,21 @@ class DistributedTV(DistributedFurnitureItem):
base.localAvatar.setSystemMessage(0, TTLocalizer.TVUnknownVideoPack % pack if pack else TTLocalizer.TVUnknownVideo)
self.resetScreen()
return
start = time.time() - startTime
movie = loader.loadTexture(video)
self.sound = loader.loadSfx(video)
length = self.sound.length()
if start >= length:
start -= int(start / length) * length
movie.synchronizeTo(self.sound)
self.screen.setColor(1, 1, 1, 1)
self.screen.setTexture(movie)
self.screen.setTexScale(TextureStage.getDefault(), movie.getTexScale())
self.sound.setTime(min(self.sound.length(), int(time.time() - startTime)))
self.sound.setTime(start)
self.sound.setLoop(True)
self.sound.play()
def __enterSphere(self, collisionEntry):

View file

@ -62,8 +62,8 @@ class Estate(Place.Place):
'activity']),
State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk', 'petTutorial']),
State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn', 'walk', 'final']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['final', 'walk']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk', 'stopped']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['final', 'walk', 'stopped']),
State.State('final', self.enterFinal, self.exitFinal, ['teleportIn']),
State.State('quest', self.enterQuest, self.exitQuest, ['walk']),
State.State('activity', self.enterActivity, self.exitActivity, ['walk', 'stopped']),

View file

@ -43,8 +43,8 @@ class House(Place.Place):
'banking',
'phone',
'stopped']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk', 'stopped']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk', 'stopped']),
State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']),
State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn']),
State.State('quest', self.enterQuest, self.exitQuest, ['walk', 'doorOut']),

View file

@ -156,11 +156,6 @@ class BingoCardGui(DirectFrame):
elif self.game.getGameState() & 1 << index:
self.cellGuiList[index].disable()
def disableCard(self):
self.stopCellBlinking()
for index in xrange(self.game.getCardSize()):
self.cellGuiList[index].disable()
def enableCard(self, callback = None):
self.notify.info('enable Bingo card')
self.stopCellBlinking()

View file

@ -1,8 +1,9 @@
from direct.directnotify.DirectNotifyGlobal import *
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.fishing import FishingTargetGlobals
from toontown.fishing.DistributedFishingTargetAI import DistributedFishingTargetAI
from toontown.toonbase import ToontownGlobals
from DistributedFishingTargetAI import DistributedFishingTargetAI
from DistributedPondBingoManagerAI import DistributedPondBingoManagerAI
import FishingTargetGlobals
class DistributedFishingPondAI(DistributedObjectAI):
notify = directNotify.newCategory("DistributedFishingPondAI")
@ -14,12 +15,42 @@ class DistributedFishingPondAI(DistributedObjectAI):
self.targets = {}
self.spots = {}
self.bingoMgr = None
def announceGenerate(self):
if self.air.newsManager.isHolidayRunning(ToontownGlobals.FISH_BINGO, ToontownGlobals.SILLY_SATURDAY):
self.startBingo()
self.accept('startBingo', self.startBingo)
self.accept('stopBingo', self.stopBingo)
DistributedObjectAI.announceGenerate(self)
def delete(self):
self.ignoreAll()
DistributedObjectAI.delete(self)
def start(self):
for _ in xrange(FishingTargetGlobals.getNumTargets(self.area)):
fishingTarget = DistributedFishingTargetAI(simbase.air)
fishingTarget.setPondDoId(self.doId)
fishingTarget.generateWithRequired(self.zoneId)
def startBingo(self):
if self.bingoMgr:
self.notify.warning('Tried to start bingo while already started!')
return
self.bingoMgr = DistributedPondBingoManagerAI(self.air)
self.bingoMgr.setPondDoId(self.getDoId())
self.bingoMgr.generateWithRequired(self.zoneId)
self.bingoMgr.createGame()
def stopBingo(self):
if not self.bingoMgr:
self.notify.warning('Tried to stop bingo but not started!')
return
self.bingoMgr.requestDelete()
self.bingoMgr = None
def hitTarget(self, target):
avId = self.air.getAvatarIdFromSender()

View file

@ -49,6 +49,7 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
self.notify.debug('generate: DistributedPondBingoManager')
def delete(self):
self.pond.resetSpotGui()
del self.pond.pondBingoMgr
self.pond.pondBingoMgr = None
del self.pond
@ -58,7 +59,6 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
del self.card
self.notify.debug('delete: Deleting Local PondManager %s' % self.doId)
DistributedObject.DistributedObject.delete(self)
return
def d_cardUpdate(self, cellId, genus, species):
self.sendUpdate('cardUpdate', [self.cardId,
@ -121,7 +121,7 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
self.card.hide()
def showCard(self):
if (self.state != 'Off' or self.state != 'CloseEvent') and self.card.getGame():
if self.state != 'Off' and self.card.getGame() != None:
self.card.loadCard()
self.card.show()
elif self.state == 'GameOver':
@ -283,8 +283,6 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
return (request, args)
elif request == 'Intermission':
return (request, args)
elif request == 'CloseEvent':
return 'CloseEvent'
elif request == 'Off':
return 'Off'
else:
@ -305,8 +303,6 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
return (request, args)
elif request == 'Intermission':
return (request, args)
elif request == 'CloseEvent':
return 'CloseEvent'
elif request == 'Off':
return 'Off'
else:
@ -338,17 +334,3 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
def exitIntermission(self):
self.notify.debug('enterIntermission: Exit Intermission State')
def enterCloseEvent(self, timestamp):
self.notify.debug('enterCloseEvent: Enter CloseEvent State')
self.card.hide()
self.pond.resetSpotGui()
def filterCloseEvent(self, request, args):
if request == 'Off':
return 'Off'
else:
self.notify.warning('filterOff: Invalid State Transition from GameOver to %s' % request)
def exitCloseEvent(self):
self.notify.debug('exitCloseEvent: Exit CloseEvent State')

View file

@ -1,18 +1,16 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import *
from toontown.fishing import BingoGlobals
from toontown.fishing import FishGlobals
from toontown.toonbase import ToontownGlobals
from toontown.fishing.NormalBingo import NormalBingo
from toontown.fishing.ThreewayBingo import ThreewayBingo
from toontown.fishing.DiagonalBingo import DiagonalBingo
from toontown.fishing.BlockoutBingo import BlockoutBingo
from toontown.fishing.FourCornerBingo import FourCornerBingo
from direct.task import Task
from direct.distributed.ClockDelta import *
import random, datetime
RequestCard = {}
import random
RequestCard = {}
class DistributedPondBingoManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPondBingoManagerAI")
@ -26,35 +24,14 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
self.state = 'Off'
self.pond = None
self.canCall = False
self.shouldStop = False
self.lastUpdate = globalClockDelta.getRealNetworkTime()
self.cardId = 0
def initTasks(self):
now = datetime.datetime.now()
weekday = now.weekday()
targetday = 2 # Wednesday
if weekday in (3, 4):
targetday = 5
togo = targetday - weekday
if togo < 0:
togo += 7
s = now + datetime.timedelta(days=togo)
start = datetime.datetime(s.year, s.month, s.day)
secs = max(0, (start - now).total_seconds())
self.notify.debug('Today it\'s %d, so we wait for %d, togo: %d %d' % (weekday, targetday, togo, secs))
taskMgr.doMethodLater(secs, DistributedPondBingoManagerAI.startTask, self.taskName('start'), extraArgs=[self])
def startTask(self):
self.notify.debug('Starting game')
def stop(task):
self.notify.debug('Stopping game')
self.shouldStop = True
return task.done
taskMgr.doMethodLater(24 * 60 * 60, stop, self.taskName('stop'))
self.createGame()
def delete(self):
taskMgr.remove(self.uniqueName('startWait'))
taskMgr.remove(self.uniqueName('createGame'))
taskMgr.remove(self.uniqueName('finishGame'))
DistributedObjectAI.delete(self)
def setPondDoId(self, pondId):
self.pond = self.air.doId2do[pondId]
@ -87,12 +64,16 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
elif result == BingoGlobals.UPDATE:
self.sendGameStateUpdate(cellId)
def d_enableBingo(self):
self.sendUpdate('enableBingo', [])
def handleBingoCall(self, cardId):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
self.air.writeServerEvent('suspicious', avId, 'Toon tried to call bingo while not on district!')
return
spot = self.pond.hasToon(avId)
if not spot:
self.air.writeServerEvent('suspicious', avId, 'Toon tried to call bingo while not fishing!')
return
@ -102,7 +83,7 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
if cardId != self.cardId:
self.air.writeServerEvent('suspicious', avId, 'Toon tried to call bingo with an expired cardId!')
return
av = self.air.doId2do[avId]
av.d_announceBingo()
self.rewardAll()
@ -158,40 +139,25 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
continue
av = self.air.doId2do[self.pond.spots[spot].avId]
av.addMoney(self.jackpot)
if self.shouldStop:
self.stopGame()
return
taskMgr.doMethodLater(5, DistributedPondBingoManagerAI.startWait, 'startWait%d' % self.getDoId(), [self])
taskMgr.remove('finishGame%d' % self.getDoId())
taskMgr.doMethodLater(5, self.startWait, self.uniqueName('startWait'))
taskMgr.remove(self.uniqueName('finishGame'))
def finishGame(self):
def finishGame(self, task=None):
self.state = 'GameOver'
self.sendStateUpdate()
if self.shouldStop:
self.stopGame()
return
taskMgr.doMethodLater(5, DistributedPondBingoManagerAI.startWait, 'startWait%d' % self.getDoId(), [self])
def stopGame(self):
self.state = 'CloseEvent'
self.sendStateUpdate()
taskMgr.doMethodLater(10, DistributedPondBingoManagerAI.turnOff, 'turnOff%d' % self.getDoId(), [self])
def turnOff(self):
self.state = 'Off'
self.sendStateUpdate()
taskMgr.doMethodLater(5, self.startWait, self.uniqueName('startWait'))
def startIntermission(self):
self.state = 'Intermission'
self.sendStateUpdate()
taskMgr.doMethodLater(300, DistributedPondBingoManagerAI.startWait, 'startWait%d' % self.getDoId(), [self])
taskMgr.doMethodLater(300, self.startWait, self.uniqueName('startWait'))
def startWait(self):
def startWait(self, task=None):
self.state = 'WaitCountdown'
self.sendStateUpdate()
taskMgr.doMethodLater(15, DistributedPondBingoManagerAI.createGame, 'createGame%d' % self.getDoId(), [self])
taskMgr.doMethodLater(15, self.createGame, self.uniqueName('createGame'))
def createGame(self):
def createGame(self, task=None):
self.canCall = False
self.tileSeed = None
self.typeId = None
@ -223,4 +189,4 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
self.b_setJackpot(BingoGlobals.getJackpot(self.typeId))
self.state = 'Playing'
self.sendStateUpdate()
taskMgr.doMethodLater(BingoGlobals.getGameTime(self.typeId), DistributedPondBingoManagerAI.finishGame, 'finishGame%d' % self.getDoId(), [self])
taskMgr.doMethodLater(BingoGlobals.getGameTime(self.typeId), self.finishGame, self.uniqueName('finishGame'))

View file

@ -33,7 +33,7 @@ Rod2JellybeanDict = {0: 10,
HealAmount = 1
JellybeanFishingHolidayScoreMultiplier = 2
MAX_RARITY = 10
GlobalRarityDialBase = 4.3
GlobalRarityDialBase = 3.8
FishingAngleMax = 50.0
OVERALL_VALUE_SCALE = 15
RARITY_VALUE_SCALE = 0.2
@ -334,19 +334,19 @@ __fishDict = {0: ((1,
(Anywhere,)),
(1,
1,
3,
4,
(TTG.ToontownCentral, Anywhere)),
(3,
5,
4,
5,
(TTG.PunchlinePlace, TTG.TheBrrrgh)),
(3,
5,
2,
3,
(TTG.SillyStreet, TTG.DaisyGardens)),
(1,
5,
1,
2,
(TTG.LoopyLane, TTG.ToontownCentral))),
2: ((2,
6,
@ -354,27 +354,27 @@ __fishDict = {0: ((1,
(TTG.DaisyGardens, Anywhere)),
(2,
6,
6,
9,
(TTG.ElmStreet, TTG.DaisyGardens)),
(5,
11,
3,
(TTG.LullabyLane,)),
4,
(TTG.LullabyLane, TTG.BedtimeBoulevard)),
(2,
6,
2,
3,
(TTG.DaisyGardens, TTG.MyEstate, TTG.OutdoorZone)),
(5,
11,
1,
(TTG.DonaldsDreamland, TTG.MyEstate, TTG.OutdoorZone, TTG.BedtimeBoulevard))),
2,
(TTG.DonaldsDreamland, TTG.MyEstate, TTG.OutdoorZone))),
4: ((2,
8,
1,
(TTG.ToontownCentral, Anywhere)),
(2,
8,
3,
4,
(TTG.ToontownCentral, Anywhere)),
(2,
8,
@ -382,7 +382,7 @@ __fishDict = {0: ((1,
(TTG.ToontownCentral, Anywhere)),
(2,
8,
5,
6,
(TTG.ToontownCentral, TTG.MinniesMelodyland))),
6: ((8,
12,
@ -394,23 +394,23 @@ __fishDict = {0: ((1,
(Anywhere,)),
(2,
6,
1,
2,
(TTG.MinniesMelodyland, Anywhere)),
(5,
10,
4,
5,
(TTG.MinniesMelodyland, Anywhere)),
(1,
5,
5,
7,
(TTG.MyEstate, TTG.OutdoorZone, Anywhere)),
(1,
5,
7,
10,
(TTG.MyEstate, TTG.OutdoorZone, Anywhere))),
10: ((6,
10,
7,
9,
(TTG.MyEstate, TTG.OutdoorZone, Anywhere)),),
12: ((7,
15,
@ -418,15 +418,15 @@ __fishDict = {0: ((1,
(TTG.DonaldsDock, Anywhere)),
(18,
20,
5,
6,
(TTG.DonaldsDock, TTG.MyEstate, TTG.OutdoorZone)),
(1,
5,
4,
5,
(TTG.DonaldsDock, TTG.MyEstate, TTG.OutdoorZone)),
(3,
7,
3,
4,
(TTG.DonaldsDock, TTG.MyEstate, TTG.OutdoorZone)),
(1,
2,
@ -437,27 +437,27 @@ __fishDict = {0: ((1,
1,
(TTG.DaisyGardens, TTG.MyEstate, TTG.OutdoorZone, Anywhere)), (2,
6,
2,
3,
(TTG.DaisyGardens, TTG.MyEstate, TTG.OutdoorZone))),
16: ((4,
12,
4,
5,
(TTG.MinniesMelodyland, Anywhere)), (4,
12,
6,
7,
(TTG.BaritoneBoulevard, TTG.MinniesMelodyland)), (4,
12,
6,
8,
(TTG.TenorTerrace, TTG.MinniesMelodyland))),
18: ((2,
4,
2,
3,
(TTG.DonaldsDock, Anywhere)), (5,
8,
6,
7,
(TTG.TheBrrrgh,)), (4,
6,
6,
8,
(TTG.LighthouseLane,))),
20: ((4,
6,
@ -465,11 +465,11 @@ __fishDict = {0: ((1,
(TTG.DonaldsDreamland,)),
(14,
18,
7,
10,
(TTG.DonaldsDreamland,)),
(6,
10,
7,
8,
(TTG.LullabyLane, TTG.BedtimeBoulevard)),
(1,
1,
@ -477,11 +477,11 @@ __fishDict = {0: ((1,
(TTG.DonaldsDreamland,)),
(2,
6,
5,
6,
(TTG.LullabyLane, TTG.BedtimeBoulevard)),
(10,
14,
3,
4,
(TTG.DonaldsDreamland, TTG.DaisyGardens))),
22: ((12,
16,
@ -489,40 +489,36 @@ __fishDict = {0: ((1,
(TTG.MyEstate, TTG.OutdoorZone, TTG.DaisyGardens, Anywhere)),
(14,
18,
2,
3,
(TTG.MyEstate, TTG.OutdoorZone, TTG.DaisyGardens, Anywhere)),
(14,
20,
4,
5,
(TTG.MyEstate, TTG.OutdoorZone, TTG.DaisyGardens)),
(14,
20,
6,
7,
(TTG.MyEstate, TTG.OutdoorZone, TTG.DaisyGardens))),
24: ((9,
11,
2,
3,
(Anywhere,)),
(8,
12,
4,
(TTG.DaisyGardens, TTG.DonaldsDock)),
(8,
12,
5,
(TTG.DaisyGardens, TTG.DonaldsDock)),
(8,
16,
12,
6,
(TTG.DaisyGardens, TTG.DonaldsDock)),
(8,
16,
7,
(TTG.DaisyGardens, TTG.DonaldsDock))),
26: ((10,
18,
2,
(TTG.TheBrrrgh,)),
(10,
18,
2,
(TTG.TheBrrrgh,)),
(10,
18,
3,
@ -531,51 +527,55 @@ __fishDict = {0: ((1,
18,
4,
(TTG.TheBrrrgh,)),
(12,
20,
(10,
18,
5,
(TTG.TheBrrrgh,)),
(14,
(12,
20,
6,
(TTG.TheBrrrgh,)),
(14,
20,
6,
7,
(TTG.TheBrrrgh,)),
(14,
20,
8,
(TTG.SleetStreet, TTG.TheBrrrgh)),
(16,
20,
8,
10,
(TTG.WalrusWay, TTG.TheBrrrgh))),
28: ((2,
10,
2,
(TTG.DonaldsDock, Anywhere)), (4,
10,
5,
6,
(TTG.BarnacleBoulevard, TTG.DonaldsDock)), (4,
10,
6,
7,
(TTG.SeaweedStreet, TTG.DonaldsDock))),
30: ((13,
17,
4,
5,
(TTG.MinniesMelodyland, Anywhere)),
(16,
20,
8,
10,
(TTG.AltoAvenue, TTG.MinniesMelodyland)),
(12,
18,
7,
9,
(TTG.TenorTerrace, TTG.MinniesMelodyland)),
(12,
18,
5,
6,
(TTG.MinniesMelodyland,)),
(12,
18,
6,
7,
(TTG.MinniesMelodyland,))),
32: ((1,
5,
@ -587,19 +587,19 @@ __fishDict = {0: ((1,
(TTG.TheBrrrgh, TTG.MyEstate, TTG.OutdoorZone, Anywhere)),
(1,
5,
3,
4,
(TTG.DaisyGardens, TTG.MyEstate, TTG.OutdoorZone)),
(1,
5,
4,
5,
(TTG.DonaldsDreamland, TTG.MyEstate, TTG.OutdoorZone)),
(1,
5,
7,
10,
(TTG.TheBrrrgh, TTG.DonaldsDreamland))),
34: ((1,
20,
7,
10,
(TTG.DonaldsDreamland, Anywhere)),)}
def getSpecies(genus):

View file

@ -66,8 +66,8 @@ class FriendHandle:
base.cr.ttsFriendsManager.d_teleportGiveup(self.doId)
def isUnderstandable(self):
if settings['speedchatPlus']:
if base.cr.wantTypedChat():
return 1
elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId):
elif base.localAvatar.isTrueFriends(self.doId):
return 1
return 0

View file

@ -6,6 +6,7 @@ from toontown.friends import ToontownFriendSecret
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from otp.nametag.NametagGroup import *
from otp.nametag.NametagConstants import *
from otp.otpbase import OTPGlobals
FLPPets = 1
FLPOnline = 2
@ -241,7 +242,6 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
def __updateScrollList(self):
petFriends = []
admins = []
trueFriends = []
friends = []
@ -257,9 +257,7 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
base.cr.fillUpFriendsMap()
return
if handle.isAdmin():
admins.insert(0, friendId)
elif base.localAvatar.isTrueFriends(friendId):
if base.localAvatar.isTrueFriends(friendId):
trueFriends.insert(0, friendId)
else:
friends.insert(0, friendId)

View file

@ -21,7 +21,7 @@ class TTSFriendsManager(DistributedObjectGlobal):
def d_getAvatarDetails(self, avId):
self.sendUpdate('getAvatarDetails', [avId])
def friendDetails(self, avId, inventory, trackAccess, trophies, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel):
def friendDetails(self, avId, inventory, trackAccess, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel):
fields = [
['setExperience' , experience],
['setTrackAccess' , trackAccess],

View file

@ -65,7 +65,6 @@ class FriendsListOperation(OperationFSM):
self.demand('Error', 'Friend was not a Toon')
return
friendId = self.friendsList[self.friendIndex]
self.realFriendsList.append([friendId, fields['setName'][0],
fields['setDNAString'][0], fields['setAdminAccess'][0], fields['setPetId'][0]])
@ -98,8 +97,10 @@ class RemoveFriendOperation(OperationFSM):
self.demand('Retrieved', fields['setFriendsList'][0], fields['setTrueFriends'][0])
def enterRetrieved(self, friendsList, trueFriendsList):
friendsList.remove(self.target)
trueFriendsList.remove(self.target)
if self.target in friendsList:
friendsList.remove(self.target)
if self.target in trueFriendsList:
trueFriendsList.remove(self.target)
if self.sender in self.mgr.onlineToons:
dg = self.air.dclassesByName['DistributedToonUD'].aiFormatUpdate(
'setFriendsList', self.sender, self.sender,
@ -115,7 +116,7 @@ class RemoveFriendOperation(OperationFSM):
self.air.dbInterface.updateObject(self.air.dbId, self.sender,
self.air.dclassesByName['DistributedToonUD'],
{'setFriendsList' : [friendsList], 'setTrueFriends' : [trueFriendsList]})
{'setFriendsList' : [friendsList], 'setTrueFriends': [trueFriendsList]})
self.demand('Off')
# -- Clear List --
@ -190,7 +191,6 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
return
inventory = fields['setInventory'][0]
trackAccess = fields['setTrackAccess'][0]
trophies = 0 # fields['setTrophyScore'][0] is not db
hp = fields['setHp'][0]
maxHp = fields['setMaxHp'][0]
defaultShard = fields['setDefaultShard'][0]
@ -199,9 +199,9 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
experience = fields['setExperience'][0]
trackBonusLevel = fields['setTrackBonusLevel'][0]
self.sendUpdateToAvatarId(senderId, 'friendDetails', [avId, inventory, trackAccess, trophies, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel])
self.sendUpdateToAvatarId(senderId, 'friendDetails', [avId, inventory, trackAccess, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel])
self.air.dbInterface.queryObject(self.air.dbId, avId, handleToon)
def getPetDetails(self, avId):
senderId = self.air.getAvatarIdFromSender()
def handlePet(dclass, fields):
@ -235,9 +235,10 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
self.air.send(dg)
for friend in friendsList:
if friend[0] in self.onlineToons:
self.sendUpdateToAvatarId(doId, 'friendOnline', [friend[0]])
self.sendUpdateToAvatarId(friend[0], 'friendOnline', [doId])
friendId = friend[0]
if friendId in self.onlineToons:
self.sendUpdateToAvatarId(doId, 'friendOnline', [friendId])
self.sendUpdateToAvatarId(friendId, 'friendOnline', [doId])
def goingOffline(self, avId):
self.toonOffline(avId)
@ -249,9 +250,9 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
if dclass != self.air.dclassesByName['DistributedToonUD']:
return
friendsList = fields['setFriendsList'][0]
for friendId in friendsList:
if friendId in self.onlineToons:
self.sendUpdateToAvatarId(friendId, 'friendOffline', [doId])
for friend in friendsList:
if friend in self.onlineToons:
self.sendUpdateToAvatarId(friend, 'friendOffline', [doId])
if doId in self.onlineToons:
self.onlineToons.remove(doId)
if doId in self.toon2data:

View file

@ -8,7 +8,7 @@ globalFriendSecret = None
def showFriendSecret():
global globalFriendSecret
if not settings['trueFriends']:
if not base.cr.wantTrueFriends():
chatMgr = base.localAvatar.chatMgr
chatMgr.fsm.request('noTrueFriends')
else:

View file

@ -5,7 +5,6 @@ from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI
from toontown.hood import ZoneUtil
from toontown.safezone import TreasureGlobals
from toontown.safezone.DistributedFishingSpotAI import DistributedFishingSpotAI
from toontown.fishing.DistributedPondBingoManagerAI import DistributedPondBingoManagerAI
from toontown.safezone.DistributedPartyGateAI import DistributedPartyGateAI
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
from toontown.suit import DistributedSuitPlannerAI
@ -90,12 +89,6 @@ class HoodAI:
fishingPond.setArea(area)
fishingPond.generateWithRequired(zoneId)
fishingPond.start()
fishingPond.bingoMgr = DistributedPondBingoManagerAI(simbase.air)
fishingPond.bingoMgr.setPondDoId(fishingPond.getDoId())
fishingPond.bingoMgr.generateWithRequired(zoneId)
fishingPond.bingoMgr.initTasks()
fishingPonds.append(fishingPond)
elif isinstance(dnaGroup, DNAVisGroup):
zoneId = int(dnaGroup.getName().split(':')[0])

View file

@ -18,7 +18,6 @@ class BodyShop(StateData.StateData):
self.legChoice = 0
self.headChoice = 0
self.speciesChoice = 0
return
def enter(self, toon, shopsVisited = []):
base.disableMouse()

View file

@ -7,6 +7,7 @@ from toontown.toonbase import TTLocalizer, ToontownGlobals
import ShuffleButton
import random, colorsys
from direct.directnotify import DirectNotifyGlobal
from direct.task import Task
class ColorShop(StateData.StateData):
notify = DirectNotifyGlobal.directNotify.newCategory('ColorShop')
@ -15,7 +16,6 @@ class ColorShop(StateData.StateData):
StateData.StateData.__init__(self, doneEvent)
self.toon = None
self.colorAll = 1
return
def getColorList(self):
return ToonDNA.allColorsList
@ -28,6 +28,7 @@ class ColorShop(StateData.StateData):
self.allParts = (TTLocalizer.ColorAll, TTLocalizer.ColorShopHead, TTLocalizer.ColorShopBody, TTLocalizer.ColorShopGloves, TTLocalizer.ColorShopLegs)
if not hasattr(self, 'headChoice'):
self.headChoice = colorList.index(self.dna.headColor)
self.allChoice = self.headChoice
self.armChoice = colorList.index(self.dna.armColor)
self.gloveChoice = colorList.index(self.dna.gloveColor)
self.legChoice = colorList.index(self.dna.legColor)
@ -59,6 +60,7 @@ class ColorShop(StateData.StateData):
print 'ColorShop: toon not found'
self.hideButtons()
taskMgr.remove('colorDragTask')
def load(self):
self.gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
@ -94,7 +96,8 @@ class ColorShop(StateData.StateData):
self.pickImage = PNMImage(int((ToontownGlobals.COLOR_SATURATION_MAX - ToontownGlobals.COLOR_SATURATION_MIN) * 100), int((ToontownGlobals.COLOR_VALUE_MAX - ToontownGlobals.COLOR_VALUE_MIN) * 100))
self.hueSlider = DirectSlider(parent=self.advancedFrame, relief=None, image='phase_3/maps/color_picker_hue.jpg', scale=0.3, pos=(-0.05, 0, -0.43), image_scale=(0.1, 1.0, 1.0), pageSize=5, orientation=DGG.VERTICAL, command=self.__chooseHue)
self.pickButton = DirectButton(parent=self.advancedFrame, relief=None, image='phase_3/maps/color_picker_empty.png', scale=0.3, pos=(-0.45, 0, -0.43), frameColor=(1, 1, 1, 0.1), pressEffect=0)
self.pickButton.bind(DGG.B1CLICK, self.__pickColor)
self.pickButton.bind(DGG.B1PRESS, self.__startPickColor)
self.pickButton.bind(DGG.B1RELEASE, self.__stopPickColor)
self.partsFrame = DirectFrame(parent=self.advancedFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(-0.395, 0, -0.85), hpr=(0, 0, -2), scale=0.9, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorAll, text_scale=0.0625, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1))
self.partLButton = DirectButton(parent=self.partsFrame, relief=None, image=shuffleImage, image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-0.2, 0, 0), state=DGG.DISABLED, command=self.__swapPart, extraArgs=[-1])
self.partRButton = DirectButton(parent=self.partsFrame, relief=None, image=shuffleImage, image_scale=halfButtonInvertScale, image1_scale=halfButtonInvertHoverScale, image2_scale=halfButtonInvertHoverScale, pos=(0.2, 0, 0), command=self.__swapPart, extraArgs=[1])
@ -183,8 +186,9 @@ class ColorShop(StateData.StateData):
texture.load(self.pickImage)
self.pickButton['image'] = texture
def __pickColor(self, pos):
x, y = pos.getMouse()
def __pickColor(self, task=None):
x = base.mouseWatcherNode.getMouseX()
y = base.mouseWatcherNode.getMouseY()
win_w, win_h = base.win.getSize()
if win_w < win_h:
@ -197,7 +201,15 @@ class ColorShop(StateData.StateData):
image_scale = self.pickButton['image_scale']
x = (.5 + x / (2. * self.pickButton.getSx(aspect2d) * image_scale[0]))
y = (.5 + y / -(2. * self.pickButton.getSz(aspect2d) * image_scale[2]))
rgb = colorsys.hsv_to_rgb(self.hueSlider['value'], self.calcRelative(x, 0.0, 1.0, 0.36, 0.7), self.calcRelative(y, 0.0, 1.0, 0.5, 0.8)) + (1,)
if not (0.0 <= x <= 1.0 and 0.0 <= y <= 1.0):
return Task.cont
x = self.calcRelative(x, 0.0, 1.0, ToontownGlobals.COLOR_SATURATION_MIN, ToontownGlobals.COLOR_SATURATION_MAX)
y = self.calcRelative(y, 0.0, 1.0, ToontownGlobals.COLOR_VALUE_MIN, ToontownGlobals.COLOR_VALUE_MAX)
rgb = colorsys.hsv_to_rgb(self.hueSlider['value'], x, y) + (1,)
rgb = tuple([float('%.2f' % x) for x in rgb])
if self.partChoice in (0, 1):
self.dna.headColor = rgb
if self.partChoice in (0, 2):
@ -206,7 +218,16 @@ class ColorShop(StateData.StateData):
self.dna.gloveColor = rgb
if self.partChoice in (0, 4):
self.dna.legColor = rgb
self.toon.swapToonColor(self.dna)
return Task.cont
def __startPickColor(self, extra):
self.__stopPickColor(extra)
taskMgr.add(self.__pickColor, 'colorDragTask')
def __stopPickColor(self, extra):
taskMgr.remove('colorDragTask')
def __swapPart(self, offset):
self.partChoice += offset
@ -217,15 +238,18 @@ class ColorShop(StateData.StateData):
def __swapAllColor(self, offset):
colorList = self.getColorList()
length = len(colorList)
choice = (self.headChoice + offset) % length
self.__updateScrollButtons(choice, length, self.allLButton, self.allRButton)
self.__swapHeadColor(offset)
oldArmColorIndex = colorList.index(self.toon.style.armColor)
oldGloveColorIndex = colorList.index(self.toon.style.gloveColor)
oldLegColorIndex = colorList.index(self.toon.style.legColor)
self.__swapArmColor(choice - oldArmColorIndex)
self.__swapGloveColor(choice - oldGloveColorIndex)
self.__swapLegColor(choice - oldLegColorIndex)
self.allChoice = (self.allChoice + offset) % length
self.__updateScrollButtons(self.allChoice, length, self.allLButton, self.allRButton)
self.__updateScrollButtons(self.allChoice, length, self.headLButton, self.headRButton)
self.__updateScrollButtons(self.allChoice, length, self.armLButton, self.armRButton)
self.__updateScrollButtons(self.allChoice, length, self.gloveLButton, self.gloveRButton)
self.__updateScrollButtons(self.allChoice, length, self.legLButton, self.legRButton)
newColor = colorList[self.allChoice]
self.dna.headColor = newColor
self.dna.armColor = newColor
self.dna.gloveColor = newColor
self.dna.legColor = newColor
self.toon.swapToonColor(self.dna)
def __swapHeadColor(self, offset):
colorList = self.getColorList()

View file

@ -51,7 +51,6 @@ class ShuffleButton:
self.incBtnShowLerp = LerpColorInterval(self.incBtn, self.lerpDuration, Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 0))
self.decBtnShowLerp = LerpColorInterval(self.decBtn, self.lerpDuration, Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 0))
self.__updateArrows()
return
def unload(self):
if self.showLerp:

View file

@ -38,6 +38,11 @@ class BlinkingArrows:
self.stopArrowsFlashing()
self.arrow1.reparentTo(hidden)
self.arrow2.reparentTo(hidden)
def reparentTo(self, parent):
self.parent = parent
self.arrow1.reparentTo(self.parent)
self.arrow2.reparentTo(self.parent)
def startArrowsFlashing(self):
onColor = Vec4(1, 1, 1, 1)

View file

@ -21,6 +21,9 @@ def init():
'camera': camera,
'hidden': hidden,
'aspect2d': aspect2d,
'topLeft': base.a2dTopLeft,
'bottomLeft': base.a2dBottomLeft,
'bottomRight': base.a2dBottomRight,
'localToon': base.localAvatar,
'laffMeter': base.localAvatar.laffMeter,
'inventory': base.localAvatar.inventory,
@ -137,7 +140,7 @@ class NPCMoviePlayer(DirectObject.DirectObject):
elif varName in globalVarDict:
return globalVarDict[varName]
elif varName.find('tomDialogue') > -1 or varName.find('harryDialogue') > -1:
notify.warning('%s getting referenced. Tutorial Ack: %d Place: %s' % (varName, base.localAvatar.tutorialAck, base.cr.playGame.hood))
notify.warning('%s getting referenced. Tutorial Ack: %d Place: %s' % (varName, base.localAvatar.tutorialAck, base.cr.playGame.hood))
return None
else:
notify.error('Variable not defined: %s' % varName)

View file

@ -70,7 +70,7 @@ class QuestPoster(DirectFrame):
self.questProgress.hide()
self.funQuest = DirectLabel(parent=self.questFrame, relief=None, text=TTLocalizer.QuestPosterFun, text_fg=(0.0, 0.439, 1.0, 1.0), text_shadow=(0, 0, 0, 1), pos=(0, 0, -0.125), scale=0.04)
self.funQuest.hide()
self.teleportButton = DirectButton(parent=self.questFrame, relief=None, image=circleModel, text="Teleport", text_scale=0.035, text_pos=(-0.0025, -0.015), pos=(0.175, 0, 0.125), scale=0.75) #, text_bg=(0, 0.75, 1, 1)
self.teleportButton = DirectButton(parent=self.questFrame, relief=None, image=circleModel, text=TTLocalizer.TeleportButton, text_scale=0.035, text_pos=(-0.0025, -0.015), pos=(0.175, 0, 0.125), scale=0.75) #, text_bg=(0, 0.75, 1, 1)
self.teleportButton.hide()
self.laffMeter = None
return
@ -172,31 +172,28 @@ class QuestPoster(DirectFrame):
suitDoorOrigin = building.find('**/*_door_origin')
elevatorNodePath.reparentTo(suitDoorOrigin)
elevatorNodePath.setPosHpr(0, 0, 0, 0, 0, 0)
return
def teleportToShop(self, npcId):
npcZone = NPCToons.getNPCZone(npcId)
npcHood = ZoneUtil.getCanonicalHoodId(npcZone)
avZone = base.localAvatar.getZoneId()
avHood = ZoneUtil.getCanonicalHoodId(avZone)
avShard = base.localAvatar.defaultShard
avPlace = base.cr.playGame.getPlace()
hqZone = {2000:2520, 1000:1507, 3000:3508, 4000:4504, 5000:5502, 7000:7503, 9000:9505}
def callback(flag):
if flag:
npcZone = None
base.cr.buildingQueryMgr.d_isSuit(npcZone, callback)
if avShard not in base.cr.activeDistrictMap:
if npcZone in (-1, 0, None):
zoneId = base.localAvatar.getZoneId()
if ZoneUtil.isDynamicZone(zoneId) or ZoneUtil.isCogHQZone(zoneId):
zoneId = 2000
npcHood = ZoneUtil.getCanonicalHoodId(zoneId)
npcZone = hqZone.get(npcHood, 2520)
base.cr.buildingQueryMgr.d_isSuit(npcZone, lambda isSuit: self.teleportToShopCallback(npcZone, npcHood, isSuit))
def teleportToShopCallback(self, npcZone, npcHood, flag):
if flag:
self.teleportButton.setColorScale(0.3, 0.3, 0.3, 1.0)
return
if npcZone in [-1, 0, None]:
return
if not ZoneUtil.isInterior(npcZone):
return
if ZoneUtil.isHQ(npcZone):
args = (avHood, hqZone[avHood], avShard, -1)
else:
args = (npcHood, npcZone, avShard, -1)
avPlace.requestTeleport(*args)
self.teleportButton.setColorScale(1.0, 1.0, 1.0, 1.0)
base.cr.playGame.getPlace().requestTeleport(npcHood, npcZone, base.localAvatar.defaultShard, -1)
def fitGeometry(self, geom, fFlip = 0, dimension = 0.8):
p1 = Point3()
@ -231,7 +228,6 @@ class QuestPoster(DirectFrame):
self.rPictureFrame.hide()
self.questProgress.hide()
self.teleportButton.hide()
self.teleportButton.setPos(0.175, 0, -0.125)
if hasattr(self, 'chooseButton'):
self.chooseButton.destroy()
del self.chooseButton
@ -305,30 +301,17 @@ class QuestPoster(DirectFrame):
fComplete = quest.getCompletionStatus(base.localAvatar, questDesc) == Quests.COMPLETE
if Quests.isQuestJustForFun(questId, rewardId):
if fComplete:
self.funQuest.hide()
self.teleportButton.show()
else:
self.teleportButton.hide()
if toNpcId == Quests.ToonHQ:
self.teleportButton.show()
self.teleportButton.setPos(0.285, 0, -0.15)
toNpcName = TTLocalizer.QuestPosterHQOfficer
toNpcBuildingName = TTLocalizer.QuestPosterHQBuildingName
toNpcStreetName = TTLocalizer.QuestPosterHQStreetName
toNpcLocationName = TTLocalizer.QuestPosterHQLocationName
elif toNpcId == Quests.ToonTailor:
self.teleportButton.show()
self.teleportButton.setPos(0.285, 0, -0.15)
toNpcName = TTLocalizer.QuestPosterTailor
toNpcBuildingName = TTLocalizer.QuestPosterTailorBuildingName
toNpcStreetName = TTLocalizer.QuestPosterTailorStreetName
toNpcLocationName = TTLocalizer.QuestPosterTailorLocationName
else:
self.teleportButton.show()
self.teleportButton.setPos(0.285, 0, -0.15)
toNpcName = NPCToons.getNPCName(toNpcId)
toNpcZone = NPCToons.getNPCZone(toNpcId)
toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
@ -349,8 +332,13 @@ class QuestPoster(DirectFrame):
objectiveStrings = quest.getObjectiveStrings()
captions = map(string.capwords, quest.getObjectiveStrings())
imageColor = Vec4(*self.colors['white'])
self.teleportButton.hide()
if base.localAvatar.tutorialAck and (fComplete or quest.getType() in (Quests.DeliverGagQuest, Quests.DeliverItemQuest, Quests.VisitQuest, Quests.TrackChoiceQuest)):
self.teleportButton.show()
self.teleportButton.setPos(0.3, 0, -0.15)
if isinstance(quest, Quests.TexturedQuest) and quest.hasFrame():
self.teleportButton.hide()
frame = quest.getFrame()
frameBgColor = frame[1]
lIconGeom = frame[0]
@ -361,9 +349,6 @@ class QuestPoster(DirectFrame):
infoText = TTLocalizer.QuestPosterAnywhere
elif quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest:
frameBgColor = 'red'
if fComplete:
self.teleportButton.show()
self.teleportButton.setPos(0.175, 0, -0.125)
if quest.getType() == Quests.DeliverGagQuest:
invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
track, item = quest.getGagType()
@ -382,7 +367,6 @@ class QuestPoster(DirectFrame):
infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
rIconGeom = self.createNpcToonHead(toNpcId)
rIconGeomScale = IMAGE_SCALE_SMALL
self.teleportButton.setPos(0.285, 0, -0.15)
elif quest.getType() == Quests.RecoverItemQuest:
frameBgColor = 'green'
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
@ -425,10 +409,7 @@ class QuestPoster(DirectFrame):
infoText = quest.getLocationName()
if infoText == '':
infoText = TTLocalizer.QuestPosterAnywhere
else:
self.teleportButton.show()
elif quest.getType() == Quests.VisitQuest:
self.teleportButton.show()
frameBgColor = 'brown'
captions[0] = '%s' % toNpcName
lIconGeom = self.createNpcToonHead(toNpcId)
@ -436,7 +417,6 @@ class QuestPoster(DirectFrame):
if not fComplete:
infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
elif quest.getType() == Quests.TrackChoiceQuest:
self.teleportButton.hide()
frameBgColor = 'green'
invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
track1, track2 = quest.getChoices(base.localAvatar)
@ -455,7 +435,6 @@ class QuestPoster(DirectFrame):
infoZ = -0.02
invModel.removeNode()
elif quest.getType() == Quests.BuildingQuest:
self.teleportButton.hide()
frameBgColor = 'blue'
track = quest.getBuildingTrack()
numFloors = quest.getNumFloors()
@ -483,7 +462,6 @@ class QuestPoster(DirectFrame):
if infoText == '':
infoText = TTLocalizer.QuestPosterAnywhere
elif quest.getType() == Quests.FactoryQuest:
self.teleportButton.hide()
frameBgColor = 'blue'
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = bookModel.find('**/factoryIcon2')
@ -494,7 +472,6 @@ class QuestPoster(DirectFrame):
if infoText == '':
infoText = TTLocalizer.QuestPosterAnywhere
elif quest.getType() == Quests.MintQuest:
self.teleportButton.hide()
frameBgColor = 'blue'
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = bookModel.find('**/CashBotMint')
@ -505,7 +482,6 @@ class QuestPoster(DirectFrame):
if infoText == '':
infoText = TTLocalizer.QuestPosterAnywhere
elif quest.getType() == Quests.CogPartQuest:
self.teleportButton.hide()
frameBgColor = 'green'
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = bookModel.find('**/CogArmIcon2')
@ -516,7 +492,6 @@ class QuestPoster(DirectFrame):
if infoText == '':
infoText = TTLocalizer.QuestPosterAnywhere
elif quest.getType() == Quests.ForemanQuest or quest.getType() == Quests.SupervisorQuest:
self.teleportButton.hide()
frameBgColor = 'blue'
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = bookModel.find('**/skelecog5')
@ -527,13 +502,11 @@ class QuestPoster(DirectFrame):
if infoText == '':
infoText = TTLocalizer.QuestPosterAnywhere
elif quest.getType() == Quests.RescueQuest:
self.teleportButton.hide()
frameBgColor = 'blue'
lIconGeom = self.createNpcToonHead(random.choice(NPCToons.HQnpcFriends.keys()))
lIconGeomScale = 0.13
infoText = quest.getLocationName().strip()
elif quest.getType() == Quests.FriendQuest:
self.teleportButton.hide()
frameBgColor = 'brown'
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
lIconGeom = gui.find('**/FriendsBox_Closed')
@ -541,7 +514,6 @@ class QuestPoster(DirectFrame):
gui.removeNode()
infoText = TTLocalizer.QuestPosterAnywhere
elif quest.getType() == Quests.TrolleyQuest:
self.teleportButton.hide()
frameBgColor = 'lightBlue'
gui = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = gui.find('**/trolley')
@ -549,7 +521,6 @@ class QuestPoster(DirectFrame):
gui.removeNode()
infoText = TTLocalizer.QuestPosterPlayground
elif quest.getType() == Quests.MailboxQuest:
self.teleportButton.hide()
frameBgColor = 'lightBlue'
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = bookModel.find('**/package')
@ -557,7 +528,6 @@ class QuestPoster(DirectFrame):
bookModel.removeNode()
infoText = TTLocalizer.QuestPosterAtHome
elif quest.getType() == Quests.PhoneQuest:
self.teleportButton.hide()
frameBgColor = 'lightBlue'
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = bookModel.find('**/clarabelleCow')
@ -565,7 +535,6 @@ class QuestPoster(DirectFrame):
bookModel.removeNode()
infoText = TTLocalizer.QuestPosterOnPhone
else:
self.teleportButton.hide()
frameBgColor = 'blue'
if quest.getType() == Quests.CogTrackQuest:
dept = quest.getCogTrack()
@ -619,7 +588,6 @@ class QuestPoster(DirectFrame):
if infoText == '':
infoText = TTLocalizer.QuestPosterAnywhere
if fComplete:
self.teleportButton.show()
textColor = (0, 0.3, 0, 1)
imageColor = Vec4(*self.colors['lightGreen'])
lPos.setX(-0.18)
@ -694,8 +662,6 @@ class QuestPoster(DirectFrame):
self.questInfo['text'] = infoText
self.questInfo.setZ(infoZ)
self.fitLabel(self.questInfo)
if not Quests.QuestDict[questId][0] >= 11:
self.teleportButton.hide()
return
def unbindMouseEnter(self):

View file

@ -11,9 +11,8 @@ POSHPRSCALE toonBuilding -1.05 7 0 0 0 0 1.875 1.875 1.875
POSHPRSCALE cogBuilding -1.05 7 0 0 0 0 1.875 1.875 1.875
POSHPRSCALE squirt1 -1.05 7 0 0 0 0 1.875 1.875 1.875
POSHPRSCALE squirt2 -1.05 7 0 0 0 0 1.875 1.875 1.875
REPARENTTO camera npc
POS camera -2.2 5.2 3.3
HPR camera 215 5 0
WRTREPARENTTO camera npc
LERP_POSHPRSCALE camera 2.8 0.0 3.5 35 5 0 1 1 1 1.5
WRTREPARENTTO camera localToon
PLAY_ANIM npc "right-hand-start" 1
WAIT 1
@ -46,11 +45,13 @@ WAIT 0.5
REPARENTTO squirt2 hidden
OBSCURE_LAFFMETER 0
SHOW laffMeter
POS laffMeter 0 0 0
SCALE laffMeter 0.075 0.075 0.075
LERP_POS laffMeter 1.7 0 0.87 1
POS laffMeter 0.153 0.0 0.13
SCALE laffMeter 0.0 0.0 0.0
WRTREPARENTTO laffMeter aspect2d
LERP_POS laffMeter -0.25 0 -0.15 1
LERP_SCALE laffMeter 0.2 0.2 0.2 0.6
WAIT 1.0833
LOOP_ANIM npc "right-hand"
LOCAL_CHAT_CONFIRM npc QuestScript101_8 "CFReversed"
LOCAL_CHAT_CONFIRM npc QuestScript101_9 "CFReversed"
FUNCTION npc "sadEyes"
@ -90,9 +91,10 @@ LOCAL_CHAT_CONFIRM npc QuestScript101_10 "CFReversed"
FUNCTION npc "normalEyes"
FUNCTION npc "blinkEyes"
LAFFMETER 15 15
WRTREPARENTTO laffMeter bottomLeft
WAIT 0.5
LERP_POS laffMeter 0.15 0.15 0.15 1
LERP_SCALE laffMeter 0.085 0.085 0.085 0.6
LERP_POS laffMeter 0.153 0.0 0.13 0.6
LERP_SCALE laffMeter 0.075 0.075 0.075 0.6
PLAY_ANIM npc "right-hand-start" -2
WAIT 1.0625
LOOP_ANIM npc "neutral"
@ -125,20 +127,30 @@ UPON_TIMEOUT FUNCTION squirt1 "removeNode"
UPON_TIMEOUT FUNCTION squirt2 "removeNode"
UPON_TIMEOUT LOOP_ANIM npc "neutral"
UPON_TIMEOUT SHOW laffMeter
UPON_TIMEOUT POS laffMeter 0.15 0.15 0.15
UPON_TIMEOUT SCALE laffMeter 0.085 0.085 0.085
UPON_TIMEOUT REPARENTTO laffMeter bottomLeft
UPON_TIMEOUT POS laffMeter 0.15 0 0.13
UPON_TIMEOUT SCALE laffMeter 0.075 0.075 0.075
POS localToon 0.776 14.6 0
HPR localToon 47.5 0 0
FINISH_QUEST_MOVIE
ID quest_incomplete_110
DEBUG "quest assign 110"
LOCAL_CHAT_CONFIRM npc QuestScript110_1
OBSCURE_BOOK 0
REPARENTTO bookOpenButton aspect2d
SHOW bookOpenButton
POS bookOpenButton 0 0 0
SCALE bookOpenButton 0.5 0.5 0.5
LERP_COLOR_SCALE bookOpenButton 1 1 1 0 1 1 1 1 0.5
WRTREPARENTTO bookOpenButton bottomRight
WAIT 1.5
LERP_POS bookOpenButton -0.158 0 0.17 1
LERP_SCALE bookOpenButton 0.305 0.305 0.305 1
WAIT 1
LOCAL_CHAT_CONFIRM npc QuestScript110_2
ARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90
REPARENTTO arrows bottomRight
ARROWS_ON -0.41 0.11 0 -0.11 0.36 90
LOCAL_CHAT_PERSIST npc QuestScript110_3
WAIT_EVENT "enterStickerBook"
ARROWS_OFF
@ -149,6 +161,7 @@ CLEAR_CHAT npc
WAIT 0.5
TOON_HEAD npc -0.2 -0.45 1
LOCAL_CHAT_CONFIRM npc QuestScript110_4
REPARENTTO arrows aspect2d
ARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90
SHOW bookNextArrow
LOCAL_CHAT_PERSIST npc QuestScript110_5
@ -171,7 +184,8 @@ LOCAL_CHAT_CONFIRM npc QuestScript110_8
LOCAL_CHAT_CONFIRM npc QuestScript110_9
LOCAL_CHAT_PERSIST npc QuestScript110_10
ENABLE_CLOSE_BOOK
ARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90
REPARENTTO arrows bottomRight
ARROWS_ON -0.41 0.11 0 -0.11 0.36 90
WAIT_EVENT "exitStickerBook"
ARROWS_OFF
TOON_HEAD npc 0 0 0
@ -180,8 +194,11 @@ HIDE bookOpenButton
LOCAL_CHAT_CONFIRM npc QuestScript110_11 1
UPON_TIMEOUT OBSCURE_BOOK 0
UPON_TIMEOUT ARROWS_OFF
UPON_TIMEOUT REPARENTTO arrows aspect2d
UPON_TIMEOUT HIDE_BOOK
UPON_TIMEOUT COLOR_SCALE bookOpenButton 1 1 1 1
UPON_TIMEOUT POS bookOpenButton -0.158 0 0.17
UPON_TIMEOUT SCALE bookOpenButton 0.305 0.305 0.305
UPON_TIMEOUT TOON_HEAD npc 0 0 0
UPON_TIMEOUT SHOW bookOpenButton
FINISH_QUEST_MOVIE
@ -193,9 +210,9 @@ FUNCTION npc "stopLookAround"
POS camera 0.0 6.0 4.0
HPR camera 180.0 0.0 0.0
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_1
WAIT 0.8
WAIT 0.8
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_2
WAIT 0.8
WAIT 0.8
POS camera -5.0 -9.0 6.0
HPR camera -25.0 -10.0 0.0
POS localToon 203.8 18.64 -0.475
@ -203,9 +220,18 @@ HPR localToon -90.0 0.0 0.0
SHOW localToon
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_3
OBSCURE_CHAT 1 0
REPARENTTO chatScButton aspect2d
SHOW chatScButton
WAIT 0.6
ARROWS_ON -1.3644 0.91 180 -1.5644 0.74 -90
POS chatScButton -0.3 0 -0.1
SCALE chatScButton 2.0 2.0 2.0
LERP_COLOR_SCALE chatScButton 1 1 1 0 1 1 1 1 0.5
WRTREPARENTTO chatScButton topLeft
WAIT 0.5
LERP_POS chatScButton 0.204 0 -0.072 0.6
LERP_SCALE chatScButton 1.179 1.179 1.179 0.6
WAIT 0.6
REPARENTTO arrows topLeft
ARROWS_ON 0.41 -0.09 180 0.21 -0.26 -90
LOCAL_CHAT_PERSIST npc QuestScriptTutorialBlocker_4
WAIT_EVENT "enterSpeedChat"
ARROWS_OFF
@ -218,16 +244,24 @@ REPARENTTO camera localToon
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_5 "CFReversed"
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_6 "CFReversed"
OBSCURE_CHAT 0 0
REPARENTTO chatNormalButton aspect2d
SHOW chatNormalButton
WAIT 0.6
POS chatNormalButton -0.3 0 -0.1
SCALE chatNormalButton 2.0 2.0 2.0
LERP_COLOR_SCALE chatNormalButton 1 1 1 0 1 1 1 1 0.5
WAIT 0.5
WRTREPARENTTO chatNormalButton topLeft
LERP_POS chatNormalButton 0.068 0 -0.072 0.6
LERP_SCALE chatNormalButton 1.179 1.179 1.179 0.6
WAIT 0.6
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_7 "CFReversed"
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_8 1 "CFReversed"
LOOP_ANIM npc "walk"
LERP_HPR npc 270 0 0 0.5
WAIT 0.5
LOOP_ANIM npc "run"
LERP_POS npc 217.4 18.81 -0.475 0.75
LERP_HPR npc 240 0 0 0.75
LERP_POS npc 217.4 18.81 -0.475 0.75
LERP_HPR npc 240 0 0 0.75
WAIT 0.75
LERP_POS npc 222.4 15.0 -0.475 0.35
LERP_HPR npc 180 0 0 0.35
@ -237,7 +271,12 @@ WAIT 0.75
REPARENTTO npc hidden
FREE_LOCALTOON
UPON_TIMEOUT ARROWS_OFF
UPON_TIMEOUT OBSCURE_CHAT 0 0
UPON_TIMEOUT REPARENTTO arrows aspect2d
UPON_TIMEOUT POS chatScButton 0.204 0 -0.072
UPON_TIMEOUT SCALE chatScButton 1.179 1.179 1.179
UPON_TIMEOUT POS chatNormalButton 0.068 0 -0.072
UPON_TIMEOUT SCALE chatNormalButton 1.179 1.179 1.179
UPON_TIMEOUT OBSCURE_CHAT 0 0
UPON_TIMEOUT REPARENTTO camera localToon
FINISH_QUEST_MOVIE
@ -250,13 +289,15 @@ WAIT 0.1
LOCAL_CHAT_CONFIRM npc QuestScriptGagShop_1
LERP_POS npcToonHead -0.64 0 -0.74 0.7
LERP_SCALE npcToonHead 0.82 0.82 0.82 0.7
LERP_COLOR_SCALE purchaseBg 1 1 1 1 0.6 0.6 0.6 1 0.7
LERP_COLOR_SCALE purchaseBg 1 1 1 1 0.6 0.6 0.6 1 0.7
WAIT 0.7
SHOW inventory
LOCAL_CHAT_CONFIRM npc QuestScriptGagShop_1a
ARROWS_ON -0.19 0.04 180 -0.4 0.26 90
LOCAL_CHAT_PERSIST npc QuestScriptGagShop_3
SEND_EVENT "enableGagPanel"
WAIT_EVENT "inventory-selection"
ARROWS_OFF
CLEAR_CHAT npc
WAIT 0.5
LOCAL_CHAT_CONFIRM npc QuestScriptGagShop_4
@ -299,6 +340,7 @@ LERP_COLOR_SCALE purchaseBg 0.6 0.6 0.6 1 1 1 1 1 0.5
WAIT 0.5
SEND_EVENT "enableBackToPlayground"
UPON_TIMEOUT TOON_HEAD npc 0 0 0
UPON_TIMEOUT ARROWS_OFF
UPON_TIMEOUT SHOW inventory
UPON_TIMEOUT SEND_EVENT "enableGagPanel"
UPON_TIMEOUT SEND_EVENT "enableBackToPlayground"
@ -320,10 +362,9 @@ CHAT_CONFIRM npc QuestScript145_2 1
UPON_TIMEOUT FUNCTION frame "removeNode"
FINISH_QUEST_MOVIE
ID quest_incomplete_150
CHAT_CONFIRM npc QuestScript150_1
ARROWS_ON 1.65 0.51 -120 1.65 0.51 -120
ARROWS_ON 1.05 0.51 -120 1.05 0.51 -120
SHOW_FRIENDS_LIST
CHAT_CONFIRM npc QuestScript150_2
ARROWS_OFF
@ -334,4 +375,4 @@ CHAT_CONFIRM npc QuestScript150_4 1
UPON_TIMEOUT HIDE_FRIENDS_LIST
UPON_TIMEOUT ARROWS_OFF
FINISH_QUEST_MOVIE
'''
'''

View file

@ -6,13 +6,30 @@ class LeaderboardMgrAI:
def __init__(self, air):
self.air = air
self.database = simbase.backups.load('leaderboard', (self.air.districtId,), default=({}))
if self.air.dbConn:
self.air.dbGlobalCursor.leaderboards.ensure_index([('ai', 1)])
shard = {'ai': self.air.districtId}
doc = self.air.dbGlobalCursor.leaderboards.find_one(shard)
if not doc:
self.database = ({})
else:
self.database = doc.get('database', ({}))
else:
self.database = simbase.backups.load('leaderboard', (self.air.districtId,), default=({}))
def getDatabase(self):
return self.database
def saveDatabase(self):
simbase.backups.save('leaderboard', (self.air.districtId,), self.database)
if self.air.dbConn:
shard = {'ai': self.air.districtId}
self.air.dbGlobalCursor.leaderboards.update(shard,
{'$setOnInsert': shard,
'$set': {'database': self.database}},
upsert = True)
else:
simbase.backups.save('leaderboard', (self.air.districtId,), self.database)
messenger.send('goofyLeaderboardChange')
def trimList(self, list):

View file

@ -773,3 +773,22 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
oldFields = {'setWishNameState': 'PENDING'}
return self.rpc_updateObject(
avId, 'DistributedToonUD', newFields, oldFields=oldFields)
@rpcmethod(accessLevel=MODERATOR)
def rpc_setChatSettings(self, accId, chatSettings):
"""
Summary:
Sets the chat settings of the account associated with the provided
[accId].
Parameters:
[int accId] = The ID of the account whose chat settings
are to be changed.
[uint8[sp+, tf]] = The chat settings - SpeedChat Plus and
True Friends
Example response:
On success: True
On failure: False
"""
return self.rpc_updateObject(accId, 'AccountUD', {'CHAT_SETTINGS': chatSettings})

View file

@ -1,42 +1,26 @@
from panda3d.core import *
from toontown.toonbase.ToonBaseGlobal import *
import DistributedSZTreasure
from direct.task.Task import Task
import math
import random
from DistributedTreasure import DistributedTreasure
import math, random
class DistributedEFlyingTreasure(DistributedSZTreasure.DistributedSZTreasure):
class DistributedEFlyingTreasure(DistributedTreasure):
def __init__(self, cr):
DistributedSZTreasure.DistributedSZTreasure.__init__(self, cr)
self.modelPath = 'phase_5.5/models/props/popsicle_treasure'
self.grabSoundPath = 'phase_4/audio/sfx/SZ_DD_treasure.ogg'
DistributedTreasure.__init__(self, cr)
self.scale = 2
self.delT = math.pi * 2.0 * random.random()
self.shadow = 0
def disable(self):
DistributedSZTreasure.DistributedSZTreasure.disable(self)
DistributedTreasure.disable(self)
taskMgr.remove(self.taskName('flying-treasure'))
def generateInit(self):
DistributedSZTreasure.DistributedSZTreasure.generateInit(self)
def setPosition(self, x, y, z):
DistributedSZTreasure.DistributedSZTreasure.setPosition(self, x, y, z)
DistributedTreasure.setPosition(self, x, y, z)
self.initPos = self.nodePath.getPos()
self.pos = self.nodePath.getPos()
def startAnimation(self):
taskMgr.add(self.animateTask, self.taskName('flying-treasure'))
def animateTask(self, task):
pos = self.initPos
t = 0.5 * math.pi * globalClock.getFrameTime()
dZ = 5.0 * math.sin(t + self.delT)
dY = 2.0 * math.cos(t + self.delT)
self.nodePath.setPos(pos[0], pos[1], pos[2] + dZ)
if self.pos:
del self.pos
self.pos = self.nodePath.getPos()
return Task.cont
return task.cont

View file

@ -0,0 +1,4 @@
import DistributedTreasureAI
class DistributedEFlyingTreasureAI(DistributedTreasureAI.DistributedTreasureAI):
pass

View file

@ -661,6 +661,8 @@ class DistributedFishingSpot(DistributedObject.DistributedObject):
jar.setPos(0, 0, 0)
def resetCastGui(self):
if not self.castGui:
return
self.notify.debug('resetCastGui: Bingo Night Ends - resetting Gui')
bucket = self.castGui.find('**/bucket')
jar = self.castGui.find('**/jar')

View file

@ -75,11 +75,13 @@ class Playground(Place.Place):
State.State('doorIn',
self.enterDoorIn,
self.exitDoorIn, [
'walk']),
'walk',
'stopped']),
State.State('doorOut',
self.enterDoorOut,
self.exitDoorOut, [
'walk']),
'walk',
'stopped']),
State.State('NPCFA',
self.enterNPCFA,
self.exitNPCFA, [

View file

@ -729,31 +729,25 @@ class ExtraOptionsTabPage(DirectFrame):
button_image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR'))
self.speed_chat_scale = 0.055
self.fov_label = DirectLabel(parent=self, relief=None, text=TTLocalizer.FieldOfViewLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight))
self.speedchatPlus_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
self.trueFriends_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight))
self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 3 * textRowHeight))
self.tpTransition_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 4 * textRowHeight))
self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
self.tpTransition_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight))
self.fov_slider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord),
value=settings['fov'], pageSize=5, range=(ToontownGlobals.DefaultCameraFov, ToontownGlobals.MaxCameraFov), command=self.__doFov,
thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2)
self.fov_slider.setScale(0.25)
self.speedchatPlus_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleSpeedchatPlus)
self.trueFriends_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleTrueFriends)
self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 3 * textRowHeight), command=self.__doToggleCogInterface)
self.tpTransition_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 4 * textRowHeight), command=self.__doToggleTpTransition)
self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleCogInterface)
self.tpTransition_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleTpTransition)
self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=button_image, image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1),
command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045))
guiButton.removeNode()
circleModel.removeNode()
self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 5, self.__updateFishingPole, [False], self.__applyFishingPole)
self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 6, self.__updateNametagStyle, [False], self.__applyNametagStyle)
self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 3, self.__updateFishingPole, [False], self.__applyFishingPole)
self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 4, self.__updateNametagStyle, [False], self.__applyNametagStyle)
def enter(self):
self.show()
self.settingsChanged = 0
self.__setSpeedchatPlusButton()
self.__setTrueFriendsButton()
self.__setCogInterfaceButton()
self.__setTpTransitionButton()
self.__updateNametagStyle()
@ -774,18 +768,14 @@ class ExtraOptionsTabPage(DirectFrame):
del self.fov_label
self.fov_slider.destroy()
del self.fov_slider
self.speedchatPlus_label.destroy()
del self.speedchatPlus_label
self.trueFriends_label.destroy()
del self.trueFriends_label
self.cogInterface_label.destroy()
del self.cogInterface_label
self.speedchatPlus_toggleButton.destroy()
del speedchatPlus_toggleButton
self.trueFriends_toggleButton.destroy()
del self.trueFriends_toggleButton
self.cogInterface_toggleButton.destroy()
del self.cogInterface_toggleButton
del self.cogInterface_label
self.tpTransition_label.destroy()
del self.tpTransition_label
self.tpTransition_toggleButton.destroy()
del self.tpTransition_toggleButton
self.bugReportButton.destroy()
del self.bugReportButton
self.destroyReportNotice()
@ -808,28 +798,6 @@ class ExtraOptionsTabPage(DirectFrame):
self.cogInterface_label['text'] = TTLocalizer.CogInterfaceLabelOn if settings['cogInterface'] else TTLocalizer.CogInterfaceLabelOff
self.cogInterface_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogInterface'] else TTLocalizer.OptionsPageToggleOn
def __doToggleSpeedchatPlus(self):
messenger.send('wakeup')
settings['speedchatPlus'] = not settings['speedchatPlus']
Toon.reconsiderAllToonsUnderstandable()
self.settingsChanged = 1
self.__setSpeedchatPlusButton()
def __setSpeedchatPlusButton(self):
self.speedchatPlus_label['text'] = TTLocalizer.SpeedchatPlusLabelOn if settings['speedchatPlus'] else TTLocalizer.SpeedchatPlusLabelOff
self.speedchatPlus_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['speedchatPlus'] else TTLocalizer.OptionsPageToggleOn
def __doToggleTrueFriends(self):
messenger.send('wakeup')
settings['trueFriends'] = not settings['trueFriends']
Toon.reconsiderAllToonsUnderstandable()
self.settingsChanged = 1
self.__setTrueFriendsButton()
def __setTrueFriendsButton(self):
self.trueFriends_label['text'] = TTLocalizer.TrueFriendsLabelOn if settings['trueFriends'] else TTLocalizer.TrueFriendsLabelOff
self.trueFriends_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['trueFriends'] else TTLocalizer.OptionsPageToggleOn
def __doToggleTpTransition(self):
messenger.send('wakeup')
settings['tpTransition'] = not settings['tpTransition']

View file

@ -1,23 +1,16 @@
from panda3d.core import *
from direct.actor import Actor
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import FSM
from direct.fsm import State
from direct.interval.IntervalGlobal import *
from direct.showbase.PythonUtil import Functor
from direct.task.Task import Task
from panda3d.core import *
import types
import random
import Suit
import SuitDNA
from otp.avatar import Avatar
from toontown.battle import BattleParticles
from toontown.battle import BattleProps
from otp.nametag.NametagGroup import NametagGroup
from otp.nametag.NametagConstants import *
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from toontown.battle import BattleParticles, BattleProps
from toontown.toonbase import TTLocalizer, ToontownGlobals
import Suit, SuitDNA, SuitHealthBar
import types, random
GenericModel = 'phase_9/models/char/bossCog'
ModelDict = {'s': 'phase_9/models/char/sellbotBoss',
@ -28,8 +21,6 @@ AnimList = ('Ff_speech', 'ltTurn2Wave', 'wave', 'Ff_lookRt', 'turn2Fb', 'Ff_neut
class BossCog(Avatar.Avatar):
notify = DirectNotifyGlobal.directNotify.newCategory('BossCog')
healthColors = Suit.Suit.healthColors
healthGlowColors = Suit.Suit.healthGlowColors
def __init__(self):
Avatar.Avatar.__init__(self)
@ -52,15 +43,14 @@ class BossCog(Avatar.Avatar):
self.queuedAnimIvals = []
self.treadsLeftPos = 0
self.treadsRightPos = 0
self.healthBar = None
self.healthCondition = 0
self.healthBar = SuitHealthBar.SuitHealthBar()
self.animDoneEvent = 'BossCogAnimDone'
self.animIvalName = 'BossCogAnimIval'
self.warningSfx = loader.loadSfx('phase_9/audio/sfx/CHQ_GOON_tractor_beam_alarmed.ogg')
def delete(self):
Avatar.Avatar.delete(self)
self.removeHealthBar()
self.healthBar.delete()
self.setDizzy(0)
self.stopAnimate()
if self.doorA:
@ -155,92 +145,17 @@ class BossCog(Avatar.Avatar):
self.collNode.setCollideMask(self.collNode.getIntoCollideMask() | ToontownGlobals.PieBitmask)
def generateHealthBar(self):
self.removeHealthBar()
chestNull = self.find('**/joint_lifeMeter')
if chestNull.isEmpty():
return
model = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
button = model.find('**/minnieCircle')
button.setScale(6.0)
button.setP(-20)
button.setColor(self.healthColors[0])
button.reparentTo(chestNull)
self.healthBar = button
glow = BattleProps.globalPropPool.getProp('glow')
glow.reparentTo(self.healthBar)
glow.setScale(0.28)
glow.setPos(-0.005, 0.01, 0.015)
glow.setColor(self.healthGlowColors[0])
button.flattenLight()
self.healthBarGlow = glow
self.healthCondition = 0
self.healthBar.generate()
self.healthBar.geom.reparentTo(self.find('**/joint_lifeMeter'))
self.healthBar.geom.setScale(6.0)
self.healthBar.geom.setHpr(0, -20, 0)
self.healthBar.geom.show()
def updateHealthBar(self):
if self.healthBar == None:
return
health = 1.0 - float(self.bossDamage) / float(self.bossMaxDamage)
if health > 0.95:
condition = 0
elif health > 0.9:
condition = 1
elif health > 0.8:
condition = 2
elif health > 0.7:
condition = 3#Yellow
elif health > 0.6:
condition = 4
elif health > 0.5:
condition = 5
elif health > 0.3:
condition = 6#Orange
elif health > 0.15:
condition = 7
elif health > 0.05:
condition = 8#Red
elif health > 0.0:
condition = 9#Blinking Red
else:
condition = 10
if self.healthCondition != condition:
if condition == 9:
blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1))
taskMgr.add(blinkTask, self.uniqueName('blink-task'))
elif condition == 10:
if self.healthCondition == 9:
taskMgr.remove(self.uniqueName('blink-task'))
blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1))
taskMgr.add(blinkTask, self.uniqueName('blink-task'))
else:
self.healthBar.setColor(self.healthColors[condition], 1)
self.healthBarGlow.setColor(self.healthGlowColors[condition], 1)
self.healthCondition = condition
def __blinkRed(self, task):
if not self.healthBar:
return
self.healthBar.setColor(self.healthColors[8], 1)
self.healthBarGlow.setColor(self.healthGlowColors[8], 1)
if self.healthCondition == 10:
self.healthBar.setScale(1.17)
return Task.done
def __blinkGray(self, task):
if not self.healthBar:
return
self.healthBar.setColor(self.healthColors[9], 1)
self.healthBarGlow.setColor(self.healthGlowColors[9], 1)
if self.healthCondition == 10:
self.healthBar.setScale(1.0)
return Task.done
def removeHealthBar(self):
if self.healthBar:
self.healthBar.removeNode()
self.healthBar = None
if self.healthCondition == 9 or self.healthCondition == 10:
taskMgr.remove(self.uniqueName('blink-task'))
self.healthCondition = 0
return
self.healthBar.update(1.0 - float(self.bossDamage) / float(self.bossMaxDamage))
def reverseHead(self):
self.neck.setHpr(self.neckReversedHpr)

View file

@ -18,8 +18,7 @@ from toontown.effects import DustCloud
from toontown.suit import DistributedBossCog
from toontown.suit import Suit
from toontown.suit import SuitDNA
from toontown.toon import Toon
from toontown.toon import ToonDNA
from toontown.toon import Toon, NPCToons
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import ToontownTimer
@ -197,17 +196,7 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM):
def __makeResistanceToon(self):
if self.resistanceToon:
return
npc = Toon.Toon()
npc.setName(TTLocalizer.BossbotResistanceToonName)
npc.setPickable(0)
npc.setPlayerType(NametagGroup.CCNonPlayer)
dna = ToonDNA.ToonDNA()
dna.newToonRandom(11237, 'm', 1)
dna.head = 'sls'
npc.setDNAString(dna.makeNetString())
npc.animFSM.request('neutral')
npc.loop('neutral')
self.resistanceToon = npc
self.resistanceToon = NPCToons.createLocalNPC(10002)
self.resistanceToon.setPosHpr(*ToontownGlobals.BossbotRTIntroStartPosHpr)
state = random.getstate()
random.seed(self.doId)

View file

@ -19,8 +19,7 @@ from toontown.building import ElevatorUtils
from toontown.chat import ResistanceChat
from toontown.coghq import CogDisguiseGlobals
from toontown.distributed import DelayDelete
from toontown.toon import Toon
from toontown.toon import ToonDNA
from toontown.toon import Toon, NPCToons
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from otp.nametag import NametagGroup
@ -38,7 +37,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM):
def __init__(self, cr):
DistributedBossCog.DistributedBossCog.__init__(self, cr)
FSM.FSM.__init__(self, 'DistributedSellbotBoss')
FSM.FSM.__init__(self, 'DistributedCashbotBoss')
self.resistanceToon = None
self.resistanceToonOnstage = 0
self.cranes = {}
@ -104,16 +103,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM):
def __makeResistanceToon(self):
if self.resistanceToon:
return
npc = Toon.Toon()
npc.setName(TTLocalizer.ResistanceToonName)
npc.setPickable(0)
npc.setPlayerType(NametagGroup.CCNonPlayer)
dna = ToonDNA.ToonDNA()
dna.newToonRandom(11237, 'f', 1)
dna.head = 'pls'
npc.setDNAString(dna.makeNetString())
npc.animFSM.request('neutral')
self.resistanceToon = npc
self.resistanceToon = NPCToons.createLocalNPC(12002)
self.resistanceToon.setPosHpr(*ToontownGlobals.CashbotRTBattleOneStartPosHpr)
state = random.getstate()
random.seed(self.doId)
@ -700,7 +690,6 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM):
self.endVault.unstash()
self.evWalls.stash()
self.midVault.unstash()
self.__showResistanceToon(True)
base.playMusic(self.stingMusic, looping=1, volume=0.9)
DistributedBossCog.DistributedBossCog.enterIntroduction(self)
@ -784,7 +773,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM):
self.stopAnimate()
self.cleanupAttacks()
self.setDizzy(0)
self.removeHealthBar()
self.healthBar.delete()
localAvatar.setCameraFov(ToontownGlobals.CogHQCameraFov)
if self.newState != 'Victory':
self.battleThreeMusic.stop()

View file

@ -403,18 +403,32 @@ class DistributedSellbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS
def enterReward(self):
DistributedBossCogAI.DistributedBossCogAI.enterReward(self)
def getVP(invoker):
for do in simbase.air.doId2do.values():
if isinstance(do, DistributedSellbotBossAI):
if invoker.doId in do.involvedToons:
return do
@magicWord(category=CATEGORY_ADMINISTRATOR)
def secondVP():
"""
Skips to the second round of the VP.
"""
invoker = spellbook.getInvoker()
boss = getVP(invoker)
if not boss:
return "You aren't in a VP!"
boss.exitIntroduction()
boss.b_setState('RollToBattleTwo')
return 'Skipping to the second round...'
@magicWord(category=CATEGORY_ADMINISTRATOR)
def skipVP():
"""
Skips to the final round of the VP.
"""
invoker = spellbook.getInvoker()
boss = None
for do in simbase.air.doId2do.values():
if isinstance(do, DistributedSellbotBossAI):
if invoker.doId in do.involvedToons:
boss = do
break
boss = getVP(invoker)
if not boss:
return "You aren't in a VP!"
if boss.state in ('PrepareBattleThree', 'BattleThree'):
@ -429,12 +443,7 @@ def killVP():
Kills the VP.
"""
invoker = spellbook.getInvoker()
boss = None
for do in simbase.air.doId2do.values():
if isinstance(do, DistributedSellbotBossAI):
if invoker.doId in do.involvedToons:
boss = do
break
boss = getVP(invoker)
if not boss:
return "You aren't in a VP!"
boss.b_setState('Victory')

View file

@ -326,12 +326,12 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.loop('neutral', 0)
self.disableBattleDetect()
self.corpMedallion.hide()
self.healthBar.show()
self.healthBar.geom.show()
if self.currHP < self.maxHP:
self.updateHealthBar(0, 1)
def exitBattle(self):
self.healthBar.hide()
self.healthBar.geom.hide()
self.corpMedallion.show()
self.currHP = self.maxHP
self.interactivePropTrackBonus = -1

View file

@ -2,11 +2,11 @@ from panda3d.core import *
from direct.actor import Actor
from direct.task.Task import Task
from otp.avatar import Avatar
from toontown.battle import BattleProps, SuitBattleGlobals
from toontown.battle import SuitBattleGlobals
from otp.nametag.NametagGroup import NametagGroup
from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.suit import SuitGlobals
import SuitDNA, string
import SuitDNA, SuitHealthBar, string
aSize = 6.06
bSize = 5.29
@ -299,26 +299,6 @@ def attachSuitHead(node, suitName):
class Suit(Avatar.Avatar):
__module__ = __name__
healthColors = (Vec4(0, 1, 0, 1),# 0 Green
Vec4(0.5, 1, 0, 1),#1 Green-Yellow
Vec4(0.75, 1, 0, 1),#2 Yellow-Green
Vec4(1, 1, 0, 1),#3 Yellow
Vec4(1, 0.866, 0, 1),#4 Yellow-Orange
Vec4(1, 0.6, 0, 1),#5 Orange-Yellow
Vec4(1, 0.5, 0, 1),#6 Orange
Vec4(1, 0.25, 0, 1.0),#7 Red-Orange
Vec4(1, 0, 0, 1),#8 Red
Vec4(0.3, 0.3, 0.3, 1))#9 Grey
healthGlowColors = (Vec4(0.25, 1, 0.25, 0.5),#Green
Vec4(0.5, 1, 0.25, .5),#1 Green-Yellow
Vec4(0.75, 1, 0.25, .5),#2 Yellow-Green
Vec4(1, 1, 0.25, 0.5),#Yellow
Vec4(1, 0.866, 0.25, .5),#4 Yellow-Orange
Vec4(1, 0.6, 0.25, .5),#5 Orange-Yellow
Vec4(1, 0.5, 0.25, 0.5),#6 Orange
Vec4(1, 0.25, 0.25, 0.5),#7 Red-Orange
Vec4(1, 0.25, 0.25, 0.5),#8 Red
Vec4(0.3, 0.3, 0.3, 0))#9 Grey
medallionColors = {'c': Vec4(0.863, 0.776, 0.769, 1.0),
's': Vec4(0.843, 0.745, 0.745, 1.0),
'l': Vec4(0.749, 0.776, 0.824, 1.0),
@ -341,8 +321,7 @@ class Suit(Avatar.Avatar):
self.shadowJoint = None
self.nametagJoint = None
self.headParts = []
self.healthBar = None
self.healthCondition = 0
self.healthBar = SuitHealthBar.SuitHealthBar()
self.isDisguised = 0
self.isWaiter = 0
self.isRental = 0
@ -368,7 +347,7 @@ class Suit(Avatar.Avatar):
part.removeNode()
self.headParts = []
self.removeHealthBar()
self.healthBar.delete()
Avatar.Avatar.delete(self)
def setHeight(self, height):
@ -585,97 +564,18 @@ class Suit(Avatar.Avatar):
icons.removeNode()
def generateHealthBar(self):
self.removeHealthBar()
model = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
button = model.find('**/minnieCircle')
model.removeNode()
button.setScale(3.0)
button.setH(180.0)
button.setColor(self.healthColors[0])
chestNull = self.find('**/joint_attachMeter')
button.reparentTo(chestNull)
self.healthBar = button
glow = BattleProps.globalPropPool.getProp('glow')
glow.reparentTo(self.healthBar)
glow.setScale(0.28)
glow.setPos(-0.005, 0.01, 0.015)
glow.setColor(self.healthGlowColors[0])
button.flattenLight()
self.healthBarGlow = glow
self.healthBar.hide()
self.healthCondition = 0
self.healthBar.generate()
self.healthBar.geom.reparentTo(self.find('**/joint_attachMeter'))
self.healthBar.geom.setScale(3.0)
def resetHealthBarForSkele(self):
self.healthBar.setPos(0.0, 0.1, 0.0)
self.healthBar.geom.setPos(0.0, 0.1, 0.0)
def updateHealthBar(self, hp, forceUpdate = 0):
if hp > self.currHP:
hp = self.currHP
self.currHP -= hp
health = float(self.currHP) / float(self.maxHP)
if health > 0.95:
condition = 0
elif health > 0.9:
condition = 1
elif health > 0.8:
condition = 2
elif health > 0.7:
condition = 3#Yellow
elif health > 0.6:
condition = 4
elif health > 0.5:
condition = 5
elif health > 0.3:
condition = 6#Orange
elif health > 0.15:
condition = 7
elif health > 0.05:
condition = 8#Red
elif health > 0.0:
condition = 9#Blinking Red
else:
condition = 10
if self.healthCondition != condition or forceUpdate:
if condition == 9:
blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1))
taskMgr.add(blinkTask, self.uniqueName('blink-task'))
elif condition == 10:
if self.healthCondition == 9:
taskMgr.remove(self.uniqueName('blink-task'))
blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1))
taskMgr.add(blinkTask, self.uniqueName('blink-task'))
else:
self.healthBar.setColor(self.healthColors[condition], 1)
self.healthBarGlow.setColor(self.healthGlowColors[condition], 1)
self.healthCondition = condition
def __blinkRed(self, task):
if not self.healthBar:
return Task.done
self.healthBar.setColor(self.healthColors[8], 1)
self.healthBarGlow.setColor(self.healthGlowColors[8], 1)
if self.healthCondition == 7:
self.healthBar.setScale(1.17)
return Task.done
def __blinkGray(self, task):
if not self.healthBar:
return Task.done
self.healthBar.setColor(self.healthColors[9], 1)
self.healthBarGlow.setColor(self.healthGlowColors[9], 1)
if self.healthCondition == 10:
self.healthBar.setScale(1.0)
return Task.done
def removeHealthBar(self):
if self.healthBar:
self.healthBar.removeNode()
self.healthBar = None
if self.healthCondition == 9 or self.healthCondition == 10:
taskMgr.remove(self.uniqueName('blink-task'))
self.healthCondition = 0
return
self.healthBar.update(float(self.currHP) / float(self.maxHP))
def getLoseActor(self):
if self.loseActor == None:
@ -773,3 +673,14 @@ class Suit(Avatar.Avatar):
return SkelSuitDialogArray
else:
return SuitDialogArray
def getTypeText(self):
if self.virtual:
return TTLocalizer.CogPanelVirtual
elif self.isWaiter:
return TTLocalizer.CogPanelWaiter
elif self.skeleRevives:
return TTLocalizer.CogPanelRevives % (self.skeleRevives + 1)
elif self.isSkelecog:
return TTLocalizer.CogPanelSkeleton
return ''

View file

@ -0,0 +1,115 @@
from direct.task.Task import Task
from toontown.battle import BattleProps
HEALTH_COLORS = (
(0, 1, 0, 1),
(0.5, 1, 0, 1),
(0.75, 1, 0, 1),
(1, 1, 0, 1),
(1, 0.86, 0, 1),
(1, 0.6, 0, 1),
(1, 0.5, 0, 1),
(1, 0.25, 0, 1.0),
(1, 0, 0, 1),
(0.3, 0.3, 0.3, 1)
)
HEALTH_GLOW_COLORS = (
(0.25, 1, 0.25, 0.5),
(0.5, 1, 0.25, .5),
(0.75, 1, 0.25, .5),
(1, 1, 0.25, 0.5),
(1, 0.866, 0.25, .5),
(1, 0.6, 0.25, .5),
(1, 0.5, 0.25, 0.5),
(1, 0.25, 0.25, 0.5),
(1, 0.25, 0.25, 0.5),
(0.3, 0.3, 0.3, 0))
class SuitHealthBar:
def __init__(self):
self.geom = None
self.geomGlow = None
self.healthCondition = 0
def delete(self):
if self.geom:
self.geom.removeNode()
self.geom = None
self.geomGlow = None
taskMgr.remove('blink-task-%s' % id(self))
self.healthCondition = 0
def generate(self):
self.delete()
model = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
button = model.find('**/minnieCircle')
model.removeNode()
button.setH(180.0)
button.setColor(HEALTH_COLORS[0])
self.geom = button
glow = BattleProps.globalPropPool.getProp('glow')
glow.reparentTo(self.geom)
glow.setScale(0.28)
glow.setPos(-0.005, 0.01, 0.015)
glow.setColor(HEALTH_GLOW_COLORS[0])
button.flattenLight()
self.geomGlow = glow
self.geom.hide()
self.healthCondition = 0
def getHealthCondition(self, health):
if health > 0.95:
return 0
elif health > 0.9:
return 1
elif health > 0.8:
return 2
elif health > 0.7:
return 3
elif health > 0.6:
return 4
elif health > 0.5:
return 5
elif health > 0.3:
return 6
elif health > 0.15:
return 7
elif health > 0.05:
return 8
elif health > 0.0:
return 9
return 10
def update(self, hp, forceUpdate = 0):
if not self.geom:
return
condition = self.getHealthCondition(hp)
if self.healthCondition != condition or forceUpdate:
taskMgr.remove('blink-task-%s' % id(self))
if condition in (9, 10):
blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75 if condition == 9 else 0.25), Task(self.__blinkGray), Task.pause(0.1))
taskMgr.add(blinkTask, 'blink-task-%s' % id(self))
else:
self.geom.setColor(HEALTH_COLORS[condition], 1)
self.geomGlow.setColor(HEALTH_GLOW_COLORS[condition], 1)
self.healthCondition = condition
def __blink(self, color):
if not self.geom:
return
self.geom.setColor(HEALTH_COLORS[color], 1)
self.geomGlow.setColor(HEALTH_GLOW_COLORS[color], 1)
def __blinkRed(self, task):
self.__blink(8)
def __blinkGray(self, task):
self.__blink(9)

View file

@ -61,3 +61,6 @@ class DistributedNPCToonBaseAI(DistributedToonAI.DistributedToonAI):
def getPositionIndex(self):
return self.posIndex
def getStartAnimState(self):
return 'neutral'

View file

@ -2382,13 +2382,19 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
def addReport(self, doId):
if not self.isReported(doId):
self.reported.append(doId)
def setFriendsList(self, friendsList):
DistributedPlayer.DistributedPlayer.setFriendsList(self, friendsList)
messenger.send('friendsListChanged')
Toon.reconsiderAllToonsUnderstandable()
def setTrueFriends(self, trueFriends):
Toon.reconsiderAllToonsUnderstandable()
self.trueFriends = trueFriends
Toon.reconsiderAllToonsUnderstandable()
messenger.send('friendsListChanged')
def isTrueFriends(self, doId):
return doId in self.trueFriends
return base.cr.wantTrueFriends() and doId in self.trueFriends
def applyBuffs(self):
for id, timestamp in enumerate(self.buffs):

View file

@ -4878,18 +4878,20 @@ def givePies(pieType, numPies=0):
else:
target.b_setNumPies(ToontownGlobals.FullPies)
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
def trackBonus(trackIndex):
@magicWord(category=CATEGORY_PROGRAMMER, types=[int, int])
def trackBonus(trackIndex, level):
"""
Modify the invoker's track bonus level.
"""
invoker = spellbook.getInvoker()
if not 0 <= trackIndex < 7:
return 'Invalid track index!'
if not -1 <= level <= 6:
return 'Invalid level!'
trackBonusLevel = [0] * 7
trackBonusLevel[trackIndex] = 1
trackBonusLevel[trackIndex] = level
invoker.b_setTrackBonusLevel(trackBonusLevel)
return 'Your track bonus level has been set!'
return 'Your track bonus level has been set to %s!' % level
@magicWord(category=CATEGORY_PROGRAMMER, types=[str, str, int])
def track(command, track, value=None):

View file

@ -773,7 +773,7 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame):
self.sosButton.show()
self.passButton.show()
self.fireButton.show()
if localAvatar.getPinkSlips() > 0:
if localAvatar.getPinkSlips():
self.fireButton['state'] = DGG.NORMAL
self.fireButton['image_color'] = Vec4(0, 0.6, 1, 1)
else:

View file

@ -66,7 +66,7 @@ class NPCFriendPanel(DirectFrame):
self.update()
def update(self):
friendList = self.friendDict.keys()
friendList = sorted(self.friendDict.keys(), reverse=True, key=lambda id: NPCToons.getNPCTrackLevelHpRarity(id)[3])
cardNum = 0
for i in xrange(self.pos, self.pos + 16):

File diff suppressed because it is too large Load diff

View file

@ -526,8 +526,14 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase):
def __handleCastDialog(self):
self.cleanupDialog()
base.cr.playGame.getPlace().setState('stopped')
self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.AvatarPanelCastInfo % self.avatar.getName(), text_wordwrap=20, command=self.cleanupDialogAndWalk)
self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.AvatarPanelCastInfo % self.avatar.getName(), text_wordwrap=20, command=self.__cleanupDialogAndWalk)
self.dialog.show()
def __cleanupDialogAndWalk(self, extra=None):
if self.dialog:
self.dialog.destroy()
self.dialog = None
base.cr.playGame.getPlace().fsm.request('walk')
def __makeBoardingGui(self):
self.confirmKickOutDialog = None

View file

@ -4288,7 +4288,7 @@ HeadingToFactoryTitle = '%s'
ForemanConfrontedMsg = '%s is battling the ' + Foreman + '!'
MintBossConfrontedMsg = '%s is battling the Supervisor!'
StageBossConfrontedMsg = '%s is battling the District Attorney!'
stageToonEnterElevator = '%s \nhas entered the elevator'
StageToonEnterElevator = '%s\nhas entered the elevator!'
ForcedLeaveStageAckMsg = 'The Law Clerk was defeated before you could reach him. You did not recover any Jury Notices.'
MinigameWaitingForOtherToons = 'Waiting for other toons to join...'
MinigamePleaseWait = 'Please wait...'
@ -4701,7 +4701,7 @@ LawbotBossName = 'Chief Justice'
BossbotBossName = 'C. E. O.'
BossCogNameWithDept = '%(name)s\n%(dept)s'
BossCogPromoteDoobers = 'You are hereby promoted to full-fledged %s. Congratulations!'
BossCogDoobersAway = {'s': 'Go! And make that sale!'}
BossCogDoobersAway = {'s': 'Go! And make that sale!'}
BossCogWelcomeToons = 'Welcome, new Cogs!'
BossCogPromoteToons = 'You are hereby promoted to full-fledged %s. Congratu--'
CagedToonInterruptBoss = 'Hey! Hiya! Hey over there!'
@ -4741,7 +4741,6 @@ CagedToonBattleThreeMaxTouchCage = 21
CagedToonBattleThreeMaxAdvice = 106
CashbotBossHadEnough = "That's it. I've had enough of these pesky Toons!"
CashbotBossOuttaHere = "I've got a train to catch!"
ResistanceToonName = 'Mata Hairy'
ResistanceToonCongratulations = "You did it! Congratulations!\x07You're an asset to the Resistance!\x07Here's a special phrase you can use in a tight spot:\x07%s\x07When you say it, %s.\x07But you can only use it once, so choose that time well!"
ResistanceToonToonupInstructions = 'all the Toons near you will gain %s Laff points'
ResistanceToonToonupAllInstructions = 'all the Toons near you will gain full Laff points'
@ -6241,6 +6240,9 @@ NPCToonNames = {20000: 'Tutorial Tom',
9319: 'Psyche',
9320: 'Toony Bob',
9321: 'Sir Biscuit',
9322: 'Glower',
9323: 'Zedd',
9324: 'Nacib',
7001: 'N. Prisoned',
7002: 'R.E. Leaseme',
7003: 'Lemmy Owte',
@ -6265,8 +6267,10 @@ NPCToonNames = {20000: 'Tutorial Tom',
7022: 'Dee Version',
7023: 'Bo Nanapeel',
10001: 'Healer Sara',
10002: "Good ol' Gil Giggles",
11001: 'Healer Gabriel',
12001: 'Healer Bill',
12002: 'Mata Hairy',
13001: 'Healer Clover'}
zone2TitleDict = {2513: ('Toon Hall', ''),
2514: ('Toontown Bank', ''),
@ -6806,6 +6810,7 @@ zone2TitleDict = {2513: ('Toon Hall', ''),
3830: ('Wait and See Goggle Defogging', ''),
9802: ("Barbra's Bohemian Art Supplies", ''),
9804: ("Angry Dan's Garden Sprinklers", ''),
9806: ("Nacib Niri", ''),
9808: ("Ori-O's Creamery and Dairy", ''),
9809: ('Rave of the Forks', ''),
9812: ('Louds Silent-Shop', ''),
@ -6816,6 +6821,8 @@ zone2TitleDict = {2513: ('Toon Hall', ''),
9817: ('The Psyche-Ologist', ''),
9819: ("Toony Bob's Fluffy Pillows", ''),
9820: ("Batty's Bat Supply", ''),
9821: ("Milk or Sugar? Tea Shop", ''),
9822: ("Zedd's Pasta", ''),
9824: ("Joe's Burnt Biscuits", ''),
9826: ("Juste-A-Cote Taxi Service", ''),
9827: ("Frekly Fred's Storage Shack", ''),
@ -8124,7 +8131,6 @@ BossbotBossPreTwo1 = "What's taking so long?"
BossbotBossPreTwo2 = 'Get cracking and serve my banquet!'
BossbotRTServeFood1 = 'Hehe, serve the food I place on these conveyor belts.'
BossbotRTServeFood2 = 'If you serve a cog three times in a row it will explode.'
BossbotResistanceToonName = "Good ol' Gil Giggles"
BossbotPhase3Speech1 = "What's happening here?!"
BossbotPhase3Speech2 = 'These waiters are toons!'
BossbotPhase3Speech3 = 'Get them!!!'
@ -8528,10 +8534,6 @@ BugReportNotice = 'Attention!\n\nThis button will open a browser which will send
CodeRedemptionWarning = 'NOTICE: All codes can only be entered once!'
CogInterfaceLabelOn = 'The cog battle interface is on.'
CogInterfaceLabelOff = 'The cog battle interface is off.'
SpeedchatPlusLabelOn = 'Speedchat Plus is on.'
SpeedchatPlusLabelOff = 'Speedchat Plus is off.'
TrueFriendsLabelOn = 'True Friends is on.'
TrueFriendsLabelOff = 'True Friends is off.'
TpTransitionLabelOn = 'The teleport transition is on.'
TpTransitionLabelOff = 'The teleport transition is off.'
FieldOfViewLabel = 'Field of View:'
@ -8723,6 +8725,8 @@ ShardPagePreferred = 'Preferred'
ShardPageShardTitle = '%s Population: %s'
ShardPageTeleport = 'Teleport to\n%s'
TeleportButton = 'Teleport'
Blacklist = [
"$1ut",
"$h1t",

View file

@ -177,7 +177,7 @@ CarryLimits = (((10,
(15,
15,
10,
5,
7,
3,
0,
0),
@ -185,15 +185,15 @@ CarryLimits = (((10,
15,
15,
10,
5,
2,
7,
3,
0),
(20,
15,
15,
10,
5,
2,
7,
3,
1)),
((10,
0,

View file

@ -1687,7 +1687,7 @@ TV_NOT_OWNER = 0
TV_INVALID_VIDEO = 1
TV_OK = 2
COLOR_SATURATION_MIN = 0.36
COLOR_SATURATION_MIN = 0.5
COLOR_SATURATION_MAX = 0.8
COLOR_VALUE_MIN = 0.5
COLOR_VALUE_MAX = 0.9
COLOR_VALUE_MAX = 0.8

View file

@ -98,10 +98,6 @@ if 'language' not in settings:
settings['language'] = 'English'
if 'cogInterface' not in settings:
settings['cogInterface'] = True
if 'speedchatPlus' not in settings:
settings['speedchatPlus'] = True
if 'trueFriends' not in settings:
settings['trueFriends'] = True
if 'tpTransition' not in settings:
settings['tpTransition'] = True
if 'fov' not in settings:

View file

@ -67,8 +67,8 @@ class Street(BattlePlace.BattlePlace):
'purchase']),
State.State('WaitForBattle', self.enterWaitForBattle, self.exitWaitForBattle, ['battle', 'walk']),
State.State('battle', self.enterBattle, self.exitBattle, ['walk', 'teleportOut', 'died']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk', 'stopped']),
State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk', 'stopped']),
State.State('elevatorIn', self.enterElevatorIn, self.exitElevatorIn, ['walk']),
State.State('elevator', self.enterElevator, self.exitElevator, ['walk']),
State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk',

View file

@ -122,23 +122,12 @@ class TownBattle(StateData.StateData):
self.SOSPetInfoPanel = TownBattleSOSPetInfoPanel.TownBattleSOSPetInfoPanel(self.SOSPetInfoPanelDoneEvent)
self.fireCogPanelDoneEvent = 'fire-cog-panel-done'
self.FireCogPanel = FireCogPanel.FireCogPanel(self.fireCogPanelDoneEvent)
self.cogFireCosts = [None,
None,
None,
None]
self.toonPanels = (TownBattleToonPanel.TownBattleToonPanel(0),
TownBattleToonPanel.TownBattleToonPanel(1),
TownBattleToonPanel.TownBattleToonPanel(2),
TownBattleToonPanel.TownBattleToonPanel(3))
self.cogPanels = (TownBattleCogPanel.TownBattleCogPanel(0),
TownBattleCogPanel.TownBattleCogPanel(1),
TownBattleCogPanel.TownBattleCogPanel(2),
TownBattleCogPanel.TownBattleCogPanel(3))
self.toonPanels = [TownBattleToonPanel.TownBattleToonPanel(i) for i in xrange(4)]
self.cogPanels = [TownBattleCogPanel.TownBattleCogPanel(i) for i in xrange(4)]
self.timer = ToontownTimer.ToontownTimer()
self.timer.posInTopRightCorner()
self.timer.setScale(0.4)
self.timer.hide()
return
def cleanup(self):
self.ignore(self.attackPanelDoneEvent)
@ -154,11 +143,9 @@ class TownBattle(StateData.StateData):
del self.FireCogPanel
del self.SOSPetSearchPanel
del self.SOSPetInfoPanel
for toonPanel in self.toonPanels:
toonPanel.cleanup()
for cogPanel in self.cogPanels:
cogPanel.cleanup()
for panel in self.toonPanels + self.cogPanels:
panel.cleanup()
del self.toonPanels
del self.cogPanels
@ -171,7 +158,6 @@ class TownBattle(StateData.StateData):
self.parentFSMState.addChild(self.fsm)
if not self.isLoaded:
self.load()
print 'Battle Event %s' % event
self.battleEvent = event
self.fsm.enterInitialState()
base.localAvatar.laffMeter.start()
@ -186,7 +172,6 @@ class TownBattle(StateData.StateData):
base.localAvatar.inventory.setBattleCreditMultiplier(self.creditMultiplier)
base.localAvatar.inventory.setActivateMode('battle', heal=0, bldg=bldg, tutorialFlag=tutorialFlag)
self.SOSPanel.bldg = bldg
return
def exit(self):
base.localAvatar.laffMeter.stop()
@ -235,44 +220,21 @@ class TownBattle(StateData.StateData):
for toonPanel in self.toonPanels:
toonPanel.hide()
toonPanel.setPos(0, 0, -0.9)
if num == 1:
self.toonPanels[0].setX(self.oddPos[1])
self.toonPanels[0].show()
elif num == 2:
self.toonPanels[0].setX(self.evenPos[1])
self.toonPanels[0].show()
self.toonPanels[1].setX(self.evenPos[2])
self.toonPanels[1].show()
elif num == 3:
self.toonPanels[0].setX(self.oddPos[0])
self.toonPanels[0].show()
self.toonPanels[1].setX(self.oddPos[1])
self.toonPanels[1].show()
self.toonPanels[2].setX(self.oddPos[2])
self.toonPanels[2].show()
elif num == 4:
self.toonPanels[0].setX(self.evenPos[0])
self.toonPanels[0].show()
self.toonPanels[1].setX(self.evenPos[1])
self.toonPanels[1].show()
self.toonPanels[2].setX(self.evenPos[2])
self.toonPanels[2].show()
self.toonPanels[3].setX(self.evenPos[3])
self.toonPanels[3].show()
else:
self.notify.error('Bad number of toons: %s' % num)
return None
self.positionPanels(num, self.toonPanels)
def __enterCogPanels(self, num):
for cogPanel in self.cogPanels:
cogPanel.hide()
cogPanel.updateHealthBar()
cogPanel.setPos(0, 0, 0.62)
self.positionPanels(num, self.cogPanels)
def positionPanels(self, num, panels):
pos = self.evenPos if num % 2 == 0 else self.oddPos
for i, panel in enumerate(self.cogPanels):
for i, panel in enumerate(panels):
if num > i:
panel.setX(pos[i if num >= 3 else i + 1])
panel.show()
@ -460,25 +422,11 @@ class TownBattle(StateData.StateData):
toonIds = map(lambda toon: toon.doId, toons)
self.notify.debug('adjustCogsAndToons() toonIds: %s self.toons: %s' % (toonIds, self.toons))
maxSuitLevel = 0
cogFireCostIndex = 0
for cog in cogs:
maxSuitLevel = max(maxSuitLevel, cog.getActualLevel())
self.cogFireCosts[cogFireCostIndex] = 1
cogFireCostIndex += 1
creditLevel = maxSuitLevel
resetActivateMode = 0
if numCogs == self.numCogs and creditLevel == self.creditLevel and luredIndices == self.luredIndices and trappedIndices == self.trappedIndices and toonIds == self.toons:
for i in xrange(len(cogs)):
if cogs[i].getHP() == self.cogPanels[i].getDisplayedCurrHp():
if cogs[i].getMaxHP() == self.cogPanels[i].getDisplayedMaxHp():
if cogs[i] == self.cogPanels[i].getSuit():
continue
else:
resetActivateMode = 1
break
else:
resetActivateMode = 1
resetActivateMode = numCogs != self.numCogs or creditLevel != self.creditLevel or luredIndices != self.luredIndices or trappedIndices != self.trappedIndices or toonIds != self.toons
self.notify.debug('adjustCogsAndToons() resetActivateMode: %s' % resetActivateMode)
self.numCogs = numCogs
self.creditLevel = creditLevel
@ -603,7 +551,7 @@ class TownBattle(StateData.StateData):
def enterFire(self):
canHeal, canTrap, canLure = self.checkHealTrapLure()
self.FireCogPanel.enter(self.numCogs, luredIndices=self.luredIndices, trappedIndices=self.trappedIndices, track=self.track, fireCosts=self.cogFireCosts)
self.FireCogPanel.enter(self.numCogs, luredIndices=self.luredIndices, trappedIndices=self.trappedIndices, track=self.track)
self.accept(self.fireCogPanelDoneEvent, self.__handleCogFireDone)
return None

View file

@ -1,228 +1,66 @@
from panda3d.core import *
from toontown.battle import BattleProps
from toontown.toonbase import ToontownGlobals
from toontown.toonbase.ToontownBattleGlobals import *
from direct.directnotify import DirectNotifyGlobal
import string
from toontown.suit import Suit
from direct.gui.DirectGui import *
from toontown.suit import Suit, SuitHealthBar
from toontown.toonbase import TTLocalizer
from direct.task.Task import Task
class TownBattleCogPanel(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('TownBattleCogPanel')
healthColors = (Vec4(0, 1, 0, 1),# 0 Green
Vec4(0.5, 1, 0, 1),#1 Green-Yellow
Vec4(0.75, 1, 0, 1),#2 Yellow-Green
Vec4(1, 1, 0, 1),#3 Yellow
Vec4(1, 0.866, 0, 1),#4 Yellow-Orange
Vec4(1, 0.6, 0, 1),#5 Orange-Yellow
Vec4(1, 0.5, 0, 1),#6 Orange
Vec4(1, 0.25, 0, 1.0),#7 Red-Orange
Vec4(1, 0, 0, 1),#8 Red
Vec4(0.3, 0.3, 0.3, 1))#9 Grey
healthGlowColors = (Vec4(0.25, 1, 0.25, 0.5),#Green
Vec4(0.5, 1, 0.25, .5),#1 Green-Yellow
Vec4(0.75, 1, 0.25, .5),#2 Yellow-Green
Vec4(1, 1, 0.25, 0.5),#Yellow
Vec4(1, 0.866, 0.25, .5),#4 Yellow-Orange
Vec4(1, 0.6, 0.25, .5),#5 Orange-Yellow
Vec4(1, 0.5, 0.25, 0.5),#6 Orange
Vec4(1, 0.25, 0.25, 0.5),#7 Red-Orange
Vec4(1, 0.25, 0.25, 0.5),#8 Red
Vec4(0.3, 0.3, 0.3, 0))#9 Grey
def __init__(self, id):
gui = loader.loadModel('phase_3.5/models/gui/battle_gui')
DirectFrame.__init__(self, relief=None, image=gui.find('**/ToonBtl_Status_BG'), image_color=Vec4(0.86, 0.86, 0.86, 0.7))
self.setScale(0.8)
DirectFrame.__init__(self, relief=None, image=gui.find('**/ToonBtl_Status_BG'), image_color=(0.86, 0.86, 0.86, 0.7), scale=0.8)
self.initialiseoptions(TownBattleCogPanel)
self.levelText = DirectLabel(parent=self, text='', pos=(-0.06, 0, -0.075), text_scale=0.055)
self.suitType = DirectLabel(parent=self, text='', pos=(0.12, 0, -0.075), text_scale=0.045)
self.healthBar = None
self.healthBarGlow = None
self.hpChangeEvent = None
self.blinkTask = None
self.suit = None
self.head = None
self.maxHP = None
self.currHP = None
self.hpChangeEvent = None
self.typeText = DirectLabel(parent=self, text='', pos=(0.12, 0, -0.075), text_scale=0.045)
self.healthBar = SuitHealthBar.SuitHealthBar()
self.generateHealthBar()
self.suit = None
self.suitHead = None
self.hide()
gui.removeNode()
return
def cleanup(self):
self.ignoreAll()
self.cleanupHead()
self.levelText.removeNode()
self.typeText.removeNode()
self.healthBar.delete()
del self.levelText
del self.typeText
del self.healthBar
DirectFrame.destroy(self)
def cleanupHead(self):
if self.suitHead:
self.suitHead.removeNode()
del self.suitHead
def setSuit(self, suit):
if self.suit == suit:
messenger.send(self.suit.uniqueName('hpChange'))
return
self.ignoreAll()
self.cleanupHead()
self.suit = suit
self.setLevelText(self.suit.getActualLevel())
if self.head:
self.head.removeNode()
self.setSuitHead(self.suit.getStyleName())
self.setMaxHp(self.suit.getMaxHP())
self.setHp(self.suit.getHP())
self.hpChangeEvent = self.suit.uniqueName('hpChange')
if self.blinkTask:
taskMgr.remove(self.blinkTask)
self.blinkTask = None
self.accept(self.hpChangeEvent, self.updateHealthBar)
self.generateSuitHead(suit.getStyleName())
self.updateHealthBar()
self.healthBar.show()
if self.suit.virtual:
self.setTypeText(TTLocalizer.CogPanelVirtual)
elif self.suit.isWaiter:
self.setTypeText(TTLocalizer.CogPanelWaiter)
elif self.suit.skeleRevives:
self.setTypeText(TTLocalizer.CogPanelRevives % (self.suit.skeleRevives + 1))
elif self.suit.isSkelecog:
self.setTypeText(TTLocalizer.CogPanelSkeleton)
else:
self.setTypeText('')
def getSuit(self, suit):
return self.suit
def setLevelText(self, level):
self.levelText['text'] = TTLocalizer.CogPanelLevel % level
def setTypeText(self, suitType):
self.suitType['text'] = suitType
def setSuitHead(self, suitName):
self.head = Suit.attachSuitHead(self, suitName)
self.head.setX(0.1)
self.head.setZ(0.01)
self.head.setScale(0.05)
self.levelText['text'] = TTLocalizer.CogPanelLevel % suit.getActualLevel()
self.typeText['text'] = suit.getTypeText()
self.accept(suit.uniqueName('hpChange'), self.updateHealthBar)
def generateSuitHead(self, name):
self.suitHead = Suit.attachSuitHead(self, name)
self.suitHead.setScale(0.05)
self.suitHead.setPos(0.1, 0, 0.01)
def generateHealthBar(self):
model = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
button = model.find('**/minnieCircle')
model.removeNode()
button.setScale(0.5)
button.setH(180.0)
button.setColor(self.healthColors[0])
button.reparentTo(self)
button.setX(-0.065)
button.setZ(0.05)
self.healthBar = button
glow = BattleProps.globalPropPool.getProp('glow')
glow.reparentTo(self.healthBar)
glow.setScale(0.28)
glow.setPos(-0.005, 0.01, 0.015)
glow.setColor(self.healthGlowColors[0])
button.flattenLight()
self.healthBarGlow = glow
self.healthBar.hide()
self.healthCondition = 0
self.healthBar.generate()
self.healthBar.geom.reparentTo(self)
self.healthBar.geom.setScale(0.5)
self.healthBar.geom.setPos(-0.065, 0, 0.05)
self.healthBar.geom.show()
def updateHealthBar(self):
if not self.suit:
return
self.setHp(self.suit.getHP())
health = float(self.currHP) / float(self.maxHP)
if health > 0.95:
condition = 0
elif health > 0.9:
condition = 1
elif health > 0.8:
condition = 2
elif health > 0.7:
condition = 3#Yellow
elif health > 0.6:
condition = 4
elif health > 0.5:
condition = 5
elif health > 0.3:
condition = 6#Orange
elif health > 0.15:
condition = 7
elif health > 0.05:
condition = 8#Red
elif health > 0.0:
condition = 9#Blinking Red
else:
condition = 10
if self.healthCondition != condition:
if condition == 9:
self.blinkTask = self.uniqueName('blink-task')
blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1))
taskMgr.add(blinkTask, self.blinkTask)
elif condition == 10:
if self.healthCondition == 9:
self.blinkTask = self.uniqueName('blink-task')
taskMgr.remove(self.blinkTask)
self.blinkTask = None
blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1))
taskMgr.add(blinkTask, self.blinkTask)
else:
if self.blinkTask:
taskMgr.remove(self.blinkTask)
self.blinkTask = None
self.healthBar.setColor(self.healthColors[condition], 1)
self.healthBarGlow.setColor(self.healthGlowColors[condition], 1)
self.healthCondition = condition
def __blinkRed(self, task):
if not self.blinkTask or not self.healthBar:
return Task.done
self.healthBar.setColor(self.healthColors[8], 1)
self.healthBarGlow.setColor(self.healthGlowColors[8], 1)
if self.healthCondition == 7:
self.healthBar.setScale(1.17)
return Task.done
def __blinkGray(self, task):
if not self.blinkTask or not self.healthBar:
return Task.done
self.healthBar.setColor(self.healthColors[9], 1)
self.healthBarGlow.setColor(self.healthGlowColors[9], 1)
if self.healthCondition == 10:
self.healthBar.setScale(1.0)
return Task.done
def removeHealthBar(self):
if self.healthCondition == 9 or self.healthCondition == 10:
if self.blinkTask:
taskMgr.remove(self.blinkTask)
self.blinkTask = None
if self.healthBar:
self.healthBar.removeNode()
self.healthBar = None
self.healthCondition = 0
return
def getDisplayedCurrHp(self):
return self.currHP
def getDisplayedMaxHp(self):
return self.maxHP
def setMaxHp(self, hp):
self.maxHP = hp
def setHp(self, hp):
self.currHP = hp
def show(self):
DirectFrame.show(self)
def cleanup(self):
self.ignoreAll()
self.removeHealthBar()
if self.head is not None:
self.head.removeNode()
del self.head
self.levelText.destroy()
del self.levelText
del self.suitType
del self.healthBar
if self.healthBarGlow is not None:
self.healthBarGlow.removeNode()
del self.healthBarGlow
del self.suit
del self.maxHP
del self.currHP
DirectFrame.destroy(self)
self.healthBar.update(float(self.suit.getHP()) / float(self.suit.getMaxHP()))

View file

@ -126,6 +126,8 @@ class TownBattleToonPanel(DirectFrame):
self.gag.setScale(0.8)
self.gag.setPos(0, 0, 0.02)
self.hasGag = 1
if self.avatar is not None and self.avatar.checkGagBonus(track, level):
self.gag.setColor((1, 0, 0, 1) if track == 1 and level == 5 else (0, 1, 0, 1))
if numTargets is not None and targetIndex is not None and localNum is not None:
self.whichText.show()
self.whichText['text'] = self.determineWhichText(numTargets, targetIndex, localNum, index)

View file

@ -35,7 +35,7 @@ class ClientServicesManager(DistributedObjectGlobal):
def requestAvatars(self):
self.sendUpdate('requestAvatars')
def setAvatars(self, avatars):
def setAvatars(self, chatSettings, avatars):
avList = []
for avNum, avName, avDNA, avPosition, nameState in avatars:
nameOpen = int(nameState == 1)
@ -48,6 +48,7 @@ class ClientServicesManager(DistributedObjectGlobal):
names[3] = avName
avList.append(PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen))
self.cr.handleChatSettings(chatSettings)
self.cr.handleAvatarsList(avList)
# --- AVATAR CREATION/DELETION ---

View file

@ -333,7 +333,8 @@ class LoginAccountFSM(OperationFSM):
'LAST_LOGIN': time.ctime(),
'LAST_LOGIN_TS': time.time(),
'ACCOUNT_ID': str(self.userId),
'ACCESS_LEVEL': self.accessLevel
'ACCESS_LEVEL': self.accessLevel,
'CHAT_SETTINGS': [1, 1]
}
self.csm.air.dbInterface.createObject(
self.csm.air.dbId,
@ -645,7 +646,7 @@ class GetAvatarsFSM(AvatarOperationFSM):
potentialAvs.append([avId, name, fields['setDNAString'][0],
index, nameState])
self.csm.sendUpdateToAccountId(self.target, 'setAvatars', [potentialAvs])
self.csm.sendUpdateToAccountId(self.target, 'setAvatars', [self.account['CHAT_SETTINGS'], potentialAvs])
self.demand('Off')
def enterQueryNameState(self):