mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
Oops, forgot this one
This commit is contained in:
parent
139f562964
commit
7fe35ebb38
1 changed files with 45 additions and 96 deletions
|
@ -1,23 +1,21 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
import PhoneGlobals
|
||||
from toontown.catalog import CatalogScreen
|
||||
from toontown.catalog import CatalogItem
|
||||
from toontown.toontowngui import TTDialog
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import DistributedHouseInterior
|
||||
from direct.actor import Actor
|
||||
from direct.directnotify.DirectNotifyGlobal import *
|
||||
import DistributedFurnitureItem
|
||||
from direct.distributed import ClockDelta
|
||||
from direct.interval.IntervalGlobal import *
|
||||
from direct.showbase import PythonUtil
|
||||
from direct.showutil import Rope
|
||||
from direct.task import Task
|
||||
from direct.directnotify.DirectNotifyGlobal import *
|
||||
from pandac.PandaModules import *
|
||||
|
||||
import DistributedFurnitureItem
|
||||
import PhoneGlobals
|
||||
from toontown.catalog import CatalogItem
|
||||
from toontown.catalog.CatalogGUI import CatalogGUI
|
||||
from toontown.catalog.CatalogItemListGUI import CatalogItemListGUI
|
||||
from toontown.catalog.CatalogItemSorter import CatalogItemSorter
|
||||
from direct.interval.IntervalGlobal import *
|
||||
import string
|
||||
from toontown.quest import Quests
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toontowngui import TTDialog
|
||||
|
||||
from direct.task import Task
|
||||
|
||||
class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
||||
notify = directNotify.newCategory('DistributedPhone')
|
||||
|
@ -46,6 +44,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
self.intervalAvatar = None
|
||||
self.phoneInUse = 0
|
||||
self.origToonHpr = None
|
||||
return
|
||||
|
||||
def announceGenerate(self):
|
||||
self.notify.debug('announceGenerate')
|
||||
|
@ -117,7 +116,9 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
def setupCamera(self, mode):
|
||||
camera.wrtReparentTo(render)
|
||||
if mode == PhoneGlobals.PHONE_MOVIE_PICKUP:
|
||||
camera.posQuatInterval(1, (4, -4, base.localAvatar.getHeight()- 0.5), (35, -8, 0), other=base.localAvatar, blendType='easeOut').start()
|
||||
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:
|
||||
|
@ -135,6 +136,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
(self.model.find('**/CurveNode7'), (0, 0, 0))))
|
||||
self.cord.reparentTo(self.model)
|
||||
self.cord.node().setBounds(BoundingSphere(Point3(-1.0, -3.2, 2.6), 2.0))
|
||||
return
|
||||
|
||||
def disable(self):
|
||||
self.notify.debug('disable')
|
||||
|
@ -152,6 +154,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
self.freeAvatar()
|
||||
self.ignoreAll()
|
||||
DistributedFurnitureItem.DistributedFurnitureItem.disable(self)
|
||||
return
|
||||
|
||||
def delete(self):
|
||||
self.notify.debug('delete')
|
||||
|
@ -172,19 +175,20 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
return
|
||||
if self.hasLocalAvatar:
|
||||
self.freeAvatar()
|
||||
if hasattr(base, 'wantPets') and base.wantPets:
|
||||
if config.GetBool('want-pets', 1):
|
||||
base.localAvatar.lookupPetDNA()
|
||||
self.notify.debug('Entering Phone Sphere....')
|
||||
taskMgr.remove(self.uniqueName('ringDoLater'))
|
||||
self.ignore(self.phoneSphereEnterEvent)
|
||||
self.cr.playGame.getPlace().detectedPhoneCollision()
|
||||
self.hasLocalAvatar = 1
|
||||
self.sendUpdate('avatarEnter')
|
||||
self.sendUpdate('avatarEnter', [])
|
||||
|
||||
def __handlePhoneDone(self):
|
||||
self.sendUpdate('avatarExit')
|
||||
self.sendUpdate('avatarExit', [])
|
||||
self.ignore(self.phoneGuiDoneEvent)
|
||||
self.phoneGui = None
|
||||
return
|
||||
|
||||
def freeAvatar(self):
|
||||
if self.hasLocalAvatar:
|
||||
|
@ -197,6 +201,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
self.ignore(self.pickupMovieDoneEvent)
|
||||
self.accept(self.phoneSphereEnterEvent, self.__handleEnterSphere)
|
||||
self.lastTime = globalClock.getFrameTime()
|
||||
return
|
||||
|
||||
def setLimits(self, numHouseItems):
|
||||
self.numHouseItems = numHouseItems
|
||||
|
@ -207,25 +212,28 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
self.ignore(self.pickupMovieDoneEvent)
|
||||
if avId != 0:
|
||||
self.lastAvId = avId
|
||||
|
||||
self.lastTime = globalClock.getFrameTime()
|
||||
isLocalToon = avId == base.localAvatar.doId
|
||||
avatar = self.cr.doId2do.get(avId)
|
||||
self.notify.debug('setMovie: %s %s %s' % (mode, avId, isLocalToon))
|
||||
|
||||
if mode == PhoneGlobals.PHONE_MOVIE_CLEAR:
|
||||
self.notify.debug('setMovie: clear')
|
||||
self.numHouseItems = None
|
||||
if self.phoneInUse:
|
||||
self.clearInterval()
|
||||
self.numHouseItems = None
|
||||
self.phoneInUse = 0
|
||||
|
||||
elif mode == PhoneGlobals.PHONE_MOVIE_EMPTY:
|
||||
self.notify.debug('setMovie: empty')
|
||||
if isLocalToon:
|
||||
self.phoneDialog = TTDialog.TTDialog(dialogName='PhoneEmpty', style=TTDialog.Acknowledge, text=TTLocalizer.DistributedPhoneEmpty, text_wordwrap=15, fadeScreen=1, command=self.__clearDialog)
|
||||
self.numHouseItems = None
|
||||
self.phoneInUse = 0
|
||||
elif mode == PhoneGlobals.PHONE_MOVIE_NO_HOUSE:
|
||||
if isLocalToon:
|
||||
self.phoneDialog = TTDialog.TTDialog(dialogName='PhoneNoHouse', style=TTDialog.Acknowledge, text=TTLocalizer.DistributedPhoneNoHouse, text_wordwrap=15, fadeScreen=1, command=self.__clearDialog)
|
||||
self.numHouseItems = None
|
||||
self.phoneInUse = 0
|
||||
|
||||
elif mode == PhoneGlobals.PHONE_MOVIE_PICKUP:
|
||||
self.notify.debug('setMovie: gui')
|
||||
if avatar:
|
||||
interval = self.takePhoneInterval(avatar)
|
||||
if isLocalToon:
|
||||
|
@ -234,87 +242,27 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
self.acceptOnce(self.pickupMovieDoneEvent, self.__showPhoneGui)
|
||||
self.playInterval(interval, elapsed, avatar)
|
||||
self.phoneInUse = 1
|
||||
|
||||
elif mode == PhoneGlobals.PHONE_MOVIE_HANGUP:
|
||||
self.notify.debug('setMovie: gui')
|
||||
if avatar:
|
||||
interval = self.replacePhoneInterval(avatar)
|
||||
self.playInterval(interval, elapsed, avatar)
|
||||
self.numHouseItems = None
|
||||
self.phoneInUse = 0
|
||||
|
||||
else:
|
||||
self.notify.warning('unknown mode in setMovie: %s' % mode)
|
||||
return
|
||||
|
||||
def __showPhoneGui(self):
|
||||
if self.toonScale:
|
||||
self.sendUpdate('setNewScale', [self.toonScale[0], self.toonScale[1], self.toonScale[2]])
|
||||
|
||||
self.phoneGui = CatalogGUI(self, doneEvent=self.phoneGuiDoneEvent)
|
||||
# Hide the phone until we get our popular items set.
|
||||
self.phoneGui.hide()
|
||||
self.__generateCatalogPages()
|
||||
|
||||
self.acceptOnce('PopularItemsSet', self.__setPopularItems)
|
||||
self.cr.catalogManager.fetchPopularItems()
|
||||
|
||||
self.phoneGui = CatalogScreen.CatalogScreen(phone=self, doneEvent=self.phoneGuiDoneEvent)
|
||||
self.phoneGui.show()
|
||||
self.accept(self.phoneGuiDoneEvent, self.__handlePhoneDone)
|
||||
self.accept('phoneAsleep', self.__handlePhoneAsleep)
|
||||
|
||||
def __generateCatalogPages(self):
|
||||
itemList = base.localAvatar.monthlyCatalog.generateList()
|
||||
itemList += base.localAvatar.weeklyCatalog.generateList()
|
||||
itemList += base.localAvatar.backCatalog.generateList()
|
||||
|
||||
sortedItems = CatalogItemSorter(itemList).sortItems()
|
||||
|
||||
catalogItemList = CatalogItemListGUI(self.phoneGui)
|
||||
for item in sortedItems['FURNITURE']:
|
||||
catalogItemList.addItem(item, 'Furniture')
|
||||
for item in sortedItems['UNSORTED']:
|
||||
catalogItemList.addItem(item, 'Unsorted Items')
|
||||
self.phoneGui.tabButtons['FURNITURE_TAB'].setCatalogItemPages(catalogItemList.generatePages())
|
||||
self.phoneGui.tabButtons['FURNITURE_TAB'].tabClicked()
|
||||
|
||||
catalogItemList = CatalogItemListGUI(self.phoneGui)
|
||||
for item in sortedItems['EMOTIONS']:
|
||||
catalogItemList.addItem(item, 'Emotions')
|
||||
self.phoneGui.tabButtons['EMOTE_TAB'].setCatalogItemPages(catalogItemList.generatePages())
|
||||
self.phoneGui.tabButtons['EMOTE_TAB'].tabClicked()
|
||||
|
||||
catalogItemList = CatalogItemListGUI(self.phoneGui)
|
||||
for item in sortedItems['SPECIAL']:
|
||||
catalogItemList.addItem(item, 'Special')
|
||||
self.phoneGui.tabButtons['SPECIAL_TAB'].setCatalogItemPages(catalogItemList.generatePages())
|
||||
self.phoneGui.tabButtons['SPECIAL_TAB'].tabClicked()
|
||||
|
||||
catalogItemList = CatalogItemListGUI(self.phoneGui)
|
||||
for item in sortedItems['CLOTHING']:
|
||||
catalogItemList.addItem(item, 'Clothing')
|
||||
self.phoneGui.tabButtons['CLOTHING_TAB'].setCatalogItemPages(catalogItemList.generatePages())
|
||||
self.phoneGui.tabButtons['CLOTHING_TAB'].tabClicked()
|
||||
|
||||
catalogItemList = CatalogItemListGUI(self.phoneGui)
|
||||
for item in sortedItems['PHRASES']:
|
||||
catalogItemList.addItem(item, 'Phrases')
|
||||
self.phoneGui.tabButtons['PHRASES_TAB'].setCatalogItemPages(catalogItemList.generatePages())
|
||||
self.phoneGui.tabButtons['PHRASES_TAB'].tabClicked()
|
||||
|
||||
catalogItemList = CatalogItemListGUI(self.phoneGui)
|
||||
for item in sortedItems['NAMETAG']:
|
||||
catalogItemList.addItem(item, 'Nametag')
|
||||
self.phoneGui.tabButtons['NAMETAG_TAB'].setCatalogItemPages(catalogItemList.generatePages())
|
||||
self.phoneGui.tabButtons['NAMETAG_TAB'].tabClicked()
|
||||
|
||||
def __setPopularItems(self):
|
||||
# Generate a list of popular items.
|
||||
itemList = self.cr.catalogManager.popularItems.generateList()
|
||||
catalogItemList = CatalogItemListGUI(self.phoneGui)
|
||||
for item in itemList:
|
||||
catalogItemList.addItem(item, 'Popular')
|
||||
self.phoneGui.tabButtons['POPULAR_TAB'].setCatalogItemPages(catalogItemList.generatePages())
|
||||
# Now that the popular items are set we can show the CatalogGUI
|
||||
self.phoneGui.show()
|
||||
# We want our default tab to be the popular tab. We need to click it twice to prevent a glitch.
|
||||
self.phoneGui.tabButtons['POPULAR_TAB'].tabClicked()
|
||||
|
||||
def __handlePhoneAsleep(self):
|
||||
self.ignore('phoneAsleep')
|
||||
if self.phoneGui:
|
||||
|
@ -327,10 +275,10 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
self.sendUpdate('requestPurchaseMessage', [context, blob, optional])
|
||||
|
||||
def requestGiftPurchase(self, item, targetDoID, callback, optional = -1):
|
||||
print 'in the client phone'
|
||||
blob = item.getBlob(store=CatalogItem.Customization)
|
||||
context = self.getCallbackContext(callback, [item])
|
||||
self.sendUpdate('requestGiftPurchaseMessage', [context, targetDoID,
|
||||
blob, optional])
|
||||
self.sendUpdate('requestGiftPurchaseMessage', [context, targetDoID, blob, optional])
|
||||
|
||||
def requestPurchaseResponse(self, context, retcode):
|
||||
self.doCallbackContext(context, [retcode])
|
||||
|
@ -342,6 +290,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
self.phoneDialog.cleanup()
|
||||
self.phoneDialog = None
|
||||
self.freeAvatar()
|
||||
return
|
||||
|
||||
def takePhoneInterval(self, toon):
|
||||
torso = TextEncoder.upper(toon.style.torso[0])
|
||||
|
@ -401,6 +350,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
if avatar:
|
||||
self.accept(avatar.uniqueName('disable'), self.clearInterval)
|
||||
self.intervalAvatar = avatar
|
||||
return
|
||||
|
||||
def clearInterval(self):
|
||||
if self.interval != None:
|
||||
|
@ -412,6 +362,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
self.__receiverToPhone()
|
||||
self.model.pose('SS_phoneOut', 0)
|
||||
self.phoneInUse = 0
|
||||
return
|
||||
|
||||
def ringIfHasPhoneQuest(self, task):
|
||||
if Quests.avatarHasPhoneQuest(base.localAvatar) and not Quests.avatarHasCompletedPhoneQuest(base.localAvatar):
|
||||
|
@ -426,11 +377,9 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
w = 0.05
|
||||
shakeOnce = Sequence(Func(phone.setR, r), Wait(w), Func(phone.setR, -r), Wait(w))
|
||||
shakeSeq = Sequence()
|
||||
for i in xrange(16):
|
||||
for i in range(16):
|
||||
shakeSeq.append(shakeOnce)
|
||||
|
||||
ringIval = Parallel(Func(base.playSfx, self.ringSfx), shakeSeq, Func(phone.setR, 0))
|
||||
self.playInterval(ringIval, 0.0, None)
|
||||
|
||||
def purchaseItemComplete(self):
|
||||
self.phoneGui.updateItems()
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue