Merge branch 'features/ttn' into 'master'

Features/ttn

It's ready <3

See merge request !1
This commit is contained in:
Ryan Lewis 2015-08-06 15:24:32 -04:00
commit 21c051ce42
279 changed files with 8397 additions and 5637 deletions

5
.gitignore vendored
View file

@ -19,3 +19,8 @@
# Local config
dependencies/config/local.prc
# PyMongo
bson
gridfs
pymongo

BIN
dependencies/astron/astrond vendored Normal file → Executable file

Binary file not shown.

0
dependencies/astron/astrond.exe vendored Normal file → Executable file
View file

View file

@ -27,11 +27,11 @@ dclass Account {
uint32 ACCOUNT_AV_SET[] required db;
uint32 ESTATE_ID db;
AvatarPendingDel ACCOUNT_AV_SET_DEL[] db;
uint64 CREATED db;
string CREATED db;
string LAST_LOGIN db;
string ACCOUNT_ID db;
uint16 ACCESS_LEVEL db;
uint64 LAST_LOGIN_TS db;
uint32 LAST_LOGIN_TS db;
};
struct BarrierData {
@ -175,12 +175,14 @@ dclass FriendManager : DistributedObject {
friendResponse(int8, int32);
inviteeFriendQuery(int32, string, blob, int32);
inviteeCancelFriendQuery(int32);
requestTFCode() airecv clsend;
redeemTFCode(string) airecv clsend;
tfResponse(uint8, string);
};
from toontown.building import DistributedAnimatedProp/AI
from toontown.toon import DistributedToon/AI/UD
from toontown.safezone import DistributedTrolley/AI
from toontown.safezone import DistributedPillow/AI
from toontown.safezone import DistributedPartyGate/AI
from toontown.suit import DistributedSuitPlanner/AI
from toontown.suit import DistributedSuitBase/AI
@ -228,7 +230,6 @@ from toontown.estate import DistributedHouse/AI
from toontown.estate import DistributedHouseInterior/AI
from toontown.estate import DistributedGarden/AI
from toontown.shtiker import DeleteManager/AI
from toontown.groups import GroupManager/AI/UD
from toontown.ai import NewsManager/AI
from toontown.shtiker import PurchaseManager/AI
from toontown.shtiker import NewbiePurchaseManager/AI
@ -250,11 +251,10 @@ from toontown.building import DistributedKartShopInterior/AI
from toontown.building import DistributedDoor/AI
from toontown.estate import DistributedHouseDoor/AI
from toontown.coghq import DistributedCogHQDoor/AI
from toontown.coghq import DistributedCogHQExteriorDoor/AI
//from toontown.coghq import DistributedCogHQExteriorDoor/AI
from toontown.coghq import DistributedSellbotHQDoor/AI
from toontown.toon import DistributedNPCToonBase/AI
from toontown.toon import DistributedNPCToon/AI
from toontown.toon import DistributedSmartNPC/AI
from toontown.toon import DistributedNPCSpecialQuestGiver/AI
from toontown.toon import DistributedNPCFlippyInToonHall/AI
from toontown.toon import DistributedNPCScientist/AI
@ -291,6 +291,9 @@ from toontown.estate import DistributedBank/AI
from toontown.estate import DistributedCloset/AI
from toontown.estate import DistributedTrunk/AI
from toontown.estate import DistributedPhone/AI
from toontown.estate import DistributedRewardCrate/AI
from toontown.estate import DistributedChair/AI
from toontown.estate import DistributedTV/AI
from toontown.effects import DistributedFireworkShow/AI
from toontown.estate import DistributedFireworksCannon/AI
from toontown.coghq import LobbyManager/AI
@ -425,7 +428,7 @@ from toontown.safezone import DistributedChineseCheckers/AI
from toontown.safezone import DistributedCheckers/AI
from toontown.safezone import DistributedFindFour/AI
from toontown.uberdog.DistributedPartyManager/AI/UD import DistributedPartyManager/AI/UD
from toontown.uberdog.DistributedLobbyManager/AI/UD import DistributedLobbyManager/AI/UD
//from toontown.uberdog.DistributedLobbyManager/AI/UD import DistributedLobbyManager/AI/UD
from toontown.coderedemption.TTCodeRedemptionMgr/AI import TTCodeRedemptionMgr/AI
from toontown.cogdominium import DistributedCogdoInterior/AI
from toontown.cogdominium import DistributedCogdoBattleBldg/AI
@ -442,14 +445,9 @@ from toontown.cogdominium import DistCogdoCrane/AI
from toontown.cogdominium import DistCogdoCraneMoneyBag/AI
from toontown.cogdominium import DistCogdoCraneCog/AI
from toontown.parties.GlobalPartyManager/AI/UD import GlobalPartyManager/AI/UD
from toontown.uberdog.GlobalLobbyManager/AI/UD import GlobalLobbyManager/AI/UD
//from toontown.uberdog.GlobalLobbyManager/AI/UD import GlobalLobbyManager/AI/UD
from toontown.uberdog.ARGManager import ARGManager
struct GiftItem {
blob Item;
string giftTag;
};
struct gardenSpecial {
uint8 index;
uint8 count;
@ -484,10 +482,10 @@ struct activity {
uint8 h;
};
struct lobby {
uint64 lobbyId;
uint32 hostId;
};
//struct lobby {
// uint64 lobbyId;
// uint32 hostId;
//};
struct party {
uint64 partyId;
@ -557,6 +555,7 @@ dclass ToontownDistrictStats : DistributedObject {
setDistrictId(uint32) broadcast required ram;
setAvatarCount(uint32) broadcast required ram;
setInvasionStatus(uint8) broadcast required ram;
setGroupAvCount(uint32[]) broadcast required ram;
};
dclass DistributedAnimatedProp : DistributedObject {
@ -599,7 +598,6 @@ dclass DistributedToon : DistributedPlayer {
setMaxClothes(uint32 = 10) required ownrecv db;
setClothesTopsList(uint8[] = []) required ownrecv db;
setClothesBottomsList(uint8[] = []) required ownrecv db;
setMaxAccessories(uint32 = 0) required ownrecv db;
setHatList(uint8[] = []) required ownrecv db;
setGlassesList(uint8[] = []) required ownrecv db;
setBackpackList(uint8[] = []) required ownrecv db;
@ -668,6 +666,7 @@ dclass DistributedToon : DistributedPlayer {
setMaxFishTank(uint8 = 20) required ownrecv db;
setFishTank(uint8[] = [], uint8[] = [], uint16[] = []) required ownrecv db;
setFishingRod(uint8 = 0) required broadcast ownrecv db;
setMaxFishingRod(uint8 = 0) required broadcast ownrecv db;
setFishingTrophies(uint8[] = []) required ownrecv db;
setFlowerCollection(uint8[] = [], uint8[] = []) required ownrecv db;
setFlowerBasket(uint8[] = [], uint8[] = []) required ownrecv db;
@ -726,8 +725,9 @@ dclass DistributedToon : DistributedPlayer {
setUnlimitedSwing(uint8) broadcast ownrecv ram;
logSuspiciousEvent(char [0-1024]) ownsend airecv;
forceLogoutWithNotify() ownrecv;
setPinkSlips(uint8 = 0) required ownrecv db;
setSpecialInventory(uint8[] = [0, 0]) required ownrecv db;
setNametagStyle(uint8 = 0) required broadcast ownrecv db;
setNametagStyles(uint8[] = [0]) required broadcast ownrecv db;
setMail(simpleMail []) ownrecv;
setNumMailItems(uint32) airecv;
setSimpleMailNotify(uint8) ownrecv airecv;
@ -745,8 +745,14 @@ dclass DistributedToon : DistributedPlayer {
setBuffs(uint32[] = []) required ownrecv db;
setRedeemedCodes(string [] = []) required ownrecv db;
setEmblems(uint32[] = [0, 0]) required ownrecv db;
setTrueFriends(uint32[] = []) required clsend ownrecv db;
setTrueFriends(uint32[] = []) required ownrecv db;
setNextKnockHeal(uint32) ram airecv;
setTFRequest(uint32[] = [0, 0]) ram airecv;
setEPP(uint8[] = []) required ownrecv db;
setStats(uint32[] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) required ownrecv db;
requestNametagStyle(uint8) airecv ownsend;
requestFishingRod(uint8) airecv ownsend;
wipeStats() airecv ownsend;
};
dclass DistributedPartyGate : DistributedObject {
@ -773,9 +779,6 @@ dclass DistributedTrolley : DistributedObject {
setMinigameZone(uint32, uint16);
};
dclass DistributedPillow : DistributedObject {
};
dclass DistributedSuitPlanner : DistributedObject {
setZoneId(uint32) required broadcast ram;
suitListQuery() airecv clsend;
@ -830,6 +833,7 @@ dclass DistributedBossCog : DistributedNode {
setToonIds(uint32[], uint32[], uint32[]) broadcast ram;
setBattleIds(uint8, uint32, uint32) broadcast ram;
setArenaSide(uint8) broadcast ram;
setKeyReward(bool) required broadcast ram;
avatarEnter() airecv clsend;
avatarExit() airecv clsend;
avatarNearEnter() airecv clsend;
@ -979,6 +983,7 @@ dclass DistributedBattleTutorial : DistributedBattle {
};
dclass DistributedLevelBattle : DistributedBattle {
announceCrateReward() broadcast;
};
dclass DistributedBattleFactory : DistributedLevelBattle {
@ -1216,45 +1221,41 @@ struct decorItem {
};
struct lawnItem {
int8 plot;
uint8 type;
uint8 species;
uint8 variety;
uint8 hardPoint;
int8 waterLevel;
int8 growthLevel;
uint16 optional;
uint64 plantedAt;
uint64 wateredAt;
};
dclass DistributedEstate : DistributedObject {
setEstateReady() broadcast;
setClientReady() airecv clsend;
setEstateType(uint8 type = 0) required broadcast db;
setClosestHouse(uint8) airecv clsend;
setTreasureIds(uint32[]) broadcast ram;
requestServerTime() airecv clsend;
setServerTime(uint32);
setDawnTime(uint32) required broadcast ram;
placeOnGround(uint32) broadcast ram;
setDecorData(lawnItem items[] = []) required airecv db;
setLastEpochTimeStamp(uint32 timestamp = 0) required airecv db;
setRentalTimeStamp(uint32 timestamp = 0) required airecv db;
setRentalType(uint8 type = 0) required airecv db;
setSlot0ToonId(uint32 toonId = 0) required airecv db;
setSlot0Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot0Garden(blob g) required airecv db;
setSlot1ToonId(uint32 toonId = 0) required airecv db;
setSlot1Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot1Garden(blob g) required airecv db;
setSlot2ToonId(uint32 toonId = 0) required airecv db;
setSlot2Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot2Garden(blob g) required airecv db;
setSlot3ToonId(uint32 toonId = 0) required airecv db;
setSlot3Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot3Garden(blob g) required airecv db;
setSlot4ToonId(uint32 toonId = 0) required airecv db;
setSlot4Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot4Garden(blob g) required airecv db;
setSlot5ToonId(uint32 toonId = 0) required airecv db;
setSlot5Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot5Garden(blob g) required airecv db;
setIdList(uint32 []) broadcast ram;
completeFlowerSale(uint8) airecv clsend;
completeFishSale(uint8) airecv clsend;
completeFishSale() airecv clsend;
thankSeller(int8, int8, int8);
awardedTrophy(uint32) broadcast;
setClouds(uint8) required broadcast ram;
@ -1269,6 +1270,7 @@ dclass DistributedHouse : DistributedObject {
setAvatarId(uint32 toonId = 0) required broadcast db;
setName(string toonName = "") required broadcast db;
setColor(uint8 colorIndex = 0) required broadcast db;
setGender(uint8 = 0) required broadcast db;
setAtticItems(blob = "") required db;
setInteriorItems(blob = "") required db;
setAtticWallpaper(blob = "") required db;
@ -1289,8 +1291,7 @@ dclass DistributedHouseInterior : DistributedObject {
};
dclass DistributedGarden : DistributedObject {
sendNewProp(uint8, int16/10, int16/10, int16/10) broadcast;
setProps(uint8[]) airecv clsend;
sendNewProp(uint8 prop, int16/10 x, int16/10 y, int16/10 z) broadcast;
};
dclass DistributedParty : DistributedObject {
@ -1470,23 +1471,6 @@ dclass DeleteManager : DistributedObject {
setInventory(blob) airecv clsend;
};
dclass GroupManager : DistributedObject {
setChildId() clsend airecv;
isPlayerGrouped(uint32);
isInGroup(uint32, uint32);
updateInfo() clsend airecv;
requestInfo() broadcast ram;
getTypeFromId(uint32);
setGroups(string) broadcast ram;
getGroups();
setGroupPlayers(string) broadcast ram;
getGroupPlayers(uint32);
createGroup(uint32, string) clsend airecv;
closeGroup(uint32) clsend airecv;
addPlayerToGroup(uint32, uint32) clsend airecv;
removePlayerFromGroup(uint32, uint32) clsend airecv;
};
dclass NewsManager : DistributedObject {
startHoliday(uint8) broadcast;
endHoliday(uint8) broadcast;
@ -1730,10 +1714,10 @@ dclass DistributedHouseDoor : DistributedDoor {
dclass DistributedCogHQDoor : DistributedDoor {
};
dclass DistributedCogHQExteriorDoor : DistributedCogHQDoor {
selectLobby(uint32) broadcast;
confirmEntrance(uint32, bool) airecv clsend;
};
//dclass DistributedCogHQExteriorDoor : DistributedCogHQDoor {
// selectLobby(uint32) broadcast;
// confirmEntrance(uint32, bool) airecv clsend;
//};
dclass DistributedSellbotHQDoor : DistributedCogHQDoor {
informPlayer(uint8) broadcast ram;
@ -1760,13 +1744,6 @@ dclass DistributedNPCToon : DistributedNPCToonBase {
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 {
setMovie(uint8, uint32, uint32, uint16[], int16) broadcast ram;
setMovieDone() airecv clsend;
@ -1781,8 +1758,8 @@ dclass DistributedNPCScientist : DistributedNPCToonBase {
};
dclass DistributedNPCClerk : DistributedNPCToonBase {
setMovie(uint8, uint32, uint32, int16) broadcast ram;
setInventory(blob, int16, uint8) airecv clsend;
setState(uint32, uint8) broadcast airecv clsend;
setInventory(blob, int16) airecv clsend;
};
dclass DistributedNPCTailor : DistributedNPCToonBase {
@ -1822,9 +1799,8 @@ dclass DistributedNPCKartClerk : DistributedNPCToonBase {
};
dclass DistributedNPCLaffRestock : DistributedNPCToonBase {
setMovie(uint8, uint32, uint32, uint32[], int16) broadcast ram;
restock(uint32, uint16, uint16) airecv clsend;
transactionDone() airecv clsend;
restock(uint8) airecv clsend;
restockResult(uint8) broadcast;
};
dclass DistributedNPCGlove : DistributedNPCToonBase {
@ -1860,7 +1836,6 @@ dclass DistributedElevator : DistributedObject {
requestExit() airecv clsend;
setElevatorTripId(uint32) required broadcast ram;
setAntiShuffle(uint8) required broadcast ram;
setMinLaff(uint8) required broadcast ram;
};
dclass DistributedElevatorFSM : DistributedObject {
@ -1887,7 +1862,6 @@ dclass DistributedElevatorFSM : DistributedObject {
requestExit() airecv clsend;
setElevatorTripId(uint32) required broadcast ram;
setAntiShuffle(uint8) required broadcast ram;
setMinLaff(uint8) required broadcast ram;
};
dclass DistributedElevatorFloor : DistributedElevatorFSM {
@ -1963,7 +1937,7 @@ dclass DistributedBoardingParty : DistributedObject {
postSizeReject(uint32, uint32, uint32) broadcast;
postInviteAccepted(uint32) broadcast;
postInviteDelcined(uint32) broadcast;
postInviteNotQualify(uint32, int8, uint32) broadcast;
postInviteNotQualify(uint32, int8) broadcast;
postAlreadyInGroup() broadcast;
postGroupDissolve(uint32, uint32, uint32 [], uint8) broadcast;
postMessageAcceptanceFailed(uint32, int8) broadcast;
@ -2093,6 +2067,25 @@ dclass DistributedPhone : DistributedFurnitureItem {
requestGiftPurchaseMessage(uint16, uint32, blob, int32) airecv clsend;
requestGiftPurchaseResponse(uint16, int8);
purchaseItemComplete();
requestGiftAvatar(uint32) airecv clsend;
setGiftAvatar(blob);
};
dclass DistributedRewardCrate : DistributedFurnitureItem {
requestKeyUsage() airecv clsend;
useKeyResponse(uint8, uint32);
};
dclass DistributedChair : DistributedFurnitureItem {
setAvId(uint32) broadcast ram;
requestSit(uint8) airecv clsend;
setStatus(uint8) broadcast ram;
};
dclass DistributedTV : DistributedFurnitureItem {
setVideo(string(0-255), uint32) required broadcast ram;
requestVideo(string(0-255)) airecv clsend;
requestVideoResponse(uint8);
};
dclass DistributedFireworkShow : DistributedObject {
@ -2560,27 +2553,24 @@ dclass DistributedLawbotChair : DistributedObject {
};
dclass DistributedLawnDecor : DistributedNode {
setEstate(uint32) required broadcast ram;
setPlot(int8) required broadcast ram;
setHeading(int16/10) required broadcast ram;
setPosition(int16/10, int16/10, int16/10) required broadcast ram;
setOwnerIndex(int8) required broadcast ram;
setPosition(int16/10, int16/10, int16/10) required broadcast ram;
plotEntered() airecv clsend;
removeItem(uint32) airecv clsend;
removeItem() airecv clsend;
setMovie(uint8, uint32) broadcast ram;
movieDone() airecv clsend;
interactionDenied(uint32) broadcast ram;
setBoxDoId(uint32, uint8) broadcast ram;
};
dclass DistributedGardenPlot : DistributedLawnDecor {
plantedItem(uint32) broadcast ram;
finishPlanting(uint32) airecv clsend;
finishRemoving(uint32) airecv clsend;
plantFlower(uint8, uint8, uint32) airecv clsend;
plantGagTree(uint8, uint8, uint32) airecv clsend;
plantStatuary(uint8, uint32) airecv clsend;
plantToonStatuary(uint8, uint16, uint32) airecv clsend;
plantNothing(uint8, uint32) airecv clsend;
plantFlower(uint8, uint8) airecv clsend;
plantGagTree(uint8, uint8) airecv clsend;
plantStatuary(uint8) airecv clsend;
plantToonStatuary(uint8, uint16) airecv clsend;
plantNothing(uint8) airecv clsend;
};
dclass DistributedGardenBox : DistributedLawnDecor {
@ -2588,7 +2578,6 @@ dclass DistributedGardenBox : DistributedLawnDecor {
};
dclass DistributedStatuary : DistributedLawnDecor {
setOwnerPlot(uint32) required broadcast ram;
setTypeIndex(uint8) required broadcast ram;
setWaterLevel(int8) required broadcast ram;
setGrowthLevel(int8) required broadcast ram;
@ -2606,11 +2595,10 @@ dclass DistributedChangingStatuary : DistributedStatuary {
};
dclass DistributedPlantBase : DistributedLawnDecor {
setOwnerPlot(uint32) required broadcast ram;
setTypeIndex(uint8) required broadcast ram;
setWaterLevel(int8) required broadcast ram;
setGrowthLevel(int8) required broadcast ram;
waterPlant(uint32) airecv clsend;
waterPlant() airecv clsend;
waterPlantDone() airecv clsend;
};
@ -2621,7 +2609,8 @@ dclass DistributedFlower : DistributedPlantBase {
dclass DistributedGagTree : DistributedPlantBase {
setWilted(int8) required broadcast ram;
requestHarvest(uint32) airecv clsend;
setFruiting(bool) required broadcast ram;
requestHarvest() airecv clsend;
};
struct golfData {
@ -3044,34 +3033,34 @@ dclass DistributedFindFour : DistributedNode {
tie() broadcast;
};
dclass DistributedLobbyManager : DistributedObject {
addLobby(uint32, uint32, string, string, int8, int8, activity [], decoration [], uint32[], uint16);
addLobbyRequest(uint32) airecv clsend;
addLobbyResponse(uint32, int8);
addLobbyResponseUdToAi(uint64, int8, lobby) airecv;
//dclass DistributedLobbyManager : DistributedObject {
// addLobby(uint32, uint32, string, string, int8, int8, activity [], decoration [], uint32[], uint16);
// addLobbyRequest(uint32) airecv clsend;
// addLobbyResponse(uint32, int8);
// addLobbyResponseUdToAi(uint64, int8, lobby) airecv;
getLobbyZone(uint32, uint32, uint8) clsend airecv;
receiveLobbyZone(uint32, uint64, uint32);
freeZoneIdFromCreatedLobby(uint32, uint32) clsend airecv;
// getLobbyZone(uint32, uint32, uint8) clsend airecv;
// receiveLobbyZone(uint32, uint64, uint32);
// freeZoneIdFromCreatedLobby(uint32, uint32) clsend airecv;
sendAvToPlayground(uint32, uint8);
exitParty(uint32) clsend airecv;
// sendAvToPlayground(uint32, uint8);
// exitParty(uint32) clsend airecv;
toonHasEnteredPartyAiToUd(uint32);
toonHasExitedPartyAiToUd(uint32);
// toonHasEnteredPartyAiToUd(uint32);
// toonHasExitedPartyAiToUd(uint32);
lobbyManagerAIStartingUp(uint32, uint32);
lobbyManagerAIGoingDown(uint32, uint32);
lobbyHasFinishedUdToAllAi(uint64 lobbyId) airecv;
// lobbyManagerAIStartingUp(uint32, uint32);
// lobbyManagerAIGoingDown(uint32, uint32);
// lobbyHasFinishedUdToAllAi(uint64 lobbyId) airecv;
requestShardIdZoneIdForHostId(uint32) clsend airecv;
sendShardIdZoneIdToAvatar(uint32, uint32);
// requestShardIdZoneIdForHostId(uint32) clsend airecv;
// sendShardIdZoneIdToAvatar(uint32, uint32);
lobbyManagerUdStartingUp() airecv;
lobbyManagerUdLost() airecv;
// lobbyManagerUdStartingUp() airecv;
// lobbyManagerUdLost() airecv;
receiveId(uint64 ids[]) airecv;
};
// receiveId(uint64 ids[]) airecv;
//};
dclass DistributedPartyManager : DistributedObject {
addParty(uint32, uint32, string, string, int8, int8, activity [], decoration [], uint32[], uint16);
@ -3124,16 +3113,16 @@ dclass DistributedPartyManager : DistributedObject {
receiveId(uint64 ids[]) airecv;
};
dclass GlobalLobbyManager : DistributedObjectGlobal {
lobbyManagerAIHello(uint32 channel);
queryLobby(uint32 hostId);
addLobby(DoId avId, uint64 lobbyId);
toonJoinedLobby(uint64 lobbyId, uint32 avId);
toonLeftLobby(uint64 lobbyId, uint32 avId);
requestLobbySlot(uint64 lobbyId, uint32 avId);
lobbyDone(uint64 lobbyId);
allocIds(uint16 count);
};
//dclass GlobalLobbyManager : DistributedObjectGlobal {
// lobbyManagerAIHello(uint32 channel);
// queryLobby(uint32 hostId);
// addLobby(DoId avId, uint64 lobbyId);
// toonJoinedLobby(uint64 lobbyId, uint32 avId);
// toonLeftLobby(uint64 lobbyId, uint32 avId);
// requestLobbySlot(uint64 lobbyId, uint32 avId);
// lobbyDone(uint64 lobbyId);
// allocIds(uint16 count);
//};
dclass GlobalPartyManager : DistributedObjectGlobal {
partyManagerAIHello(uint32 channel);
@ -3188,11 +3177,11 @@ dclass TTCodeRedemptionMgr : DistributedObject {
struct Friend
{
uint32 doId;
string name;
blob dna;
uint16 adminAccess;
uint32 petId;
uint32 doId;
string name;
blob dna;
uint16 adminAccess;
uint32 petId;
};
dclass TTSFriendsManager : DistributedObjectGlobal {

0
dependencies/astron/libeay32.dll vendored Normal file → Executable file
View file

0
dependencies/astron/msvcp120.dll vendored Normal file → Executable file
View file

0
dependencies/astron/msvcr120.dll vendored Normal file → Executable file
View file

0
dependencies/astron/prod/start-ai-server.sh vendored Normal file → Executable file
View file

0
dependencies/astron/prod/start-astron-cluster.sh vendored Normal file → Executable file
View file

0
dependencies/astron/prod/start-uberdog-server.sh vendored Normal file → Executable file
View file

0
dependencies/astron/ssleay32.dll vendored Normal file → Executable file
View file

View file

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

View file

@ -20,7 +20,7 @@ dc-file dependencies/astron/dclass/stride.dc
# Core features:
want-pets #t
want-parties #t
want-parties #f
want-cogdominiums #t
want-lawbot-cogdo #t
want-anim-props #t
@ -29,6 +29,8 @@ want-find-four #t
want-chinese-checkers #t
want-checkers #t
want-house-types #t
want-gifting #t
want-top-toons #f
# Chat:
want-whitelist #t
@ -36,6 +38,12 @@ want-whitelist #t
# Developer options:
show-population #t
want-instant-parties #t
want-instant-delivery #t
cogdo-pop-factor 1.5
cogdo-ratio 0.5
default-directnotify-level info
default-directnotify-level info
# Crates:
dont-destroy-crate #t
get-key-reward-always #t
get-crate-reward-always #t

0
dependencies/libpandadna.pyd vendored Normal file → Executable file
View file

0
dependencies/libpandadna.so vendored Normal file → Executable file
View file

0
dev/win32/start-ai-server.bat Normal file → Executable file
View file

0
dev/win32/start-astron-cluster.bat Normal file → Executable file
View file

0
dev/win32/start-game.bat Normal file → Executable file
View file

0
dev/win32/start-uberdog-server.bat Normal file → Executable file
View file

View file

@ -17,7 +17,6 @@ from otp.nametag.Nametag import Nametag
from otp.nametag.NametagGroup import NametagGroup
from otp.nametag.NametagConstants import *
teleportNotify = DirectNotifyGlobal.directNotify.newCategory('Teleport')
teleportNotify.showTime = True
if config.GetBool('want-teleport-debug', 1):
@ -27,24 +26,15 @@ def reconsiderAllUnderstandable():
for av in Avatar.ActiveAvatars:
av.considerUnderstandable()
class Avatar(Actor, ShadowCaster):
notify = directNotify.newCategory('Avatar')
ActiveAvatars = []
ManagesNametagAmbientLightChanged = False
def __init__(self, other = None):
self.name = ''
try:
self.Avatar_initialized
return
except:
self.Avatar_initialized = 1
Actor.__init__(self, None, None, other, flattenable=0, setFinal=1)
ShadowCaster.__init__(self)
self.__font = OTPGlobals.getInterfaceFont()
self.__speechFont = OTPGlobals.getInterfaceFont()
self.name = ''
self.soundChatBubble = None
self.avatarType = ''
self.nametagNodePath = None
@ -59,18 +49,11 @@ class Avatar(Actor, ShadowCaster):
self.nametag3d = self.attachNewNode('nametag3d')
self.nametag3d.setTag('cam', 'nametag')
self.nametag3d.setLightOff()
if self.ManagesNametagAmbientLightChanged:
self.acceptNametagAmbientLightChange()
OTPRender.renderReflection(False, self.nametag3d, 'otp_avatar_nametag', None)
self.getGeomNode().showThrough(OTPRender.ShadowCameraBitmask)
self.nametag3d.hide(OTPRender.ShadowCameraBitmask)
self.collTube = None
self.battleTube = None
self.scale = 1.0
self.nametagScale = 1.0
self.height = 0.0
self.battleTubeHeight = 0.0
self.battleTubeRadius = 0.0
self.style = None
self.understandable = 1
self.setPlayerType(NametagGroup.CCNormal)
@ -91,11 +74,8 @@ class Avatar(Actor, ShadowCaster):
except:
self.deleteNametag3d()
Actor.cleanup(self)
if self.ManagesNametagAmbientLightChanged:
self.ignoreNametagAmbientLightChange()
self.Avatar_deleted = 1
del self.__font
del self.__speechFont
del self.style
del self.soundChatBubble
self.nametag.destroy()
@ -104,12 +84,6 @@ class Avatar(Actor, ShadowCaster):
ShadowCaster.delete(self)
Actor.delete(self)
def acceptNametagAmbientLightChange(self):
self.accept('nametagAmbientLightChanged', self.nametagAmbientLightChanged)
def ignoreNametagAmbientLightChange(self):
self.ignore('nametagAmbientLightChanged')
def isLocal(self):
return 0
@ -127,7 +101,7 @@ class Avatar(Actor, ShadowCaster):
if self.isUnderstandable():
self.nametag.setColorCode(self.playerType)
else:
self.nametag.setColorCode(NametagGroup.CCNoChat)
self.nametag.setColorCode(NametagGroup.CCNonPlayer)
self.setNametagName()
def considerUnderstandable(self):
@ -136,9 +110,6 @@ class Avatar(Actor, ShadowCaster):
if hasattr(base, 'localAvatar') and (self == base.localAvatar):
self.understandable = 1
self.setPlayerType(NametagGroup.CCNormal)
elif hasattr(self, 'adminAccess') and self.isAdmin():
self.understandable = 2
self.setPlayerType(NametagGroup.CCAdmin)
elif self.playerType == NametagGroup.CCSuit:
self.understandable = 1
self.setPlayerType(NametagGroup.CCSuit)
@ -154,6 +125,8 @@ class Avatar(Actor, ShadowCaster):
else:
self.understandable = 0
self.setPlayerType(NametagGroup.CCSpeedChat)
if hasattr(self, 'adminAccess') and self.isAdmin():
self.understandable = 2
if not hasattr(self, 'nametag'):
self.notify.warning('no nametag attributed, but would have been used')
else:
@ -177,13 +150,6 @@ class Avatar(Actor, ShadowCaster):
self.getGeomNode().setScale(scale)
self.setHeight(self.height)
def getNametagScale(self):
return self.nametagScale
def setNametagScale(self, scale):
self.nametagScale = scale
self.nametag3d.setScale(scale)
def adjustNametag3d(self, parentScale = 1.0):
self.nametag3d.setPos(0, 0, self.height + 0.5)
@ -197,8 +163,6 @@ class Avatar(Actor, ShadowCaster):
self.collTube.setPointB(0, 0, height - self.getRadius())
if self.collNodePath:
self.collNodePath.forceRecomputeBounds()
if self.battleTube:
self.battleTube.setPointB(0, 0, height - self.getRadius())
def getRadius(self):
return OTPGlobals.AvatarDefaultRadius
@ -245,13 +209,6 @@ class Avatar(Actor, ShadowCaster):
self.__font = font
self.nametag.setFont(font)
def getSpeechFont(self):
return self.__speechFont
def setSpeechFont(self, font):
self.__speechFont = font
self.nametag.setSpeechFont(font)
def getStyle(self):
return self.style
@ -349,9 +306,6 @@ class Avatar(Actor, ShadowCaster):
self.nametag.setChat(chatString, chatFlags)
self.playCurrentDialogue(dialogue, chatFlags, interrupt)
def setChatMuted(self, chatString, chatFlags, dialogue = None, interrupt = 1, quiet = 0):
pass
def displayTalk(self, chatString):
if not base.localAvatar.isIgnored(self.doId):
self.clearChat()
@ -364,11 +318,6 @@ class Avatar(Actor, ShadowCaster):
def clearChat(self):
self.nametag.clearChat()
def isInView(self):
pos = self.getPos(camera)
eyePos = Point3(pos[0], pos[1], pos[2] + self.getHeight())
return base.camNode.isInView(eyePos)
def getNameVisible(self):
return self.__nameVisible
@ -539,11 +488,6 @@ class Avatar(Actor, ShadowCaster):
cJoint.clearNetTransforms()
cJoint.addNetTransform(nametagNode)
def nametagAmbientLightChanged(self, newlight):
self.nametag3d.setLightOff()
if newlight:
self.nametag3d.setLight(newlight)
def deleteNametag3d(self):
if self.nametagNodePath:
self.nametagNodePath.removeNode()
@ -615,10 +559,5 @@ def target():
Returns the current Spellbook target.
"""
target = spellbook.getTarget()
print 'Called target.'
print 'Name: ' + target.getName()
doId = str(int(target.doId))
print 'doId: ', doId
accessLevel = str(int(target.getAdminAccess()))
print 'Access Level: ', accessLevel
return 'Target: %s-%d [%d]' % (target.getName(), int(target.doId), int(target.getAdminAccess()))
return 'Target: %s-%d [%d]' % (target.getName(), int(target.doId), int(target.getAdminAccess()))

View file

@ -62,6 +62,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.sleepFlag = 0
self.isDisguised = 0
self.movingFlag = 0
self.preventCameraDisable = False
self.lastNeedH = None
self.accept('friendOnline', self.__friendOnline)
self.accept('friendOffline', self.__friendOffline)
@ -73,6 +74,9 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.accept('avatarMoving', self.clearPageUpDown)
self.showNametag2d()
self.setPickable(0)
def setPreventCameraDisable(self, prevent):
self.preventCameraDisable = prevent
def useSwimControls(self):
self.controlManager.use('swim', self)
@ -421,7 +425,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.controlManager.setSpeeds(OTPGlobals.ToonForwardSlowSpeed, OTPGlobals.ToonJumpSlowForce, OTPGlobals.ToonReverseSlowSpeed, OTPGlobals.ToonRotateSlowSpeed)
def pageUp(self):
if not self.avatarControlsEnabled:
if not (self.avatarControlsEnabled or self.preventCameraDisable):
return
self.wakeUp()
if not self.isPageUp:
@ -433,7 +437,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.clearPageUpDown()
def pageDown(self):
if not self.avatarControlsEnabled:
if not (self.avatarControlsEnabled and self.preventCameraDisable):
return
self.wakeUp()
if not self.isPageDown:
@ -452,7 +456,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.setCameraPositionByIndex(self.cameraIndex)
def nextCameraPos(self, forward):
if not self.avatarControlsEnabled:
if not (self.avatarControlsEnabled or self.preventCameraDisable):
return
self.wakeUp()
self.__cameraHasBeenMoved = 1
@ -465,6 +469,10 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
if self.cameraIndex < 0:
self.cameraIndex = len(self.cameraPositions) - 1
self.setCameraPositionByIndex(self.cameraIndex)
def setCameraPosition(self, index):
self.cameraIndex = index
self.setCameraPositionByIndex(index)
def initCameraPositions(self):
camHeight = self.getClampedAvatarHeight()

View file

@ -1,40 +1,83 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectGlobalUD import DistributedObjectGlobalUD
from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.MsgTypes import *
from otp.distributed import OtpDoGlobals
from toontown.toonbase import TTLocalizer
BLACKLIST = TTLocalizer.Blacklist
OFFENSE_MSGS = ('-- DEV CHAT -- word blocked: %s', 'Watch your language! This is your first offense. You said "%s".',
'Watch your language! This is your second offense. Next offense you\'ll get banned for 24 hours. You said "%s".')
class ChatAgentUD(DistributedObjectGlobalUD):
notify = DirectNotifyGlobal.directNotify.newCategory("ChatAgentUD")
def announceGenerate(self):
DistributedObjectGlobalUD.announceGenerate(self)
self.chatMode2channel = {
notify = DirectNotifyGlobal.directNotify.newCategory('ChatAgentUD')
WantWhitelist = config.GetBool('want-whitelist', True)
chatMode2channel = {
1 : OtpDoGlobals.OTP_MOD_CHANNEL,
2 : OtpDoGlobals.OTP_ADMIN_CHANNEL,
3 : OtpDoGlobals.OTP_SYSADMIN_CHANNEL,
}
self.chatMode2prefix = {
}
chatMode2prefix = {
1 : "[MOD] ",
2 : "[ADMIN] ",
3 : "[SYSADMIN] ",
}
}
def announceGenerate(self):
DistributedObjectGlobalUD.announceGenerate(self)
self.offenses = {}
def chatMessage(self, message, chatMode):
sender = self.air.getAvatarIdFromSender()
if sender == 0:
self.air.writeServerEvent('suspicious', accId=self.air.getAccountIdFromSender(),
issue='Account sent chat without an avatar', message=message)
self.air.writeServerEvent('suspicious', self.air.getAccountIdFromSender(),
'Account sent chat without an avatar', message)
return
self.air.writeServerEvent('chat-said', avId=sender, chatMode=chatMode, msg=message)
if chatMode != 0:
if message.startswith('.'):
message = '.' + self.chatMode2prefix.get(chatMode, "") + message[1:]
else:
message = self.chatMode2prefix.get(chatMode, "") + message
if chatMode == 0:
if self.detectBadWords(self.air.getMsgSender(), message):
return
self.air.writeServerEvent('chat-said', sender, message)
DistributedAvatar = self.air.dclassesByName['DistributedAvatarUD']
dg = DistributedAvatar.aiFormatUpdate('setTalk', sender, self.chatMode2channel.get(chatMode, sender), self.air.ourChannel, [message])
dg = DistributedAvatar.aiFormatUpdate('setTalk', sender, sender,
self.air.ourChannel,
[message])
self.air.send(dg)
def detectBadWords(self, sender, message):
words = message.split()
print words
for word in words:
if word.lower() in BLACKLIST:
accountId = (sender >> 32) & 0xFFFFFFFF
avId = sender & 0xFFFFFFFF
if not sender in self.offenses:
self.offenses[sender] = 0
if self.air.friendsManager.getToonAccess(avId) < 300:
self.offenses[sender] += 1
if self.offenses[sender] >= 3:
msg = 'Banned'
else:
msg = OFFENSE_MSGS[self.offenses[sender]] % word
dclass = self.air.dclassesByName['ClientServicesManagerUD']
dg = dclass.aiFormatUpdate('systemMessage',
OtpDoGlobals.OTP_DO_ID_CLIENT_SERVICES_MANAGER,
sender, 1000000, [msg])
self.air.send(dg)
#self.air.banManager.ban(sender, 2, 'language')
self.air.writeServerEvent('chat-offense', accountId, word=word, num=self.offenses[sender], msg=msg)
if self.offenses[sender] >= 3:
del self.offenses[sender]
return 1
return 0

View file

@ -2886,6 +2886,7 @@ WHITELIST = [
'be',
'be-awesome',
'be-yoink',
'beach',
'beachcombers',
'beachead',
'beached',
@ -9980,6 +9981,7 @@ WHITELIST = [
'deny',
'denying',
'deodorant',
'deorro',
'depart',
'departed',
'departing',
@ -22308,6 +22310,8 @@ WHITELIST = [
'masterly',
'masterpiece',
'masters',
'mastervoltage',
'mastervolty',
'mastery',
'mat',
'matata',
@ -30128,6 +30132,7 @@ WHITELIST = [
'sins',
'sip',
'sir',
'sirbiscuit',
'siren',
"siren's",
'sirens',
@ -34728,6 +34733,7 @@ WHITELIST = [
'volleyball',
'voltage',
'voltorn',
'volty',
'volume',
"volume's",
'volumed',
@ -36496,6 +36502,7 @@ WHITELIST = [
'zebra',
"zebra's",
'zebras',
'zedd',
'zeddars',
'zeke',
'zelda',
@ -36862,4 +36869,4 @@ WHITELIST = [
'zyyk',
'zzz',
'zzzzzs',
]
]

View file

@ -1,6 +1,5 @@
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.toonbase import ToontownGlobals
class DistributedDistrictAI(DistributedObjectAI):
notify = directNotify.newCategory('DistributedDistrictAI')
@ -8,16 +7,6 @@ class DistributedDistrictAI(DistributedObjectAI):
name = 'District'
available = 0
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
doId = self.doId - (self.doId % 100000000 % 1000000)
self.air.groupManager.shardGroups[doId] = {
ToontownGlobals.SellbotHQ: ['VP Group', []],
ToontownGlobals.CashbotHQ: ['CFO Group', []],
ToontownGlobals.LawbotHQ: ['CJ Group', []],
ToontownGlobals.BossbotHQ: ['CEO Group', []],
}
def setName(self, name):
self.name = name

View file

@ -1071,7 +1071,7 @@ class OTPClientRepository(ClientRepositoryBase):
for s in self.activeDistrictMap.values():
if s.available:
list.append((s.doId, s.name, s.avatarCount, s.invasionStatus))
list.append((s.doId, s.name, s.avatarCount, s.invasionStatus, s.groupAvCount))
return list

View file

@ -3,7 +3,6 @@ OTP_DO_ID_FRIEND_MANAGER = 4501
OTP_DO_ID_TOONTOWN = 1337
OTP_DO_ID_CLIENT_SERVICES_MANAGER = 4665
OTP_DO_ID_TTS_FRIENDS_MANAGER = 4666
OPT_DO_ID_GROUP_MANAGER = 4667
OTP_DO_ID_GLOBAL_PARTY_MANAGER = 4477
OTP_DO_ID_GLOBAL_LOBBY_MANAGER = 4478
OTP_DO_ID_CHAT_MANAGER = 4681

View file

@ -1,19 +1,11 @@
class PotentialAvatar:
def __init__(self, id, names, dna, position, allowedName, creator = 1, shared = 1, online = 0, wishState = 'CLOSED', wishName = '', defaultShard = 0, lastLogout = 0):
def __init__(self, id, names, dna, position, allowedName):
self.id = id
self.name = names[0]
self.dna = dna
self.avatarType = None
self.position = position
self.wantName = names[1]
self.approvedName = names[2]
self.rejectedName = names[3]
self.allowedName = allowedName
self.wishState = wishState
self.wishName = wishName
self.creator = creator
self.shared = shared
self.online = online
self.defaultShard = defaultShard
self.lastLogout = lastLogout

View file

@ -91,3 +91,14 @@ class FriendManager(DistributedObject.DistributedObject):
self.notify.debug('Client: inviteeCancelFriendQuery(%d)' % context)
messenger.send('cancelFriendInvitation', [context])
self.up_inviteeAcknowledgeCancel(context)
def requestTFCode(self, callback):
self.tfCallback = callback
self.sendUpdate('requestTFCode')
def redeemTFCode(self, code, callback):
self.tfCallback = callback
self.sendUpdate('redeemTFCode', [code])
def tfResponse(self, response, code):
self.tfCallback(response, code)

View file

@ -1,5 +1,58 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from otp.otpbase import OTPGlobals
from toontown.toonbase import ToontownGlobals
import datetime, uuid, time, string, random
AVAILABLE_CHARS = string.ascii_lowercase + string.digits
class AddTrueFriend:
def __init__(self, manager, av, targetId, code):
self.air = manager.air
self.manager = manager
self.av = av
self.targetId = targetId
self.code = code
def start(self):
self.air.dbInterface.queryObject(self.air.dbId, self.targetId, self.__gotAvatar)
def __gotAvatar(self, dclass, fields):
dclasses = self.air.dclassesByName['DistributedToonAI']
if dclass != dclasses:
return
friendsList = fields['setFriendsList'][0]
trueFriendsList = fields['setTrueFriends'][0]
name = fields['setName'][0]
avId = self.av.doId
if avId in trueFriendsList:
self.manager.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_ALREADY_FRIENDS_NAME, name])
return
elif avId not in friendsList:
if len(friendsList) >= OTPGlobals.MaxFriends:
self.manager.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_FRIENDS_LIST_FULL_HIM, name])
return
friendsList.append(avId)
if self.targetId not in self.av.getFriendsList():
self.av.extendFriendsList(self.targetId)
if hasattr(self.manager, 'data'):
del self.manager.data[self.code]
else:
self.air.dbGlobalCursor.tfCodes.remove({'_id': self.code})
self.av.addTrueFriend(self.targetId)
trueFriendsList.append(avId)
self.air.send(dclasses.aiFormatUpdate('setFriendsList', self.targetId, self.targetId, self.air.ourChannel, [friendsList]))
self.air.send(dclasses.aiFormatUpdate('setTrueFriends', self.targetId, self.targetId, self.air.ourChannel, [trueFriendsList]))
self.manager.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_SUCCESS, name])
del self.manager.tfFsms[avId]
class FriendManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("FriendManagerAI")
@ -9,6 +62,15 @@ class FriendManagerAI(DistributedObjectAI):
self.air = air
self.currentContext = 0
self.requests = {}
self.tfFsms = {}
self.connectToDatabase()
def connectToDatabase(self):
if not self.air.dbConn:
self.notify.warning('Not using mongodb, true friends will be non-persistent')
self.data = {}
else:
self.air.dbGlobalCursor.tfCodes.ensure_index('date', expireAfterSeconds=ToontownGlobals.TF_EXPIRE_SECS)
def friendQuery(self, requested):
avId = self.air.getAvatarIdFromSender()
@ -118,3 +180,81 @@ class FriendManagerAI(DistributedObjectAI):
return
del self.requests[context]
def getRandomCharSequence(self, count):
return ''.join(random.choice(AVAILABLE_CHARS) for i in xrange(count))
def getTFCode(self, tryNumber):
if tryNumber == ToontownGlobals.MAX_TF_TRIES:
return str(uuid.uuid4())
code = 'TT %s %s' % (self.getRandomCharSequence(3), self.getRandomCharSequence(3))
if (hasattr(self, 'data') and code in self.data) or (self.air.dbConn and self.air.dbGlobalCursor.tfCodes.find({'_id': code}).count() > 0):
return self.getTFCode(tryNumber + 1)
return code
def requestTFCode(self):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
tfRequest = av.getTFRequest()
if tfRequest[1] >= ToontownGlobals.MAX_TF_TRIES and tfRequest[0] >= time.time():
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_COOLDOWN, ''])
return
code = self.getTFCode(0)
if hasattr(self, 'data'):
self.data[code] = avId
else:
self.air.dbGlobalCursor.tfCodes.insert({'_id': code, 'date': datetime.datetime.utcnow(), 'avId': avId})
av.b_setTFRequest((time.time() + ToontownGlobals.TF_COOLDOWN_SECS, tfRequest[1] + 1))
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_SUCCESS, code])
def redeemTFCode(self, code):
avId = self.air.getAvatarIdFromSender()
if avId in self.tfFsms:
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_TOO_FAST, ''])
return
av = self.air.doId2do.get(avId)
if not av:
return
if hasattr(self, 'data'):
if code not in self.data:
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_UNKNOWN_SECRET, ''])
return
targetId = self.data[code]
else:
fields = self.air.dbGlobalCursor.tfCodes.find_one({'_id': code})
if not fields:
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_UNKNOWN_SECRET, ''])
return
targetId = fields['avId']
if avId == targetId:
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_SELF_SECRET, ''])
return
elif av.isTrueFriends(targetId):
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_ALREADY_FRIENDS, ''])
return
elif targetId not in av.getFriendsList() and len(av.getFriendsList()) >= OTPGlobals.MaxFriends:
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_FRIENDS_LIST_FULL_YOU, ''])
return
tfOperation = AddTrueFriend(self, av, targetId, code)
tfOperation.start()
self.tfFsms[avId] = tfOperation

View file

@ -9,15 +9,12 @@ CFThought=2
CFTimeout=8
CCNormal = 0
CCNoChat = 1
CCNonPlayer = 2
CCSuit = 3
CCToonBuilding = 4
CCSuitBuilding = 5
CCHouseBuilding = 6
CCSpeedChat = 7
CCFreeChat = 8
CCAdmin = 9
CCNonPlayer = 1
CCSuit = 2
CCToonBuilding = 3
CCSuitBuilding = 4
CCHouseBuilding = 5
CCSpeedChat = 6
NAMETAG_COLORS = {
CCNormal: (
@ -34,20 +31,6 @@ NAMETAG_COLORS = {
((0.3, 0.3, 0.7, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
),
CCNoChat: (
# Normal FG BG
((0.8, 0.4, 0.0, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Click FG BG
((1.0, 0.5, 0.5, 1.0), (0.2, 0.2, 0.2, 0.6), # Name
(1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Hover FG BG
((1.0, 0.5, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0), # Name
(0.0, 0.6, 0.6, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Disable FG BG
((0.8, 0.4, 0.0, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
),
CCNonPlayer: (
# Normal FG BG
((0.8, 0.4, 0.0, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
@ -131,35 +114,7 @@ NAMETAG_COLORS = {
# Disable FG BG
((0.0, 0.6, 0.2, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
),
CCFreeChat: (
# Normal FG BG
((0.3, 0.3, 0.7, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Click FG BG
((0.2, 0.2, 0.5, 1.0), (0.2, 0.2, 0.2, 0.6), # Name
(1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Hover FG BG
((0.5, 0.5, 1.0, 1.0), (1.0, 1.0, 1.0, 1.0), # Name
(0.0, 0.6, 0.6, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Disable FG BG
((0.3, 0.3, 0.7, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
),
CCAdmin: (
# Normal FG BG
((1.0, 0.35, 0.25, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Click FG BG
((1.0, 0.35, 0.25, 1.0), (0.2, 0.2, 0.2, 0.6), # Name
(1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Hover FG BG
((1.0, 0.5, 0.56, 1.0), (1.0, 1.0, 1.0, 1.0), # Name
(0.0, 0.6, 0.6, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
# Disable FG BG
((1.0, 0.35, 0.25, 1.0), (0.8, 0.8, 0.8, 0.5), # Name
(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat
),
)
}
ARROW_COLORS = {
@ -168,15 +123,12 @@ ARROW_COLORS = {
DEFAULT_WORDWRAPS = {
CCNormal: 7.5,
CCNoChat: 7.5,
CCNonPlayer: 7.5,
CCSuit: 7.5,
CCToonBuilding: 8.5,
CCSuitBuilding: 8.5,
CCHouseBuilding: 10.0,
CCSpeedChat: 7.5,
CCFreeChat: 7.5,
CCAdmin: 7.5
CCSpeedChat: 7.5
}
WTNormal = 0
@ -195,7 +147,7 @@ WHISPER_COLORS = {
# Hover FG BG
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.9, 0.6)),
# Disable FG BG
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)),
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6))
),
WTQuickTalker: (
# Normal FG BG
@ -205,7 +157,7 @@ WHISPER_COLORS = {
# Hover FG BG
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.9, 0.6)),
# Disable FG BG
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)),
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6))
),
WTSystem: (
# Normal FG BG
@ -215,9 +167,18 @@ WHISPER_COLORS = {
# Hover FG BG
((0.0, 0.0, 0.0, 1.0), (0.8, 0.4, 1.0, 0.6)),
# Disable FG BG
((0.0, 0.0, 0.0, 1.0), (0.8, 0.3, 0.6, 0.6)),
((0.0, 0.0, 0.0, 1.0), (0.8, 0.3, 0.6, 0.6))
),
WTBattleSOS: (
# Normal FG BG
((0.0, 0.0, 0.0, 1.0), (0.8, 0.3, 0.6, 0.6)),
# Click FG BG
((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)),
# Hover FG BG
((0.0, 0.0, 0.0, 1.0), (0.8, 0.4, 0.0, 0.8)),
# Disable FG BG
((0.0, 0.0, 0.0, 1.0), (0.8, 0.3, 0.6, 0.6))
),
# TODO: WTBattleSOS
WTEmote: (
# Normal FG BG
((0.0, 0.0, 0.0, 1.0), (0.9, 0.5, 0.1, 0.6)),
@ -226,7 +187,19 @@ WHISPER_COLORS = {
# Hover FG BG
((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.2, 0.6)),
# Disable FG BG
((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.1, 0.6)),
((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.1, 0.6))
),
# TODO: WTToontownBoardingGroup
WTToontownBoardingGroup: (
# Normal FG BG
((0.0, 0.0, 0.0, 1.0), (0.9, 0.5, 0.1, 0.6)),
# Click FG BG
((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)),
# Hover FG BG
((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.2, 0.6)),
# Disable FG BG
((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.1, 0.6))
)
}
def getFriendColor(handle):
return CCNormal if settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat

View file

@ -2,18 +2,16 @@ from pandac.PandaModules import *
from NametagConstants import *
from Nametag3d import *
from Nametag2d import *
import subprocess
class NametagGroup:
CCNormal = CCNormal
CCNoChat = CCNoChat
CCNonPlayer = CCNonPlayer
CCSuit = CCSuit
CCToonBuilding = CCToonBuilding
CCSuitBuilding = CCSuitBuilding
CCHouseBuilding = CCHouseBuilding
CCSpeedChat = CCSpeedChat
CCFreeChat = CCFreeChat
CCAdmin = CCAdmin
CHAT_TIMEOUT_MAX = 12.0
CHAT_TIMEOUT_MIN = 4.0
@ -244,6 +242,9 @@ class NametagGroup:
tag.chatFlags = self.chatFlags
tag.avatar = self.avatar
tag.icon = self.icon
if settings['talk2speech']:
subprocess.Popen('espeak "%s"' % tag.chatString)
tag.update()

View file

@ -7,7 +7,6 @@ import OTPGlobals, OTPRender, math
class OTPBase(ShowBase):
def __init__(self, windowType = None):
self.wantEnviroDR = False
ShowBase.__init__(self, windowType=windowType)
self.idTags = config.GetBool('want-id-tags', 0)
if not self.idTags:
@ -15,9 +14,6 @@ class OTPBase(ShowBase):
self.wantNametags = self.config.GetBool('want-nametags', 1)
self.wantDynamicShadows = 1
self.stereoEnabled = False
self.enviroDR = None
self.enviroCam = None
self.pixelZoomSetup = False
self.whiteList = None
if config.GetBool('want-whitelist', True):
@ -27,159 +23,12 @@ class OTPBase(ShowBase):
if config.GetBool('want-sequence-list', True):
self.whiteList.setSequenceList(SequenceListData.SEQUENCES)
if base.cam:
if self.wantEnviroDR:
base.cam.node().setCameraMask(OTPRender.MainCameraBitmask)
else:
base.cam.node().setCameraMask(OTPRender.MainCameraBitmask | OTPRender.EnviroCameraBitmask)
taskMgr.setupTaskChain('net')
def setTaskChainNetThreaded(self):
if base.config.GetBool('want-threaded-network', 0):
taskMgr.setupTaskChain('net', numThreads=1, frameBudget=0.001, threadPriority=TPLow)
def setTaskChainNetNonthreaded(self):
taskMgr.setupTaskChain('net', numThreads=0, frameBudget=-1)
def toggleStereo(self):
self.stereoEnabled = not self.stereoEnabled
if self.stereoEnabled:
if not base.win.isStereo():
base.win.setRedBlueStereo(True, ColorWriteAttrib.CRed, ColorWriteAttrib.CGreen | ColorWriteAttrib.CBlue)
if self.wantEnviroDR:
self.setupEnviroCamera()
return
mainDR = base.camNode.getDisplayRegion(0)
if self.stereoEnabled:
if not mainDR.isStereo():
base.win.removeDisplayRegion(mainDR)
mainDR = base.win.makeStereoDisplayRegion()
mainDR.getRightEye().setClearDepthActive(True)
mainDR.setCamera(base.cam)
elif mainDR.isStereo():
base.win.removeDisplayRegion(mainDR)
mainDR = base.win.makeMonoDisplayRegion()
mainDR.setCamera(base.cam)
def setupEnviroCamera(self):
clearColor = VBase4(0, 0, 0, 1)
if self.enviroDR:
clearColor = self.enviroDR.getClearColor()
self.win.removeDisplayRegion(self.enviroDR)
if not self.enviroCam:
self.enviroCam = self.cam.attachNewNode(Camera('enviroCam'))
mainDR = self.camNode.getDisplayRegion(0)
if self.stereoEnabled:
self.enviroDR = self.win.makeStereoDisplayRegion()
if not mainDR.isStereo():
self.win.removeDisplayRegion(mainDR)
mainDR = self.win.makeStereoDisplayRegion()
mainDR.setCamera(self.cam)
ml = mainDR.getLeftEye()
mr = mainDR.getRightEye()
el = self.enviroDR.getLeftEye()
er = self.enviroDR.getRightEye()
el.setSort(-8)
ml.setSort(-6)
er.setSort(-4)
er.setClearDepthActive(True)
mr.setSort(-2)
mr.setClearDepthActive(False)
else:
self.enviroDR = self.win.makeMonoDisplayRegion()
if mainDR.isStereo():
self.win.removeDisplayRegion(mainDR)
mainDR = self.win.makeMonoDisplayRegion()
mainDR.setCamera(self.cam)
self.enviroDR.setSort(-10)
self.enviroDR.setClearColor(clearColor)
self.win.setClearColor(clearColor)
self.enviroDR.setCamera(self.enviroCam)
self.enviroCamNode = self.enviroCam.node()
self.enviroCamNode.setLens(self.cam.node().getLens())
self.enviroCamNode.setCameraMask(OTPRender.EnviroCameraBitmask)
render.hide(OTPRender.EnviroCameraBitmask)
self.camList.append(self.enviroCam)
self.backgroundDrawable = self.enviroDR
self.enviroDR.setTextureReloadPriority(-10)
if self.pixelZoomSetup:
self.setupAutoPixelZoom()
def setupAutoPixelZoom(self):
self.win.setPixelZoom(1)
self.enviroDR.setPixelZoom(1)
if not self.stereoEnabled:
self.enviroDR.setClearColorActive(True)
self.enviroDR.setClearDepthActive(True)
self.win.setClearColorActive(False)
self.win.setClearDepthActive(False)
self.backgroundDrawable = self.enviroDR
else:
self.enviroDR.setClearColorActive(False)
self.enviroDR.setClearDepthActive(False)
self.enviroDR.getRightEye().setClearDepthActive(True)
self.win.setClearColorActive(True)
self.win.setClearDepthActive(True)
self.backgroundDrawable = self.win
self.pixelZoomSetup = True
self.targetPixelZoom = 1.0
self.pixelZoomTask = None
self.pixelZoomCamHistory = 2.0
self.pixelZoomCamMovedList = []
self.pixelZoomStarted = None
flag = self.config.GetBool('enable-pixel-zoom', True)
self.enablePixelZoom(flag)
return
def enablePixelZoom(self, flag):
if not self.backgroundDrawable.supportsPixelZoom():
flag = False
self.pixelZoomEnabled = flag
taskMgr.remove('chasePixelZoom')
if flag:
taskMgr.add(self.__chasePixelZoom, 'chasePixelZoom', priority=-52)
else:
self.backgroundDrawable.setPixelZoom(1)
def __chasePixelZoom(self, task):
now = globalClock.getFrameTime()
pos = base.cam.getNetTransform().getPos()
prevPos = base.cam.getNetPrevTransform().getPos()
d2 = (pos - prevPos).lengthSquared()
if d2:
d = math.sqrt(d2)
self.pixelZoomCamMovedList.append((now, d))
while self.pixelZoomCamMovedList and self.pixelZoomCamMovedList[0][0] < now - self.pixelZoomCamHistory:
del self.pixelZoomCamMovedList[0]
dist = sum(map(lambda pair: pair[1], self.pixelZoomCamMovedList))
speed = dist / self.pixelZoomCamHistory
if speed < 5:
self.backgroundDrawable.setPixelZoom(4)
self.pixelZoomStart = None
elif speed > 10:
if self.pixelZoomStart == None:
self.pixelZoomStart = now
elapsed = now - self.pixelZoomStart
if elapsed > 10:
self.backgroundDrawable.setPixelZoom(16)
elif elapsed > 5:
self.backgroundDrawable.setPixelZoom(8)
return task.cont
def getShardPopLimits(self):
return (100, 200, -1)
base.cam.node().setCameraMask(OTPRender.MainCameraBitmask)
taskMgr.setupTaskChain('net', numThreads=1, frameBudget=0.001, threadPriority=TPLow)
def getRepository(self):
return self.cr
def openMainWindow(self, *args, **kw):
result = ShowBase.openMainWindow(self, *args, **kw)
if result:
self.wantEnviroDR = not self.win.getGsg().isHardware() or config.GetBool('want-background-region', 1)
self.backgroundDrawable = self.win
return result
def run(self):
try:
taskMgr.run()

View file

@ -132,7 +132,8 @@ CRBootedReasons = {100: 'You have been disconnected because someone else just lo
102: 'You are not authorized to use administrator privileges.',
103: 'You were banned by a moderator.\n\nBehave next time!',
105: 'Toontown Stride is now temporarily closed for maintenance. Everyone who was playing has been disconnected from the game.\n\nFor more information, please visit the Toontown Stride website.',
153: 'The district you were playing on has been reset. Everyone who was playing on that district has been disconnected. However, you should be able to connect again and go right back into the game.'}
153: 'The district you were playing on has been reset. Everyone who was playing on that district has been disconnected. However, you should be able to connect again and go right back into the game.',
166: 'You were disconnected to prevent a district reset.'}
CRBootedReasonUnknownCode = 'An unexpected problem has occurred (error code %s). Your connection has been lost, but you should be able to connect again and go right back into the game.'
CRTryConnectAgain = '\n\nTry to connect again?'
CRToontownUnavailable = 'The server appears to be temporarily unavailable, still trying...'
@ -233,6 +234,7 @@ FriendInviterConfirmRemove = 'Remove'
FriendInviterYes = lYes
FriendInviterNo = lNo
FriendInviterClickToon = 'Click on the toon you would like to make friends with.'
FriendInviterTooMany = 'You have too many friends on your list to add another one now. You will have to remove some friends if you want to make friends with %s.'
FriendInviterToonTooMany = 'You have too many toon friends on your list to add another one now. You will have to remove some toon friends if you want to make friends with %s.'
FriendInviterNotYet = 'Would you like to make friends with %s?'
FriendInviterCheckAvailability = 'Seeing if %s is available.'
@ -374,7 +376,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
'Good, it takes two to mingle.',
"Let's mingle.",
'This looks like a good place to mingle.',
"Well,isn't this cozy?",
"Well, isn't this cozy?",
"You're mingling with defeat.",
"I'm going to mingle in your business.",
"Are you sure you're ready to mingle?"],
@ -518,7 +520,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
'Care to take a few turns with me?',
'I have my own special spin on the subject.'],
'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.",
"You're not going to like the way I work.",
'The boss is counting on me to stop you.',
@ -541,7 +543,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
'Careful, I may leave a mark.'],
'ym': ["I'm positive you're not going to like this.",
"I don't know the meaning of no.",
'Want to meet? I say yes, anytime.',
'Want to meet? I say yes, anytime.',
'You need some positive enforcement.',
"I'm going to make a positive impression.",
"I haven't been wrong yet.",
@ -590,7 +592,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
'Can I interest you in an insurance plan?',
'You should have missed my call.',
"You won't be able to get rid of me now.",
'This a bad time? Good.',
'This a bad time? Good.',
'I was planning on running into you.',
'I will be reversing the charges for this call.',
'I have some costly items for you today.',
@ -620,7 +622,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
'Would you like some hand-me-downs?',
'Let me show you some of my handiwork.',
'I think the handwriting is on the wall.',
"I'll gladly handle your gags for you"],
"I'll gladly handle your gags for you."],
'sc': ['I will make short work of you.',
"You're about to have money trouble.",
"You're about to be overcharged.",
@ -642,7 +644,7 @@ SuitFaceoffTaunts = {'b': ['Do you have a donation for me?',
"I've been asked to pinch-hit.",
"I'll prove you're not dreaming.",
'Heads you lose, tails I win.',
'A Penny for your gags.'],
'A penny for your gags.'],
'tw': ['Things are about to get very tight.',
"That's Mr. Tightwad to you.",
"I'm going to cut off your funding.",
@ -2344,4 +2346,4 @@ AccessToString = {
500: '\x01androidGreen\x01Developer\x02',
600: '\x01cobalt\x01Admin\x02',
700: '\x01azure\x01System Admin\x02'
}
}

View file

@ -4,7 +4,6 @@ ReflectionCameraBitmask = BitMask32.bit(1)
ShadowCameraBitmask = BitMask32.bit(2)
SkyReflectionCameraBitmask = BitMask32.bit(3)
GlowCameraBitmask = BitMask32.bit(4)
EnviroCameraBitmask = BitMask32.bit(5)
def setCameraBitmask(default, node_path, camera_bitmask, tag = None, tag_function = None, context = None):
if node_path:

View file

@ -17,7 +17,7 @@ class Settings(collections.MutableMapping):
def write(self):
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):
self.store[key] = value

View file

@ -3,7 +3,8 @@ import random
from otp.ai.MagicWordGlobal import *
from toontown.fishing import FishGlobals
from toontown.fishing.FishBase import FishBase
from toontown.toonbase import TTLocalizer
from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.uberdog import TopToonsGlobals
class FishManagerAI:
@ -50,6 +51,7 @@ class FishManagerAI:
netlist = av.fishTank.getNetLists()
av.d_setFishTank(netlist[0], netlist[1], netlist[2])
del self.requestedFish[av.doId]
av.addStat(ToontownGlobals.STAT_FISH)
return [itemType, genus, species, weight]
if itemType == FishGlobals.FishItem:
success, genus, species, weight = FishGlobals.getRandomFishVitals(zoneId, av.getFishingRod())
@ -66,6 +68,8 @@ class FishManagerAI:
av.fishTank.addFish(fish)
netlist = av.fishTank.getNetLists()
av.d_setFishTank(netlist[0], netlist[1], netlist[2])
messenger.send('topToonsManager-event', [av.doId, TopToonsGlobals.CAT_FISH, 1])
av.addStat(ToontownGlobals.STAT_FISH)
return [itemType, genus, species, weight]
elif itemType == FishGlobals.BootItem:
return [itemType, 0, 0, 0]
@ -89,6 +93,8 @@ class FishManagerAI:
av.fishTank.addFish(fish)
netlist = av.fishTank.getNetLists()
av.d_setFishTank(netlist[0], netlist[1], netlist[2])
messenger.send('topToonsManager-event', [av.doId, TopToonsGlobals.CAT_FISH, 1])
av.addStat(ToontownGlobals.STAT_FISH)
return [itemType, genus, species, weight]
else:
money = FishGlobals.Rod2JellybeanDict[av.getFishingRod()]

View file

@ -9,15 +9,6 @@ CAROLING_REWARD = 100
SCAVENGER_HUNT_LOCATIONS = 6
Holidays = {
ToontownGlobals.LAUGHING_MAN: {
'startMonth': 6,
'startDay': 22,
'endMonth': 6,
'endDay': 22,
'startMessage': TTLocalizer.LaughingManHolidayStart,
'ongoingMessage': TTLocalizer.LaughingManHolidayOngoing,
'endMessage': TTLocalizer.LaughingManHolidayEnd
},
ToontownGlobals.GRAND_PRIX: {
'weekDay': 0,
'startMessage': TTLocalizer.CircuitRaceStart,

View file

@ -52,10 +52,7 @@ class NewsManager(DistributedObject):
self.endSpecialHoliday(id)
def startSpecialHoliday(self, id):
if id == ToontownGlobals.LAUGHING_MAN:
for toon in base.cr.toons.values():
toon.generateLaughingMan()
elif id == ToontownGlobals.APRIL_TOONS_WEEK:
if id == ToontownGlobals.APRIL_TOONS_WEEK:
if isinstance(base.cr.playGame.getPlace(), Estate.Estate):
base.localAvatar.startAprilToonsControls()
@ -68,10 +65,7 @@ class NewsManager(DistributedObject):
base.localAvatar.chatMgr.chatInputSpeedChat.addWinterMenu()
def endSpecialHoliday(self, id):
if id == ToontownGlobals.LAUGHING_MAN:
for toon in base.cr.toons.values():
toon.swapToonHead(laughingMan=toon.getWantLaughingMan())
elif id == ToontownGlobals.APRIL_TOONS_WEEK:
if id == ToontownGlobals.APRIL_TOONS_WEEK:
if isinstance(base.cr.playGame.getPlace(), Estate.Estate):
base.localAvatar.stopAprilToonsControls()

View file

@ -3,7 +3,8 @@ from toontown.building import FADoorCodes
from otp.ai.MagicWordGlobal import *
from toontown.hood import ZoneUtil
from toontown.quest import Quests
from toontown.uberdog import TopToonsGlobals
from toontown.toonbase import ToontownGlobals
QuestIdIndex = 0
QuestFromNpcIdIndex = 1
@ -75,6 +76,7 @@ class QuestManagerAI:
# If they've completed a quest.
if completeStatus == Quests.COMPLETE:
# ToonUp the toon to max health.
messenger.send('topToonsManager-event', [av.doId, TopToonsGlobals.CAT_TASKS, 1])
av.toonUp(av.maxHp)
# If it's a TrackChoiceQuest then present their track choices.
@ -91,6 +93,7 @@ class QuestManagerAI:
# The toon has completed this quest. Give them a reward!
npc.completeQuest(avId, questId, rewardId)
self.completeQuest(av, questId)
av.addStat(ToontownGlobals.STAT_TASKS)
break
else:
# They haven't completed any quests so we have to give them choices.
@ -289,6 +292,17 @@ class QuestManagerAI:
questList.append(questDesc)
av.b_setQuests(questList)
def toonCalledClarabelle(self, av):
avQuests = av.getQuests()
questList = []
for i in xrange(0, len(avQuests), 5):
questDesc = avQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[QuestIdIndex])
if isinstance(questClass, Quests.PhoneQuest) and questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE:
questDesc[QuestProgressIndex] += 1
questList.append(questDesc)
av.b_setQuests(questList)
def toonMadeNPCFriend(self, av, count, method):
avQuests = av.getQuests()
@ -437,6 +451,7 @@ class QuestManagerAI:
def toonKilledBuilding(self, av, type, difficulty, floors, zoneId, cogdo):
# Get the avatars current quests.
messenger.send('topToonsManager-event', [av.doId, TopToonsGlobals.CAT_BLDG, 1])
avQuests = av.getQuests()
questList = []
zoneId = ZoneUtil.getBranchZone(zoneId)
@ -491,6 +506,7 @@ class QuestManagerAI:
def toonKilledCogs(self, av, suitsKilled, zoneId):
# Get the avatar's current quests.
messenger.send('topToonsManager-event', [av.doId, TopToonsGlobals.CAT_COGS, len(suitsKilled)])
avQuests = av.getQuests()
questList = []

View file

@ -19,6 +19,10 @@ sys.path.append(
)
import argparse
import gc
# Panda3D 1.10.0 is 63.
gc.disable()
parser = argparse.ArgumentParser()
parser.add_argument('--base-channel', help='The base channel that the server may use.')
@ -60,6 +64,7 @@ simbase.air.connect(host, port)
try:
run()
gc.enable()
except SystemExit:
raise
except Exception:

View file

@ -46,12 +46,12 @@ from toontown.racing.LeaderboardMgrAI import LeaderboardMgrAI
from toontown.pets.PetManagerAI import PetManagerAI
from toontown.safezone.SafeZoneManagerAI import SafeZoneManagerAI
from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
from toontown.groups.GroupManagerAI import GroupManagerAI
from toontown.toon import NPCToons
from toontown.toonbase import ToontownGlobals
from toontown.tutorial.TutorialManagerAI import TutorialManagerAI
from toontown.uberdog.DistributedPartyManagerAI import DistributedPartyManagerAI
from toontown.uberdog.DistributedLobbyManagerAI import DistributedLobbyManagerAI
from toontown.uberdog.TopToonsManagerAI import TopToonsManagerAI
#from toontown.uberdog.DistributedLobbyManagerAI import DistributedLobbyManagerAI
class ToontownAIRepository(ToontownInternalRepository):
def __init__(self, baseChannel, stateServerChannel, districtName):
@ -71,7 +71,6 @@ class ToontownAIRepository(ToontownInternalRepository):
self.mintMgr = None
self.lawOfficeMgr = None
self.countryClubMgr = None
self.groupManager = GroupManagerAI(self)
self.zoneAllocator = UniqueIdAllocator(ToontownGlobals.DynamicZonesBegin,
ToontownGlobals.DynamicZonesEnd)
@ -86,6 +85,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.wantCogbuildings = self.config.GetBool('want-cogbuildings', True)
self.wantCogdominiums = self.config.GetBool('want-cogdominiums', True)
self.wantTrackClsends = self.config.GetBool('want-track-clsends', False)
self.wantTopToons = self.config.GetBool('want-top-toons', True)
self.baseXpMultiplier = self.config.GetFloat('base-xp-multiplier', 1.0)
self.cogSuitMessageSent = False
@ -103,7 +103,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.tutorialManager.generateWithRequired(2)
self.friendManager = FriendManagerAI(self)
self.friendManager.generateWithRequired(2)
self.questManager = QuestManagerAI(self)
self.questManager = QuestManagerAI(self)
self.banManager = BanManagerAI.BanManagerAI(self)
self.suitInvasionManager = SuitInvasionManagerAI(self)
self.blackCatMgr = DistributedBlackCatMgrAI(self)
@ -119,7 +119,8 @@ class ToontownAIRepository(ToontownInternalRepository):
self.codeRedemptionMgr.generateWithRequired(2)
self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self)
self.buildingQueryMgr.generateWithRequired(2)
self.groupManager.generateWithRequired(2)
if self.wantTopToons:
self.topToonsMgr = TopToonsManagerAI(self)
if self.wantKarts:
self.leaderboardMgr = LeaderboardMgrAI(self)
if self.wantFishing:
@ -136,10 +137,10 @@ class ToontownAIRepository(ToontownInternalRepository):
self.partyManager.generateWithRequired(2)
self.globalPartyMgr = self.generateGlobalObject(
OTP_DO_ID_GLOBAL_PARTY_MANAGER, 'GlobalPartyManager')
self.lobbyManager = DistributedLobbyManagerAI(self)
self.lobbyManager.generateWithRequired(2)
self.globalLobbyMgr = self.generateGlobalObject(
OTP_DO_ID_GLOBAL_LOBBY_MANAGER, 'GlobalLobbyManager')
#self.lobbyManager = DistributedLobbyManagerAI(self)
#self.lobbyManager.generateWithRequired(2)
#self.globalLobbyMgr = self.generateGlobalObject(
# OTP_DO_ID_GLOBAL_LOBBY_MANAGER, 'GlobalLobbyManager')
def createSafeZones(self):
NPCToons.generateZone2NpcDict()
@ -178,6 +179,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.cogHeadquarters.append(BossbotHQAI.BossbotHQAI(self))
def handleConnected(self):
ToontownInternalRepository.handleConnected(self)
self.districtId = self.allocateChannel()
self.notify.info('Creating ToontownDistrictAI(%d)...' % self.districtId)
self.distributedDistrict = ToontownDistrictAI(self)

View file

@ -721,7 +721,7 @@ class BattleCalculatorAI:
0,
0]
self.toonSkillPtsGained[id] = expList
expList[trk] = expList[trk] + (lvl + 1) * self.__skillCreditMultiplier
expList[trk] = min(ExperienceCap, expList[trk] + (lvl + 1) * self.__skillCreditMultiplier)
return
def __clearTgtDied(self, tgt, lastAtk, currAtk):

View file

@ -1,5 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownBattleGlobals
from toontown.toonbase import ToontownBattleGlobals, ToontownGlobals
from toontown.suit import SuitDNA
BattleExperienceAINotify = DirectNotifyGlobal.directNotify.newCategory('BattleExprienceAI')
@ -183,9 +183,15 @@ def assignRewards(activeToons, toonSkillPtsGained, suitsKilled, zoneId, helpfulT
if helpfulToons and toon.doId in helpfulToons:
simbase.air.questManager.toonKilledCogs(toon, suitsKilled, zoneId)
simbase.air.cogPageManager.toonKilledCogs(toon, suitsKilled, zoneId)
addStats(toon, suitsKilled)
else:
BattleExperienceAINotify.debug('toon=%d unhelpful not getting killed cog quest credit' % toon.doId)
else:
simbase.air.questManager.toonKilledCogs(toon, suitsKilled, zoneId)
simbase.air.cogPageManager.toonKilledCogs(toon, suitsKilled, zoneId)
return
addStats(toon, suitsKilled)
def addStats(toon, suitsKilled):
toon.addStat(ToontownGlobals.STAT_COGS, len(suitsKilled))
toon.addStat(ToontownGlobals.STAT_V2, len([suit for suit in suitsKilled if 'hasRevives' in suit and suit['hasRevives']]))
toon.addStat(ToontownGlobals.STAT_SKELE, len([suit for suit in suitsKilled if 'isSkelecog' in suit and suit['isSkelecog']]))

View file

@ -1366,6 +1366,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
if check == -1:
self.air.writeServerEvent('suspicious', toonId, 'Toon generating movie for non-existent gag track %s level %s' % (track, level))
self.notify.warning('generating movie for non-existent gag track %s level %s! avId: %s' % (track, level, toonId))
toon.addStat(ToontownGlobals.STAT_GAGS)
toon.d_setInventory(toon.inventory.makeNetString())
hps = attack[TOON_HP_COL]
if track == SOS:

View file

@ -338,7 +338,7 @@ class Movie(DirectObject.DirectObject):
self.tutorialTom = Toon.Toon()
dna = ToonDNA.ToonDNA()
dna.newToonFromProperties(*('dls', 'ms', 'm', 'm', 7, 0, 7, 7, 2, 6, 2, 6, 2, 16, 0))
dna.newToonFromProperties(*('dls', 'ms', 'm', 'm', 7, 0, 7, 7, 2, 6, 2, 6, 2, 16))
self.tutorialTom.setDNA(dna)
self.tutorialTom.setName(TTLocalizer.NPCToonNames[20000])
self.tutorialTom.setPickable(0)

View file

@ -11,6 +11,7 @@ from toontown.toonbase import ToontownBattleGlobals
import BattleParticles
import BattleProps
import MovieNPCSOS
import random
notify = DirectNotifyGlobal.directNotify.newCategory('MovieLures')
def safeWrtReparentTo(nodePath, parent):
@ -379,7 +380,7 @@ def __createSuitDamageTrack(battle, suit, hp, lure, trapProp):
explosionTrack = Sequence(Wait(2.3), createTNTExplosionTrack(battle, trapProp=trapProp, relativeTo=parent))
suitTrack = Sequence(ActorInterval(suit, 'flail', duration=0.7), ActorInterval(suit, 'flail', startTime=0.7, endTime=0.0), ActorInterval(suit, 'neutral', duration=0.4), ActorInterval(suit, 'flail', startTime=0.6, endTime=0.7), Wait(0.4), ActorInterval(suit, 'slip-forward', startTime=2.48, duration=0.1), Func(battle.movie.needRestoreColor), Func(suit.setColorScale, Vec4(0.2, 0.2, 0.2, 1)), Func(trapProp.reparentTo, hidden), ActorInterval(suit, 'slip-forward', startTime=2.58), Func(suit.clearColorScale), Func(trapProp.sparksEffect.cleanup), Func(battle.movie.clearRestoreColor))
damageTrack = Sequence(Wait(2.3), Func(suit.showHpText, -hp, openEnded=0), Func(suit.updateHealthBar, hp))
explosionSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
explosionSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart_%s.ogg' % random.randint(1, 6))
soundTrack = Sequence(SoundInterval(globalBattleSoundCache.getSound('TL_dynamite.ogg'), duration=2.0, node=suit), SoundInterval(explosionSound, duration=0.6, node=suit))
result.append(Parallel(tntTrack, suitTrack, damageTrack, explosionTrack, soundTrack))
elif trapName == 'traintrack':

View file

@ -267,7 +267,7 @@ def createSuitReviveTrack(suit, toon, battle, npcs = []):
suitTrack.append(Func(suit.loop, 'neutral'))
suitTrack.append(Func(messenger.send, suit.uniqueName('hpChange')))
spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg')
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart_%s.ogg' % random.randint(1, 6))
deathSoundTrack = Sequence(Wait(0.8), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8), SoundInterval(deathSound, volume=0.32))
BattleParticles.loadParticles()
smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
@ -312,7 +312,7 @@ def createSuitDeathTrack(suit, toon, battle, npcs = []):
suitTrack.append(Func(removeDeathSuit, suit, deathSuit, name='remove-death-suit'))
suitTrack.append(Func(notify.debug, 'after removeDeathSuit'))
spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg')
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart_%s.ogg' % random.randint(1, 6))
deathSoundTrack = Sequence(Wait(0.8), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8), SoundInterval(deathSound, volume=0.32))
BattleParticles.loadParticles()
smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')

View file

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

View file

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

View file

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

View file

@ -105,17 +105,17 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
merger = False
if invitee and invitee.battleId != 0:
reason = BoardingPartyBase.BOARDCODE_BATTLE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0])
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return
if self.hasPendingInvite(inviteeId):
reason = BoardingPartyBase.BOARDCODE_PENDING_INVITE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0])
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return
if self.__isInElevator(inviteeId):
reason = BoardingPartyBase.BOARDCODE_IN_ELEVATOR
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0])
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return
if self.hasActiveGroup(inviteeId):
@ -127,7 +127,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
# group merge already requested?
if self.hasPendingInvite(inviteeLeaderId):
reason = BoardingPartyBase.BOARDCODE_PENDING_INVITE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0])
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return
@ -137,13 +137,13 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
inviteeId = inviteeLeaderId
merger = True
else:
reason = BoardingPartyBase.BOARDCODE_GROUPS_TO_LARGE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0])
reason = BoardingPartyBase.BOARDCODE_GROUPS_TOO_LARGE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return
else:
reason = BoardingPartyBase.BOARDCODE_DIFF_GROUP
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0])
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return
# 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..
if len(self.elevatorIdList) == 1:
if inviteeOkay:
if inviteeOkay == REJECT_MINLAFF:
reason = BoardingPartyBase.BOARDCODE_MINLAFF
elif inviteeOkay == REJECT_PROMOTION:
if inviteeOkay == REJECT_PROMOTION:
reason = BoardingPartyBase.BOARDCODE_PROMOTION
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, self.elevatorIdList[0]])
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
return
else:
inviterOkay = self.checkBoard(inviterId, self.elevatorIdList[0])
if inviterOkay:
if inviterOkay == REJECT_MINLAFF:
reason = BoardingPartyBase.BOARDCODE_MINLAFF
elif inviterOkay == REJECT_PROMOTION:
if inviterOkay == REJECT_PROMOTION:
reason = BoardingPartyBase.BOARDCODE_PROMOTION
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviterId, reason, self.elevatorIdList[0]])
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviterId, reason])
return
# 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:
@ -277,8 +273,8 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
return
# Lets make sure we still CAN merge them in
if ((len(self.getGroupMemberList(leaderId)) + len(self.getGroupMemberList(inviteeId))) > self.maxSize):
reason = BoardingPartyBase.BOARDCODE_GROUPS_TO_LARGE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason, 0])
reason = BoardingPartyBase.BOARDCODE_GROUPS_TOO_LARGE
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviteeId, reason])
self.sendUpdateToAvatarId(inviteeId, 'postMessageInvitationFailed', [inviterId])
return
group = self.groupListDict.get(leaderId)
@ -365,9 +361,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
avatar = simbase.air.doId2do.get(avId)
if avatar:
if elevator.checkBoard(avatar) != 0:
if elevator.checkBoard(avatar) == REJECT_MINLAFF:
boardOkay = BoardingPartyBase.BOARDCODE_MINLAFF
elif elevator.checkBoard(avatar) == REJECT_PROMOTION:
if elevator.checkBoard(avatar) == REJECT_PROMOTION:
boardOkay = BoardingPartyBase.BOARDCODE_PROMOTION
avatarsFailingRequirements.append(avId)
elif avatar.battleId != 0:
@ -382,8 +376,6 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
boardOkay = BoardingPartyBase.BOARDCODE_SPACE
if boardOkay != BoardingPartyBase.BOARDCODE_OKAY:
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:
self.notify.debug('An avatar did not meet the elevator promotion requirements')
elif boardOkay == BoardingPartyBase.BOARDCODE_BATTLE:

View file

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

View file

@ -435,7 +435,9 @@ class DistributedBuilding(DistributedObject.DistributedObject):
return
dnaStore = self.cr.playGame.dnaStore
level = int(self.difficulty / 2) + 1
suitNP = dnaStore.findNode('suit_landmark_' + chr(self.track) + str(level))
if level > 5:
self.notify.warning('Level is bigger than 5: %s' % level)
suitNP = dnaStore.findNode('suit_landmark_' + chr(self.track) + str(min(level, 5)))
zoneId = dnaStore.getZoneFromBlockNumber(self.block)
newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId]
suitBuildingNP = suitNP.copyTo(newParentNP)

View file

@ -23,7 +23,7 @@ from toontown.cogdominium.CogdoLayout import CogdoLayout
from toontown.cogdominium.SuitPlannerCogdoInteriorAI import SuitPlannerCogdoInteriorAI
from toontown.hood import ZoneUtil
from toontown.toonbase.ToontownGlobals import ToonHall
from toontown.toonbase import ToontownGlobals
class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
def __init__(self, air, blockNumber, zoneId, trophyMgr):
@ -292,6 +292,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
self.air.writeServerEvent('buildingDefeated', t, '%s|%s|%s|%s' % (self.track, self.numFloors, self.zoneId, victorList))
if toon is not None:
self.air.questManager.toonKilledBuilding(toon, self.track, self.difficulty, self.numFloors, self.zoneId, 0)
toon.addStat(ToontownGlobals.STAT_BLDG)
for i in xrange(0, 4):
victor = victorList[i]
if (victor is None) or (victor not in self.air.doId2do):
@ -329,6 +330,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
if toon != None:
self.air.questManager.toonKilledBuilding(toon, self.track, self.difficulty, 5, self.zoneId, 1)
toon.addStat(ToontownGlobals.STAT_COGDO)
continue
victorList.extend([None, None, None, None])

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,6 +10,7 @@ from direct.distributed import DistributedObject
from direct.fsm import State
from toontown.battle import BattleBase
from toontown.hood import ZoneUtil
from toontown.suit import SuitDNA
class DistributedSuitInterior(DistributedObject.DistributedObject):
id = 0
@ -249,14 +250,15 @@ class DistributedSuitInterior(DistributedObject.DistributedObject):
def __playElevator(self, ts, name, callback):
SuitHs = []
SuitPositions = []
DeptName = SuitDNA.suitDeptFilenames[self.suits[0].style.dept]
if self.floorModel:
self.floorModel.removeNode()
if self.currentFloor == 0:
self.floorModel = loader.loadModel('phase_7/models/modules/suit_interior')
self.floorModel = loader.loadModel('phase_7/models/modules/suit_interior_%s' % DeptName)
SuitHs = self.BottomFloor_SuitHs
SuitPositions = self.BottomFloor_SuitPositions
elif self.currentFloor == self.numFloors - 1:
self.floorModel = loader.loadModel('phase_7/models/modules/boss_suit_office')
self.floorModel = loader.loadModel('phase_7/models/modules/boss_suit_office_%s' % DeptName)
SuitHs = self.BossOffice_SuitHs
SuitPositions = self.BossOffice_SuitPositions
else:

View file

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

View file

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

View file

@ -15,45 +15,6 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
self.isSpecial = isSpecial
CatalogItem.CatalogItem.makeNewItem(self)
def storedInTrunk(self):
return 1
def notOfferedTo(self, avatar):
article = AccessoryTypes[self.accessoryType][ATArticle]
if article in [AHat,
AGlasses,
ABackpack,
AShoes]:
return 0
forBoys = article in [ABoysHat,
ABoysGlasses,
ABoysBackpack,
ABoysShoes]
if avatar.getStyle().getGender() == 'm':
return not forBoys
else:
return forBoys
def forBoysOnly(self):
article = AccessoryTypes[self.accessoryType][ATArticle]
if article in [ABoysHat,
ABoysGlasses,
ABoysBackpack,
ABoysShoes]:
return 1
else:
return 0
def forGirlsOnly(self):
article = AccessoryTypes[self.accessoryType][ATArticle]
if article in [AGirlsHat,
AGirlsGlasses,
AGirlsBackpack,
AGirlsShoes]:
return 1
else:
return 0
def getPurchaseLimit(self):
return 1
@ -64,8 +25,6 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
return 1
if avatar.mailboxContents.count(self) != 0:
return 1
if self in avatar.awardMailboxContents or self in avatar.onAwardOrder:
return 1
str = AccessoryTypes[self.accessoryType][ATString]
if self.isHat():
defn = ToonDNA.HatStyles[str]
@ -122,10 +81,7 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
def recordPurchase(self, avatar, optional):
if avatar.isTrunkFull():
if avatar.getMaxAccessories() == 0:
return ToontownGlobals.P_NoTrunk
else:
return ToontownGlobals.P_NoRoomForItem
return ToontownGlobals.P_NoRoomForItem
str = AccessoryTypes[self.accessoryType][ATString]
if self.isHat():
defn = ToonDNA.HatStyles[str]
@ -218,6 +174,9 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
avatar.d_catalogGenAccessories()
return ToontownGlobals.P_ItemAvailable
def getDeliveryTime(self):
return 60
def getPicture(self, avatar):
model = self.loadModel()
spin = 1
@ -239,7 +198,6 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
model.setColorScale(color, 1)
if needsAlpha:
model.setTransparency(1)
return
def loadModel(self):
modelPath = self.getFilename()
@ -264,17 +222,14 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
from toontown.toontowngui import TTDialog
avatar = base.localAvatar
accessoriesOnOrder = 0
for item in avatar.onOrder + avatar.mailboxContents:
if item.storedInTrunk():
for item in avatar.onOrder + avatar.mailboxContents + avatar.onGiftOrder:
if hasattr(item, 'isHat'):
accessoriesOnOrder += 1
if avatar.isTrunkFull(accessoriesOnOrder):
self.requestPurchaseCleanup()
buttonCallback = PythonUtil.Functor(self.__handleFullPurchaseDialog, phone, callback)
if avatar.getMaxAccessories() == 0:
text = TTLocalizer.CatalogPurchaseNoTrunk
else:
text = TTLocalizer.CatalogPurchaseTrunkFull
text = TTLocalizer.CatalogPurchaseTrunkFull
self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=text, text_wordwrap=15, command=buttonCallback)
self.dialog.show()
else:
@ -305,25 +260,19 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
return TTLocalizer.CatalogAcceptShoes
elif retcode == ToontownGlobals.P_NoRoomForItem:
return TTLocalizer.CatalogAcceptTrunkFull
elif retcode == ToontownGlobals.P_NoTrunk:
return TTLocalizer.CatalogAcceptNoTrunk
return CatalogItem.CatalogItem.getAcceptItemErrorText(self, retcode)
def isHat(self):
article = AccessoryTypes[self.accessoryType][ATArticle]
return article in [AHat, ABoysHat, AGirlsHat]
return AccessoryTypes[self.accessoryType][ATArticle] == AHat
def areGlasses(self):
article = AccessoryTypes[self.accessoryType][ATArticle]
return article in [AGlasses, ABoysGlasses, AGirlsGlasses]
return AccessoryTypes[self.accessoryType][ATArticle] == AGlasses
def isBackpack(self):
article = AccessoryTypes[self.accessoryType][ATArticle]
return article in [ABackpack, ABoysBackpack, AGirlsBackpack]
return AccessoryTypes[self.accessoryType][ATArticle] == ABackpack
def areShoes(self):
article = AccessoryTypes[self.accessoryType][ATArticle]
return article in [AShoes, ABoysShoes, AGirlsShoes]
return AccessoryTypes[self.accessoryType][ATArticle] == AShoes
def output(self, store = -1):
return 'CatalogAccessoryItem(%s%s)' % (self.accessoryType, self.formatOptionalData(store))

View file

@ -7,15 +7,6 @@ AHat = 0
AGlasses = 1
ABackpack = 2
AShoes = 3
ABoysHat = 4
ABoysGlasses = 5
ABoysBackpack = 6
ABoysShoes = 7
AGirlsHat = 8
AGirlsGlasses = 9
AGirlsBackpack = 10
AGirlsShoes = 11
APriceTest = 5
APriceBasic = 250
APriceBasicPlus = 400
APriceCool = 800
@ -28,7 +19,7 @@ AccessoryTypes = {101: (AHat,
'hsf1',
APriceCool,
5),
103: (AGirlsHat,
103: (AHat,
'hrb1',
APriceBasic,
1),
@ -40,11 +31,11 @@ AccessoryTypes = {101: (AHat,
'hsf3',
APriceCool,
0),
106: (AGirlsHat,
106: (AHat,
'hrb2',
APriceBasicPlus,
3),
107: (AGirlsHat,
107: (AHat,
'hrb3',
APriceBasicPlus,
0),
@ -96,7 +87,7 @@ AccessoryTypes = {101: (AHat,
'hpb1',
APriceBasicPlus,
6),
120: (ABoysHat,
120: (AHat,
'hcr1',
10000,
5),
@ -132,23 +123,23 @@ AccessoryTypes = {101: (AHat,
'hst1',
APriceBasicPlus,
1),
129: (AGirlsHat,
129: (AHat,
'hsu1',
APriceCool,
1),
130: (AGirlsHat,
130: (AHat,
'hrb4',
APriceBasic,
1),
131: (AGirlsHat,
131: (AHat,
'hrb5',
APriceBasicPlus,
4),
132: (AGirlsHat,
132: (AHat,
'hrb6',
APriceBasic,
2),
133: (AGirlsHat,
133: (AHat,
'hrb7',
APriceBasicPlus,
6),
@ -156,7 +147,7 @@ AccessoryTypes = {101: (AHat,
'hat1',
APriceCool,
2),
135: (AGirlsHat,
135: (AHat,
'hhd1',
APriceCool,
2),
@ -188,11 +179,11 @@ AccessoryTypes = {101: (AHat,
'hft2',
APriceCool,
6),
143: (ABoysHat,
143: (AHat,
'hhd2',
APriceCool,
3),
144: (AGirlsHat,
144: (AHat,
'hpc1',
APriceCool,
5),
@ -208,7 +199,7 @@ AccessoryTypes = {101: (AHat,
'hat2',
APriceCool,
2),
148: (AGirlsHat,
148: (AHat,
'htr1',
10000,
3),
@ -280,7 +271,7 @@ AccessoryTypes = {101: (AHat,
'hby1',
APriceAwesome,
5),
166: (AGirlsHat,
166: (AHat,
'hrb8',
APriceBasicPlus,
6),
@ -292,7 +283,7 @@ AccessoryTypes = {101: (AHat,
'hbb7',
APriceBasic,
6),
169: (AGirlsHat,
169: (AHat,
'hrb9',
APriceBasicPlus,
6),
@ -300,7 +291,7 @@ AccessoryTypes = {101: (AHat,
'hwt2',
APriceAwesome,
4),
171: (AGirlsHat,
171: (AHat,
'hhw1',
APriceBasicPlus,
7),
@ -412,11 +403,11 @@ AccessoryTypes = {101: (AHat,
'gsr1',
APriceBasicPlus,
5),
223: (ABoysGlasses,
223: (AGlasses,
'ghw1',
APriceTest,
APriceBasic,
0),
224: (ABoysGlasses,
224: (AGlasses,
'ghw2',
APriceBasic,
7),
@ -564,11 +555,11 @@ AccessoryTypes = {101: (AHat,
'scs1',
APriceBasicPlus,
6),
405: (ABoysShoes,
405: (AShoes,
'swt1',
APriceBasicPlus,
1),
406: (AGirlsShoes,
406: (AShoes,
'smj1',
APriceBasicPlus,
1),
@ -604,11 +595,11 @@ AccessoryTypes = {101: (AHat,
'sht1',
APriceAwesome,
4),
415: (AGirlsShoes,
415: (AShoes,
'smj2',
APriceBasicPlus,
3),
416: (AGirlsShoes,
416: (AShoes,
'smj3',
APriceBasicPlus,
4),
@ -664,7 +655,7 @@ AccessoryTypes = {101: (AHat,
'slf1',
APriceBasicPlus,
3),
430: (AGirlsShoes,
430: (AShoes,
'smj4',
APriceBasicPlus,
2),

View file

@ -16,9 +16,7 @@ class CatalogBeanItem(CatalogItem.CatalogItem):
return 0
def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder:
return 1
return 0
return self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder
def getAcceptItemErrorText(self, retcode):
if retcode == ToontownGlobals.P_ItemAvailable:

View file

@ -15,9 +15,7 @@ class CatalogChatItem(CatalogItem.CatalogItem):
return 1
def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder:
return 1
return avatar.customMessages.count(self.customIndex) != 0
return self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or avatar.customMessages.count(self.customIndex) != 0
def getTypeName(self):
return TTLocalizer.ChatTypeName

View file

@ -291,7 +291,7 @@ ClothingTypes = {101: (ABoysShirt, 'bss1', 40),
1818: (AGirlsSkirt, 'sa_gs20', 5000),
1819: (AGirlsSkirt, 'sa_gs21', 5000),
1820: (AShirt, 'sa_ss55', 5000),
1821: (AShirt, 'weed', 5000)}
1821: (AShirt, 'flannel', 300)}
class CatalogClothingItem(CatalogItem.CatalogItem):
@ -338,8 +338,6 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
return 1
if avatar.mailboxContents.count(self) != 0:
return 1
if self in avatar.awardMailboxContents or self in avatar.onAwardOrder:
return 1
str = ClothingTypes[self.clothingType][CTString]
dna = avatar.getStyle()
if self.isShirt():
@ -374,7 +372,7 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
return TTLocalizer.ClothingArticleNames[article]
def recordPurchase(self, avatar, optional):
if avatar.isClosetFull():
if avatar.isClosetFull(1):
return ToontownGlobals.P_NoRoomForItem
str = ClothingTypes[self.clothingType][CTString]
dna = avatar.getStyle()
@ -419,7 +417,7 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
return ToontownGlobals.P_ItemAvailable
def getDeliveryTime(self):
return 1
return 60
def getPicture(self, avatar):
from toontown.toon import Toon

View file

@ -17,7 +17,7 @@ class CatalogEmoteItem(CatalogItem.CatalogItem):
return 1
def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder:
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder:
return 1
if self.emoteIndex >= len(avatar.emoteAccess):
return 0

View file

@ -17,11 +17,14 @@ FLRug = 4
FLPainting = 8
FLOnTable = 16
FLIsTable = 32
FLPhone = 64
FLBillboard = 128
FLTrunk = 256
FLBoysOnly = 512
FLGirlsOnly = 1024
FLBillboard = 64
FLPhone = 128
FLCrate = 256
FLChair = 512
FLTV = 1024
FLTrunk = 2048
FLBoysOnly = 4096
FLGirlsOnly = 8192
furnitureColors = [
(0.792, 0.353, 0.29, 1.0),
(0.176, 0.592, 0.439, 1.0),
@ -70,20 +73,36 @@ for closetId, maxClothes in ClosetToClothes.items():
ClothesToCloset[maxClothes] += (closetId,)
MaxClosetIds = (508, 518)
MaxTrunkIds = (4000, 4010)
TvToPosScale = {
1530: ((-1.15, -0.5, 1.1), (2.5, 1.7, 1.4)),
1531: ((-2.3, -0.2, 1.6), (5, 5, 5)),
1532: ((-7, -0.2, 1.8), (15, 10, 8.5))
1531: ((-2.3, -0.2, 2.522), (5, 3.75, 3.187)),
1532: ((-7, -0.2, 2.8), (15, 10, 7.8))
}
ChairToPosHpr = {
100: ((0, -3.9, 0.88), (180, 0, 0), (0, -4.9, 0), -3.0),
105: ((0, -3.9, 0.88), (180, 0, 0), (0, -4.9, 0), -3.0),
110: ((0, -1.6, 0.5), (180, 0, 0), (0, -2.6, 0), 0.0),
120: ((0, -1.6, 0.5), (180, 0, 0), (0, -2.6, 0), 0.0),
130: ((0, -2.8, 0.5), (180, 0, 0), (0, -3.8, 0), -2.0),
140: ((0, -1.6, 0.5), (180, 0, 0), (0, -2.6, 0), 0.0),
145: ((0, -2.1, 0.2), (180, 0, 0), (0, -3.1, 0), 0.0),
160: ((-1.7, 0, 0.9), (90, 0, 0), (-2.7, 0, 0), 0.0),
170: ((0, 1.8, 0.4), (0, 0, 0), (0, 2.8, 0), 0.0),
700: ((0, -1.2, 0.5), (180, 0, 0), (0, -2.2, 0), 0.0),
705: ((0, -1.2, 0.5), (180, 0, 0), (0, -2.2, 0), 0.0),
710: ((0, -1.1, 0.4), (180, 0, 0), (0, -2.1, 0), 0.0),
715: ((0, -1.1, 0.4), (180, 0, 0), (0, -2.1, 0), 0.0),
720: ((0, -2.7, 0.2), (180, 0, 0), (0, -3.7, 0), -3.0)
}
FurnitureTypes = {
100: ('phase_5.5/models/estate/chairA', # Model
None, # Color
None, # Color Options
80), # Base Price
# Flags
80, # Base Price
FLChair), # Flags
# Scale
105: ('phase_5.5/models/estate/chairAdesat',
None,
@ -93,27 +112,33 @@ FurnitureTypes = {
3: (('**/cushion*', furnitureColors[3]), ('**/arm*', furnitureColors[3])),
4: (('**/cushion*', furnitureColors[4]), ('**/arm*', furnitureColors[4])),
5: (('**/cushion*', furnitureColors[5]), ('**/arm*', furnitureColors[5]))},
160),
160,
FLChair),
110: ('phase_3.5/models/modules/chair',
None,
None,
40),
40,
FLChair),
120: ('phase_5.5/models/estate/deskChair',
None,
None,
60),
60,
FLChair),
130: ('phase_5.5/models/estate/BugRoomChair',
None,
None,
160),
160,
FLChair),
140: ('phase_5.5/models/estate/UWlobsterChair',
None,
None,
200),
200,
FLChair),
145: ('phase_5.5/models/estate/UWlifeSaverChair',
None,
None,
200),
200,
FLChair),
150: ('phase_5.5/models/estate/West_saddleStool2',
None,
None,
@ -121,11 +146,13 @@ FurnitureTypes = {
160: ('phase_5.5/models/estate/West_nativeChair',
None,
None,
160),
160,
FLChair),
170: ('phase_5.5/models/estate/cupcakeChair',
None,
None,
240),
240,
FLChair),
200: ('phase_5.5/models/estate/regular_bed',
None,
None,
@ -415,7 +442,8 @@ FurnitureTypes = {
700: ('phase_3.5/models/modules/couch_1person',
None,
None,
230),
230,
FLChair),
705: ('phase_5.5/models/estate/couch_1personDesat',
None,
{0: (('**/*couch', furnitureColors[0]),),
@ -424,11 +452,13 @@ FurnitureTypes = {
3: (('**/*couch', furnitureColors[3]),),
4: (('**/*couch', furnitureColors[4]),),
5: (('**/*couch', furnitureColors[5]),)},
460),
460,
FLChair),
710: ('phase_3.5/models/modules/couch_2person',
None,
None,
230),
230,
FLChair),
715: ('phase_5.5/models/estate/couch_2personDesat',
None,
{0: (('**/*couch', furnitureColors[0]),),
@ -437,11 +467,13 @@ FurnitureTypes = {
3: (('**/*couch', furnitureColors[3]),),
4: (('**/*couch', furnitureColors[4]),),
5: (('**/*couch', furnitureColors[5]),)},
460),
460,
FLChair),
720: ('phase_5.5/models/estate/West_HayCouch',
None,
None,
420),
420,
FLChair),
730: ('phase_5.5/models/estate/twinkieCouch',
None,
None,
@ -721,15 +753,18 @@ FurnitureTypes = {
1530: ('phase_5.5/models/estate/bugRoomTV',
None,
None,
675),
675,
FLTV),
1531: ('phase_5.5/models/estate/bugRoomTV_50inch',
None,
None,
1250),
1250,
FLTV),
1532: ('phase_5.5/models/estate/bugRoomTV_100inch',
None,
None,
5000),
5000,
FLTV),
1600: ('phase_5.5/models/estate/vaseA_short',
None,
None,
@ -892,7 +927,13 @@ FurnitureTypes = {
None,
None,
200,
FLPainting)
FLPainting),
10040: ('phase_10/models/cashbotHQ/CBWoodCrate',
None,
None,
0,
FLCrate,
0.5)
}
class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
@ -910,7 +951,7 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
return 1
def replacesExisting(self):
return self.getFlags() & (FLCloset | FLBank | FLTrunk) != 0
return self.getFlags() & (FLCloset | FLBank) != 0
def hasExisting(self):
return 1
@ -920,16 +961,14 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
return TTLocalizer.FurnitureYourOldCloset
elif self.getFlags() & FLBank:
return TTLocalizer.FurnitureYourOldBank
elif self.getFlags() & FLTrunk:
return TTLocalizer.FurnitureYourOldTrunk
else:
return None
return None
def notOfferedTo(self, avatar):
if self.getFlags() & FLCloset or self.getFlags() & FLTrunk:
if self.getFlags() & FLCloset:
decade = self.furnitureType - self.furnitureType % 10
forBoys = (decade == 500 or decade == 4000)
forBoys = decade == 500
if avatar.getStyle().getGender() == 'm':
return not forBoys
else:
@ -955,9 +994,6 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
def isDeletable(self):
return self.getFlags() & (FLBank | FLCloset | FLPhone | FLTrunk) == 0
def getMaxAccessories(self):
return ToontownGlobals.MaxAccessories
def getMaxBankMoney(self):
return BankToMoney.get(self.furnitureType)
@ -975,11 +1011,6 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
return 1
if self in avatar.onOrder or self in avatar.mailboxContents:
return 1
if self.getFlags() & FLTrunk:
if self.getMaxAccessories() <= avatar.getMaxAccessories():
return 1
if self in avatar.onOrder or self in avatar.mailboxContents:
return 1
return 0
def getTypeName(self):
@ -1007,29 +1038,25 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
def isGift(self):
if self.getEmblemPrices():
return 0
if self.getFlags() & (FLCloset | FLBank | FLTrunk):
if self.getFlags() & (FLCloset | FLBank):
return 0
else:
return 1
def recordPurchase(self, avatar, optional):
house, retcode = self.getHouseInfo(avatar)
self.giftTag = None
if retcode >= 0:
if self.getFlags() & FLCloset:
if avatar.getMaxClothes() > self.getMaxClothes():
return ToontownGlobals.P_AlreadyOwnBiggerCloset
avatar.b_setMaxClothes(self.getMaxClothes())
if self.getFlags() & FLTrunk:
avatar.b_setMaxAccessories(self.getMaxAccessories())
if self.getFlags() & FLBank:
avatar.b_setMaxBankMoney(self.getMaxBankMoney())
return retcode
house.addAtticItem(self)
return retcode
def getDeliveryTime(self):
return 1
return 24 * 60
def getPicture(self, avatar):
model = self.loadModel(animate=0)
@ -1084,38 +1111,7 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
model.setScale(scale)
model.flattenLight()
if animate and self.furnitureType in TvToPosScale:
pos = TvToPosScale[self.furnitureType]
screen = NodePath(CardMaker('tv-screen').generate())
model.find('**/toonTownBugTV_screen').hide()
screen.reparentTo(model)
screen.setScale(*pos[1])
screen.setPos(*pos[0])
self.startVideo(screen)
return model
def startVideo(self, model, file=None):
files = glob.glob('user/videos/*.mp4')
if not files:
model.setTextureOff(TextureStage.getDefault())
model.setColor(0.3, 0.3, 0.3, 1.0)
return
if file is None:
file = random.randint(0, len(files) - 1)
elif file >= len(files):
file = 0
movie = loader.loadTexture(files[file])
sound = loader.loadSfx(files[file])
movie.synchronizeTo(sound)
model.setTexture(movie)
model.setTexScale(TextureStage.getDefault(), movie.getTexScale())
self.videoSequence = Sequence(SoundInterval(sound, volume=1.0), Func(self.startVideo, model, file + 1))
self.videoSequence.start()
def decodeDatagram(self, di, versionNumber, store):
CatalogAtticItem.CatalogAtticItem.decodeDatagram(self, di, versionNumber, store)
@ -1210,29 +1206,6 @@ def getAllBanks():
return list
def get50ItemTrunk(avatar, duplicateItems):
if config.GetBool('want-accessories', 1):
if avatar.getStyle().getGender() == 'm':
index = 0
else:
index = 1
trunkId = MaxTrunkIds[index]
item = CatalogFurnitureItem(trunkId)
if item in avatar.onOrder or item in avatar.mailboxContents:
return None
return item
# If we get here, we probably don't want accessories yet.
return None
def getMaxTrunks():
list = []
for trunkId in MaxTrunkIds:
list.append(CatalogFurnitureItem(trunkId))
return list
def getAllFurnitures(index):
list = []
colors = FurnitureTypes[index][FTColorOptions]

View file

@ -22,11 +22,6 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
else:
return 100
def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder:
return 1
return 0
def getAcceptItemErrorText(self, retcode):
if retcode == ToontownGlobals.P_ItemAvailable:
return TTLocalizer.CatalogAcceptGarden
@ -39,17 +34,16 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
return TTLocalizer.GardenTypeName
def getName(self):
name = GardenGlobals.Specials[self.gardenIndex]['photoName']
return name
return GardenGlobals.Specials[self.gardenIndex]['photoName']
def recordPurchase(self, avatar, optional):
if avatar:
avatar.addGardenItem(self.gardenIndex, self.numItems)
if 1:
return ToontownGlobals.P_ItemAvailable
return ToontownGlobals.P_ItemAvailable
def getPicture(self, avatar):
photoModel = GardenGlobals.Specials[self.gardenIndex]['photoModel']
if 'photoAnimation' in GardenGlobals.Specials[self.gardenIndex]:
modelPath = photoModel + GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][0]
animationName = GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][1]
@ -75,7 +69,6 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
self.model.setScale(photoScale)
self.hasPicture = True
return (frame, None)
return None
def cleanupPicture(self):
CatalogItem.CatalogItem.cleanupPicture(self)
@ -126,7 +119,7 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
def getDeliveryTime(self):
if self.gardenIndex == GardenGlobals.GardenAcceleratorSpecial:
return 1
return 24 * 60
else:
return 0

View file

@ -15,7 +15,7 @@ class CatalogGardenStarterItem(CatalogItem.CatalogItem):
def getPurchaseLimit(self):
return 0
def reachedPurchaseLimit(self, avatar):
def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder or hasattr(avatar, 'gardenStarted') and avatar.getGardenStarted():
return 1
return 0
@ -31,13 +31,13 @@ class CatalogGardenStarterItem(CatalogItem.CatalogItem):
def recordPurchase(self, avatar, optional):
if avatar:
estate = simbase.air.estateManager.toon2estate.get(avatar)
self.notify.debug('rental -- has avatar')
estate = simbase.air.estateManager._lookupEstate(avatar)
if estate:
av = simbase.air.doId2do.get(avatar)
if av:
av.b_setGardenStarted(True)
print('garden saved')
estate.placeStarterGarden(avatar)
self.notify.debug('rental -- has estate')
estate.placeStarterGarden(avatar.doId)
else:
self.notify.warning('rental -- something not there')
return ToontownGlobals.P_ItemAvailable
def getPicture(self, avatar):

View file

@ -1,7 +1,7 @@
from direct.directnotify import DirectNotifyGlobal
import CatalogItem
import CatalogItemList
from CatalogFurnitureItem import CatalogFurnitureItem, nextAvailableCloset, nextAvailableBank, getAllClosets, get50ItemCloset, getMaxClosets, get50ItemTrunk, getAllBanks
from CatalogFurnitureItem import CatalogFurnitureItem, nextAvailableCloset, nextAvailableBank, getAllClosets, get50ItemCloset, getMaxClosets, getAllBanks
from CatalogAnimatedFurnitureItem import CatalogAnimatedFurnitureItem
from CatalogClothingItem import CatalogClothingItem, getAllClothes
from CatalogChatItem import CatalogChatItem, getChatRange
@ -12,8 +12,8 @@ from CatalogMouldingItem import CatalogMouldingItem, getAllMouldings
from CatalogWainscotingItem import CatalogWainscotingItem, getAllWainscotings
from CatalogWindowItem import CatalogWindowItem
from CatalogPoleItem import nextAvailablePole, getAllPoles
from CatalogTankItem import nextAvailableTank, getAllTanks
from CatalogPetTrickItem import CatalogPetTrickItem, getAllPetTricks
from CatalogTankItem import nextAvailableTank, getAllTanks
from CatalogGardenItem import CatalogGardenItem
from CatalogToonStatueItem import CatalogToonStatueItem
from CatalogRentalItem import CatalogRentalItem
@ -26,7 +26,7 @@ from toontown.toonbase import ToontownGlobals
import types
import random
import time
from panda3d.core import *
from pandac.PandaModules import *
MetaItems = {100: getAllClothes(101, 102, 103, 104, 105, 106, 107, 108, 109, 109, 111, 115, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 211, 215),
300: getAllClothes(301, 302, 303, 304, 305, 308, 401, 403, 404, 405, 407, 451, 452, 453),
2000: getChatRange(0, 1999),
@ -41,25 +41,20 @@ MetaItems = {100: getAllClothes(101, 102, 103, 104, 105, 106, 107, 108, 109, 109
2921: getChatRange(12050, 12099),
2930: getChatRange(13000, 13099),
2940: getChatRange(14000, 14099),
3000: getWallpapers(1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100),
3010: getWallpapers(2200, 2300, 2400, 2500, 2600, 2700, 2800),
3020: getWallpapers(2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600),
3030: getWallpapers(3700, 3800, 3900),
3500: getAllWainscotings(1000, 1010),
3510: getAllWainscotings(1020),
3520: getAllWainscotings(1030),
3530: getAllWainscotings(1040),
4000: getFloorings(1000, 1010, 1020, 1030, 1040, 1050, 1060, 1070, 1080, 1090, 1100),
4010: getFloorings(1110, 1120, 1130),
4020: getFloorings(1140, 1150, 1160, 1170, 1180, 1190),
4500: getAllMouldings(1000, 1010),
4510: getAllMouldings(1020, 1030, 1040),
4520: getAllMouldings(1070),
5000: getAllPetTricks()}
MetaItemChatKeysSold = (2000,
2010,
@ -401,7 +396,29 @@ MonthlySchedule = ((7,
15,
8,
15,
2010,
2010,
((4, 2940),)),
(9,
1,
9,
30,
(CatalogGardenItem(135, 1),)),
(1,
1,
1,
31,
(CatalogGardenItem(135, 1),)),
(4,
1,
4,
30,
(CatalogGardenItem(135, 1),)),
(6,
1,
6,
30,
(CatalogGardenItem(135, 1),)),
(6,
26,
7,
@ -460,16 +477,22 @@ MonthlySchedule = ((7,
9,
7,
15,
2010,
2010,
(CatalogClothingItem(1751, 0),)),
(6,
14,
7,
15,
2010,
2010,
(CatalogClothingItem(1754, 0), CatalogClothingItem(1755, 0), CatalogClothingItem(1756, 0))),
(7,
21,
8,
17,
2010,
2010,
(CatalogClothingItem(1749, 0),
CatalogClothingItem(1750, 0),
CatalogClothingItem(1757, 0),
@ -478,6 +501,8 @@ MonthlySchedule = ((7,
25,
9,
21,
2010,
2010,
(CatalogClothingItem(1763, 0),)),
(6,
5,
@ -488,44 +513,49 @@ MonthlySchedule = ((7,
1,
12,
31,
(
CatalogGardenItem(100, 1),
(CatalogGardenItem(100, 1),
CatalogGardenItem(101, 1),
CatalogGardenItem(103, 1),
CatalogGardenItem(104, 1),
CatalogToonStatueItem(105, endPoseIndex=108),
CatalogRentalItem(1, 2880, 1000),
CatalogRentalItem(2, 2890, 1000),
CatalogGardenStarterItem(),
CatalogNametagItem(0),
CatalogFurnitureItem(1530),
CatalogFurnitureItem(1531),
CatalogFurnitureItem(1532),
CatalogFurnitureItem(1532),
CatalogNametagItem(15),
CatalogNametagItem(16),
CatalogNametagItem(17),
CatalogClothingItem(1608, 0, True),
CatalogClothingItem(1605, 0, True),
CatalogClothingItem(1602, 0, True),
CatalogClothingItem(1607, 0, True),
CatalogClothingItem(1604, 0, True),
CatalogClothingItem(1601, 0, True),
CatalogClothingItem(1606, 0, True),
CatalogClothingItem(1603, 0, True),
CatalogClothingItem(1600, 0, True),
CatalogEmoteItem(25, True),
CatalogEmoteItem(26, True),
CatalogEmoteItem(20, True),
CatalogEmoteItem(21, True),
CatalogEmoteItem(22, True),
CatalogEmoteItem(23, True),
CatalogEmoteItem(24, True),
CatalogEmoteItem(25, True),
CatalogEmoteItem(26, True),
CatalogNametagItem(15, True),
CatalogNametagItem(16, True),
CatalogNametagItem(17, True))),
CatalogClothingItem(1821, 0, True))),
(5,
26,
6,
30,
2013,
2013,
(CatalogAccessoryItem(175),)),
(8,
27,
9,
5,
2013,
2013,
((3, 2900),
CatalogChatItem(10003),
CatalogClothingItem(1001, 0),
@ -575,6 +605,8 @@ MonthlySchedule = ((7,
3,
9,
12,
2013,
2013,
((3, 2910),
CatalogFurnitureItem(680),
CatalogFurnitureItem(681),
@ -609,6 +641,8 @@ MonthlySchedule = ((7,
20,
9,
19,
2013,
2013,
(CatalogAccessoryItem(101),
CatalogAccessoryItem(103),
CatalogAccessoryItem(117),
@ -805,11 +839,7 @@ WeeklySchedule = ((100,
4000,
4500,
CatalogFurnitureItem(110),
CatalogFurnitureItem(100),
nextAvailablePole,
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
CatalogFurnitureItem(100)),
(100,
(5, 2000),
CatalogFurnitureItem(1420),
@ -830,10 +860,7 @@ WeeklySchedule = ((100,
CatalogAnimatedFurnitureItem(490),
CatalogFurnitureItem(1000),
CatalogClothingItem(117, 0),
CatalogClothingItem(217, 0),
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
CatalogClothingItem(217, 0)),
(100,
(5, 2000),
CatalogFurnitureItem(1430),
@ -853,11 +880,7 @@ WeeklySchedule = ((100,
4000,
4500,
CatalogFurnitureItem(1210),
CatalogClothingItem(409, 0),
nextAvailablePole,
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
CatalogClothingItem(409, 0)),
(300,
(5, 2000),
CatalogEmoteItem(13),
@ -876,10 +899,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(910),
CatalogFurnitureItem(1600),
CatalogClothingItem(118, 0),
CatalogClothingItem(218, 0),
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
CatalogClothingItem(218, 0)),
(100,
(5, 2000),
3000,
@ -896,11 +916,7 @@ WeeklySchedule = ((100,
3500,
4000,
4500,
CatalogFurnitureItem(620),
nextAvailablePole,
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
CatalogFurnitureItem(620)),
(300,
(5, 2000),
3000,
@ -920,10 +936,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(630),
CatalogFurnitureItem(1630),
CatalogEmoteItem(11),
CatalogNametagItem(11),
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
CatalogNametagItem(11)),
(100,
(2, 2000),
(3, 2010),
@ -946,11 +959,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(120),
CatalogClothingItem(120, 0),
CatalogClothingItem(220, 0),
nextAvailablePole,
5000,
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
5000),
(100,
(2, 2000),
(3, 2010),
@ -971,10 +980,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(1120),
CatalogFurnitureItem(930),
CatalogFurnitureItem(1500),
CatalogEmoteItem(6),
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
CatalogEmoteItem(6)),
(300,
(2, 2000),
(3, 2010),
@ -997,7 +1003,6 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(940),
CatalogClothingItem(121, 0),
CatalogClothingItem(221, 0),
nextAvailablePole,
5000),
(100,
(2, 2000),
@ -1038,7 +1043,6 @@ WeeklySchedule = ((100,
4510,
CatalogFurnitureItem(300),
CatalogFurnitureItem(1220),
nextAvailablePole,
5000),
(300,
(2, 2000),
@ -1096,7 +1100,6 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(145),
CatalogClothingItem(123, 0),
CatalogClothingItem(224, 0),
nextAvailablePole,
5000),
(100,
(1, 2000),
@ -1137,8 +1140,7 @@ WeeklySchedule = ((100,
4520,
CatalogWindowItem(90),
CatalogClothingItem(124, 0),
CatalogClothingItem(411, 0),
nextAvailablePole),
CatalogClothingItem(411, 0)),
(100,
(1, 2000),
(2, 2010),
@ -1184,7 +1186,6 @@ WeeklySchedule = ((100,
4020,
4520,
CatalogFurnitureItem(1910),
nextAvailablePole,
CatalogFurnitureItem(1000)),
(300,
(1, 2000),
@ -1236,7 +1237,6 @@ WeeklySchedule = ((100,
3530,
4020,
4520,
nextAvailablePole,
CatalogWallpaperItem(3900),
CatalogFurnitureItem(980),
CatalogNametagItem(13)),
@ -1249,7 +1249,8 @@ WeeklySchedule = ((100,
4020,
4520,
CatalogClothingItem(130, 0),
CatalogFurnitureItem(150)),
CatalogFurnitureItem(150),
CatalogNametagItem(14)),
(100,
(1, 2010),
(2, 2020),
@ -1281,7 +1282,6 @@ WeeklySchedule = ((100,
3530,
4020,
4520,
nextAvailablePole,
CatalogFurnitureItem(1930),
CatalogFurnitureItem(670)),
(300,
@ -1324,7 +1324,6 @@ WeeklySchedule = ((100,
3530,
4020,
4520,
nextAvailablePole,
CatalogFurnitureItem(1940),
CatalogWindowItem(130)),
(300,
@ -1347,19 +1346,17 @@ WeeklySchedule = ((100,
4020,
4520,
CatalogFurnitureItem(250),
CatalogFurnitureItem(1960),
nextAvailablePole),
CatalogFurnitureItem(1960)),
Sale(CatalogFurnitureItem(210, 0), CatalogFurnitureItem(220, 0), CatalogFurnitureItem(1100), CatalogFurnitureItem(110), CatalogFurnitureItem(100), CatalogFurnitureItem(700), CatalogFurnitureItem(710), CatalogFurnitureItem(410), CatalogAnimatedFurnitureItem(490), CatalogFurnitureItem(1210), CatalogFurnitureItem(1200), CatalogFurnitureItem(800), CatalogFurnitureItem(1110), CatalogFurnitureItem(230), CatalogFurnitureItem(420), CatalogAnimatedFurnitureItem(480), CatalogFurnitureItem(120), CatalogFurnitureItem(1700), CatalogFurnitureItem(1120), CatalogFurnitureItem(430), CatalogAnimatedFurnitureItem(491), CatalogFurnitureItem(1130), CatalogFurnitureItem(130), CatalogFurnitureItem(300), CatalogFurnitureItem(1220), CatalogFurnitureItem(810), CatalogFurnitureItem(1230), CatalogFurnitureItem(310), CatalogFurnitureItem(1240), CatalogFurnitureItem(240), CatalogFurnitureItem(145), CatalogFurnitureItem(1725), CatalogFurnitureItem(140), CatalogFurnitureItem(950), CatalogFurnitureItem(1720)),
Sale(CatalogClothingItem(116, 0), CatalogClothingItem(216, 0), CatalogClothingItem(408, 0), CatalogClothingItem(117, 0), CatalogClothingItem(217, 0), CatalogClothingItem(409, 0), CatalogClothingItem(118, 0), CatalogClothingItem(218, 0), CatalogClothingItem(410, 0), CatalogClothingItem(119, 0), CatalogClothingItem(219, 0), CatalogClothingItem(120, 0), CatalogClothingItem(220, 0), CatalogClothingItem(121, 0), CatalogClothingItem(221, 0), CatalogClothingItem(222, 0), CatalogClothingItem(123, 0), CatalogClothingItem(224, 0), CatalogClothingItem(411, 0), CatalogClothingItem(311, 0), CatalogClothingItem(310, 0)),
Sale(CatalogWindowItem(40), CatalogWindowItem(70), CatalogWindowItem(50), CatalogWindowItem(60), CatalogWindowItem(80), CatalogWindowItem(100), CatalogWindowItem(90), CatalogWindowItem(110)),
Sale(CatalogEmoteItem(5), CatalogEmoteItem(9), CatalogEmoteItem(13), CatalogEmoteItem(11), CatalogEmoteItem(6), CatalogEmoteItem(8), CatalogNametagItem(10)),
Sale(CatalogFurnitureItem(600), CatalogFurnitureItem(610), CatalogFurnitureItem(620), CatalogFurnitureItem(630), CatalogFurnitureItem(640), CatalogFurnitureItem(650), CatalogFurnitureItem(660), CatalogFurnitureItem(900), CatalogFurnitureItem(910), CatalogFurnitureItem(920), CatalogFurnitureItem(930), CatalogFurnitureItem(940), CatalogFurnitureItem(1000), CatalogFurnitureItem(1010), CatalogFurnitureItem(1020), CatalogFurnitureItem(1030), CatalogFurnitureItem(1400), CatalogFurnitureItem(1410), CatalogFurnitureItem(1420), CatalogFurnitureItem(1430), CatalogFurnitureItem(1440), CatalogFurnitureItem(1441), CatalogFurnitureItem(1442), CatalogFurnitureItem(1443), CatalogFurnitureItem(1500), CatalogFurnitureItem(1510), CatalogFurnitureItem(1520), CatalogFurnitureItem(1530), CatalogFurnitureItem(1531), CatalogFurnitureItem(1532), CatalogFurnitureItem(1600), CatalogFurnitureItem(1610), CatalogFurnitureItem(1620), CatalogFurnitureItem(1630), CatalogFurnitureItem(1640), CatalogFurnitureItem(1650), CatalogFurnitureItem(1660), CatalogFurnitureItem(1661), CatalogFurnitureItem(1710), CatalogFurnitureItem(1800), CatalogFurnitureItem(1810), CatalogFurnitureItem(1900), CatalogFurnitureItem(1910)),
Sale(CatalogFurnitureItem(600), CatalogFurnitureItem(610), CatalogFurnitureItem(620), CatalogFurnitureItem(630), CatalogFurnitureItem(640), CatalogFurnitureItem(650), CatalogFurnitureItem(660), CatalogFurnitureItem(900), CatalogFurnitureItem(910), CatalogFurnitureItem(920), CatalogFurnitureItem(930), CatalogFurnitureItem(940), CatalogFurnitureItem(1000), CatalogFurnitureItem(1010), CatalogFurnitureItem(1020), CatalogFurnitureItem(1030), CatalogFurnitureItem(1400), CatalogFurnitureItem(1410), CatalogFurnitureItem(1420), CatalogFurnitureItem(1430), CatalogFurnitureItem(1440), CatalogFurnitureItem(1441), CatalogFurnitureItem(1442), CatalogFurnitureItem(1443), CatalogFurnitureItem(1500), CatalogFurnitureItem(1510), CatalogFurnitureItem(1520), CatalogFurnitureItem(1530), CatalogFurnitureItem(1600), CatalogFurnitureItem(1531), CatalogFurnitureItem(1532), CatalogFurnitureItem(1610), CatalogFurnitureItem(1620), CatalogFurnitureItem(1630), CatalogFurnitureItem(1640), CatalogFurnitureItem(1650), CatalogFurnitureItem(1660), CatalogFurnitureItem(1661), CatalogFurnitureItem(1710), CatalogFurnitureItem(1800), CatalogFurnitureItem(1810), CatalogFurnitureItem(1900), CatalogFurnitureItem(1910)),
(300,
(1, 2020),
(2, 2030),
(3, 2040),
CatalogFurnitureItem(730),
nextAvailablePole),
CatalogFurnitureItem(730)),
(100,
(1, 2020),
(2, 2030),
@ -1382,8 +1379,7 @@ WeeklySchedule = ((100,
(1, 2020),
(2, 2030),
(3, 2040),
CatalogFurnitureItem(1140),
nextAvailablePole),
CatalogFurnitureItem(1140)),
(100,
(1, 2020),
(2, 2030),
@ -1406,8 +1402,7 @@ WeeklySchedule = ((100,
(2, 2040),
(3, 2050),
CatalogClothingItem(131, 0),
CatalogClothingItem(225, 0),
nextAvailablePole),
CatalogClothingItem(225, 0)),
(300,
(1, 2030),
(2, 2040),
@ -1427,7 +1422,6 @@ WeeklySchedule = ((100,
(1, 2030),
(2, 2040),
(3, 2050),
nextAvailablePole,
CatalogEmoteItem(12),
CatalogNametagItem(5)),
(300,
@ -1451,8 +1445,7 @@ WeeklySchedule = ((100,
(1, 2030),
(2, 2040),
(3, 2050),
CatalogFurnitureItem(1215),
nextAvailablePole),
CatalogFurnitureItem(1215)),
(300,
(1, 2030),
(2, 2040),
@ -1472,17 +1465,19 @@ WeeklySchedule = ((100,
(300,
(1, 2030),
(2, 2040),
(3, 2050),
nextAvailablePole))
(3, 2050)))
class CatalogGenerator:
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogGenerator')
def __init__(self):
self.__itemLists = {}
self.__releasedItemLists = {}
if config.GetBool('save-catalog-schedule', False):
self.outputSchedule('catalog-schedule.txt')
def getReleasedCatalogList(self, weekStart):
dayNumber = int(weekStart / (24 * 60))
itemLists = self.__getReleasedItemLists(dayNumber, weekStart)
return itemLists
def generateMonthlyCatalog(self, avatar, weekStart):
dayNumber = int(weekStart / (24 * 60))
@ -1512,25 +1507,24 @@ class CatalogGenerator:
if nextAvailableCloset not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableCloset, monthlyCatalog, saleItem=0)
if nextAvailableBank not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableBank, monthlyCatalog, saleItem=0)
weeklyCatalog += self.__selectItem(avatar, nextAvailableBank, monthlyCatalog, saleItem = 0)
if nextAvailableTank not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableTank, monthlyCatalog, saleItem=0)
weeklyCatalog += self.__selectItem(avatar, nextAvailableTank, monthlyCatalog, saleItem = 0)
if nextAvailablePole not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailablePole, monthlyCatalog, saleItem = 0)
def hasPetTrick(catalog):
for item in catalog:
if isinstance(item, CatalogPetTrickItem):
return 1
weeklyCatalog += self.__selectItem(avatar, get50ItemTrunk, monthlyCatalog, saleItem=0)
if True:
return 0
def hasPetTrick(catalog):
for item in catalog:
if isinstance(item, CatalogPetTrickItem):
return 1
if not hasPetTrick(weeklyCatalog) and not hasPetTrick(avatar.weeklyCatalog) and not hasPetTrick(avatar.backCatalog):
self.notify.debug('Artificially adding pet trick to catalog')
weeklyCatalog += self.__selectItem(avatar, 5000, monthlyCatalog, saleItem=saleItem)
return 0
if not hasPetTrick(weeklyCatalog) and not hasPetTrick(avatar.weeklyCatalog) and not hasPetTrick(avatar.backCatalog):
weeklyCatalog += self.__selectItem(avatar, 5000, monthlyCatalog, saleItem=saleItem)
self.notify.debug('Generated catalog: %s' % weeklyCatalog)
return weeklyCatalog
@ -1559,12 +1553,45 @@ class CatalogGenerator:
return backCatalog
def __getReleasedItemLists(self, dayNumber, weekStart):
itemLists = self.__releasedItemLists.get(dayNumber)
if itemLists != None:
return itemLists
else:
self.__releasedItemLists.clear()
testDaysAhead = simbase.config.GetInt('test-server-holiday-days-ahead', 0)
nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60)
year = nowtuple[0]
month = nowtuple[1]
day = nowtuple[2]
itemLists = []
for monthlyItems in MonthlySchedule:
startMM = monthlyItems[0]
startDD = monthlyItems[1]
endMM = monthlyItems[2]
endDD = monthlyItems[3]
if len(monthlyItems) == 7:
startYYYY = monthlyItems[4]
endYYYY = monthlyItems[5]
list = monthlyItems[6]
else:
startYYYY = 1969
endYYYY = year
list = monthlyItems[4]
pastStart = year > startYYYY or (year == startYYYY and (month > startMM or (month == startMM and day >= startDD)))
if pastStart:
itemLists.append(list)
self.__releasedItemLists[dayNumber] = itemLists
return itemLists
def __getMonthlyItemLists(self, dayNumber, weekStart):
itemLists = self.__itemLists.get(dayNumber)
if itemLists != None:
return itemLists
testDaysAhead = config.GetInt('test-server-holiday-days-ahead', 0)
testDaysAhead = simbase.config.GetInt('test-server-holiday-days-ahead', 0)
nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60)
year = nowtuple[0]
month = nowtuple[1]
day = nowtuple[2]
self.notify.debug('Generating seasonal itemLists for %s/%s.' % (month, day))
@ -1574,9 +1601,16 @@ class CatalogGenerator:
startDD = monthlyItems[1]
endMM = monthlyItems[2]
endDD = monthlyItems[3]
list = monthlyItems[4]
pastStart = month > startMM or (month == startMM and day >= startDD)
beforeEnd = month < endMM or (month == endMM and day <= endDD)
if len(monthlyItems) == 7:
startYYYY = monthlyItems[4]
endYYYY = monthlyItems[5]
list = monthlyItems[6]
else:
startYYYY = 1969
endYYYY = year
list = monthlyItems[4]
pastStart = year >= startYYYY and (month > startMM or (month == startMM and day >= startDD))
beforeEnd = year <= endYYYY and (month < endMM or (month == endMM and day <= endDD))
if endMM < startMM:
if pastStart or beforeEnd:
itemLists.append(list)
@ -1707,35 +1741,31 @@ class CatalogGenerator:
def __recordSchedule(self, sched, weekCode, schedule):
if isinstance(schedule, Sale):
schedule = schedule.args
try:
for item in list(schedule):
if callable(item):
if item == nextAvailablePole:
item = getAllPoles()
elif item == nextAvailableCloset:
item = getAllClosets()
elif item == nextAvailableBank:
item = getAllBanks()
elif item == nextAvailableTank:
item = getAllTanks()
elif item == get50ItemCloset:
item = getMaxClosets()
elif item == get50ItemTrunk:
item = getMaxTrunks()
else:
self.notify.warning("Don't know how to interpret function " % repr(name))
item = None
elif isinstance(item, types.TupleType):
item = item[1]
if isinstance(item, types.IntType):
item = MetaItems[item]
if isinstance(item, CatalogItem.CatalogItem):
self.__recordScheduleItem(sched, weekCode, None, item)
elif item != None:
for i in item:
self.__recordScheduleItem(sched, None, weekCode, i)
except:
print 'Wrong: %s' % schedule
for item in schedule:
if callable(item):
if item == nextAvailablePole:
item = getAllPoles()
elif item == nextAvailableCloset:
item = getAllClosets()
elif item == nextAvailableBank:
item = getAllBanks()
elif item == nextAvailableTank:
item == getAllTanks()
elif item == get50ItemCloset:
item = getMaxClosets()
else:
self.notify.warning("Don't know how to interpret function " % repr(name))
item = None
elif isinstance(item, types.TupleType):
item = item[1]
if isinstance(item, types.IntType):
item = MetaItems[item]
if isinstance(item, CatalogItem.CatalogItem):
self.__recordScheduleItem(sched, weekCode, None, item)
elif item != None:
for i in item:
self.__recordScheduleItem(sched, None, weekCode, i)
return
def __recordScheduleItem(self, sched, weekCode, maybeWeekCode, item):

View file

@ -42,8 +42,8 @@ class CatalogItem:
return
def isAward(self):
result = self.specialEventId != 0
return result
#result = self.specialEventId != 0
return False
def makeNewItem(self):
pass
@ -78,9 +78,6 @@ class CatalogItem:
def storedInCloset(self):
return 0
def storedInTrunk(self):
return 0
def storedInAttic(self):
return 0
@ -196,6 +193,8 @@ class CatalogItem:
return TTLocalizer.CatalogPurchaseGiftLimitReached
elif retcode == ToontownGlobals.P_NotEnoughMoney:
return TTLocalizer.CatalogPurchaseGiftNotEnoughMoney
elif retcode == ToontownGlobals.P_TooFast:
return TTLocalizer.CatalogPurchaseGiftTooFast
else:
return TTLocalizer.CatalogPurchaseGiftGeneralError % {'friend': '%s',
'error': retcode}
@ -277,9 +276,9 @@ class CatalogItem:
x = di.getArg(STInt16, 10)
y = di.getArg(STInt16, 10)
z = di.getArg(STInt16, 100)
h = di.getArg(STInt8, 256.0 / 360.0)
p = di.getArg(STInt8, 256.0 / 360.0)
r = di.getArg(STInt8, 256.0 / 360.0)
h = di.getArg(STInt16, 256.0 / 360.0)
p = di.getArg(STInt16, 256.0 / 360.0)
r = di.getArg(STInt16, 256.0 / 360.0)
self.posHpr = (x,
y,
z,
@ -287,7 +286,7 @@ class CatalogItem:
p,
r)
if store & GiftTag:
self.giftTag = di.getString()
self.giftTag = di.getUint32()
self.specialEventId = di.getUint8()
def encodeDatagram(self, dg, store):
@ -297,9 +296,9 @@ class CatalogItem:
dg.putArg(self.posHpr[0], STInt16, 10)
dg.putArg(self.posHpr[1], STInt16, 10)
dg.putArg(self.posHpr[2], STInt16, 100)
dg.putArg(self.posHpr[3], STInt8, 256.0 / 360.0)
dg.putArg(self.posHpr[4], STInt8, 256.0 / 360.0)
dg.putArg(self.posHpr[5], STInt8, 256.0 / 360.0)
dg.putArg(self.posHpr[3], STInt16, 256.0 / 360.0)
dg.putArg(self.posHpr[4], STInt16, 256.0 / 360.0)
dg.putArg(self.posHpr[5], STInt16, 256.0 / 360.0)
if store & GiftTag:
dg.addString(self.giftTag)
dg.addUint8(self.specialEventId)

View file

@ -10,7 +10,6 @@ from CatalogFlooringItem import getAllFloorings
from CatalogMouldingItem import getAllMouldings
from CatalogWainscotingItem import getAllWainscotings
from CatalogFurnitureItem import getAllFurnitures
from CatalogFurnitureItem import FLTrunk
from otp.otpbase import OTPGlobals
CATALOG_PANEL_WORDWRAP = 10
CATALOG_PANEL_CHAT_WORDWRAP = 9
@ -292,11 +291,7 @@ class CatalogItemPanel(DirectFrame):
auxText = TTLocalizer.CatalogOnOrderText
else:
auxText = ''
isNameTag = typeCode == CatalogItemTypes.NAMETAG_ITEM
if isNameTag and self['item'].nametagStyle == base.localAvatar.getNametagStyle():
auxText = TTLocalizer.CatalogCurrent
self.buyButton['state'] = DGG.DISABLED
elif self['item'].reachedPurchaseLimit(base.localAvatar):
if self['item'].reachedPurchaseLimit(base.localAvatar):
max = self['item'].getPurchaseLimit()
if max <= 1:
auxText = TTLocalizer.CatalogPurchasedText
@ -325,13 +320,9 @@ class CatalogItemPanel(DirectFrame):
def __handlePurchaseRequest(self):
if self['item'].replacesExisting() and self['item'].hasExisting():
if self['item'].getFlags() & FLTrunk:
message = TTLocalizer.CatalogVerifyPurchase % {'item': self['item'].getName(),
'price': self['item'].getPrice(self['type'])}
else:
message = TTLocalizer.CatalogOnlyOnePurchase % {'old': self['item'].getYourOldDesc(),
'item': self['item'].getName(),
'price': self['item'].getPrice(self['type'])}
message = TTLocalizer.CatalogOnlyOnePurchase % {'old': self['item'].getYourOldDesc(),
'item': self['item'].getName(),
'price': self['item'].getPrice(self['type'])}
elif self['item'].isRental():
message = TTLocalizer.CatalogVerifyRent % {'item': self['item'].getName(),
'price': self['item'].getPrice(self['type'])}
@ -402,14 +393,9 @@ class CatalogItemPanel(DirectFrame):
'item': self['item'].getName(),
'price': self['item'].getPrice(self['type'])}
else:
friendIndex = self.parentCatalogScreen.friendGiftIndex
friendText = 'Error'
numFriends = len(base.localAvatar.friendsList) + len(base.cr.avList) - 1
if numFriends > 0:
friendText = self.parentCatalogScreen.receiverName
message = TTLocalizer.CatalogVerifyGift % {'item': self['item'].getName(),
'price': self['item'].getPrice(self['type']),
'friend': friendText}
'friend': self.parentCatalogScreen.friendName if self.parentCatalogScreen.friendName else TTLocalizer.CatalogGiftError}
self.verify = TTDialog.TTGlobalDialog(doneEvent='verifyGiftDone', message=message, style=TTDialog.TwoChoice)
self.verify.show()
self.accept('verifyGiftDone', self.__handleVerifyGift)
@ -441,44 +427,38 @@ class CatalogItemPanel(DirectFrame):
def updateGiftButton(self, giftUpdate = 0):
if not self.loaded:
return
self.giftButton.show()
if giftUpdate == 0:
return
self.auxText['text'] = ' '
numFriends = len(base.localAvatar.friendsList) + len(base.cr.avList) - 1
if numFriends > 0:
self.giftButton['state'] = DGG.DISABLED
self.giftButton.show()
auxText = ' '
if self['item'].isGift() <= 0:
self.giftButton.show()
self.giftButton['state'] = DGG.DISABLED
auxText = TTLocalizer.CatalogNotAGift
self.auxText['text'] = auxText
return
elif self.parentCatalogScreen.gotAvatar == 1:
avatar = self.parentCatalogScreen.giftAvatar
if self['item'].forBoysOnly() and avatar.getStyle().getGender() == 'f' or self['item'].forGirlsOnly() and avatar.getStyle().getGender() == 'm':
self.giftButton.show()
self.giftButton['state'] = DGG.DISABLED
auxText = TTLocalizer.CatalogNoFit
self.auxText['text'] = auxText
return
elif self['item'].reachedPurchaseLimit(avatar):
self.giftButton.show()
self.giftButton['state'] = DGG.DISABLED
auxText = TTLocalizer.CatalogPurchasedGiftText
self.auxText['text'] = auxText
return
elif len(avatar.mailboxContents) + len(avatar.onGiftOrder) >= ToontownGlobals.MaxMailboxContents:
self.giftButton.show()
self.giftButton['state'] = DGG.DISABLED
auxText = TTLocalizer.CatalogMailboxFull
self.auxText['text'] = auxText
return
elif self['item'].getPrice(self['type']) <= base.localAvatar.getMoney() + base.localAvatar.getBankMoney():
self.giftButton['state'] = DGG.NORMAL
self.giftButton.show()
self.auxText['text'] = ''
self.giftButton['state'] = DGG.DISABLED
self.giftButton.show()
if self['item'].isGift() <= 0:
self.auxText['text'] = TTLocalizer.CatalogNotAGift
return
if not self.parentCatalogScreen.friend:
return
avatar = self.parentCatalogScreen.friend
if self['item'].forBoysOnly() and avatar.getStyle().getGender() == 'f' or self['item'].forGirlsOnly() and avatar.getStyle().getGender() == 'm':
self.auxText['text'] = TTLocalizer.CatalogNoFit
elif self['item'].reachedPurchaseLimit(avatar):
self.auxText['text'] = TTLocalizer.CatalogPurchasedGiftText
elif len(avatar.mailboxContents) + len(avatar.onOrder) + len(avatar.onGiftOrder) + 1 >= ToontownGlobals.MaxMailboxContents:
self.auxText['text'] = TTLocalizer.CatalogMailboxFull
else:
orderCount = avatar.onGiftOrder.count(self['item'])
if orderCount:
self.auxText['text'] = TTLocalizer.CatalogOnOrderText if orderCount == 1 else '%d %s' % (orderCount, TTLocalizer.CatalogOnOrderText)
if self['item'].getPrice(self['type']) <= base.localAvatar.getMoney() + base.localAvatar.getBankMoney():
self.giftButton['state'] = DGG.NORMAL
def handleSoundOnButton(self):
item = self.items[self.itemIndex]

View file

@ -17,11 +17,7 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
return 1
def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder:
return 1
if avatar.nametagStyle == self.nametagStyle:
return 1
return 0
return self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self.nametagStyle in avatar.nametagStyles
def getAcceptItemErrorText(self, retcode):
if retcode == ToontownGlobals.P_ItemAvailable:
@ -45,6 +41,7 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
def recordPurchase(self, avatar, optional):
if avatar:
avatar.b_setNametagStyle(self.nametagStyle)
avatar.addNametagStyle(self.nametagStyle)
return ToontownGlobals.P_ItemAvailable
def getDeliveryTime(self):
@ -52,10 +49,7 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
def getPicture(self, avatar):
frame = self.makeFrame()
if self.nametagStyle == 100:
inFont = ToontownGlobals.getToonFont()
else:
inFont = ToontownGlobals.getNametagFont(self.nametagStyle)
inFont = ToontownGlobals.getNametagFont(self.nametagStyle)
nameTagDemo = DirectLabel(parent=frame, relief=None, pos=(0, 0, 0.24), scale=0.5, text=base.localAvatar.getName(), text_fg=(1.0, 1.0, 1.0, 1), text_shadow=(0, 0, 0, 1), text_font=inFont, text_wordwrap=9)
self.hasPicture = True
return (frame, None)
@ -71,16 +65,6 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
def getBasePrice(self):
return 500
cost = 500
if self.nametagStyle == 0:
cost = 600
elif self.nametagStyle == 1:
cost = 600
elif self.nametagStyle == 2:
cost = 600
elif self.nametagStyle == 100:
cost = 50
return cost
def decodeDatagram(self, di, versionNumber, store):
CatalogItem.CatalogItem.decodeDatagram(self, di, versionNumber, store)
@ -92,9 +76,6 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
dg.addUint16(self.nametagStyle)
dg.addBool(self.isSpecial)
def isGift(self):
return 0
def getBackSticky(self):
itemType = 1
numSticky = 4

View file

@ -17,7 +17,7 @@ class CatalogPetTrickItem(CatalogItem.CatalogItem):
return 1
def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder or not hasattr(avatar, 'petTrickPhrases'):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or not hasattr(avatar, 'petTrickPhrases'):
return 1
return self.trickId in avatar.petTrickPhrases

View file

@ -16,7 +16,7 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
return 1
def reachedPurchaseLimit(self, avatar):
return avatar.getFishingRod() >= self.rodId or self in avatar.onOrder or self in avatar.mailboxContents
return avatar.getMaxFishingRod() >= self.rodId or self in avatar.onOrder or self in avatar.mailboxContents
def saveHistory(self):
return 1
@ -31,17 +31,18 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
if self.rodId < 0 or self.rodId > FishGlobals.MaxRodId:
self.notify.warning('Invalid fishing pole: %s for avatar %s' % (self.rodId, avatar.doId))
return ToontownGlobals.P_InvalidIndex
if self.rodId < avatar.getFishingRod():
if self.rodId < avatar.getMaxFishingRod():
self.notify.warning('Avatar already has pole: %s for avatar %s' % (self.rodId, avatar.doId))
return ToontownGlobals.P_ItemUnneeded
avatar.b_setFishingRod(self.rodId)
avatar.b_setMaxFishingRod(self.rodId)
return ToontownGlobals.P_ItemAvailable
def isGift(self):
return 0
def getDeliveryTime(self):
return 1
return 24 * 60
def getPicture(self, avatar):
rodPath = FishGlobals.RodFileDict.get(self.rodId)
@ -83,7 +84,6 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
def decodeDatagram(self, di, versionNumber, store):
CatalogItem.CatalogItem.decodeDatagram(self, di, versionNumber, store)
self.rodId = di.getUint8()
price = FishGlobals.RodPriceDict[self.rodId]
def encodeDatagram(self, dg, store):
CatalogItem.CatalogItem.encodeDatagram(self, dg, store)
@ -91,7 +91,7 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
def nextAvailablePole(avatar, duplicateItems):
rodId = avatar.getFishingRod() + 1
rodId = avatar.getMaxFishingRod() + 1
if rodId > FishGlobals.MaxRodId:
return None
item = CatalogPoleItem(rodId)

View file

@ -24,9 +24,7 @@ class CatalogRentalItem(CatalogItem.CatalogItem):
return 0
def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder:
return 1
return 0
return self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder
def saveHistory(self):
return 1

View file

@ -15,7 +15,7 @@ import random
from toontown.toon import DistributedToon
from direct.directnotify import DirectNotifyGlobal
from otp.nametag.ChatBalloon import ChatBalloon
from otp.nametag import NametagGroup
from otp.nametag import NametagGroup, NametagConstants
NUM_CATALOG_ROWS = 3
NUM_CATALOG_COLS = 2
@ -31,8 +31,10 @@ class CatalogScreen(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogScreen')
def __init__(self, parent = aspect2d, **kw):
self.gifting = -1
guiItems = loader.loadModel('phase_5.5/models/gui/catalog_gui')
background = guiItems.find('**/catalog_background')
background.setBin("background", 10)
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
guiBack = loader.loadModel('phase_5.5/models/gui/package_delivery_panel')
optiondefs = (('scale', 0.667, None),
@ -43,19 +45,11 @@ class CatalogScreen(DirectFrame):
('relief', None, None))
self.defineoptions(kw, optiondefs)
DirectFrame.__init__(self, parent)
self.friendGiftIndex = 0
self.friendGiftHandle = None
self.frienddoId = None
self.receiverName = 'Error Nameless Toon'
self.friends = {}
self.family = {}
self.ffList = []
self.textRolloverColor = Vec4(1, 1, 0, 1)
self.textDownColor = Vec4(0.5, 0.9, 1, 1)
self.textDisabledColor = Vec4(0.4, 0.8, 0.4, 1)
self.giftAvatar = None
self.gotAvatar = 0
self.allowGetDetails = 1
self.friend = None
self.friendAvId = None
self.friendName = None
self.friendList = []
self.friends = []
self.load(guiItems, guiButton, guiBack)
self.initialiseoptions(CatalogScreen)
self.enableBackorderCatalogButton()
@ -65,10 +59,8 @@ class CatalogScreen(DirectFrame):
self.hide()
self.clarabelleChatNP = None
self.clarabelleChatBalloon = None
self.gifting = -1
self.createdGiftGui = None
self.viewing = None
return
def show(self):
self.accept('CatalogItemPurchaseRequest', self.__handlePurchaseRequest)
@ -90,9 +82,6 @@ class CatalogScreen(DirectFrame):
taskMgr.doMethodLater(1.0, clarabelleGreeting, 'clarabelleGreeting')
taskMgr.doMethodLater(12.0, clarabelleHelpText1, 'clarabelleHelpText1')
if hasattr(self, 'giftToggle'):
self.giftToggle['state'] = DGG.NORMAL
self.giftToggle['text'] = TTLocalizer.CatalogGiftToggleOn
def hide(self):
self.ignore('CatalogItemPurchaseRequest')
@ -542,15 +531,15 @@ class CatalogScreen(DirectFrame):
-2.0,
-1.45), image_scale=(1.0, 1.0, smash), image_pos=(0.0, 0.0, -1.9 + lift), image=backDown, pressEffect=0, command=self.showEmblemItems, text=TTLocalizer.CatalogEmblem, text_font=ToontownGlobals.getSignFont(), text_pos=(1.75, 0.132), text_scale=0.065, text_fg=(0.353, 0.627, 0.627, 1.0), text2_fg=(0.353, 0.427, 0.427, 1.0))
self.emblemCatalogButton2.hide()
self.__makeFFlist()
if len(self.ffList) > 0:
self.__makeFriendList()
if len(self.friendList) > 0:
if config.GetBool('want-gifting', True):
self.giftToggle = DirectButton(self.base, relief=None, pressEffect=0, image=(giftToggleUp, giftToggleDown, giftToggleUp), image_scale=(1.0, 1, 0.7), command=self.__giftToggle, text=TTLocalizer.CatalogGiftToggleOff, text_font=ToontownGlobals.getSignFont(), text_pos=TTLocalizer.CSgiftTogglePos, text_scale=TTLocalizer.CSgiftToggle, text_fg=(0.353, 0.627, 0.627, 1.0), text3_fg=(0.15, 0.3, 0.3, 1.0), text2_fg=(0.353, 0.427, 0.427, 1.0), image_color=Vec4(1.0, 1.0, 0.2, 1.0), image1_color=Vec4(0.9, 0.85, 0.2, 1.0), image2_color=Vec4(0.9, 0.85, 0.2, 1.0), image3_color=Vec4(0.5, 0.45, 0.2, 1.0))
self.giftToggle.setPos(0.0, 0, -0.035)
self.giftLabel = DirectLabel(self.base, relief=None, image=giftFriends, image_scale=(1.15, 1, 1.14), text=' ', text_font=ToontownGlobals.getSignFont(), text_pos=(1.2, -0.97), text_scale=0.07, text_fg=(0.392, 0.549, 0.627, 1.0), sortOrder=100, textMayChange=1)
self.giftLabel.setPos(-0.15, 0, 0.08)
self.giftLabel.hide()
self.friendLabel = DirectLabel(self.base, relief=None, text='Friend Name', text_font=ToontownGlobals.getSignFont(), text_pos=(-0.25, 0.132), text_scale=0.068, text_align=TextNode.ALeft, text_fg=(0.992, 0.949, 0.327, 1.0), sortOrder=100, textMayChange=1)
self.friendLabel = DirectLabel(self.base, relief=None, text=TTLocalizer.CatalogGiftChoose, text_font=ToontownGlobals.getSignFont(), text_pos=(-0.25, 0.132), text_scale=0.068, text_align=TextNode.ALeft, text_fg=(0.992, 0.949, 0.327, 1.0), sortOrder=100, textMayChange=1)
self.friendLabel.setPos(0.5, 0, -0.42)
self.friendLabel.hide()
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
@ -569,9 +558,6 @@ class CatalogScreen(DirectFrame):
clipNP = self.scrollList.attachNewNode(clipper)
self.scrollList.setClipPlane(clipNP)
self.__makeScrollList()
friendId = self.ffList[0]
self.__chooseFriend(self.ffList[0][0], self.ffList[0][1])
self.update()
self.createdGiftGui = 1
for i in xrange(4):
self.newCatalogButton.component('text%d' % i).setR(90)
@ -828,8 +814,7 @@ class CatalogScreen(DirectFrame):
taskMgr.remove('clarabelleGreeting')
taskMgr.remove('clarabelleHelpText1')
taskMgr.remove('clarabelleAskAnythingElse')
if self.giftAvatar:
base.cr.cancelAvatarDetailsRequest(self.giftAvatar)
taskMgr.remove('friendButtonsReady')
self.hide()
self.hangup.hide()
self.destroy()
@ -861,16 +846,12 @@ class CatalogScreen(DirectFrame):
del self.giftLabel
del self.friendLabel
del self.scrollList
del self.friend
del self.friends
self.unloadClarabelle()
if self.responseDialog:
self.responseDialog.cleanup()
self.responseDialog = None
if self.giftAvatar:
if hasattr(self.giftAvatar, 'doId'):
self.giftAvatar.delete()
else:
self.giftAvatar = None
return
def unloadClarabelle(self):
base.win.removeDisplayRegion(self.cDr)
@ -888,8 +869,6 @@ class CatalogScreen(DirectFrame):
del self.clarabelleChatBalloon
def hangUp(self):
if hasattr(self, 'giftAvatar') and self.giftAvatar:
self.giftAvatar.disable()
self.setClarabelleChat(random.choice(TTLocalizer.CatalogGoodbyeList), type='goodbye')
self.setPageIndex(-1)
self.showPageItems()
@ -918,9 +897,8 @@ class CatalogScreen(DirectFrame):
self.update()
def update(self, task = None):
if not hasattr(self.giftAvatar, 'doId'):
if self.gifting == 1:
self.__giftToggle()
if (not self.friend) and self.gifting == 1:
self.__giftToggle()
if hasattr(self, 'beanBank'):
self.beanBank['text'] = str(base.localAvatar.getTotalMoney())
for item in self.panelList + self.backPanelList + self.specialPanelList + self.emblemPanelList:
@ -932,7 +910,7 @@ class CatalogScreen(DirectFrame):
taskMgr.remove('clarabelleAskAnythingElse')
def __handleGiftPurchaseRequest(self, item):
item.requestGiftPurchase(self['phone'], self.frienddoId, self.__handleGiftPurchaseResponse)
item.requestGiftPurchase(self['phone'], self.friendAvId, self.__handleGiftPurchaseResponse)
taskMgr.remove('clarabelleAskAnythingElse')
def __handlePurchaseResponse(self, retCode, item):
@ -951,7 +929,7 @@ class CatalogScreen(DirectFrame):
return
if self.isEmpty() or self.isHidden():
return
self.setClarabelleChat(item.getRequestGiftPurchaseErrorText(retCode) % self.receiverName)
self.setClarabelleChat(item.getRequestGiftPurchaseErrorText(retCode) % self.friendName)
self.__loadFriend()
def askAnythingElse(task):
@ -1007,81 +985,60 @@ class CatalogScreen(DirectFrame):
self.silverLabel.hide()
self.goldLabel.hide()
def checkFamily(self, doId):
test = 0
for familyMember in base.cr.avList:
if familyMember.id == doId:
test = 1
return test
def __makeFFlist(self):
def __makeFriendList(self):
for av in base.cr.avList:
if av.id != base.localAvatar.doId:
self.friendList.append((av.id, av.name, NametagGroup.CCNonPlayer))
for id, handle in base.cr.friendsMap.items():
if isinstance(handle, FriendHandle.FriendHandle):
self.ffList.append((id, handle.getName(), None))#NametagGlobals.getFriendColor(handle)))
self.friendList.append((id, handle.getName(), NametagConstants.getFriendColor(handle)))
def __makeScrollList(self):
for ff in self.ffList:
ffbutton = self.makeFamilyButton(ff[0], ff[1], ff[2])
if ffbutton:
self.scrollList.addItem(ffbutton, refresh=0)
self.friends[ff] = ffbutton
for friend in self.friendList:
button = self.makeFriendButton(*friend)
self.scrollList.addItem(button, refresh=0)
self.friends.append(button)
self.scrollList.refresh()
def makeFamilyButton(self, familyId, familyName, colorCode):
# fg = NametagGlobals.getNameFg(colorCode, PGButton.SInactive)
return DirectButton(
relief=None,
text=familyName,
text_scale=0.04,
text_align=TextNode.ALeft,
# text_fg=fg,
text1_bg=self.textDownColor,
text2_bg=self.textRolloverColor,
text3_fg=self.textDisabledColor,
textMayChange=0,
command=self.__chooseFriend,
extraArgs=[familyId, familyName]
)
def makeFriendButton(self, avId, name, colorCode):
color = NametagConstants.NAMETAG_COLORS[colorCode]
def __chooseFriend(self, friendId, friendName):
return DirectButton(relief=None, text=name, text_scale=0.04, text_align=TextNode.ALeft, text_fg=color[0][0], text1_bg=(1, 1, 0, 1),
text2_bg=(0.5, 0.9, 1, 1), text3_fg=(0.4, 0.8, 0.4, 1), command=self.__chooseFriend, extraArgs=[avId, name])
def __chooseFriend(self, avId, name):
messenger.send('wakeup')
self.frienddoId = friendId
self.receiverName = friendName
self.friendLabel['text'] = TTLocalizer.CatalogGiftTo % self.receiverName
if self.friendAvId == avId:
return
self.friendAvId = avId
self.friendName = name
self.__loadFriend()
def __loadFriend(self):
if self.allowGetDetails == 0:
CatalogScreen.notify.warning('smashing requests')
if self.frienddoId and self.allowGetDetails:
if self.giftAvatar:
if hasattr(self.giftAvatar, 'doId'):
self.giftAvatar.disable()
self.giftAvatar.delete()
self.giftAvatar = None
self.giftAvatar = DistributedToon.DistributedToon(base.cr)
self.giftAvatar.doId = self.frienddoId
self.giftAvatar.forceAllowDelayDelete()
self.giftAvatar.generate()
base.cr.getAvatarDetails(self.giftAvatar, self.__handleAvatarDetails, 'DistributedToon')
self.gotAvatar = 0
self.allowGetDetails = 0
self.scrollList['state'] = DGG.DISABLED
return
def __handleAvatarDetails(self, gotData, avatar, dclass):
if self.giftAvatar.doId != avatar.doId or gotData == 0:
CatalogScreen.notify.error('Get Gift Avatar Failed')
self.gotAvatar = 0
if not self.friendAvId:
return
else:
self.gotAvatar = 1
self.giftAvatar = avatar
self.scrollList['state'] = DGG.NORMAL
self.allowGetDetails = 1
for friendButton in self.friends:
friendButton['state'] = DGG.DISABLED
self.friend = None
self.friendLabel['text'] = TTLocalizer.CatalogGiftUpdating
taskMgr.remove('friendButtonsReady')
self['phone'].requestGiftAvatar(self.friendAvId)
def setFriendReady(self, friend):
self.friend = friend
self.friendLabel['text'] = TTLocalizer.CatalogGiftTo % self.friendName
taskMgr.doMethodLater(1.5, self.setFriendButtonsReady, 'friendButtonsReady')
self.update()
def setFriendButtonsReady(self, task=None):
for friendButton in self.friends:
friendButton['state'] = DGG.NORMAL
def __giftToggle(self):
messenger.send('wakeup')
@ -1092,12 +1049,16 @@ class CatalogScreen(DirectFrame):
self.scrollList.show()
self.hideEmblems()
self.giftToggle['text'] = TTLocalizer.CatalogGiftToggleOn
self.friendLabel['text'] = TTLocalizer.CatalogGiftChoose
self.__loadFriend()
else:
self.friend = None
self.friendAvId = 0
self.friendName = None
self.gifting = -1
self.giftLabel.hide()
self.friendLabel.hide()
self.scrollList.hide()
self.showEmblems()
self.giftToggle['text'] = TTLocalizer.CatalogGiftToggleOff
self.update()
self.update()

View file

@ -24,11 +24,10 @@ class CatalogSurfaceItem(CatalogAtticItem.CatalogAtticItem):
return 1
def recordPurchase(self, avatar, optional):
self.giftTag = None
house, retcode = self.getHouseInfo(avatar)
if retcode >= 0:
house.addWallpaper(self)
return retcode
def getDeliveryTime(self):
return 1
return 60

View file

@ -33,13 +33,13 @@ class CatalogTankItem(CatalogItem.CatalogItem):
if self.maxTank <= avatar.getMaxFishTank():
return ToontownGlobals.P_ItemUnneeded
avatar.b_setMaxFishTank(self.maxTank)
return ToontownGlobals.P_ItemAvailable
return ToontownGlobals.P_ItemOnOrder
def isGift(self):
return 0
def getDeliveryTime(self):
return 0
return 1
def getPicture(self, avatar):
gui = loader.loadModel('phase_4/models/gui/fishingGui')

View file

@ -25,6 +25,7 @@ class CatalogToonStatueItem(CatalogGardenItem.CatalogGardenItem):
model, ival = self.makeFrameModel(toonStatuary.toon, 1)
self.pictureToonStatue = toonStatuary
self.hasPicture = True
toonStatuary.toon.setBin('gui-popup', 60)
return (model, ival)
def cleanupPicture(self):

View file

@ -37,14 +37,13 @@ class CatalogWindowItem(CatalogAtticItem.CatalogAtticItem):
return TTLocalizer.WindowViewNames.get(self.windowType)
def recordPurchase(self, avatar, optional):
self.giftTag = None
house, retcode = self.getHouseInfo(avatar)
if retcode >= 0:
house.addWindow(self)
return retcode
def getDeliveryTime(self):
return 1
return 4 * 60
def getPicture(self, avatar):
frame = self.makeFrame()

View file

@ -0,0 +1,98 @@
from toontown.toon import ToonDNA
import CatalogItem, CatalogItemList
import json, time
def createFromJson(jsonData):
return createFromFields(json.loads(jsonData))
def createFromFields(fields):
avatar = GiftAvatar()
for key, value in fields.iteritems():
getattr(avatar, key)(value)
return avatar
class GiftAvatar:
def getStyle(self):
return self.style
def getHat(self):
return self.hat
def getGlasses(self):
return self.glasses
def getBackpack(self):
return self.backpack
def getShoes(self):
return self.shoes
def getGiftScheduleBlob(self):
return self.onGiftOrder.getBlob(store=CatalogItem.Customization | CatalogItem.DeliveryDate)
def setDNAString(self, dnaString):
self.style = ToonDNA.ToonDNA()
self.style.makeFromNetString(dnaString.decode('base64'))
def setMailboxContents(self, contents):
self.mailboxContents = CatalogItemList.CatalogItemList(contents.decode('base64'), store=CatalogItem.Customization)
def setGiftSchedule(self, onOrder):
self.onGiftOrder = CatalogItemList.CatalogItemList(onOrder.decode('base64'), store=CatalogItem.Customization | CatalogItem.DeliveryDate)
def setDeliverySchedule(self, onOrder):
self.onOrder = CatalogItemList.CatalogItemList(onOrder.decode('base64'), store=CatalogItem.Customization | CatalogItem.DeliveryDate)
def setHat(self, hat):
self.hat = hat
def setGlasses(self, glasses):
self.glasses = glasses
def setBackpack(self, backpack):
self.backpack = backpack
def setShoes(self, shoes):
self.shoes = shoes
def setHatList(self, list):
self.hatList = list[0]
def setGlassesList(self, list):
self.glassesList = list[0]
def setBackpackList(self, list):
self.backpackList = list[0]
def setShoesList(self, list):
self.shoesList = list[0]
def setCustomMessages(self, customMessages):
self.customMessages = customMessages[0]
def setClothesTopsList(self, clothesList):
self.clothesTopsList = clothesList[0]
def setClothesBottomsList(self, clothesList):
self.clothesBottomsList = clothesList[0]
def setEmoteAccess(self, emoteAccess):
self.emoteAccess = emoteAccess[0]
def setPetTrickPhrases(self, tricks):
self.petTrickPhrases = tricks[0]
def setNametagStyles(self, nametagStyles):
self.nametagStyles = nametagStyles[0]
def addToGiftSchedule(self, avId, targetId, item, minutes=0):
if config.GetBool('want-instant-delivery', False):
minutes = 0
item.giftTag = avId
item.deliveryDate = int(time.time() / 60. + minutes + .5)
self.onGiftOrder.append(item)
simbase.air.send(simbase.air.dclassesByName['DistributedToonAI'].aiFormatUpdate('setGiftSchedule', targetId, targetId, simbase.air.ourChannel, [self.getGiftScheduleBlob()]))

View file

@ -31,7 +31,6 @@ class MailboxScreen(DirectObject.DirectObject):
self.dialogBox = None
self.load()
self.hide()
return
def show(self):
self.frame.show()
@ -79,7 +78,7 @@ class MailboxScreen(DirectObject.DirectObject):
self.quitButton = DirectButton(parent=self.frame, relief=None, image=(gui2.find('**/QuitBtn_UP'), gui2.find('**/QuitBtn_DN'), gui2.find('**/QuitBtn_RLVR')), pos=(0.5, 1.0, -0.42), scale=0.9, text=TTLocalizer.MailboxExitButton, text_font=ToontownGlobals.getSignFont(), text0_fg=(0.152, 0.75, 0.258, 1), text1_fg=(0.152, 0.75, 0.258, 1), text2_fg=(0.977, 0.816, 0.133, 1), text_scale=0.045, text_pos=(0, -0.01), command=self.__handleExit)
self.gettingText = DirectLabel(parent=self.frame, relief=None, text='', text_wordwrap=10, pos=(0.0, 0.0, 0.32), scale=0.09)
self.gettingText.hide()
self.giftTagPanel = DirectLabel(parent=self.frame, relief=None, text='Gift TAG!!', text_wordwrap=16, pos=(0.0, 0.0, 0.01), scale=0.06)
self.giftTagPanel = DirectLabel(parent=self.frame, relief=None, text=TTLocalizer.MailboxGiftTag % TTLocalizer.MailboxGiftTagAnonymous, text_wordwrap=16, pos=(0.0, 0.0, 0.01), scale=0.06)
self.giftTagPanel.hide()
self.itemText = DirectLabel(parent=self.frame, relief=None, text='', text_wordwrap=16, pos=(0.0, 0.0, -0.022), scale=0.07)
self.itemText.hide()
@ -249,10 +248,7 @@ class MailboxScreen(DirectObject.DirectObject):
self.acceptingIndex = None
if retcode < 0:
self.notify.info('Could not take item %s: retcode %s' % (item, retcode))
if retcode == ToontownGlobals.P_NoTrunk:
self.dialogBox = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.CatalogAcceptNoTrunk, text_wordwrap=15, command=self.__acceptError)
else:
self.dialogBox = TTDialog.TTDialog(style=TTDialog.TwoChoiceCustom, text=item.getAcceptItemErrorText(retcode), text_wordwrap=15, command=self.__handleDiscard, buttonText=[TTLocalizer.MailboxDiscard, TTLocalizer.MailboxLeave])
self.dialogBox = TTDialog.TTDialog(style=TTDialog.TwoChoiceCustom, text=item.getAcceptItemErrorText(retcode), text_wordwrap=15, command=self.__handleDiscard, buttonText=[TTLocalizer.MailboxDiscard, TTLocalizer.MailboxLeave])
self.dialogBox.show()
elif hasattr(item, 'storedInAttic') and item.storedInAttic():
self.numAtticAccepted += 1
@ -513,4 +509,11 @@ class MailboxScreen(DirectObject.DirectObject):
def getSenderName(self, avId):
sender = base.cr.identifyFriend(avId)
return sender.getName() if sender else TTLocalizer.MailboxGiftTagAnonymous
if sender:
return sender.getName()
for av in base.cr.avList:
if av.id == avId:
return av.name
return TTLocalizer.MailboxGiftTagAnonymous

View file

@ -23,6 +23,7 @@ RESISTANCE_MONEY = 2
RESISTANCE_TICKETS = 3
RESISTANCE_MERITS = 4
resistanceMenu = [RESISTANCE_TOONUP, RESISTANCE_RESTOCK, RESISTANCE_MONEY, RESISTANCE_TICKETS, RESISTANCE_MERITS]
randomResistanceMenu = [RESISTANCE_TOONUP, RESISTANCE_RESTOCK, RESISTANCE_MONEY, RESISTANCE_TICKETS]
resistanceDict = {
RESISTANCE_TOONUP: {
'menuName': TTLocalizer.ResistanceToonupMenu,
@ -138,7 +139,7 @@ def getItemValue(textId):
def getRandomId():
menuIndex = random.choice(resistanceMenu)
menuIndex = random.choice(randomResistanceMenu)
itemIndex = random.choice(getItems(menuIndex))
return encodeId(menuIndex, itemIndex)

View file

@ -43,13 +43,6 @@ only include the comma if there are multiple arguments.
class TTCodeRedemptionMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("TTCodeRedemptionMgrAI")
codes = {
'weed': {
'items': [
CatalogClothingItem.CatalogClothingItem(1821, 0)
],
'month': 4,
'day': 20
},
'gardening': {
'items': [
CatalogGardenStarterItem.CatalogGardenStarterItem()
@ -75,15 +68,6 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI):
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
def getMailboxCount(self, items):
count = 0
for item in items:
if item.getDeliveryTime() > 0:
count += 1
return count
def redeemCode(self, code):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
@ -119,9 +103,7 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI):
self.air.writeServerEvent('suspicious', avId, 'Toon tried to redeem non-existent code %s' % code)
def requestCodeRedeem(self, avId, av, items):
count = self.getMailboxCount(items)
if len(av.onOrder) + count > 5 or len(av.mailboxContents) + len(av.onOrder) + count >= ToontownGlobals.MaxMailboxContents:
if len(av.mailboxContents) + len(av.onOrder) + len(av.onGiftOrder) + len(items) >= ToontownGlobals.MaxMailboxContents:
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [3])
return
@ -129,8 +111,7 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI):
if item in av.onOrder:
continue
item.deliveryDate = int(time.time() / 60) + 0.01
av.onOrder.append(item)
av.addToDeliverySchedule(item)
av.b_setDeliverySchedule(av.onOrder)
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [0])

View file

@ -67,7 +67,7 @@ class CogdoBarrelRoomIntro(CogdoGameMovie):
self.frame.hide()
backgroundGui.removeNode()
self.toonDNA = ToonDNA.ToonDNA()
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14, 0)
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14)
self.toonHead = Toon.Toon()
self.toonHead.setDNA(self.toonDNA)
self.makeSuit('sc')

View file

@ -67,7 +67,7 @@ class CogdoElevatorMovie(CogdoGameMovie):
self.frame.hide()
backgroundGui.removeNode()
self.toonDNA = ToonDNA.ToonDNA()
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14, 0)
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14)
self.toonHead = Toon.Toon()
self.toonHead.setDNA(self.toonDNA)
self.makeSuit('sc')

View file

@ -71,7 +71,7 @@ class CogdoExecutiveSuiteIntro(CogdoGameMovie):
self.frame.hide()
backgroundGui.removeNode()
self.toonDNA = ToonDNA.ToonDNA()
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14, 0)
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14)
self.toonHead = Toon.Toon()
self.toonHead.setDNA(self.toonDNA)
self.makeSuit('sc')

View file

@ -53,7 +53,7 @@ class CogdoFlyingGameIntro(CogdoGameMovie):
def load(self):
CogdoGameMovie.load(self)
self.toonDNA = ToonDNA.ToonDNA()
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14, 0)
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14)
self.toonHead = Toon.Toon()
self.toonHead.setDNA(self.toonDNA)
self.makeSuit('sc')

View file

@ -180,7 +180,7 @@ SfxFiles = {'toonHitByDrop': 'phase_5/audio/sfx/tt_s_ara_cmg_toonHit.ogg',
'throw': 'phase_3.5/audio/sfx/AA_pie_throw_only.ogg',
'splat': 'phase_5/audio/sfx/SA_watercooler_spray_only.ogg',
'cogSpin': 'phase_3.5/audio/sfx/Cog_Death.ogg',
'cogDeath': 'phase_3.5/audio/sfx/ENC_cogfall_apart.ogg',
'cogDeath': 'phase_3.5/audio/sfx/ENC_cogfall_apart_1.ogg',
'bossCogAngry': 'phase_5/audio/sfx/tt_s_ara_cmg_bossCogAngry.ogg',
'cogStomp': 'phase_5/audio/sfx/tt_s_ara_cmg_cogStomp.ogg',
'quake': 'phase_5/audio/sfx/tt_s_ara_cmg_groundquake.ogg',

View file

@ -56,7 +56,7 @@ class CogdoMazeGameIntro(CogdoGameMovie):
def load(self):
CogdoGameMovie.load(self)
self.toonDNA = ToonDNA.ToonDNA()
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14, 0)
self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14)
self.toonHead = Toon.Toon()
self.toonHead.setDNA(self.toonDNA)
self.makeSuit('sc')

View file

@ -374,7 +374,7 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq
deathSuit = diner.getLoseActor()
ival = Sequence(Func(self.notify.debug, 'before actorinterval sit-lose'), ActorInterval(diner, 'sit-lose'), Func(self.notify.debug, 'before deathSuit.setHpr'), Func(deathSuit.setHpr, diner.getHpr()), Func(self.notify.debug, 'before diner.hide'), Func(diner.hide), Func(self.notify.debug, 'before deathSuit.reparentTo'), Func(deathSuit.reparentTo, self.chairLocators[chairIndex]), Func(self.notify.debug, 'befor ActorInterval lose'), ActorInterval(deathSuit, 'lose', duration=MovieUtil.SUIT_LOSE_DURATION), Func(self.notify.debug, 'before remove deathsuit'), Func(removeDeathSuit, diner, deathSuit, name='remove-death-suit-%d-%d' % (chairIndex, self.index)), Func(self.notify.debug, 'diner.stash'), Func(diner.stash))
spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg')
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart_%s.ogg' % random.randint(1, 6))
deathSoundTrack = Sequence(Wait(0.8), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2, node=deathSuit), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8, node=deathSuit), SoundInterval(deathSound, volume=0.32, node=deathSuit))
intervalName = 'dinerDie-%d-%d' % (self.index, chairIndex)
deathIval = Parallel(ival, deathSoundTrack)

View file

@ -22,6 +22,7 @@ class DistributedBattleFactoryAI(DistributedLevelBattleAI.DistributedLevelBattle
return self.level.factoryId
def handleToonsWon(self, toons):
self.handleCrateReward(toons)
for toon in toons:
recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId())
self.toonItems[toon.doId][0].extend(recovered)

View file

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

Some files were not shown because too many files have changed in this diff Show more