general: loads to TTC!

This commit is contained in:
Open Toontown 2019-11-17 16:29:23 -05:00
parent 4bf0dc3263
commit 4acc9fa914
29 changed files with 723 additions and 263 deletions

3
.gitignore vendored
View file

@ -2,4 +2,7 @@
*.pyo *.pyo
*.log *.log
resources/ resources/
news/
sign/
whitelist/
*.so *.so

View file

@ -542,5 +542,6 @@ dclass AstronLoginManager : DistributedObject {
nameTypedResponse(uint32, uint8); nameTypedResponse(uint32, uint8);
acknowledgeAvatarName(uint32) clsend; acknowledgeAvatarName(uint32) clsend;
acknowledgeAvatarNameResponse(); acknowledgeAvatarNameResponse();
requestRemoveAvatar(uint32) clsend;
requestPlayAvatar(uint32) clsend;
}; };

View file

@ -442,72 +442,72 @@ typedef int16 pair16[2];
dclass DistributedToon : DistributedPlayer { dclass DistributedToon : DistributedPlayer {
setDNAString(blob) required broadcast ownrecv db; setDNAString(blob) required broadcast ownrecv db;
setGM(uint8) required broadcast ownrecv db; setGM(uint8 = 0) required broadcast ownrecv db;
setMaxBankMoney(int16) required broadcast ownrecv db; setMaxBankMoney(int16 = 12000) required broadcast ownrecv db;
setBankMoney(int16) required broadcast ownrecv db; setBankMoney(int16 = 0) required broadcast ownrecv db;
setMaxMoney(int16) required broadcast ownrecv db; setMaxMoney(int16 = 40) required broadcast ownrecv db;
setMoney(int16) required broadcast ownrecv db; setMoney(int16 = 0) required broadcast ownrecv db;
setMaxHp(int16) required broadcast ownrecv db; setMaxHp(int16 = 15) required broadcast ownrecv db;
setHp(int16) required broadcast ownrecv db; setHp(int16 = 15) required broadcast ownrecv db;
toonUp(uint16) broadcast ownrecv; toonUp(uint16) broadcast ownrecv;
takeDamage(uint16) broadcast ownrecv; takeDamage(uint16) broadcast ownrecv;
setBattleId(uint32) required broadcast ram; setBattleId(uint32) required broadcast ram;
setExperience(blob) required ownrecv db; setExperience(blob = [0 * 14]) required ownrecv db;
setMaxCarry(uint8) required ownrecv db; setMaxCarry(uint8 = 20) required ownrecv db;
setTrackAccess(uint16[]) required broadcast ownrecv db; setTrackAccess(uint16[] = [0, 0, 0, 0, 1, 1, 0]) required broadcast ownrecv db;
setTrackProgress(int8, uint32) required ownrecv db; setTrackProgress(int8 = -1, uint32 = 0) required ownrecv db;
setTrackBonusLevel(int8[]) required broadcast ownrecv db; setTrackBonusLevel(int8[] = [-1 * 7]) required broadcast ownrecv db;
setInventory(blob) required ownrecv db; setInventory(blob = [0 * 7, 0 * 7, 0 * 7, 0 * 7, 1, 0 * 6, 1, 0 * 6, 0 * 7]) required ownrecv db;
setMaxNPCFriends(uint16) required ownrecv db; setMaxNPCFriends(uint16 = 16) required ownrecv db;
setNPCFriendsDict(FriendEntry[]) required ownrecv db; setNPCFriendsDict(FriendEntry[]) required ownrecv db;
setDefaultShard(uint32) required ownrecv db; setDefaultShard(uint32 = 0) required ownrecv db;
setDefaultZone(uint32) required ownrecv db; setDefaultZone(uint32 = 0) required ownrecv db;
setShtickerBook(blob) required ownrecv db; setShtickerBook(blob = []) required ownrecv db;
setZonesVisited(uint32[]) required ownrecv db; setZonesVisited(uint32[] = [2000]) required ownrecv db;
setHoodsVisited(uint32[]) required ownrecv db; setHoodsVisited(uint32[] = [2000]) required ownrecv db;
setInterface(blob) required ownrecv db; setInterface(blob = []) required ownrecv db;
setLastHood(uint32) required ownrecv db; setLastHood(uint32 = 0) required ownrecv db;
setTutorialAck(uint8) required ownrecv db; setTutorialAck(uint8 = 0) required ownrecv db;
setMaxClothes(uint32) required ownrecv db; setMaxClothes(uint32 = 10) required ownrecv db;
setClothesTopsList(uint8[]) required ownrecv db; setClothesTopsList(uint8[] = []) required ownrecv db;
setClothesBottomsList(uint8[]) required ownrecv db; setClothesBottomsList(uint8[] = []) required ownrecv db;
setMaxAccessories(uint32) required ownrecv db; setMaxAccessories(uint32 = 0) required ownrecv db;
setHatList(uint8[]) required ownrecv db; setHatList(uint8[] = []) required ownrecv db;
setGlassesList(uint8[]) required ownrecv db; setGlassesList(uint8[] = []) required ownrecv db;
setBackpackList(uint8[]) required ownrecv db; setBackpackList(uint8[] = []) required ownrecv db;
setShoesList(uint8[]) required ownrecv db; setShoesList(uint8[] = []) required ownrecv db;
setHat(uint8, uint8, uint8) required broadcast db ownrecv; setHat(uint8 = 0, uint8 = 0, uint8 = 0) required broadcast db ownrecv;
setGlasses(uint8, uint8, uint8) required broadcast db ownrecv; setGlasses(uint8 = 0, uint8 = 0, uint8 = 0) required broadcast db ownrecv;
setBackpack(uint8, uint8, uint8) required broadcast db ownrecv; setBackpack(uint8 = 0, uint8 = 0, uint8 = 0) required broadcast db ownrecv;
setShoes(uint8, uint8, uint8) required broadcast db ownrecv; setShoes(uint8 = 0, uint8 = 0, uint8 = 0) required broadcast db ownrecv;
setGardenSpecials(gardenSpecial []) required ownrecv db airecv; setGardenSpecials(gardenSpecial [] = []) required ownrecv db airecv;
setEarnedExperience(uint16[]) ownrecv; setEarnedExperience(uint16[]) ownrecv;
setTunnelIn(int16, int16/10, int16/10, int16/10, int16/100, int32/100) ownsend broadcast; setTunnelIn(int16, int16/10, int16/10, int16/10, int16/100, int32/100) ownsend broadcast;
setTunnelOut(int16, int16/10, int16/10, int16/10, int16/10, int16/100, int32/100) ownsend broadcast; setTunnelOut(int16, int16/10, int16/10, int16/10, int16/10, int16/100, int32/100) ownsend broadcast;
setAnimState(char [0-1024], int16/1000, int16) broadcast ram ownsend airecv; setAnimState(char [0-1024], int16/1000, int16) broadcast ram ownsend airecv;
setEmoteState(int16, int16/1000, int16) broadcast ram ownsend; setEmoteState(int16, int16/1000, int16) broadcast ram ownsend;
setEmoteAccess(uint8[]) required ownrecv db; setEmoteAccess(uint8[] = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) required ownrecv db;
setCustomMessages(uint16[]) required ownrecv db; setCustomMessages(uint16[] = []) required ownrecv db;
setSleepAutoReply(uint32) broadcast clsend ownrecv; setSleepAutoReply(uint32) broadcast clsend ownrecv;
setResistanceMessages(pair16 []) required ownrecv db; setResistanceMessages(pair16 [] = []) required ownrecv db;
setPetTrickPhrases(uint8[]) required ownrecv db; setPetTrickPhrases(uint8[] = [0]) required ownrecv db;
setCatalogSchedule(uint16, uint32) required ownrecv db; setCatalogSchedule(uint16 = 0, uint32 = 0) required ownrecv db;
setCatalog(blob, blob, blob) required ownrecv db; setCatalog(blob = [], blob = [], blob = []) required ownrecv db;
setMailboxContents(blob) required ownrecv db; setMailboxContents(blob = []) required ownrecv db;
setDeliverySchedule(blob) required ownrecv db airecv; setDeliverySchedule(blob = []) required ownrecv db airecv;
setGiftSchedule(blob) required ownrecv db airecv; setGiftSchedule(blob = []) required ownrecv db airecv;
setAwardMailboxContents(blob) required ownrecv db; setAwardMailboxContents(blob = []) required ownrecv db;
setAwardSchedule(blob) required ownrecv db airecv; setAwardSchedule(blob = []) required ownrecv db airecv;
setAwardNotify(uint8) required ownrecv db; setAwardNotify(uint8 = 0) required ownrecv db;
setCatalogNotify(uint8, uint8) required ownrecv db; setCatalogNotify(uint8 = 0, uint8 = 0) required ownrecv db;
playSplashEffect(int16/10, int16/10, int16/10) broadcast ownsend; playSplashEffect(int16/10, int16/10, int16/10) broadcast ownsend;
setWhisperSCToontaskFrom(uint32, uint32, uint32, uint32, uint8) ownrecv clsend; setWhisperSCToontaskFrom(uint32, uint32, uint32, uint32, uint8) ownrecv clsend;
setSCToontask(uint32, uint32, uint32, uint8) broadcast ownsend; setSCToontask(uint32, uint32, uint32, uint8) broadcast ownsend;
reqSCResistance(uint16, uint32 []) ownsend airecv; reqSCResistance(uint16, uint32 []) ownsend airecv;
setSCResistance(uint16, uint32 []) broadcast ownrecv; setSCResistance(uint16, uint32 []) broadcast ownrecv;
setSpeedChatStyleIndex(uint8) required ownsend broadcast db; setSpeedChatStyleIndex(uint8 = 1) required ownsend broadcast db;
setTrophyScore(uint16) broadcast ownrecv ram; setTrophyScore(uint16) broadcast ownrecv ram;
setTeleportAccess(uint32[]) required ownrecv db; setTeleportAccess(uint32[] = []) required ownrecv db;
checkTeleportAccess(uint16) airecv ownsend; checkTeleportAccess(uint16) airecv ownsend;
battleSOS(uint32) ownrecv clsend; battleSOS(uint32) ownrecv clsend;
teleportQuery(uint32) ownrecv clsend; teleportQuery(uint32) ownrecv clsend;
@ -515,39 +515,39 @@ dclass DistributedToon : DistributedPlayer {
teleportResponseToAI(uint32, int8, uint32, uint32, uint32, uint32) ownsend airecv; teleportResponseToAI(uint32, int8, uint32, uint32, uint32, uint32) ownsend airecv;
teleportGiveup(uint32) ownrecv clsend; teleportGiveup(uint32) ownrecv clsend;
teleportGreeting(uint32) broadcast ownsend; teleportGreeting(uint32) broadcast ownsend;
setCogStatus(uint32[]) required ownrecv db; setCogStatus(uint32[] = [1 * 32]) required ownrecv db;
setCogCount(uint32[]) required ownrecv db; setCogCount(uint32[] = [0 * 32]) required ownrecv db;
setCogRadar(uint8[]) required ownrecv db; setCogRadar(uint8[] = [0 * 4]) required ownrecv db;
setBuildingRadar(uint8[]) required ownrecv db; setBuildingRadar(uint8[] = [0 * 4]) required ownrecv db;
setCogLevels(uint8[]) required broadcast ownrecv db; setCogLevels(uint8[] = [0 * 4]) required broadcast ownrecv db;
setCogTypes(uint8[]) required broadcast ownrecv db; setCogTypes(uint8[] = [0 * 4]) required broadcast ownrecv db;
setCogParts(uint32[]) required broadcast ownrecv db; setCogParts(uint32[] = [0 * 4]) required broadcast ownrecv db;
setCogMerits(uint16[]) required ownrecv db; setCogMerits(uint16[] = [0 * 4]) required ownrecv db;
setCogIndex(int8) broadcast ram; setCogIndex(int8) broadcast ram;
setDisguisePageFlag(int8) ownrecv; setDisguisePageFlag(int8) ownrecv;
setSosPageFlag(int8) ownrecv; setSosPageFlag(int8) ownrecv;
setHouseId(uint32) required ownrecv db; setHouseId(uint32 = 0) required ownrecv db;
setQuests(uint32[]) required broadcast ownrecv db; setQuests(uint32[] = []) required broadcast ownrecv db;
setQuestHistory(uint16[]) required ownrecv db; setQuestHistory(uint16[] = []) required ownrecv db;
setRewardHistory(uint8, uint16[]) required ownrecv db; setRewardHistory(uint8 = 0, uint16[] = []) required ownrecv db;
setQuestCarryLimit(uint8) required ownrecv db; setQuestCarryLimit(uint8 = 1) required ownrecv db;
requestDeleteQuest(uint32[]) ownsend airecv; requestDeleteQuest(uint32[]) ownsend airecv;
setCheesyEffect(int16, uint32, uint32) required broadcast ownrecv db; setCheesyEffect(int16 = 0, uint32 = 0, uint32 = 0) required broadcast ownrecv db;
setGhostMode(uint8) broadcast ownrecv ram; setGhostMode(uint8) broadcast ownrecv ram;
setPosIndex(uint8) required ownrecv db; setPosIndex(uint8 = 0) required ownrecv db;
setFishCollection(uint8[], uint8[], uint16[]) required ownrecv db; setFishCollection(uint8[] = [], uint8[] = [], uint16[] = []) required ownrecv db;
setMaxFishTank(uint8) required ownrecv db; setMaxFishTank(uint8 = 20) required ownrecv db;
setFishTank(uint8[], uint8[], uint16[]) required ownrecv db; setFishTank(uint8[] = [], uint8[] = [], uint16[] = []) required ownrecv db;
setFishingRod(uint8) required broadcast ownrecv db; setFishingRod(uint8 = 0) required broadcast ownrecv db;
setFishingTrophies(uint8[]) required ownrecv db; setFishingTrophies(uint8[] = []) required ownrecv db;
setFlowerCollection(uint8[], uint8[]) required ownrecv db; setFlowerCollection(uint8[] = [], uint8[] = []) required ownrecv db;
setFlowerBasket(uint8[], uint8[]) required ownrecv db; setFlowerBasket(uint8[] = [], uint8[] = []) required ownrecv db;
setMaxFlowerBasket(uint8) required ownrecv db; setMaxFlowerBasket(uint8 = 20) required ownrecv db;
setGardenTrophies(uint8[]) required ownrecv db; setGardenTrophies(uint8[] = []) required ownrecv db;
setShovel(uint8) required broadcast ownrecv db; setShovel(uint8 = 0) required broadcast ownrecv db;
setShovelSkill(uint32) required ownrecv db; setShovelSkill(uint32 = 0) required ownrecv db;
setWateringCan(uint8) required broadcast ownrecv db; setWateringCan(uint8 = 0) required broadcast ownrecv db;
setWateringCanSkill(uint32) required ownrecv db; setWateringCanSkill(uint32 = 0) required ownrecv db;
promoteShovel(uint8) ownrecv; promoteShovel(uint8) ownrecv;
promoteWateringCan(uint8) ownrecv; promoteWateringCan(uint8) ownrecv;
reactivateWater() ownrecv; reactivateWater() ownrecv;
@ -558,51 +558,51 @@ dclass DistributedToon : DistributedPlayer {
setNumPies(uint16) broadcast ownrecv ram; setNumPies(uint16) broadcast ownrecv ram;
catalogGenClothes(uint32) broadcast ownrecv; catalogGenClothes(uint32) broadcast ownrecv;
catalogGenAccessories(uint32) broadcast ownrecv; catalogGenAccessories(uint32) broadcast ownrecv;
setPetId(uint32) required broadcast ownrecv db; setPetId(uint32 = 0) required broadcast ownrecv db;
setPetMovie(uint32, uint8) ownsend airecv; setPetMovie(uint32, uint8) ownsend airecv;
setPetTutorialDone(uint8) required ownsend airecv db; setPetTutorialDone(uint8 = 0) required ownsend airecv db;
setFishBingoTutorialDone(uint8) required ownsend airecv db; setFishBingoTutorialDone(uint8 = 0) required ownsend airecv db;
setFishBingoMarkTutorialDone(uint8) required ownsend airecv db; setFishBingoMarkTutorialDone(uint8 = 0) required ownsend airecv db;
setKartBodyType(int8) required broadcast ownrecv db; setKartBodyType(int8 = -1) required broadcast ownrecv db;
setKartBodyColor(int8) required broadcast ownrecv db; setKartBodyColor(int8 = -1) required broadcast ownrecv db;
setKartAccessoryColor(int8) required broadcast ownrecv db; setKartAccessoryColor(int8 = -1) required broadcast ownrecv db;
setKartEngineBlockType(int8) required broadcast ownrecv db; setKartEngineBlockType(int8 = -1) required broadcast ownrecv db;
setKartSpoilerType(int8) required broadcast ownrecv db; setKartSpoilerType(int8 = -1) required broadcast ownrecv db;
setKartFrontWheelWellType(int8) required broadcast ownrecv db; setKartFrontWheelWellType(int8 = -1) required broadcast ownrecv db;
setKartBackWheelWellType(int8) required broadcast ownrecv db; setKartBackWheelWellType(int8 = -1) required broadcast ownrecv db;
setKartRimType(int8) required broadcast ownrecv db; setKartRimType(int8 = -1) required broadcast ownrecv db;
setKartDecalType(int8) required broadcast ownrecv db; setKartDecalType(int8 = -1) required broadcast ownrecv db;
updateKartDNAField(int8, int8) ownsend airecv; updateKartDNAField(int8, int8) ownsend airecv;
addOwnedAccessory(int8) ownsend airecv; addOwnedAccessory(int8) ownsend airecv;
removeOwnedAccessory(int8) ownsend airecv; removeOwnedAccessory(int8) ownsend airecv;
setTickets(uint32) required broadcast ownrecv db; setTickets(uint32 = 200) required broadcast ownrecv db;
setKartingHistory(uint8 [16]) required ownrecv db; setKartingHistory(uint8 [16] = [0 * 16]) required ownrecv db;
setKartingTrophies(uint8 [33]) required ownrecv db; setKartingTrophies(uint8 [33] = [0 * 33]) required ownrecv db;
setKartingPersonalBest(uint32/1000 [6]) required ownrecv db; setKartingPersonalBest(uint32/1000 [6] = [0 * 6]) required ownrecv db;
setKartingPersonalBest2(uint32/1000 [12]) required ownrecv db; setKartingPersonalBest2(uint32/1000 [12] = [0 * 12]) required ownrecv db;
setKartAccessoriesOwned(int8 [16]) required broadcast ownrecv db; setKartAccessoriesOwned(int8 [16] = [-1 * 16]) required broadcast ownrecv db;
setCurrentKart(uint32) broadcast ownrecv ram; setCurrentKart(uint32) broadcast ownrecv ram;
squish(uint8) ownsend airecv; squish(uint8) ownsend airecv;
announceBingo() broadcast ownrecv; announceBingo() broadcast ownrecv;
trickOrTreatTargetMet(uint32) ownrecv; trickOrTreatTargetMet(uint32) ownrecv;
trickOrTreatMilestoneMet() ownrecv; trickOrTreatMilestoneMet() ownrecv;
winterCarolingTargetMet(uint32) ownrecv; winterCarolingTargetMet(uint32) ownrecv;
setCogSummonsEarned(uint8[]) required ownrecv db; setCogSummonsEarned(uint8[] = [0 * 32]) required ownrecv db;
reqCogSummons(char [0-256], uint32) ownsend airecv; reqCogSummons(char [0-256], uint32) ownsend airecv;
cogSummonsResponse(string, uint32, uint32) ownrecv; cogSummonsResponse(string, uint32, uint32) ownrecv;
reqUseSpecial(int32) ownsend airecv; reqUseSpecial(int32) ownsend airecv;
useSpecialResponse(string) ownrecv; useSpecialResponse(string) ownrecv;
setGardenStarted(uint8) required ownrecv db; setGardenStarted(uint8 = 0) required ownrecv db;
sendToGolfCourse(uint32) ownrecv; sendToGolfCourse(uint32) ownrecv;
setGolfHistory(uint16 [18]) required ownrecv db; setGolfHistory(uint16 [18] = [0 * 18]) required ownrecv db;
setPackedGolfHoleBest(uint8 [18]) required ownrecv db; setPackedGolfHoleBest(uint8 [18] = [0 * 18]) required ownrecv db;
setGolfCourseBest(uint8 [3]) required ownrecv db; setGolfCourseBest(uint8 [3] = [0 * 3]) required ownrecv db;
setUnlimitedSwing(uint8) broadcast ownrecv ram; setUnlimitedSwing(uint8) broadcast ownrecv ram;
logSuspiciousEvent(char [0-1024]) ownsend airecv; logSuspiciousEvent(char [0-1024]) ownsend airecv;
logMessage(char [0-1024]) ownsend airecv; logMessage(char [0-1024]) ownsend airecv;
forceLogoutWithNotify() ownrecv; forceLogoutWithNotify() ownrecv;
setPinkSlips(uint8) required ownrecv db; setPinkSlips(uint8 = 0) required ownrecv db;
setNametagStyle(uint8) broadcast required ram db; setNametagStyle(uint8 = 0) broadcast required ram db;
setMail(simpleMail []) ownrecv; setMail(simpleMail []) ownrecv;
setNumMailItems(uint32) airecv; setNumMailItems(uint32) airecv;
setSimpleMailNotify(uint8) ownrecv airecv; setSimpleMailNotify(uint8) ownrecv airecv;
@ -3269,4 +3269,3 @@ dclass DistributedTrashcanZeroMgr : DistributedPhaseEventMgr {
dclass DistributedSillyMeterMgr : DistributedPhaseEventMgr { dclass DistributedSillyMeterMgr : DistributedPhaseEventMgr {
}; };

View file

@ -42,3 +42,11 @@ class Settings:
@staticmethod @staticmethod
def doSavedSettingsExist(): def doSavedSettingsExist():
return 0 return 0
@staticmethod
def getAcceptingNewFriends():
return 1
@staticmethod
def getAcceptingNonFriendWhispers():
return 1

View file

@ -956,15 +956,15 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def _requestAvatarList(self): def _requestAvatarList(self):
if not self.astronSupport:
self.sendGetAvatarsMsg() self.sendGetAvatarsMsg()
else:
self.astronLoginManager.sendRequestAvatarList()
self.waitForDatabaseTimeout(requestName='WaitForAvatarList') self.waitForDatabaseTimeout(requestName='WaitForAvatarList')
self.acceptOnce(OtpAvatarManager.OtpAvatarManager.OnlineEvent, self._requestAvatarList) self.acceptOnce(OtpAvatarManager.OtpAvatarManager.OnlineEvent, self._requestAvatarList)
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def sendGetAvatarsMsg(self): def sendGetAvatarsMsg(self):
if self.astronSupport:
self.astronLoginManager.sendRequestAvatarList()
else:
datagram = PyDatagram() datagram = PyDatagram()
datagram.addUint16(CLIENT_GET_AVATARS) datagram.addUint16(CLIENT_GET_AVATARS)
self.send(datagram) self.send(datagram)
@ -1086,12 +1086,16 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterWaitForDeleteAvatarResponse(self, potAv): def enterWaitForDeleteAvatarResponse(self, potAv):
if not self.astronSupport:
self.handler = self.handleWaitForDeleteAvatarResponse self.handler = self.handleWaitForDeleteAvatarResponse
self.sendDeleteAvatarMsg(potAv.id) self.sendDeleteAvatarMsg(potAv.id)
self.waitForDatabaseTimeout(requestName='WaitForDeleteAvatarResponse') self.waitForDatabaseTimeout(requestName='WaitForDeleteAvatarResponse')
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def sendDeleteAvatarMsg(self, avId): def sendDeleteAvatarMsg(self, avId):
if self.astronSupport:
self.astronLoginManager.sendRequestRemoveAvatar(avId)
else:
datagram = PyDatagram() datagram = PyDatagram()
datagram.addUint16(CLIENT_DELETE_AVATAR) datagram.addUint16(CLIENT_DELETE_AVATAR)
datagram.addUint32(avId) datagram.addUint32(avId)
@ -1133,6 +1137,7 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterWaitForSetAvatarResponse(self, potAv): def enterWaitForSetAvatarResponse(self, potAv):
if not self.astronSupport:
self.handler = self.handleWaitForSetAvatarResponse self.handler = self.handleWaitForSetAvatarResponse
self.sendSetAvatarMsg(potAv) self.sendSetAvatarMsg(potAv)
self.waitForDatabaseTimeout(requestName='WaitForSetAvatarResponse') self.waitForDatabaseTimeout(requestName='WaitForSetAvatarResponse')
@ -1152,6 +1157,9 @@ class OTPClientRepository(ClientRepositoryBase):
def sendSetAvatarIdMsg(self, avId): def sendSetAvatarIdMsg(self, avId):
if avId != self.__currentAvId: if avId != self.__currentAvId:
self.__currentAvId = avId self.__currentAvId = avId
if self.astronSupport:
self.astronLoginManager.sendRequestPlayAvatar(avId)
else:
datagram = PyDatagram() datagram = PyDatagram()
datagram.addUint16(CLIENT_SET_AVATAR) datagram.addUint16(CLIENT_SET_AVATAR)
datagram.addUint32(avId) datagram.addUint32(avId)
@ -1413,6 +1421,7 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterWaitOnEnterResponses(self, shardId, hoodId, zoneId, avId): def enterWaitOnEnterResponses(self, shardId, hoodId, zoneId, avId):
self.cleanGameExit = False self.cleanGameExit = False
if not self.astronSupport:
self.handler = self.handleWaitOnEnterResponses self.handler = self.handleWaitOnEnterResponses
self.handlerArgs = {'hoodId': hoodId, self.handlerArgs = {'hoodId': hoodId,
'zoneId': zoneId, 'zoneId': zoneId,
@ -1635,6 +1644,7 @@ class OTPClientRepository(ClientRepositoryBase):
else: else:
self.gameFSM.request('playGame', [hoodId, zoneId, avId]) self.gameFSM.request('playGame', [hoodId, zoneId, avId])
if not config.GetBool('astron-support', True):
def handlePlayGame(self, msgType, di): def handlePlayGame(self, msgType, di):
if self.notify.getDebug(): if self.notify.getDebug():
self.notify.debug('handle play game got message type: ' + `msgType`) self.notify.debug('handle play game got message type: ' + `msgType`)
@ -1662,6 +1672,24 @@ class OTPClientRepository(ClientRepositoryBase):
self.handleGetAvatarDetailsResp(di) self.handleGetAvatarDetailsResp(di)
else: else:
self.handleMessageType(msgType, di) self.handleMessageType(msgType, di)
else:
def handlePlayGame(self, msgType, di):
if self.notify.getDebug():
self.notify.debug('handle play game got message type: ' + `msgType`)
if msgType == CLIENT_ENTER_OBJECT_REQUIRED:
self.handleGenerateWithRequired(di)
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
self.handleGenerateWithRequiredOther(di)
elif msgType == CLIENT_OBJECT_SET_FIELD:
self.handleUpdateField(di)
elif msgType == CLIENT_OBJECT_DISABLE:
self.handleDisable(di)
elif msgType == CLIENT_OBJECT_DISABLE_OWNER:
self.handleDisable(di, ownerView=True)
elif msgType == CLIENT_OBJECT_DELETE_RESP:
self.handleDelete(di)
else:
self.handleMessageType(msgType, di)
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterSwitchShards(self, shardId, hoodId, zoneId, avId): def enterSwitchShards(self, shardId, hoodId, zoneId, avId):
@ -2226,6 +2254,36 @@ class OTPClientRepository(ClientRepositoryBase):
self.doGenerate(parentId, zoneId, classId, doId, di) self.doGenerate(parentId, zoneId, classId, doId, di)
else: else:
self.doGenerate(parentId, zoneId, classId, doId, di) self.doGenerate(parentId, zoneId, classId, doId, di)
def handleGenerateWithRequiredOtherOwner(self, di):
classId = di.getUint16()
doId = di.getUint32()
parentId = di.getUint32()
zoneId = di.getUint32()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredOtherFieldsOwner(dclass, doId, di)
dclass.stopGenerate()
def handleQuietZoneGenerateWithRequired(self, di):
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
doId = di.getUint32()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate()
def handleQuietZoneGenerateWithRequiredOther(self, di):
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
doId = di.getUint32()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredOtherFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate()
else: else:
def handleGenerateWithRequired(self, di, other=False): def handleGenerateWithRequired(self, di, other=False):
doId = di.getUint32() doId = di.getUint32()
@ -2356,6 +2414,36 @@ class OTPClientRepository(ClientRepositoryBase):
# We're done. # We're done.
dclass.stopGenerate() dclass.stopGenerate()
def handleGenerateWithRequiredOtherOwner(self, di):
doId = di.getUint32()
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredOtherFieldsOwner(dclass, doId, di)
dclass.stopGenerate()
def handleQuietZoneGenerateWithRequired(self, di):
doId = di.getUint32()
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate()
def handleQuietZoneGenerateWithRequiredOther(self, di):
doId = di.getUint32()
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredOtherFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate()
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def handleAvatarListResponse(self, avatarList): def handleAvatarListResponse(self, avatarList):
avList = [] avList = []
@ -2379,36 +2467,6 @@ class OTPClientRepository(ClientRepositoryBase):
self.avList = avList self.avList = avList
self.loginFSM.request('chooseAvatar', [self.avList]) self.loginFSM.request('chooseAvatar', [self.avList])
def handleGenerateWithRequiredOtherOwner(self, di):
classId = di.getUint16()
doId = di.getUint32()
parentId = di.getUint32()
zoneId = di.getUint32()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredOtherFieldsOwner(dclass, doId, di)
dclass.stopGenerate()
def handleQuietZoneGenerateWithRequired(self, di):
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
doId = di.getUint32()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate()
def handleQuietZoneGenerateWithRequiredOther(self, di):
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
doId = di.getUint32()
dclass = self.dclassesByNumber[classId]
dclass.startGenerate()
distObj = self.generateWithRequiredOtherFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate()
def handleDisable(self, di, ownerView = False): def handleDisable(self, di, ownerView = False):
doId = di.getUint32() doId = di.getUint32()
if not self.isLocalId(doId): if not self.isLocalId(doId):

View file

@ -15,3 +15,6 @@ class OTPInternalRepository(AstronInternalRepository):
def getAccountIdFromSender(self): def getAccountIdFromSender(self):
return (self.getMsgSender() >> 32) & 0xFFFFFFFF return (self.getMsgSender() >> 32) & 0xFFFFFFFF
def getAvatarIdFromSender(self):
return self.getMsgSender() & 0xFFFFFFFF

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import *
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData from direct.fsm import StateData

View file

@ -149,3 +149,9 @@ class AstronLoginManager(DistributedObjectGlobal):
def acknowledgeAvatarNameResponse(self): def acknowledgeAvatarNameResponse(self):
self._callback() self._callback()
def sendRequestRemoveAvatar(self, avId):
self.sendUpdate('requestRemoveAvatar', [avId])
def sendRequestPlayAvatar(self, avId):
self.sendUpdate('requestPlayAvatar', [avId])

View file

@ -191,6 +191,7 @@ class LoginOperation:
class GetAvatarsOperation: class GetAvatarsOperation:
notify = DirectNotifyGlobal.directNotify.newCategory('GetAvatarsOperation')
def __init__(self, loginManager, sender): def __init__(self, loginManager, sender):
self.loginManager = loginManager self.loginManager = loginManager
@ -549,6 +550,181 @@ class AcknowledgeNameOperation:
del self.loginManager.account2operation[self.sender] del self.loginManager.account2operation[self.sender]
class RemoveAvatarOperation:
notify = DirectNotifyGlobal.directNotify.newCategory('RemoveAvatarOperation')
def __init__(self, loginManager, sender):
self.loginManager = loginManager
self.sender = sender
self.account = None
self.avList = []
self.pendingAvatars = None
self.avatarFields = None
self.avId = None
def start(self, avId):
self.avId = avId
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
# no uwu
return
self.account = fields
self.avList = self.account['ACCOUNT_AV_SET']
self.avList = self.avList[:6]
self.avList += [0] * (6 - len(self.avList))
self.__handleRemoveAvatar()
def __handleRemoveAvatar(self):
if self.avId not in self.avList:
# avatar doesn't exist.
return
index = self.avList.index(self.avId)
self.avList[index] = 0
avatarsRemoved = list(self.account.get('ACCOUNT_AV_SET_DEL', []))
avatarsRemoved.append([self.avId, int(time.time())])
estateId = self.account.get('ESTATE_ID', 0)
if estateId != 0:
self.loginManager.air.dbInterface.updateObject(self.loginManager.air.dbId, estateId,
self.loginManager.air.dclassesByName['DistributedEstateAI'],
{'setSlot%sToonId' % index: [0],
'setSlot%sItems' % index: [[]]})
self.loginManager.air.dbInterface.updateObject(self.loginManager.air.dbId, self.sender, self.loginManager.air.dclassesByName['AstronAccountUD'],
{'ACCOUNT_AV_SET': self.avList,
'ACCOUNT_AV_SET_DEL': avatarsRemoved},
{'ACCOUNT_AV_SET': self.account['ACCOUNT_AV_SET'],
'ACCOUNT_AV_SET_DEL': self.account['ACCOUNT_AV_SET_DEL']},
self.__handleAvatarRemoved)
def __handleAvatarRemoved(self, fields):
if fields:
# failed to remove the avatar.
return
self.__handleQueryAvatars()
def __handleQueryAvatars(self):
self.pendingAvatars = set()
self.avatarFields = {}
for avId in self.avList:
if avId:
self.pendingAvatars.add(avId)
def response(dclass, fields, avId=avId):
if dclass != self.loginManager.air.dclassesByName['DistributedToonUD']:
# mayonnaise
return
self.avatarFields[avId] = fields
self.pendingAvatars.remove(avId)
if not self.pendingAvatars:
self.__handleSendAvatars()
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, avId, response)
if not self.pendingAvatars:
self.__handleSendAvatars()
def __handleSendAvatars(self):
potentialAvatars = []
for avId, fields in self.avatarFields.items():
index = self.avList.index(avId)
wishNameState = fields.get('WishNameState', [''])[0]
name = fields['setName'][0]
nameState = 0
if wishNameState == 'OPEN':
nameState = 1
elif wishNameState == 'PENDING':
nameState = 2
elif wishNameState == 'APPROVED':
nameState = 3
name = fields['WishName'][0]
elif wishNameState == 'REJECTED':
nameState = 4
elif wishNameState == 'LOCKED':
nameState = 0
else:
# unknown name state.
nameState = 0
potentialAvatars.append([avId, name, fields['setDNAString'][0], index, nameState])
self.loginManager.sendUpdateToAccountId(self.sender, 'avatarListResponse', [potentialAvatars])
del self.loginManager.account2operation[self.sender]
class LoadAvatarOperation:
notify = DirectNotifyGlobal.directNotify.newCategory('LoadAvatarOperation')
def __init__(self, loginManager, sender):
self.loginManager = loginManager
self.sender = sender
self.avId = None
def start(self, avId):
self.avId = avId
self.__handleRetrieveAccount()
def __handleRetrieveAccount(self):
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
# no uwu
return
self.account = fields
self.avList = self.account['ACCOUNT_AV_SET']
self.avList = self.avList[:6]
self.avList += [0] * (6 - len(self.avList))
self.__handleGetTargetAvatar()
def __handleGetTargetAvatar(self):
if self.avId not in self.avList:
return
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId, self.__handleAvatarRetrieved)
def __handleAvatarRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['DistributedToonUD']:
return
self.avatar = fields
self.__handleSetAvatar()
def __handleSetAvatar(self):
channel = self.loginManager.GetAccountConnectionChannel(self.sender)
cleanupDatagram = PyDatagram()
cleanupDatagram.addServerHeader(self.avId, channel, STATESERVER_OBJECT_DELETE_RAM)
cleanupDatagram.addUint32(self.avId)
datagram = PyDatagram()
datagram.addServerHeader(channel, self.loginManager.air.ourChannel, CLIENTAGENT_ADD_POST_REMOVE)
datagram.addString(cleanupDatagram.getMessage())
self.loginManager.air.send(datagram)
self.loginManager.air.sendActivate(self.avId, 0, 0, self.loginManager.air.dclassesByName['DistributedToonUD'])
datagram = PyDatagram()
datagram.addServerHeader(channel, self.loginManager.air.ourChannel, CLIENTAGENT_OPEN_CHANNEL)
datagram.addChannel(self.loginManager.GetPuppetConnectionChannel(self.avId))
self.loginManager.air.send(datagram)
self.loginManager.air.clientAddSessionObject(channel, self.avId)
datagram = PyDatagram()
datagram.addServerHeader(channel, self.loginManager.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
datagram.addChannel(self.sender << 32 | self.avId) # accountId in high 32 bits, avatar in low.
self.loginManager.air.send(datagram)
self.loginManager.air.setOwner(self.avId, channel)
del self.loginManager.account2operation[self.sender]
class AstronLoginManagerUD(DistributedObjectGlobalUD): class AstronLoginManagerUD(DistributedObjectGlobalUD):
notify = DirectNotifyGlobal.directNotify.newCategory('AstronLoginManagerUD') notify = DirectNotifyGlobal.directNotify.newCategory('AstronLoginManagerUD')
@ -653,3 +829,45 @@ class AstronLoginManagerUD(DistributedObjectGlobalUD):
newOperation = AcknowledgeNameOperation(self, sender) newOperation = AcknowledgeNameOperation(self, sender)
self.account2operation[sender] = newOperation self.account2operation[sender] = newOperation
newOperation.start(avId) newOperation.start(avId)
def requestRemoveAvatar(self, avId):
sender = self.air.getAccountIdFromSender()
if not sender:
# TODO KILL CONNECTION
return
if sender in self.account2operation:
# BAD!!!!
return
newOperation = RemoveAvatarOperation(self, sender)
self.account2operation[sender] = newOperation
newOperation.start(avId)
def requestPlayAvatar(self, avId):
currentAvId = self.air.getAvatarIdFromSender()
accId = self.air.getAccountIdFromSender()
if currentAvId and avId:
# todo: kill the connection
return
elif not currentAvId and not avId:
# I don't think we need to do anything extra here
return
sender = self.air.getAccountIdFromSender()
if not sender:
# TODO KILL CONNECTION
return
if sender in self.account2operation:
# BAD!!!!
return
if avId:
newOperation = LoadAvatarOperation(self, sender)
self.account2operation[sender] = newOperation
newOperation.start(avId)
else:
newOperation = UnloadAvatarOperation(self, sender)
self.account2operation[sender] = newOperation
newOperation.start(currentAvId)

View file

@ -23,3 +23,6 @@ class LoginAstronAccount(LoginBase):
if __debug__: if __debug__:
return 1 return 1
return 0 return 0
def supportsAuthenticateDelete(self):
return 0

View file

@ -0,0 +1,4 @@
class HolidayManagerAI:
def __init__(self, air):
self.air = air
self.currentHolidays = {}

View file

@ -1,16 +1,25 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from otp.ai.AIZoneData import AIZoneDataStore
from otp.distributed.OtpDoGlobals import *
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
from otp.distributed.OtpDoGlobals import * from toontown.ai.HolidayManagerAI import HolidayManagerAI
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
from toontown.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI
class ToontownAIRepository(ToontownInternalRepository): class ToontownAIRepository(ToontownInternalRepository):
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownAIRepository') notify = DirectNotifyGlobal.directNotify.newCategory('ToontownAIRepository')
def __init__(self, baseChannel, serverId, districtName): def __init__(self, baseChannel, serverId, districtName):
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='AI') ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='AI')
self.doLiveUpdates = config.GetBool('want-live-updates', True)
self.districtName = districtName self.districtName = districtName
self.districtId = None self.districtId = None
self.district = None self.district = None
self.holidayManager = None
self.zoneDataStore = None
self.inGameNewsMgr = None
self.catalogManager = None
def handleConnected(self): def handleConnected(self):
ToontownInternalRepository.handleConnected(self) ToontownInternalRepository.handleConnected(self)
@ -24,6 +33,53 @@ class ToontownAIRepository(ToontownInternalRepository):
# Claim ownership of that district... # Claim ownership of that district...
self.district.setAI(self.ourChannel) self.district.setAI(self.ourChannel)
# Create our local objects.
self.createLocals()
# Create our global objects.
self.createGlobals()
# Make our district available, and we're done. # Make our district available, and we're done.
self.district.b_setAvailable(True) self.district.b_setAvailable(True)
self.notify.info('Done.') self.notify.info('Done.')
def createLocals(self):
"""
Creates "local" (non-distributed) objects.
"""
# Create our holiday manager...
self.holidayManager = HolidayManagerAI(self)
# Create our zone data store...
self.zoneDataStore = AIZoneDataStore()
def createGlobals(self):
"""
Creates "global" (distributed) objects.
"""
# Generate our in-game news manager...
self.inGameNewsMgr = DistributedInGameNewsMgrAI(self)
self.inGameNewsMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
# Generate our catalog manager...
self.catalogManager = CatalogManagerAI(self)
def getTrackClsends(self):
return False
def getAvatarExitEvent(self, avId):
return 'distObjDelete-%d' % avId
def getZoneDataStore(self):
return self.zoneDataStore
def incrementPopulation(self):
print 'TODO districtStats'
def decrementPopulation(self):
print 'TODO districtStats'
def sendQueryToonMaxHp(self, avId, callback):
pass # TODO?

View file

@ -3,3 +3,9 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class CatalogManagerAI(DistributedObjectAI): class CatalogManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogManagerAI') notify = DirectNotifyGlobal.directNotify.newCategory('CatalogManagerAI')
def startCatalog(self):
pass
def deliverCatalogFor(self, _):
pass

View file

@ -3,7 +3,6 @@ import datetime
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
from direct.showbase import AppRunnerGlobal
from otp.chat.WhiteList import WhiteList from otp.chat.WhiteList import WhiteList
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
@ -23,14 +22,8 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
vfs = VirtualFileSystem.getGlobalPtr() vfs = VirtualFileSystem.getGlobalPtr()
filename = Filename('twhitelist.dat') filename = Filename('twhitelist.dat')
searchPath = DSearchPath() searchPath = DSearchPath()
if AppRunnerGlobal.appRunner: if __debug__:
searchPath.appendDirectory(Filename.expandFrom('$TT_3_ROOT/phase_3/etc')) searchPath.appendDirectory(Filename('resources/phase_3/etc'))
else:
searchPath.appendDirectory(Filename('.'))
searchPath.appendDirectory(Filename('etc'))
searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('$TOONTOWN/src/chat')))
searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('toontown/src/chat')))
searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('toontown/chat')))
found = vfs.resolveFilename(filename, searchPath) found = vfs.resolveFilename(filename, searchPath)
if not found: if not found:
self.notify.info("Couldn't find whitelist data file!") self.notify.info("Couldn't find whitelist data file!")

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libtoontown import *
from toontown.toonbase.ToonBaseGlobal import * from toontown.toonbase.ToonBaseGlobal import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData from direct.fsm import StateData

View file

@ -322,6 +322,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.avCreate = MakeAToon.MakeAToon(self.loginFSM, avList, 'makeAToonComplete', index, self.isPaid()) self.avCreate = MakeAToon.MakeAToon(self.loginFSM, avList, 'makeAToonComplete', index, self.isPaid())
self.avCreate.load() self.avCreate.load()
self.avCreate.enter() self.avCreate.enter()
if not self.astronSupport:
self.handler = self.handleCreateAvatar self.handler = self.handleCreateAvatar
self.accept('makeAToonComplete', self.__handleMakeAToon, [avList, index]) self.accept('makeAToonComplete', self.__handleMakeAToon, [avList, index])
self.accept('nameShopCreateAvatar', self.sendCreateAvatarMsg) self.accept('nameShopCreateAvatar', self.sendCreateAvatarMsg)
@ -332,9 +333,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.send(dg) self.send(dg)
def handleCreateAvatar(self, msgType, di): def handleCreateAvatar(self, msgType, di):
if self.astronSupport:
self.handleMessageType(msgType, di)
else:
if msgType == CLIENT_CREATE_AVATAR_RESP or msgType == CLIENT_SET_NAME_PATTERN_ANSWER or msgType == CLIENT_SET_WISHNAME_RESP: if msgType == CLIENT_CREATE_AVATAR_RESP or msgType == CLIENT_SET_NAME_PATTERN_ANSWER or msgType == CLIENT_SET_WISHNAME_RESP:
self.avCreate.ns.nameShopHandler(msgType, di) self.avCreate.ns.nameShopHandler(msgType, di)
else: else:
@ -372,6 +370,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
del self.newPotAv del self.newPotAv
return return
if not config.GetBool('astron-support', True):
def handleAvatarResponseMsg(self, di): def handleAvatarResponseMsg(self, di):
self.cleanupWaitingForDatabase() self.cleanupWaitingForDatabase()
avatarId = di.getUint32() avatarId = di.getUint32()
@ -400,6 +399,31 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
else: else:
self.notify.error('Bad avatar: return code %d' % returnCode) self.notify.error('Bad avatar: return code %d' % returnCode)
return return
else:
def handleAvatarResponseMsg(self, avatarId, di):
self.cleanupWaitingForDatabase()
dclass = self.dclassesByName['DistributedToon']
NametagGlobals.setMasterArrowsOn(0)
loader.beginBulkLoad('localAvatarPlayGame', OTPLocalizer.CREnteringToontown, 400, 1, TTLocalizer.TIP_GENERAL)
localAvatar = LocalToon.LocalToon(self)
localAvatar.dclass = dclass
base.localAvatar = localAvatar
__builtins__['localAvatar'] = base.localAvatar
NametagGlobals.setToon(base.localAvatar)
localAvatar.doId = avatarId
self.localAvatarDoId = avatarId
parentId = None
zoneId = None
localAvatar.setLocation(parentId, zoneId)
localAvatar.generateInit()
localAvatar.generate()
dclass.receiveUpdateBroadcastRequiredOwner(localAvatar, di)
localAvatar.announceGenerate()
localAvatar.postGenerateMessage()
self.doId2do[avatarId] = localAvatar
localAvatar.initInterface()
self.sendGetFriendsListRequest()
self.loginFSM.request('playingGame')
def getAvatarDetails(self, avatar, func, *args): def getAvatarDetails(self, avatar, func, *args):
pad = ScratchPad() pad = ScratchPad()
@ -826,6 +850,9 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.friendsListError = 0 self.friendsListError = 0
def sendGetFriendsListRequest(self): def sendGetFriendsListRequest(self):
if self.astronSupport:
print 'sendGetFriendsListRequest TODO'
else:
self.friendsMapPending = 1 self.friendsMapPending = 1
self.friendsListError = 0 self.friendsListError = 0
datagram = PyDatagram() datagram = PyDatagram()
@ -1050,8 +1077,12 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
return True return True
def sendQuietZoneRequest(self): def sendQuietZoneRequest(self):
if self.astronSupport:
self.sendSetZoneMsg(OTPGlobals.QuietZone, [])
else:
self.sendSetZoneMsg(OTPGlobals.QuietZone) self.sendSetZoneMsg(OTPGlobals.QuietZone)
if not config.GetBool('astron-support', True):
def handleQuietZoneGenerateWithRequired(self, di): def handleQuietZoneGenerateWithRequired(self, di):
parentId = di.getUint32() parentId = di.getUint32()
zoneId = di.getUint32() zoneId = di.getUint32()
@ -1073,6 +1104,36 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
dclass.startGenerate() dclass.startGenerate()
distObj = self.generateWithRequiredOtherFields(dclass, doId, di, parentId, zoneId) distObj = self.generateWithRequiredOtherFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate() dclass.stopGenerate()
else:
def handleQuietZoneGenerateWithRequired(self, di):
doId = di.getUint32()
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
dclass = self.dclassesByNumber[classId]
if dclass.getClassDef().neverDisable:
dclass.startGenerate()
distObj = self.generateWithRequiredFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate()
def handleQuietZoneGenerateWithRequiredOther(self, di):
doId = di.getUint32()
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
dclass = self.dclassesByNumber[classId]
if dclass.getClassDef().neverDisable:
dclass.startGenerate()
distObj = self.generateWithRequiredOtherFields(dclass, doId, di, parentId, zoneId)
dclass.stopGenerate()
def handleGenerateWithRequiredOtherOwner(self, di):
if self.loginFSM.getCurrentState().getName() == 'waitForSetAvatarResponse':
doId = di.getUint32()
parentId = di.getUint32()
zoneId = di.getUint32()
classId = di.getUint16()
self.handleAvatarResponseMsg(doId, di)
def handleQuietZoneUpdateField(self, di): def handleQuietZoneUpdateField(self, di):
di2 = DatagramIterator(di) di2 = DatagramIterator(di)

View file

@ -8,3 +8,9 @@ class ToontownInternalRepository(OTPInternalRepository):
def __init__(self, baseChannel, serverId=None, dcFileNames=None, dcSuffix='AI', connectMethod=None, threadedNet=None): def __init__(self, baseChannel, serverId=None, dcFileNames=None, dcSuffix='AI', connectMethod=None, threadedNet=None):
OTPInternalRepository.__init__(self, baseChannel, serverId, dcFileNames, dcSuffix, connectMethod, threadedNet) OTPInternalRepository.__init__(self, baseChannel, serverId, dcFileNames, dcSuffix, connectMethod, threadedNet)
def _isValidPlayerLocation(self, parentId, zoneId):
if zoneId < 1000 and zoneId != -1:
return False
return True

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import *
import FriendsListPanel import FriendsListPanel
import FriendInviter import FriendInviter
import FriendInvitee import FriendInvitee

View file

@ -12,6 +12,7 @@ import QuietZoneState
import ZoneUtil import ZoneUtil
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toon.Toon import teleportDebug from toontown.toon.Toon import teleportDebug
from direct.interval.IntervalGlobal import *
class Hood(StateData.StateData): class Hood(StateData.StateData):
notify = DirectNotifyGlobal.directNotify.newCategory('Hood') notify = DirectNotifyGlobal.directNotify.newCategory('Hood')
@ -25,6 +26,7 @@ class Hood(StateData.StateData):
self.id = None self.id = None
self.hoodId = hoodId self.hoodId = hoodId
self.titleText = None self.titleText = None
self.titleTextSeq = None
self.titleColor = (1, 1, 1, 1) self.titleColor = (1, 1, 1, 1)
self.holidayStorageDNADict = {} self.holidayStorageDNADict = {}
self.spookySkyFile = None self.spookySkyFile = None
@ -56,19 +58,17 @@ class Hood(StateData.StateData):
self.titleText.setColor(Vec4(*self.titleColor)) self.titleText.setColor(Vec4(*self.titleColor))
self.titleText.clearColorScale() self.titleText.clearColorScale()
self.titleText.setFg(self.titleColor) self.titleText.setFg(self.titleColor)
seq = Task.sequence(Task.pause(0.1), Task.pause(6.0), self.titleText.lerpColorScale(Vec4(1.0, 1.0, 1.0, 1.0), Vec4(1.0, 1.0, 1.0, 0.0), 0.5), Task(self.hideTitleTextTask)) self.titleTextSeq = Sequence(Wait(0.1), Wait(6.0), self.titleText.colorScaleInterval(0.5, Vec4(1.0, 1.0, 1.0, 0.0), Vec4(1.0, 1.0, 1.0, 1.0)), Func(self.hideTitleText))
taskMgr.add(seq, 'titleText') self.titleTextSeq.start()
def hideTitleTextTask(self, task):
self.titleText.hide()
return Task.done
def hideTitleText(self): def hideTitleText(self):
if self.titleText: if self.titleText:
self.titleText.hide() self.titleText.hide()
def exit(self): def exit(self):
taskMgr.remove('titleText') if self.titleTextSeq:
self.titleTextSeq.finish()
self.titleTextSeq = None
if self.titleText: if self.titleText:
self.titleText.cleanup() self.titleText.cleanup()
self.titleText = None self.titleText = None
@ -194,7 +194,9 @@ class Hood(StateData.StateData):
self.spawnTitleText(requestStatus['zoneId']) self.spawnTitleText(requestStatus['zoneId'])
def exitSafeZoneLoader(self): def exitSafeZoneLoader(self):
taskMgr.remove('titleText') if self.titleTextSeq:
self.titleTextSeq.finish()
self.titleTextSeq = None
self.hideTitleText() self.hideTitleText()
self.ignore(self.loaderDoneEvent) self.ignore(self.loaderDoneEvent)
self.loader.exit() self.loader.exit()

View file

@ -111,7 +111,7 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager):
def removeSetZoneCompleteCallback(self, token): def removeSetZoneCompleteCallback(self, token):
if token is not None: if token is not None:
if token in self._setZoneCompleteLocalCallbacks: if any(token == x[1] for x in self._setZoneCompleteLocalCallbacks._callbacks):
self._setZoneCompleteLocalCallbacks.remove(token) self._setZoneCompleteLocalCallbacks.remove(token)
qzsd = self._getQZState() qzsd = self._getQZState()
if qzsd: if qzsd:

View file

@ -138,6 +138,7 @@ class QuietZoneState(StateData.StateData):
self._setZoneCompleteCallbacks.remove(token) self._setZoneCompleteCallbacks.remove(token)
return return
if not config.GetBool('astron-support', True):
def handleWaitForQuietZoneResponse(self, msgType, di): def handleWaitForQuietZoneResponse(self, msgType, di):
self.notify.debug('handleWaitForQuietZoneResponse(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')') self.notify.debug('handleWaitForQuietZoneResponse(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
if msgType == CLIENT_CREATE_OBJECT_REQUIRED: if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
@ -150,6 +151,19 @@ class QuietZoneState(StateData.StateData):
self.notify.debug('ignoring unwanted message from previous zone') self.notify.debug('ignoring unwanted message from previous zone')
else: else:
base.cr.handlePlayGame(msgType, di) base.cr.handlePlayGame(msgType, di)
else:
def handleWaitForQuietZoneResponse(self, msgType, di):
self.notify.debug('handleWaitForQuietZoneResponse(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
if msgType == CLIENT_ENTER_OBJECT_REQUIRED:
base.cr.handleQuietZoneGenerateWithRequired(di)
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
base.cr.handleQuietZoneGenerateWithRequiredOther(di)
elif msgType == CLIENT_OBJECT_SET_FIELD:
base.cr.handleQuietZoneUpdateField(di)
elif msgType in QUIET_ZONE_IGNORED_LIST:
self.notify.debug('ignoring unwanted message from previous zone')
else:
base.cr.handlePlayGame(msgType, di)
def handleWaitForZoneRedirect(self, msgType, di): def handleWaitForZoneRedirect(self, msgType, di):
self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')') self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')

View file

@ -219,7 +219,7 @@ class AvatarChoice(DirectButton):
nameBalloon = loader.loadModel('phase_3/models/props/chatbox_input') nameBalloon = loader.loadModel('phase_3/models/props/chatbox_input')
okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')) okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
cancelButtonImage = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')) cancelButtonImage = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr'))
self.deleteWithPasswordFrame = DirectFrame(pos=(0.0, 0.1, 0.2), parent=aspect2dp, relief=None, image=DGG.getDefaultDialogGeom(), image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.4, 1.0, 1.0), text=deleteText, text_wordwrap=19, text_scale=TTLocalizer.ACdeleteWithPasswordFrame, text_pos=(0, 0.25), textMayChange=1, sortOrder=NO_FADE_SORT_INDEX) self.deleteWithPasswordFrame = DirectFrame(pos=(0.0, 0.1, 0.2), parent=aspect2dp, relief=None, image=DGG.getDefaultDialogGeom(), image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.4, 1.0, 1.0), text=deleteText, text_wordwrap=19, text_scale=TTLocalizer.ACdeleteWithPasswordFrame, text_pos=(0, 0.25), textMayChange=1, sortOrder=DGG.NO_FADE_SORT_INDEX)
self.deleteWithPasswordFrame.hide() self.deleteWithPasswordFrame.hide()
if self.deleteWithPassword: if self.deleteWithPassword:
self.passwordLabel = DirectLabel(parent=self.deleteWithPasswordFrame, relief=None, pos=(-0.07, 0.0, -0.2), text=TTLocalizer.AvatarChoicePassword, text_scale=0.08, text_align=TextNode.ARight, textMayChange=0) self.passwordLabel = DirectLabel(parent=self.deleteWithPasswordFrame, relief=None, pos=(-0.07, 0.0, -0.2), text=TTLocalizer.AvatarChoicePassword, text_scale=0.08, text_align=TextNode.ARight, textMayChange=0)

