Merge remote-tracking branch 'origin/master' into feature/deployment

This commit is contained in:
Alexander 2015-08-07 16:13:37 -04:00
commit d93a8e5e60
45 changed files with 150 additions and 520 deletions

View file

@ -255,7 +255,6 @@ from toontown.coghq import DistributedCogHQDoor/AI
from toontown.coghq import DistributedSellbotHQDoor/AI from toontown.coghq import DistributedSellbotHQDoor/AI
from toontown.toon import DistributedNPCToonBase/AI from toontown.toon import DistributedNPCToonBase/AI
from toontown.toon import DistributedNPCToon/AI from toontown.toon import DistributedNPCToon/AI
from toontown.toon import DistributedSmartNPC/AI
from toontown.toon import DistributedNPCSpecialQuestGiver/AI from toontown.toon import DistributedNPCSpecialQuestGiver/AI
from toontown.toon import DistributedNPCFlippyInToonHall/AI from toontown.toon import DistributedNPCFlippyInToonHall/AI
from toontown.toon import DistributedNPCScientist/AI from toontown.toon import DistributedNPCScientist/AI
@ -1745,13 +1744,6 @@ dclass DistributedNPCToon : DistributedNPCToonBase {
chooseTrack(int8) airecv clsend; chooseTrack(int8) airecv clsend;
}; };
dclass DistributedSmartNPC : DistributedNPCToonBase {
greet(uint32, uint32) broadcast ram;
talkMessage(uint32, string) airecv clsend;
respond(uint32, string, uint32) broadcast ram;
dismiss(uint32, uint16) broadcast ram;
};
dclass DistributedNPCSpecialQuestGiver : DistributedNPCToonBase { dclass DistributedNPCSpecialQuestGiver : DistributedNPCToonBase {
setMovie(uint8, uint32, uint32, uint16[], int16) broadcast ram; setMovie(uint8, uint32, uint32, uint16[], int16) broadcast ram;
setMovieDone() airecv clsend; setMovieDone() airecv clsend;
@ -1844,7 +1836,6 @@ dclass DistributedElevator : DistributedObject {
requestExit() airecv clsend; requestExit() airecv clsend;
setElevatorTripId(uint32) required broadcast ram; setElevatorTripId(uint32) required broadcast ram;
setAntiShuffle(uint8) required broadcast ram; setAntiShuffle(uint8) required broadcast ram;
setMinLaff(uint8) required broadcast ram;
}; };
dclass DistributedElevatorFSM : DistributedObject { dclass DistributedElevatorFSM : DistributedObject {
@ -1871,7 +1862,6 @@ dclass DistributedElevatorFSM : DistributedObject {
requestExit() airecv clsend; requestExit() airecv clsend;
setElevatorTripId(uint32) required broadcast ram; setElevatorTripId(uint32) required broadcast ram;
setAntiShuffle(uint8) required broadcast ram; setAntiShuffle(uint8) required broadcast ram;
setMinLaff(uint8) required broadcast ram;
}; };
dclass DistributedElevatorFloor : DistributedElevatorFSM { dclass DistributedElevatorFloor : DistributedElevatorFSM {
@ -1947,7 +1937,7 @@ dclass DistributedBoardingParty : DistributedObject {
postSizeReject(uint32, uint32, uint32) broadcast; postSizeReject(uint32, uint32, uint32) broadcast;
postInviteAccepted(uint32) broadcast; postInviteAccepted(uint32) broadcast;
postInviteDelcined(uint32) broadcast; postInviteDelcined(uint32) broadcast;
postInviteNotQualify(uint32, int8, uint32) broadcast; postInviteNotQualify(uint32, int8) broadcast;
postAlreadyInGroup() broadcast; postAlreadyInGroup() broadcast;
postGroupDissolve(uint32, uint32, uint32 [], uint8) broadcast; postGroupDissolve(uint32, uint32, uint32 [], uint8) broadcast;
postMessageAcceptanceFailed(uint32, int8) broadcast; postMessageAcceptanceFailed(uint32, int8) broadcast;

View file

@ -99,7 +99,6 @@ want-cogbuildings #t
# Optional: # Optional:
show-total-population #t show-total-population #t
want-mat-all-tailors #t want-mat-all-tailors #t
want-talkative-tyler #f
estate-day-night #t estate-day-night #t
want-garden-game #f want-garden-game #f
want-language-selection #t want-language-selection #t

View file

@ -813,7 +813,7 @@ class OTPClientRepository(ClientRepositoryBase):
district = None district = None
if not district: if not district:
self.distributedDistrict = self.getStartingDistrict() self.distributedDistrict = self.getStartingDistrict()
if self.distributedDistrict is None: if not self.distributedDistrict:
self.loginFSM.request('noShards') self.loginFSM.request('noShards')
return return
shardId = self.distributedDistrict.doId shardId = self.distributedDistrict.doId
@ -1030,26 +1030,26 @@ class OTPClientRepository(ClientRepositoryBase):
pass pass
def getStartingDistrict(self): def getStartingDistrict(self):
district = None if not self.activeDistrictMap:
if len(self.activeDistrictMap.keys()) == 0:
self.notify.info('no shards') self.notify.info('no shards')
return return
maxPop = config.GetInt('shard-mid-pop', 300) maxPop = config.GetInt('shard-mid-pop', 300)
preferred = settings.get('preferredShard', None)
# Join the least populated district. if preferred:
for shard in self.activeDistrictMap.values(): for shard in self.activeDistrictMap.values():
if district: if shard.available and shard.name == preferred and shard.avatarCount < maxPop:
if shard.avatarCount < district.avatarCount and shard.available: return shard
if shard.avatarCount < maxPop:
district = shard
else:
if shard.available:
if shard.avatarCount < maxPop:
district = shard
if district is not None: for shard in self.activeDistrictMap.values():
if shard.available and shard.avatarCount < maxPop:
district = shard
maxPop = district.avatarCount
if district:
self.notify.debug('chose %s: pop %s' % (district.name, district.avatarCount)) self.notify.debug('chose %s: pop %s' % (district.name, district.avatarCount))
return district return district
def getShardName(self, shardId): def getShardName(self, shardId):

View file

@ -376,7 +376,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
'Good, it takes two to mingle.', 'Good, it takes two to mingle.',
"Let's mingle.", "Let's mingle.",
'This looks like a good place to mingle.', 'This looks like a good place to mingle.',
"Well,isn't this cozy?", "Well, isn't this cozy?",
"You're mingling with defeat.", "You're mingling with defeat.",
"I'm going to mingle in your business.", "I'm going to mingle in your business.",
"Are you sure you're ready to mingle?"], "Are you sure you're ready to mingle?"],
@ -520,7 +520,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
'Care to take a few turns with me?', 'Care to take a few turns with me?',
'I have my own special spin on the subject.'], 'I have my own special spin on the subject.'],
'f': ["I'm gonna tell the boss about you!", 'f': ["I'm gonna tell the boss about you!",
"I may be just a flunky - But I'm real spunky.", "I may be just a Flunky - But I'm real spunky.",
"I'm using you to step up the corporate ladder.", "I'm using you to step up the corporate ladder.",
"You're not going to like the way I work.", "You're not going to like the way I work.",
'The boss is counting on me to stop you.', 'The boss is counting on me to stop you.',
@ -644,7 +644,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
"I've been asked to pinch-hit.", "I've been asked to pinch-hit.",
"I'll prove you're not dreaming.", "I'll prove you're not dreaming.",
'Heads you lose, tails I win.', 'Heads you lose, tails I win.',
'A Penny for your gags.'], 'A penny for your gags.'],
'tw': ['Things are about to get very tight.', 'tw': ['Things are about to get very tight.',
"That's Mr. Tightwad to you.", "That's Mr. Tightwad to you.",
"I'm going to cut off your funding.", "I'm going to cut off your funding.",

View file

@ -17,7 +17,7 @@ class Settings(collections.MutableMapping):
def write(self): def write(self):
with open(self.filename, 'w') as f: with open(self.filename, 'w') as f:
json.dump(self.store, f) json.dump(self.store, f, sort_keys=True, indent=2, separators=(',', ': '))
def __setitem__(self, key, value): def __setitem__(self, key, value):
self.store[key] = value self.store[key] = value

View file

@ -3,14 +3,13 @@ from toontown.toonbase import ToontownGlobals
import copy import copy
BOARDCODE_OKAY = 1 BOARDCODE_OKAY = 1
BOARDCODE_MISSING = 0 BOARDCODE_MISSING = 0
BOARDCODE_MINLAFF = -1 BOARDCODE_PROMOTION = -1
BOARDCODE_PROMOTION = -2 BOARDCODE_BATTLE = -2
BOARDCODE_BATTLE = -3 BOARDCODE_SPACE = -3
BOARDCODE_SPACE = -4 BOARDCODE_DIFF_GROUP = -4
BOARDCODE_DIFF_GROUP = -6 BOARDCODE_PENDING_INVITE = -5
BOARDCODE_PENDING_INVITE = -7 BOARDCODE_IN_ELEVATOR = -6
BOARDCODE_IN_ELEVATOR = -8 BOARDCODE_GROUPS_TOO_LARGE = -7 # JBS
BOARDCODE_GROUPS_TO_LARGE = -9 # JBS
INVITE_ACCEPT_FAIL_GROUP_FULL = -1 INVITE_ACCEPT_FAIL_GROUP_FULL = -1
class BoardingPartyBase: class BoardingPartyBase:

View file

@ -3,7 +3,7 @@ import DistributedBossElevatorAI
class DistributedBBElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedBBElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):
def __init__(self, air, bldg, zone, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, zone, antiShuffle = 0):
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle, minLaff=0) DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle)
self.type = ELEVATOR_BB self.type = ELEVATOR_BB
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -198,17 +198,10 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
self.groupInviteePanel = None self.groupInviteePanel = None
return return
def postInviteNotQualify(self, avId, reason, elevatorId): def postInviteNotQualify(self, avId, reason):
messenger.send('updateGroupStatus') messenger.send('updateGroupStatus')
rejectText = '' rejectText = ''
minLaff = TTLocalizer.BoardingMore
if elevatorId:
elevator = base.cr.doId2do.get(elevatorId)
if elevator:
minLaff = elevator.minLaff
if avId == localAvatar.doId: if avId == localAvatar.doId:
if reason == BoardingPartyBase.BOARDCODE_MINLAFF:
rejectText = TTLocalizer.BoardingInviteMinLaffInviter % minLaff
if reason == BoardingPartyBase.BOARDCODE_PROMOTION: if reason == BoardingPartyBase.BOARDCODE_PROMOTION:
rejectText = TTLocalizer.BoardingInvitePromotionInviter rejectText = TTLocalizer.BoardingInvitePromotionInviter
else: else:
@ -217,8 +210,6 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
avatarNameText = avatar.name avatarNameText = avatar.name
else: else:
avatarNameText = '' avatarNameText = ''
if reason == BoardingPartyBase.BOARDCODE_MINLAFF:
rejectText = TTLocalizer.BoardingInviteMinLaffInvitee % (avatarNameText, minLaff)
if reason == BoardingPartyBase.BOARDCODE_PROMOTION: if reason == BoardingPartyBase.BOARDCODE_PROMOTION:
rejectText = TTLocalizer.BoardingInvitePromotionInvitee % avatarNameText rejectText = TTLocalizer.BoardingInvitePromotionInvitee % avatarNameText
if reason == BoardingPartyBase.BOARDCODE_BATTLE: if reason == BoardingPartyBase.BOARDCODE_BATTLE:
@ -229,8 +220,8 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
rejectText = TTLocalizer.BoardingInviteePendingIvite % avatarNameText rejectText = TTLocalizer.BoardingInviteePendingIvite % avatarNameText
if reason == BoardingPartyBase.BOARDCODE_IN_ELEVATOR: if reason == BoardingPartyBase.BOARDCODE_IN_ELEVATOR:
rejectText = TTLocalizer.BoardingInviteeInElevator % avatarNameText rejectText = TTLocalizer.BoardingInviteeInElevator % avatarNameText
if reason == BoardingPartyBase.BOARDCODE_GROUPS_TO_LARGE: # JBS if reason == BoardingPartyBase.BOARDCODE_GROUPS_TOO_LARGE: # JBS
rejectText = TTLocalizer.BoardingGroupsToLarge % avatarNameText rejectText = TTLocalizer.BoardingGroupsTooLarge % avatarNameText
if self.inviterPanels.isInvitingPanelIdCorrect(avId) or avId == localAvatar.doId: if self.inviterPanels.isInvitingPanelIdCorrect(avId) or avId == localAvatar.doId:
self.inviterPanels.destroyInvitingPanel() self.inviterPanels.destroyInvitingPanel()
self.showMe(rejectText) self.showMe(rejectText)
@ -317,22 +308,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
avatarText += secondLastName + ' ' + TTLocalizer.And + ' ' + lastName avatarText += secondLastName + ' ' + TTLocalizer.And + ' ' + lastName
return avatarText return avatarText
if reason == BoardingPartyBase.BOARDCODE_MINLAFF: if reason == BoardingPartyBase.BOARDCODE_PROMOTION:
self.notify.debug("%s 's group cannot board because it does not have enough laff points." % leaderId)
elevator = base.cr.doId2do.get(elevatorId)
if elevator:
minLaffPoints = elevator.minLaff
else:
minLaffPoints = TTLocalizer.BoardingMore
if leaderId in avatarsFailingRequirements:
rejectText = TTLocalizer.BoardcodeMinLaffLeader % minLaffPoints
else:
avatarNameText = getAvatarText(avatarsFailingRequirements)
if len(avatarsFailingRequirements) == 1:
rejectText = TTLocalizer.BoardcodeMinLaffNonLeaderSingular % (avatarNameText, minLaffPoints)
else:
rejectText = TTLocalizer.BoardcodeMinLaffNonLeaderPlural % (avatarNameText, minLaffPoints)
elif reason == BoardingPartyBase.BOARDCODE_PROMOTION:
self.notify.debug("%s 's group cannot board because it does not have enough promotion merits." % leaderId) self.notify.debug("%s 's group cannot board because it does not have enough promotion merits." % leaderId)
if leaderId in avatarsFailingRequirements: if leaderId in avatarsFailingRequirements:
rejectText = TTLocalizer.BoardcodePromotionLeader rejectText = TTLocalizer.BoardcodePromotionLeader

