estate: catalog work begins

This commit is contained in:
Aidan 2014-05-27 16:14:38 -04:00
parent 019f1c0231
commit 596bcaabca
11 changed files with 100 additions and 18 deletions

View file

@ -56,6 +56,9 @@ from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
# Toontorial
from toontown.tutorial.TutorialManagerAI import TutorialManagerAI
# Catalogs.
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
# Magic Words!
from panda3d.core import PStatClient
from otp.ai.MagicWordGlobal import *
@ -186,6 +189,9 @@ class ToontownAIRepository(ToontownInternalRepository):
self.tutorialManager = TutorialManagerAI(self)
self.tutorialManager.generateWithRequired(2)
self.catalogManager = CatalogManagerAI(self)
self.catalogManager.generateWithRequired(2)
def createZones(self):
"""

View file

@ -1,9 +1,30 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from CatalogGenerator import CatalogGenerator
from toontown.toonbase import ToontownGlobals
import time
class CatalogManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("CatalogManagerAI")
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.catalogGenerator = CatalogGenerator()
def startCatalog(self):
pass
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if av:
self.deliverCatalogFor(av)
def deliverCatalogFor(self, av):
monthlyCatalog = self.catalogGenerator.generateMonthlyCatalog(av, av.catalogScheduleCurrentWeek)
weeklyCatalog = self.catalogGenerator.generateWeeklyCatalog(av, av.catalogScheduleCurrentWeek, monthlyCatalog)
backCatalog = self.catalogGenerator.generateBackCatalog(av, av.catalogScheduleCurrentWeek, av.catalogScheduleCurrentWeek - 1, monthlyCatalog)
av.b_setCatalog(monthlyCatalog, weeklyCatalog, backCatalog)
av.b_setCatalogSchedule(av.catalogScheduleCurrentWeek + 1, time.time() + 604800)
av.b_setCatalogNotify(ToontownGlobals.NewItems, av.mailboxNotify)
def isItemReleased(self, accessory):
return 1

View file

@ -14,6 +14,8 @@ from direct.actor import Actor
import random
from toontown.toon import DistributedToon
from direct.directnotify import DirectNotifyGlobal
from otp.nametag.ChatBalloon import ChatBalloon
from otp.nametag import NametagGroup
NUM_CATALOG_ROWS = 3
NUM_CATALOG_COLS = 2
CatalogPanelCenters = [[Point3(-0.95, 0, 0.91), Point3(-0.275, 0, 0.91)], [Point3(-0.95, 0, 0.275), Point3(-0.275, 0, 0.275)], [Point3(-0.95, 0, -0.4), Point3(-0.275, 0, -0.4)]]
@ -933,9 +935,10 @@ class CatalogScreen(DirectFrame):
self.clearClarabelleChat()
if not self.clarabelleChatBalloon:
self.clarabelleChatBalloon = loader.loadModel('phase_3/models/props/chatbox')
self.clarabelleChat = ChatBalloon(self.clarabelleChatBalloon.node())
chatNode = self.clarabelleChat.generate(str, ToontownGlobals.getInterfaceFont(), 10, Vec4(0, 0, 0, 1), Vec4(1, 1, 1, 1), 0, 0, 0, NodePath(), 0, 0, NodePath())
self.clarabelleChatNP = self.attachNewNode(chatNode, 1000)
self.clarabelleChat = ChatBalloon(self.clarabelleChatBalloon)
#chatNode = self.clarabelleChat.generate(str, ToontownGlobals.getInterfaceFont(), 10, Vec4(0, 0, 0, 1), Vec4(1, 1, 1, 1), 0, 0, 0, NodePath(), 0, 0, NodePath())
chatNode = self.clarabelleChat.generate(str, ToontownGlobals.getInterfaceFont())[0]
self.clarabelleChatNP = self.attachNewNode(chatNode.node(), 1000)
self.clarabelleChatNP.setScale(0.08)
self.clarabelleChatNP.setPos(0.7, 0, 0.6)
if timeout:

View file

@ -56,6 +56,7 @@ class DNAFurnitureReaderAI:
else:
self.notify.error('Could not find "interior" in DNA!')
self.itemList.append(CatalogFurnitureItem(1399, posHpr=self.phonePos))
# Every child in the interior node is a prop, thus:
for child in interior.children:
code = child.getCode()
@ -72,7 +73,6 @@ class DNAFurnitureReaderAI:
h, p, r = child.getHpr()
self.itemList.append(CatalogFurnitureItem(itemId,
posHpr=(x, y, z, h, p, r)))
self.itemList.append(CatalogFurnitureItem(1399, posHpr=self.phonePos))
def getList(self):
if not self.itemList:

View file

@ -100,6 +100,7 @@ class DistributedClosetAI(DistributedFurnitureItemAI):
return
elif finished == 1:
self.d_setMovie(ClosetGlobals.CLOSET_MOVIE_COMPLETE, avId, globalClockDelta.getRealNetworkTime())
taskMgr.doMethodLater(1, self.__resetMovie, 'resetMovie-%d' % self.getDoId(), extraArgs=[])
self.d_setState(ClosetGlobals.CLOSED, 0, self.furnitureMgr.ownerId, self.gender, self.topList, self.botList)
av.b_setDNAString(self.customerDNA.makeNetString())
self.removedBottoms = []
@ -146,6 +147,7 @@ class DistributedClosetAI(DistributedFurnitureItemAI):
self.removedBottoms = []
self.removedTops = []
self.d_setMovie(ClosetGlobals.CLOSET_MOVIE_COMPLETE, avId, globalClockDelta.getRealNetworkTime())
taskMgr.doMethodLater(1, self.__resetMovie, 'resetMovie-%d' % self.getDoId(), extraArgs=[])
self.d_setState(ClosetGlobals.CLOSED, 0, self.furnitureMgr.ownerId, self.gender, self.topList, self.botList)
self.customerDNA = None
self.avId = None
@ -158,6 +160,9 @@ class DistributedClosetAI(DistributedFurnitureItemAI):
def d_setMovie(self, movie, avId, time):
self.sendUpdate('setMovie', [movie, avId, time])
def __resetMovie(self):
self.d_setMovie(ClosetGlobals.CLOSET_MOVIE_CLEAR, 0, globalClockDelta.getRealNetworkTime())
def setMovie(self, todo0, todo1, todo2):
pass

View file

@ -2,7 +2,7 @@ from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.catalog.CatalogItemList import CatalogItemList
from toontown.catalog import CatalogItem
from toontown.catalog.CatalogFurnitureItem import CatalogFurnitureItem, BankToMoney, ClosetToClothes
from toontown.catalog.CatalogFurnitureItem import CatalogFurnitureItem, FLCloset, FLBank, FLPhone
from toontown.toonbase import ToontownGlobals
from DistributedFurnitureItemAI import DistributedFurnitureItemAI
from DistributedBankAI import DistributedBankAI
@ -88,11 +88,11 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
self.items = []
for item in items:
if item.furnitureType in ClosetToClothes.keys():
if item.getFlags() & FLCloset:
do = DistributedClosetAI(self.air, self, item)
elif item.furnitureType in BankToMoney.keys():
elif item.getFlags() & FLBank:
do = DistributedBankAI(self.air, self, item)
elif item.furnitureType == 1399:
elif item.getFlags() & FLPhone:
do = DistributedPhoneAI(self.air, self, item)
else:
do = DistributedFurnitureItemAI(self.air, self, item)

View file

@ -45,7 +45,7 @@ class DistributedHouseInteriorAI(DistributedObjectAI):
dnaFile = interior[0]
phonePos = interior[2]
phonePos = interior[1]
# Load DNA...
dnaData = self.air.loadDNA(dnaFile)

View file

@ -116,7 +116,9 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
def setupCamera(self, mode):
camera.wrtReparentTo(render)
if mode == PhoneGlobals.PHONE_MOVIE_PICKUP:
camera.lerpPosHpr(4, -4, base.localAvatar.getHeight() - 0.5, 35, -8, 0, 1, other=base.localAvatar, blendType='easeOut', task=self.uniqueName('lerpCamera'))
quat = Quat()
quat.setHpr((35, -8, 0))
LerpPosQuatInterval(camera, 1, (4, -4, base.localAvatar.getHeight() - 0.5), quat, blendType='easeOut', other=base.localAvatar).start()
def setupCord(self):
if self.cord:
@ -173,7 +175,8 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
return
if self.hasLocalAvatar:
self.freeAvatar()
base.localAvatar.lookupPetDNA()
if base.config.GetBool('want-pets', 1):
base.localAvatar.lookupPetDNA()
self.notify.debug('Entering Phone Sphere....')
taskMgr.remove(self.uniqueName('ringDoLater'))
self.ignore(self.phoneSphereEnterEvent)

View file

@ -1,25 +1,57 @@
from direct.directnotify import DirectNotifyGlobal
from toontown.estate.DistributedFurnitureItemAI import DistributedFurnitureItemAI
from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import *
import PhoneGlobals
class DistributedPhoneAI(DistributedFurnitureItemAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPhoneAI")
def setInitialScale(self, todo0, todo1, todo2):
def __init__(self, air, furnitureMgr, item):
DistributedFurnitureItemAI.__init__(self, air, furnitureMgr, item)
self.avId = None
def setInitialScale(self, sx, sy, sz):
pass
def getInitialScale(self):
return (1, 1, 1)
def setNewScale(self, todo0, todo1, todo2):
pass
def setNewScale(self, sx, sy, sz):
if sx + sy + sz < 5:
return
self.sendUpdate('setInitialScale', [sx, sy, sz])
def avatarEnter(self):
pass
avId = self.air.getAvatarIdFromSender()
if self.avId:
if self.avId == avId:
self.air.writeServerEvent('suspicious', avId=avId, issue='Tried to use a phone twice!')
return
self.sendUpdateToAvatarId(avId, 'freeAvatar', [])
return
av = self.air.doId2do.get(avId)
if not av:
return
if len(av.monthlyCatalog) == 0 and len(av.weeklyCatalog) == 0 and len(av.backCatalog) == 0:
self.d_setMovie(PhoneGlobals.PHONE_MOVIE_EMPTY, avId, globalClockDelta.getRealNetworkTime())
taskMgr.doMethodLater(1, self.__resetMovie, 'resetMovie-%d' % self.getDoId(), extraArgs=[])
return
self.avId = avId
self.d_setMovie(PhoneGlobals.PHONE_MOVIE_PICKUP, avId, globalClockDelta.getRealNetworkTime())
self.sendUpdateToAvatarId(avId, 'setLimits', [20]) # TODO - what is the correct number here
av.b_setCatalogNotify(ToontownGlobals.NoItems, av.mailboxNotify)
def avatarExit(self):
pass
avId = self.air.getAvatarIdFromSender()
if avId != self.avId:
self.air.writeServerEvent('suspicious', avId=avId, issue='Tried to exit a phone they weren\'t using!')
return
self.avId = None
self.d_setMovie(PhoneGlobals.PHONE_MOVIE_HANGUP, avId, globalClockDelta.getRealNetworkTime())
taskMgr.doMethodLater(1, self.__resetMovie, 'resetMovie-%d' % self.getDoId(), extraArgs=[])
def freeAvatar(self):
pass
@ -29,6 +61,12 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
def setMovie(self, todo0, todo1, todo2):
pass
def d_setMovie(self, mode, avId, time):
self.sendUpdate('setMovie', [mode, avId, time])
def __resetMovie(self):
self.d_setMovie(PhoneGlobals.PHONE_MOVIE_CLEAR, 0, globalClockDelta.getRealNetworkTime())
def requestPurchaseMessage(self, todo0, todo1, todo2):
pass

View file

@ -5063,6 +5063,10 @@ def fanfare():
""" Give target toon a fanfare for the lolz. """
spellbook.getTarget().magicFanfare()
return "Jason: Because the trumpets they go...~"
@magicWord(category=CATEGORY_OVERRIDE)
def catalog():
simbase.air.catalogManager.deliverCatalogFor(spellbook.getTarget())
@magicWord(category=CATEGORY_CHARACTERSTATS, types=[int])
def pouch(amt):

View file

@ -113,6 +113,8 @@ class NewsPageButtonManager(FSM.FSM):
self.__blinkIval.pause()
def isNewIssueButtonShown(self):
if not base.config.GetBool('want-news-tab', 1):
return False
if localAvatar.getLastTimeReadNews() < base.cr.inGameNewsMgr.getLatestIssue():
return True
return False