View file

@ -202,7 +202,7 @@ class CalendarGuiDay(DirectFrame):
except e: except e:
numItems = 0 numItems = 0
if numItems <= self.scrollList.numItemsVisible: if numItems <= self.scrollList['numItemsVisible']:
self.scrollList.incButton.hide() self.scrollList.incButton.hide()
self.scrollList.decButton.hide() self.scrollList.decButton.hide()
else: else:

View file

@ -128,14 +128,12 @@ class OptionsTabPage(DirectFrame):
'DirectX8': Settings.DX8} 'DirectX8': Settings.DX8}
def __init__(self, parent = aspect2d): def __init__(self, parent = aspect2d):
self.parent = parent
self.currentSizeIndex = None self.currentSizeIndex = None
DirectFrame.__init__(self, parent=self.parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0)) DirectFrame.__init__(self, parent=parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0))
self.load() self.load()
return return
def destroy(self): def destroy(self):
self.parent = None
DirectFrame.destroy(self) DirectFrame.destroy(self)
return return
@ -473,13 +471,11 @@ class CodesTabPage(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('CodesTabPage') notify = DirectNotifyGlobal.directNotify.newCategory('CodesTabPage')
def __init__(self, parent = aspect2d): def __init__(self, parent = aspect2d):
self.parent = parent DirectFrame.__init__(self, parent=parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0))
DirectFrame.__init__(self, parent=self.parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0))
self.load() self.load()
return return
def destroy(self): def destroy(self):
self.parent = None
DirectFrame.destroy(self) DirectFrame.destroy(self)
return return

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.showbase import DirectObject from direct.showbase import DirectObject
from direct.fsm import StateData from direct.fsm import StateData

View file

@ -410,7 +410,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def announceZoneChange(self, newZoneId, oldZoneId): def announceZoneChange(self, newZoneId, oldZoneId):
from toontown.pets import PetObserve from toontown.pets import PetObserve
self.air.welcomeValleyManager.toonSetZone(self.doId, newZoneId) #self.air.welcomeValleyManager.toonSetZone(self.doId, newZoneId) # TODO
broadcastZones = [oldZoneId, newZoneId] broadcastZones = [oldZoneId, newZoneId]
if self.isInEstate() or self.wasInEstate(): if self.isInEstate() or self.wasInEstate():
broadcastZones = union(broadcastZones, self.estateZones) broadcastZones = union(broadcastZones, self.estateZones)

View file

@ -12,6 +12,7 @@ from direct.showbase import PythonUtil
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.gui import DirectGuiGlobals from direct.gui import DirectGuiGlobals
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import *
from otp.avatar import LocalAvatar from otp.avatar import LocalAvatar
from otp.login import LeaveToPayDialog from otp.login import LeaveToPayDialog
from otp.avatar import PositionExaminer from otp.avatar import PositionExaminer

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libtoontown import *
from direct.directnotify.DirectNotifyGlobal import * from direct.directnotify.DirectNotifyGlobal import *
from direct.showbase import Loader from direct.showbase import Loader
from toontown.toontowngui import ToontownLoadingScreen from toontown.toontowngui import ToontownLoadingScreen

View file

@ -3,3 +3,20 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedInGameNewsMgrAI(DistributedObjectAI): class DistributedInGameNewsMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedInGameNewsMgrAI') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedInGameNewsMgrAI')
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.latestIssueStr = ''
def setLatestIssueStr(self, latestIssueStr):
self.latestIssueStr = latestIssueStr
def d_setLatestIssueStr(self, latestIssueStr):
self.sendUpdate('setLatestIssueStr', [latestIssueStr])
def b_setLatestIssueStr(self, latestIssueStr):
self.setLatestIssueStr(latestIssueStr)
self.d_setLatestIssueStr(latestIssueStr)
def getLatestIssueStr(self):
return self.latestIssueStr