View file

@ -105,17 +105,17 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
merger = False merger = False
if invitee and invitee.battleId != 0: if invitee and invitee.battleId != 0:
reason = BoardingPartyBase.BOARDCODE_BATTLE reason = BoardingPartyBase.BOARDCODE_BATTLE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId]) self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return return
if self.hasPendingInvite(inviteeId): if self.hasPendingInvite(inviteeId):
reason = BoardingPartyBase.BOARDCODE_PENDING_INVITE reason = BoardingPartyBase.BOARDCODE_PENDING_INVITE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId]) self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return return
if self.__isInElevator(inviteeId): if self.__isInElevator(inviteeId):
reason = BoardingPartyBase.BOARDCODE_IN_ELEVATOR reason = BoardingPartyBase.BOARDCODE_IN_ELEVATOR
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId]) self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return return
if self.hasActiveGroup(inviteeId): if self.hasActiveGroup(inviteeId):
@ -127,7 +127,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
# group merge already requested? # group merge already requested?
if self.hasPendingInvite(inviteeLeaderId): if self.hasPendingInvite(inviteeLeaderId):
reason = BoardingPartyBase.BOARDCODE_PENDING_INVITE reason = BoardingPartyBase.BOARDCODE_PENDING_INVITE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId]) self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return return
@ -137,13 +137,13 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
inviteeId = inviteeLeaderId inviteeId = inviteeLeaderId
merger = True merger = True
else: else:
reason = BoardingPartyBase.BOARDCODE_GROUPS_TO_LARGE reason = BoardingPartyBase.BOARDCODE_GROUPS_TOO_LARGE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId]) self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return return
else: else:
reason = BoardingPartyBase.BOARDCODE_DIFF_GROUP reason = BoardingPartyBase.BOARDCODE_DIFF_GROUP
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId]) self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return return
# Lets see what the invitee is currently doing # Lets see what the invitee is currently doing
@ -152,20 +152,16 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
# I know there is an unexpected issue here when we are merging groups... lets think about this really hard.. # I know there is an unexpected issue here when we are merging groups... lets think about this really hard..
if len(self.elevatorIdList) == 1: if len(self.elevatorIdList) == 1:
if inviteeOkay: if inviteeOkay:
if inviteeOkay == REJECT_MINLAFF: if inviteeOkay == REJECT_PROMOTION:
reason = BoardingPartyBase.BOARDCODE_MINLAFF
elif inviteeOkay == REJECT_PROMOTION:
reason = BoardingPartyBase.BOARDCODE_PROMOTION reason = BoardingPartyBase.BOARDCODE_PROMOTION
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, self.elevatorIdList[0]]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
return return
else: else:
inviterOkay = self.checkBoard(inviterId, self.elevatorIdList[0]) inviterOkay = self.checkBoard(inviterId, self.elevatorIdList[0])
if inviterOkay: if inviterOkay:
if inviterOkay == REJECT_MINLAFF: if inviterOkay == REJECT_PROMOTION:
reason = BoardingPartyBase.BOARDCODE_MINLAFF
elif inviterOkay == REJECT_PROMOTION:
reason = BoardingPartyBase.BOARDCODE_PROMOTION reason = BoardingPartyBase.BOARDCODE_PROMOTION
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviterId, reason, self.elevatorIdList[0]]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviterId, reason])
return return
# Is the inviter already in the avIdDict? It follows they either must be in a group or have a pending invite... # Is the inviter already in the avIdDict? It follows they either must be in a group or have a pending invite...
if inviterId in self.avIdDict: if inviterId in self.avIdDict:
@ -277,8 +273,8 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
return return
# Lets make sure we still CAN merge them in # Lets make sure we still CAN merge them in
if ((len(self.getGroupMemberList(leaderId)) + len(self.getGroupMemberList(inviteeId))) > self.maxSize): if ((len(self.getGroupMemberList(leaderId)) + len(self.getGroupMemberList(inviteeId))) > self.maxSize):
reason = BoardingPartyBase.BOARDCODE_GROUPS_TO_LARGE reason = BoardingPartyBase.BOARDCODE_GROUPS_TOO_LARGE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId]) self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return return
group = self.groupListDict.get(leaderId) group = self.groupListDict.get(leaderId)
@ -365,9 +361,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
avatar = simbase.air.doId2do.get(avId) avatar = simbase.air.doId2do.get(avId)
if avatar: if avatar:
if elevator.checkBoard(avatar) != 0: if elevator.checkBoard(avatar) != 0:
if elevator.checkBoard(avatar) == REJECT_MINLAFF: if elevator.checkBoard(avatar) == REJECT_PROMOTION:
boardOkay = BoardingPartyBase.BOARDCODE_MINLAFF
elif elevator.checkBoard(avatar) == REJECT_PROMOTION:
boardOkay = BoardingPartyBase.BOARDCODE_PROMOTION boardOkay = BoardingPartyBase.BOARDCODE_PROMOTION
avatarsFailingRequirements.append(avId) avatarsFailingRequirements.append(avId)
elif avatar.battleId != 0: elif avatar.battleId != 0:
@ -382,8 +376,6 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
boardOkay = BoardingPartyBase.BOARDCODE_SPACE boardOkay = BoardingPartyBase.BOARDCODE_SPACE
if boardOkay != BoardingPartyBase.BOARDCODE_OKAY: if boardOkay != BoardingPartyBase.BOARDCODE_OKAY:
self.notify.debug('Something is wrong with the group board request') self.notify.debug('Something is wrong with the group board request')
if boardOkay == BoardingPartyBase.BOARDCODE_MINLAFF:
self.notify.debug('An avatar did not meet the elevator laff requirements')
if boardOkay == BoardingPartyBase.BOARDCODE_PROMOTION: if boardOkay == BoardingPartyBase.BOARDCODE_PROMOTION:
self.notify.debug('An avatar did not meet the elevator promotion requirements') self.notify.debug('An avatar did not meet the elevator promotion requirements')
elif boardOkay == BoardingPartyBase.BOARDCODE_BATTLE: elif boardOkay == BoardingPartyBase.BOARDCODE_BATTLE:

View file

@ -12,8 +12,8 @@ from toontown.suit import DistributedSellbotBossAI
class DistributedBossElevatorAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedBossElevatorAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
def __init__(self, air, bldg, zone, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, zone, antiShuffle = 0):
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, numSeats=8, antiShuffle=antiShuffle, minLaff=minLaff) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, numSeats=8, antiShuffle=antiShuffle)
self.zone = zone self.zone = zone
self.type = ELEVATOR_VP self.type = ELEVATOR_VP
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']
@ -53,8 +53,6 @@ class DistributedBossElevatorAI(DistributedElevatorExtAI.DistributedElevatorExtA
def checkBoard(self, av): def checkBoard(self, av):
dept = ToontownGlobals.cogHQZoneId2deptIndex(self.zone) dept = ToontownGlobals.cogHQZoneId2deptIndex(self.zone)
if av.hp < self.minLaff:
return REJECT_MINLAFF
if not av.readyForPromotion(dept): if not av.readyForPromotion(dept):
return REJECT_PROMOTION return REJECT_PROMOTION
return 0 return 0

View file

@ -3,7 +3,7 @@ import DistributedBossElevatorAI
class DistributedCFOElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedCFOElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):
def __init__(self, air, bldg, zone, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, zone, antiShuffle = 0):
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle, minLaff=minLaff) DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle)
self.type = ELEVATOR_CFO self.type = ELEVATOR_CFO
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -3,7 +3,7 @@ import DistributedBossElevatorAI
class DistributedCJElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedCJElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):
def __init__(self, air, bldg, zone, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, zone, antiShuffle = 0):
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle, minLaff=minLaff) DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle)
self.type = ELEVATOR_CJ self.type = ELEVATOR_CJ
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -41,8 +41,8 @@ class DistributedClubElevatorAI(DistributedElevatorFSMAI.DistributedElevatorFSMA
id = 0 id = 0
DoBlockedRoomCheck = simbase.config.GetBool('elevator-blocked-rooms-check', 1) DoBlockedRoomCheck = simbase.config.GetBool('elevator-blocked-rooms-check', 1)
def __init__(self, air, lawOfficeId, bldg, avIds, markerId = None, numSeats = 4, antiShuffle = 0, minLaff = 0): def __init__(self, air, lawOfficeId, bldg, avIds, markerId = None, numSeats = 4, antiShuffle = 0):
DistributedElevatorFSMAI.DistributedElevatorFSMAI.__init__(self, air, bldg, numSeats, antiShuffle = antiShuffle, minLaff = minLaff) DistributedElevatorFSMAI.DistributedElevatorFSMAI.__init__(self, air, bldg, numSeats, antiShuffle = antiShuffle)
FSM.__init__(self, 'ElevatorFloor_%s_FSM' % self.id) FSM.__init__(self, 'ElevatorFloor_%s_FSM' % self.id)
self.type = ElevatorConstants.ELEVATOR_COUNTRY_CLUB self.type = ElevatorConstants.ELEVATOR_COUNTRY_CLUB
self.countdownTime = ElevatorConstants.ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorConstants.ElevatorData[self.type]['countdown']
@ -291,8 +291,6 @@ class DistributedClubElevatorAI(DistributedElevatorFSMAI.DistributedElevatorFSMA
return self.latch return self.latch
def checkBoard(self, av): def checkBoard(self, av):
if av.hp < self.minLaff:
return ElevatorConstants.REJECT_MINLAFF
if self.DoBlockedRoomCheck and self.bldg: if self.DoBlockedRoomCheck and self.bldg:
if hasattr(self.bldg, 'blockedRooms'): if hasattr(self.bldg, 'blockedRooms'):
if self.bldg.blockedRooms: if self.bldg.blockedRooms:

View file

@ -344,8 +344,6 @@ class DistributedElevator(DistributedObject.DistributedObject):
if hasattr(base.localAvatar, 'elevatorNotifier'): if hasattr(base.localAvatar, 'elevatorNotifier'):
if reason == REJECT_SHUFFLE: if reason == REJECT_SHUFFLE:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff)
elif reason == REJECT_MINLAFF:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorMinLaff % self.minLaff)
elif reason == REJECT_PROMOTION: elif reason == REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage)
doneStatus = {'where': 'reject'} doneStatus = {'where': 'reject'}
@ -496,12 +494,6 @@ class DistributedElevator(DistributedObject.DistributedObject):
def getAntiShuffle(self): def getAntiShuffle(self):
return self.antiShuffle return self.antiShuffle
def setMinLaff(self, minLaff):
self.minLaff = minLaff
def getMinLaff(self):
return self.minLaff
def storeToonTrack(self, avId, track): def storeToonTrack(self, avId, track):
self.clearToonTrack(avId) self.clearToonTrack(avId)
self.__toonTracks[avId] = track self.__toonTracks[avId] = track

View file

@ -11,7 +11,7 @@ from direct.directnotify import DirectNotifyGlobal
class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI): class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorAI') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorAI')
def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0):
DistributedObjectAI.DistributedObjectAI.__init__(self, air) DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.type = ELEVATOR_NORMAL self.type = ELEVATOR_NORMAL
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']
@ -19,7 +19,6 @@ class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI):
self.bldgDoId = bldg.getDoId() self.bldgDoId = bldg.getDoId()
self.seats = [] self.seats = []
self.setAntiShuffle(antiShuffle) self.setAntiShuffle(antiShuffle)
self.setMinLaff(minLaff)
if self.antiShuffle: if self.antiShuffle:
if not hasattr(simbase.air, 'elevatorTripId'): if not hasattr(simbase.air, 'elevatorTripId'):
simbase.air.elevatorTripId = 1 simbase.air.elevatorTripId = 1
@ -145,11 +144,9 @@ class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI):
return self.fsm.getCurrentState().getName() return self.fsm.getCurrentState().getName()
def avIsOKToBoard(self, av): def avIsOKToBoard(self, av):
return av.hp > self.minLaff and self.accepting return self.accepting
def checkBoard(self, av): def checkBoard(self, av):
if av.hp < self.minLaff:
return REJECT_MINLAFF
return 0 return 0
def requestBoard(self, *args): def requestBoard(self, *args):
@ -289,9 +286,3 @@ class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI):
def getAntiShuffle(self): def getAntiShuffle(self):
return self.antiShuffle return self.antiShuffle
def setMinLaff(self, minLaff):
self.minLaff = minLaff
def getMinLaff(self):
return self.minLaff

View file

@ -11,8 +11,8 @@ from direct.directnotify import DirectNotifyGlobal
class DistributedElevatorExtAI(DistributedElevatorAI.DistributedElevatorAI): class DistributedElevatorExtAI(DistributedElevatorAI.DistributedElevatorAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorExtAI') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorExtAI')
def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0):
DistributedElevatorAI.DistributedElevatorAI.__init__(self, air, bldg, numSeats, antiShuffle=antiShuffle, minLaff=minLaff) DistributedElevatorAI.DistributedElevatorAI.__init__(self, air, bldg, numSeats, antiShuffle=antiShuffle)
self.anyToonsBailed = 0 self.anyToonsBailed = 0
self.boardingParty = None self.boardingParty = None
return return

View file

@ -316,8 +316,6 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
if hasattr(base.localAvatar, 'elevatorNotifier'): if hasattr(base.localAvatar, 'elevatorNotifier'):
if reason == REJECT_SHUFFLE: if reason == REJECT_SHUFFLE:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff)
elif reason == REJECT_MINLAFF:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorMinLaff % self.minLaff)
elif reason == REJECT_PROMOTION: elif reason == REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage)
elif reason == REJECT_BLOCKED_ROOM: elif reason == REJECT_BLOCKED_ROOM:
@ -475,11 +473,5 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
def getAntiShuffle(self): def getAntiShuffle(self):
return self.antiShuffle return self.antiShuffle
def setMinLaff(self, minLaff):
self.minLaff = minLaff
def getMinLaff(self):
return self.minLaff
def getDestName(self): def getDestName(self):
return None return None

View file

@ -38,7 +38,7 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
'Opening'] } 'Opening'] }
id = 0 id = 0
def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0):
DistributedObjectAI.DistributedObjectAI.__init__(self, air) DistributedObjectAI.DistributedObjectAI.__init__(self, air)
FSM.__init__(self, 'Elevator_%s_FSM' % self.id) FSM.__init__(self, 'Elevator_%s_FSM' % self.id)
self.type = ELEVATOR_NORMAL self.type = ELEVATOR_NORMAL
@ -50,7 +50,6 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
self.seats.append(None) self.seats.append(None)
self.accepting = 0 self.accepting = 0
self.setAntiShuffle(antiShuffle) self.setAntiShuffle(antiShuffle)
self.setMinLaff(minLaff)
if self.antiShuffle: if self.antiShuffle:
if not hasattr(simbase.air, 'elevatorTripId'): if not hasattr(simbase.air, 'elevatorTripId'):
simbase.air.elevatorTripId = 1 simbase.air.elevatorTripId = 1
@ -146,13 +145,9 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
return self.state return self.state
def avIsOKToBoard(self, av): def avIsOKToBoard(self, av):
if av.hp > self.minLaff:
pass
return self.accepting return self.accepting
def checkBoard(self, av): def checkBoard(self, av):
if av.hp < self.minLaff:
return REJECT_MINLAFF
return 0 return 0
def requestBoard(self, *args): def requestBoard(self, *args):
@ -275,9 +270,3 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
def getAntiShuffle(self): def getAntiShuffle(self):
return self.antiShuffle return self.antiShuffle
def setMinLaff(self, minLaff):
self.minLaff = minLaff
def getMinLaff(self):
return self.minLaff

View file

@ -40,8 +40,8 @@ class DistributedElevatorFloorAI(DistributedElevatorFSMAI.DistributedElevatorFSM
'Opening'] } 'Opening'] }
id = 0 id = 0
def __init__(self, air, lawOfficeId, bldg, avIds, markerId = None, numSeats = 4, antiShuffle = 0, minLaff = 0): def __init__(self, air, lawOfficeId, bldg, avIds, markerId = None, numSeats = 4, antiShuffle = 0):
DistributedElevatorFSMAI.DistributedElevatorFSMAI.__init__(self, air, bldg, numSeats, antiShuffle = antiShuffle, minLaff = minLaff) DistributedElevatorFSMAI.DistributedElevatorFSMAI.__init__(self, air, bldg, numSeats, antiShuffle = antiShuffle)
FSM.__init__(self, 'ElevatorFloor_%s_FSM' % self.id) FSM.__init__(self, 'ElevatorFloor_%s_FSM' % self.id)
self.type = ELEVATOR_STAGE self.type = ELEVATOR_STAGE
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -3,7 +3,7 @@ import DistributedBossElevatorAI
class DistributedVPElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedVPElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):
def __init__(self, air, bldg, zone, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, zone, antiShuffle = 0):
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle, minLaff=minLaff) DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle)
self.type = ELEVATOR_VP self.type = ELEVATOR_VP
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -11,11 +11,10 @@ ELEVATOR_COUNTRY_CLUB = 8
ELEVATOR_FIELD = 9 ELEVATOR_FIELD = 9
REJECT_NOREASON = 0 REJECT_NOREASON = 0
REJECT_SHUFFLE = 1 REJECT_SHUFFLE = 1
REJECT_MINLAFF = 2 REJECT_NOSEAT = 2
REJECT_NOSEAT = 3 REJECT_PROMOTION = 3
REJECT_PROMOTION = 4 REJECT_BLOCKED_ROOM = 4
REJECT_BLOCKED_ROOM = 5 REJECT_BOARDINGPARTY = 5
REJECT_BOARDINGPARTY = 6
MAX_GROUP_BOARDING_TIME = 6.0 MAX_GROUP_BOARDING_TIME = 6.0
ElevatorData = {ELEVATOR_NORMAL: {'openTime': 2.0, ElevatorData = {ELEVATOR_NORMAL: {'openTime': 2.0,
'closeTime': 2.0, 'closeTime': 2.0,

View file

@ -355,8 +355,6 @@ class DistributedCogKart(DistributedElevatorExt.DistributedElevatorExt):
if hasattr(base.localAvatar, 'elevatorNotifier'): if hasattr(base.localAvatar, 'elevatorNotifier'):
if reason == ElevatorConstants.REJECT_SHUFFLE: if reason == ElevatorConstants.REJECT_SHUFFLE:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff)
elif reason == ElevatorConstants.REJECT_MINLAFF:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.KartMinLaff % self.minLaff)
elif reason == ElevatorConstants.REJECT_PROMOTION: elif reason == ElevatorConstants.REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage)
doneStatus = {'where': 'reject'} doneStatus = {'where': 'reject'}

View file

@ -8,9 +8,9 @@ from toontown.toonbase import ToontownGlobals
class DistributedCogKartAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedCogKartAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogKartAI') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogKartAI')
def __init__(self, air, index, x, y, z, h, p, r, bldg, minLaff): def __init__(self, air, index, x, y, z, h, p, r, bldg):
self.posHpr = (x, y, z, h, p, r) self.posHpr = (x, y, z, h, p, r)
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, minLaff = minLaff) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg)
self.type = ElevatorConstants.ELEVATOR_COUNTRY_CLUB self.type = ElevatorConstants.ELEVATOR_COUNTRY_CLUB
self.courseIndex = index self.courseIndex = index
if self.courseIndex == 0: if self.courseIndex == 0:

View file

@ -9,8 +9,8 @@ from direct.task import Task
class DistributedFactoryElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedFactoryElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
def __init__(self, air, bldg, factoryId, entranceId, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, factoryId, entranceId, antiShuffle = 0):
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle=antiShuffle, minLaff=minLaff) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle=antiShuffle)
self.factoryId = factoryId self.factoryId = factoryId
self.entranceId = entranceId self.entranceId = entranceId

View file

@ -9,8 +9,8 @@ from toontown.toonbase import ToontownGlobals
class DistributedLawOfficeElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedLawOfficeElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
def __init__(self, air, bldg, lawOfficeId, entranceId, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, lawOfficeId, entranceId, antiShuffle = 0):
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle = antiShuffle, minLaff = minLaff) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle = antiShuffle)
self.lawOfficeId = lawOfficeId self.lawOfficeId = lawOfficeId
self.entranceId = entranceId self.entranceId = entranceId

View file

@ -10,8 +10,8 @@ import CogDisguiseGlobals
class DistributedMintElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedMintElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
def __init__(self, air, bldg, mintId, antiShuffle = 0, minLaff = 0): def __init__(self, air, bldg, mintId, antiShuffle = 0):
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle=antiShuffle, minLaff=minLaff) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle=antiShuffle)
self.mintId = mintId self.mintId = mintId
self.cogDept = ToontownGlobals.cogHQZoneId2deptIndex(self.mintId) self.cogDept = ToontownGlobals.cogHQZoneId2deptIndex(self.mintId)
self.type = ELEVATOR_MINT self.type = ELEVATOR_MINT

View file

@ -12,6 +12,7 @@ class DistributedChair(DistributedFurnitureItem):
self.dialog = None self.dialog = None
self.exitButton = None self.exitButton = None
self.avId = ToontownGlobals.CHAIR_NONE self.avId = ToontownGlobals.CHAIR_NONE
self.accept('exitingStoppedState', self.destroyGui)
def loadModel(self): def loadModel(self):
model = DistributedFurnitureItem.loadModel(self) model = DistributedFurnitureItem.loadModel(self)

View file

@ -10,6 +10,7 @@ class DistributedRewardCrate(DistributedFurnitureItem):
def __init__(self, cr): def __init__(self, cr):
DistributedFurnitureItem.__init__(self, cr) DistributedFurnitureItem.__init__(self, cr)
self.dialog = None self.dialog = None
self.accept('exitingStoppedState', self.destroyDialog)
def loadModel(self): def loadModel(self):
model = DistributedFurnitureItem.loadModel(self) model = DistributedFurnitureItem.loadModel(self)

View file

@ -13,10 +13,7 @@ class DistributedTV(DistributedFurnitureItem):
self.dialog = None self.dialog = None
self.screen = None self.screen = None
self.sound = None self.sound = None
def announceGenerate(self):
self.accept('exitingStoppedState', self.destroyGui) self.accept('exitingStoppedState', self.destroyGui)
DistributedFurnitureItem.announceGenerate(self)
def loadModel(self, animate=1): def loadModel(self, animate=1):
model = DistributedFurnitureItem.loadModel(self) model = DistributedFurnitureItem.loadModel(self)
@ -94,7 +91,6 @@ class DistributedTV(DistributedFurnitureItem):
self.screen.setColor(1, 1, 1, 1) self.screen.setColor(1, 1, 1, 1)
self.screen.setTexture(movie) self.screen.setTexture(movie)
self.screen.setTexScale(TextureStage.getDefault(), movie.getTexScale()) self.screen.setTexScale(TextureStage.getDefault(), movie.getTexScale())
self.sound.setLoop(True)
self.sound.setTime(min(self.sound.length(), int(time.time() - startTime))) self.sound.setTime(min(self.sound.length(), int(time.time() - startTime)))
self.sound.play() self.sound.play()

View file

@ -37,14 +37,13 @@ class BossbotHQAI(CogHQAI.CogHQAI):
(-48.44, 15.308, 0) (-48.44, 15.308, 0)
) )
hprList = ((110.815, 0, 0), (61.231, 0, 0), (-105.481, 0, 0)) hprList = ((110.815, 0, 0), (61.231, 0, 0), (-105.481, 0, 0))
mins = ToontownGlobals.FactoryLaffMinimums[3]
for cogCourse in xrange(len(posList)): for cogCourse in xrange(len(posList)):
pos = posList[cogCourse] pos = posList[cogCourse]
hpr = hprList[cogCourse] hpr = hprList[cogCourse]
cogKart = DistributedCogKartAI.DistributedCogKartAI( cogKart = DistributedCogKartAI.DistributedCogKartAI(
self.air, cogCourse, self.air, cogCourse,
pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2], pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2],
self.air.countryClubMgr, minLaff=mins[cogCourse]) self.air.countryClubMgr)
cogKart.generateWithRequired(self.zoneId) cogKart.generateWithRequired(self.zoneId)
self.cogKarts.append(cogKart) self.cogKarts.append(cogKart)

View file

@ -37,11 +37,10 @@ class CashbotHQAI(CogHQAI.CogHQAI):
ToontownGlobals.CashbotMintIntB, ToontownGlobals.CashbotMintIntB,
ToontownGlobals.CashbotMintIntC ToontownGlobals.CashbotMintIntC
) )
mins = ToontownGlobals.FactoryLaffMinimums[1]
for i in xrange(len(destZones)): for i in xrange(len(destZones)):
mintElevator = DistributedMintElevatorExtAI( mintElevator = DistributedMintElevatorExtAI(
self.air, self.air.mintMgr, destZones[i], self.air, self.air.mintMgr, destZones[i],
antiShuffle=0, minLaff=mins[i]) antiShuffle=0)
mintElevator.generateWithRequired(self.zoneId) mintElevator.generateWithRequired(self.zoneId)
self.mintElevators.append(mintElevator) self.mintElevators.append(mintElevator)

View file

@ -50,11 +50,10 @@ class LawbotHQAI(CogHQAI.CogHQAI):
ToontownGlobals.LawbotStageIntC, ToontownGlobals.LawbotStageIntC,
ToontownGlobals.LawbotStageIntD ToontownGlobals.LawbotStageIntD
) )
mins = ToontownGlobals.FactoryLaffMinimums[2]
for i in xrange(len(destZones)): for i in xrange(len(destZones)):
lawOfficeElevator = DistributedLawOfficeElevatorExtAI( lawOfficeElevator = DistributedLawOfficeElevatorExtAI(
self.air, self.air.lawOfficeMgr, destZones[i], i, self.air, self.air.lawOfficeMgr, destZones[i], i,
antiShuffle=0, minLaff=mins[i]) antiShuffle=0)
lawOfficeElevator.generateWithRequired( lawOfficeElevator.generateWithRequired(
ToontownGlobals.LawbotOfficeExt) ToontownGlobals.LawbotOfficeExt)
self.lawOfficeElevators.append(lawOfficeElevator) self.lawOfficeElevators.append(lawOfficeElevator)

View file

@ -285,10 +285,10 @@ class ColorShop(StateData.StateData):
self.notify.debug('Entering changeColor') self.notify.debug('Entering changeColor')
colorList = self.getColorList() colorList = self.getColorList()
newChoice = self.shuffleButton.getCurrChoice() newChoice = self.shuffleButton.getCurrChoice()
newHeadColorIndex = colorList.index(newChoice[0]) newHeadColorIndex = self.indexOf(colorList, newChoice[0], 25)
newArmColorIndex = colorList.index(newChoice[1]) newArmColorIndex = self.indexOf(colorList, newChoice[1], 25)
newGloveColorIndex = colorList.index(newChoice[2]) newGloveColorIndex = self.indexOf(colorList, newChoice[2], 0)
newLegColorIndex = colorList.index(newChoice[3]) newLegColorIndex = self.indexOf(colorList, newChoice[3], 25)
self.__swapHeadColor(newHeadColorIndex - self.headChoice) self.__swapHeadColor(newHeadColorIndex - self.headChoice)
if self.colorAll: if self.colorAll:
self.__swapArmColor(newHeadColorIndex - self.armChoice) self.__swapArmColor(newHeadColorIndex - self.armChoice)
@ -299,5 +299,11 @@ class ColorShop(StateData.StateData):
self.__swapGloveColor(newGloveColorIndex - self.gloveChoice) self.__swapGloveColor(newGloveColorIndex - self.gloveChoice)
self.__swapLegColor(newLegColorIndex - self.legChoice) self.__swapLegColor(newLegColorIndex - self.legChoice)
def indexOf(self, list, item, default):
try:
return list.index(item)
except:
return default
def getCurrToonSetting(self): def getCurrToonSetting(self):
return [self.dna.headColor, self.dna.armColor, self.dna.gloveColor, self.dna.legColor] return [self.dna.headColor, self.dna.armColor, self.dna.gloveColor, self.dna.legColor]

View file

@ -87,6 +87,7 @@ class ShardPage(ShtikerPage.ShtikerPage):
self.groupDialog = None self.groupDialog = None
def load(self): def load(self):
matchGui = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
main_text_scale = 0.06 main_text_scale = 0.06
title_text_scale = 0.12 title_text_scale = 0.12
self.title = DirectLabel(parent=self, relief=None, text=TTLocalizer.ShardPageTitle, text_scale=title_text_scale, textMayChange=0, pos=(0, 0, 0.6)) self.title = DirectLabel(parent=self, relief=None, text=TTLocalizer.ShardPageTitle, text_scale=title_text_scale, textMayChange=0, pos=(0, 0, 0.6))
@ -96,6 +97,7 @@ class ShardPage(ShtikerPage.ShtikerPage):
totalPop_ycoord = shardPop_ycoord - 0.44 totalPop_ycoord = shardPop_ycoord - 0.44
self.districtInfo = NodePath('Selected-Shard-Info') self.districtInfo = NodePath('Selected-Shard-Info')
self.districtInfo.reparentTo(self) self.districtInfo.reparentTo(self)
self.preferredButton = DirectButton(parent=self, relief=None, image=matchGui.find('**/minnieCircle'), pos=(0.1, 0, -0.575), scale=0.35, text=TTLocalizer.ShardPagePreferred, text_scale=0.11, text_pos=(0, -0.2), command=self.setPreferredShard)
self.totalPopulationText = DirectLabel(parent=self.districtInfo, relief=None, text=TTLocalizer.ShardPagePopulationTotal % 1, text_scale=main_text_scale, text_wordwrap=8, textMayChange=1, text_align=TextNode.ACenter, pos=(0.4247, 0, totalPop_ycoord)) self.totalPopulationText = DirectLabel(parent=self.districtInfo, relief=None, text=TTLocalizer.ShardPagePopulationTotal % 1, text_scale=main_text_scale, text_wordwrap=8, textMayChange=1, text_align=TextNode.ACenter, pos=(0.4247, 0, totalPop_ycoord))
if self.showTotalPop: if self.showTotalPop:
self.totalPopulationText.show() self.totalPopulationText.show()
@ -112,6 +114,7 @@ class ShardPage(ShtikerPage.ShtikerPage):
self.buttonXstart = self.itemFrameXorigin + 0.293 self.buttonXstart = self.itemFrameXorigin + 0.293
self.regenerateScrollList() self.regenerateScrollList()
scrollTitle = DirectFrame(parent=self.scrollList, text=TTLocalizer.ShardPageScrollTitle, text_scale=main_text_scale, text_align=TextNode.ACenter, relief=None, pos=(self.buttonXstart, 0, self.itemFrameZorigin + 0.127)) scrollTitle = DirectFrame(parent=self.scrollList, text=TTLocalizer.ShardPageScrollTitle, text_scale=main_text_scale, text_align=TextNode.ACenter, relief=None, pos=(self.buttonXstart, 0, self.itemFrameZorigin + 0.127))
matchGui.removeNode()
def firstLoadShard(self, buttonTuple): def firstLoadShard(self, buttonTuple):
curShardTuples = base.cr.listActiveShards() curShardTuples = base.cr.listActiveShards()
@ -258,9 +261,9 @@ class ShardPage(ShtikerPage.ShtikerPage):
popText = self.getPopText(shardPop) popText = self.getPopText(shardPop)
districtInfoNode = self.districtInfo.attachNewNode('district-info') districtInfoNode = self.districtInfo.attachNewNode('district-info')
self.districtStatusLabel = DirectLabel(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.45), text=popText, text_scale=0.09, text_fg=Vec4(0, 0, 0, 1), textMayChange=1) self.districtStatusLabel = DirectLabel(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.45), text=popText, text_scale=0.09, text_fg=Vec4(0, 0, 0, 1), textMayChange=1)
pText = '%s Population: %s' % (shardName, str(shardPop)) pText = TTLocalizer.ShardPageShardTitle % (shardName, str(shardPop))
self.populationStatusLabel = DirectLabel(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.38), text=pText, text_scale=0.04, text_fg=Vec4(0, 0, 0, 1), textMayChange=1) self.populationStatusLabel = DirectLabel(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.38), text=pText, text_scale=0.04, text_fg=Vec4(0, 0, 0, 1), textMayChange=1)
tText = 'Teleport to\n%s' % shardName tText = TTLocalizer.ShardPageTeleport % shardName
tImage = loader.loadModel('phase_4/models/gui/purchase_gui') tImage = loader.loadModel('phase_4/models/gui/purchase_gui')
tImage.setSz(1.35) tImage.setSz(1.35)
self.shardTeleportButton = DirectButton(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.25), image=(tImage.find('**/PurchScrn_BTN_UP'), tImage.find('**/PurchScrn_BTN_DN'), tImage.find('**/PurchScrn_BTN_RLVR')), text=tText, text_scale=0.065, text_pos=(0.0, 0.015), text_fg=Vec4(0, 0, 0, 1), textMayChange=1, command=self.choseShard, extraArgs=[shardId]) self.shardTeleportButton = DirectButton(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.25), image=(tImage.find('**/PurchScrn_BTN_UP'), tImage.find('**/PurchScrn_BTN_DN'), tImage.find('**/PurchScrn_BTN_RLVR')), text=tText, text_scale=0.065, text_pos=(0.0, 0.015), text_fg=Vec4(0, 0, 0, 1), textMayChange=1, command=self.choseShard, extraArgs=[shardId])
@ -272,6 +275,7 @@ class ShardPage(ShtikerPage.ShtikerPage):
self.currentO = [shardPop, shardName, shardId] self.currentO = [shardPop, shardName, shardId]
self.currentBTL['state'] = DGG.DISABLED self.currentBTL['state'] = DGG.DISABLED
self.currentBTR['state'] = DGG.DISABLED self.currentBTR['state'] = DGG.DISABLED
self.preferredButton.setColor((0, 1, 0, 1) if settings.get('preferredShard') == shardName else (1, 0, 0, 1))
if shardId == base.localAvatar.defaultShard: if shardId == base.localAvatar.defaultShard:
self.shardTeleportButton['state'] = DGG.DISABLED self.shardTeleportButton['state'] = DGG.DISABLED
@ -487,3 +491,11 @@ class ShardPage(ShtikerPage.ShtikerPage):
place = base.cr.playGame.hood.place place = base.cr.playGame.hood.place
place.requestTeleport(canonicalHoodId, canonicalHoodId, shardId, -1) place.requestTeleport(canonicalHoodId, canonicalHoodId, shardId, -1)
def setPreferredShard(self):
if settings.get('preferredShard', '') == self.currentO[1]:
self.preferredButton.setColor(1, 0, 0, 1)
del settings['preferredShard']
else:
self.preferredButton.setColor(0, 1, 0, 1)
settings['preferredShard'] = self.currentO[1]

View file

@ -1,53 +0,0 @@
from panda3d.core import *
from DistributedNPCToonBase import *
from toontown.hood import ZoneUtil
from otp.nametag.NametagConstants import *
from toontown.quest import QuestChoiceGui
from toontown.quest import QuestParser
from toontown.quest import TrackChoiceGui
from toontown.toonbase import TTLocalizer
SPAMMING = 1
DOUBLE_ENTRY = 2
class DistributedSmartNPC(DistributedNPCToonBase):
def __init__(self, cr):
DistributedNPCToonBase.__init__(self, cr)
self.accept('chatUpdate', self.chatUpdate)
def disable(self):
self.ignoreAll()
DistributedNPCToonBase.disable(self)
def delayDelete(self):
DistributedNPCToonBase.delayDelete(self)
self.disable()
def handleCollisionSphereEnter(self, collEntry):
self.sendUpdate('avatarEnter', [])
def chatUpdate(self, message, chatFlags):
self.sendUpdate('talkMessage', [base.localAvatar.doId, message])
def greet(self, npcId, avId):
if avId in base.cr.doId2do:
avName = base.cr.doId2do.get(avId).getName()
self.setChatAbsolute('Hello, %s' % avName + '!', CFSpeech | CFTimeout)
def dismiss(self, avId, statusCode):
if avId in base.cr.doId2do:
avName = base.cr.doId2do.get(avId).getName()
if statusCode == SPAMMING:
self.setChatAbsolute('Slow down there, %s' % avName + '. I can\'t even understand you!', CFSpeech | CFTimeout)
elif statusCode == DOUBLE_ENTRY:
self.setChatAbsolute('Well hey there %s' % avName + ', didn\'t we JUST talk?', CFSpeech | CFTimeout)
def respond(self, npcId, message, avId):
try:
name = base.cr.doId2do.get(avId).getName()
self.setChatAbsolute(message, CFSpeech | CFTimeout)
except:
print 'Responding to non-available character!'

View file

@ -1,76 +0,0 @@
from otp.ai.AIBaseGlobal import *
from direct.task.Task import Task
from panda3d.core import *
from DistributedNPCToonBaseAI import *
from toontown.quest import Quests
import time
from QuestionMgr import ChatterBotFactory, ChatterBotType
from direct.task import Task
class DistributedSmartNPCAI(DistributedNPCToonBaseAI):
def __init__(self, air, npcId, questCallback = None, hq = 0):
DistributedNPCToonBaseAI.__init__(self, air, npcId, questCallback)
self.air = air
self.personOfInterest = 0
self.stopDouble = 0
self.nameOfInterest = ''
self.factory = ChatterBotFactory()
self.engine = self.factory.create(ChatterBotType.CLEVERBOT)
self.brain = self.engine.create_session()
self.myTask = taskMgr.doMethodLater(0.5, self.tylerTask, 'tylerTask')
self.index = 0
def tylerTask(self, task):
if task.time >= 5:
self.index = 0
if task.time <= 25:
return task.cont
self.response('I guess you don\'t want to talk anymore %s' % self.nameOfInterest + '...', self.personOfInterest)
self.stopDouble = self.personOfInterest
self.personOfInterest = 0
self.nameOfInterest = ''
return task.done
def restartTask(self):
taskMgr.remove(self.myTask)
taskMgr.add(self.myTask)
def avatarEnter(self):
if not self.personOfInterest:
sender = self.air.getAvatarIdFromSender()
if not sender == self.stopDouble:
name = self.air.doId2do.get(sender).getName()
self.personOfInterest = sender
self.nameOfInterest = name
self.sendUpdate('greet', [self.npcId, sender])
self.brain = self.engine.create_session()
else:
self.sendUpdate('dismiss', [sender, 2])
pass
else:
#Tyler is busy!
pass
def talkMessage(self, sender, message):
if sender == self.personOfInterest:
self.index += 1
if self.index >= 4:
self.stopDouble = self.personOfInterest
self.personOfInterest = 0
self.nameOfInterest = ''
taskMgr.remove(self.myTask)
self.index = 0
self.sendUpdate('dismiss', [sender, 1])
return
self.restartTask()
self.generateAnswer(message, sender)
def generateAnswer(self, message, sender):
name = self.air.doId2do.get(sender).getName()
answer = self.brain.think(message)
self.response(answer, sender)
def response(self, response, sendTo):
self.sendUpdate('respond', [self.npcId, response, sendTo])
self.restartTask()

View file

@ -4843,7 +4843,7 @@ def dna(part, value):
return 'Bottom texture color index set to: ' + str(dna.botTexColor) return 'Bottom texture color index set to: ' + str(dna.botTexColor)
if part == 'show': if part == 'show':
return dna.asTuple() return dna.asNpcTuple() if value else dna.asTuple()
if part == 'showrandom': if part == 'showrandom':
return NPCToons.getRandomDNA(time.time(), value) return NPCToons.getRandomDNA(time.time(), value)
return 'Invalid part: ' + part return 'Invalid part: ' + part

View file

@ -67,9 +67,8 @@ NPC_PARTYPERSON = 8
NPC_SPECIALQUESTGIVER = 9 NPC_SPECIALQUESTGIVER = 9
NPC_FLIPPYTOONHALL = 10 NPC_FLIPPYTOONHALL = 10
NPC_SCIENTIST = 11 NPC_SCIENTIST = 11
NPC_SMART = 12 NPC_GLOVE = 12
NPC_GLOVE = 13 NPC_LAFF_RESTOCK = 13
NPC_LAFF_RESTOCK = 14
CLERK_COUNTDOWN_TIME = 120 CLERK_COUNTDOWN_TIME = 120
TAILOR_COUNTDOWN_TIME = 300 TAILOR_COUNTDOWN_TIME = 300
@ -90,7 +89,6 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
import DistributedNPCSpecialQuestGiverAI import DistributedNPCSpecialQuestGiverAI
import DistributedNPCFlippyInToonHallAI import DistributedNPCFlippyInToonHallAI
import DistributedNPCScientistAI import DistributedNPCScientistAI
import DistributedSmartNPCAI
import DistributedNPCGloveAI import DistributedNPCGloveAI
import DistributedNPCLaffRestockAI import DistributedNPCLaffRestockAI
canonicalZoneId, name, dnaType, gender, protected, type = desc canonicalZoneId, name, dnaType, gender, protected, type = desc
@ -118,8 +116,6 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
npc = DistributedNPCFlippyInToonHallAI.DistributedNPCFlippyInToonHallAI(air, npcId) npc = DistributedNPCFlippyInToonHallAI.DistributedNPCFlippyInToonHallAI(air, npcId)
elif type == NPC_SCIENTIST: elif type == NPC_SCIENTIST:
npc = DistributedNPCScientistAI.DistributedNPCScientistAI(air, npcId) npc = DistributedNPCScientistAI.DistributedNPCScientistAI(air, npcId)
elif type == NPC_SMART:
npc = DistributedSmartNPCAI.DistributedSmartNPCAI(air, npcId)
elif type == NPC_GLOVE: elif type == NPC_GLOVE:
npc = DistributedNPCGloveAI.DistributedNPCGloveAI(air, npcId) npc = DistributedNPCGloveAI.DistributedNPCGloveAI(air, npcId)
elif type == NPC_LAFF_RESTOCK: elif type == NPC_LAFF_RESTOCK:
@ -161,9 +157,6 @@ def createNpcsInZone(air, zoneId):
if npcDesc[5] == NPC_PARTYPERSON: if npcDesc[5] == NPC_PARTYPERSON:
if not air.wantParties: if not air.wantParties:
continue continue
if npcDesc[5] == NPC_SMART:
if not config.GetBool('want-talkative-tyler', False):
continue
npcs.append(createNPC(air, npcId, npcDesc, zoneId, posIndex=i)) npcs.append(createNPC(air, npcId, npcDesc, zoneId, posIndex=i))
return npcs return npcs
@ -225,12 +218,6 @@ NPCToonDict = {20000: (-1,
'm', 'm',
1, 1,
NPC_SPECIALQUESTGIVER), NPC_SPECIALQUESTGIVER),
998: (2000,
lnames[998],
'r',
'm',
1,
NPC_SMART),
999: (-1, 999: (-1,
lnames[999], lnames[999],
'r', 'r',
@ -11577,8 +11564,7 @@ NPCToonDict = {20000: (-1,
0, 0,
10, 10,
5, 5,
27, 27),
0),
'm', 'm',
0, 0,
NPC_REGULAR), NPC_REGULAR),
@ -11596,8 +11582,7 @@ NPCToonDict = {20000: (-1,
0, 0,
0, 0,
0, 0,
15, 15),
0),
'm', 'm',
0, 0,
NPC_REGULAR), NPC_REGULAR),

View file

@ -1,139 +0,0 @@
# Embedded file name: /Users/pierredavidbelanger/Dev/chatter-bot-api/python/chatterbotapi.py
import md5
import urllib
import urllib2
import uuid
import xml.dom.minidom
class ChatterBotType:
CLEVERBOT = 1
JABBERWACKY = 2
PANDORABOTS = 3
class ChatterBotFactory:
def create(self, type, arg = None):
if type == ChatterBotType.CLEVERBOT:
return _Cleverbot('http://www.cleverbot.com/webservicemin', 35)
elif type == ChatterBotType.JABBERWACKY:
return _Cleverbot('http://jabberwacky.com/webservicemin', 29)
elif type == ChatterBotType.PANDORABOTS:
if arg == None:
raise Exception('PANDORABOTS needs a botid arg')
return _Pandorabots(arg)
else:
return
class ChatterBot:
def create_session(self):
return None
class ChatterBotSession:
def think_thought(self, thought):
return thought
def think(self, text):
thought = ChatterBotThought()
thought.text = text
return self.think_thought(thought).text
class ChatterBotThought:
pass
class _Cleverbot(ChatterBot):
def __init__(self, url, endIndex):
self.url = url
self.endIndex = endIndex
def create_session(self):
return _CleverbotSession(self)
class _CleverbotSession(ChatterBotSession):
def __init__(self, bot):
self.bot = bot
self.vars = {}
self.vars['start'] = 'y'
self.vars['icognoid'] = 'wsf'
self.vars['fno'] = '0'
self.vars['sub'] = 'Say'
self.vars['islearning'] = '1'
self.vars['cleanslate'] = 'false'
def think_thought(self, thought):
self.vars['stimulus'] = thought.text
data = urllib.urlencode(self.vars)
data_to_digest = data[9:self.bot.endIndex]
data_digest = md5.new(data_to_digest).hexdigest()
data = data + '&icognocheck=' + data_digest
url_response = urllib2.urlopen(self.bot.url, data)
response = url_response.read()
response_values = response.split('\r')
self.vars['sessionid'] = _utils_string_at_index(response_values, 1)
self.vars['logurl'] = _utils_string_at_index(response_values, 2)
self.vars['vText8'] = _utils_string_at_index(response_values, 3)
self.vars['vText7'] = _utils_string_at_index(response_values, 4)
self.vars['vText6'] = _utils_string_at_index(response_values, 5)
self.vars['vText5'] = _utils_string_at_index(response_values, 6)
self.vars['vText4'] = _utils_string_at_index(response_values, 7)
self.vars['vText3'] = _utils_string_at_index(response_values, 8)
self.vars['vText2'] = _utils_string_at_index(response_values, 9)
self.vars['prevref'] = _utils_string_at_index(response_values, 10)
self.vars['emotionalhistory'] = _utils_string_at_index(response_values, 12)
self.vars['ttsLocMP3'] = _utils_string_at_index(response_values, 13)
self.vars['ttsLocTXT'] = _utils_string_at_index(response_values, 14)
self.vars['ttsLocTXT3'] = _utils_string_at_index(response_values, 15)
self.vars['ttsText'] = _utils_string_at_index(response_values, 16)
self.vars['lineRef'] = _utils_string_at_index(response_values, 17)
self.vars['lineURL'] = _utils_string_at_index(response_values, 18)
self.vars['linePOST'] = _utils_string_at_index(response_values, 19)
self.vars['lineChoices'] = _utils_string_at_index(response_values, 20)
self.vars['lineChoicesAbbrev'] = _utils_string_at_index(response_values, 21)
self.vars['typingData'] = _utils_string_at_index(response_values, 22)
self.vars['divert'] = _utils_string_at_index(response_values, 23)
response_thought = ChatterBotThought()
response_thought.text = _utils_string_at_index(response_values, 16)
return response_thought
class _Pandorabots(ChatterBot):
def __init__(self, botid):
self.botid = botid
def create_session(self):
return _PandorabotsSession(self)
class _PandorabotsSession(ChatterBotSession):
def __init__(self, bot):
self.vars = {}
self.vars['botid'] = bot.botid
self.vars['custid'] = uuid.uuid1()
def think_thought(self, thought):
self.vars['input'] = thought.text
data = urllib.urlencode(self.vars)
url_response = urllib2.urlopen('http://www.pandorabots.com/pandora/talk-xml', data)
response = url_response.read()
response_dom = xml.dom.minidom.parseString(response)
response_thought = ChatterBotThought()
response_thought.text = response_dom.getElementsByTagName('that')[0].childNodes[0].data.strip()
return response_thought
def _utils_string_at_index(strings, index):
if len(strings) > index:
return strings[index]
else:
return ''

View file

@ -1,26 +0,0 @@
import random
class QuestionMgr:
def __init__(self):
self.greetings = ['hi', 'hello', 'hey', 'sup', 'howdy', 'yo']
self.greetingResp = ['Hello there, ', 'Howdy there, ', 'Hows it hanging, ', 'How do you do, ', 'Whats up, ', 'Woah! You scared me there ']
self.response = ''
self.confused = 1
def ask(self, message, sender):
msg = message.lower()
vbls = msg.split()
for i in xrange(0, len(vbls)):
if vbls[i] in self.greetings:
index = random.randint(0, len(self.greetingResp) -1)
helloResp = self.greetingResp[index]
respFinal = helloResp + '%s' % sender + '!'
self.response += helloResp
self.confused = 0
else:
if self.confused:
self.response += 'Dang, I really don\'t understand you.'
self.confused = 1
return self.response

View file

@ -2451,6 +2451,10 @@ class ToonDNA:
dg.addUint8(self.sleeveTexColor) dg.addUint8(self.sleeveTexColor)
dg.addUint8(self.botTex) dg.addUint8(self.botTex)
dg.addUint8(self.botTexColor) dg.addUint8(self.botTexColor)
self.armColor = self.migrateColor(self.armColor)
self.gloveColor = self.migrateColor(self.gloveColor)
self.legColor = self.migrateColor(self.legColor)
self.headColor = self.migrateColor(self.headColor)
for colors in (self.armColor, self.gloveColor, self.legColor, self.headColor): for colors in (self.armColor, self.gloveColor, self.legColor, self.headColor):
for color in colors[:-1]: for color in colors[:-1]:
dg.addFloat64(color) dg.addFloat64(color)
@ -2700,6 +2704,22 @@ class ToonDNA:
self.botTex, self.botTex,
self.botTexColor) self.botTexColor)
def asNpcTuple(self):
return (self.head,
self.torso,
self.legs,
self.gender,
allColorsList.index(self.armColor),
allColorsList.index(self.gloveColor),
allColorsList.index(self.legColor),
allColorsList.index(self.headColor),
self.topTex,
self.topTexColor,
self.sleeveTex,
self.sleeveTexColor,
self.botTex,
self.botTexColor)
def getType(self): def getType(self):
if self.type == 't': if self.type == 't':
type = self.getAnimal() type = self.getAnimal()

View file

@ -3057,10 +3057,8 @@ ElevatorHopOff = 'Hop off'
ElevatorStayOff = "If you hop off, you'll need to wait\nfor the elevator to leave or empty." ElevatorStayOff = "If you hop off, you'll need to wait\nfor the elevator to leave or empty."
ElevatorLeaderOff = 'Only your leader can decide when to hop off.' ElevatorLeaderOff = 'Only your leader can decide when to hop off.'
ElevatorHoppedOff = 'You need to wait for the next elevator.' ElevatorHoppedOff = 'You need to wait for the next elevator.'
ElevatorMinLaff = 'You need %s laff points to ride this elevator.'
ElevatorHopOK = 'Okay' ElevatorHopOK = 'Okay'
ElevatorGroupMember = 'Only your group leader can\n decide when to board.' ElevatorGroupMember = 'Only your group leader can\n decide when to board.'
KartMinLaff = 'You need %s laff points to ride this kart'
CogsIncExt = ', Inc.' CogsIncExt = ', Inc.'
CogsIncModifier = '%s' + CogsIncExt CogsIncModifier = '%s' + CogsIncExt
CogsInc = Cogs.upper() + CogsIncExt CogsInc = Cogs.upper() + CogsIncExt
@ -5591,7 +5589,6 @@ CatalogExitButtonText = 'Hang Up'
CatalogPastButtonText = 'To Past Items' CatalogPastButtonText = 'To Past Items'
TutorialHQOfficerName = 'HQ Harry' TutorialHQOfficerName = 'HQ Harry'
NPCToonNames = {20000: 'Tutorial Tom', NPCToonNames = {20000: 'Tutorial Tom',
998: 'Talkative Tyler',
999: 'Toon Tailor', 999: 'Toon Tailor',
1000: lToonHQ, 1000: lToonHQ,
20001: Flippy, 20001: Flippy,
@ -5607,7 +5604,6 @@ NPCToonNames = {20000: 'Tutorial Tom',
2009: lHQOfficerF, 2009: lHQOfficerF,
2010: lHQOfficerF, 2010: lHQOfficerF,
2012: 'Fisherman Freddy', 2012: 'Fisherman Freddy',
2018: 'Duff..err..TIP Man',
2013: 'Clerk Poppy', 2013: 'Clerk Poppy',
2014: 'Clerk Peppy', 2014: 'Clerk Peppy',
2015: 'Clerk Pappy', 2015: 'Clerk Pappy',
@ -8080,9 +8076,6 @@ QuitBoardingPartyLeader = 'Disband'
QuitBoardingPartyNonLeader = 'Leave' QuitBoardingPartyNonLeader = 'Leave'
QuitBoardingPartyConfirm = 'Are you sure you want to quit this Boarding Group?' QuitBoardingPartyConfirm = 'Are you sure you want to quit this Boarding Group?'
BoardcodeMissing = 'Something went wrong; try again later.' BoardcodeMissing = 'Something went wrong; try again later.'
BoardcodeMinLaffLeader = 'Your group cannot board because you have less than %s laff points.'
BoardcodeMinLaffNonLeaderSingular = 'Your group cannot board because %s has less than %s laff points.'
BoardcodeMinLaffNonLeaderPlural = 'Your group cannot board because %s have less than %s laff points.'
BoardcodePromotionLeader = 'Your group cannot board because you do not have enough promotion merits.' BoardcodePromotionLeader = 'Your group cannot board because you do not have enough promotion merits.'
BoardcodePromotionNonLeaderSingular = 'Your group cannot board because %s does not have enough promotion merits.' BoardcodePromotionNonLeaderSingular = 'Your group cannot board because %s does not have enough promotion merits.'
BoardcodePromotionNonLeaderPlural = 'Your group cannot board because %s do not have enough promotion merits.' BoardcodePromotionNonLeaderPlural = 'Your group cannot board because %s do not have enough promotion merits.'
@ -8090,8 +8083,6 @@ BoardcodeSpace = 'Your group cannot board because there is not enough space.'
BoardcodeBattleLeader = 'Your group cannot board because you are in battle.' BoardcodeBattleLeader = 'Your group cannot board because you are in battle.'
BoardcodeBattleNonLeaderSingular = 'Your group cannot board because %s is in battle.' BoardcodeBattleNonLeaderSingular = 'Your group cannot board because %s is in battle.'
BoardcodeBattleNonLeaderPlural = 'Your group cannot board because %s are in battle.' BoardcodeBattleNonLeaderPlural = 'Your group cannot board because %s are in battle.'
BoardingInviteMinLaffInviter = 'You need %s Laff Points before being a member of this Boarding Group.'
BoardingInviteMinLaffInvitee = '%s needs %s Laff Points before being a member of this Boarding Group.'
BoardingInvitePromotionInviter = 'You need to earn a promotion before being a member of this Boarding Group.' BoardingInvitePromotionInviter = 'You need to earn a promotion before being a member of this Boarding Group.'
BoardingInvitePromotionInvitee = '%s needs to earn a promotion before being a member of this Boarding Group.' BoardingInvitePromotionInvitee = '%s needs to earn a promotion before being a member of this Boarding Group.'
BoardingInviteeInDiffGroup = '%s is already in a different Boarding Group.' BoardingInviteeInDiffGroup = '%s is already in a different Boarding Group.'
@ -8099,7 +8090,7 @@ BoardingInviteeInKickOutList = '%s had been removed by your leader. Only the lea
BoardingInviteePendingIvite = '%s has a pending invite; try again later.' BoardingInviteePendingIvite = '%s has a pending invite; try again later.'
BoardingInviteeInElevator = '%s is currently busy; try again later.' BoardingInviteeInElevator = '%s is currently busy; try again later.'
BoardingInviteGroupFull = 'Your Boarding Group is already full.' BoardingInviteGroupFull = 'Your Boarding Group is already full.'
BoardingGroupsToLarge = '%s is already in a different Boarding Group that is too large to merge.' BoardingGroupsTooLarge = '%s is already in a different Boarding Group that is too large to merge.'
BoardingAlreadyInGroup = 'You cannot accept this invitation because you are part of another Boarding Group.' BoardingAlreadyInGroup = 'You cannot accept this invitation because you are part of another Boarding Group.'
BoardingGroupAlreadyFull = 'You cannot accept this invitation because the group is already full.' BoardingGroupAlreadyFull = 'You cannot accept this invitation because the group is already full.'
BoardingKickOutConfirm = 'Are you sure you want to remove %s?' BoardingKickOutConfirm = 'Are you sure you want to remove %s?'
@ -8728,6 +8719,10 @@ ColorAdvanced = 'Advanced'
ColorBasic = 'Basic' ColorBasic = 'Basic'
ColorAll = 'All' ColorAll = 'All'
ShardPagePreferred = 'Preferred'
ShardPageShardTitle = '%s Population: %s'
ShardPageTeleport = 'Teleport to\n%s'
Blacklist = [ Blacklist = [
"$1ut", "$1ut",
"$h1t", "$h1t",

View file

@ -1425,13 +1425,6 @@ ColorNoChat = (0.8,
0.5, 0.5,
0.1, 0.1,
1) 1)
FactoryLaffMinimums = [(0, 31, 0),
(0, 66, 71),
(0,
81,
86,
96),
(0, 101, 106)]
PICNIC_COUNTDOWN_TIME = 60 PICNIC_COUNTDOWN_TIME = 60
BossbotRTIntroStartPosHpr = (0, BossbotRTIntroStartPosHpr = (0,
-64, -64,

View file

@ -1,4 +1,8 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
import gc
gc.disable()
import __builtin__ import __builtin__
__builtin__.process = 'client' __builtin__.process = 'client'
@ -193,11 +197,15 @@ del version
base.loader = base.loader base.loader = base.loader
__builtin__.loader = base.loader __builtin__.loader = base.loader
autoRun = ConfigVariableBool('toontown-auto-run', 1) autoRun = ConfigVariableBool('toontown-auto-run', 1)
gc.enable()
gc.collect()
if autoRun: if autoRun:
try: try:
base.run() base.run()
except SystemExit: except SystemExit:
raise pass
except: except:
print describeException() import traceback
raise traceback.print_exc()

View file

@ -359,9 +359,6 @@ class TownBattle(StateData.StateData):
def enterAttack(self): def enterAttack(self):
self.attackPanel.enter() self.attackPanel.enter()
self.accept(self.attackPanelDoneEvent, self.__handleAttackPanelDone) self.accept(self.attackPanelDoneEvent, self.__handleAttackPanelDone)
for toonPanel in self.toonPanels:
toonPanel.setValues(0, BattleBase.NO_ATTACK)
return None return None
def exitAttack(self): def exitAttack(self):