From 504472441025d22d84705f3d4e7f0afa437035f5 Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 24 Jun 2015 11:21:50 -0400 Subject: [PATCH 01/27] Remove TTI nametag/chat/margin files --- toontown/chat/ChatBalloon.py | 120 -------- toontown/chat/ChatGlobals.py | 48 ---- toontown/chat/WhisperPopup.py | 341 ---------------------- toontown/margins/MarginCell.py | 40 --- toontown/margins/MarginGlobals.py | 9 - toontown/margins/MarginManager.py | 76 ----- toontown/margins/MarginVisible.py | 59 ---- toontown/margins/__init__.py | 0 toontown/nametag/Nametag.py | 308 -------------------- toontown/nametag/Nametag2d.py | 322 --------------------- toontown/nametag/Nametag3d.py | 185 ------------ toontown/nametag/NametagFloat2d.py | 21 -- toontown/nametag/NametagFloat3d.py | 8 - toontown/nametag/NametagGlobals.py | 247 ---------------- toontown/nametag/NametagGroup.py | 441 ----------------------------- toontown/nametag/__init__.py | 0 16 files changed, 2225 deletions(-) delete mode 100755 toontown/chat/ChatBalloon.py delete mode 100755 toontown/chat/ChatGlobals.py delete mode 100755 toontown/chat/WhisperPopup.py delete mode 100755 toontown/margins/MarginCell.py delete mode 100755 toontown/margins/MarginGlobals.py delete mode 100755 toontown/margins/MarginManager.py delete mode 100755 toontown/margins/MarginVisible.py delete mode 100755 toontown/margins/__init__.py delete mode 100755 toontown/nametag/Nametag.py delete mode 100755 toontown/nametag/Nametag2d.py delete mode 100755 toontown/nametag/Nametag3d.py delete mode 100755 toontown/nametag/NametagFloat2d.py delete mode 100755 toontown/nametag/NametagFloat3d.py delete mode 100755 toontown/nametag/NametagGlobals.py delete mode 100755 toontown/nametag/NametagGroup.py delete mode 100755 toontown/nametag/__init__.py diff --git a/toontown/chat/ChatBalloon.py b/toontown/chat/ChatBalloon.py deleted file mode 100755 index 6a811456..00000000 --- a/toontown/chat/ChatBalloon.py +++ /dev/null @@ -1,120 +0,0 @@ -from panda3d.core import * - - -class ChatBalloon(NodePath): - TEXT_X_OFFSET = -0.04 - TEXT_Y_OFFSET = -0.05 - - # Proportion of the Z offset based on the default line height, and the new - # line height: - TEXT_Z_OFFSET = -(4.0/33.0) - - TEXT_MIN_WIDTH = 1.55 - TEXT_MIN_HEIGHT = 1.1 - TEXT_GLYPH_SCALE = 0.95 - TEXT_GLYPH_SHIFT = -0.05 - - BALLOON_X_PADDING = 0.525 - BALLOON_Z_PADDING = 0.5 - - BUTTON_SCALE = 6 - BUTTON_SHIFT = (0, 0, 0.6) - - def __init__(self, model, modelWidth, modelHeight, textNode, - foreground=VBase4(0, 0, 0, 1), background=VBase4(1, 1, 1, 1), - reversed=False, button=None): - NodePath.__init__(self, 'chatBalloon') - - self.model = model - self.modelWidth = modelWidth - self.modelHeight = modelHeight - self.textNode = textNode - self.foreground = foreground - self.background = background - self.button = button - - # Set the TextNode color: - self.textNode.setTextColor(self.foreground) - - # Create a balloon: - self.balloon = self.model.copyTo(self) - self.balloon.setColor(self.background) - self.balloon.setTransparency(self.background[3] < 1) - - # Attach the TextNode: - self.textNodePath = self.attachNewNode(self.textNode) - self.textNodePath.setTransparency(self.foreground[3] < 1) - self.textNodePath.setAttrib(DepthWriteAttrib.make(0)) - - # Resize the balloon as necessary: - middle = self.balloon.find('**/middle') - top = self.balloon.find('**/top') - self.textWidth = self.textNode.getWidth() - if self.textWidth < self.TEXT_MIN_WIDTH: - self.textWidth = self.TEXT_MIN_WIDTH - paddedWidth = self.textWidth + (self.BALLOON_X_PADDING*2) - self.balloon.setSx(paddedWidth / modelWidth) - self.textHeight = textNode.getHeight() - if self.textHeight < self.TEXT_MIN_HEIGHT: - self.textHeight = self.TEXT_MIN_HEIGHT - paddedHeight = self.textHeight + (self.BALLOON_Z_PADDING*2) - middle.setSz(paddedHeight - 1.5) # Compensate for the top, as well. - top.setZ(middle, 1) - - if reversed: - self.balloon.setSx(-self.balloon.getSx()) - self.balloon.setTwoSided(True) # Render the backface of the balloon. - - self.width = paddedWidth - self.height = paddedHeight - - # Position the TextNode: - self.center = self.balloon.getBounds().getCenter() - self.textNodePath.setPos(self.center) - self.textNodePath.setY(self.TEXT_Y_OFFSET) - self.textNodePath.setX(self.textNodePath, -(self.textWidth/2)) - if self.textWidth == self.TEXT_MIN_WIDTH: - centerX = (self.TEXT_MIN_WIDTH-self.textNode.getWidth()) / 2.0 - self.textNodePath.setX(self.textNodePath, centerX) - self.textNodePath.setZ(top, -self.BALLOON_Z_PADDING + self.TEXT_Z_OFFSET) - if self.textHeight == self.TEXT_MIN_HEIGHT: - centerZ = (ChatBalloon.TEXT_MIN_HEIGHT-self.textNode.getHeight()) / 2.0 - self.textNodePath.setZ(self.textNodePath, -centerZ) - self.textNodePath.setX(self.textNodePath, self.TEXT_X_OFFSET) - - # Add a button if one is given: - if self.button is not None: - self.buttonNodePath = button.copyTo(self) - self.buttonNodePath.setPos(self.textNodePath, self.textWidth, 0, -self.textHeight) - self.buttonNodePath.setPos(self.buttonNodePath, ChatBalloon.BUTTON_SHIFT) - self.buttonNodePath.setScale(ChatBalloon.BUTTON_SCALE) - else: - self.buttonNodePath = None - - # Finally, enable anti-aliasing: - self.setAntialias(AntialiasAttrib.MMultisample) - - def setForeground(self, foreground): - self.foreground = foreground - self.textNode.setTextColor(self.foreground) - - def getForeground(self): - return self.foreground - - def setBackground(self, background): - self.background = background - self.balloon.setColor(self.background) - - def getBackground(self): - return self.background - - def setButton(self, button): - if self.buttonNodePath is not None: - self.buttonNodePath.removeNode() - self.buttonNodePath = None - - if button is not None: - self.buttonNodePath = button.copyTo(self) - self.buttonNodePath.setPos(self.textNodePath, self.textWidth, 0, -self.textHeight) - self.buttonNodePath.setPos(self.buttonNodePath, ChatBalloon.BUTTON_SHIFT) - self.buttonNodePath.setScale(ChatBalloon.BUTTON_SCALE) diff --git a/toontown/chat/ChatGlobals.py b/toontown/chat/ChatGlobals.py deleted file mode 100755 index 359bf773..00000000 --- a/toontown/chat/ChatGlobals.py +++ /dev/null @@ -1,48 +0,0 @@ -CFSpeech = 1 << 0 -CFThought = 1 << 1 -CFQuicktalker = 1 << 2 -CFTimeout = 1 << 3 -CFPageButton = 1 << 4 -CFQuitButton = 1 << 5 -CFNoQuitButton = 1 << 6 -CFReversed = 1 << 7 - -WTNormal = 0 -WTSystem = 1 -WTBattleSOS = 2 -WTEmote = 3 -WTToontownBoardingGroup = 4 - -# Foreground, background: -WhisperColors = { - WTNormal: ( - ((0.0, 0.0, 0.0, 1.0), (0.2, 0.6, 0.8, 0.6)), # Normal - ((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)), # Click - ((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.9, 0.6)), # Rollover - ((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled - ), - WTSystem: ( - ((0.0, 0.0, 0.0, 1.0), (0.8, 0.3, 0.6, 0.6)), # Normal - ((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)), # Click - ((0.0, 0.0, 0.0, 1.0), (0.8, 0.4, 1.0, 0.6)), # Rollover - ((0.0, 0.0, 0.0, 1.0), (0.8, 0.3, 0.6, 0.6)) # Disabled - ), - WTEmote: ( - ((0.0, 0.0, 0.0, 1.0), (0.9, 0.5, 0.1, 0.6)), # Normal - ((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)), # Click - ((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.2, 0.6)), # Rollover - ((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.1, 0.6)), # Disabled - ), - WTBattleSOS: ( - ((0.0, 0.0, 0.0, 1.0), (0.2, 0.6, 0.8, 0.6)), # Normal - ((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)), # Click - ((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.9, 0.6)), # Rollover - ((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled - ), - WTToontownBoardingGroup: ( - ((0.0, 0.0, 0.0, 1.0), (0.9, 0.5, 0.1, 0.6)), # Normal - ((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)), # Click - ((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.2, 0.6)), # Rollover - ((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.1, 0.6)) # Disabled - ) -} diff --git a/toontown/chat/WhisperPopup.py b/toontown/chat/WhisperPopup.py deleted file mode 100755 index a584d98e..00000000 --- a/toontown/chat/WhisperPopup.py +++ /dev/null @@ -1,341 +0,0 @@ -from panda3d.core import TextNode, PGButton, Point3 - -from toontown.chat import ChatGlobals -from toontown.chat.ChatBalloon import ChatBalloon -from toontown.margins import MarginGlobals -from toontown.margins.MarginVisible import MarginVisible -from toontown.nametag import NametagGlobals -from toontown.toontowngui.Clickable2d import Clickable2d - - -class WhisperQuitButton(Clickable2d): - CONTENTS_SCALE = 12 - - def __init__(self, whisperPopup): - Clickable2d.__init__(self, 'WhisperQuitButton') - - self.whisperPopup = whisperPopup - - self.contents.setScale(self.CONTENTS_SCALE) - self.contents.hide() - - self.nodePath = None - - self.update() - - def destroy(self): - self.ignoreAll() - - if self.nodePath is not None: - self.nodePath.removeNode() - self.nodePath = None - - Clickable2d.destroy(self) - - def getUniqueName(self): - return 'WhisperQuitButton-' + str(id(self)) - - def update(self): - if self.nodePath is not None: - self.nodePath.removeNode() - self.nodePath = None - - self.contents.node().removeAllChildren() - - quitButtonNode = NametagGlobals.quitButton[self.clickState] - self.nodePath = quitButtonNode.copyTo(self.contents) - - def applyClickState(self, clickState): - if self.nodePath is not None: - self.nodePath.removeNode() - self.nodePath = None - - quitButtonNode = NametagGlobals.quitButton[clickState] - self.nodePath = quitButtonNode.copyTo(self.contents) - - def setClickState(self, clickState): - self.applyClickState(clickState) - - if self.isHovering() or self.whisperPopup.isHovering(): - self.contents.show() - elif self.clickState == PGButton.SDepressed: - self.contents.show() - else: - self.contents.hide() - - Clickable2d.setClickState(self, clickState) - - def enterDepressed(self): - base.playSfx(NametagGlobals.clickSound) - - def enterRollover(self): - if self.lastClickState != PGButton.SDepressed: - base.playSfx(NametagGlobals.rolloverSound) - - def updateClickRegion(self): - if self.nodePath is not None: - right = NametagGlobals.quitButtonWidth / 2.0 - left = -right - top = NametagGlobals.quitButtonHeight / 2.0 - bottom = -top - - self.setClickRegionFrame(left, right, bottom, top) - - -class WhisperPopup(Clickable2d, MarginVisible): - CONTENTS_SCALE = 0.25 - - TEXT_MAX_ROWS = 6 - TEXT_WORD_WRAP = 8 - - QUIT_BUTTON_SHIFT = (0.42, 0, 0.42) - - WHISPER_TIMEOUT_MIN = 10 - WHISPER_TIMEOUT_MAX = 20 - - def __init__(self, text, font, whisperType, timeout=None): - Clickable2d.__init__(self, 'WhisperPopup') - MarginVisible.__init__(self) - - self.text = text - self.font = font - self.whisperType = whisperType - if timeout is None: - self.timeout = len(text) * 0.33 - if self.timeout < self.WHISPER_TIMEOUT_MIN: - self.timeout = self.WHISPER_TIMEOUT_MIN - elif self.timeout > self.WHISPER_TIMEOUT_MAX: - self.timeout = self.WHISPER_TIMEOUT_MAX - else: - self.timeout = timeout - - self.active = False - - self.senderName = '' - self.fromId = 0 - - self.contents.setScale(self.CONTENTS_SCALE) - - self.whisperColor = ChatGlobals.WhisperColors[self.whisperType] - - self.textNode = TextNode('text') - self.textNode.setWordwrap(self.TEXT_WORD_WRAP) - self.textNode.setTextColor(self.whisperColor[PGButton.SInactive][0]) - self.textNode.setFont(self.font) - self.textNode.setText(self.text) - - self.chatBalloon = None - self.quitButton = None - - self.timeoutTaskName = self.getUniqueName() + '-timeout' - self.timeoutTask = None - - self.quitEvent = self.getUniqueName() + '-quit' - self.accept(self.quitEvent, self.destroy) - - self.setPriority(MarginGlobals.MP_high) - self.setVisible(True) - - self.update() - - self.accept('MarginVisible-update', self.update) - - def destroy(self): - self.ignoreAll() - - if self.timeoutTask is not None: - taskMgr.remove(self.timeoutTask) - self.timeoutTask = None - - if self.chatBalloon is not None: - self.chatBalloon.removeNode() - self.chatBalloon = None - - if self.quitButton is not None: - self.quitButton.destroy() - self.quitButton = None - - self.textNode = None - - Clickable2d.destroy(self) - - def getUniqueName(self): - return 'WhisperPopup-' + str(id(self)) - - def update(self): - if self.chatBalloon is not None: - self.chatBalloon.removeNode() - self.chatBalloon = None - - if self.quitButton is not None: - self.quitButton.destroy() - self.quitButton = None - - self.contents.node().removeAllChildren() - - self.draw() - - if self.cell is not None: - # We're in the margin display. Reposition our content, and update - # the click region: - self.reposition() - self.updateClickRegion() - else: - # We aren't in the margin display. Disable the click region if one - # is present: - if self.region is not None: - self.region.setActive(False) - - def draw(self): - if self.isClickable(): - foreground, background = self.whisperColor[self.clickState] - else: - foreground, background = self.whisperColor[PGButton.SInactive] - self.chatBalloon = ChatBalloon( - NametagGlobals.chatBalloon2dModel, - NametagGlobals.chatBalloon2dWidth, - NametagGlobals.chatBalloon2dHeight, self.textNode, - foreground=foreground, background=background - ) - self.chatBalloon.reparentTo(self.contents) - - # Calculate the center of the TextNode: - left, right, bottom, top = self.textNode.getFrameActual() - center = self.contents.getRelativePoint( - self.chatBalloon.textNodePath, - ((left+right) / 2.0, 0, (bottom+top) / 2.0)) - - # Translate the chat balloon along the inverse: - self.chatBalloon.setPos(self.chatBalloon, -center) - - # Draw the quit button: - self.quitButton = WhisperQuitButton(self) - quitButtonNodePath = self.contents.attachNewNode(self.quitButton) - - # Move the quit button to the top right of the TextNode: - quitButtonNodePath.setPos(self.contents.getRelativePoint( - self.chatBalloon.textNodePath, (right, 0, top))) - - # Apply the quit button shift: - quitButtonNodePath.setPos(quitButtonNodePath, self.QUIT_BUTTON_SHIFT) - - # Allow the quit button to close this whisper: - self.quitButton.setClickEvent(self.quitEvent) - - def manage(self, marginManager): - MarginVisible.manage(self, marginManager) - - self.timeoutTask = taskMgr.doMethodLater( - self.timeout, self.unmanage, self.timeoutTaskName, [marginManager]) - - def unmanage(self, marginManager): - MarginVisible.unmanage(self, marginManager) - - self.destroy() - - def setClickable(self, senderName, fromId): - self.senderName = senderName - self.fromId = fromId - self.setClickEvent('clickedWhisper', extraArgs=[fromId]) - self.setActive(True) - - def applyClickState(self, clickState): - if self.chatBalloon is not None: - foreground, background = self.whisperColor[clickState] - self.chatBalloon.setForeground(foreground) - self.chatBalloon.setBackground(background) - - def setClickState(self, clickState): - if self.isClickable(): - self.applyClickState(clickState) - else: - self.applyClickState(PGButton.SInactive) - - if self.isHovering() or self.quitButton.isHovering(): - self.quitButton.contents.show() - elif self.quitButton.getClickState() == PGButton.SDepressed: - self.quitButton.contents.show() - else: - self.quitButton.contents.hide() - - Clickable2d.setClickState(self, clickState) - - def enterDepressed(self): - if self.isClickable(): - base.playSfx(NametagGlobals.clickSound) - - def enterRollover(self): - if self.isClickable() and (self.lastClickState != PGButton.SDepressed): - base.playSfx(NametagGlobals.rolloverSound) - - def updateClickRegion(self): - if self.chatBalloon is not None: - right = self.chatBalloon.width / 2.0 - left = -right - top = self.chatBalloon.height / 2.0 - bottom = -top - - self.setClickRegionFrame(left, right, bottom, top) - self.region.setActive(True) - else: - if self.region is not None: - self.region.setActive(False) - - if self.quitButton is not None: - self.quitButton.updateClickRegion() - - def marginVisibilityChanged(self): - if self.cell is not None: - # We're in the margin display. Reposition our content, and update - # the click region: - self.reposition() - self.updateClickRegion() - else: - # We aren't in the margin display. Disable the click region if one - # is present: - if self.region is not None: - self.region.setActive(False) - - def reposition(self): - if self.contents is None: - return - - origin = Point3() - - self.contents.setPos(origin) - - if self.chatBalloon is not None: - self.chatBalloon.removeNode() - self.chatBalloon = None - - if self.quitButton is not None: - self.quitButton.destroy() - self.quitButton = None - - self.contents.node().removeAllChildren() - - if (self.cell in base.leftCells) or (self.cell in base.rightCells): - text = self.text.replace('\x01WLDisplay\x01', '').replace('\x02', '') - textWidth = self.textNode.calcWidth(text) - if (textWidth / self.TEXT_WORD_WRAP) > self.TEXT_MAX_ROWS: - self.textNode.setWordwrap(textWidth / (self.TEXT_MAX_ROWS-0.5)) - else: - self.textNode.setWordwrap(self.TEXT_WORD_WRAP) - - self.draw() - - left, right, bottom, top = self.textNode.getFrameActual() - if self.cell in base.bottomCells: - # Move the origin to the bottom center of the chat balloon: - origin = self.contents.getRelativePoint( - self.chatBalloon.textNodePath, ((left+right) / 2.0, 0, bottom)) - elif self.cell in base.leftCells: - # Move the origin to the left center of the chat balloon: - origin = self.contents.getRelativePoint( - self.chatBalloon.textNodePath, (left, 0, (bottom+top) / 2.0)) - elif self.cell in base.rightCells: - # Move the origin to the right center of the chat balloon: - origin = self.contents.getRelativePoint( - self.chatBalloon.textNodePath, (right, 0, (bottom+top) / 2.0)) - - self.contents.setPos(self.contents, -origin) diff --git a/toontown/margins/MarginCell.py b/toontown/margins/MarginCell.py deleted file mode 100755 index c2bec1f4..00000000 --- a/toontown/margins/MarginCell.py +++ /dev/null @@ -1,40 +0,0 @@ -from pandac.PandaModules import NodePath - - -class MarginCell(NodePath): - def __init__(self): - NodePath.__init__(self, 'cell') - - self.active = False - self.content = None - self.contentNodePath = None - - def setActive(self, active): - if not active: - self.setContent(None) - - self.active = active - - def getActive(self): - return self.active - - def setContent(self, content): - if self.content is not None: - self.content.setCell(None) - self.content.marginVisibilityChanged() - self.content = None - - if self.contentNodePath is not None: - self.contentNodePath.removeNode() - self.contentNodePath = None - - if content is not None: - content.setLastCell(self) - content.setCell(self) - self.contentNodePath = self.attachNewNode(content) - content.marginVisibilityChanged() - - self.content = content - - def getContent(self): - return self.content diff --git a/toontown/margins/MarginGlobals.py b/toontown/margins/MarginGlobals.py deleted file mode 100755 index e04947e0..00000000 --- a/toontown/margins/MarginGlobals.py +++ /dev/null @@ -1,9 +0,0 @@ -# Priorities: -MP_low = 0 -MP_normal = 1 -MP_high = 2 -MP_urgent = 3 - - -def updateMarginVisibles(): - messenger.send('MarginVisible-update') diff --git a/toontown/margins/MarginManager.py b/toontown/margins/MarginManager.py deleted file mode 100755 index 44dc1530..00000000 --- a/toontown/margins/MarginManager.py +++ /dev/null @@ -1,76 +0,0 @@ -from pandac.PandaModules import PandaNode -import random - -from toontown.margins.MarginCell import MarginCell - - -class MarginManager(PandaNode): - def __init__(self): - PandaNode.__init__(self, 'margins') - - self.cells = set() - self.visibles = set() - - def addCell(self, x, y, a2dMarker): - cell = MarginCell() - cell.reparentTo(a2dMarker) - cell.setPos(x, 0, y) - cell.setScale(0.2) - cell.setActive(True) - - self.cells.add(cell) - self.reorganize() - - return cell - - def removeCell(self, cell): - if cell in self.cells: - self.cells.remove(cell) - self.reorganize() - - def addVisible(self, visible): - self.visibles.add(visible) - self.reorganize() - - def removeVisible(self, visible): - if visible in self.visibles: - self.visibles.remove(visible) - self.reorganize() - - def getActiveCells(self): - return [cell for cell in self.cells if cell.getActive()] - - def reorganize(self): - # First, get all of the active cells: - activeCells = self.getActiveCells() - - # Next, get all of the visibles sorted by priority: - visibles = list(self.visibles) - visibles.sort(key=lambda visible: visible.getPriority(), reverse=True) - - # We can only display so many visibles, so truncate them based on the - # number of active cells: - visibles = visibles[:len(activeCells)] - - # Now, let's build a list of empty cells: - emptyCells = [] - for cell in activeCells: - content = cell.getContent() - if content in visibles: - # This cell is already displaying something we want to see. - # Ignore it: - visibles.remove(content) - continue - elif content is not None: - # This cell isn't displaying anything interesting, so let's - # empty it: - cell.setContent(None) - emptyCells.append(cell) - - # Assign the visibles to their cells: - for visible in visibles: - cell = visible.getLastCell() - if cell not in emptyCells: - cell = random.choice(emptyCells) - cell.setContent(visible) - emptyCells.remove(cell) diff --git a/toontown/margins/MarginVisible.py b/toontown/margins/MarginVisible.py deleted file mode 100755 index 3a5054bd..00000000 --- a/toontown/margins/MarginVisible.py +++ /dev/null @@ -1,59 +0,0 @@ -class MarginVisible: - def __init__(self): - self.marginManager = None - self.visible = False - self.priority = 0 - self.lastCell = None - self.cell = None - - def manage(self, marginManager): - if self.marginManager is not None: - self.unmanage(self.marginManager) - self.marginManager = marginManager - if self.visible: - self.marginManager.addVisible(self) - - def unmanage(self, marginManager): - if marginManager != self.marginManager: - return - if self.marginManager is None: - return - if self.visible: - self.marginManager.removeVisible(self) - self.marginManager = None - - def setVisible(self, visible): - if visible == self.visible: - return - self.visible = visible - if self.marginManager is not None: - if self.visible: - self.marginManager.addVisible(self) - else: - self.marginManager.removeVisible(self) - - def getVisible(self): - return self.visible - - def setPriority(self, priority): - self.priority = priority - if (self.marginManager is not None) and self.visible: - self.marginManager.reorganize() - - def getPriority(self): - return self.priority - - def setLastCell(self, cell): - self.lastCell = cell - - def getLastCell(self): - return self.lastCell - - def setCell(self, cell): - self.cell = cell - - def getCell(self): - return self.cell - - def marginVisibilityChanged(self): - pass # Inheritors should override this method. diff --git a/toontown/margins/__init__.py b/toontown/margins/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/toontown/nametag/Nametag.py b/toontown/nametag/Nametag.py deleted file mode 100755 index af76c471..00000000 --- a/toontown/nametag/Nametag.py +++ /dev/null @@ -1,308 +0,0 @@ -from direct.task.Task import Task -from pandac.PandaModules import TextNode, VBase4 -from direct.interval.IntervalGlobal import * -from toontown.chat.ChatBalloon import ChatBalloon -from toontown.nametag import NametagGlobals - - -class Nametag: - TEXT_WORD_WRAP = 8 - TEXT_Y_OFFSET = -0.05 - - CHAT_TEXT_WORD_WRAP = 12 - - PANEL_X_PADDING = 0.2 - PANEL_Z_PADDING = 0.2 - - CHAT_BALLOON_ALPHA = 1 - - def __init__(self): - self.avatar = None - - self.panel = None - self.icon = None - self.chatBalloon = None - - self.chatButton = NametagGlobals.noButton - self.chatReversed = False - - self.font = None - self.chatFont = None - - self.chatType = NametagGlobals.CHAT - self.chatBalloonType = NametagGlobals.CHAT_BALLOON - - self.nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCNormal] - self.chatColor = NametagGlobals.ChatColors[NametagGlobals.CCNormal] - self.speedChatColor = self.chatColor[0][1] - - self.nametagHidden = False - self.chatHidden = False - self.thoughtHidden = False - - # Create our TextNodes: - self.textNode = TextNode('text') - self.textNode.setWordwrap(self.TEXT_WORD_WRAP) - self.textNode.setAlign(TextNode.ACenter) - - self.chatTextNode = TextNode('chatText') - self.chatTextNode.setWordwrap(self.CHAT_TEXT_WORD_WRAP) - self.chatTextNode.setGlyphScale(ChatBalloon.TEXT_GLYPH_SCALE) - self.chatTextNode.setGlyphShift(ChatBalloon.TEXT_GLYPH_SHIFT) - - # Add the tick task: - self.tickTaskName = self.getUniqueName() + '-tick' - self.tickTask = taskMgr.add(self.tick, self.tickTaskName, sort=45) - - def destroy(self): - if self.tickTask is not None: - taskMgr.remove(self.tickTask) - self.tickTask = None - - self.chatTextNode = None - self.textNode = None - - self.chatFont = None - self.font = None - - self.chatButton = NametagGlobals.noButton - - self.removeBalloon() - self.removeIcon() - self.removePanel() - - self.avatar = None - - def getUniqueName(self): - return 'Nametag-' + str(id(self)) - - def getChatBalloonModel(self): - pass # Inheritors should override this method. - - def getChatBalloonWidth(self): - pass # Inheritors should override this method. - - def getChatBalloonHeight(self): - pass # Inheritors should override this method. - - def tick(self, task): - return Task.done # Inheritors should override this method. - - def updateClickRegion(self): - pass # Inheritors should override this method. - - def drawChatBalloon(self, model, modelWidth, modelHeight): - pass # Inheritors should override this method. - - def drawNametag(self): - pass # Inheritors should override this method. - - def setAvatar(self, avatar): - self.avatar = avatar - - def getAvatar(self): - return self.avatar - - def setIcon(self, icon): - self.icon = icon - - def getIcon(self): - return self.icon - - def setChatButton(self, chatButton): - self.chatButton = chatButton - - def getChatButton(self): - return self.chatButton - - def hasChatButton(self): - if (self.chatBalloonType == NametagGlobals.CHAT_BALLOON) and self.chatHidden: - return False - if (self.chatBalloonType == NametagGlobals.THOUGHT_BALLOON) and self.thoughtHidden: - return False - return self.chatButton != NametagGlobals.noButton - - def setChatReversed(self, chatReversed): - self.chatReversed = chatReversed - - def getChatReversed(self): - return self.chatReversed - - def setFont(self, font): - self.font = font - if self.font is not None: - self.textNode.setFont(self.font) - self.update() - - def getFont(self): - return self.font - - def setChatFont(self, chatFont): - self.chatFont = chatFont - if self.chatFont is not None: - self.chatTextNode.setFont(self.chatFont) - self.update() - - def getChatFont(self): - return self.chatFont - - def setChatType(self, chatType): - self.chatType = chatType - - def getChatType(self): - return self.chatType - - def setChatBalloonType(self, chatBalloonType): - self.chatBalloonType = chatBalloonType - - def getChatBalloonType(self): - return self.chatBalloonType - - def setNametagColor(self, nametagColor): - self.nametagColor = nametagColor - - def getNametagColor(self): - return self.nametagColor - - def setChatColor(self, chatColor): - self.chatColor = chatColor - - def getChatColor(self): - return self.chatColor - - def setSpeedChatColor(self, speedChatColor): - self.speedChatColor = speedChatColor - - def getSpeedChatColor(self): - return self.speedChatColor - - def hideNametag(self): - self.nametagHidden = True - - def showNametag(self): - self.nametagHidden = False - - def hideChat(self): - self.chatHidden = True - - def showChat(self): - self.chatHidden = False - - def hideThought(self): - self.thoughtHidden = True - - def showThought(self): - self.thoughtHidden = False - - def applyClickState(self, clickState): - if self.chatBalloon is not None: - foreground, background = self.chatColor[clickState] - if self.chatType == NametagGlobals.SPEEDCHAT: - background = self.speedChatColor - if background[3] > self.CHAT_BALLOON_ALPHA: - background = VBase4( - background[0], background[1], background[2], - self.CHAT_BALLOON_ALPHA) - self.chatBalloon.setForeground(foreground) - self.chatBalloon.setBackground(background) - self.chatBalloon.setButton(self.chatButton[clickState]) - elif self.panel is not None: - foreground, background = self.nametagColor[clickState] - self.setForeground(foreground) - self.setBackground(background) - - def setText(self, text): - self.textNode.setText(text) - - def getText(self): - try: - text = self.textNode.getText() - return text - except AttributeError: - return None - - def setChatText(self, chatText): - self.chatTextNode.setText(chatText) - - def getChatText(self): - try: - text = self.chatTextNode.getText() - return text - except AttributeError: - return None - - def setWordWrap(self, wordWrap): - if wordWrap is None: - wordWrap = self.TEXT_WORD_WRAP - self.textNode.setWordwrap(wordWrap) - self.update() - - def getWordWrap(self): - return self.textNode.getWordwrap() - - def setChatWordWrap(self, chatWordWrap): - if (chatWordWrap is None) or (chatWordWrap > self.CHAT_TEXT_WORD_WRAP): - chatWordWrap = self.CHAT_TEXT_WORD_WRAP - self.chatTextNode.setWordwrap(chatWordWrap) - self.update() - - def getChatWordWrap(self): - return self.chatTextNode.getWordwrap() - - def setForeground(self, foreground): - self.textNode.setTextColor(foreground) - - def setBackground(self, background): - if self.panel is not None: - self.panel.setColor(background) - - def setShadow(self, shadow): - self.textNode.setShadow(shadow) - - def getShadow(self): - return self.textNode.getShadow() - - def clearShadow(self): - self.textNode.clearShadow() - - def removeBalloon(self): - if self.chatBalloon: - self.chatBalloon.removeNode() - self.chatBalloon = None - - def removePanel(self): - if self.panel: - self.panel.removeNode() - self.panel = None - - def removeIcon(self): - if self.icon: - self.icon.removeAllChildren() - self.icon = None - - def update(self): - self.removeBalloon() - self.removePanel() - - if self.getChatText(): - if self.chatBalloonType == NametagGlobals.CHAT_BALLOON: - if not self.chatHidden: - model = self.getChatBalloonModel() - modelWidth = self.getChatBalloonWidth() - modelHeight = self.getChatBalloonHeight() - self.drawChatBalloon(model, modelWidth, modelHeight) - return - elif self.chatBalloonType == NametagGlobals.THOUGHT_BALLOON: - if not self.thoughtHidden: - model = NametagGlobals.thoughtBalloonModel - modelWidth = NametagGlobals.thoughtBalloonWidth - modelHeight = NametagGlobals.thoughtBalloonHeight - self.drawChatBalloon(model, modelWidth, modelHeight) - return - - if hasattr(self.avatar, 'ghostMode'): - if self.avatar.ghostMode == 2: - return - - if self.getText() and (not self.nametagHidden): - self.drawNametag() diff --git a/toontown/nametag/Nametag2d.py b/toontown/nametag/Nametag2d.py deleted file mode 100755 index 4797fbc9..00000000 --- a/toontown/nametag/Nametag2d.py +++ /dev/null @@ -1,322 +0,0 @@ -from direct.task.Task import Task -import math -from panda3d.core import PGButton, VBase4, DepthWriteAttrib, Point3 -from direct.interval.IntervalGlobal import * -from toontown.chat.ChatBalloon import ChatBalloon -from toontown.margins import MarginGlobals -from toontown.margins.MarginVisible import MarginVisible -from toontown.nametag import NametagGlobals -from toontown.nametag.Nametag import Nametag -from toontown.toontowngui.Clickable2d import Clickable2d - - -class Nametag2d(Nametag, Clickable2d, MarginVisible): - CONTENTS_SCALE = 0.25 - - CHAT_TEXT_MAX_ROWS = 6 - CHAT_TEXT_WORD_WRAP = 8 - - CHAT_BALLOON_ALPHA = 0.4 - - ARROW_OFFSET = -1.0 - ARROW_SCALE = 1.5 - - def __init__(self): - Nametag.__init__(self) - Clickable2d.__init__(self, 'Nametag2d') - MarginVisible.__init__(self) - - self.actualChatText = '' - - self.arrow = None - self.textNodePath = None - - self.contents.setScale(self.CONTENTS_SCALE) - self.hideThought() - - self.accept('MarginVisible-update', self.update) - - def destroy(self): - self.ignoreAll() - - Nametag.destroy(self) - - if self.textNodePath is not None: - self.textNodePath.removeNode() - self.textNodePath = None - - if self.arrow is not None: - self.arrow.removeNode() - self.arrow = None - - Clickable2d.destroy(self) - - def getUniqueName(self): - return 'Nametag2d-' + str(id(self)) - - def getChatBalloonModel(self): - return NametagGlobals.chatBalloon2dModel - - def getChatBalloonWidth(self): - return NametagGlobals.chatBalloon2dWidth - - def getChatBalloonHeight(self): - return NametagGlobals.chatBalloon2dHeight - - def setChatText(self, chatText): - self.actualChatText = chatText - - Nametag.setChatText(self, chatText) - - def updateClickRegion(self): - if self.chatBalloon is not None: - right = self.chatBalloon.width / 2.0 - left = -right - top = self.chatBalloon.height / 2.0 - bottom = -top - - self.setClickRegionFrame(left, right, bottom, top) - self.region.setActive(True) - elif self.panel is not None: - centerX = (self.textNode.getLeft()+self.textNode.getRight()) / 2.0 - centerY = (self.textNode.getBottom()+self.textNode.getTop()) / 2.0 - - left = centerX - (self.panelWidth/2.0) - right = centerX + (self.panelWidth/2.0) - bottom = centerY - (self.panelHeight/2.0) - top = centerY + (self.panelHeight/2.0) - - self.setClickRegionFrame(left, right, bottom, top) - self.region.setActive(True) - else: - if self.region is not None: - self.region.setActive(False) - - def isClickable(self): - if self.getChatText() and self.hasChatButton(): - return True - return NametagGlobals.wantActiveNametags and Clickable2d.isClickable(self) - - def setClickState(self, clickState): - if self.isClickable(): - self.applyClickState(clickState) - else: - self.applyClickState(PGButton.SInactive) - - Clickable2d.setClickState(self, clickState) - - def enterDepressed(self): - if self.isClickable(): - base.playSfx(NametagGlobals.clickSound) - - def enterRollover(self): - if self.isClickable() and (self.lastClickState != PGButton.SDepressed): - base.playSfx(NametagGlobals.rolloverSound) - - def update(self): - self.contents.node().removeAllChildren() - - Nametag.update(self) - - if self.cell is not None: - # We're in the margin display. Reposition our content, and update - # the click region: - self.reposition() - self.updateClickRegion() - else: - # We aren't in the margin display. Disable the click region if one - # is present: - if self.region is not None: - self.region.setActive(False) - - def tick(self, task): - if (self.avatar is None) or self.avatar.isEmpty(): - return Task.cont - - if (self.cell is None) or (self.arrow is None): - return Task.cont - - location = self.avatar.getPos(NametagGlobals.me) - rotation = NametagGlobals.me.getQuat(base.cam) - camSpacePos = rotation.xform(location) - - arrowRadians = math.atan2(camSpacePos[0], camSpacePos[1]) - arrowDegrees = (arrowRadians/math.pi) * 180 - self.arrow.setR(arrowDegrees - 90) - - return Task.cont - - def drawChatBalloon(self, model, modelWidth, modelHeight): - if self.chatFont is None: - # We can't draw this without a font. - return - - # Prefix the nametag text: - self.chatTextNode.setText(self.getText() + ': ' + self.actualChatText) - - # Set our priority in the margin system: - self.setPriority(MarginGlobals.MP_normal) - - if self.textNodePath is not None: - self.textNodePath.removeNode() - self.textNodePath = None - - if self.arrow is not None: - self.arrow.removeNode() - self.arrow = None - - if self.isClickable(): - foreground, background = self.chatColor[self.clickState] - else: - foreground, background = self.chatColor[PGButton.SInactive] - if self.chatType == NametagGlobals.SPEEDCHAT: - background = self.speedChatColor - if background[3] > self.CHAT_BALLOON_ALPHA: - background = VBase4( - background[0], background[1], background[2], - self.CHAT_BALLOON_ALPHA) - self.chatBalloon = ChatBalloon( - model, modelWidth, modelHeight, self.chatTextNode, - foreground=foreground, background=background, - reversed=self.chatReversed, - button=self.chatButton[self.clickState]) - self.chatBalloon.reparentTo(self.contents) - - # Calculate the center of the TextNode: - left, right, bottom, top = self.chatTextNode.getFrameActual() - center = self.contents.getRelativePoint( - self.chatBalloon.textNodePath, - ((left+right) / 2.0, 0, (bottom+top) / 2.0)) - - # Translate the chat balloon along the inverse: - self.chatBalloon.setPos(self.chatBalloon, -center) - - def drawNametag(self): - # Set our priority in the margin system: - self.setPriority(MarginGlobals.MP_low) - - if self.textNodePath is not None: - self.textNodePath.removeNode() - self.textNodePath = None - - if self.arrow is not None: - self.arrow.removeNode() - self.arrow = None - - if self.font is None: - # We can't draw this without a font. - return - - # Attach the icon: - if self.icon is not None: - self.contents.attachNewNode(self.icon) - - if self.isClickable(): - foreground, background = self.nametagColor[self.clickState] - else: - foreground, background = self.nametagColor[PGButton.SInactive] - - # Set the color of the TextNode: - self.textNode.setTextColor(foreground) - - # Attach the TextNode: - self.textNodePath = self.contents.attachNewNode(self.textNode, 1) - self.textNodePath.setTransparency(foreground[3] < 1) - self.textNodePath.setAttrib(DepthWriteAttrib.make(0)) - self.textNodePath.setY(self.TEXT_Y_OFFSET) - - # Attach a panel behind the TextNode: - self.panel = NametagGlobals.cardModel.copyTo(self.contents, 0) - self.panel.setColor(background) - self.panel.setTransparency(background[3] < 1) - - # Reposition the panel: - x = (self.textNode.getLeft()+self.textNode.getRight()) / 2.0 - z = (self.textNode.getBottom()+self.textNode.getTop()) / 2.0 - self.panel.setPos(x, 0, z) - - # Resize the panel: - self.panelWidth = self.textNode.getWidth() + self.PANEL_X_PADDING - self.panelHeight = self.textNode.getHeight() + self.PANEL_Z_PADDING - self.panel.setScale(self.panelWidth, 1, self.panelHeight) - - # Add an arrow: - self.arrow = NametagGlobals.arrowModel.copyTo(self.contents) - self.arrow.setZ(self.ARROW_OFFSET + self.textNode.getBottom()) - self.arrow.setScale(self.ARROW_SCALE) - self.arrow.setColor(self.nametagColor[4] if len(self.nametagColor) >= 5 else self.nametagColor[0][0]) - - def marginVisibilityChanged(self): - if self.cell is not None: - # We're in the margin display. Reposition our content, and update - # the click region: - self.reposition() - self.updateClickRegion() - else: - # We aren't in the margin display. Disable the click region if one - # is present: - if self.region is not None: - self.region.setActive(False) - - def reposition(self): - if self.contents is None: - return - - origin = Point3() - - self.contents.setPos(origin) - - if self.chatBalloon is not None: - self.chatBalloon.removeNode() - self.chatBalloon = None - - self.contents.node().removeAllChildren() - - if (self.cell in base.leftCells) or (self.cell in base.rightCells): - text = self.getChatText().replace('\x01WLDisplay\x01', '').replace('\x02', '') - textWidth = self.chatTextNode.calcWidth(text) - if (textWidth / self.CHAT_TEXT_WORD_WRAP) > self.CHAT_TEXT_MAX_ROWS: - self.chatTextNode.setWordwrap(textWidth / (self.CHAT_TEXT_MAX_ROWS-0.5)) - else: - self.chatTextNode.setWordwrap(self.CHAT_TEXT_WORD_WRAP) - - model = self.getChatBalloonModel() - modelWidth = self.getChatBalloonWidth() - modelHeight = self.getChatBalloonHeight() - self.drawChatBalloon(model, modelWidth, modelHeight) - - nodePath = self.chatBalloon.textNodePath - - left, right, bottom, top = self.chatTextNode.getFrameActual() - left -= self.chatBalloon.BALLOON_X_PADDING - right += self.chatBalloon.BALLOON_X_PADDING - bottom -= self.chatBalloon.BALLOON_Z_PADDING - top += self.chatBalloon.BALLOON_Z_PADDING - elif self.panel is not None: - nodePath = self.textNodePath - - left, right, bottom, top = self.textNode.getFrameActual() - left -= self.PANEL_X_PADDING - right += self.PANEL_X_PADDING - bottom -= self.PANEL_Z_PADDING - top += self.PANEL_Z_PADDING - - # Compensate for the arrow: - bottom -= self.ARROW_SCALE - else: - return - - if self.cell in base.bottomCells: - # Move the origin to the bottom center of the node path: - origin = self.contents.getRelativePoint( - nodePath, ((left+right) / 2.0, 0, bottom)) - elif self.cell in base.leftCells: - # Move the origin to the left center of the node path: - origin = self.contents.getRelativePoint( - nodePath, (left, 0, (bottom+top) / 2.0)) - elif self.cell in base.rightCells: - # Move the origin to the right center of the node path: - origin = self.contents.getRelativePoint( - nodePath, (right, 0, (bottom+top) / 2.0)) - - self.contents.setPos(self.contents, -origin) diff --git a/toontown/nametag/Nametag3d.py b/toontown/nametag/Nametag3d.py deleted file mode 100755 index 95e81d1d..00000000 --- a/toontown/nametag/Nametag3d.py +++ /dev/null @@ -1,185 +0,0 @@ -from direct.task.Task import Task -import math -from panda3d.core import BillboardEffect, Vec3, Point3, PGButton, VBase4 -from panda3d.core import DepthWriteAttrib -from direct.interval.IntervalGlobal import * -from toontown.chat.ChatBalloon import ChatBalloon -from toontown.nametag import NametagGlobals -from toontown.nametag.Nametag import Nametag -from toontown.toontowngui.Clickable3d import Clickable3d - - -class Nametag3d(Nametag, Clickable3d): - MAX_SCALE = 2.5 - SCALING_FACTOR = 0.065 - SCALING_MIN_DISTANCE = 1 - SCALING_MAX_DISTANCE = math.pow(MAX_SCALE / SCALING_FACTOR, 2) - - def __init__(self): - Nametag.__init__(self) - Clickable3d.__init__(self, 'Nametag3d') - - self.distance = 0 - - self.billboardOffset = 3 - self.doBillboardEffect() - - def destroy(self): - self.ignoreAll() - - Nametag.destroy(self) - Clickable3d.destroy(self) - - def getUniqueName(self): - return 'Nametag3d-' + str(id(self)) - - def getChatBalloonModel(self): - return NametagGlobals.chatBalloon3dModel - - def getChatBalloonWidth(self): - return NametagGlobals.chatBalloon3dWidth - - def getChatBalloonHeight(self): - return NametagGlobals.chatBalloon3dHeight - - def setBillboardOffset(self, billboardOffset): - self.billboardOffset = billboardOffset - self.doBillboardEffect() - - def getBillboardOffset(self): - return self.billboardOffset - - def doBillboardEffect(self): - billboardEffect = BillboardEffect.make( - Vec3(0, 0, 1), True, False, self.billboardOffset, base.cam, - Point3(0, 0, 0)) - self.contents.setEffect(billboardEffect) - - def updateClickRegion(self): - if self.chatBalloon is not None: - left = self.chatBalloon.center[0] - (self.chatBalloon.width/2) - right = left + self.chatBalloon.width - - # Calculate the bottom of the region based on constants. - # 2.4 is the padded height of a single-line message: - bottom = NametagGlobals.chatBalloon3dHeight - 2.4 - top = bottom + self.chatBalloon.height - - self.setClickRegionFrame(left, right, bottom, top) - elif self.panel is not None: - centerX = (self.textNode.getLeft()+self.textNode.getRight()) / 2.0 - centerY = (self.textNode.getBottom()+self.textNode.getTop()) / 2.0 - - left = centerX - (self.panelWidth/2.0) - right = centerX + (self.panelWidth/2.0) - bottom = centerY - (self.panelHeight/2.0) - top = centerY + (self.panelHeight/2.0) - - self.setClickRegionFrame(left, right, bottom, top) - - def isClickable(self): - if self.getChatText() and self.hasChatButton(): - return True - return NametagGlobals.wantActiveNametags and Clickable3d.isClickable(self) - - def setClickState(self, clickState): - if self.isClickable(): - self.applyClickState(clickState) - else: - self.applyClickState(PGButton.SInactive) - - Clickable3d.setClickState(self, clickState) - - def enterDepressed(self): - if self.isClickable(): - base.playSfx(NametagGlobals.clickSound) - - def enterRollover(self): - if self.isClickable() and (self.lastClickState != PGButton.SDepressed): - base.playSfx(NametagGlobals.rolloverSound) - - def removeContents(self): - if self.contents: - self.contents.node().removeAllChildren() - - def update(self): - self.removeContents() - Nametag.update(self) - - def tick(self, task): - distance = self.contents.getPos(base.cam).length() - - if distance < self.SCALING_MIN_DISTANCE: - distance = self.SCALING_MIN_DISTANCE - elif distance > self.SCALING_MAX_DISTANCE: - distance = self.SCALING_MAX_DISTANCE - - if distance != self.distance: - self.contents.setScale(math.sqrt(distance) * self.SCALING_FACTOR) - self.distance = distance - - self.updateClickRegion() - - return Task.cont - - def drawChatBalloon(self, model, modelWidth, modelHeight): - if self.chatFont is None: - # We can't draw this without a font. - return - - if self.isClickable(): - foreground, background = self.chatColor[self.clickState] - else: - foreground, background = self.chatColor[PGButton.SInactive] - if self.chatType == NametagGlobals.SPEEDCHAT: - background = self.speedChatColor - if background[3] > self.CHAT_BALLOON_ALPHA: - background = VBase4( - background[0], background[1], background[2], - self.CHAT_BALLOON_ALPHA) - self.chatBalloon = ChatBalloon( - model, modelWidth, modelHeight, self.chatTextNode, - foreground=foreground, background=background, - reversed=self.chatReversed, - button=self.chatButton[self.clickState]) - self.chatBalloon.reparentTo(self.contents) - scaleLerp = Sequence(LerpScaleInterval(self.chatBalloon, 0.2, VBase3(1, 1, 1), VBase3(0, 0, 0), blendType='easeInOut')) - scaleLerp.start() - - def drawNametag(self): - if self.font is None: - # We can't draw this without a font. - return - - # Attach the icon: - if self.icon is not None: - self.contents.attachNewNode(self.icon) - - if self.isClickable(): - foreground, background = self.nametagColor[self.clickState] - else: - foreground, background = self.nametagColor[PGButton.SInactive] - - # Set the color of the TextNode: - self.textNode.setTextColor(foreground) - - # Attach the TextNode: - textNodePath = self.contents.attachNewNode(self.textNode, 1) - textNodePath.setTransparency(foreground[3] < 1) - textNodePath.setAttrib(DepthWriteAttrib.make(0)) - textNodePath.setY(self.TEXT_Y_OFFSET) - - # Attach a panel behind the TextNode: - self.panel = NametagGlobals.cardModel.copyTo(self.contents, 0) - self.panel.setColor(background) - self.panel.setTransparency(background[3] < 1) - - # Reposition the panel: - x = (self.textNode.getLeft()+self.textNode.getRight()) / 2.0 - z = (self.textNode.getBottom()+self.textNode.getTop()) / 2.0 - self.panel.setPos(x, 0, z) - - # Resize the panel: - self.panelWidth = self.textNode.getWidth() + self.PANEL_X_PADDING - self.panelHeight = self.textNode.getHeight() + self.PANEL_Z_PADDING - self.panel.setScale(self.panelWidth, 1, self.panelHeight) diff --git a/toontown/nametag/NametagFloat2d.py b/toontown/nametag/NametagFloat2d.py deleted file mode 100755 index 173d0e03..00000000 --- a/toontown/nametag/NametagFloat2d.py +++ /dev/null @@ -1,21 +0,0 @@ -from pandac.PandaModules import Point3 - -from toontown.nametag.NametagFloat3d import NametagFloat3d - - -class NametagFloat2d(NametagFloat3d): - def doBillboardEffect(self): - pass - - def update(self): - NametagFloat3d.update(self) - - self.updateClickRegion() - - def setClickRegionFrame(self, left, right, bottom, top): - mat = self.contents.getNetTransform().getMat() - - left, _, top = mat.xformPoint(Point3(left, 0, top)) - right, _, bottom = mat.xformPoint(Point3(right, 0, bottom)) - - self.region.setFrame(left, right, bottom, top) diff --git a/toontown/nametag/NametagFloat3d.py b/toontown/nametag/NametagFloat3d.py deleted file mode 100755 index 64662c78..00000000 --- a/toontown/nametag/NametagFloat3d.py +++ /dev/null @@ -1,8 +0,0 @@ -from direct.task.Task import Task - -from toontown.nametag.Nametag3d import Nametag3d - - -class NametagFloat3d(Nametag3d): - def tick(self, task): - return Task.done diff --git a/toontown/nametag/NametagGlobals.py b/toontown/nametag/NametagGlobals.py deleted file mode 100755 index f767da98..00000000 --- a/toontown/nametag/NametagGlobals.py +++ /dev/null @@ -1,247 +0,0 @@ -from pandac.PandaModules import VBase4 -from otp.otpbase import OTPGlobals - -CCNormal = 0 -CCNonPlayer = 1 -CCSuit = 2 -CCToonBuilding = 3 -CCSuitBuilding = 4 -CCHouseBuilding = 5 -CCSpeedChat = 6 -CCAdmin = 7 - -CHAT = 0 -SPEEDCHAT = 1 - -CHAT_BALLOON = 0 -THOUGHT_BALLOON = 1 - -cardModel = None -arrowModel = None -chatBalloon3dModel = None -chatBalloon3dWidth = 0 -chatBalloon3dHeight = 0 -chatBalloon2dModel = None -chatBalloon2dWidth = 0 -chatBalloon2dHeight = 0 -thoughtBalloonModel = None -thoughtBalloonWidth = 0 -thoughtBalloonHeight = 0 -noButton = (None, None, None, None) -pageButton = (None, None, None, None) -quitButton = (None, None, None, None) -quitButtonWidth = 0 -quitButtonHeight = 0 - -rolloverSound = None -clickSound = None - -me = None -want2dNametags = True -forceOnscreenChat = False -force2dNametags = False -wantActiveNametags = True - - -def setCardModel(model): - global cardModel - cardModel = loader.loadModel(model) - - -def setArrowModel(model): - global arrowModel - arrowModel = loader.loadModel(model) - - -def setChatBalloon3dModel(model): - global chatBalloon3dModel - global chatBalloon3dWidth - global chatBalloon3dHeight - chatBalloon3dModel = loader.loadModel(model) - chatBalloon3dWidth, chatBalloon3dHeight = getModelWidthHeight(chatBalloon3dModel) - - -def setChatBalloon2dModel(model): - global chatBalloon2dModel - global chatBalloon2dWidth - global chatBalloon2dHeight - chatBalloon2dModel = loader.loadModel(model) - chatBalloon2dWidth, chatBalloon2dHeight = getModelWidthHeight(chatBalloon2dModel) - - -def setThoughtBalloonModel(model): - global thoughtBalloonModel - global thoughtBalloonWidth - global thoughtBalloonHeight - thoughtBalloonModel = loader.loadModel(model) - thoughtBalloonWidth, thoughtBalloonHeight = getModelWidthHeight(thoughtBalloonModel) - - -def setPageButton(normal, down, rollover, disabled): - global pageButton - pageButton = (normal, down, rollover, disabled) - - -def setQuitButton(normal, down, rollover, disabled): - global quitButton - global quitButtonWidth - global quitButtonHeight - quitButton = (normal, down, rollover, disabled) - quitButtonWidth, quitButtonHeight = getModelWidthHeight(normal) - - -def setRolloverSound(sound): - global rolloverSound - rolloverSound = sound - - -def setClickSound(sound): - global clickSound - clickSound = sound - - -def setMe(nodePath): - global me - me = nodePath - - -def setWant2dNametags(value): - global want2dNametags - want2dNametags = value - - -def setForceOnscreenChat(value): - global forceOnscreenChat - forceOnscreenChat = value - - -def setForce2dNametags(value): - global force2dNametags - force2dNametags = value - - -def setWantActiveNametags(value): - global wantActiveNametags - wantActiveNametags = value - - -def getModelWidthHeight(model): - tightBounds = model.getTightBounds() - if tightBounds is None: - return (0, 0) - minPoint, maxPoint = tightBounds - width = maxPoint.getX() - minPoint.getX() - height = maxPoint.getZ() - minPoint.getZ() - return (width, height) - -def getFriendColor(handle): - if handle.isAdmin(): - return CCAdmin - elif settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId): - return CCNormal - return CCSpeedChat - -# Foreground, background: -NametagColors = { - CCNormal: ( # Blue - (VBase4(0.3, 0.3, 0.7, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Normal - (VBase4(0.3, 0.3, 0.7, 1.0), VBase4(0.2, 0.2, 0.2, 0.6)), # Down - (VBase4(0.5, 0.5, 1.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.3, 0.3, 0.7, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)) # Disabled - ), - CCNonPlayer: ( # Orange - (VBase4(0.8, 0.4, 0.0, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Normal - (VBase4(0.8, 0.4, 0.0, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Down - (VBase4(0.8, 0.4, 0.0, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Rollover - (VBase4(0.8, 0.4, 0.0, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)) # Disabled - ), - CCSuit: ( - (VBase4(0.2, 0.2, 0.2, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Normal - (VBase4(0.2, 0.2, 0.2, 1.0), VBase4(0.2, 0.2, 0.2, 0.6)), # Down - (VBase4(0.4, 0.4, 0.4, 1.0), VBase4(1.0, 1.0, 1.0, 0.7)), # Rollover - (VBase4(0.2, 0.2, 0.2, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Disabled - VBase4(0.8, 0.4, 0.0, 1.0) # Custom arrow color - ), - CCSuitBuilding: ( - (VBase4(0.5, 0.5, 0.5, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Normal - (VBase4(0.5, 0.5, 0.5, 1.0), VBase4(0.2, 0.2, 0.2, 0.6)), # Down - (VBase4(0.7, 0.7, 0.7, 1.0), VBase4(1.0, 1.0, 1.0, 0.7)), # Rollover - (VBase4(0.5, 0.5, 0.5, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)) # Disabled - ), - CCToonBuilding: ( - (VBase4(0.2, 0.6, 0.9, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Normal - (VBase4(0.2, 0.6, 0.9, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Down - (VBase4(0.2, 0.6, 0.9, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Rollover - (VBase4(0.2, 0.6, 0.9, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)) # Disabled - ), - CCHouseBuilding: ( - (VBase4(0.2, 0.6, 0.9, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Normal - (VBase4(0.2, 0.2, 0.5, 1.0), VBase4(0.2, 0.2, 0.2, 0.6)), # Down - (VBase4(0.5, 0.5, 1.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.6, 0.2, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)) # Disabled - ), - CCSpeedChat: ( # Green - (VBase4(0.0, 0.6, 0.2, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Normal - (VBase4(0.0, 0.5, 0.0, 1.0), VBase4(0.5, 0.5, 0.5, 0.6)), # Down - (VBase4(0.0, 0.7, 0.2, 1.0), VBase4(1.0, 1.0, 1.0, 0.7)), # Rollover - (VBase4(0.0, 0.6, 0.2, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)) # Disabled - ), - CCAdmin: ( # Red - (VBase4(1.0, 0.35, 0.25, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)), # Normal - (VBase4(1.0, 0.35, 0.25, 1.0), VBase4(0.5, 0.5, 0.5, 0.6)), # Down - (VBase4(1.0, 0.5, 0.56, 1.0), VBase4(1.0, 1.0, 1.0, 0.7)), # Rollover - (VBase4(1.0, 0.35, 0.25, 1.0), VBase4(0.8, 0.8, 0.8, 0.5)) # Disabled - ) -} - -# Foreground, background: -ChatColors = { - CCNormal: ( - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Normal - (VBase4(1.0, 0.5, 0.5, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Down - (VBase4(0.0, 0.6, 0.6, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)) # Disabled - ), - CCNonPlayer: ( - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Normal - (VBase4(1.0, 0.5, 0.5, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Click - (VBase4(0.0, 0.6, 0.6, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)) # Disabled - ), - CCSuit: ( - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Normal - (VBase4(1.0, 0.5, 0.5, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Down - (VBase4(0.0, 0.6, 0.6, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)) # Disabled - ), - CCSuitBuilding: ( - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Normal - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Down - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)) # Disabled - ), - CCToonBuilding: ( - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Normal - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Down - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)) # Disabled - ), - CCHouseBuilding: ( - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Normal - (VBase4(1.0, 0.5, 0.5, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Down - (VBase4(0.0, 0.6, 0.6, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)) # Disabled - ), - CCSpeedChat: ( - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Normal - (VBase4(1.0, 0.5, 0.5, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Down - (VBase4(0.0, 0.6, 0.6, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)) # Disabled - ), - CCAdmin: ( - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Normal - (VBase4(1.0, 0.5, 0.5, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Down - (VBase4(0.0, 0.6, 0.6, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)), # Rollover - (VBase4(0.0, 0.0, 0.0, 1.0), VBase4(1.0, 1.0, 1.0, 1.0)) # Disabled - ) -} diff --git a/toontown/nametag/NametagGroup.py b/toontown/nametag/NametagGroup.py deleted file mode 100755 index b8d0fe0a..00000000 --- a/toontown/nametag/NametagGroup.py +++ /dev/null @@ -1,441 +0,0 @@ -from direct.task.Task import Task -from pandac.PandaModules import VBase4, PandaNode - -from toontown.margins.MarginVisible import MarginVisible -from toontown.nametag import NametagGlobals -from toontown.nametag.Nametag2d import Nametag2d -from toontown.nametag.Nametag3d import Nametag3d - - -class NametagGroup: - CHAT_TIMEOUT_MIN = 4.0 - CHAT_TIMEOUT_MAX = 12.0 - CHAT_STOMP_DELAY = 0.2 - - def __init__(self): - self.avatar = None - self.active = True - self.objectCode = None - - self.chatButton = NametagGlobals.noButton - self.chatReversed = False - - self.font = None - self.chatFont = None - - self.shadow = None - - self.marginManager = None - self.visible3d = True - - self.chatType = NametagGlobals.CHAT - self.chatBalloonType = NametagGlobals.CHAT_BALLOON - - self.nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCNormal] - self.chatColor = NametagGlobals.ChatColors[NametagGlobals.CCNormal] - self.speedChatColor = VBase4(1, 1, 1, 1) - - self.wordWrap = 8 - self.chatWordWrap = 12 - - self.text = '' - - self.chatPages = [] - self.chatPageIndex = 0 - self.chatTimeoutTask = None - self.chatTimeoutTaskName = self.getUniqueName() + '-timeout' - - self.stompChatText = '' - self.stompTask = None - self.stompTaskName = self.getUniqueName() + '-stomp' - - self.icon = PandaNode('icon') - - self.nametag2d = Nametag2d() - self.nametag3d = Nametag3d() - - self.nametags = set() - self.add(self.nametag2d) - self.add(self.nametag3d) - - # Add the tick task: - self.tickTaskName = self.getUniqueName() + '-tick' - self.tickTask = taskMgr.add(self.tick, self.tickTaskName, sort=45) - - def destroy(self): - if self.marginManager is not None: - self.unmanage(self.marginManager) - - if self.tickTask is not None: - taskMgr.remove(self.tickTask) - self.tickTask = None - - self.clearChatText() - - for nametag in list(self.nametags): - self.remove(nametag) - - self.nametag2d = None - self.nametag3d = None - - if self.icon is not None: - self.icon.removeAllChildren() - self.icon = None - - self.chatFont = None - self.font = None - - self.chatButton = NametagGlobals.noButton - - self.avatar = None - - def getUniqueName(self): - return 'NametagGroup-' + str(id(self)) - - def tick(self, task): - if (self.avatar is None) or (self.avatar.isEmpty()): - return Task.cont - - chatText = self.getChatText() - if (NametagGlobals.forceOnscreenChat and - chatText and - self.chatBalloonType == NametagGlobals.CHAT_BALLOON): - visible3d = False - elif self.avatar == NametagGlobals.me: - if (chatText and - self.chatBalloonType == NametagGlobals.CHAT_BALLOON and - not base.cam.node().isInView(self.avatar.getPos(base.cam))): - visible3d = False - else: - visible3d = True - elif NametagGlobals.force2dNametags: - visible3d = False - elif (not NametagGlobals.want2dNametags and - ((not chatText) or (self.chatBalloonType != NametagGlobals.CHAT_BALLOON))): - visible3d = True - elif self.avatar.isHidden(): - visible3d = False - else: - visible3d = base.cam.node().isInView(self.avatar.getPos(base.cam)) - - if visible3d != self.visible3d: - self.visible3d = visible3d - if self.nametag2d is not None: - self.nametag2d.setVisible(not visible3d) - - return Task.cont - - def setAvatar(self, avatar): - self.avatar = avatar - for nametag in self.nametags: - nametag.setAvatar(self.avatar) - - def getAvatar(self): - return self.avatar - - def setActive(self, active): - self.active = active - for nametag in self.nametags: - nametag.setActive(self.active) - - def getActive(self): - return self.active - - def setObjectCode(self, objectCode): - self.objectCode = objectCode - - def getObjectCode(self): - return self.objectCode - - def setChatButton(self, chatButton): - self.chatButton = chatButton - for nametag in self.nametags: - nametag.setChatButton(self.chatButton) - - def getChatButton(self): - return self.chatButton - - def hasChatButton(self): - return self.chatButton != NametagGlobals.noButton - - def setChatReversed(self, reversed): - self.chatReversed = reversed - for nametag in self.nametags: - nametag.setChatReversed(reversed) - - def getChatReversed(self): - return self.chatReversed - - def setFont(self, font): - self.font = font - for nametag in self.nametags: - nametag.setFont(self.font) - - def getFont(self): - return self.font - - def setChatFont(self, chatFont): - self.chatFont = chatFont - for nametag in self.nametags: - nametag.setChatFont(self.chatFont) - - def getChatFont(self): - return self.chatFont - - def setShadow(self, shadow): - self.shadow = shadow - for nametag in self.nametags: - nametag.setShadow(self.shadow) - - def getShadow(self): - return self.shadow - - def clearShadow(self): - self.shadow = None - for nametag in self.nametags: - nametag.clearShadow() - - def setChatType(self, chatType): - self.chatType = chatType - for nametag in self.nametags: - nametag.setChatType(self.chatType) - - def getChatType(self): - return self.chatType - - def setChatBalloonType(self, chatBalloonType): - self.chatBalloonType = chatBalloonType - for nametag in self.nametags: - nametag.setChatBalloonType(self.chatBalloonType) - - def getChatBalloonType(self): - return self.chatBalloonType - - def setNametagColor(self, nametagColor): - self.nametagColor = nametagColor - for nametag in self.nametags: - nametag.setNametagColor(self.nametagColor) - - def getNametagColor(self): - return self.nametagColor - - def setChatColor(self, chatColor): - self.chatColor = chatColor - for nametag in self.nametags: - nametag.setChatColor(self.chatColor) - - def getChatColor(self): - return self.chatColor - - def setSpeedChatColor(self, speedChatColor): - self.speedChatColor = speedChatColor - for nametag in self.nametags: - nametag.setSpeedChatColor(self.speedChatColor) - - def getSpeedChatColor(self): - return self.speedChatColor - - def setWordWrap(self, wordWrap): - self.wordWrap = wordWrap - for nametag in self.nametags: - nametag.setWordWrap(self.wordWrap) - - def getWordWrap(self): - return self.wordWrap - - def setChatWordWrap(self, chatWordWrap): - self.chatWordWrap = chatWordWrap - for nametag in self.nametags: - nametag.setChatWordWrap(self.chatWordWrap) - - def getChatWordWrap(self): - return self.chatWordWrap - - def setText(self, text): - self.text = text - for nametag in self.nametags: - nametag.setText(self.text) - nametag.update() - - def getText(self): - return self.text - - def getNumChatPages(self): - return len(self.chatPages) - - def setChatPageIndex(self, chatPageIndex): - if chatPageIndex >= self.getNumChatPages(): - return - - self.chatPageIndex = chatPageIndex - for nametag in self.nametags: - nametag.setChatText(self.chatPages[self.chatPageIndex]) - nametag.update() - - def getChatPageIndex(self): - return self.chatPageIndex - - def setChatText(self, chatText, timeout=False): - # If we are currently displaying chat text, we need to "stomp" it. In - # other words, we need to clear the current chat text, pause for a - # brief moment, and then display the new chat text: - if self.getChatText(): - self.clearChatText() - self.stompChatText = chatText - self.stompTask = taskMgr.doMethodLater( - self.CHAT_STOMP_DELAY, self.__chatStomp, self.stompTaskName, - extraArgs=[timeout]) - return - - self.clearChatText() - - self.chatPages = chatText.split('\x07') - self.setChatPageIndex(0) - - if timeout: - delay = len(self.getChatText()) * 0.5 - if delay < self.CHAT_TIMEOUT_MIN: - delay = self.CHAT_TIMEOUT_MIN - elif delay > self.CHAT_TIMEOUT_MAX: - delay = self.CHAT_TIMEOUT_MAX - self.chatTimeoutTask = taskMgr.doMethodLater( - delay, self.clearChatText, self.chatTimeoutTaskName) - - def getChatText(self): - if self.chatPageIndex >= self.getNumChatPages(): - return '' - return self.chatPages[self.chatPageIndex] - - def clearChatText(self, task=None): - if self.stompTask is not None: - taskMgr.remove(self.stompTask) - self.stompTask = None - - self.stompChatText = '' - - if self.chatTimeoutTask is not None: - taskMgr.remove(self.chatTimeoutTask) - self.chatTimeoutTask = None - - self.chatPages = [] - self.chatPageIndex = 0 - - for nametag in self.nametags: - nametag.setChatText('') - nametag.update() - - if task is not None: - return Task.done - - def getStompChatText(self): - return self.stompChatText - - def setIcon(self, icon): - self.icon = icon - for nametag in self.nametags: - nametag.setIcon(self.icon) - - def getIcon(self): - return self.icon - - def setNametag2d(self, nametag2d): - if self.nametag2d is not None: - self.remove(self.nametag2d) - self.nametag2d = None - - if nametag2d is None: - return - - self.nametag2d = nametag2d - self.add(self.nametag2d) - - def getNametag2d(self): - return self.nametag2d - - def setNametag3d(self, nametag3d): - if self.nametag3d is not None: - self.remove(self.nametag3d) - self.nametag3d = None - - if nametag3d is None: - return - - self.nametag3d = nametag3d - self.add(self.nametag3d) - - def getNametag3d(self): - return self.nametag3d - - def add(self, nametag): - self.nametags.add(nametag) - nametag.setAvatar(self.avatar) - nametag.setActive(self.active) - nametag.setClickEvent(self.getUniqueName()) - nametag.setChatButton(self.chatButton) - nametag.setFont(self.font) - nametag.setChatFont(self.chatFont) - nametag.setChatType(self.chatType) - nametag.setChatBalloonType(self.chatBalloonType) - nametag.setNametagColor(self.nametagColor) - nametag.setChatColor(self.chatColor) - nametag.setSpeedChatColor(self.speedChatColor) - nametag.setWordWrap(self.wordWrap) - nametag.setChatWordWrap(self.chatWordWrap) - nametag.setText(self.text) - nametag.setChatText(self.getChatText()) - nametag.setIcon(self.icon) - nametag.update() - - def remove(self, nametag): - nametag.destroy() - self.nametags.remove(nametag) - - def updateAll(self): - for nametag in self.nametags: - nametag.update() - - def manage(self, marginManager): - if self.marginManager is not None: - self.unmanage(self.marginManager) - self.marginManager = marginManager - for nametag in self.nametags: - if isinstance(nametag, MarginVisible): - nametag.manage(self.marginManager) - - def unmanage(self, marginManager): - if marginManager != self.marginManager: - return - if self.marginManager is None: - return - self.marginManager = marginManager - for nametag in self.nametags: - if isinstance(nametag, MarginVisible): - nametag.unmanage(self.marginManager) - - def hideNametag(self): - for nametag in self.nametags: - nametag.hideNametag() - - def showNametag(self): - for nametag in self.nametags: - nametag.showNametag() - - def hideChat(self): - for nametag in self.nametags: - nametag.hideChat() - - def showChat(self): - for nametag in self.nametags: - nametag.showChat() - - def hideThought(self): - for nametag in self.nametags: - nametag.hideThought() - - def showThought(self): - for nametag in self.nametags: - nametag.showThought() - - def __chatStomp(self, timeout=False): - self.setChatText(self.stompChatText, timeout=timeout) - self.stompChatText = '' \ No newline at end of file diff --git a/toontown/nametag/__init__.py b/toontown/nametag/__init__.py deleted file mode 100755 index e69de29b..00000000 From 84e8ad4c0d3439321e294e607238bc99ac10c98b Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 24 Jun 2015 11:28:44 -0400 Subject: [PATCH 02/27] Push TTR nametag code --- otp/chat/ChatGlobals.py | 50 ++++- otp/margins/ClickablePopup.py | 162 ++++++++++++++++ otp/margins/MarginCell.py | 83 +++++++++ otp/margins/MarginManager.py | 83 +++++++++ otp/margins/MarginPopup.py | 52 ++++++ otp/margins/WhisperPopup.py | 97 ++++++++++ otp/margins/__init__.py | 0 otp/nametag/ChatBalloon.py | 93 ++++++++++ otp/nametag/Nametag.py | 156 ++++++++++++++++ otp/nametag/Nametag2d.py | 113 +++++++++++ otp/nametag/Nametag3d.py | 70 +++++++ otp/nametag/NametagConstants.py | 216 +++++++++++++++++++++ otp/nametag/NametagFloat2d.py | 7 + otp/nametag/NametagFloat3d.py | 7 + otp/nametag/NametagGlobals.py | 100 ++++++++++ otp/nametag/NametagGroup.py | 320 ++++++++++++++++++++++++++++++++ otp/nametag/__init__.py | 0 17 files changed, 1606 insertions(+), 3 deletions(-) create mode 100644 otp/margins/ClickablePopup.py create mode 100644 otp/margins/MarginCell.py create mode 100644 otp/margins/MarginManager.py create mode 100644 otp/margins/MarginPopup.py create mode 100644 otp/margins/WhisperPopup.py create mode 100644 otp/margins/__init__.py create mode 100644 otp/nametag/ChatBalloon.py create mode 100644 otp/nametag/Nametag.py create mode 100644 otp/nametag/Nametag2d.py create mode 100644 otp/nametag/Nametag3d.py create mode 100644 otp/nametag/NametagConstants.py create mode 100644 otp/nametag/NametagFloat2d.py create mode 100644 otp/nametag/NametagFloat3d.py create mode 100644 otp/nametag/NametagGlobals.py create mode 100644 otp/nametag/NametagGroup.py create mode 100644 otp/nametag/__init__.py diff --git a/otp/chat/ChatGlobals.py b/otp/chat/ChatGlobals.py index 096905f4..94203eeb 100755 --- a/otp/chat/ChatGlobals.py +++ b/otp/chat/ChatGlobals.py @@ -1,9 +1,53 @@ +import string +NORMAL_CHAT = 1 +WHISPER_CHAT = 2 +GUILD_CHAT = 3 +CREW_CHAT = 4 +SHIPPVP_CHAT = 5 +ERROR_NONE = None +ERROR_NO_OPEN_CHAT = 1 +ERROR_NOT_FRIENDS = 2 +ERROR_NO_RECEIVER = 3 +ERROR_NO_GUILD_CHAT = 4 +ERROR_NO_CREW_CHAT = 5 +ERROR_NO_SHIPPVP_CHAT = 6 +TYPEDCHAT = 0 SPEEDCHAT_NORMAL = 1 SPEEDCHAT_EMOTE = 2 SPEEDCHAT_CUSTOM = 3 -SPEEDCHAT_QUEST = 4 - +SYSTEMCHAT = 4 +GAMECHAT = 5 +GUILDCHAT = 6 +PARTYCHAT = 7 +SPEEDCHAT_QUEST = 8 +FRIEND_UPDATE = 9 +CREW_UPDATE = 10 +GUILD_UPDATE = 11 +AVATAR_UNAVAILABLE = 12 +SHIPPVPCHAT = 13 +GMCHAT = 14 +ChatEvent = 'ChatEvent' NormalChatEvent = 'NormalChatEvent' SCChatEvent = 'SCChatEvent' SCCustomChatEvent = 'SCCustomChatEvent' -SCEmoteChatEvent = 'SCEmoteChatEvent' \ No newline at end of file +SCEmoteChatEvent = 'SCEmoteChatEvent' +SCQuestEvent = 'SCQuestEvent' +OnScreen = 0 +OffScreen = 1 +Thought = 2 +ThoughtPrefix = '.' + +def isThought(message): + if len(message) == 0: + return 0 + elif message.find(ThoughtPrefix, 0, len(ThoughtPrefix)) >= 0: + return 1 + else: + return 0 + + +def removeThoughtPrefix(message): + if isThought(message): + return message[len(ThoughtPrefix):] + else: + return message diff --git a/otp/margins/ClickablePopup.py b/otp/margins/ClickablePopup.py new file mode 100644 index 00000000..ed9b8aec --- /dev/null +++ b/otp/margins/ClickablePopup.py @@ -0,0 +1,162 @@ +from pandac.PandaModules import * +from direct.showbase.DirectObject import DirectObject +from otp.nametag import NametagGlobals + +class ClickablePopup(PandaNode, DirectObject): + CS_NORMAL = 0 + CS_CLICK = 1 + CS_HOVER = 2 + CS_DISABLED = 3 + + def __init__(self, cam=None): + PandaNode.__init__(self, 'popup') + DirectObject.__init__(self) + + self.__mwn = NametagGlobals.mouseWatcher + self.__name = 'clickregion-%d' % id(self) + + self.__cam = cam + self.__region = MouseWatcherRegion(self.__name, 0, 0, 0, 0) + self.__mwn.addRegion(self.__region) + + self.__disabled = False + self.__clicked = False + self.__hovered = False + self.__onscreen = False + self.__clickState = 0 + self.__clickArgs = [] + + self.__clickEvent = '' + + self.accept(self.__getEvent(self.__mwn.getEnterPattern()), self.__mouseEnter) + self.accept(self.__getEvent(self.__mwn.getLeavePattern()), self.__mouseLeave) + self.accept(self.__getEvent(self.__mwn.getButtonDownPattern()), self.__buttonDown) + self.accept(self.__getEvent(self.__mwn.getButtonUpPattern()), self.__buttonUp) + + def destroy(self): + self.__mwn.removeRegion(self.__region) + self.ignoreAll() + + def setClickRegionEvent(self, event, clickArgs=[]): + if event is None: + # The caller is disabling us, so instead: + self.__disabled = True + self.__region.setActive(False) + self.__updateClickState() + else: + self.__clickEvent = event + self.__clickArgs = clickArgs + self.__disabled = False + self.__region.setActive(True) + self.__updateClickState() + + def getClickState(self): + return self.__clickState + + def clickStateChanged(self): + pass # Intended for subclasses. + + def __getEvent(self, pattern): + return pattern.replace('%r', self.__name) + + def __mouseEnter(self, region, extra): + self.__hovered = True + self.__updateClickState() + + def __mouseLeave(self, region, extra): + self.__hovered = False + self.__updateClickState() + + def __buttonDown(self, region, button): + if button == 'mouse1': + self.__clicked = True + self.__updateClickState() + + def __buttonUp(self, region, button): + if button == 'mouse1': + self.__clicked = False + self.__updateClickState() + + def __updateClickState(self): + if self.__disabled: + state = self.CS_DISABLED + elif self.__clicked: + state = self.CS_CLICK + elif self.__hovered: + state = self.CS_HOVER + else: + state = self.CS_NORMAL + + if self.__clickState == state: return + oldState = self.__clickState + self.__clickState = state + + if oldState == self.CS_NORMAL and state == self.CS_HOVER: + # Play rollover sound: + base.playSfx(NametagGlobals.rolloverSound) + elif state == self.CS_CLICK: + # Play click sound: + base.playSfx(NametagGlobals.clickSound) + elif oldState == self.CS_CLICK and state == self.CS_HOVER: + # Fire click event: + messenger.send(self.__clickEvent, self.__clickArgs) + + self.clickStateChanged() + + def updateClickRegion(self, left, right, bottom, top, offset=0): + transform = NodePath.anyPath(self).getNetTransform() + + if self.__cam: + # We have a camera, so get its transform and move our net transform + # into the coordinate space of the camera: + camTransform = self.__cam.getNetTransform() + transform = camTransform.invertCompose(transform) + + # We must discard the rotational component on our transform, thus: + transform = transform.setQuat(Quat()) + + # Next, we'll transform the frame into camspace: + mat = transform.getMat() + cTopLeft = mat.xformPoint(Point3(left, 0, top)) + cBottomRight = mat.xformPoint(Point3(right, 0, bottom)) + + # Shift along the offset while in camspace, not worldspace. + if offset: + mid = mat.xformPoint(Point3(0,0,0)) + length = mid.length() + shift = mid*(length - offset)/length - mid + cTopLeft += shift + cBottomRight += shift + + if self.__cam: + # We must go further and project to screenspace: + lens = self.__cam.node().getLens() + + sTopLeft = Point2() + sBottomRight = Point2() + + if not (lens.project(Point3(cTopLeft), sTopLeft) and + lens.project(Point3(cBottomRight), sBottomRight)): + # Not on-screen! Disable the click region: + self.__region.setActive(False) + self.__onscreen = False + return + else: + # No cam; the "camspace" (actually just net transform) IS the + # screenspace transform. + sTopLeft = Point2(cTopLeft[0], cTopLeft[2]) + sBottomRight = Point2(cBottomRight[0], cBottomRight[2]) + + sLeft, sTop = sTopLeft + sRight, sBottom = sBottomRight + + self.__region.setFrame(sLeft, sRight, sBottom, sTop) + self.__region.setActive(not self.__disabled) + self.__onscreen = True + + def stashClickRegion(self): + self.__region.setActive(False) + self.__onscreen = False + + def isOnScreen(self): + return self.__onscreen diff --git a/otp/margins/MarginCell.py b/otp/margins/MarginCell.py new file mode 100644 index 00000000..5fc13874 --- /dev/null +++ b/otp/margins/MarginCell.py @@ -0,0 +1,83 @@ +from pandac.PandaModules import * + +class MarginCell(NodePath): + def __init__(self, manager): + NodePath.__init__(self, 'cell') + + self.manager = manager + + self.content = None + self.available = False + + self.debugSquare = None + self.debugMode = False + + self.setDebug(config.GetBool('want-cell-debug', False)) + + def setAvailable(self, available): + if not available and self.hasContent(): + self.setContent(None) + + self.available = available + + self.updateDebug() + + def setContent(self, content): + if self.content: + self.content._assignedCell = None + self.contentNP.removeNode() + self.content.marginVisibilityChanged() + + if content: + content._assignedCell = self + content._lastCell = self + self.contentNP = self.attachNewNode(content) + content.marginVisibilityChanged() + + self.content = content + + self.updateDebug() + + def hasContent(self): + return self.content is not None + + def getContent(self): + return self.content + + def isAvailable(self): + return self.available + + def isFree(self): + return self.isAvailable() and not self.hasContent() + + def setDebugColor(self, color): + if not self.debugSquare: + cm = CardMaker('debugSquare') + cm.setFrameFullscreenQuad() + self.debugSquare = self.attachNewNode(cm.generate()) + self.debugSquare.setTransparency(1) + self.debugSquare.setY(1) + + self.debugSquare.setColor(color) + + def updateDebug(self): + if not self.debugMode: return + + if self.hasContent(): + self.setDebugColor(VBase4(0.0, 0.8, 0.0, 0.5)) + elif self.isAvailable(): + self.setDebugColor(VBase4(0.0, 0.0, 0.8, 0.5)) + else: + self.setDebugColor(VBase4(0.8, 0.0, 0.0, 0.5)) + + def setDebug(self, status): + if bool(status) == self.debugMode: + return + + self.debugMode = status + + if self.debugMode: + self.updateDebug() + elif self.debugSquare: + self.debugSquare.removeNode() + self.debugSquare = None diff --git a/otp/margins/MarginManager.py b/otp/margins/MarginManager.py new file mode 100644 index 00000000..dbbbb978 --- /dev/null +++ b/otp/margins/MarginManager.py @@ -0,0 +1,83 @@ +from pandac.PandaModules import * +from MarginCell import MarginCell +import random + +class MarginManager(PandaNode): + def __init__(self): + PandaNode.__init__(self, 'margins') + + self.cells = set() + self.visiblePopups = set() + + def addGridCell(self, x, y, a2d): + # Yucky! + nodePath = NodePath.anyPath(self) + a2d.reparentTo(nodePath) + cell = MarginCell(self) + cell.reparentTo(a2d) + cell.setScale(0.2) + cell.setPos(x, 0, y) + cell.setAvailable(True) + cell.setPythonTag('MarginCell', cell) + + self.cells.add(cell) + self.reorganize() + + return cell + + def setCellAvailable(self, cell, available): + cell = cell.getPythonTag('MarginCell') + cell.setAvailable(available) + self.reorganize() + + def addVisiblePopup(self, popup): + self.visiblePopups.add(popup) + self.reorganize() + + def removeVisiblePopup(self, popup): + if popup not in self.visiblePopups: return + self.visiblePopups.remove(popup) + self.reorganize() + + def reorganize(self): + # First, get all active cells: + activeCells = [cell for cell in self.cells if cell.isAvailable()] + + # Next, get all visible popups, sorted by priority: + popups = list(self.visiblePopups) + popups.sort(key=lambda x: -x.getPriority()) + + # We can only display so many popups, so truncate to the number of active + # margin cells: + popups = popups[:len(activeCells)] + + # Now, we need to build up a list of free cells: + freeCells = [] + for cell in activeCells: + if not cell.hasContent(): + freeCells.append(cell) + elif cell.getContent() in popups: + # It's already displaying something we want to show, so we can + # safely ignore this cell/popup pair: + popups.remove(cell.getContent()) + else: + # It's not displaying something we want to see, evict the old + # popup: + cell.setContent(None) + freeCells.append(cell) + + # At this point, there should be enough cells to show the popups: + assert len(freeCells) >= len(popups) + + # Now we assign the popups: + for popup in popups: + if popup._lastCell in freeCells and popup._lastCell.isFree(): + # The last cell it had assigned is available, so let's assign it + # again: + popup._lastCell.setContent(popup) + freeCells.remove(popup._lastCell) + else: + # We assign a cell at random. + cell = random.choice(freeCells) + cell.setContent(popup) + freeCells.remove(cell) diff --git a/otp/margins/MarginPopup.py b/otp/margins/MarginPopup.py new file mode 100644 index 00000000..69ead38a --- /dev/null +++ b/otp/margins/MarginPopup.py @@ -0,0 +1,52 @@ +from pandac.PandaModules import * + +class MarginPopup: + def __init__(self): + self.__manager = None + self.__visible = False + + self.__priority = 0 + + # The margin management system uses these: + self._assignedCell = None + self._lastCell = None + + def setVisible(self, visibility): + visibility = bool(visibility) + if self.__visible == visibility: return + + self.__visible = visibility + + if self.__manager is not None: + if visibility: + self.__manager.addVisiblePopup(self) + else: + self.__manager.removeVisiblePopup(self) + + def getPriority(self): + return self.__priority + + def setPriority(self, priority): + self.__priority = priority + if self.__manager is not None: + self.__manager.reorganize() + + def isDisplayed(self): + return self._assignedCell is not None + + def marginVisibilityChanged(self): + pass # Fired externally when the result of isDisplayed changes. For subclasses. + + def manage(self, manager): + if self.__manager: + self.unmanage(self.__manager) + self.__manager = manager + + if self.__visible: + manager.addVisiblePopup(self) + + def unmanage(self, manager): + if self.__manager is not None: + if self.__visible: + self.__manager.removeVisiblePopup(self) + self.__manager = None diff --git a/otp/margins/WhisperPopup.py b/otp/margins/WhisperPopup.py new file mode 100644 index 00000000..4b2bd260 --- /dev/null +++ b/otp/margins/WhisperPopup.py @@ -0,0 +1,97 @@ +from MarginPopup import * +from ClickablePopup import * +from otp.nametag import NametagGlobals +from otp.nametag.NametagConstants import * + +class WhisperPopup(MarginPopup, ClickablePopup): + WTNormal = WTNormal + WTQuickTalker = WTQuickTalker + WTSystem = WTSystem + WTBattleSOS = WTBattleSOS + WTEmote = WTEmote + WTToontownBoardingGroup = WTToontownBoardingGroup + + WORDWRAP = 7.5 + SCALE_2D = 0.25 + + def __init__(self, text, font, whisperType, timeout=10.0): + ClickablePopup.__init__(self) + MarginPopup.__init__(self) + + self.innerNP = NodePath.anyPath(self).attachNewNode('innerNP') + self.innerNP.setScale(self.SCALE_2D) + + self.text = text + self.font = font + self.whisperType = whisperType + self.timeout = timeout + + self.active = False + self.fromId = 0 + + self.left = 0.0 + self.right = 0.0 + self.top = 0.0 + self.bottom = 0.0 + + self.updateContents() + + self.setPriority(2) + self.setVisible(True) + + def updateContents(self): + if self.whisperType in WHISPER_COLORS: + cc = self.whisperType + else: + cc = WTSystem + + fgColor, bgColor = WHISPER_COLORS[cc][self.getClickState()] + self.innerNP.node().removeAllChildren() + + balloon, frame = NametagGlobals.speechBalloon2d.generate( + self.text, self.font, textColor=fgColor, balloonColor=bgColor, + wordWrap=self.WORDWRAP) + balloon.reparentTo(self.innerNP) + + # Calculate the center of the TextNode. + text = balloon.find('**/+TextNode') + t = text.node() + self.left, self.right, self.bottom, self.top = t.getFrameActual() + center = self.innerNP.getRelativePoint(text, ((self.left + self.right) / 2., 0, (self.bottom + self.top) / 2.)) + + # Next translate the balloon along the inverse. + balloon.setPos(balloon, -center) + + if self.active and self.fromId: + self.setClickRegionEvent('clickedWhisper', clickArgs=[self.fromId]) + + def setClickable(self, senderName, fromId, todo=0): + self.active = True + self.fromId = fromId + + self.updateContents() + self.__updateClickRegion() + + def marginVisibilityChanged(self): + self.__updateClickRegion() + + def __updateClickRegion(self): + if self.isDisplayed() and self.active: + self.updateClickRegion(-1, 1, self.bottom, self.top) + else: + self.stashClickRegion() + + def clickStateChanged(self): + self.updateContents() + + def manage(self, manager): + MarginPopup.manage(self, manager) + + taskMgr.doMethodLater(self.timeout, self.unmanage, 'whisper-timeout-%d' % id(self), [manager]) + + # Manually Clean up + def unmanage(self, manager): + MarginPopup.unmanage(self, manager) + + ClickablePopup.destroy(self) + self.innerNP.removeNode() diff --git a/otp/margins/__init__.py b/otp/margins/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/otp/nametag/ChatBalloon.py b/otp/nametag/ChatBalloon.py new file mode 100644 index 00000000..598eb47b --- /dev/null +++ b/otp/nametag/ChatBalloon.py @@ -0,0 +1,93 @@ +from pandac.PandaModules import * + +class ChatBalloon: + TEXT_SHIFT = (0.1, -0.05, 1.1) + TEXT_SHIFT_REVERSED = -0.05 + TEXT_SHIFT_PROP = 0.08 + NATIVE_WIDTH = 10.0 + MIN_WIDTH = 2.5 + MIN_HEIGHT = 1 + BUBBLE_PADDING = 0.3 + BUBBLE_PADDING_PROP = 0.05 + BUTTON_SCALE = 6 + BUTTON_SHIFT = (-0.2, 0, 0.6) + FRAME_SHIFT = (0.2, 1.4) + + def __init__(self, model): + self.model = model + + def generate(self, text, font, textColor=(0,0,0,1), balloonColor=(1,1,1,1), + wordWrap = 10.0, button=None, reversed=False): + root = NodePath('balloon') + + # Add balloon geometry: + balloon = self.model.copyTo(root) + top = balloon.find('**/top') + middle = balloon.find('**/middle') + bottom = balloon.find('**/bottom') + + balloon.setColor(balloonColor) + if balloonColor[3] < 1.0: + balloon.setTransparency(1) + + # Render the text into a TextNode, using the font: + t = root.attachNewNode(TextNode('text')) + t.node().setFont(font) + t.node().setWordwrap(wordWrap) + t.node().setText(text) + t.node().setTextColor(textColor) + + width, height = t.node().getWidth(), t.node().getHeight() + + # Turn off depth write for the text: The place in the depth buffer is + # held by the chat bubble anyway, and the text renders after the bubble + # so there's no risk of the bubble overwriting the text's pixels. + t.setAttrib(DepthWriteAttrib.make(0)) + t.setPos(self.TEXT_SHIFT) + t.setX(t, self.TEXT_SHIFT_PROP*width) + t.setZ(t, height) + + if reversed: + # The nametag code wants the text on the left side of the axis, + # rather than on the right side. Therefore, we move the text to the + # opposite side: + t.setX(self.TEXT_SHIFT_REVERSED - self.TEXT_SHIFT_PROP*width - width) + + # Give the chat bubble a button, if one is requested: + if button: + np = button.copyTo(root) + np.setPos(t, width, 0, -height) + np.setPos(np, self.BUTTON_SHIFT) + np.setScale(self.BUTTON_SCALE) + + # Set a minimum width and height for short or empty messages + if width < self.MIN_WIDTH: + width = self.MIN_WIDTH + if reversed: + t.setX(t, -width/2.0) + else: + t.setX(t, width/2.0) + t.node().setAlign(TextNode.ACenter) + + if height < self.MIN_HEIGHT: + height = self.MIN_HEIGHT + t.setX(t, height/2.0) + t.node().setAlign(TextNode.ACenter) + + # Set the balloon's size: + width *= 1+self.BUBBLE_PADDING_PROP + width += self.BUBBLE_PADDING + balloon.setSx(width/self.NATIVE_WIDTH) + if reversed: + balloon.setSx(-balloon.getSx()) + balloon.setTwoSided(True) # Render the backface of the balloon + middle.setSz(height) + top.setZ(top, height-1) + + # Calculate the frame occupied by the balloon: + left, bottom = self.FRAME_SHIFT + if reversed: + left = -left - width + frame = (left, left+width, bottom, bottom+height+1) + + return root, frame diff --git a/otp/nametag/Nametag.py b/otp/nametag/Nametag.py new file mode 100644 index 00000000..ac1bf1e6 --- /dev/null +++ b/otp/nametag/Nametag.py @@ -0,0 +1,156 @@ +from NametagConstants import * +import NametagGlobals +from otp.margins.ClickablePopup import ClickablePopup +from otp.otpbase import OTPGlobals +from pandac.PandaModules import * + +class Nametag(ClickablePopup): + CName = 1 + CSpeech = 2 + CThought = 4 + + NAME_PADDING = 0.2 + CHAT_ALPHA = 1.0 + + DEFAULT_CHAT_WORDWRAP = 10.0 + + IS_3D = False # 3D variants will set this to True. + + def __init__(self): + if self.IS_3D: + ClickablePopup.__init__(self, NametagGlobals.camera) + else: + ClickablePopup.__init__(self) + + self.contents = 0 # To be set by subclass. + + self.innerNP = NodePath.anyPath(self).attachNewNode('nametag_contents') + + self.wordWrap = 7.5 + self.chatWordWrap = None + + self.font = None + self.speechFont = None + self.name = '' + self.displayName = '' + self.qtColor = VBase4(1,1,1,1) + self.colorCode = CCNormal + self.avatar = None + self.icon = NodePath('icon') + + self.frame = (0, 0, 0, 0) + + self.nameFg = (0,0,0,1) + self.nameBg = (1,1,1,1) + self.chatFg = (0,0,0,1) + self.chatBg = (1,1,1,1) + + self.chatString = '' + self.chatFlags = 0 + + def destroy(self): + ClickablePopup.destroy(self) + + def setContents(self, contents): + self.contents = contents + self.update() + + def setAvatar(self, avatar): + self.avatar = avatar + + def setChatWordwrap(self, chatWordWrap): + self.chatWordWrap = chatWordWrap + + def tick(self): + pass # Does nothing by default. + + def clickStateChanged(self): + self.update() + + def getButton(self): + cs = self.getClickState() + if self.buttons is None: + return None + elif cs in self.buttons: + return self.buttons[cs] + else: + return self.buttons.get(0) + + def update(self): + if self.colorCode in NAMETAG_COLORS: + cc = self.colorCode + else: + cc = CCNormal + + self.nameFg, self.nameBg, self.chatFg, self.chatBg = NAMETAG_COLORS[cc][self.getClickState()] + + self.innerNP.node().removeAllChildren() + if self.contents & self.CThought and self.chatFlags & CFThought: + self.showThought() + elif self.contents & self.CSpeech and self.chatFlags&CFSpeech: + self.showSpeech() + elif self.contents & self.CName and self.displayName: + self.showName() + + def showBalloon(self, balloon, text): + if not self.speechFont: + # If no font is set, we can't display anything yet... + return + color = self.qtColor if (self.chatFlags&CFQuicktalker) else self.chatBg + if color[3] > self.CHAT_ALPHA: + color = (color[0], color[1], color[2], self.CHAT_ALPHA) + + reversed = (self.IS_3D and (self.chatFlags&CFReversed)) + + balloon, frame = balloon.generate(text, self.speechFont, textColor=self.chatFg, + balloonColor=color, + wordWrap=self.chatWordWrap or \ + self.DEFAULT_CHAT_WORDWRAP, + button=self.getButton(), + reversed=reversed) + balloon.reparentTo(self.innerNP) + self.frame = frame + + def showThought(self): + self.showBalloon(self.getThoughtBalloon(), self.chatString) + + def showSpeech(self): + self.showBalloon(self.getSpeechBalloon(), self.chatString) + + def showName(self): + if not self.font: + # If no font is set, we can't actually display a name yet... + return + + # Create text node: + self.innerNP.attachNewNode(self.icon) + t = self.innerNP.attachNewNode(TextNode('name'), 1) + t.node().setFont(self.font) + t.node().setAlign(TextNode.ACenter) + t.node().setWordwrap(self.wordWrap) + t.node().setText(self.displayName) + t.setColor(self.nameFg) + t.setTransparency(self.nameFg[3] < 1.0) + + width, height = t.node().getWidth(), t.node().getHeight() + + # Put the actual written name a little in front of the nametag and + # disable depth write so the text appears nice and clear, free from + # z-fighting and bizarre artifacts. The text renders *after* the tag + # behind it, due to both being in the transparency bin, + # so there's really no problem with doing this. + t.setY(-0.05) + t.setAttrib(DepthWriteAttrib.make(0)) + + # Apply panel behind the text: + panel = NametagGlobals.nametagCardModel.copyTo(self.innerNP, 0) + panel.setPos((t.node().getLeft()+t.node().getRight())/2.0, 0, + (t.node().getTop()+t.node().getBottom())/2.0) + panel.setScale(width + self.NAME_PADDING, 1, height + self.NAME_PADDING) + panel.setColor(self.nameBg) + panel.setTransparency(self.nameBg[3] < 1.0) + + self.frame = (t.node().getLeft()-self.NAME_PADDING/2.0, + t.node().getRight()+self.NAME_PADDING/2.0, + t.node().getBottom()-self.NAME_PADDING/2.0, + t.node().getTop()+self.NAME_PADDING/2.0) diff --git a/otp/nametag/Nametag2d.py b/otp/nametag/Nametag2d.py new file mode 100644 index 00000000..0622fed5 --- /dev/null +++ b/otp/nametag/Nametag2d.py @@ -0,0 +1,113 @@ +from Nametag import * +from otp.margins.MarginPopup import * +from pandac.PandaModules import * +import math + +class Nametag2d(Nametag, MarginPopup): + SCALE_2D = 0.25 + CHAT_ALPHA = 0.5 + ARROW_OFFSET = -1.0 + ARROW_SCALE = 1.5 + + DEFAULT_CHAT_WORDWRAP = 8.0 + + def __init__(self): + Nametag.__init__(self) + MarginPopup.__init__(self) + + self.contents = self.CName|self.CSpeech + self.chatWordWrap = 7.5 + + self.arrow = None + + self.innerNP.setScale(self.SCALE_2D) + + def showBalloon(self, balloon, text): + text = '%s: %s' % (self.name, text) + Nametag.showBalloon(self, balloon, text) + + # Next, center the balloon in the cell: + balloon = NodePath.anyPath(self).find('*/balloon') + + # Calculate the center of the TextNode. + text = balloon.find('**/+TextNode') + t = text.node() + left, right, bottom, top = t.getFrameActual() + center = self.innerNP.getRelativePoint(text, + ((left+right)/2., 0, (bottom+top)/2.)) + + # Next translate the balloon along the inverse. + balloon.setPos(balloon, -center) + # Also translate the frame: + left, right, bottom, top = self.frame + self.frame = (left-center.getX(), right-center.getX(), + bottom-center.getZ(), top-center.getZ()) + + # When a balloon is active, we need to be somewhat higher-priority in the + # popup system: + self.setPriority(1) + + # Remove our pointer arrow: + if self.arrow is not None: + self.arrow.removeNode() + self.arrow = None + + def showName(self): + Nametag.showName(self) + + # Revert our priority back to basic: + self.setPriority(0) + + # Tack on an arrow: + t = self.innerNP.find('**/+TextNode') + arrowZ = self.ARROW_OFFSET + t.node().getBottom() + + self.arrow = NametagGlobals.arrowModel.copyTo(self.innerNP) + self.arrow.setZ(arrowZ) + self.arrow.setScale(self.ARROW_SCALE) + self.arrow.setColor(ARROW_COLORS.get(self.colorCode, self.nameFg)) + + def update(self): + Nametag.update(self) + self.considerUpdateClickRegion() + + def marginVisibilityChanged(self): + self.considerUpdateClickRegion() + + def considerUpdateClickRegion(self): + # If we are onscreen, we update our click region: + if self.isDisplayed(): + left, right, bottom, top = self.frame + self.updateClickRegion(left*self.SCALE_2D, right*self.SCALE_2D, + bottom*self.SCALE_2D, top*self.SCALE_2D) + else: + self.stashClickRegion() + + def tick(self): + # Update the arrow's pointing. + if not self.isDisplayed() or self.arrow is None: + return # No arrow or not onscreen. + + if self.avatar is None or self.avatar.isEmpty(): + return # No avatar, can't be done. + + # Get points needed in calculation: + cam = NametagGlobals.camera or base.cam + toon = NametagGlobals.toon or cam + + # libotp calculates this using the offset from localToon->avatar, but + # the orientation from cam. Therefore, we duplicate it like so: + location = self.avatar.getPos(toon) + rotation = toon.getQuat(cam) + + camSpacePos = rotation.xform(location) + arrowRadians = math.atan2(camSpacePos[0], camSpacePos[1]) + arrowDegrees = arrowRadians/math.pi*180 + + self.arrow.setR(arrowDegrees - 90) + + def getSpeechBalloon(self): + return NametagGlobals.speechBalloon2d + + def getThoughtBalloon(self): + return NametagGlobals.thoughtBalloon2d diff --git a/otp/nametag/Nametag3d.py b/otp/nametag/Nametag3d.py new file mode 100644 index 00000000..63ad5bab --- /dev/null +++ b/otp/nametag/Nametag3d.py @@ -0,0 +1,70 @@ +from Nametag import * +import NametagGlobals +from NametagConstants import * +from pandac.PandaModules import * +import math + +class Nametag3d(Nametag): + WANT_DYNAMIC_SCALING = True + SCALING_FACTOR = 0.055 + SCALING_MINDIST = 1 + SCALING_MAXDIST = 50 + + BILLBOARD_OFFSET = 3.0 + SHOULD_BILLBOARD = True + + IS_3D = True + + def __init__(self): + Nametag.__init__(self) + + self.contents = self.CName|self.CSpeech|self.CThought + + self.bbOffset = self.BILLBOARD_OFFSET + self._doBillboard() + + def _doBillboard(self): + if self.SHOULD_BILLBOARD: + self.innerNP.setEffect(BillboardEffect.make( + Vec3(0,0,1), + True, + False, + self.bbOffset, + NodePath(), # Empty; look at scene camera + Point3(0,0,0))) + else: + self.bbOffset = 0.0 + + def setBillboardOffset(self, bbOffset): + self.bbOffset = bbOffset + self._doBillboard() + + def tick(self): + if not self.WANT_DYNAMIC_SCALING: + scale = self.SCALING_FACTOR + else: + # Attempt to maintain the same on-screen size. + distance = self.innerNP.getPos(NametagGlobals.camera).length() + distance = max(min(distance, self.SCALING_MAXDIST), self.SCALING_MINDIST) + + scale = math.sqrt(distance)*self.SCALING_FACTOR + + self.innerNP.setScale(scale) + + # As 3D nametags can move around on their own, we need to update the + # click frame constantly: + path = NodePath.anyPath(self) + if path.isHidden() or (path.getTop() != NametagGlobals.camera.getTop() and + path.getTop() != render2d): + self.stashClickRegion() + else: + left, right, bottom, top = self.frame + self.updateClickRegion(left*scale, right*scale, + bottom*scale, top*scale, + self.bbOffset) + + def getSpeechBalloon(self): + return NametagGlobals.speechBalloon3d + + def getThoughtBalloon(self): + return NametagGlobals.thoughtBalloon3d diff --git a/otp/nametag/NametagConstants.py b/otp/nametag/NametagConstants.py new file mode 100644 index 00000000..39cd3067 --- /dev/null +++ b/otp/nametag/NametagConstants.py @@ -0,0 +1,216 @@ +CFNoQuitButton=256 +CFPageButton=16 +CFQuicktalker=4 +CFQuitButton=32 +CFReversed=64 +CFSndOpenchat=128 +CFSpeech=1 +CFThought=2 +CFTimeout=8 + +CCNormal = 0 +CCNoChat = 1 +CCNonPlayer = 2 +CCSuit = 3 +CCToonBuilding = 4 +CCSuitBuilding = 5 +CCHouseBuilding = 6 +CCSpeedChat = 7 +CCFreeChat = 8 + +NAMETAG_COLORS = { + CCNormal: ( + # 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.3, 0.3, 0.7, 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 + ), + 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 + (0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat + # Click 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 + # Hover 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 + # 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 + ), + CCSuit: ( + # Normal FG BG + ((0.2, 0.2, 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 + # Click FG BG + ((0.2, 0.2, 0.2, 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.4, 0.4, 0.4, 1.0), (1.0, 1.0, 1.0, 0.7), # Name + (0.0, 0.6, 0.6, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat + # Disable FG BG + ((0.2, 0.2, 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 + ), + CCSuitBuilding: ( + # Normal FG BG + ((0.5, 0.5, 0.5, 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.5, 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 + ((0.7, 0.7, 0.7, 1.0), (1.0, 1.0, 1.0, 0.7), # Name + (0.0, 0.6, 0.6, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat + # Disable FG BG + ((0.5, 0.5, 0.5, 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 + ), + CCToonBuilding: ( + # Normal FG BG + ((0.2, 0.6, 0.9, 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.6, 0.9, 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 + # Hover FG BG + ((0.2, 0.6, 0.9, 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 + # Disable FG BG + ((0.2, 0.6, 0.9, 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 + ), + CCHouseBuilding: ( + # Normal FG BG + ((0.2, 0.6, 0.9, 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.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 + ), + CCSpeedChat: ( + # Normal 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 + # Click FG BG + ((0.0, 0.5, 0.0, 1.0), (0.5, 0.5, 0.5, 0.6), # Name + (1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat + # Hover FG BG + ((0.0, 0.7, 0.2, 1.0), (1.0, 1.0, 1.0, 0.7), # Name + (0.0, 0.6, 0.6, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat + # 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 + ), +} + +ARROW_COLORS = { + CCSuit: (0.8, 0.4, 0.0, 1.0), +} + +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 +} + +WTNormal = 0 +WTQuickTalker = 1 +WTSystem = 2 +WTBattleSOS = 3 +WTEmote = 4 +WTToontownBoardingGroup = 5 + +WHISPER_COLORS = { + WTNormal: ( + # Normal FG BG + ((0.0, 0.0, 0.0, 1.0), (0.2, 0.6, 0.8, 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.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)), + ), + WTQuickTalker: ( + # Normal FG BG + ((0.0, 0.0, 0.0, 1.0), (0.2, 0.6, 0.8, 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.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)), + ), + WTSystem: ( + # 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, 1.0, 0.6)), + # 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)), + # 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)), + ), + # TODO: WTToontownBoardingGroup +} diff --git a/otp/nametag/NametagFloat2d.py b/otp/nametag/NametagFloat2d.py new file mode 100644 index 00000000..258e2e97 --- /dev/null +++ b/otp/nametag/NametagFloat2d.py @@ -0,0 +1,7 @@ +from Nametag3d import * + +class NametagFloat2d(Nametag3d): + WANT_DYNAMIC_SCALING = False + SCALING_FACTOR = 1.0 + SHOULD_BILLBOARD = False + IS_3D = False diff --git a/otp/nametag/NametagFloat3d.py b/otp/nametag/NametagFloat3d.py new file mode 100644 index 00000000..0d331f58 --- /dev/null +++ b/otp/nametag/NametagFloat3d.py @@ -0,0 +1,7 @@ +from Nametag3d import * + +class NametagFloat3d(Nametag3d): + WANT_DYNAMIC_SCALING = False + SCALING_FACTOR = 1.0 + SHOULD_BILLBOARD = True + IS_3D = False diff --git a/otp/nametag/NametagGlobals.py b/otp/nametag/NametagGlobals.py new file mode 100644 index 00000000..d6c972b6 --- /dev/null +++ b/otp/nametag/NametagGlobals.py @@ -0,0 +1,100 @@ +camera = None +def setCamera(cam): + global camera + camera = cam + +arrowModel = None +def setArrowModel(am): + global arrowModel + arrowModel = am + +nametagCardModel = None +nametagCardDimensions = None +def setNametagCard(model, dimensions): + global nametagCardModel, nametagCardDimensions + nametagCardModel = model + nametagCardDimensions = dimensions + +mouseWatcher = None +def setMouseWatcher(mw): + global mouseWatcher + mouseWatcher = mw + +speechBalloon3d = None +def setSpeechBalloon3d(sb3d): + global speechBalloon3d + speechBalloon3d = sb3d + +thoughtBalloon3d = None +def setThoughtBalloon3d(tb3d): + global thoughtBalloon3d + thoughtBalloon3d = tb3d + +speechBalloon2d = None +def setSpeechBalloon2d(sb2d): + global speechBalloon2d + speechBalloon2d = sb2d + +thoughtBalloon2d = None +def setThoughtBalloon2d(tb2d): + global thoughtBalloon2d + thoughtBalloon2d = tb2d + +pageButtons = {} +def setPageButton(state, model): + pageButtons[state] = model + +quitButtons = {} +def setQuitButton(state, model): + quitButtons[state] = model + +rolloverSound = None +def setRolloverSound(ros): + global rolloverSound + rolloverSound = ros + +clickSound = None +def setClickSound(cs): + global clickSound + clickSound = cs + +toon = None +def setToon(t): + global toon + toon = t + +masterArrowsOn = 0 +def setMasterArrowsOn(mao): + global masterArrowsOn + masterArrowsOn = mao + +masterNametagsActive = 0 +def setMasterNametagsActive(mna): + global masterNametagsActive + masterNametagsActive = mna + +min2dAlpha = 0.0 +def setMin2dAlpha(m2a): + global min2dAlpha + min2dAlpha = m2a + +def getMin2dAlpha(): + global min2dAlpha + return min2dAlpha + +max2dAlpha = 0.0 +def setMax2dAlpha(m2a): + global max2dAlpha + max2dAlpha = m2a + +def getMax2dAlpha(): + global max2dAlpha + return max2dAlpha + +onscreenChatForced = 0 +def setOnscreenChatForced(ocf): + global onscreenChatForced + onscreenChatForced = ocf + +def setGlobalNametagScale(s): + pass \ No newline at end of file diff --git a/otp/nametag/NametagGroup.py b/otp/nametag/NametagGroup.py new file mode 100644 index 00000000..ea7af978 --- /dev/null +++ b/otp/nametag/NametagGroup.py @@ -0,0 +1,320 @@ +from pandac.PandaModules import * +from NametagConstants import * +from Nametag3d import * +from Nametag2d import * + +class NametagGroup: + CCNormal = CCNormal + CCNoChat = CCNoChat + CCNonPlayer = CCNonPlayer + CCSuit = CCSuit + CCToonBuilding = CCToonBuilding + CCSuitBuilding = CCSuitBuilding + CCHouseBuilding = CCHouseBuilding + CCSpeedChat = CCSpeedChat + CCFreeChat = CCFreeChat + + CHAT_TIMEOUT_MAX = 12.0 + CHAT_TIMEOUT_MIN = 4.0 + CHAT_TIMEOUT_PROP = 0.5 + + def __init__(self): + self.nametag2d = Nametag2d() + self.nametag3d = Nametag3d() + self.icon = PandaNode('icon') + + self.chatTimeoutTask = None + + self.font = None + self.speechFont = None + self.name = '' + self.displayName = '' + self.wordWrap = None + self.qtColor = VBase4(1,1,1,1) + self.colorCode = CCNormal + self.avatar = None + self.active = True + + self.chatPages = [] + self.chatPage = 0 + self.chatFlags = 0 + + self.objectCode = None + + self.manager = None + + self.nametags = [] + self.addNametag(self.nametag2d) + self.addNametag(self.nametag3d) + + self.visible3d = True # Is a 3D nametag visible, or do we need a 2D popup? + + self.tickTask = taskMgr.add(self.__tickTask, self.getUniqueId(), sort=45) + + self.stompTask = None + self.stompText = None + self.stompFlags = 0 + + def destroy(self): + taskMgr.remove(self.tickTask) + if self.manager is not None: + self.unmanage(self.manager) + for nametag in list(self.nametags): + self.removeNametag(nametag) + if self.stompTask: + self.stompTask.remove() + + def getNametag2d(self): + return self.nametag2d + + def getNametag3d(self): + return self.nametag3d + + def getNameIcon(self): + return self.icon + + def getNumChatPages(self): + if not self.chatFlags & (CFSpeech|CFThought): + return 0 + + return len(self.chatPages) + + def setPageNumber(self, page): + self.chatPage = page + self.updateTags() + + def getChatStomp(self): + return bool(self.stompTask) + + def getChat(self): + if self.chatPage >= len(self.chatPages): + return '' + else: + return self.chatPages[self.chatPage] + + def getStompText(self): + return self.stompText + + def getStompDelay(self): + return 0.2 + + def getUniqueId(self): + return 'Nametag-%d' % id(self) + + def hasButton(self): + return bool(self.getButtons()) + + def getButtons(self): + if self.getNumChatPages() < 2: + # Either only one page or no pages displayed. This means no button, + # unless the game code specifically requests one. + if self.chatFlags & CFQuitButton: + return NametagGlobals.quitButtons + elif self.chatFlags & CFPageButton: + return NametagGlobals.pageButtons + else: + return None + elif self.chatPage == self.getNumChatPages()-1: + # Last page of a multiple-page chat. This calls for a quit button, + # unless the game says otherwise. + if not self.chatFlags & CFNoQuitButton: + return NametagGlobals.quitButtons + else: + return None + else: + # Non-last page of a multiple-page chat. This calls for a page + # button, but only if the game requests it: + if self.chatFlags & CFPageButton: + return NametagGlobals.pageButtons + else: + return None + + def setActive(self, active): + self.active = active + + def isActive(self): + return self.active + + def setAvatar(self, avatar): + self.avatar = avatar + + def setFont(self, font): + self.font = font + self.updateTags() + + def setSpeechFont(self, font): + self.speechFont = font + self.updateTags() + + def setWordwrap(self, wrap): + self.wordWrap = wrap + self.updateTags() + + def setColorCode(self, cc): + self.colorCode = cc + self.updateTags() + + def setName(self, name): + self.name = name + self.updateTags() + + def setDisplayName(self, name): + self.displayName = name + self.updateTags() + + def setQtColor(self, color): + self.qtColor = color + self.updateTags() + + def setChat(self, chatString, chatFlags): + if not self.chatFlags&CFSpeech: + # We aren't already displaying some chat. Therefore, we don't have + # to stomp. + self._setChat(chatString, chatFlags) + else: + # Stomp! + self.clearChat() + self.stompText = chatString + self.stompFlags = chatFlags + self.stompTask = taskMgr.doMethodLater(self.getStompDelay(), self.__updateStomp, + 'ChatStomp-' + self.getUniqueId()) + + def _setChat(self, chatString, chatFlags): + if chatString: + self.chatPages = chatString.split('\x07') + self.chatFlags = chatFlags + else: + self.chatPages = [] + self.chatFlags = 0 + self.setPageNumber(0) # Calls updateTags() for us. + + self._stopChatTimeout() + if chatFlags&CFTimeout: + self._startChatTimeout() + + def __updateStomp(self, task): + self._setChat(self.stompText, self.stompFlags) + self.stompTask = None + + def setContents(self, contents): + # This function is a little unique, it's meant to override contents on + # EXISTING nametags only: + for tag in self.nametags: + tag.setContents(contents) + + def setObjectCode(self, objectCode): + self.objectCode = objectCode + + def getObjectCode(self): + return self.objectCode + + def _startChatTimeout(self): + length = len(self.getChat()) + timeout = min(max(length*self.CHAT_TIMEOUT_PROP, self.CHAT_TIMEOUT_MIN), self.CHAT_TIMEOUT_MAX) + self.chatTimeoutTask = taskMgr.doMethodLater(timeout, self.__doChatTimeout, + 'ChatTimeout-' + self.getUniqueId()) + + def __doChatTimeout(self, task): + self._setChat('', 0) + return task.done + + def _stopChatTimeout(self): + if self.chatTimeoutTask: + taskMgr.remove(self.chatTimeoutTask) + + def clearShadow(self): + pass + + def clearChat(self): + self._setChat('', 0) + if self.stompTask: + self.stompTask.remove() + + def updateNametag(self, tag): + tag.font = self.font + tag.speechFont = self.speechFont + tag.name = self.name + tag.wordWrap = self.wordWrap or DEFAULT_WORDWRAPS[self.colorCode] + tag.displayName = self.displayName or self.name + tag.qtColor = self.qtColor + tag.colorCode = self.colorCode + tag.chatString = self.getChat() + tag.buttons = self.getButtons() + tag.chatFlags = self.chatFlags + tag.avatar = self.avatar + tag.icon = self.icon + + tag.update() + + def __testVisible3D(self): + # We must determine if a 3D nametag is visible or not, since this + # affects the visibility state of 2D nametags. + + # Next, we iterate over all of our nametags until we find a visible + # one: + for nametag in self.nametags: + if not isinstance(nametag, Nametag3d): + continue # It's not in the 3D system, disqualified. + + if nametag.isOnScreen(): + return True + + # If we got here, none of the tags were a match... + return False + + + def __tickTask(self, task): + for nametag in self.nametags: + nametag.tick() + if (NametagGlobals.masterNametagsActive and self.active) or self.hasButton(): + nametag.setClickRegionEvent(self.getUniqueId()) + else: + nametag.setClickRegionEvent(None) + + if NametagGlobals.onscreenChatForced and self.chatFlags & CFSpeech: + # Because we're *forcing* chat onscreen, we skip the visible3d test + # and go ahead and display it anyway. + visible3d = False + elif not NametagGlobals.masterArrowsOn and not self.chatFlags: + # We're forcing margins offscreen; therefore, we should pretend + # that the 3D nametag is always visible. + visible3d = True + else: + visible3d = self.__testVisible3D() + + if visible3d ^ self.visible3d: + self.visible3d = visible3d + for nametag in self.nametags: + if isinstance(nametag, MarginPopup): + nametag.setVisible(not visible3d) + + return task.cont + + def updateTags(self): + for nametag in self.nametags: + self.updateNametag(nametag) + + def addNametag(self, nametag): + self.nametags.append(nametag) + self.updateNametag(nametag) + if self.manager is not None and isinstance(nametag, MarginPopup): + nametag.manage(manager) + + def removeNametag(self, nametag): + self.nametags.remove(nametag) + if self.manager is not None and isinstance(nametag, MarginPopup): + nametag.unmanage(manager) + nametag.destroy() + + def manage(self, manager): + self.manager = manager + for tag in self.nametags: + if isinstance(tag, MarginPopup): + tag.manage(manager) + + def unmanage(self, manager): + self.manager = None + for tag in self.nametags: + if isinstance(tag, MarginPopup): + tag.unmanage(manager) + tag.destroy() diff --git a/otp/nametag/__init__.py b/otp/nametag/__init__.py new file mode 100644 index 00000000..e69de29b From a110fb7a1939106f2d8412f721b2842c44e39d6c Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 24 Jun 2015 11:37:57 -0400 Subject: [PATCH 03/27] ChatUtil has this stuff --- otp/chat/ChatGlobals.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/otp/chat/ChatGlobals.py b/otp/chat/ChatGlobals.py index 94203eeb..605a3907 100755 --- a/otp/chat/ChatGlobals.py +++ b/otp/chat/ChatGlobals.py @@ -35,19 +35,3 @@ SCQuestEvent = 'SCQuestEvent' OnScreen = 0 OffScreen = 1 Thought = 2 -ThoughtPrefix = '.' - -def isThought(message): - if len(message) == 0: - return 0 - elif message.find(ThoughtPrefix, 0, len(ThoughtPrefix)) >= 0: - return 1 - else: - return 0 - - -def removeThoughtPrefix(message): - if isThought(message): - return message[len(ThoughtPrefix):] - else: - return message From cadeff717dc19230a57c4b68de5c94c6dd8a57b4 Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 24 Jun 2015 12:32:30 -0400 Subject: [PATCH 04/27] Current work --- otp/avatar/Avatar.py | 227 ++++++++++++++-------------------- toontown/toon/NPCToons.py | 4 +- toontown/toonbase/ToonBase.py | 112 ++++++++++------- 3 files changed, 163 insertions(+), 180 deletions(-) diff --git a/otp/avatar/Avatar.py b/otp/avatar/Avatar.py index a53438aa..6d423afa 100755 --- a/otp/avatar/Avatar.py +++ b/otp/avatar/Avatar.py @@ -12,9 +12,9 @@ from otp.chat import ChatUtil from otp.otpbase import OTPGlobals from otp.otpbase import OTPLocalizer from otp.otpbase import OTPRender -from toontown.chat.ChatGlobals import * -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagGroup import NametagGroup +from otp.nametag.Nametag import Nametag +from otp.nametag.NametagGroup import NametagGroup +from otp.nametag.NametagConstants import CFSpeech, CFThought, CFTimeout, CFPageButton, CFNoQuitButton, CFQuitButton teleportNotify = DirectNotifyGlobal.directNotify.newCategory('Teleport') @@ -43,15 +43,18 @@ class Avatar(Actor, ShadowCaster): Actor.__init__(self, None, None, other, flattenable=0, setFinal=1) ShadowCaster.__init__(self) self.__font = OTPGlobals.getInterfaceFont() + self.__speechFont = OTPGlobals.getInterfaceFont() self.soundChatBubble = None self.avatarType = '' self.nametagNodePath = None self.__nameVisible = 1 self.nametag = NametagGroup() self.nametag.setAvatar(self) - interfaceFont = OTPGlobals.getInterfaceFont() - self.nametag.setFont(interfaceFont) - self.nametag.setChatFont(interfaceFont) + self.nametag.setFont(OTPGlobals.getInterfaceFont()) + self.nametag.setSpeechFont(OTPGlobals.getInterfaceFont()) + self.nametag2dContents = Nametag.CName | Nametag.CSpeech + self.nametag2dDist = Nametag.CName | Nametag.CSpeech + self.nametag2dNormalContents = Nametag.CName | Nametag.CSpeech self.nametag3d = self.attachNewNode('nametag3d') self.nametag3d.setTag('cam', 'nametag') self.nametag3d.setLightOff() @@ -69,7 +72,7 @@ class Avatar(Actor, ShadowCaster): self.battleTubeRadius = 0.0 self.style = None self.understandable = 1 - self.setPlayerType(NametagGlobals.CCNormal) + self.setPlayerType(NametagGroup.CCNormal) self.ghostMode = 0 self.__chatParagraph = None self.__chatMessage = None @@ -79,7 +82,6 @@ class Avatar(Actor, ShadowCaster): self.__chatDialogueList = [] self.__chatSet = 0 self.__chatLocal = 0 - self.__chatQuitButton = False self.__currentDialogue = None def delete(self): @@ -92,6 +94,7 @@ class Avatar(Actor, ShadowCaster): self.ignoreNametagAmbientLightChange() self.Avatar_deleted = 1 del self.__font + del self.__speechFont del self.style del self.soundChatBubble self.nametag.destroy() @@ -121,50 +124,53 @@ class Avatar(Actor, ShadowCaster): self.notify.warning('no nametag attributed, but would have been used.') return if self.isUnderstandable(): - nametagColor = NametagGlobals.NametagColors[self.playerType] - self.nametag.setNametagColor(nametagColor) - chatColor = NametagGlobals.ChatColors[self.playerType] - self.nametag.setChatColor(chatColor) + self.nametag.setColorCode(self.playerType) else: - nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCNonPlayer] - self.nametag.setNametagColor(nametagColor) - chatColor = NametagGlobals.ChatColors[NametagGlobals.CCNonPlayer] - self.nametag.setChatColor(chatColor) - self.setNametagName() - self.nametag.updateAll() + self.nametag.setColorCode(NametagGroup.CCNoChat) def considerUnderstandable(self): - if self.playerType in (NametagGlobals.CCNormal, NametagGlobals.CCSpeedChat): - self.setPlayerType(NametagGlobals.CCSpeedChat) - if hasattr(base, 'localAvatar') and (self == base.localAvatar): + speed = 0 + if self.playerType in (NametagGroup.CCNormal, NametagGroup.CCFreeChat, NametagGroup.CCSpeedChat): + self.setPlayerType(NametagGroup.CCSpeedChat) + speed = 1 + if hasattr(base, 'localAvatar') and self == base.localAvatar: self.understandable = 1 - self.setPlayerType(NametagGlobals.CCNormal) - elif hasattr(self, 'adminAccess') and self.isAdmin(): - self.understandable = 2 - self.setPlayerType(NametagGlobals.CCAdmin) - elif self.playerType == NametagGlobals.CCSuit: + self.setPlayerType(NametagGroup.CCFreeChat) + elif self.playerType == NametagGroup.CCSuit: self.understandable = 1 - self.setPlayerType(NametagGlobals.CCSuit) - elif self.playerType not in (NametagGlobals.CCNormal, NametagGlobals.CCSpeedChat): + self.setPlayerType(NametagGroup.CCSuit) + elif self.playerType not in (NametagGroup.CCNormal, NametagGroup.CCFreeChat, NametagGroup.CCSpeedChat): self.understandable = 1 - self.setPlayerType(NametagGlobals.CCNonPlayer) - elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId): - self.understandable = 2 - self.setPlayerType(NametagGlobals.CCNormal) - elif settings['speedchatPlus']: + self.setPlayerType(NametagGroup.CCNoChat) + elif hasattr(base, 'localAvatar') and self.commonChatFlags & base.localAvatar.commonChatFlags & OTPGlobals.CommonChat: + self.understandable = 1 + self.setPlayerType(NametagGroup.CCFreeChat) + elif self.commonChatFlags & OTPGlobals.SuperChat: + self.understandable = 1 + self.setPlayerType(NametagGroup.CCFreeChat) + elif hasattr(base, 'localAvatar') and base.localAvatar.commonChatFlags & OTPGlobals.SuperChat: + self.understandable = 1 + self.setPlayerType(NametagGroup.CCFreeChat) + elif base.cr.getFriendFlags(self.doId) & OTPGlobals.FriendChat: + self.understandable = 1 + self.setPlayerType(NametagGroup.CCFreeChat) + elif base.cr.playerFriendsManager.findPlayerIdFromAvId(self.doId) is not None: + playerInfo = base.cr.playerFriendsManager.findPlayerInfoFromAvId(self.doId) + if playerInfo.openChatFriendshipYesNo: + self.understandable = 1 + self.nametag.setColorCode(NametagGroup.CCFreeChat) + elif playerInfo.isUnderstandable(): + self.understandable = 1 + else: + self.understandable = 0 + elif hasattr(base, 'localAvatar') and self.whitelistChatFlags & base.localAvatar.whitelistChatFlags: self.understandable = 1 - self.setPlayerType(NametagGlobals.CCSpeedChat) else: self.understandable = 0 - self.setPlayerType(NametagGlobals.CCSpeedChat) if not hasattr(self, 'nametag'): self.notify.warning('no nametag attributed, but would have been used') else: - nametagColor = NametagGlobals.NametagColors[self.playerType] - self.nametag.setNametagColor(nametagColor) - chatColor = NametagGlobals.ChatColors[self.playerType] - self.nametag.setChatColor(chatColor) - self.nametag.updateAll() + self.nametag.setColorCode(self.playerType) def isUnderstandable(self): return self.understandable @@ -222,25 +228,13 @@ class Avatar(Actor, ShadowCaster): return self.name = name if hasattr(self, 'nametag'): - self.setNametagName() + self.nametag.setName(name) def setDisplayName(self, str): if hasattr(self, 'isDisguised'): if self.isDisguised: return - self.setNametagName(str) - - def setNametagName(self, name=None): - if not name: - name = self.name - - if hasattr(self, 'adminAccess') and self.isAdmin(): - access = self.getAdminAccess() - - if access in OTPLocalizer.AccessToString: - name += '\n\x01shadow\x01%s\x02' % OTPLocalizer.AccessToString[access] - - self.nametag.setText(name) + self.nametag.setDisplayName(str) def getFont(self): return self.__font @@ -248,7 +242,13 @@ class Avatar(Actor, ShadowCaster): def setFont(self, font): self.__font = font self.nametag.setFont(font) - self.nametag.setChatFont(font) + + def getSpeechFont(self): + return self.__speechFont + + def setSpeechFont(self, font): + self.__speechFont = font + self.nametag.setSpeechFont(font) def getStyle(self): return self.style @@ -266,7 +266,7 @@ class Avatar(Actor, ShadowCaster): if dialogue: base.playSfx(dialogue, node=self) elif chatFlags & CFSpeech != 0 and self.nametag.getNumChatPages() > 0: - self.playDialogueForString(self.nametag.getChatText()) + self.playDialogueForString(self.nametag.getChat()) if self.soundChatBubble != None: base.playSfx(self.soundChatBubble, node=self) @@ -344,28 +344,7 @@ class Avatar(Actor, ShadowCaster): def setChatAbsolute(self, chatString, chatFlags, dialogue=None, interrupt=1): self.clearChat() - - if chatFlags & CFQuicktalker: - self.nametag.setChatType(NametagGlobals.SPEEDCHAT) - else: - self.nametag.setChatType(NametagGlobals.CHAT) - - if chatFlags & CFThought: - self.nametag.setChatBalloonType(NametagGlobals.THOUGHT_BALLOON) - else: - self.nametag.setChatBalloonType(NametagGlobals.CHAT_BALLOON) - - if chatFlags & CFPageButton: - self.nametag.setChatButton(NametagGlobals.pageButton) - else: - self.nametag.setChatButton(NametagGlobals.noButton) - - if chatFlags & CFReversed: - self.nametag.setChatReversed(True) - else: - self.nametag.setChatReversed(False) - - self.nametag.setChatText(chatString, timeout=(chatFlags & CFTimeout)) + self.nametag.setChat(chatString, chatFlags) self.playCurrentDialogue(dialogue, chatFlags, interrupt) def setChatMuted(self, chatString, chatFlags, dialogue = None, interrupt = 1, quiet = 0): @@ -374,18 +353,14 @@ class Avatar(Actor, ShadowCaster): def displayTalk(self, chatString): if not base.localAvatar.isIgnored(self.doId): self.clearChat() - self.nametag.setChatType(NametagGlobals.CHAT) - self.nametag.setChatButton(NametagGlobals.noButton) if ChatUtil.isThought(chatString): chatString = ChatUtil.removeThoughtPrefix(chatString) - self.nametag.setChatBalloonType(NametagGlobals.THOUGHT_BALLOON) - self.nametag.setChatText(chatString) + self.nametag.setChat(chatString, CFThought) else: - self.nametag.setChatBalloonType(NametagGlobals.CHAT_BALLOON) - self.nametag.setChatText(chatString, timeout=True) + self.nametag.setChat(chatString, CFSpeech | CFTimeout) def clearChat(self): - self.nametag.clearChatText() + self.nametag.clearChat() def isInView(self): pos = self.getPos(camera) @@ -404,62 +379,44 @@ class Avatar(Actor, ShadowCaster): def hideName(self): nametag3d = self.nametag.getNametag3d() - nametag3d.hideNametag() - nametag3d.showChat() - nametag3d.showThought() - nametag3d.update() + nametag3d.setContents(Nametag.CSpeech | Nametag.CThought) def showName(self): if self.__nameVisible and (not self.ghostMode): nametag3d = self.nametag.getNametag3d() - nametag3d.showNametag() - nametag3d.showChat() - nametag3d.showThought() - nametag3d.update() + nametag3d.setContents(Nametag.CName | Nametag.CSpeech | Nametag.CThought) def hideNametag2d(self): nametag2d = self.nametag.getNametag2d() - nametag2d.hideNametag() - nametag2d.hideChat() - nametag2d.update() + self.nametag2dContents = 0 + nametag2d.setContents(self.nametag2dContents & self.nametag2dDist) def showNametag2d(self): nametag2d = self.nametag.getNametag2d() - if not self.ghostMode: - nametag2d.showNametag() - nametag2d.showChat() - else: - nametag2d.hideNametag() - nametag2d.hideChat() - nametag2d.update() + self.nametag2dContents = self.nametag2dNormalContents + if self.ghostMode: + self.nametag2dContents = Nametag.CSpeech + nametag2d.setContents(self.nametag2dContents & self.nametag2dDist) def hideNametag3d(self): nametag3d = self.nametag.getNametag3d() - nametag3d.hideNametag() - nametag3d.hideChat() - nametag3d.hideThought() - nametag3d.update() + nametag3d.setContents(0) def showNametag3d(self): nametag3d = self.nametag.getNametag3d() if self.__nameVisible and (not self.ghostMode): - nametag3d.showNametag() - nametag3d.showChat() - nametag3d.showThought() + nametag3d.setContents(Nametag.CName | Nametag.CSpeech | Nametag.CThought) else: - nametag3d.hideNametag() - nametag3d.hideChat() - nametag3d.hideThought() - nametag3d.update() + nametag3d.setContents(0) def setPickable(self, flag): self.nametag.setActive(flag) def clickedNametag(self): MagicWordManager.lastClickedNametag = self - if self.nametag.getChatText() and self.nametag.hasChatButton(): + if self.nametag.hasButton(): self.advancePageNumber() - elif self.nametag.getActive(): + elif self.nametag.isActive(): messenger.send('clickedNametag', [self]) def setPageChat(self, addressee, paragraph, message, quitButton, @@ -468,9 +425,10 @@ class Avatar(Actor, ShadowCaster): self.__chatPageNumber = None self.__chatParagraph = paragraph self.__chatMessage = message - self.__chatFlags = CFSpeech - if extraChatFlags is not None: - self.__chatFlags |= extraChatFlags + if extraChatFlags is None: + self.__chatFlags = CFSpeech + else: + self.__chatFlags = CFSpeech | extraChatFlags self.__chatDialogueList = dialogueList self.__chatSet = 0 self.__chatLocal = 0 @@ -478,7 +436,10 @@ class Avatar(Actor, ShadowCaster): if addressee == base.localAvatar.doId: if pageButton: self.__chatFlags |= CFPageButton - self.__chatQuitButton = quitButton + if quitButton == None: + self.__chatFlags |= CFNoQuitButton + elif quitButton: + self.__chatFlags |= CFQuitButton self.b_setPageNumber(self.__chatParagraph, 0) def setLocalPageChat(self, message, quitButton, extraChatFlags=None, @@ -487,14 +448,18 @@ class Avatar(Actor, ShadowCaster): self.__chatPageNumber = None self.__chatParagraph = None self.__chatMessage = message - self.__chatFlags = CFSpeech - if extraChatFlags is not None: - self.__chatFlags |= extraChatFlags + if extraChatFlags is None: + self.__chatFlags = CFSpeech + else: + self.__chatFlags = CFSpeech | extraChatFlags self.__chatDialogueList = dialogueList self.__chatSet = 1 self.__chatLocal = 1 self.__chatFlags |= CFPageButton - self.__chatQuitButton = quitButton + if quitButton == None: + self.__chatFlags |= CFNoQuitButton + elif quitButton: + self.__chatFlags |= CFQuitButton if len(dialogueList) > 0: dialogue = dialogueList[0] else: @@ -529,9 +494,6 @@ class Avatar(Actor, ShadowCaster): pageNumber += 1 if pageNumber >= self.nametag.getNumChatPages(): pageNumber = -1 - if self.__chatQuitButton: - if pageNumber == self.nametag.getNumChatPages() - 1: - self.nametag.setChatButton(NametagGlobals.quitButton) if self.__chatLocal: self.setPageNumber(self.__chatParagraph, pageNumber) else: @@ -550,10 +512,7 @@ class Avatar(Actor, ShadowCaster): self.setChatAbsolute(self.__chatMessage, self.__chatFlags, dialogue) self.__chatSet = 1 if pageNumber < self.nametag.getNumChatPages(): - if (self.__chatAddressee == base.localAvatar.doId) and self.__chatQuitButton: - if pageNumber == self.nametag.getNumChatPages() - 1: - self.nametag.setChatButton(NametagGlobals.quitButton) - self.nametag.setChatPageIndex(pageNumber) + self.nametag.setPageNumber(pageNumber) if pageNumber > 0: if len(self.__chatDialogueList) > pageNumber: dialogue = self.__chatDialogueList[pageNumber] @@ -573,7 +532,7 @@ class Avatar(Actor, ShadowCaster): self.deleteNametag3d() nametagNode = self.nametag.getNametag3d() self.nametagNodePath = self.nametag3d.attachNewNode(nametagNode) - iconNodePath = self.nametag.getIcon() + iconNodePath = self.nametag.getNameIcon() for cJoint in self.getNametagJoints(): cJoint.clearNetTransforms() cJoint.addNetTransform(nametagNode) @@ -622,7 +581,7 @@ class Avatar(Actor, ShadowCaster): Avatar.ActiveAvatars.append(self) self.nametag.manage(base.marginManager) - self.accept(self.nametag.getUniqueName(), self.clickedNametag) + self.accept(self.nametag.getUniqueId(), self.clickedNametag) def removeActive(self): if base.wantNametags: @@ -632,7 +591,7 @@ class Avatar(Actor, ShadowCaster): pass self.nametag.unmanage(base.marginManager) - self.ignore(self.nametag.getUniqueName()) + self.ignore(self.nametag.getUniqueId()) def loop(self, animName, restart = 1, partName = None, fromFrame = None, toFrame = None): return Actor.loop(self, animName, restart, partName, fromFrame, toFrame) diff --git a/toontown/toon/NPCToons.py b/toontown/toon/NPCToons.py index d06b8648..ec4cbe32 100755 --- a/toontown/toon/NPCToons.py +++ b/toontown/toon/NPCToons.py @@ -5,7 +5,7 @@ import sys, os import ToonDNA from toontown.hood import ZoneUtil -from toontown.nametag import NametagGlobals +from otp.nametag.NametagGroup import * from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownGlobals @@ -177,7 +177,7 @@ def createLocalNPC(npcId): npc = Toon.Toon() npc.setName(name) npc.setPickable(0) - npc.setPlayerType(NametagGlobals.CCNonPlayer) + npc.setPlayerType(NametagGroup.CCNonPlayer) dna = ToonDNA.ToonDNA() if dnaType == 'r': dnaList = getRandomDNA(npcId, gender) diff --git a/toontown/toonbase/ToonBase.py b/toontown/toonbase/ToonBase.py index c34b4d5a..d9ab7152 100755 --- a/toontown/toonbase/ToonBase.py +++ b/toontown/toonbase/ToonBase.py @@ -20,9 +20,9 @@ import ToontownGlobals import ToontownLoader from otp.otpbase import OTPBase from otp.otpbase import OTPGlobals -from toontown.margins import MarginGlobals -from toontown.margins.MarginManager import MarginManager -from toontown.nametag import NametagGlobals +from otp.nametag.ChatBalloon import ChatBalloon +from otp.nametag import NametagGlobals +from otp.margins.MarginManager import MarginManager from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals from toontown.toontowngui import TTDialog @@ -155,8 +155,6 @@ class ToonBase(OTPBase.OTPBase): def windowEvent(self, win): OTPBase.OTPBase.windowEvent(self, win) - MarginGlobals.updateMarginVisibles() - def setCursorAndIcon(self): tempdir = tempfile.mkdtemp() atexit.register(shutil.rmtree, tempdir) @@ -247,54 +245,80 @@ class ToonBase(OTPBase.OTPBase): self.screenshotStr += str def initNametagGlobals(self): - NametagGlobals.setMe(base.cam) - - NametagGlobals.setCardModel('phase_3/models/props/panel.bam') - NametagGlobals.setArrowModel('phase_3/models/props/arrow.bam') - NametagGlobals.setChatBalloon3dModel('phase_3/models/props/chatbox.bam') - NametagGlobals.setChatBalloon2dModel('phase_3/models/props/chatbox_noarrow.bam') - NametagGlobals.setThoughtBalloonModel('phase_3/models/props/chatbox_thought_cutout.bam') - - chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui.bam') - NametagGlobals.setPageButton( - chatButtonGui.find('**/Horiz_Arrow_UP'), chatButtonGui.find('**/Horiz_Arrow_DN'), - chatButtonGui.find('**/Horiz_Arrow_Rllvr'), chatButtonGui.find('**/Horiz_Arrow_UP')) - NametagGlobals.setQuitButton( - chatButtonGui.find('**/CloseBtn_UP'), chatButtonGui.find('**/CloseBtn_DN'), - chatButtonGui.find('**/CloseBtn_Rllvr'), chatButtonGui.find('**/CloseBtn_UP')) - chatButtonGui.removeNode() - + arrow = loader.loadModel('phase_3/models/props/arrow') + card = loader.loadModel('phase_3/models/props/panel') + speech3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox')) + thought3d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_thought_cutout')) + speech2d = ChatBalloon(loader.loadModel('phase_3/models/props/chatbox_noarrow')) + chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui') + NametagGlobals.setCamera(self.cam) + NametagGlobals.setArrowModel(arrow) + NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5)) + if self.mouseWatcherNode: + NametagGlobals.setMouseWatcher(self.mouseWatcherNode) + NametagGlobals.setSpeechBalloon3d(speech3d) + NametagGlobals.setThoughtBalloon3d(thought3d) + NametagGlobals.setSpeechBalloon2d(speech2d) + NametagGlobals.setThoughtBalloon2d(thought3d) + NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP')) + NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN')) + NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr')) + NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP')) + NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN')) + NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr')) rolloverSound = DirectGuiGlobals.getDefaultRolloverSound() - if rolloverSound is not None: + if rolloverSound: NametagGlobals.setRolloverSound(rolloverSound) clickSound = DirectGuiGlobals.getDefaultClickSound() - if clickSound is not None: + if clickSound: NametagGlobals.setClickSound(clickSound) + NametagGlobals.setToon(self.cam) self.marginManager = MarginManager() - self.margins = self.aspect2d.attachNewNode( - self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) + self.margins = self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) + mm = self.marginManager + + # TODO: Dynamicaly add more and reposition cells + padding = 0.0225 + + # Order: Top to bottom self.leftCells = [ - self.marginManager.addCell(0.1, -0.6, self.a2dTopLeft), - self.marginManager.addCell(0.1, -1.0, self.a2dTopLeft), - self.marginManager.addCell(0.1, -1.4, self.a2dTopLeft) - ] - self.bottomCells = [ - self.marginManager.addCell(0.4, 0.1, self.a2dBottomCenter), - self.marginManager.addCell(-0.4, 0.1, self.a2dBottomCenter), - self.marginManager.addCell(-1.0, 0.1, self.a2dBottomCenter), - self.marginManager.addCell(1.0, 0.1, self.a2dBottomCenter) - ] - self.rightCells = [ - self.marginManager.addCell(-0.1, -0.6, self.a2dTopRight), - self.marginManager.addCell(-0.1, -1.0, self.a2dTopRight), - self.marginManager.addCell(-0.1, -1.4, self.a2dTopRight) + mm.addGridCell(0.2 + padding, -0.45, base.a2dTopLeft), # Above boarding groups + mm.addGridCell(0.2 + padding, -0.9, base.a2dTopLeft), # 1 + mm.addGridCell(0.2 + padding, -1.35, base.a2dTopLeft) # Below Boarding Groups ] - def setCellsActive(self, cells, active): - for cell in cells: - cell.setActive(active) - self.marginManager.reorganize() + # Order: Left to right + self.bottomCells = [ + mm.addGridCell(-0.87, 0.2 + padding, base.a2dBottomCenter), # To the right of the laff meter + mm.addGridCell(-0.43, 0.2 + padding, base.a2dBottomCenter), # 1 + mm.addGridCell(0.01, 0.2 + padding, base.a2dBottomCenter), # 2 + mm.addGridCell(0.45, 0.2 + padding, base.a2dBottomCenter), # 3 + mm.addGridCell(0.89, 0.2 + padding, base.a2dBottomCenter) # To the left of the shtiker book + ] + + # Order: Bottom to top + self.rightCells = [ + mm.addGridCell(-0.2 - padding, -1.35, base.a2dTopRight), # Above the street map + mm.addGridCell(-0.2 - padding, -0.9, base.a2dTopRight), # Below the friends list + mm.addGridCell(-0.2 - padding, -0.45, base.a2dTopRight) # Behind the friends list + ] + + def hideFriendMargins(self): + middleCell = self.rightCells[1] + topCell = self.rightCells[2] + + self.setCellsAvailable([middleCell, topCell], False) + + def showFriendMargins(self): + middleCell = self.rightCells[1] + topCell = self.rightCells[2] + + self.setCellsAvailable([middleCell, topCell], True) + + def setCellsAvailable(self, cell_list, available): + for cell in cell_list: + self.marginManager.setCellAvailable(cell, available) def startShow(self, cr): self.cr = cr From 167c5c5736702a3bf0be6ae83b1827c3ec24253c Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 24 Jun 2015 13:19:10 -0400 Subject: [PATCH 05/27] Current work --- otp/avatar/DistributedPlayer.py | 12 +++++----- otp/chat/TalkAssistant.py | 2 +- otp/distributed/OTPClientRepository.py | 2 +- toontown/shtiker/ShtikerBook.py | 16 +++++++------ toontown/suit/Suit.py | 7 +++--- toontown/toon/DistributedToon.py | 33 +++++--------------------- toontown/toon/TTEmote.py | 4 ++-- toontown/toon/Toon.py | 9 ++++--- 8 files changed, 34 insertions(+), 51 deletions(-) diff --git a/otp/avatar/DistributedPlayer.py b/otp/avatar/DistributedPlayer.py index 1fe2e8c7..e18cc55d 100755 --- a/otp/avatar/DistributedPlayer.py +++ b/otp/avatar/DistributedPlayer.py @@ -11,8 +11,8 @@ from otp.chat import ChatGarbler, TalkAssistant from otp.distributed.TelemetryLimited import TelemetryLimited from otp.otpbase import OTPGlobals, OTPLocalizer from otp.speedchat import SCDecoders -from toontown.chat.ChatGlobals import * -from toontown.chat.WhisperPopup import WhisperPopup +from otp.nametag.NametagConstants import * +from otp.margins.WhisperPopup import WhisperPopup class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBase, TelemetryLimited): chatGarbler = ChatGarbler.ChatGarbler({'default': OTPLocalizer.ChatGarblerDefault}) @@ -114,7 +114,7 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa if self is localAvatar: return True - def setSystemMessage(self, aboutId, chatString, whisperType = WTSystem): + def setSystemMessage(self, aboutId, chatString, whisperType = WhisperPopup.WTSystem): self.displayWhisper(aboutId, chatString, whisperType) def displayWhisper(self, fromId, chatString, whisperType): @@ -130,7 +130,7 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa return chatString = SCDecoders.decodeSCStaticTextMsg(msgIndex) if chatString: - self.displayWhisper(fromId, chatString, WTNormal) + self.displayWhisper(fromId, chatString, WhisperPopup.WTNormal) return def whisperSCCustomTo(self, msgIndex, sendToId): @@ -151,7 +151,7 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa return chatString = SCDecoders.decodeSCCustomMsg(msgIndex) if chatString: - self.displayWhisper(fromId, chatString, WTNormal) + self.displayWhisper(fromId, chatString, WhisperPopup.WTNormal) def whisperSCEmoteTo(self, emoteId, sendToId): messenger.send('wakeup') @@ -163,7 +163,7 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa return chatString = SCDecoders.decodeSCEmoteWhisperMsg(emoteId, handle.getName()) if chatString: - self.displayWhisper(fromId, chatString, WTEmote) + self.displayWhisper(fromId, chatString, WhisperPopup.WTEmote) return def setChatAbsolute(self, chatString, chatFlags, dialogue = None, interrupt = 1, quiet = 0): diff --git a/otp/chat/TalkAssistant.py b/otp/chat/TalkAssistant.py index 74ffa8e1..f7f413bf 100755 --- a/otp/chat/TalkAssistant.py +++ b/otp/chat/TalkAssistant.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.showbase import DirectObject from otp.chat.ChatGlobals import * -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * import ChatUtil class TalkAssistant(DirectObject.DirectObject): diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 906398c2..ad320735 100755 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -16,7 +16,7 @@ from otp.distributed.OtpDoGlobals import * from otp.distributed.TelemetryLimiter import TelemetryLimiter from otp.otpbase import OTPGlobals, OTPLocalizer from otp.otpgui import OTPDialog -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * import sys, time, types, random class OTPClientRepository(ClientRepositoryBase): diff --git a/toontown/shtiker/ShtikerBook.py b/toontown/shtiker/ShtikerBook.py index 6b6b8142..bdd38eb2 100755 --- a/toontown/shtiker/ShtikerBook.py +++ b/toontown/shtiker/ShtikerBook.py @@ -5,7 +5,7 @@ from direct.showbase import DirectObject from panda3d.core import * from toontown.effects import DistributedFireworkShow -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals from toontown.parties import DistributedPartyFireworksActivity from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals @@ -63,9 +63,11 @@ class ShtikerBook(DirectFrame, StateData.StateData): base.disableMouse() base.render.hide() base.setBackgroundColor(0.05, 0.15, 0.4) - base.setCellsActive([base.rightCells[0]], 0) - NametagGlobals.setForce2dNametags(True) - NametagGlobals.setForceOnscreenChat(True) + base.setCellsAvailable([base.rightCells[0]], 0) + self.oldMin2dAlpha = NametagGlobals.getMin2dAlpha() + self.oldMax2dAlpha = NametagGlobals.getMax2dAlpha() + NametagGlobals.setMin2dAlpha(0.8) + NametagGlobals.setMax2dAlpha(1.0) self.__isOpen = 1 self.__setButtonVisibility() self.show() @@ -97,9 +99,9 @@ class ShtikerBook(DirectFrame, StateData.StateData): gsg = base.win.getGsg() if gsg: base.render.prepareScene(gsg) - base.setCellsActive([base.rightCells[0]], 1) - NametagGlobals.setForce2dNametags(False) - NametagGlobals.setForceOnscreenChat(False) + NametagGlobals.setMin2dAlpha(self.oldMin2dAlpha) + NametagGlobals.setMax2dAlpha(self.oldMax2dAlpha) + base.setCellsAvailable([base.rightCells[0]], 1) self.__isOpen = 0 self.hide() self.hideButton() diff --git a/toontown/suit/Suit.py b/toontown/suit/Suit.py index cf31aa55..8e62e256 100755 --- a/toontown/suit/Suit.py +++ b/toontown/suit/Suit.py @@ -3,7 +3,7 @@ from direct.actor import Actor from direct.task.Task import Task from otp.avatar import Avatar from toontown.battle import BattleProps, SuitBattleGlobals -from toontown.nametag import NametagGlobals +from otp.nametag.NametagGroup import NametagGroup from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.suit import SuitGlobals import SuitDNA, string @@ -333,7 +333,8 @@ class Suit(Avatar.Avatar): Avatar.Avatar.__init__(self) self.setFont(ToontownGlobals.getSuitFont()) - self.setPlayerType(NametagGlobals.CCSuit) + self.setSpeechFont(ToontownGlobals.getSuitFont()) + self.setPlayerType(NametagGroup.CCSuit) self.setPickable(1) self.leftHand = None self.rightHand = None @@ -416,8 +417,6 @@ class Suit(Avatar.Avatar): self.generateHead(head) self.setHeight(properties[SuitGlobals.HEIGHT_INDEX]) - if len(properties) > SuitGlobals.NAMETAG_WRAP_INDEX: - self.nametag.setWordWrap(properties[SuitGlobals.NAMETAG_WRAP_INDEX]) self.setName(SuitBattleGlobals.SuitAttributes[dna.name]['name']) self.getGeomNode().setScale(self.scale) diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 11c4d8f5..948616ad 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -29,8 +29,8 @@ from toontown.catalog import CatalogItem from toontown.catalog import CatalogItemList from toontown.chat import ResistanceChat from toontown.chat import ToonChatGarbler -from toontown.chat.ChatGlobals import * -from toontown.chat.WhisperPopup import * +from otp.nametag.NametagConstants import * +from otp.margins.WhisperPopup import * from toontown.coghq import CogDisguiseGlobals from toontown.distributed import DelayDelete from toontown.distributed import DelayDelete @@ -46,8 +46,8 @@ from toontown.fishing import FishTank from toontown.friends import FriendHandle from toontown.golf import GolfGlobals from toontown.hood import ZoneUtil -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagGlobals import * +from otp.nametag import NametagGroup +from otp.nametag.NametagGroup import * from toontown.parties import PartyGlobals from toontown.parties.InviteInfo import InviteInfo from toontown.parties.PartyGlobals import InviteStatus, PartyStatus @@ -2064,36 +2064,15 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute DistributedAvatar.DistributedAvatar.setChatAbsolute(self, chatString, chatFlags, dialogue, interrupt) def setChatMuted(self, chatString, chatFlags, dialogue=None, interrupt=1, quiet=0): - if chatFlags & CFQuicktalker: - self.nametag.setChatType(NametagGlobals.SPEEDCHAT) - elif chatFlags & CFSpeech: - self.nametag.setChatType(NametagGlobals.CHAT) - - if chatFlags & CFThought: - self.nametag.setChatBalloonType(NametagGlobals.THOUGHT_BALLOON) - else: - self.nametag.setChatBalloonType(NametagGlobals.CHAT_BALLOON) - - if chatFlags & CFPageButton: - self.nametag.setChatButton(NametagGlobals.pageButton) - elif chatFlags & CFQuitButton: - self.nametag.setChatButton(NametagGlobals.quitButton) - else: - self.nametag.setChatButton(NametagGlobals.noButton) - - self.nametag.setChatText(chatString, timeout=bool(chatFlags & CFTimeout)) + self.nametag.setChat(chatString, chatFlags) self.playCurrentDialogue(dialogue, chatFlags - CFSpeech, interrupt) def displayTalk(self, chatString): flags = CFSpeech | CFTimeout - self.nametag.setChatType(NametagGlobals.CHAT) if ChatUtil.isThought(chatString): flags = CFThought - self.nametag.setChatBalloonType(NametagGlobals.THOUGHT_BALLOON) chatString = ChatUtil.removeThoughtPrefix(chatString) - else: - self.nametag.setChatBalloonType(NametagGlobals.CHAT_BALLOON) - self.nametag.setChatText(chatString, timeout=(flags & CFTimeout)) + self.nametag.setChat(chatString, flags) if base.toonChatSounds: self.playCurrentDialogue(None, flags, interrupt=1) diff --git a/toontown/toon/TTEmote.py b/toontown/toon/TTEmote.py index 3cdf7fc9..d89a6c33 100755 --- a/toontown/toon/TTEmote.py +++ b/toontown/toon/TTEmote.py @@ -8,8 +8,8 @@ import types import Toon, ToonDNA from otp.avatar import Emote from otp.otpbase import OTPLocalizer -from toontown.chat.ChatGlobals import * -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * +from otp.nametag.NametagGroup import * from toontown.toonbase import TTLocalizer diff --git a/toontown/toon/Toon.py b/toontown/toon/Toon.py index bf16e86c..ea2f5063 100755 --- a/toontown/toon/Toon.py +++ b/toontown/toon/Toon.py @@ -20,12 +20,12 @@ from otp.avatar.Avatar import teleportNotify from otp.otpbase import OTPGlobals from otp.otpbase import OTPLocalizer from toontown.battle import SuitBattleGlobals -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.distributed import DelayDelete from toontown.effects import DustCloud from toontown.effects import Wake from toontown.hood import ZoneUtil -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagGroup import * from toontown.suit import SuitDNA from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals @@ -454,6 +454,7 @@ class Toon(Avatar.Avatar, ToonHead): self.partyHat = None self.setTag('pieCode', str(ToontownGlobals.PieCodeToon)) self.setFont(ToontownGlobals.getToonFont()) + self.setSpeechFont(ToontownGlobals.getToonFont()) self.soundChatBubble = base.loadSfx('phase_3/audio/sfx/GUI_balloon_popup.ogg') self.animFSM = ClassicFSM('Toon', [State('off', self.enterOff, self.exitOff), State('neutral', self.enterNeutral, self.exitNeutral), @@ -2732,6 +2733,7 @@ class Toon(Avatar.Avatar, ToonHead): self.suit.loop('neutral') self.isDisguised = 1 self.setFont(ToontownGlobals.getSuitFont()) + self.setSpeechFont(ToontownGlobals.getSuitFont()) if setDisplayName: if hasattr(base, 'idTags') and base.idTags: name = self.getAvIdName() @@ -2765,7 +2767,8 @@ class Toon(Avatar.Avatar, ToonHead): Emote.globalEmote.releaseAll(self) self.isDisguised = 0 self.setFont(ToontownGlobals.getToonFont()) - self.nametag.setWordWrap(None) + self.setSpeechFont(ToontownGlobals.getToonFont()) + self.nametag.setWordwrap(None) if hasattr(base, 'idTags') and base.idTags: name = self.getAvIdName() else: From c568a632f1aee4253e1b8094979d3d482119c2f3 Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 24 Jun 2015 13:44:04 -0400 Subject: [PATCH 06/27] More work --- otp/avatar/LocalAvatar.py | 2 +- otp/chat/ChatManager.py | 2 +- toontown/friends/FriendsListPanel.py | 2 +- toontown/makeatoon/MakeAToon.py | 2 +- toontown/pets/Pet.py | 7 ++++--- toontown/quest/QuestParser.py | 2 +- toontown/toon/LocalToon.py | 9 ++++----- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/otp/avatar/LocalAvatar.py b/otp/avatar/LocalAvatar.py index 07244010..2a74b453 100755 --- a/otp/avatar/LocalAvatar.py +++ b/otp/avatar/LocalAvatar.py @@ -19,7 +19,7 @@ import DistributedAvatar from otp.ai.MagicWordGlobal import * from otp.otpbase import OTPGlobals from otp.otpbase import OTPLocalizer -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.toonbase import ToontownGlobals diff --git a/otp/chat/ChatManager.py b/otp/chat/ChatManager.py index 237a74fd..3110ba2d 100755 --- a/otp/chat/ChatManager.py +++ b/otp/chat/ChatManager.py @@ -5,7 +5,7 @@ from direct.gui.DirectGui import * from direct.showbase import DirectObject from panda3d.core import * from otp.otpbase import OTPLocalizer -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * import ChatUtil ChatEvent = 'ChatEvent' diff --git a/toontown/friends/FriendsListPanel.py b/toontown/friends/FriendsListPanel.py index 9a3bdf55..7964e5de 100755 --- a/toontown/friends/FriendsListPanel.py +++ b/toontown/friends/FriendsListPanel.py @@ -4,7 +4,7 @@ from direct.fsm import StateData from toontown.toon import ToonAvatarPanel from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagGroup import * from otp.otpbase import OTPGlobals FLPPets = 1 FLPOnline = 2 diff --git a/toontown/makeatoon/MakeAToon.py b/toontown/makeatoon/MakeAToon.py index 832448a4..ee5f2be8 100755 --- a/toontown/makeatoon/MakeAToon.py +++ b/toontown/makeatoon/MakeAToon.py @@ -16,7 +16,7 @@ from MakeAToonGlobals import * import MakeClothesGUI import NameShop from otp.avatar import Avatar -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.distributed.ToontownMsgTypes import * from toontown.toon import LocalToon from toontown.toon import Toon diff --git a/toontown/pets/Pet.py b/toontown/pets/Pet.py index 10e0ab5d..1a9e05ed 100755 --- a/toontown/pets/Pet.py +++ b/toontown/pets/Pet.py @@ -27,8 +27,9 @@ Component2IconDict = {'boredom': 'Bored', 'surprise': 'Surprised', 'affection': 'Love'} -from toontown.nametag import * -from toontown.nametag.NametagGlobals import * +from otp.nametag import * +from otp.nametag.NametagConstants import * +from otp.nametag.NametagGroup import * class Pet(Avatar.Avatar): notify = DirectNotifyGlobal.directNotify.newCategory('Pet') @@ -45,7 +46,7 @@ class Pet(Avatar.Avatar): Pet.SerialNum += 1 self.lockedDown = 0 self.setPickable(1) - self.setPlayerType(NametagGlobals.CCNonPlayer) + self.setPlayerType(NametagGroup.CCNonPlayer) self.animFSM = ClassicFSM('petAnimFSM', [State('off', self.enterOff, self.exitOff), State('neutral', self.enterNeutral, self.exitNeutral), State('neutralHappy', self.enterNeutralHappy, self.exitNeutralHappy), diff --git a/toontown/quest/QuestParser.py b/toontown/quest/QuestParser.py index 2773ab90..c1160f01 100755 --- a/toontown/quest/QuestParser.py +++ b/toontown/quest/QuestParser.py @@ -3,7 +3,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import * from direct.showbase import DirectObject from otp.speedchat import SpeedChatGlobals -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.suit import Suit, SuitDNA from toontown.toon import ToonHeadFrame from toontown.toonbase import TTLocalizer, ToontownBattleGlobals diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 6baf0c16..482d2043 100755 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -25,10 +25,9 @@ from toontown.battle.BattleSounds import * from toontown.catalog import CatalogNotifyDialog from toontown.chat import TTTalkAssistant from toontown.chat import ToontownChatManager -from toontown.chat.ChatGlobals import * -from toontown.chat.WhisperPopup import * +from otp.nametag.NametagConstants import * +from otp.margins.WhisperPopup import * from toontown.estate import GardenGlobals -from toontown.nametag.NametagGlobals import * from toontown.parties import PartyGlobals from toontown.quest import QuestMap from toontown.quest import QuestParser @@ -1211,12 +1210,12 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): def showGardeningGui(self): self.loadGardeningGui() self.__gardeningGui.show() - base.setCellsActive([base.leftCells[2]], 0) + base.setCellsAvailable([base.leftCells[2]], 0) def hideGardeningGui(self): if self.__gardeningGui: self.__gardeningGui.hide() - base.setCellsActive([base.leftCells[2]], 1) + base.setCellsAvailable([base.leftCells[2]], 1) def showShovelButton(self, add = 0): if add: From fa24711bc88b6c7e0cb788ea50c51ee17a23fb1a Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 24 Jun 2015 14:09:51 -0400 Subject: [PATCH 07/27] More work --- toontown/friends/FriendsListManager.py | 6 ++-- toontown/parties/PartyPlanner.py | 44 ++++++++++---------------- toontown/toon/ToonHeadFrame.py | 17 +++++----- toontown/town/Street.py | 6 ++-- 4 files changed, 31 insertions(+), 42 deletions(-) diff --git a/toontown/friends/FriendsListManager.py b/toontown/friends/FriendsListManager.py index a822c4ed..5d7e2a1b 100755 --- a/toontown/friends/FriendsListManager.py +++ b/toontown/friends/FriendsListManager.py @@ -14,7 +14,7 @@ from toontown.toonbase import ToontownGlobals from toontown.toon import Toon import FriendHandle from otp.otpbase import OTPGlobals -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class FriendsListManager: notify = DirectNotifyGlobal.directNotify.newCategory('FriendsListManager') @@ -47,7 +47,7 @@ class FriendsListManager: self.accept('openFriendsList', self.__openFriendsList) self.accept('clickedNametag', self.__handleClickedNametag) base.localAvatar.setFriendsListButtonActive(1) - NametagGlobals.setWantActiveNametags(True) + NametagGlobals.setMasterNametagsActive(1) self.accept('gotoAvatar', self.__handleGotoAvatar) self.accept('friendAvatar', self.__handleFriendAvatar) self.accept('avatarDetails', self.__handleAvatarDetails) @@ -65,7 +65,7 @@ class FriendsListManager: self.ignore('openFriendsList') self.ignore('clickedNametag') base.localAvatar.setFriendsListButtonActive(0) - NametagGlobals.setWantActiveNametags(False) + NametagGlobals.setMasterNametagsActive(0) if self.avatarPanel: self.avatarPanel.cleanup() self.avatarPanel = None diff --git a/toontown/parties/PartyPlanner.py b/toontown/parties/PartyPlanner.py index 658f27d0..90dae354 100755 --- a/toontown/parties/PartyPlanner.py +++ b/toontown/parties/PartyPlanner.py @@ -8,14 +8,12 @@ from direct.gui.DirectGui import DirectFrame, DirectButton, DirectLabel, DirectS from direct.showbase import DirectObject from direct.showbase import PythonUtil from panda3d.core import * -from pandac.PandaModules import Vec3, Vec4, Point3, TextNode, VBase4 from otp.otpbase import OTPGlobals from otp.otpbase import OTPLocalizer -from toontown.nametag.Nametag import Nametag -from toontown.nametag.NametagFloat2d import * -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagGroup import NametagGroup +from otp.nametag.NametagGroup import NametagGroup +from otp.nametag.Nametag import Nametag +from otp.nametag.NametagFloat2d import * from toontown.parties import PartyGlobals from toontown.parties import PartyUtils from toontown.parties.CalendarGuiMonth import CalendarGuiMonth @@ -278,41 +276,33 @@ class PartyPlanner(DirectFrame, FSM): def __createNametag(self, parent): if self.nametagGroup == None: self.nametagGroup = NametagGroup() - interfaceFont = OTPGlobals.getInterfaceFont() - self.nametagGroup.setFont(interfaceFont) - self.nametagGroup.setChatFont(interfaceFont) - self.nametagGroup.setActive(False) + self.nametagGroup.setFont(ToontownGlobals.getToonFont()) + self.nametagGroup.setSpeechFont(ToontownGlobals.getToonFont()) + self.nametagGroup.setActive(0) self.nametagGroup.setAvatar(self.partyPlannerHead) self.nametagGroup.manage(base.marginManager) - nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCNonPlayer] - self.nametagGroup.setNametagColor(nametagColor) - chatColor = NametagGlobals.ChatColors[NametagGlobals.CCNonPlayer] - self.nametagGroup.setChatColor(chatColor) - nametag2d = self.nametagGroup.getNametag2d() - nametag2d.hideNametag() - nametag2d.hideChat() + self.nametagGroup.setColorCode(self.nametagGroup.CCNonPlayer) + self.nametagGroup.getNametag2d().setContents(0) self.nametagNode = NametagFloat2d() - self.nametagNode.hideChat() - self.nametagGroup.add(self.nametagNode) - self.nametagGroup.setText(base.cr.partyManager.getPartyPlannerName()) + self.nametagNode.setContents(Nametag.CName) + self.nametagGroup.addNametag(self.nametagNode) + self.nametagGroup.setName(base.cr.partyManager.getPartyPlannerName()) self.nametagNP = parent.attachNewNode(self.nametagNode) nametagPos = self.gui.find('**/step_01_partymanPeteNametag_locator').getPos() self.nametagNP.setPosHprScale(nametagPos[0], 0, nametagPos[2], 0, 0, 0, 0.1, 1, 0.1) self.chatNode = NametagFloat2d() - self.chatNode.hideNametag() - self.chatNode.showThought() - self.nametagGroup.add(self.chatNode) - self.nametagGroup.setChatText(TTLocalizer.PartyPlannerInstructions) + self.chatNode.setContents(Nametag.CSpeech | Nametag.CThought) + self.nametagGroup.addNametag(self.chatNode) + self.nametagGroup.setChat(TTLocalizer.PartyPlannerInstructions, CFSpeech) self.chatNP = parent.attachNewNode(self.chatNode) chatPos = self.gui.find('**/step_01_partymanPeteText_locator').getPos() self.chatNP.setPosHprScale(chatPos[0], 0, chatPos[2], 0, 0, 0, 0.08, 1, 0.08) - self.nametagGroup.updateAll() def clearNametag(self): if self.nametagGroup != None: self.nametagGroup.unmanage(base.marginManager) - self.nametagGroup.remove(self.nametagNode) - self.nametagGroup.remove(self.chatNode) + self.nametagGroup.removeNametag(self.nametagNode) + self.nametagGroup.removeNametag(self.chatNode) self.nametagNP.removeNode() self.chatNP.removeNode() del self.nametagNP @@ -690,7 +680,7 @@ class PartyPlanner(DirectFrame, FSM): goingBackAllowed = False self.confirmTitleLabel['text'] = TTLocalizer.PartyPlannerConfirmationErrorTitle confirmRecapText = TTLocalizer.PartyPlannerConfirmationTooManyText - self.nametagGroup.setChatText(confirmRecapText) + self.nametagGroup.setChat(confirmRecapText, CFSpeech) self.request('Farewell', goingBackAllowed) def __acceptExit(self): diff --git a/toontown/toon/ToonHeadFrame.py b/toontown/toon/ToonHeadFrame.py index 902a8597..e384e97e 100755 --- a/toontown/toon/ToonHeadFrame.py +++ b/toontown/toon/ToonHeadFrame.py @@ -3,8 +3,8 @@ from panda3d.core import * import ToonHead from toontown.distributed import DelayDelete -from toontown.nametag.Nametag import Nametag -from toontown.nametag.NametagFloat2d import NametagFloat2d +from otp.nametag.Nametag import Nametag +from otp.nametag.NametagFloat2d import NametagFloat2d from toontown.toonbase import ToontownGlobals @@ -22,14 +22,13 @@ class ToonHeadFrame(DirectFrame): self.headModel.setupHead(self.av.style, forGui=1) self.headModel.reparentTo(self.head) self.tag1Node = NametagFloat2d() - self.tag1Node.hideNametag() - self.tag1Node.showThought() - self.av.nametag.add(self.tag1Node) + self.tag1Node.setContents(Nametag.CSpeech | Nametag.CThought) + self.av.nametag.addNametag(self.tag1Node) self.tag1 = self.attachNewNode(self.tag1Node) self.tag1.setPosHprScale(-0.16, 0, -0.09, 0, 0, 0, 0.055, 0.055, 0.055) self.tag2Node = NametagFloat2d() - self.tag2Node.hideChat() - self.av.nametag.add(self.tag2Node) + self.tag2Node.setContents(Nametag.CName) + self.av.nametag.addNametag(self.tag2Node) self.tag2 = self.attachNewNode(self.tag2Node) self.tag2.setPosHprScale(-0.27, 10.0, 0.16, 0, 0, 0, 0.05, 0.05, 0.05) self.extraData = DirectLabel(parent=self, relief=None, pos=(0.0, 0.0, 0.06), scale=1.0, text='', text0_fg=(0.3, 0.2, 1, 1), text_scale=(0.14, 0.06), text_pos=(0, -0.01)) @@ -42,8 +41,8 @@ class ToonHeadFrame(DirectFrame): self.head.removeNode() del self.head if not self.av.isEmpty(): - self.av.nametag.remove(self.tag1Node) - self.av.nametag.remove(self.tag2Node) + self.av.nametag.removeNametag(self.tag1Node) + self.av.nametag.removeNametag(self.tag2Node) self.tag1.removeNode() self.tag2.removeNode() del self.tag1 diff --git a/toontown/town/Street.py b/toontown/town/Street.py index 24ef2d41..9eab5e5b 100755 --- a/toontown/town/Street.py +++ b/toontown/town/Street.py @@ -19,7 +19,7 @@ from toontown.toon.Toon import teleportDebug from toontown.estate import HouseGlobals from toontown.toonbase import TTLocalizer from direct.interval.IntervalGlobal import * -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals visualizeZones = base.config.GetBool('visualize-zones', 0) @@ -104,7 +104,7 @@ class Street(BattlePlace.BattlePlace): base.localAvatar.setGeom(self.loader.geom) base.localAvatar.setOnLevelGround(1) self._telemLimiter = TLGatherAllAvs('Street', RotationLimitToH) - NametagGlobals.setWant2dNametags(arrowsOn) + NametagGlobals.setMasterArrowsOn(arrowsOn) self.zone = ZoneUtil.getBranchZone(requestStatus['zoneId']) def __lightDecorationOn__(): @@ -147,7 +147,7 @@ class Street(BattlePlace.BattlePlace): light.reparentTo(hidden) newsManager = base.cr.newsManager - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) self.loader.hood.stopSky() self.loader.music.stop() base.localAvatar.setGeom(render) From dab0ac32d54227598b650fb2e36e76d612f4596e Mon Sep 17 00:00:00 2001 From: John Cote Date: Wed, 24 Jun 2015 15:08:15 -0400 Subject: [PATCH 08/27] More nametag shit --- toontown/battle/DistributedBattle.py | 10 +++++----- toontown/battle/DistributedBattleBase.py | 8 ++++---- toontown/battle/DistributedBattleBldg.py | 12 +++++------- toontown/battle/DistributedBattleFinal.py | 5 +++-- toontown/battle/Movie.py | 6 +++--- toontown/battle/MovieNPCSOS.py | 4 ++-- toontown/battle/MovieSOS.py | 4 ++-- toontown/battle/MovieSuitAttacks.py | 5 ++--- toontown/building/ToonInterior.py | 7 ++++--- toontown/minigame/Purchase.py | 23 ++++++++++------------- toontown/toon/DistributedNPCToonBase.py | 4 ++-- 11 files changed, 42 insertions(+), 46 deletions(-) diff --git a/toontown/battle/DistributedBattle.py b/toontown/battle/DistributedBattle.py index e43dfa97..1d5dc341 100755 --- a/toontown/battle/DistributedBattle.py +++ b/toontown/battle/DistributedBattle.py @@ -7,10 +7,10 @@ from BattleBase import * import DistributedBattleBase import SuitBattleGlobals from otp.avatar import Emote -from toontown.chat.ChatGlobals import * from toontown.distributed import DelayDelete -from toontown.nametag import NametagGlobals from toontown.toonbase import ToontownBattleGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals class DistributedBattle(DistributedBattleBase.DistributedBattleBase): @@ -119,7 +119,7 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): soundTrack = Wait(delay + faceoffTime) mtrack = Parallel(suitTrack, toonTrack, soundTrack) if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) mtrack = Parallel(mtrack, camTrack) done = Func(callback) track = Sequence(mtrack, done, name=name) @@ -157,7 +157,7 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): self.delayDeleteMembers() Emote.globalEmote.disableAll(base.localAvatar, 'dbattle, enterReward') if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) if self.localToonActive() == 0: self.removeInactiveLocalToon(base.localAvatar) for toon in self.toons: @@ -188,7 +188,7 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): self.ignore('resumeAfterReward') self.movie.resetReward(finish=1) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) Emote.globalEmote.releaseAll(base.localAvatar, 'dbattle, exitReward') def enterResume(self, ts = 0): diff --git a/toontown/battle/DistributedBattleBase.py b/toontown/battle/DistributedBattleBase.py index 1ff82317..455b438c 100755 --- a/toontown/battle/DistributedBattleBase.py +++ b/toontown/battle/DistributedBattleBase.py @@ -20,7 +20,8 @@ from toontown.hood import ZoneUtil from toontown.distributed import DelayDelete from toontown.toon import TTEmote from otp.avatar import Emote -from toontown.nametag import NametagGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): @@ -1039,7 +1040,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): self.notify.debug('enterLocalToonWaitForInput()') camera.setPosHpr(self.camPos, self.camHpr) base.camLens.setMinFov(self.camMenuFov/(4./3.)) - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) self.townBattle.setState('Attack') self.accept(self.localToonBattleEvent, self.__handleLocalToonBattleEvent) @@ -1205,8 +1206,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): self.notify.debug('enterPlayMovie()') self.delayDeleteMembers() if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) - pass + NametagGlobals.setMasterArrowsOn(0) if ToontownBattleGlobals.SkipMovie: self.movie.play(ts, self.__handleMovieDone) self.movie.finish() diff --git a/toontown/battle/DistributedBattleBldg.py b/toontown/battle/DistributedBattleBldg.py index bf4bf5ab..3d00623c 100755 --- a/toontown/battle/DistributedBattleBldg.py +++ b/toontown/battle/DistributedBattleBldg.py @@ -10,9 +10,8 @@ import DistributedBattleBase import MovieUtil import SuitBattleGlobals from otp.avatar import Emote -from toontown.chat.ChatGlobals import * -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.suit import Suit from toontown.suit import SuitDNA from toontown.toon import TTEmote @@ -189,15 +188,14 @@ class DistributedBattleBldg(DistributedBattleBase.DistributedBattleBase): self.notify.debug('exitReward()') self.clearInterval(self.uniqueName('floorReward')) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) for toon in self.toons: toon.startSmooth() def enterBuildingReward(self, ts): self.delayDeleteMembers() if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) - pass + NametagGlobals.setMasterArrowsOn(0) self.movie.playReward(ts, self.uniqueName('building-reward'), self.__handleBuildingRewardDone, noSkip=True) def __handleBuildingRewardDone(self): @@ -209,7 +207,7 @@ class DistributedBattleBldg(DistributedBattleBase.DistributedBattleBase): def exitBuildingReward(self): self.movie.resetReward(finish=1) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) def enterResume(self, ts=0): if self.hasLocalToon(): diff --git a/toontown/battle/DistributedBattleFinal.py b/toontown/battle/DistributedBattleFinal.py index dd48e464..1f62eea2 100755 --- a/toontown/battle/DistributedBattleFinal.py +++ b/toontown/battle/DistributedBattleFinal.py @@ -10,7 +10,8 @@ import DistributedBattleBase import MovieUtil import SuitBattleGlobals from toontown.distributed import DelayDelete -from toontown.nametag import NametagGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.suit import Suit from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownGlobals @@ -157,7 +158,7 @@ class DistributedBattleFinal(DistributedBattleBase.DistributedBattleBase): self.notify.debug('exitReward()') self.clearInterval(self.uniqueName('floorReward'), finish=1) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) for toon in self.toons: toon.startSmooth() diff --git a/toontown/battle/Movie.py b/toontown/battle/Movie.py index 1f3b4132..a03a47c4 100755 --- a/toontown/battle/Movie.py +++ b/toontown/battle/Movie.py @@ -24,7 +24,6 @@ import MovieUtil import PlayByPlayText import RewardPanel from SuitBattleGlobals import * -from toontown.chat.ChatGlobals import * from toontown.distributed import DelayDelete from toontown.toon import NPCToons from toontown.toon import Toon @@ -32,7 +31,8 @@ from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from toontown.toonbase.ToontownBattleGlobals import * from toontown.toontowngui import TTDialog -from toontown.nametag import NametagGlobals +from otp.nametag.NametagConstants import * +from otp.nametag.NametagGroup import * camPos = Point3(14, 0, 10) @@ -342,7 +342,7 @@ class Movie(DirectObject.DirectObject): self.tutorialTom.setDNA(dna) self.tutorialTom.setName(TTLocalizer.NPCToonNames[20000]) self.tutorialTom.setPickable(0) - self.tutorialTom.setPlayerType(NametagGlobals.CCNonPlayer) + self.tutorialTom.setPlayerType(NametagGroup.CCNonPlayer) self.tutorialTom.uniqueName = uniqueName self.musicVolume = 0.9 music = base.cr.playGame.place.loader.battleMusic diff --git a/toontown/battle/MovieNPCSOS.py b/toontown/battle/MovieNPCSOS.py index 7f994dc4..47815ec5 100755 --- a/toontown/battle/MovieNPCSOS.py +++ b/toontown/battle/MovieNPCSOS.py @@ -7,8 +7,8 @@ from BattleProps import * from BattleSounds import * import MovieCamera import MovieUtil -from toontown.chat.ChatGlobals import * -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.toon import NPCToons from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals diff --git a/toontown/battle/MovieSOS.py b/toontown/battle/MovieSOS.py index 89c6dd1e..d486d85f 100755 --- a/toontown/battle/MovieSOS.py +++ b/toontown/battle/MovieSOS.py @@ -3,8 +3,8 @@ from direct.interval.IntervalGlobal import * from panda3d.core import * import MovieCamera -from toontown.chat.ChatGlobals import * -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.toonbase import TTLocalizer diff --git a/toontown/battle/MovieSuitAttacks.py b/toontown/battle/MovieSuitAttacks.py index 3d3c6451..e1b5aca0 100755 --- a/toontown/battle/MovieSuitAttacks.py +++ b/toontown/battle/MovieSuitAttacks.py @@ -10,9 +10,8 @@ from BattleSounds import * import MovieCamera import MovieUtil from SuitBattleGlobals import * -from toontown.chat.ChatGlobals import * -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.suit.SuitDNA import * from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals diff --git a/toontown/building/ToonInterior.py b/toontown/building/ToonInterior.py index 85831059..75de4494 100755 --- a/toontown/building/ToonInterior.py +++ b/toontown/building/ToonInterior.py @@ -9,7 +9,8 @@ import DistributedToonInterior from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs from toontown.hood import Place from toontown.hood import ZoneUtil -from toontown.nametag import NametagGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.toon import HealthForceAcknowledge from toontown.toon import NPCForceAcknowledge from toontown.toonbase import TTLocalizer @@ -92,7 +93,7 @@ class ToonInterior(Place.Place): volume = requestStatus.get('musicVolume', 0.7) base.playMusic(self.loader.activityMusic, looping=1, volume=volume) self._telemLimiter = TLGatherAllAvs('ToonInterior', RotationLimitToH) - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.fsm.request(requestStatus['how'], [requestStatus]) def exit(self): @@ -100,7 +101,7 @@ class ToonInterior(Place.Place): messenger.send('exitToonInterior') self._telemLimiter.destroy() del self._telemLimiter - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) self.loader.activityMusic.stop() def setState(self, state): diff --git a/toontown/minigame/Purchase.py b/toontown/minigame/Purchase.py index 47d859a2..7d3f0211 100755 --- a/toontown/minigame/Purchase.py +++ b/toontown/minigame/Purchase.py @@ -6,8 +6,8 @@ from direct.task.Task import Task import MinigameGlobals from PurchaseBase import * from toontown.distributed import DelayDelete -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagFloat2d import * +from otp.nametag.NametagFloat2d import * +from otp.nametag import NametagGlobals from toontown.toon import ToonHead from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownTimer @@ -304,7 +304,7 @@ class Purchase(PurchaseBase): floorNode = CollisionNode('collision_floor') floorNode.addSolid(floor) self.collisionFloor = render.attachNewNode(floorNode) - NametagGlobals.setForceOnscreenChat(True) + NametagGlobals.setOnscreenChatForced(1) for index in xrange(len(self.ids)): avId = self.ids[index] if self.states[index] != PURCHASE_NO_CLIENT_STATE and self.states[index] != PURCHASE_DISCONNECTED_STATE and avId in base.cr.doId2do: @@ -511,7 +511,7 @@ class Purchase(PurchaseBase): self.title.reparentTo(self.frame) self.rewardDoubledJellybeanLabel.hide() base.camLens.setMinFov(settings['fov']/(4./3.)) - NametagGlobals.setForceOnscreenChat(False) + NametagGlobals.setOnscreenChatForced(0) def _handleClientCleanup(self): if hasattr(self, 'toonsKeep'): @@ -626,16 +626,13 @@ class PurchaseHeadFrame(DirectFrame): self.headModel.setupHead(self.av.style, forGui=1) self.headModel.reparentTo(self.head) self.tag2Node = NametagFloat2d() - self.tag2Node.hideChat() - self.tag2Node.hideThought() - self.tag2Node.update() - self.av.nametag.add(self.tag2Node) + self.tag2Node.setContents(Nametag.CName) + self.av.nametag.addNametag(self.tag2Node) self.tag2 = self.attachNewNode(self.tag2Node) self.tag2.setPosHprScale(-0.22, 10.0, 0.12, 0, 0, 0, 0.046, 0.046, 0.046) self.tag1Node = NametagFloat2d() - self.tag1Node.hideNametag() - self.tag1Node.update() - self.av.nametag.add(self.tag1Node) + self.tag1Node.setContents(Nametag.CSpeech | Nametag.CThought) + self.av.nametag.addNametag(self.tag1Node) self.tag1 = self.attachNewNode(self.tag1Node) self.tag1.setPosHprScale(-0.15, 0, -0.1, 0, 0, 0, 0.046, 0.046, 0.046) self.hide() @@ -647,8 +644,8 @@ class PurchaseHeadFrame(DirectFrame): del self.headModel self.head.removeNode() del self.head - self.av.nametag.remove(self.tag1Node) - self.av.nametag.remove(self.tag2Node) + self.av.nametag.removeNametag(self.tag1Node) + self.av.nametag.removeNametag(self.tag2Node) self.tag1.removeNode() self.tag2.removeNode() del self.tag1 diff --git a/toontown/toon/DistributedNPCToonBase.py b/toontown/toon/DistributedNPCToonBase.py index f62abcf7..1c5c7e6d 100755 --- a/toontown/toon/DistributedNPCToonBase.py +++ b/toontown/toon/DistributedNPCToonBase.py @@ -9,7 +9,7 @@ import random import DistributedToon import NPCToons -from toontown.nametag import NametagGlobals +from otp.nametag.NametagGroup import NametagGroup from toontown.quest import QuestChoiceGui from toontown.quest import QuestParser from toontown.quest import Quests @@ -26,7 +26,7 @@ class DistributedNPCToonBase(DistributedToon.DistributedToon): DistributedToon.DistributedToon.__init__(self, cr) self.__initCollisions() self.setPickable(0) - self.setPlayerType(NametagGlobals.CCNonPlayer) + self.setPlayerType(NametagGroup.CCNonPlayer) def disable(self): self.ignore('enter' + self.cSphereNode.getName()) From e8a57d72510d53c5c5f82cab0cdcd6ccf4c0e461 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 25 Jun 2015 14:51:27 -0400 Subject: [PATCH 09/27] More work --- toontown/battle/MovieToonVictory.py | 7 ++++--- toontown/building/DistributedDoor.py | 20 +++++++++---------- toontown/building/DistributedElevatorExt.py | 17 +++++++--------- .../building/DistributedKnockKnockDoor.py | 19 ++++++++---------- 4 files changed, 28 insertions(+), 35 deletions(-) diff --git a/toontown/battle/MovieToonVictory.py b/toontown/battle/MovieToonVictory.py index 4ba695c5..e4998bd4 100755 --- a/toontown/battle/MovieToonVictory.py +++ b/toontown/battle/MovieToonVictory.py @@ -6,7 +6,8 @@ import MovieCamera from direct.directnotify import DirectNotifyGlobal import types notify = DirectNotifyGlobal.directNotify.newCategory('MovieToonVictory') -from toontown.nametag import NametagGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals def __findToonReward(rewards, toon): for r in rewards: @@ -76,7 +77,7 @@ def doToonVictory(localToonActive, toons, rewardToonIds, rewardDicts, deathList, track = Sequence() if localToonActive == 1: track.append(Func(rpanel.show)) - track.append(Func(NametagGlobals.setForceOnscreenChat, True)) + track.append(Func(NametagGlobals.setOnscreenChatForced, 1)) camTrack = Sequence() endTrack = Sequence() danceSound = globalBattleSoundCache.getSound('ENC_Win.ogg') @@ -121,7 +122,7 @@ def doToonVictory(localToonActive, toons, rewardToonIds, rewardDicts, deathList, track.append(Func(skipper.destroy)) if localToonActive == 1: track.append(Func(rpanel.hide)) - track.append(Func(NametagGlobals.setForceOnscreenChat, False)) + track.append(Func(NametagGlobals.setOnscreenChatForced, 0)) track.append(endTrack) trackdur = track.getDuration() soundTrack = SoundInterval(danceSound, duration=trackdur, loop=1) diff --git a/toontown/building/DistributedDoor.py b/toontown/building/DistributedDoor.py index a8957f4e..8153ffa8 100755 --- a/toontown/building/DistributedDoor.py +++ b/toontown/building/DistributedDoor.py @@ -13,8 +13,8 @@ from toontown.hood import ZoneUtil from toontown.suit import Suit from toontown.toonbase.ToonBaseGlobal import * from toontown.toontowngui import TTDialog -from toontown.nametag.NametagGroup import NametagGroup -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagGroup import NametagGroup +from otp.nametag.Nametag import Nametag class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): @@ -105,25 +105,23 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): return if self.nametag == None: self.nametag = NametagGroup() - self.nametag.setNametag3d(None) self.nametag.setFont(ToontownGlobals.getBuildingNametagFont()) if TTLocalizer.BuildingNametagShadow: self.nametag.setShadow(*TTLocalizer.BuildingNametagShadow) - self.nametag.hideChat() - self.nametag.hideThought() - nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCToonBuilding] - self.nametag.setNametagColor(nametagColor) - self.nametag.setActive(False) + self.nametag.setContents(Nametag.CName) + self.nametag.setColorCode(NametagGroup.CCToonBuilding) + self.nametag.setActive(0) self.nametag.setAvatar(self.getDoorNodePath()) - name = self.cr.playGame.dnaStore.getTitleFromBlockNumber(self.block) - self.nametag.setText(name) + self.nametag.setObjectCode(self.block) + name = self.cr.playGame.dnaData.getBlock(self.block).title + self.nametag.setName(name) self.nametag.manage(base.marginManager) - self.nametag.updateAll() def clearNametag(self): if self.nametag is not None: self.nametag.unmanage(base.marginManager) self.nametag.setAvatar(NodePath()) + self.nametag.destroy() self.nametag = None def getTriggerName(self): diff --git a/toontown/building/DistributedElevatorExt.py b/toontown/building/DistributedElevatorExt.py index 513ea146..ad33cfa2 100755 --- a/toontown/building/DistributedElevatorExt.py +++ b/toontown/building/DistributedElevatorExt.py @@ -9,9 +9,9 @@ import DistributedElevator from ElevatorConstants import * from ElevatorUtils import * from toontown.hood import ZoneUtil -from toontown.nametag import NametagGlobals -from toontown.nametag.Nametag import Nametag -from toontown.nametag.NametagGroup import NametagGroup +from otp.nametag.NametagGroup import NametagGroup +from otp.nametag.Nametag import Nametag +from otp.nametag.NametagConstants import * from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals @@ -41,20 +41,17 @@ class DistributedElevatorExt(DistributedElevator.DistributedElevator): self.nametag.setFont(ToontownGlobals.getBuildingNametagFont()) if TTLocalizer.BuildingNametagShadow: self.nametag.setShadow(*TTLocalizer.BuildingNametagShadow) - self.nametag.hideChat() - self.nametag.hideThought() - nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCSuitBuilding] - self.nametag.setNametagColor(nametagColor) - self.nametag.setActive(False) + self.nametag.setContents(Nametag.CName) + self.nametag.setColorCode(NametagGroup.CCSuitBuilding) + self.nametag.setActive(0) self.nametag.setAvatar(self.getElevatorModel()) name = self.cr.playGame.dnaStore.getTitleFromBlockNumber(self.bldg.block) if not name: name = TTLocalizer.CogsInc else: name += TTLocalizer.CogsIncExt - self.nametag.setText(name) + self.nametag.setName(name) self.nametag.manage(base.marginManager) - self.nametag.updateAll() def clearNametag(self): if self.nametag != None: diff --git a/toontown/building/DistributedKnockKnockDoor.py b/toontown/building/DistributedKnockKnockDoor.py index c654d7af..04beea88 100755 --- a/toontown/building/DistributedKnockKnockDoor.py +++ b/toontown/building/DistributedKnockKnockDoor.py @@ -5,12 +5,11 @@ from panda3d.core import * import DistributedAnimatedProp from KnockKnockJokes import * -from toontown.chat.ChatGlobals import * from toontown.distributed import DelayDelete -from toontown.nametag.NametagGlobals import * -from toontown.nametag.NametagGroup import NametagGroup from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals +from otp.nametag.NametagGroup import NametagGroup +from otp.nametag.NametagConstants import * import random class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp): @@ -76,21 +75,19 @@ class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp) return self.nametag = NametagGroup() self.nametag.setAvatar(doorNP) - toonFont = ToontownGlobals.getToonFont() - self.nametag.setFont(toonFont) - self.nametag.setChatFont(toonFont) - self.nametag.setText(doorName) - self.nametag.setActive(False) - self.nametag.hideNametag() + self.nametag.setFont(ToontownGlobals.getToonFont()) + self.nametag.setSpeechFont(ToontownGlobals.getToonFont()) + self.nametag.setName(doorName) + self.nametag.setActive(0) self.nametag.manage(base.marginManager) - self.nametag.getNametag3d().setBillboardOffset(6) + self.nametag.getNametag3d().setBillboardOffset(4) nametagNode = self.nametag.getNametag3d() self.nametagNP = render.attachNewNode(nametagNode) self.nametagNP.setName('knockKnockDoor_nt_' + str(self.propId)) pos = doorNP.getBounds().getCenter() self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2)) d = duration * 0.125 - track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChatText, TTLocalizer.DoorKnockKnock), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[0]), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[1]), Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4)), Func(self.cleanupTrack)) + track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChat, TTLocalizer.DoorKnockKnock, CFSpeech), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChat, joke[0], CFSpeech), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChat, joke[1], CFSpeech), Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4)), Func(self.cleanupTrack)) track.delayDelete = DelayDelete.DelayDelete(avatar, 'knockKnockTrack') return track From 7cf799814c837000957212bee112f6ab89f817d8 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 25 Jun 2015 19:38:35 -0400 Subject: [PATCH 10/27] Deprecate CatalogChatBalloon and edit CatalogScreen for new tags --- toontown/catalog/CatalogChatBalloon.py | 93 -------------------------- toontown/catalog/CatalogScreen.py | 10 +-- 2 files changed, 5 insertions(+), 98 deletions(-) delete mode 100755 toontown/catalog/CatalogChatBalloon.py diff --git a/toontown/catalog/CatalogChatBalloon.py b/toontown/catalog/CatalogChatBalloon.py deleted file mode 100755 index c162ef43..00000000 --- a/toontown/catalog/CatalogChatBalloon.py +++ /dev/null @@ -1,93 +0,0 @@ -from panda3d.core import * - -class CatalogChatBalloon: - TEXT_SHIFT = (0.1, -0.05, 1.1) - TEXT_SHIFT_REVERSED = -0.05 - TEXT_SHIFT_PROP = 0.08 - NATIVE_WIDTH = 10.0 - MIN_WIDTH = 2.5 - MIN_HEIGHT = 1 - BUBBLE_PADDING = 0.3 - BUBBLE_PADDING_PROP = 0.05 - BUTTON_SCALE = 6 - BUTTON_SHIFT = (-0.2, 0, 0.6) - FRAME_SHIFT = (0.2, 1.4) - - def __init__(self, model): - self.model = model - - def generate(self, text, font, textColor=(0,0,0,1), balloonColor=(1,1,1,1), - wordWrap = 10.0, button=None, reversed=False): - root = NodePath('balloon') - - # Add balloon geometry: - balloon = self.model.copyTo(root) - top = balloon.find('**/top') - middle = balloon.find('**/middle') - bottom = balloon.find('**/bottom') - - balloon.setColor(balloonColor) - if balloonColor[3] < 1.0: - balloon.setTransparency(1) - - # Render the text into a TextNode, using the font: - t = root.attachNewNode(TextNode('text')) - t.node().setFont(font) - t.node().setWordwrap(wordWrap) - t.node().setText(text) - t.node().setTextColor(textColor) - - width, height = t.node().getWidth(), t.node().getHeight() - - # Turn off depth write for the text: The place in the depth buffer is - # held by the chat bubble anyway, and the text renders after the bubble - # so there's no risk of the bubble overwriting the text's pixels. - t.setAttrib(DepthWriteAttrib.make(0)) - t.setPos(self.TEXT_SHIFT) - t.setX(t, self.TEXT_SHIFT_PROP*width) - t.setZ(t, height) - - if reversed: - # The nametag code wants the text on the left side of the axis, - # rather than on the right side. Therefore, we move the text to the - # opposite side: - t.setX(self.TEXT_SHIFT_REVERSED - self.TEXT_SHIFT_PROP*width - width) - - # Give the chat bubble a button, if one is requested: - if button: - np = button.copyTo(root) - np.setPos(t, width, 0, -height) - np.setPos(np, self.BUTTON_SHIFT) - np.setScale(self.BUTTON_SCALE) - - # Set a minimum width and height for short or empty messages - if width < self.MIN_WIDTH: - width = self.MIN_WIDTH - if reversed: - t.setX(t, -width/2.0) - else: - t.setX(t, width/2.0) - t.node().setAlign(TextNode.ACenter) - - if height < self.MIN_HEIGHT: - height = self.MIN_HEIGHT - t.setX(t, height/2.0) - t.node().setAlign(TextNode.ACenter) - - # Set the balloon's size: - width *= 1+self.BUBBLE_PADDING_PROP - width += self.BUBBLE_PADDING - balloon.setSx(width/self.NATIVE_WIDTH) - if reversed: - balloon.setSx(-balloon.getSx()) - balloon.setTwoSided(True) # Render the backface of the balloon - middle.setSz(height) - top.setZ(top, height-1) - - # Calculate the frame occupied by the balloon: - left, bottom = self.FRAME_SHIFT - if reversed: - left = -left - width - frame = (left, left+width, bottom, bottom+height+1) - - return root, frame diff --git a/toontown/catalog/CatalogScreen.py b/toontown/catalog/CatalogScreen.py index afc1654f..275512d5 100755 --- a/toontown/catalog/CatalogScreen.py +++ b/toontown/catalog/CatalogScreen.py @@ -14,8 +14,8 @@ from direct.actor import Actor import random from toontown.toon import DistributedToon from direct.directnotify import DirectNotifyGlobal -from toontown.nametag import NametagGlobals -import CatalogChatBalloon +from otp.nametag.ChatBalloon import ChatBalloon +from otp.nametag import NametagGroup NUM_CATALOG_ROWS = 3 NUM_CATALOG_COLS = 2 @@ -971,13 +971,13 @@ class CatalogScreen(DirectFrame): if not self.clarabelleChatBalloon: self.clarabelleChatBalloon = loader.loadModel('phase_3/models/props/chatbox') - - self.clarabelleChat = CatalogChatBalloon.CatalogChatBalloon(self.clarabelleChatBalloon) + + self.clarabelleChat = ChatBalloon(self.clarabelleChatBalloon) 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: taskMgr.doMethodLater(timeout, self.clearClarabelleChat, 'clearClarabelleChat') From 46cb2afda68c80e88b125669f89379d0aee122c5 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 25 Jun 2015 21:10:16 -0400 Subject: [PATCH 11/27] This is really getting boring... --- toontown/cogdominium/DistributedCogdoInterior.py | 3 +-- toontown/coghq/CogHQBossBattle.py | 6 +++--- toontown/coghq/CogHQExterior.py | 4 ++-- toontown/coghq/CountryClubInterior.py | 7 +++---- toontown/coghq/DistributedBattleFactory.py | 7 ++++--- toontown/coghq/DistributedCashbotBossCrane.py | 6 +++--- toontown/coghq/DistributedCountryClubBattle.py | 6 +++--- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/toontown/cogdominium/DistributedCogdoInterior.py b/toontown/cogdominium/DistributedCogdoInterior.py index 28865f33..6925340f 100755 --- a/toontown/cogdominium/DistributedCogdoInterior.py +++ b/toontown/cogdominium/DistributedCogdoInterior.py @@ -31,8 +31,7 @@ PAINTING_DICT = {'s': 'tt_m_ara_crg_paintingMoverShaker', 'm': 'tt_m_ara_crg_paintingMoverShaker', 'c': 'tt_m_ara_crg_paintingMoverShaker'} -from toontown.nametag.NametagGlobals import * -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * class DistributedCogdoInterior(DistributedObject.DistributedObject): id = 0 diff --git a/toontown/coghq/CogHQBossBattle.py b/toontown/coghq/CogHQBossBattle.py index 233203eb..d9de04a7 100755 --- a/toontown/coghq/CogHQBossBattle.py +++ b/toontown/coghq/CogHQBossBattle.py @@ -9,8 +9,8 @@ from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals from toontown.battle import BattlePlace from toontown.suit import Suit -from toontown.nametag.NametagGlobals import * -from toontown.nametag import NametagGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals import math class CogHQBossBattle(BattlePlace.BattlePlace): @@ -109,7 +109,7 @@ class CogHQBossBattle(BattlePlace.BattlePlace): if self.bossCog: self.bossCog.d_avatarEnter() self._telemLimiter = TLGatherAllAvs('CogHQBossBattle', RotationLimitToH) - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) base.localAvatar.inventory.setRespectInvasions(0) self.fsm.request(requestStatus['how'], [requestStatus]) diff --git a/toontown/coghq/CogHQExterior.py b/toontown/coghq/CogHQExterior.py index 9db9976b..4e186469 100755 --- a/toontown/coghq/CogHQExterior.py +++ b/toontown/coghq/CogHQExterior.py @@ -5,7 +5,7 @@ from direct.fsm import State from toontown.toonbase import ToontownGlobals from panda3d.core import * from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class CogHQExterior(BattlePlace.BattlePlace): notify = DirectNotifyGlobal.directNotify.newCategory('CogHQExterior') @@ -69,7 +69,7 @@ class CogHQExterior(BattlePlace.BattlePlace): self._telemLimiter = TLGatherAllAvs('CogHQExterior', RotationLimitToH) self.accept('doorDoneEvent', self.handleDoorDoneEvent) self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger) - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.nodeList) how = requestStatus['how'] self.fsm.request(how, [requestStatus]) diff --git a/toontown/coghq/CountryClubInterior.py b/toontown/coghq/CountryClubInterior.py index ced2378e..37833f7e 100755 --- a/toontown/coghq/CountryClubInterior.py +++ b/toontown/coghq/CountryClubInterior.py @@ -5,7 +5,6 @@ from direct.fsm import State from direct.showbase import BulletinBoardWatcher from panda3d.core import * from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs -from toontown.nametag import NametagGlobals from toontown.toon import Toon from toontown.toonbase import ToontownGlobals from toontown.hood import ZoneUtil @@ -14,7 +13,7 @@ from toontown.toontowngui import TTDialog from toontown.toonbase import ToontownBattleGlobals from toontown.coghq import DistributedCountryClub from toontown.building import Elevator -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals import random class CountryClubInterior(BattlePlace.BattlePlace): @@ -87,7 +86,7 @@ class CountryClubInterior(BattlePlace.BattlePlace): self._telemLimiter = TLGatherAllAvs('CountryClubInterior', RotationLimitToH) def commence(self = self): - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.fsm.request(requestStatus['how'], [requestStatus]) base.playMusic(self.music, looping=1, volume=0.8) base.transitions.irisIn() @@ -107,7 +106,7 @@ class CountryClubInterior(BattlePlace.BattlePlace): self.acceptOnce('localToonConfrontedCountryClubBoss', handleConfrontedBoss) def exit(self): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) bboard.remove(DistributedCountryClub.DistributedCountryClub.ReadyPost) self._telemLimiter.destroy() del self._telemLimiter diff --git a/toontown/coghq/DistributedBattleFactory.py b/toontown/coghq/DistributedBattleFactory.py index 0bd2e0c7..1396bccb 100755 --- a/toontown/coghq/DistributedBattleFactory.py +++ b/toontown/coghq/DistributedBattleFactory.py @@ -11,7 +11,8 @@ from toontown.suit import SuitDNA from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.toonbase import ToontownGlobals -from toontown.nametag import NametagGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals class DistributedBattleFactory(DistributedLevelBattle.DistributedLevelBattle): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBattleFactory') @@ -29,7 +30,7 @@ class DistributedBattleFactory(DistributedLevelBattle.DistributedLevelBattle): self.disableCollision() self.delayDeleteMembers() if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) if self.bossBattle: messenger.send('localToonConfrontedForeman') self.movie.playReward(ts, self.uniqueName('building-reward'), self.__handleFactoryRewardDone, noSkip=True) @@ -45,4 +46,4 @@ class DistributedBattleFactory(DistributedLevelBattle.DistributedLevelBattle): self.notify.info('exitFactoryReward()') self.movie.resetReward(finish=1) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) diff --git a/toontown/coghq/DistributedCashbotBossCrane.py b/toontown/coghq/DistributedCashbotBossCrane.py index f9e20d7c..21dfdc33 100755 --- a/toontown/coghq/DistributedCashbotBossCrane.py +++ b/toontown/coghq/DistributedCashbotBossCrane.py @@ -10,8 +10,8 @@ from direct.task import Task from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from otp.otpbase import OTPGlobals +from otp.nametag import NametagGlobals import random -from toontown.nametag import NametagGlobals class DistributedCashbotBossCrane(DistributedObject.DistributedObject, FSM.FSM): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCashbotBossCrane') @@ -407,7 +407,7 @@ class DistributedCashbotBossCrane(DistributedObject.DistributedObject, FSM.FSM): taskMgr.add(self.__watchControls, 'watchCraneControls') taskMgr.doMethodLater(5, self.__displayCraneAdvice, self.craneAdviceName) taskMgr.doMethodLater(10, self.__displayMagnetAdvice, self.magnetAdviceName) - NametagGlobals.setForceOnscreenChat(True) + NametagGlobals.setOnscreenChatForced(1) self.arrowVert = 0 self.arrowHorz = 0 return @@ -428,7 +428,7 @@ class DistributedCashbotBossCrane(DistributedObject.DistributedObject, FSM.FSM): self.ignore('InputState-turnRight') self.arrowVert = 0 self.arrowHorz = 0 - NametagGlobals.setForceOnscreenChat(False) + NametagGlobals.setOnscreenChatForced(0) taskMgr.remove('watchCraneControls') self.__setMoveSound(None) return diff --git a/toontown/coghq/DistributedCountryClubBattle.py b/toontown/coghq/DistributedCountryClubBattle.py index 81597846..68d99544 100755 --- a/toontown/coghq/DistributedCountryClubBattle.py +++ b/toontown/coghq/DistributedCountryClubBattle.py @@ -5,7 +5,7 @@ from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.interval.IntervalGlobal import * from otp.avatar import Emote -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals from panda3d.core import * from toontown.battle import SuitBattleGlobals from toontown.battle.BattleBase import * @@ -31,7 +31,7 @@ class DistributedCountryClubBattle(DistributedLevelBattle.DistributedLevelBattle self.disableCollision() self.delayDeleteMembers() if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) if self.bossBattle: messenger.send('localToonConfrontedCountryClubBoss') self.movie.playReward(ts, self.uniqueName('building-reward'), self.__handleCountryClubRewardDone, noSkip=True) @@ -47,4 +47,4 @@ class DistributedCountryClubBattle(DistributedLevelBattle.DistributedLevelBattle self.notify.debug('exitCountryClubReward()') self.movie.resetReward(finish=1) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) From d109dd2a1604a85489bc48e0edade243dccf7190 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 25 Jun 2015 22:12:22 -0400 Subject: [PATCH 12/27] toontown\coghq is fully converted --- toontown/coghq/DistributedCountryClubRoom.py | 1 - toontown/coghq/DistributedFactory.py | 2 -- toontown/coghq/DistributedLawbotCannon.py | 6 +++--- toontown/coghq/DistributedLevelBattle.py | 9 ++++----- toontown/coghq/DistributedMintBattle.py | 6 +++--- toontown/coghq/DistributedMintRoom.py | 1 - toontown/coghq/DistributedStageBattle.py | 6 +++--- toontown/coghq/DistributedStageRoom.py | 1 - toontown/coghq/FactoryExterior.py | 4 ++-- toontown/coghq/FactoryInterior.py | 7 ++++--- toontown/coghq/MintInterior.py | 6 +++--- toontown/coghq/StageInterior.py | 6 +++--- 12 files changed, 25 insertions(+), 30 deletions(-) diff --git a/toontown/coghq/DistributedCountryClubRoom.py b/toontown/coghq/DistributedCountryClubRoom.py index 543159a8..91bdd4d5 100755 --- a/toontown/coghq/DistributedCountryClubRoom.py +++ b/toontown/coghq/DistributedCountryClubRoom.py @@ -10,7 +10,6 @@ import FactoryEntityCreator import CountryClubRoomSpecs from otp.level import LevelSpec, LevelConstants from toontown.toonbase import TTLocalizer -from toontown.nametag.NametagGlobals import * def getCountryClubRoomReadyPostName(doId): return 'countryClubRoomReady-%s' % doId diff --git a/toontown/coghq/DistributedFactory.py b/toontown/coghq/DistributedFactory.py index 92f04b22..d8dfd3d3 100755 --- a/toontown/coghq/DistributedFactory.py +++ b/toontown/coghq/DistributedFactory.py @@ -14,8 +14,6 @@ from toontown.toonbase import TTLocalizer from toontown.coghq import FactoryCameraViews from direct.controls.ControlManager import CollisionHandlerRayStart from otp.ai.MagicWordGlobal import * -from toontown.nametag.NametagGlobals import * -from toontown.chat.ChatGlobals import CFThought, CFTimeout class DistributedFactory(DistributedLevel.DistributedLevel, FactoryBase.FactoryBase): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedFactory') diff --git a/toontown/coghq/DistributedLawbotCannon.py b/toontown/coghq/DistributedLawbotCannon.py index e97a5d66..11d0e6d3 100755 --- a/toontown/coghq/DistributedLawbotCannon.py +++ b/toontown/coghq/DistributedLawbotCannon.py @@ -7,7 +7,7 @@ from pandac.PandaModules import CollisionSphere, CollisionNode from toontown.toonbase import ToontownGlobals from toontown.estate import DistributedCannon from toontown.estate import CannonGlobals -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals from direct.gui.DirectGui import * from panda3d.core import * from toontown.toon import NPCToons @@ -253,7 +253,7 @@ class DistributedLawbotCannon(DistributedObject.DistributedObject): def __makeGui(self): if self.madeGui: return - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) guiModel = 'phase_4/models/gui/cannon_game_gui' cannonGui = loader.loadModel(guiModel) self.aimPad = DirectFrame(image=cannonGui.find('**/CannonFire_PAD'), relief=None, pos=(0.7, 0, -0.553333), scale=0.8) @@ -297,7 +297,7 @@ class DistributedLawbotCannon(DistributedObject.DistributedObject): if self.flashingLabel: self.flashingLabel.finish() self.flashingLabel = None - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.__disableAimInterface() self.upButton.unbind(DGG.B1PRESS) self.upButton.unbind(DGG.B1RELEASE) diff --git a/toontown/coghq/DistributedLevelBattle.py b/toontown/coghq/DistributedLevelBattle.py index 5a1ff8cb..ad1d758e 100755 --- a/toontown/coghq/DistributedLevelBattle.py +++ b/toontown/coghq/DistributedLevelBattle.py @@ -9,9 +9,8 @@ from otp.avatar import Emote from toontown.battle import DistributedBattle from toontown.battle import SuitBattleGlobals from toontown.battle.BattleBase import * -from toontown.chat.ChatGlobals import * -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.suit import SuitDNA from toontown.toon import TTEmote from toontown.toonbase import ToontownGlobals @@ -179,7 +178,7 @@ class DistributedLevelBattle(DistributedBattle.DistributedBattle): camTrack.append(Func(camera.lookAt, suit)) mtrack = Parallel(suitTrack, toonTrack) if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) mtrack = Parallel(mtrack, camTrack) done = Func(callback) track = Sequence(mtrack, done, name=name) @@ -229,6 +228,6 @@ class DistributedLevelBattle(DistributedBattle.DistributedBattle): self.notify.info('exitReward()') self.clearInterval(self.uniqueName('floorReward')) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) for toon in self.toons: toon.startSmooth() diff --git a/toontown/coghq/DistributedMintBattle.py b/toontown/coghq/DistributedMintBattle.py index b8b6ae99..24300f82 100755 --- a/toontown/coghq/DistributedMintBattle.py +++ b/toontown/coghq/DistributedMintBattle.py @@ -11,7 +11,7 @@ from toontown.suit import SuitDNA from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.toonbase import ToontownGlobals -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class DistributedMintBattle(DistributedLevelBattle.DistributedLevelBattle): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedMintBattle') @@ -29,7 +29,7 @@ class DistributedMintBattle(DistributedLevelBattle.DistributedLevelBattle): self.disableCollision() self.delayDeleteMembers() if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) if self.bossBattle: messenger.send('localToonConfrontedMintBoss') self.movie.playReward(ts, self.uniqueName('building-reward'), self.__handleMintRewardDone, noSkip=True) @@ -45,4 +45,4 @@ class DistributedMintBattle(DistributedLevelBattle.DistributedLevelBattle): self.notify.debug('exitMintReward()') self.movie.resetReward(finish=1) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) diff --git a/toontown/coghq/DistributedMintRoom.py b/toontown/coghq/DistributedMintRoom.py index b69311ab..d0ed277d 100755 --- a/toontown/coghq/DistributedMintRoom.py +++ b/toontown/coghq/DistributedMintRoom.py @@ -9,7 +9,6 @@ import MintRoomBase, MintRoom import MintRoomSpecs from otp.level import DistributedLevel from otp.level import LevelSpec, LevelConstants -from toontown.nametag.NametagGlobals import * from toontown.toonbase import TTLocalizer from toontown.toonbase.ToontownGlobals import * diff --git a/toontown/coghq/DistributedStageBattle.py b/toontown/coghq/DistributedStageBattle.py index d98b82e5..178c2edc 100755 --- a/toontown/coghq/DistributedStageBattle.py +++ b/toontown/coghq/DistributedStageBattle.py @@ -11,7 +11,7 @@ from toontown.suit import SuitDNA from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.toonbase import ToontownGlobals -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class DistributedStageBattle(DistributedLevelBattle.DistributedLevelBattle): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedStageBattle') @@ -29,7 +29,7 @@ class DistributedStageBattle(DistributedLevelBattle.DistributedLevelBattle): self.disableCollision() self.delayDeleteMembers() if self.hasLocalToon(): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) if self.bossBattle: messenger.send('localToonConfrontedStageBoss') self.movie.playReward(ts, self.uniqueName('building-reward'), self.__handleStageRewardDone, noSkip=True) @@ -45,4 +45,4 @@ class DistributedStageBattle(DistributedLevelBattle.DistributedLevelBattle): self.notify.debug('exitStageReward()') self.movie.resetReward(finish=1) self._removeMembersKeep() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) diff --git a/toontown/coghq/DistributedStageRoom.py b/toontown/coghq/DistributedStageRoom.py index 4f2a142c..6077525a 100755 --- a/toontown/coghq/DistributedStageRoom.py +++ b/toontown/coghq/DistributedStageRoom.py @@ -10,7 +10,6 @@ import FactoryEntityCreator import StageRoomSpecs from otp.level import LevelSpec, LevelConstants from toontown.toonbase import TTLocalizer -from toontown.nametag.NametagGlobals import * def getStageRoomReadyPostName(doId): return 'stageRoomReady-%s' % doId diff --git a/toontown/coghq/FactoryExterior.py b/toontown/coghq/FactoryExterior.py index 1a27c647..f29269ec 100755 --- a/toontown/coghq/FactoryExterior.py +++ b/toontown/coghq/FactoryExterior.py @@ -2,7 +2,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals from panda3d.core import * from toontown.battle import BattlePlace from toontown.building import Elevator @@ -93,7 +93,7 @@ class FactoryExterior(BattlePlace.BattlePlace): self._telemLimiter = TLGatherAllAvs('FactoryExterior', RotationLimitToH) self.accept('doorDoneEvent', self.handleDoorDoneEvent) self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger) - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.nodeList) how = requestStatus['how'] self.fsm.request(how, [requestStatus]) diff --git a/toontown/coghq/FactoryInterior.py b/toontown/coghq/FactoryInterior.py index 35740dd7..0a1b9eee 100755 --- a/toontown/coghq/FactoryInterior.py +++ b/toontown/coghq/FactoryInterior.py @@ -11,7 +11,8 @@ from toontown.toonbase import TTLocalizer from toontown.toontowngui import TTDialog from toontown.toonbase import ToontownBattleGlobals from toontown.building import Elevator -from toontown.nametag import NametagGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals class FactoryInterior(BattlePlace.BattlePlace): notify = DirectNotifyGlobal.directNotify.newCategory('FactoryInterior') @@ -79,7 +80,7 @@ class FactoryInterior(BattlePlace.BattlePlace): self._telemLimiter = TLGatherAllAvs('FactoryInterior', RotationLimitToH) def commence(self = self): - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.fsm.request(requestStatus['how'], [requestStatus]) base.playMusic(self.music, looping=1, volume=0.8) base.transitions.irisIn() @@ -100,7 +101,7 @@ class FactoryInterior(BattlePlace.BattlePlace): self.acceptOnce('localToonConfrontedForeman', handleConfrontedForeman) def exit(self): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) self._telemLimiter.destroy() del self._telemLimiter if hasattr(base, 'factoryReady'): diff --git a/toontown/coghq/MintInterior.py b/toontown/coghq/MintInterior.py index 045ce387..80157cfb 100755 --- a/toontown/coghq/MintInterior.py +++ b/toontown/coghq/MintInterior.py @@ -12,7 +12,7 @@ from toontown.toonbase import TTLocalizer from toontown.toontowngui import TTDialog from toontown.toonbase import ToontownBattleGlobals from toontown.coghq import DistributedMint -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class MintInterior(BattlePlace.BattlePlace): notify = DirectNotifyGlobal.directNotify.newCategory('MintInterior') @@ -80,7 +80,7 @@ class MintInterior(BattlePlace.BattlePlace): self._telemLimiter = TLGatherAllAvs('MintInterior', RotationLimitToH) def commence(self = self): - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.fsm.request(requestStatus['how'], [requestStatus]) base.playMusic(self.music, looping=1, volume=0.8) base.transitions.irisIn() @@ -100,7 +100,7 @@ class MintInterior(BattlePlace.BattlePlace): self.acceptOnce('localToonConfrontedMintBoss', handleConfrontedBoss) def exit(self): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) bboard.remove(DistributedMint.DistributedMint.ReadyPost) self._telemLimiter.destroy() del self._telemLimiter diff --git a/toontown/coghq/StageInterior.py b/toontown/coghq/StageInterior.py index 6b08ec86..47233adf 100755 --- a/toontown/coghq/StageInterior.py +++ b/toontown/coghq/StageInterior.py @@ -13,7 +13,7 @@ from toontown.toontowngui import TTDialog from toontown.toonbase import ToontownBattleGlobals from toontown.coghq import DistributedStage from toontown.building import Elevator -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class StageInterior(BattlePlace.BattlePlace): notify = DirectNotifyGlobal.directNotify.newCategory('StageInterior') @@ -82,7 +82,7 @@ class StageInterior(BattlePlace.BattlePlace): base.cr.forbidCheesyEffects(1) def commence(self = self): - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.fsm.request(requestStatus['how'], [requestStatus]) base.playMusic(self.music, looping=1, volume=0.8) base.transitions.irisIn() @@ -102,7 +102,7 @@ class StageInterior(BattlePlace.BattlePlace): self.acceptOnce('localToonConfrontedStageBoss', handleConfrontedBoss) def exit(self): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) self._telemLimiter.destroy() del self._telemLimiter bboard.remove(DistributedStage.DistributedStage.ReadyPost) From 5cc0d8f27a1e3e3a1fee18f9a43b11e8334126a8 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 25 Jun 2015 22:59:13 -0400 Subject: [PATCH 13/27] More nametag translation --- otp/nametag/NametagGlobals.py | 4 ++-- toontown/estate/DistributedCannon.py | 13 ++++++------- toontown/estate/DistributedHouse.py | 17 +++++++---------- toontown/estate/ToonStatueSelectionGUI.py | 14 +++++++++----- toontown/minigame/DistributedCannonGame.py | 11 +++++------ toontown/minigame/DistributedPatternGame.py | 7 ++++--- toontown/minigame/DistributedTugOfWarGame.py | 8 +++++--- toontown/parties/Cannon.py | 11 +++++------ toontown/racing/DistributedVehicle.py | 6 +++--- 9 files changed, 46 insertions(+), 45 deletions(-) diff --git a/otp/nametag/NametagGlobals.py b/otp/nametag/NametagGlobals.py index d6c972b6..7f74d09a 100644 --- a/otp/nametag/NametagGlobals.py +++ b/otp/nametag/NametagGlobals.py @@ -95,6 +95,6 @@ onscreenChatForced = 0 def setOnscreenChatForced(ocf): global onscreenChatForced onscreenChatForced = ocf - + def setGlobalNametagScale(s): - pass \ No newline at end of file + pass diff --git a/toontown/estate/DistributedCannon.py b/toontown/estate/DistributedCannon.py index b5db83fc..861a249d 100755 --- a/toontown/estate/DistributedCannon.py +++ b/toontown/estate/DistributedCannon.py @@ -21,8 +21,8 @@ from direct.distributed import DistributedObject from toontown.effects import Wake from direct.controls.ControlManager import CollisionHandlerRayStart -from toontown.nametag.NametagFloat3d import NametagFloat3d -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagFloat3d import NametagFloat3d +from otp.nametag.Nametag import Nametag LAND_TIME = 2 WORLD_SCALE = 2.0 @@ -1239,19 +1239,19 @@ class DistributedCannon(DistributedObject.DistributedObject): def __calcHitTreasures(self, trajectory): estate = self.cr.doId2do.get(self.estateId) self.hitTreasures = [] - if estate: + '''if estate: doIds = estate.flyingTreasureId for id in doIds: t = self.cr.doId2do.get(id) if t: - pos = t.nodePath.getPos() + pos = t.pos rad = 10.5 height = 10.0 t_impact = trajectory.checkCollisionWithCylinderSides(pos, rad, height) if t_impact > 0: self.hitTreasures.append([t_impact, t]) - del estate + del estate''' return None def __shootTask(self, task): @@ -1579,5 +1579,4 @@ class DistributedCannon(DistributedObject.DistributedObject): def turnOnBumperCollision(self, whatever = 0): if self.bumperCol: - self.bumperCol.setCollideMask(ToontownGlobals.WallBitmask) - + self.bumperCol.setCollideMask(ToontownGlobals.WallBitmask)# decompiled 0 files: 0 okay, 1 failed, 0 verify failed diff --git a/toontown/estate/DistributedHouse.py b/toontown/estate/DistributedHouse.py index 29f8a562..37bb1218 100755 --- a/toontown/estate/DistributedHouse.py +++ b/toontown/estate/DistributedHouse.py @@ -19,8 +19,8 @@ import HouseGlobals from toontown.building import ToonInteriorColors from direct.showbase.MessengerGlobal import messenger from toontown.dna.DNAParser import * -from toontown.nametag.NametagGroup import NametagGroup -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagGroup import NametagGroup +from otp.nametag.Nametag import Nametag class DistributedHouse(DistributedObject.DistributedObject): notify = directNotify.newCategory('DistributedHouse') @@ -231,19 +231,16 @@ class DistributedHouse(DistributedObject.DistributedObject): else: houseName = TTLocalizer.AvatarsHouse % TTLocalizer.GetPossesive(self.name) self.nametag = NametagGroup() - self.nametag.setNametag3d(None) self.nametag.setFont(ToontownGlobals.getBuildingNametagFont()) if TTLocalizer.BuildingNametagShadow: self.nametag.setShadow(*TTLocalizer.BuildingNametagShadow) - self.nametag.hideChat() - self.nametag.hideThought() - nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCToonBuilding] - self.nametag.setNametagColor(nametagColor) - self.nametag.setActive(False) + self.nametag.setContents(Nametag.CName) + self.nametag.setColorCode(NametagGroup.CCHouseBuilding) + self.nametag.setActive(0) self.nametag.setAvatar(self.house) - self.nametag.setText(houseName) + self.nametag.setObjectCode(self.doId) + self.nametag.setName(houseName) self.nametag.manage(base.marginManager) - self.nametag.updateAll() def unload(self): self.notify.debug('unload') diff --git a/toontown/estate/ToonStatueSelectionGUI.py b/toontown/estate/ToonStatueSelectionGUI.py index f50f2c19..7fd5dcc1 100755 --- a/toontown/estate/ToonStatueSelectionGUI.py +++ b/toontown/estate/ToonStatueSelectionGUI.py @@ -9,7 +9,8 @@ from panda3d.core import * from toontown.estate import DistributedToonStatuary from toontown.estate import GardenGlobals from toontown.estate import PlantingGUI -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals +from otp.nametag.NametagGroup import * from toontown.toon import DistributedToon from toontown.toon import Toon from toontown.toonbase import TTLocalizer @@ -96,20 +97,23 @@ class ToonStatueSelectionGUI(DirectFrame): return test def __makeFFlist(self): - playerAvatar = (base.localAvatar.doId, base.localAvatar.name, NametagGlobals.CCNonPlayer) + playerAvatar = (base.localAvatar.doId, base.localAvatar.name, CCNonPlayer) self.ffList.append(playerAvatar) self.dnaSelected = base.localAvatar.style self.createPreviewToon(self.dnaSelected) for familyMember in base.cr.avList: if familyMember.id != base.localAvatar.doId: - newFF = (familyMember.id, familyMember.name, NametagGlobals.CCNonPlayer) + newFF = (familyMember.id, familyMember.name, CCNonPlayer) self.ffList.append(newFF) for friendId in base.localAvatar.friendsList: handle = base.cr.identifyFriend(friendId) if handle and not self.checkFamily(friendId): if hasattr(handle, 'getName'): - newFF = (friendId, handle.getName(), NametagGlobals.getFriendColor(handle)) + colorCode = CCSpeedChat + if flags & ToontownGlobals.FriendChat: + colorCode = CCFreeChat + newFF = (friendId, handle.getName(), colorCode) self.ffList.append(newFF) else: self.notify.warning('Bad Handle for getName in makeFFlist') @@ -124,7 +128,7 @@ class ToonStatueSelectionGUI(DirectFrame): self.scrollList.refresh() def makeFamilyButton(self, familyId, familyName, colorCode): - fg = NametagGlobals.NametagColors[colorCode][3][0] + 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 __chooseFriend(self, friendId, friendName): diff --git a/toontown/minigame/DistributedCannonGame.py b/toontown/minigame/DistributedCannonGame.py index e2bf4fd8..52b3a451 100755 --- a/toontown/minigame/DistributedCannonGame.py +++ b/toontown/minigame/DistributedCannonGame.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from panda3d.core import * -from toontown.nametag.NametagFloat3d import NametagFloat3d -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagFloat3d import NametagFloat3d +from otp.nametag.Nametag import Nametag from toontown.toonbase.ToonBaseGlobal import * from DistributedMinigame import * from direct.distributed.ClockDelta import * @@ -198,7 +198,7 @@ class DistributedCannonGame(DistributedMinigame): if av: av.loop('neutral') av.setPlayRate(1.0, 'run') - av.nametag.remove(head.tag) + av.nametag.removeNametag(head.tag) head.delete() del self.toonHeadDict @@ -345,11 +345,10 @@ class DistributedCannonGame(DistributedMinigame): self.toonHeadDict[avId] = head toon = self.getAvatar(avId) tag = NametagFloat3d() - tag.hideNametag() - tag.update() + tag.setContents(Nametag.CSpeech | Nametag.CThought) tag.setBillboardOffset(0) tag.setAvatar(head) - toon.nametag.add(tag) + toon.nametag.addNametag(tag) tagPath = head.attachNewNode(tag) tagPath.setPos(0, 0, 1) head.tag = tag diff --git a/toontown/minigame/DistributedPatternGame.py b/toontown/minigame/DistributedPatternGame.py index 29d04747..ceb52ef4 100755 --- a/toontown/minigame/DistributedPatternGame.py +++ b/toontown/minigame/DistributedPatternGame.py @@ -9,8 +9,7 @@ import string import ArrowKeys from DistributedMinigame import * import PatternGameGlobals -from toontown.chat.ChatGlobals import * -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * from toontown.toon import NPCToons from toontown.toon import ToonHead from toontown.toonbase import TTLocalizer @@ -200,6 +199,7 @@ class DistributedPatternGame(DistributedMinigame): camera.setPosHpr(0.0, -14.59, 10.56, 0.0, -16.39, 0.0) base.camLens.setMinFov(24.66/(4./3.)) base.setBackgroundColor(Vec4(0.984, 0.984, 0.584, 1)) + NametagGlobals.setGlobalNametagScale(0.6) self.arrowKeys = ArrowKeys.ArrowKeys() self.room.reparentTo(render) self.room.setPosHpr(0.0, 18.39, -ToontownGlobals.FloorOffset, 0.0, 0.0, 0.0) @@ -244,7 +244,7 @@ class DistributedPatternGame(DistributedMinigame): self.makeToonLookatCamera(self.blinky) self.blinky.loop('neutral') self.blinky.nametag.manage(base.marginManager) - self.blinky.nametag.getNametag3d().setChatWordWrap(8) + self.blinky.nametag.getNametag3d().setChatWordwrap(8) self.arrowDict['m'] = [self.arrows.pop(), self.xs.pop()] for k in xrange(0, 2): self.arrowDict['m'][k].setBillboardAxis() @@ -262,6 +262,7 @@ class DistributedPatternGame(DistributedMinigame): self.music.stop() base.camLens.setMinFov(settings['fov']/(4./3.)) base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor) + NametagGlobals.setGlobalNametagScale(1.0) self.arrowKeys.destroy() del self.arrowKeys self.room.reparentTo(hidden) diff --git a/toontown/minigame/DistributedTugOfWarGame.py b/toontown/minigame/DistributedTugOfWarGame.py index 81d791a6..4f755987 100755 --- a/toontown/minigame/DistributedTugOfWarGame.py +++ b/toontown/minigame/DistributedTugOfWarGame.py @@ -21,7 +21,7 @@ from toontown.effects import Ripples from toontown.toonbase import TTLocalizer import MinigamePowerMeter from direct.task.Task import Task -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class DistributedTugOfWarGame(DistributedMinigame): bgm = 'phase_4/audio/bgm/MG_tug_o_war.ogg' @@ -251,6 +251,7 @@ class DistributedTugOfWarGame(DistributedMinigame): self.notify.debug('onstage') DistributedMinigame.onstage(self) self.lt = base.localAvatar + NametagGlobals.setGlobalNametagScale(1) self.arrowKeys = ArrowKeys.ArrowKeys() self.room.reparentTo(render) self.room.setPosHpr(0.0, 18.39, -ToontownGlobals.FloorOffset, 0.0, 0.0, 0.0) @@ -294,6 +295,7 @@ class DistributedTugOfWarGame(DistributedMinigame): self.setupTrack = None base.camLens.setMinFov(settings['fov']/(4./3.)) base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar) + NametagGlobals.setGlobalNametagScale(1.0) if self.arrowKeys: self.arrowKeys.setPressHandlers(self.arrowKeys.NULL_HANDLERS) self.arrowKeys.setReleaseHandlers(self.arrowKeys.NULL_HANDLERS) @@ -1020,8 +1022,8 @@ class DistributedTugOfWarGame(DistributedMinigame): d = SuitDNA.SuitDNA() d.newSuit(self.suitType) self.suit.setDNA(d) - self.suit.nametag.setNametag2d(None) - self.suit.nametag.setNametag3d(None) + self.suit.nametag3d.stash() + self.suit.nametag.destroy() self.suit.reparentTo(render) self.suit.setPos(self.origSuitPosHpr[0]) self.suit.setHpr(self.origSuitPosHpr[1]) diff --git a/toontown/parties/Cannon.py b/toontown/parties/Cannon.py index 74510d13..2b66b1c8 100755 --- a/toontown/parties/Cannon.py +++ b/toontown/parties/Cannon.py @@ -9,8 +9,8 @@ from toontown.minigame.CannonGameGlobals import * from toontown.toonbase import ToontownGlobals from toontown.parties.PartyUtils import toRadians, calcVelocity from direct.showbase.PythonUtil import StackTrace -from toontown.nametag.NametagFloat3d import NametagFloat3d -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagFloat3d import NametagFloat3d +from otp.nametag.Nametag import Nametag CANNON_ROTATION_MIN = -70 CANNON_ROTATION_MAX = 70 INITIAL_VELOCITY = 80.0 @@ -134,11 +134,10 @@ class Cannon: self.toonHead.setupHead(toon.style) self.toonHead.reparentTo(hidden) tag = NametagFloat3d() - tag.hideNametag() - tag.update() + tag.setContents(Nametag.CSpeech | Nametag.CThought) tag.setBillboardOffset(0) tag.setAvatar(self.toonHead) - toon.nametag.add(tag) + toon.nametag.addNametag(tag) tagPath = self.toonHead.attachNewNode(tag) tagPath.setPos(0, 0, 1) self.toonHead.tag = tag @@ -192,7 +191,7 @@ class Cannon: if self.toonHead != None: self.hideToonHead() if hasattr(self.toonInside, 'nametag'): - self.toonInside.nametag.remove(self.toonHead.tag) + self.toonInside.nametag.removeNametag(self.toonHead.tag) self.toonHead.delete() self.toonHead = None self.toonInside = None diff --git a/toontown/racing/DistributedVehicle.py b/toontown/racing/DistributedVehicle.py index c3330b50..8d630378 100755 --- a/toontown/racing/DistributedVehicle.py +++ b/toontown/racing/DistributedVehicle.py @@ -19,7 +19,7 @@ from toontown.battle.BattleProps import * import random from direct.showbase.PythonUtil import randFloat from direct.task.Task import Task -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals import math iceTurnFactor = 0.25 iceAccelFactor = 0.4 @@ -497,7 +497,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart, self.toon.sendCurrentPosition() self.doHeadScale(self.toon, 1.75) self.toon.setShear(0, 0, 0) - NametagGlobals.setForceOnscreenChat(True) + NametagGlobals.setOnscreenChatForced(1) if self.localVehicle: camera.reparentTo(self.cameraNode) camera.setPosHpr(0, -33, 16, 0, -10, 0) @@ -537,7 +537,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart, self.toon.reparentTo(render) self.toon.loop('neutral') self.toon.startSmooth() - NametagGlobals.setForceOnscreenChat(False) + NametagGlobals.setOnscreenChatForced(0) base.camLens.setMinFov(settings['fov']/(4./3.)) def doHeadScale(self, model, scale): From dd45d7d7be2a392335307e9b520938a5b656bcd7 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 25 Jun 2015 23:33:15 -0400 Subject: [PATCH 14/27] YET MORE WORK. ALMOST DONE. --- toontown/estate/DistributedCannon.py | 2 +- toontown/safezone/OZSafeZoneLoader.py | 2 -- toontown/suit/BossCog.py | 4 ++-- toontown/suit/DistributedBossCog.py | 18 +++++++++--------- toontown/suit/DistributedBossbotBoss.py | 7 ++++--- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/toontown/estate/DistributedCannon.py b/toontown/estate/DistributedCannon.py index 861a249d..adf5ab23 100755 --- a/toontown/estate/DistributedCannon.py +++ b/toontown/estate/DistributedCannon.py @@ -1579,4 +1579,4 @@ class DistributedCannon(DistributedObject.DistributedObject): def turnOnBumperCollision(self, whatever = 0): if self.bumperCol: - self.bumperCol.setCollideMask(ToontownGlobals.WallBitmask)# decompiled 0 files: 0 okay, 1 failed, 0 verify failed + self.bumperCol.setCollideMask(ToontownGlobals.WallBitmask) diff --git a/toontown/safezone/OZSafeZoneLoader.py b/toontown/safezone/OZSafeZoneLoader.py index 6cedaecb..a61d8a3d 100755 --- a/toontown/safezone/OZSafeZoneLoader.py +++ b/toontown/safezone/OZSafeZoneLoader.py @@ -8,8 +8,6 @@ from panda3d.core import * import random from otp.avatar import Avatar -from toontown.chat.ChatGlobals import * -from toontown.nametag.NametagGroup import * from otp.otpbase import OTPGlobals from toontown.distributed import DelayDelete from toontown.effects import Bubbles diff --git a/toontown/suit/BossCog.py b/toontown/suit/BossCog.py index 5c2fe6c5..28c53391 100755 --- a/toontown/suit/BossCog.py +++ b/toontown/suit/BossCog.py @@ -14,7 +14,7 @@ import SuitDNA from otp.avatar import Avatar from toontown.battle import BattleParticles from toontown.battle import BattleProps -from toontown.nametag import NametagGlobals +from otp.nametag.NametagGroup import NametagGroup from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals @@ -34,7 +34,7 @@ class BossCog(Avatar.Avatar): def __init__(self): Avatar.Avatar.__init__(self) self.setFont(ToontownGlobals.getSuitFont()) - self.setPlayerType(NametagGlobals.CCSuit) + self.setPlayerType(NametagGroup.CCSuit) self.setPickable(0) self.doorA = None self.doorB = None diff --git a/toontown/suit/DistributedBossCog.py b/toontown/suit/DistributedBossCog.py index c4044c38..cf3207d1 100755 --- a/toontown/suit/DistributedBossCog.py +++ b/toontown/suit/DistributedBossCog.py @@ -21,7 +21,7 @@ from toontown.friends import FriendsListManager from direct.controls.ControlManager import CollisionHandlerRayStart from direct.showbase import PythonUtil import random -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBossCog') @@ -957,7 +957,7 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): self.transitions.IrisModelName = 'phase_3/models/misc/iris' self.transitions.FadeModelName = 'phase_3/models/misc/fade' self.transitions.fadeScreen(alpha=1) - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) def __doneWaitForToons(self): self.doneBarrier('WaitForToons') @@ -966,7 +966,7 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): self.show() self.transitions.noFade() del self.transitions - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) def enterElevator(self): for toonId in self.involvedToons: @@ -997,7 +997,7 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): def enterIntroduction(self): self.controlToons() ElevatorUtils.openDoors(self.leftDoor, self.rightDoor, self.elevatorType) - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) intervalName = 'IntroductionMovie' delayDeletes = [] seq = Sequence(self.makeIntroductionMovie(delayDeletes), Func(self.__beginBattleOne), name=intervalName) @@ -1016,7 +1016,7 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): self.clearInterval(intervalName) self.unstickToons() self.releaseToons() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) ElevatorUtils.closeDoors(self.leftDoor, self.rightDoor, self.elevatorType) def enterBattleOne(self): @@ -1039,8 +1039,8 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): self.accept('clickedNametag', self.__clickedNameTag) self.accept('friendAvatar', self.__handleFriendAvatar) self.accept('avatarDetails', self.__handleAvatarDetails) - NametagGlobals.setWant2dNametags(False) - NametagGlobals.setWantActiveNametags(True) + NametagGlobals.setMasterArrowsOn(0) + NametagGlobals.setMasterNametagsActive(1) def exitBattleThree(self): self.ignore('clickedNameTag') @@ -1084,8 +1084,8 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): self.accept('clickedNametag', self.__clickedNameTag) self.accept('friendAvatar', self.__handleFriendAvatar) self.accept('avatarDetails', self.__handleAvatarDetails) - NametagGlobals.setWant2dNametags(False) - NametagGlobals.setWantActiveNametags(True) + NametagGlobals.setMasterArrowsOn(0) + NametagGlobals.setMasterNametagsActive(1) def exitBattleFour(self): self.ignore('clickedNameTag') diff --git a/toontown/suit/DistributedBossbotBoss.py b/toontown/suit/DistributedBossbotBoss.py index e3c56994..31b95016 100755 --- a/toontown/suit/DistributedBossbotBoss.py +++ b/toontown/suit/DistributedBossbotBoss.py @@ -12,11 +12,9 @@ from toontown.battle import MovieToonVictory from toontown.battle import RewardPanel from toontown.battle import SuitBattleGlobals from toontown.building import ElevatorConstants -from toontown.chat.ChatGlobals import * from toontown.coghq import CogDisguiseGlobals from toontown.distributed import DelayDelete from toontown.effects import DustCloud -from toontown.nametag import NametagGlobals from toontown.suit import DistributedBossCog from toontown.suit import Suit from toontown.suit import SuitDNA @@ -25,6 +23,9 @@ from toontown.toon import ToonDNA from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownTimer +from otp.nametag import NametagGroup +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals OneBossCog = None @@ -195,7 +196,7 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): npc = Toon.Toon() npc.setName(TTLocalizer.BossbotResistanceToonName) npc.setPickable(0) - npc.setPlayerType(NametagGlobals.CCNonPlayer) + npc.setPlayerType(NametagGroup.CCNonPlayer) dna = ToonDNA.ToonDNA() dna.newToonRandom(11237, 'm', 1) dna.head = 'sls' From 9b52f82419dc636fcfdc1fa99afd615daf93b176 Mon Sep 17 00:00:00 2001 From: John Cote Date: Fri, 26 Jun 2015 00:32:17 -0400 Subject: [PATCH 15/27] UGH WHEN WILL THIS END --- toontown/battle/MovieHeal.py | 2 +- toontown/battle/MoviePetSOS.py | 2 +- toontown/building/DistributedBoardingParty.py | 4 ++-- toontown/building/DistributedTutorialInterior.py | 2 +- toontown/suit/DistributedCashbotBoss.py | 12 ++++++------ toontown/suit/DistributedLawbotBoss.py | 11 +++++------ toontown/suit/DistributedSellbotBoss.py | 4 ++-- toontown/suit/DistributedSuit.py | 11 +++++------ toontown/suit/DistributedSuitBase.py | 4 ++-- toontown/toon/DistributedNPCClerk.py | 3 +-- toontown/toon/DistributedNPCToon.py | 3 +-- 11 files changed, 27 insertions(+), 31 deletions(-) diff --git a/toontown/battle/MovieHeal.py b/toontown/battle/MovieHeal.py index 1ba0f9ca..d1307ad9 100755 --- a/toontown/battle/MovieHeal.py +++ b/toontown/battle/MovieHeal.py @@ -10,7 +10,7 @@ from BattleSounds import * import MovieCamera import MovieNPCSOS import MovieUtil -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.effects import Splash from toontown.toon import NPCToons from toontown.toonbase import TTLocalizer diff --git a/toontown/battle/MoviePetSOS.py b/toontown/battle/MoviePetSOS.py index 6822113c..5de9aed7 100755 --- a/toontown/battle/MoviePetSOS.py +++ b/toontown/battle/MoviePetSOS.py @@ -7,7 +7,7 @@ from BattleProps import * from BattleSounds import * import MovieCamera import MovieUtil -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.pets import Pet, PetTricks from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals diff --git a/toontown/building/DistributedBoardingParty.py b/toontown/building/DistributedBoardingParty.py index 03b851d8..1da48700 100755 --- a/toontown/building/DistributedBoardingParty.py +++ b/toontown/building/DistributedBoardingParty.py @@ -6,8 +6,8 @@ from panda3d.core import * import BoardingGroupShow from toontown.building import BoardingPartyBase -from toontown.chat.ChatGlobals import * -from toontown.chat.WhisperPopup import * +from otp.nametag.NametagConstants import * +from otp.margins.WhisperPopup import * from toontown.hood import ZoneUtil from toontown.toon import BoardingGroupInviterPanels from toontown.toon import GroupInvitee diff --git a/toontown/building/DistributedTutorialInterior.py b/toontown/building/DistributedTutorialInterior.py index 6425d563..98b68603 100755 --- a/toontown/building/DistributedTutorialInterior.py +++ b/toontown/building/DistributedTutorialInterior.py @@ -15,7 +15,7 @@ from toontown.suit import Suit from toontown.quest import QuestParser from toontown.toon import DistributedNPCSpecialQuestGiver from toontown.toonbase import TTLocalizer -from toontown.chat.ChatGlobals import CFSpeech +from otp.nametag.NametagConstants import CFSpeech class DistributedTutorialInterior(DistributedObject.DistributedObject): diff --git a/toontown/suit/DistributedCashbotBoss.py b/toontown/suit/DistributedCashbotBoss.py index 046e434a..79372c56 100755 --- a/toontown/suit/DistributedCashbotBoss.py +++ b/toontown/suit/DistributedCashbotBoss.py @@ -17,15 +17,15 @@ from toontown.battle import SuitBattleGlobals from toontown.building import ElevatorConstants from toontown.building import ElevatorUtils from toontown.chat import ResistanceChat -from toontown.chat.ChatGlobals import * from toontown.coghq import CogDisguiseGlobals from toontown.distributed import DelayDelete -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagGlobals import * from toontown.toon import Toon from toontown.toon import ToonDNA from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals +from otp.nametag import NametagGroup +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals OneBossCog = None @@ -105,7 +105,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): npc = Toon.Toon() npc.setName(TTLocalizer.ResistanceToonName) npc.setPickable(0) - npc.setPlayerType(NametagGlobals.CCNonPlayer) + npc.setPlayerType(NametagGroup.CCNonPlayer) dna = ToonDNA.ToonDNA() dna.newToonRandom(11237, 'f', 1) dna.head = 'pls' @@ -716,7 +716,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def enterPrepareBattleThree(self): self.controlToons() - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) intervalName = 'PrepareBattleThreeMovie' delayDeletes = [] self.movieCrane = self.cranes[0] @@ -745,7 +745,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): if self.newState == 'BattleThree': self.movieCrane.request('Free') self.movieSafe.request('Initial') - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) ElevatorUtils.closeDoors(self.leftDoor, self.rightDoor, ElevatorConstants.ELEVATOR_CFO) taskMgr.remove(self.uniqueName('physics')) diff --git a/toontown/suit/DistributedLawbotBoss.py b/toontown/suit/DistributedLawbotBoss.py index 024a3ced..ce17f52e 100755 --- a/toontown/suit/DistributedLawbotBoss.py +++ b/toontown/suit/DistributedLawbotBoss.py @@ -21,12 +21,11 @@ from toontown.battle import SuitBattleGlobals from toontown.battle.BattleProps import * from toontown.building import ElevatorConstants from toontown.building import ElevatorUtils -from toontown.chat.ChatGlobals import * from toontown.coghq import CogDisguiseGlobals from toontown.distributed import DelayDelete -from toontown.nametag import NametagGlobals -from toontown.nametag import NametagGroup -from toontown.nametag.NametagGlobals import * +from otp.nametag import NametagGroup +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.toon import Toon from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals @@ -976,7 +975,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def exitBattleThree(self): self.notify.debug('----- exitBattleThree') DistributedBossCog.DistributedBossCog.exitBattleThree(self) - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) bossDoneEventName = self.uniqueName('DestroyedBoss') self.ignore(bossDoneEventName) taskMgr.remove(self.uniqueName('StandUp')) @@ -1597,7 +1596,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): npc.setDNAString(dnaNetString) npc.setName(TTLocalizer.WitnessToonName) npc.setPickable(0) - npc.setPlayerType(NametagGlobals.CCNonPlayer) + npc.setPlayerType(NametagGroup.CCNonPlayer) npc.animFSM.request('Sit') self.witnessToon = npc self.witnessToon.setPosHpr(*ToontownGlobals.LawbotBossWitnessStandPosHpr) diff --git a/toontown/suit/DistributedSellbotBoss.py b/toontown/suit/DistributedSellbotBoss.py index d19cf337..6bfb59fe 100755 --- a/toontown/suit/DistributedSellbotBoss.py +++ b/toontown/suit/DistributedSellbotBoss.py @@ -19,15 +19,15 @@ from toontown.battle import MovieToonVictory from toontown.battle import RewardPanel from toontown.battle import SuitBattleGlobals from toontown.battle.BattleProps import * -from toontown.chat.ChatGlobals import * from toontown.coghq import CogDisguiseGlobals from toontown.distributed import DelayDelete -from toontown.nametag.NametagGlobals import * from toontown.suit import SellbotBossGlobals from toontown.toon import NPCToons from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals OneBossCog = None diff --git a/toontown/suit/DistributedSuit.py b/toontown/suit/DistributedSuit.py index 8957fdd9..ee020857 100755 --- a/toontown/suit/DistributedSuit.py +++ b/toontown/suit/DistributedSuit.py @@ -20,10 +20,9 @@ from otp.avatar import DistributedAvatar from otp.otpbase import OTPLocalizer from toontown.battle import BattleProps from toontown.battle import DistributedBattle -from toontown.chat.ChatGlobals import * from toontown.distributed.DelayDeletable import DelayDeletable -from toontown.nametag import NametagGlobals -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from libpandadna import * from toontown.toonbase import ToontownGlobals @@ -632,11 +631,11 @@ class DistributedSuit(DistributedSuitBase.DistributedSuitBase, DelayDeletable): base.playSfx(dialogue, node=self) elif chatFlags & CFSpeech != 0: if self.nametag.getNumChatPages() > 0: - self.playDialogueForString(self.nametag.getChatText()) + self.playDialogueForString(self.nametag.getChat()) if self.soundChatBubble != None: base.playSfx(self.soundChatBubble, node=self) - elif self.nametag.getStompChatText(): - self.playDialogueForString(self.nametag.getStompChatText(), self.nametag.CHAT_STOMP_DELAY) + elif self.nametag.getChatStomp() > 0: + self.playDialogueForString(self.nametag.getStompText(), self.nametag.getStompDelay()) def playDialogueForString(self, chatString, delay = 0.0): if len(chatString) == 0: diff --git a/toontown/suit/DistributedSuitBase.py b/toontown/suit/DistributedSuitBase.py index 108401d5..e73d727f 100755 --- a/toontown/suit/DistributedSuitBase.py +++ b/toontown/suit/DistributedSuitBase.py @@ -6,9 +6,9 @@ from direct.interval.IntervalGlobal import * from direct.task import Task from otp.avatar import DistributedAvatar from otp.otpbase import OTPGlobals +from otp.nametag.NametagConstants import * +from otp.nametag import NametagGlobals from toontown.battle import BattleProps -from toontown.chat.ChatGlobals import * -from toontown.nametag.NametagGlobals import * from toontown.toonbase import TTLocalizer, ToontownGlobals import Suit, SuitBase, SuitDialog, SuitTimings import random diff --git a/toontown/toon/DistributedNPCClerk.py b/toontown/toon/DistributedNPCClerk.py index 64d66f09..e36c8c1d 100755 --- a/toontown/toon/DistributedNPCClerk.py +++ b/toontown/toon/DistributedNPCClerk.py @@ -4,12 +4,11 @@ from panda3d.core import * from DistributedNPCToonBase import * import NPCToons -from toontown.chat.ChatGlobals import * from toontown.hood import ZoneUtil from toontown.minigame import ClerkPurchase -from toontown.nametag.NametagGlobals import * from toontown.shtiker.PurchaseManagerConstants import * from toontown.toonbase import TTLocalizer +from otp.nametag.NametagConstants import * class DistributedNPCClerk(DistributedNPCToonBase): diff --git a/toontown/toon/DistributedNPCToon.py b/toontown/toon/DistributedNPCToon.py index f6312bba..e27fef44 100755 --- a/toontown/toon/DistributedNPCToon.py +++ b/toontown/toon/DistributedNPCToon.py @@ -2,9 +2,8 @@ from direct.interval.IntervalGlobal import * from panda3d.core import * import time from DistributedNPCToonBase import * -from toontown.chat.ChatGlobals import * from toontown.hood import ZoneUtil -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * from toontown.quest import QuestChoiceGui from toontown.quest import QuestParser from toontown.quest import TrackChoiceGui From 48539188de8d488bafa6ca936363e3ea733f1335 Mon Sep 17 00:00:00 2001 From: John Cote Date: Fri, 26 Jun 2015 03:09:27 -0400 Subject: [PATCH 16/27] Some final nametag shit --- otp/avatar/DistributedAvatar.py | 8 ++++---- otp/nametag/NametagConstants.py | 15 +++++++++++++++ toontown/building/DistributedDoor.py | 2 +- toontown/building/DistributedTutorialInterior.py | 4 ++-- toontown/cogdominium/CogdoBarrelRoomMovies.py | 4 ++-- toontown/cogdominium/CogdoElevatorMovie.py | 4 ++-- toontown/cogdominium/CogdoExecutiveSuiteMovies.py | 4 ++-- toontown/cogdominium/CogdoMazeGameMovies.py | 4 ++-- toontown/coghq/DistributedBanquetTable.py | 4 ++-- toontown/coghq/DistributedCountryClubRoom.py | 1 + toontown/coghq/DistributedFactory.py | 1 + toontown/coghq/DistributedGolfGreenGame.py | 4 ++-- toontown/coghq/DistributedMintRoom.py | 1 + toontown/coghq/DistributedStageRoom.py | 1 + toontown/distributed/ToontownClientRepository.py | 6 +++--- toontown/estate/DistributedTarget.py | 4 ++-- toontown/estate/houseDesign.py | 4 ++-- toontown/friends/FriendsListPanel.py | 8 ++++---- toontown/golf/DistributedGolfCourse.py | 4 ++-- toontown/hood/Place.py | 8 ++++---- toontown/minigame/DistributedCatchGame.py | 4 ++-- toontown/minigame/DistributedCogThiefGame.py | 4 ++-- toontown/minigame/DistributedMazeGame.py | 4 ++-- toontown/minigame/DistributedTagGame.py | 4 ++-- toontown/minigame/MazeSuit.py | 4 ++-- toontown/minigame/TwoDEnemy.py | 4 ++-- toontown/parties/CannonGui.py | 8 ++++---- toontown/parties/DistributedPartyActivity.py | 4 ++-- .../parties/DistributedPartyTrampolineActivity.py | 8 ++++---- toontown/parties/PartyCatchActivityToonSD.py | 4 ++-- toontown/parties/PartyCogActivityGui.py | 4 ++-- toontown/parties/PublicPartyGui.py | 4 ++-- toontown/quest/QuestChoiceGui.py | 8 ++++---- toontown/safezone/DistributedFishingSpot.py | 8 ++++---- toontown/safezone/DistributedPicnicTable.py | 4 ++-- toontown/safezone/Playground.py | 4 ++-- toontown/suit/DistributedGoon.py | 4 ++-- toontown/toon/DistributedNPCFisherman.py | 3 +-- toontown/toon/DistributedNPCGlove.py | 6 +++--- toontown/toon/DistributedNPCKartClerk.py | 3 +-- toontown/toon/DistributedNPCLaffRestock.py | 2 +- toontown/toon/DistributedNPCPartyPerson.py | 2 +- toontown/toon/DistributedNPCPetclerk.py | 3 +-- toontown/toon/DistributedNPCSpecialQuestGiver.py | 3 +-- .../toon/DistributedNPCSpecialQuestGiverAI.py | 1 - toontown/toon/DistributedNPCTailor.py | 2 +- toontown/toon/DistributedSmartNPC.py | 3 +-- toontown/toon/DistributedToon.py | 11 ++++++----- toontown/toon/GroupPanel.py | 7 +++---- toontown/toon/TTEmote.py | 2 +- toontown/toon/Toon.py | 14 +++++++------- toontown/toon/ToonAvatarPanel.py | 4 ++-- toontown/uberdog/ClientServicesManager.py | 4 ++-- toontown/uberdog/DistributedPartyManager.py | 2 +- 54 files changed, 130 insertions(+), 117 deletions(-) diff --git a/otp/avatar/DistributedAvatar.py b/otp/avatar/DistributedAvatar.py index f2a11835..76081ab7 100755 --- a/otp/avatar/DistributedAvatar.py +++ b/otp/avatar/DistributedAvatar.py @@ -9,6 +9,7 @@ from Avatar import Avatar from otp.ai.MagicWordGlobal import * from otp.otpbase import OTPGlobals from toontown.battle.BattleProps import globalPropPool +from otp.nametag.Nametag import Nametag class DistributedAvatar(DistributedActor, Avatar): @@ -84,12 +85,11 @@ class DistributedAvatar(DistributedActor, Avatar): def do_setParent(self, parentToken): if not self.isDisabled(): - nametag2d = self.nametag.getNametag2d() if parentToken == OTPGlobals.SPHidden: - nametag2d.hideNametag() + self.nametag2dDist &= ~Nametag.CName else: - nametag2d.showNametag() - nametag2d.update() + self.nametag2dDist |= Nametag.CName + self.nametag.getNametag2d().setContents(self.nametag2dContents & self.nametag2dDist) DistributedActor.do_setParent(self, parentToken) self.__setTags() diff --git a/otp/nametag/NametagConstants.py b/otp/nametag/NametagConstants.py index 39cd3067..b4c668f0 100644 --- a/otp/nametag/NametagConstants.py +++ b/otp/nametag/NametagConstants.py @@ -17,6 +17,7 @@ CCSuitBuilding = 5 CCHouseBuilding = 6 CCSpeedChat = 7 CCFreeChat = 8 +CCAdmin = 9 NAMETAG_COLORS = { CCNormal: ( @@ -145,6 +146,20 @@ 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 ), + 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 = { diff --git a/toontown/building/DistributedDoor.py b/toontown/building/DistributedDoor.py index 8153ffa8..059295bd 100755 --- a/toontown/building/DistributedDoor.py +++ b/toontown/building/DistributedDoor.py @@ -113,7 +113,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): self.nametag.setActive(0) self.nametag.setAvatar(self.getDoorNodePath()) self.nametag.setObjectCode(self.block) - name = self.cr.playGame.dnaData.getBlock(self.block).title + name = self.cr.playGame.dnaStore.getTitleFromBlockNumber(self.block) self.nametag.setName(name) self.nametag.manage(base.marginManager) diff --git a/toontown/building/DistributedTutorialInterior.py b/toontown/building/DistributedTutorialInterior.py index 98b68603..3889e464 100755 --- a/toontown/building/DistributedTutorialInterior.py +++ b/toontown/building/DistributedTutorialInterior.py @@ -145,8 +145,8 @@ class DistributedTutorialInterior(DistributedObject.DistributedObject): suitDNA = SuitDNA.SuitDNA() suitDNA.newSuit('f') self.suit.setDNA(suitDNA) - self.suit.nametag.setNametag2d(None) - self.suit.nametag.setNametag3d(None) + self.suit.nametag3d.stash() + self.suit.nametag.destroy() self.suit.loop('neutral') self.suit.setPosHpr(-20, 8, 0, 0, 0, 0) self.suit.reparentTo(self.interior) diff --git a/toontown/cogdominium/CogdoBarrelRoomMovies.py b/toontown/cogdominium/CogdoBarrelRoomMovies.py index 8506176f..affdff5e 100755 --- a/toontown/cogdominium/CogdoBarrelRoomMovies.py +++ b/toontown/cogdominium/CogdoBarrelRoomMovies.py @@ -87,13 +87,13 @@ class CogdoBarrelRoomIntro(CogdoGameMovie): def start(): self.frame.show() - base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0) + base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0) def end(): self._dialogueLabel.reparentTo(hidden) self.toonHead.reparentTo(hidden) self.frame.hide() - base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1) + base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1) self._stopUpdateTask() self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Wait(CogdoBarrelRoomConsts.BarrelRoomIntroTimeout), Func(end)) diff --git a/toontown/cogdominium/CogdoElevatorMovie.py b/toontown/cogdominium/CogdoElevatorMovie.py index c78ae53b..293e6688 100755 --- a/toontown/cogdominium/CogdoElevatorMovie.py +++ b/toontown/cogdominium/CogdoElevatorMovie.py @@ -87,13 +87,13 @@ class CogdoElevatorMovie(CogdoGameMovie): def start(): self.frame.show() - base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0) + base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0) def end(): self._dialogueLabel.reparentTo(hidden) self.toonHead.reparentTo(hidden) self.frame.hide() - base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1) + base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1) self._stopUpdateTask() self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Wait(self.elevatorDuration), Func(end)) diff --git a/toontown/cogdominium/CogdoExecutiveSuiteMovies.py b/toontown/cogdominium/CogdoExecutiveSuiteMovies.py index 4eb230ec..fb3e6ccf 100755 --- a/toontown/cogdominium/CogdoExecutiveSuiteMovies.py +++ b/toontown/cogdominium/CogdoExecutiveSuiteMovies.py @@ -91,7 +91,7 @@ class CogdoExecutiveSuiteIntro(CogdoGameMovie): def start(): self.frame.show() - base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0) + base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0) def showShopOwner(): self._setCamTarget(self._shopOwner, -10, offset=Point3(0, 0, 5)) @@ -100,7 +100,7 @@ class CogdoExecutiveSuiteIntro(CogdoGameMovie): self._dialogueLabel.reparentTo(hidden) self.toonHead.reparentTo(hidden) self.frame.hide() - base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1) + base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1) self._stopUpdateTask() self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Func(showShopOwner), ParallelEndTogether(camera.posInterval(self.cameraMoveDuration, Point3(8, 0, 13), blendType='easeInOut'), camera.hprInterval(0.5, self._camHelperNode.getHpr(), blendType='easeInOut')), Wait(self.introDuration), Func(end)) diff --git a/toontown/cogdominium/CogdoMazeGameMovies.py b/toontown/cogdominium/CogdoMazeGameMovies.py index 61fb7d8b..498db394 100755 --- a/toontown/cogdominium/CogdoMazeGameMovies.py +++ b/toontown/cogdominium/CogdoMazeGameMovies.py @@ -87,8 +87,8 @@ class CogdoMazeGameIntro(CogdoGameMovie): d = SuitDNA.SuitDNA() d.newSuit(suitData['dnaName']) bossSuit.setDNA(d) - bossSuit.nametag.setNametag2d(None) - bossSuit.nametag.setNametag3d(None) + bossSuit.nametag3d.stash() + bossSuit.nametag.destroy() bossSuit.setScale(suitData['scale']) bossSuit.loop('neutral') bossSuit.reparentTo(render) diff --git a/toontown/coghq/DistributedBanquetTable.py b/toontown/coghq/DistributedBanquetTable.py index b6086d85..5bf867d6 100755 --- a/toontown/coghq/DistributedBanquetTable.py +++ b/toontown/coghq/DistributedBanquetTable.py @@ -192,8 +192,8 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq level -= 4 diner.dna.newSuitRandom(level=level, dept='c') diner.setDNA(diner.dna) - diner.nametag.setNametag2d(None) - diner.nametag.setNametag3d(None) + diner.nametag3d.stash() + diner.nametag.destroy() if self.useNewAnimations: diner.loop('sit', fromFrame=i) else: diff --git a/toontown/coghq/DistributedCountryClubRoom.py b/toontown/coghq/DistributedCountryClubRoom.py index 91bdd4d5..9ed19ba5 100755 --- a/toontown/coghq/DistributedCountryClubRoom.py +++ b/toontown/coghq/DistributedCountryClubRoom.py @@ -9,6 +9,7 @@ import CountryClubRoomBase, CountryClubRoom import FactoryEntityCreator import CountryClubRoomSpecs from otp.level import LevelSpec, LevelConstants +from otp.nametag.NametagConstants import * from toontown.toonbase import TTLocalizer def getCountryClubRoomReadyPostName(doId): diff --git a/toontown/coghq/DistributedFactory.py b/toontown/coghq/DistributedFactory.py index d8dfd3d3..5aa044b4 100755 --- a/toontown/coghq/DistributedFactory.py +++ b/toontown/coghq/DistributedFactory.py @@ -13,6 +13,7 @@ from otp.level import LevelConstants from toontown.toonbase import TTLocalizer from toontown.coghq import FactoryCameraViews from direct.controls.ControlManager import CollisionHandlerRayStart +from otp.nametag.NametagConstants import * from otp.ai.MagicWordGlobal import * class DistributedFactory(DistributedLevel.DistributedLevel, FactoryBase.FactoryBase): diff --git a/toontown/coghq/DistributedGolfGreenGame.py b/toontown/coghq/DistributedGolfGreenGame.py index fbd2a457..25d4c63f 100755 --- a/toontown/coghq/DistributedGolfGreenGame.py +++ b/toontown/coghq/DistributedGolfGreenGame.py @@ -419,7 +419,7 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): self.isActive = 1 self.__setCamera() self.spriteNode.show() - base.setCellsActive([base.bottomCells[1], base.bottomCells[2], base.bottomCells[3]], 0) + base.setCellsAvailable([base.bottomCells[1], base.bottomCells[2], base.bottomCells[3]], 0) self.setupFlag = 1 def startBoard(self, board, attackPattern): @@ -557,7 +557,7 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): self.isActive = 0 if self.standbySprite: self.standbySprite.nodeObj.hide() - base.setCellsActive([base.bottomCells[1], base.bottomCells[2], base.bottomCells[3]], 1) + base.setCellsAvailable([base.bottomCells[1], base.bottomCells[2], base.bottomCells[3]], 1) self.sendUpdate('leaveGame', []) return diff --git a/toontown/coghq/DistributedMintRoom.py b/toontown/coghq/DistributedMintRoom.py index d0ed277d..f720f90e 100755 --- a/toontown/coghq/DistributedMintRoom.py +++ b/toontown/coghq/DistributedMintRoom.py @@ -9,6 +9,7 @@ import MintRoomBase, MintRoom import MintRoomSpecs from otp.level import DistributedLevel from otp.level import LevelSpec, LevelConstants +from otp.nametag.NametagConstants import * from toontown.toonbase import TTLocalizer from toontown.toonbase.ToontownGlobals import * diff --git a/toontown/coghq/DistributedStageRoom.py b/toontown/coghq/DistributedStageRoom.py index 6077525a..6cd61902 100755 --- a/toontown/coghq/DistributedStageRoom.py +++ b/toontown/coghq/DistributedStageRoom.py @@ -9,6 +9,7 @@ import StageRoomBase, StageRoom import FactoryEntityCreator import StageRoomSpecs from otp.level import LevelSpec, LevelConstants +from otp.nametag.NametagConstants import * from toontown.toonbase import TTLocalizer def getStageRoomReadyPostName(doId): diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 37f97d6c..ff7dd89f 100755 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -293,13 +293,13 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): def handleAvatarResponseMsg(self, avatarId, di): self.cleanupWaitingForDatabase() dclass = self.dclassesByName['DistributedToon'] - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) loader.beginBulkLoad('localAvatarPlayGame', OTPLocalizer.CREnteringToontown, 400, 1, TTLocalizer.TIP_GENERAL, 0) localAvatar = LocalToon.LocalToon(self) localAvatar.dclass = dclass base.localAvatar = localAvatar __builtins__['localAvatar'] = base.localAvatar - NametagGlobals.setMe(base.localAvatar) + NametagGlobals.setToon(base.localAvatar) localAvatar.doId = avatarId self.localAvatarDoId = avatarId parentId = None @@ -423,7 +423,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): self.notify.error('could not delete localAvatar, delayDeletes=%s' % (base.localAvatar.getDelayDeleteNames(),)) base.localAvatar.deleteOrDelay() base.localAvatar.detectLeaks() - NametagGlobals.setMe(base.cam) + NametagGlobals.setToon(base.cam) del base.localAvatar del __builtins__['localAvatar'] base.localAvatarStyle = None diff --git a/toontown/estate/DistributedTarget.py b/toontown/estate/DistributedTarget.py index 0d622543..d6b36573 100755 --- a/toontown/estate/DistributedTarget.py +++ b/toontown/estate/DistributedTarget.py @@ -155,12 +155,12 @@ class DistributedTarget(DistributedObject.DistributedObject): def showTimer(self): if base.localAvatar.animFSM.getCurrentState().getName() != 'ReadBook': - base.setCellsActive([base.rightCells[0]], 0) + base.setCellsAvailable([base.rightCells[0]], 0) self.timer.show() def hideTimer(self): self.timer.hide() - base.setCellsActive([base.rightCells[0]], 1) + base.setCellsAvailable([base.rightCells[0]], 1) def setPosition(self, x, y, z): self.geom.setPos(x, y, z) diff --git a/toontown/estate/houseDesign.py b/toontown/estate/houseDesign.py index 84713cc5..ac271eef 100755 --- a/toontown/estate/houseDesign.py +++ b/toontown/estate/houseDesign.py @@ -383,7 +383,7 @@ class ObjectManager(NodePath, DirectObject): self.__updateDeleteButtons() self.showAtticPicker() base.localAvatar.laffMeter.stop() - base.setCellsActive(base.leftCells + [base.bottomCells[0]], 0) + base.setCellsAvailable(base.leftCells + [base.bottomCells[0]], 0) if self.guiInterval: self.guiInterval.finish() self.guiInterval = self.furnitureGui.posHprScaleInterval(1.0, Point3(0.155, -0.6, -1.045), Vec3(0), Vec3(0.06), startPos=Point3(0.115, 0.0, -0.66), startHpr=Vec3(0), startScale=Vec3(0.04), blendType='easeInOut', name='lerpFurnitureButton') @@ -419,7 +419,7 @@ class ObjectManager(NodePath, DirectObject): self.inTrashPicker = None self.__cleanupVerifyDelete() self.furnitureGui.hide() - base.setCellsActive(base.leftCells + [base.bottomCells[0]], 1) + base.setCellsAvailable(base.leftCells + [base.bottomCells[0]], 1) base.localAvatar.laffMeter.start() taskMgr.remove('recenterButtonFrameTask') self.cleanupDialog() diff --git a/toontown/friends/FriendsListPanel.py b/toontown/friends/FriendsListPanel.py index 7964e5de..f5ddc171 100755 --- a/toontown/friends/FriendsListPanel.py +++ b/toontown/friends/FriendsListPanel.py @@ -270,10 +270,10 @@ class FriendsListPanel(DirectFrame, StateData.StateData): friendButton.destroy() del self.friends[friendId] - self.createButtons(petFriends, NametagColors[CCNonPlayer][0][0]) - self.createButtons(admins, NametagColors[CCAdmin][0][0]) - self.createButtons(trueFriends, NametagColors[CCNormal][0][0]) - self.createButtons(friends, NametagColors[CCSpeedChat][0][0]) + self.createButtons(petFriends, NAMETAG_COLORS[CCNonPlayer][0][0]) + self.createButtons(admins, NAMETAG_COLORS[CCAdmin][0][0]) + self.createButtons(trueFriends, NAMETAG_COLORS[CCNormal][0][0]) + self.createButtons(friends, NAMETAG_COLORS[CCSpeedChat][0][0]) self.scrollList.index = self.listScrollIndex[self.panelType] self.scrollList.refresh() diff --git a/toontown/golf/DistributedGolfCourse.py b/toontown/golf/DistributedGolfCourse.py index a6516011..b4ae6386 100755 --- a/toontown/golf/DistributedGolfCourse.py +++ b/toontown/golf/DistributedGolfCourse.py @@ -157,7 +157,7 @@ class DistributedGolfCourse(DistributedObject.DistributedObject, FSM, DelayDelet else: color += 1 - base.setCellsActive(base.leftCells, 0) + base.setCellsAvailable(base.leftCells, 0) else: self.toonPanels = None @@ -201,7 +201,7 @@ class DistributedGolfCourse(DistributedObject.DistributedObject, FSM, DelayDelet else: self.notify.warning('GOLF COURSE: Attempting to clean up twice') - base.setCellsActive(base.leftCells, 1) + base.setCellsAvailable(base.leftCells, 1) def onstage(self): self.notify.debug('GOLF COURSE: onstage') diff --git a/toontown/hood/Place.py b/toontown/hood/Place.py index 064c52f1..e152ecde 100755 --- a/toontown/hood/Place.py +++ b/toontown/hood/Place.py @@ -436,7 +436,7 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager): self.fsm.request(out[requestStatus['how']], [requestStatus]) def enterDoorIn(self, requestStatus): - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) door = base.cr.doId2do.get(requestStatus['doorDoId']) if not door is None: door.readyToExit() @@ -444,7 +444,7 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager): base.localAvatar.startQuestMap() def exitDoorIn(self): - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) base.localAvatar.obscureMoveFurnitureButton(-1) def enterDoorOut(self): @@ -600,7 +600,7 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager): def _placeTeleportInPostZoneComplete(self, requestStatus): teleportDebug(requestStatus, '_placeTeleportInPostZoneComplete(%s)' % (requestStatus,)) - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) base.localAvatar.laffMeter.start() base.localAvatar.startQuestMap() base.localAvatar.reconsiderCheesyEffect() @@ -645,7 +645,7 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager): def exitTeleportIn(self): self.removeSetZoneCompleteCallback(self._tiToken) self._tiToken = None - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) base.localAvatar.laffMeter.stop() base.localAvatar.obscureMoveFurnitureButton(-1) base.localAvatar.stopUpdateSmartCamera() diff --git a/toontown/minigame/DistributedCatchGame.py b/toontown/minigame/DistributedCatchGame.py index 538488a3..f9147367 100755 --- a/toontown/minigame/DistributedCatchGame.py +++ b/toontown/minigame/DistributedCatchGame.py @@ -116,8 +116,8 @@ class DistributedCatchGame(DistributedMinigame): d = SuitDNA.SuitDNA() d.newSuit(type) suit.setDNA(d) - suit.nametag.setNametag2d(None) - suit.nametag.setNametag3d(None) + suit.nametag3d.stash() + suit.nametag.destroy() suit.pose('walk', 0) self.suits.append(suit) diff --git a/toontown/minigame/DistributedCogThiefGame.py b/toontown/minigame/DistributedCogThiefGame.py index 9c438929..1de4f300 100755 --- a/toontown/minigame/DistributedCogThiefGame.py +++ b/toontown/minigame/DistributedCogThiefGame.py @@ -176,8 +176,8 @@ class DistributedCogThiefGame(DistributedMinigame): pos = self.cogInfo[cogIndex]['pos'] suit.reparentTo(self.gameBoard) suit.setPos(pos) - suit.nametag.setNametag2d(None) - suit.nametag.setNametag3d(None) + suit.nametag3d.stash() + suit.nametag.destroy() for avId in self.avIdList: self.toonHitTracks[avId] = Wait(0.1) diff --git a/toontown/minigame/DistributedMazeGame.py b/toontown/minigame/DistributedMazeGame.py index 4d4e15c4..e4178cde 100755 --- a/toontown/minigame/DistributedMazeGame.py +++ b/toontown/minigame/DistributedMazeGame.py @@ -621,7 +621,7 @@ class DistributedMazeGame(DistributedMinigame): self.scorePanels = [] self.goalBar.destroy() del self.goalBar - base.setCellsActive(base.rightCells, 1) + base.setCellsAvailable(base.rightCells, 1) for suit in self.suits: suit.offstage() @@ -700,7 +700,7 @@ class DistributedMazeGame(DistributedMinigame): self.goalBar.show() self.goalBar['value'] = 0.0 - base.setCellsActive(base.rightCells, 0) + base.setCellsAvailable(base.rightCells, 0) self.__spawnUpdateSuitsTask() orthoDrive = OrthoDrive(self.TOON_SPEED, maxFrameMove=self.MAX_FRAME_MOVE, customCollisionCallback=self.__doMazeCollisions, priority=1) self.orthoWalk = OrthoWalk(orthoDrive, broadcast=not self.isSinglePlayer()) diff --git a/toontown/minigame/DistributedTagGame.py b/toontown/minigame/DistributedTagGame.py index 66a9e5bf..696beef7 100755 --- a/toontown/minigame/DistributedTagGame.py +++ b/toontown/minigame/DistributedTagGame.py @@ -162,7 +162,7 @@ class DistributedTagGame(DistributedMinigame): scorePanel.reparentTo(base.a2dBottomRight) self.scorePanels.append(scorePanel) - base.setCellsActive(base.rightCells, 0) + base.setCellsAvailable(base.rightCells, 0) self.walkStateData.enter() self.walkStateData.fsm.request('walking') if base.localAvatar.isIt: @@ -195,7 +195,7 @@ class DistributedTagGame(DistributedMinigame): panel.cleanup() self.scorePanels = [] - base.setCellsActive(base.rightCells, 1) + base.setCellsAvailable(base.rightCells, 1) base.mouseInterfaceNode.setForwardSpeed(ToontownGlobals.ToonForwardSpeed) base.mouseInterfaceNode.setRotateSpeed(ToontownGlobals.ToonRotateSpeed) self.itPointer.reparentTo(hidden) diff --git a/toontown/minigame/MazeSuit.py b/toontown/minigame/MazeSuit.py index e211197a..0e00e712 100755 --- a/toontown/minigame/MazeSuit.py +++ b/toontown/minigame/MazeSuit.py @@ -43,8 +43,8 @@ class MazeSuit(DirectObject): d = SuitDNA.SuitDNA() d.newSuit(suitDnaName) self.suit.setDNA(d) - self.suit.nametag.setNametag2d(None) - self.suit.nametag.setNametag3d(None) + self.suit.nametag3d.stash() + self.suit.nametag.destroy() if startTile is None: defaultStartPos = MazeGameGlobals.SUIT_START_POSITIONS[self.serialNum] self.startTile = (defaultStartPos[0] * self.maze.width, defaultStartPos[1] * self.maze.height) diff --git a/toontown/minigame/TwoDEnemy.py b/toontown/minigame/TwoDEnemy.py index d5af57d9..ad62545f 100755 --- a/toontown/minigame/TwoDEnemy.py +++ b/toontown/minigame/TwoDEnemy.py @@ -84,8 +84,8 @@ class TwoDEnemy(DirectObject): self.suit.pose('walk', 0) self.suitName = 'Enemy-%s' % self.index self.suit.setName(self.suitName) - self.suit.nametag.setNametag2d(None) - self.suit.nametag.setNametag3d(None) + self.suit.nametag3d.stash() + self.suit.nametag.destroy() suitPosAttribs = suitAttribs[1] initX, initY, initZ = suitPosAttribs[0] initPos = Point3(initX, initY, initZ) diff --git a/toontown/parties/CannonGui.py b/toontown/parties/CannonGui.py index 95ec0518..0cb9e4fc 100755 --- a/toontown/parties/CannonGui.py +++ b/toontown/parties/CannonGui.py @@ -75,8 +75,8 @@ class CannonGui(DirectObject): def enable(self, timer = 0): self.__aimPad.show() - base.setCellsActive([base.bottomCells[2], base.bottomCells[3]], 0) - base.setCellsActive([base.rightCells[1]], 0) + base.setCellsAvailable([base.bottomCells[2], base.bottomCells[3]], 0) + base.setCellsAvailable([base.rightCells[1]], 0) if timer > 0: self.__timerPad.setTime(timer) self.__timerPad.countdown(timer) @@ -85,8 +85,8 @@ class CannonGui(DirectObject): def disable(self): self.__aimPad.hide() - base.setCellsActive([base.bottomCells[2], base.bottomCells[3]], 1) - base.setCellsActive([base.rightCells[1]], 1) + base.setCellsAvailable([base.bottomCells[2], base.bottomCells[3]], 1) + base.setCellsAvailable([base.rightCells[1]], 1) self.__timerPad.hide() self.disableKeys() diff --git a/toontown/parties/DistributedPartyActivity.py b/toontown/parties/DistributedPartyActivity.py index 025039a5..d2795f68 100755 --- a/toontown/parties/DistributedPartyActivity.py +++ b/toontown/parties/DistributedPartyActivity.py @@ -496,7 +496,7 @@ class DistributedPartyActivity(DistributedObject.DistributedObject): self.notify.debug('BASE: startRules') self.accept(self.rulesDoneEvent, self.handleRulesDone) self.rulesPanel = MinigameRulesPanel('PartyRulesPanel', self.getTitle(), self.getInstructions(), self.rulesDoneEvent, timeout) - base.setCellsActive(base.bottomCells + [base.leftCells[0], base.rightCells[1]], False) + base.setCellsAvailable(base.bottomCells + [base.leftCells[0], base.rightCells[1]], False) self.rulesPanel.load() self.rulesPanel.enter() @@ -507,7 +507,7 @@ class DistributedPartyActivity(DistributedObject.DistributedObject): self.rulesPanel.exit() self.rulesPanel.unload() del self.rulesPanel - base.setCellsActive(base.bottomCells + [base.leftCells[0], base.rightCells[1]], True) + base.setCellsAvailable(base.bottomCells + [base.leftCells[0], base.rightCells[1]], True) def handleRulesDone(self): self.notify.error('BASE: handleRulesDone should be overridden') diff --git a/toontown/parties/DistributedPartyTrampolineActivity.py b/toontown/parties/DistributedPartyTrampolineActivity.py index 262b2f6d..c4d9cc7b 100755 --- a/toontown/parties/DistributedPartyTrampolineActivity.py +++ b/toontown/parties/DistributedPartyTrampolineActivity.py @@ -299,7 +299,7 @@ class DistributedPartyTrampolineActivity(DistributedPartyActivity): def startActive(self): DistributedPartyTrampolineActivity.notify.debug('startActive') if self.toon != None and self.toon.doId == base.localAvatar.doId: - base.setCellsActive(base.bottomCells, True) + base.setCellsAvailable(base.bottomCells, True) self.accept('arrow_left', self.onLeft) self.accept('arrow_left-up', self.onLeftUp) self.accept('arrow_right', self.onRight) @@ -390,8 +390,8 @@ class DistributedPartyTrampolineActivity(DistributedPartyActivity): self.timeLeftToSimulate = 0.0 self.doSimulateStep = False taskMgr.add(self.updateTask, self.uniqueName('TrampolineActivity.updateTask')) - base.setCellsActive(base.leftCells, False) - base.setCellsActive(base.bottomCells, False) + base.setCellsAvailable(base.leftCells, False) + base.setCellsAvailable(base.bottomCells, False) DistributedPartyActivity.startRules(self) def releaseToon(self): @@ -405,7 +405,7 @@ class DistributedPartyTrampolineActivity(DistributedPartyActivity): self.hopOffAnim.start() def postHopOff(self): - base.setCellsActive(base.leftCells, True) + base.setCellsAvailable(base.leftCells, True) self.timer.stop() self.timer.hide() self.toon.dropShadow.reparentTo(self.toon.getShadowJoint()) diff --git a/toontown/parties/PartyCatchActivityToonSD.py b/toontown/parties/PartyCatchActivityToonSD.py index 895e1dcf..16bd2de5 100755 --- a/toontown/parties/PartyCatchActivityToonSD.py +++ b/toontown/parties/PartyCatchActivityToonSD.py @@ -109,7 +109,7 @@ class PartyCatchActivityToonSD(StateData.StateData): self.activity.orthoWalk.stop() self.accept(self.activity.rulesDoneEvent, self.handleRulesDone) self.rulesPanel = MinigameRulesPanel('PartyRulesPanel', self.activity.getTitle(), self.activity.getInstructions(), self.activity.rulesDoneEvent, PartyGlobals.DefaultRulesTimeout) - base.setCellsActive(base.bottomCells + [base.leftCells[0], base.rightCells[1]], False) + base.setCellsAvailable(base.bottomCells + [base.leftCells[0], base.rightCells[1]], False) self.rulesPanel.load() self.rulesPanel.enter() else: @@ -125,7 +125,7 @@ class PartyCatchActivityToonSD(StateData.StateData): self.rulesPanel.exit() self.rulesPanel.unload() del self.rulesPanel - base.setCellsActive(base.bottomCells + [base.leftCells[0], base.rightCells[1]], True) + base.setCellsAvailable(base.bottomCells + [base.leftCells[0], base.rightCells[1]], True) def enterNormal(self): self.notify.debug('enterNormal') diff --git a/toontown/parties/PartyCogActivityGui.py b/toontown/parties/PartyCogActivityGui.py index 99d03618..4b62767d 100755 --- a/toontown/parties/PartyCogActivityGui.py +++ b/toontown/parties/PartyCogActivityGui.py @@ -254,12 +254,12 @@ class PartyCogActivityGui(DirectObject): def disableToontownHUD(self): base.localAvatar.hideName() base.localAvatar.laffMeter.hide() - base.setCellsActive(base.bottomCells + [base.rightCells[1]], False) + base.setCellsAvailable(base.bottomCells + [base.rightCells[1]], False) def enableToontownHUD(self): base.localAvatar.showName() base.localAvatar.laffMeter.show() - base.setCellsActive(base.bottomCells + [base.rightCells[1]], True) + base.setCellsAvailable(base.bottomCells + [base.rightCells[1]], True) def setTeam(self, team): self.team = team diff --git a/toontown/parties/PublicPartyGui.py b/toontown/parties/PublicPartyGui.py index a0025bdb..f5ba382f 100755 --- a/toontown/parties/PublicPartyGui.py +++ b/toontown/parties/PublicPartyGui.py @@ -243,9 +243,9 @@ class PublicPartyGui(DirectFrame): return (list, label) def stash(self): - base.setCellsActive(base.bottomCells, 1) + base.setCellsAvailable(base.bottomCells, 1) DirectFrame.stash(self) def unstash(self): - base.setCellsActive(base.bottomCells, 0) + base.setCellsAvailable(base.bottomCells, 0) DirectFrame.unstash(self) diff --git a/toontown/quest/QuestChoiceGui.py b/toontown/quest/QuestChoiceGui.py index c3f1f640..ba9a6a9a 100755 --- a/toontown/quest/QuestChoiceGui.py +++ b/toontown/quest/QuestChoiceGui.py @@ -19,8 +19,8 @@ class QuestChoiceGui(DirectFrame): self.timer = ToontownTimer.ToontownTimer() self.timer.reparentTo(self) self.timer.setScale(0.3) - base.setCellsActive(base.leftCells, 0) - base.setCellsActive([base.bottomCells[0], base.bottomCells[1]], 0) + base.setCellsAvailable(base.leftCells, 0) + base.setCellsAvailable([base.bottomCells[0], base.bottomCells[1]], 0) def setQuests(self, quests, fromNpcId, timeout): for i in xrange(0, len(quests), 3): @@ -56,8 +56,8 @@ class QuestChoiceGui(DirectFrame): if questId != 0: if base.config.GetBool('want-qa-regression', 0): self.notify.info('QA-REGRESSION: CREATEATASK: Create A Task.') - base.setCellsActive(base.leftCells, 1) - base.setCellsActive([base.bottomCells[0], base.bottomCells[1]], 1) + base.setCellsAvailable(base.leftCells, 1) + base.setCellsAvailable([base.bottomCells[0], base.bottomCells[1]], 1) self.timer.stop() messenger.send('chooseQuest', [questId]) diff --git a/toontown/safezone/DistributedFishingSpot.py b/toontown/safezone/DistributedFishingSpot.py index 028ed44f..9eca5fe7 100755 --- a/toontown/safezone/DistributedFishingSpot.py +++ b/toontown/safezone/DistributedFishingSpot.py @@ -223,7 +223,7 @@ class DistributedFishingSpot(DistributedObject.DistributedObject): else: self.collSphere.setTangible(1) if self.avId == base.localAvatar.doId: - base.setCellsActive(base.bottomCells, 0) + base.setCellsAvailable(base.bottomCells, 0) self.localToonFishing = 1 if base.wantBingo: self.pond.setLocalToonSpot(self) @@ -240,8 +240,8 @@ class DistributedFishingSpot(DistributedObject.DistributedObject): self.__hideCastGui() if base.wantBingo: self.pond.setLocalToonSpot() - base.setCellsActive([base.bottomCells[1], base.bottomCells[2]], 1) - base.setCellsActive(base.rightCells, 1) + base.setCellsAvailable([base.bottomCells[1], base.bottomCells[2]], 1) + base.setCellsAvailable(base.rightCells, 1) place = base.cr.playGame.getPlace() if place: place.setState('walk') @@ -643,7 +643,7 @@ class DistributedFishingSpot(DistributedObject.DistributedObject): jar = self.castGui.find('**/jar') self.castGui.find('**/display_jar').reparentTo(jar) self.jar.reparentTo(jar) - base.setCellsActive(base.rightCells, 0) + base.setCellsAvailable(base.rightCells, 0) bucket.setScale(0.9) bucket.setX(-1.9) bucket.setZ(-.11) diff --git a/toontown/safezone/DistributedPicnicTable.py b/toontown/safezone/DistributedPicnicTable.py index de045bb7..cd01b482 100755 --- a/toontown/safezone/DistributedPicnicTable.py +++ b/toontown/safezone/DistributedPicnicTable.py @@ -500,10 +500,10 @@ class DistributedPicnicTable(DistributedNode.DistributedNode): self.tableclothSphereNode.setCollideMask(BitMask32(0)) def enterOff(self): - base.setCellsActive(base.leftCells + base.bottomCells, 0) + base.setCellsAvailable(base.leftCells + base.bottomCells, 0) def exitOff(self): - base.setCellsActive(base.bottomCells, 0) + base.setCellsAvailable(base.bottomCells, 0) def enterChooseMode(self): self.winTrack = Sequence(autoFinish=1) diff --git a/toontown/safezone/Playground.py b/toontown/safezone/Playground.py index d21788b9..ff918886 100755 --- a/toontown/safezone/Playground.py +++ b/toontown/safezone/Playground.py @@ -219,7 +219,7 @@ class Playground(Place.Place): self.loader.hood.startSky() lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) lightsOn.start() - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.zoneId = requestStatus['zoneId'] self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList) how = requestStatus['how'] @@ -243,7 +243,7 @@ class Playground(Place.Place): light.reparentTo(hidden) newsManager = base.cr.newsManager - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) for i in self.loader.nodeList: self.loader.exitAnimatedProps(i) diff --git a/toontown/suit/DistributedGoon.py b/toontown/suit/DistributedGoon.py index 48d676d6..f40b7bc4 100755 --- a/toontown/suit/DistributedGoon.py +++ b/toontown/suit/DistributedGoon.py @@ -183,8 +183,8 @@ class DistributedGoon(DistributedCrushableEntity.DistributedCrushableEntity, Goo Goon.Goon.delete(self) def enterOff(self, *args): - self.nametag.setNametag2d(None) - self.nametag.setNametag3d(None) + self.nametag3d.stash() + self.nametag.destroy() self.hide() self.isStunned = 0 self.isDead = 0 diff --git a/toontown/toon/DistributedNPCFisherman.py b/toontown/toon/DistributedNPCFisherman.py index 86c76998..150726fc 100755 --- a/toontown/toon/DistributedNPCFisherman.py +++ b/toontown/toon/DistributedNPCFisherman.py @@ -6,10 +6,9 @@ import time from DistributedNPCToonBase import * import NPCToons -from toontown.chat.ChatGlobals import * from toontown.fishing import FishSellGUI -from toontown.nametag.NametagGlobals import * from toontown.toonbase import TTLocalizer +from otp.nametag.NametagConstants import * class DistributedNPCFisherman(DistributedNPCToonBase): diff --git a/toontown/toon/DistributedNPCGlove.py b/toontown/toon/DistributedNPCGlove.py index e20f0fc4..3e9c5ba4 100755 --- a/toontown/toon/DistributedNPCGlove.py +++ b/toontown/toon/DistributedNPCGlove.py @@ -1,4 +1,4 @@ -from toontown.chat.ChatGlobals import CFSpeech, CFTimeout +from otp.nametag.NametagConstants import CFSpeech, CFTimeout from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.toon import NPCToons from DistributedNPCToonBase import DistributedNPCToonBase @@ -45,14 +45,14 @@ class DistributedNPCGlove(DistributedNPCToonBase): return base.cr.playGame.getPlace().fsm.request('stopped') - base.setCellsActive(base.bottomCells, 0) + base.setCellsAvailable(base.bottomCells, 0) self.setChatAbsolute(TTLocalizer.GlovePickColorMessage, CFSpeech|CFTimeout) self.acceptOnce('gloveShopDone', self.__gloveShopDone) self.gloveDialog = GloveShopGui.GloveShopGui() def freeAvatar(self): base.cr.playGame.getPlace().fsm.request('walk') - base.setCellsActive(base.bottomCells, 1) + base.setCellsAvailable(base.bottomCells, 1) def __gloveShopDone(self, state, glove): self.freeAvatar() diff --git a/toontown/toon/DistributedNPCKartClerk.py b/toontown/toon/DistributedNPCKartClerk.py index 6255979b..0e5f716c 100755 --- a/toontown/toon/DistributedNPCKartClerk.py +++ b/toontown/toon/DistributedNPCKartClerk.py @@ -4,11 +4,10 @@ from panda3d.core import * from DistributedNPCToonBase import * import NPCToons -from toontown.chat.ChatGlobals import * -from toontown.nametag.NametagGlobals import * from toontown.racing.KartShopGlobals import * from toontown.racing.KartShopGui import * from toontown.toonbase import TTLocalizer +from otp.nametag.NametagConstants import * class DistributedNPCKartClerk(DistributedNPCToonBase): diff --git a/toontown/toon/DistributedNPCLaffRestock.py b/toontown/toon/DistributedNPCLaffRestock.py index c8190294..56ca430b 100755 --- a/toontown/toon/DistributedNPCLaffRestock.py +++ b/toontown/toon/DistributedNPCLaffRestock.py @@ -1,6 +1,6 @@ from panda3d.core import * from direct.distributed import ClockDelta -from toontown.chat.ChatGlobals import CFSpeech, CFTimeout +from otp.nametag.NametagConstants import CFSpeech, CFTimeout from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.toontowngui import TTDialog from toontown.toon import NPCToons diff --git a/toontown/toon/DistributedNPCPartyPerson.py b/toontown/toon/DistributedNPCPartyPerson.py index 0bac45be..4acda0b5 100755 --- a/toontown/toon/DistributedNPCPartyPerson.py +++ b/toontown/toon/DistributedNPCPartyPerson.py @@ -5,7 +5,7 @@ from panda3d.core import * from DistributedNPCToonBase import DistributedNPCToonBase from otp.otpbase import OTPLocalizer -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.parties import PartyGlobals from toontown.toon import NPCToons from toontown.toonbase import TTLocalizer diff --git a/toontown/toon/DistributedNPCPetclerk.py b/toontown/toon/DistributedNPCPetclerk.py index f9d6c046..0a426c28 100755 --- a/toontown/toon/DistributedNPCPetclerk.py +++ b/toontown/toon/DistributedNPCPetclerk.py @@ -4,11 +4,10 @@ from panda3d.core import * from DistributedNPCToonBase import * import NPCToons -from toontown.chat.ChatGlobals import * from toontown.hood import ZoneUtil -from toontown.nametag.NametagGlobals import * from toontown.pets import PetshopGUI from toontown.toonbase import TTLocalizer +from otp.nametag.NametagConstants import * class DistributedNPCPetclerk(DistributedNPCToonBase): diff --git a/toontown/toon/DistributedNPCSpecialQuestGiver.py b/toontown/toon/DistributedNPCSpecialQuestGiver.py index 7c365759..f266a3d4 100755 --- a/toontown/toon/DistributedNPCSpecialQuestGiver.py +++ b/toontown/toon/DistributedNPCSpecialQuestGiver.py @@ -2,13 +2,12 @@ from direct.interval.IntervalGlobal import * from panda3d.core import * from DistributedNPCToonBase import * -from toontown.chat.ChatGlobals import * from toontown.hood import ZoneUtil -from toontown.nametag.NametagGlobals import * from toontown.quest import QuestChoiceGui from toontown.quest import QuestParser from toontown.quest import TrackChoiceGui from toontown.toonbase import TTLocalizer +from otp.nametag.NametagConstants import * ChoiceTimeout = 20 diff --git a/toontown/toon/DistributedNPCSpecialQuestGiverAI.py b/toontown/toon/DistributedNPCSpecialQuestGiverAI.py index 3a12bfc5..78f9634f 100755 --- a/toontown/toon/DistributedNPCSpecialQuestGiverAI.py +++ b/toontown/toon/DistributedNPCSpecialQuestGiverAI.py @@ -3,7 +3,6 @@ from direct.task.Task import Task from panda3d.core import * from DistributedNPCToonBaseAI import * from toontown.quest import Quests -from toontown.nametag.NametagGlobals import * class DistributedNPCSpecialQuestGiverAI(DistributedNPCToonBaseAI): diff --git a/toontown/toon/DistributedNPCTailor.py b/toontown/toon/DistributedNPCTailor.py index 6b0c2318..ae701637 100755 --- a/toontown/toon/DistributedNPCTailor.py +++ b/toontown/toon/DistributedNPCTailor.py @@ -6,7 +6,7 @@ from DistributedNPCToonBase import * import NPCToons import TailorClothesGUI import ToonDNA -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.estate import ClosetGlobals from toontown.toonbase import TTLocalizer diff --git a/toontown/toon/DistributedSmartNPC.py b/toontown/toon/DistributedSmartNPC.py index 5dcf8772..bc317894 100755 --- a/toontown/toon/DistributedSmartNPC.py +++ b/toontown/toon/DistributedSmartNPC.py @@ -1,9 +1,8 @@ from panda3d.core import * from DistributedNPCToonBase import * -from toontown.chat.ChatGlobals import * from toontown.hood import ZoneUtil -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * from toontown.quest import QuestChoiceGui from toontown.quest import QuestParser from toontown.quest import TrackChoiceGui diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 948616ad..6fc1b770 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -1211,10 +1211,11 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute realIndexToUse = 0 if type(index) == type(0) and 0 <= index and index < len(speedChatStyles): realIndexToUse = index + else: + base.cr.centralLogger.writeClientEvent('Hacker victim setSpeedChatStyleIndex invalid attacking toon = %d' % self.doId) self.speedChatStyleIndex = realIndexToUse nameKey, arrowColor, rolloverColor, frameColor = speedChatStyles[realIndexToUse] - self.nametag.setSpeedChatColor(VBase4(frameColor[0], frameColor[1], frameColor[2], 1)) - self.nametag.updateAll() + self.nametag.setQtColor(VBase4(frameColor[0], frameColor[1], frameColor[2], 1)) if self.isLocal(): messenger.send('SpeedChatStyleChange', []) @@ -1990,11 +1991,11 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute base.playSfx(dialogue, node=self) elif chatFlags & CFSpeech != 0: if self.nametag.getNumChatPages() > 0: - self.playDialogueForString(self.nametag.getChatText()) + self.playDialogueForString(self.nametag.getChat()) if self.soundChatBubble != None: base.playSfx(self.soundChatBubble, node=self) - elif self.nametag.getStompChatText(): - self.playDialogueForString(self.nametag.getStompChatText(), self.nametag.CHAT_STOMP_DELAY) + elif self.nametag.getChatStomp(): + self.playDialogueForString(self.nametag.getStompText(), self.nametag.getStompDelay()) def playDialogueForString(self, chatString, delay = 0.0): if len(chatString) == 0: diff --git a/toontown/toon/GroupPanel.py b/toontown/toon/GroupPanel.py index e7d7fe8c..d8636f55 100755 --- a/toontown/toon/GroupPanel.py +++ b/toontown/toon/GroupPanel.py @@ -1,7 +1,6 @@ from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -from toontown.nametag import NametagGlobals from direct.gui.DirectGui import * from panda3d.core import * from direct.showbase import DirectObject @@ -30,7 +29,7 @@ class GroupPanel(DirectObject.DirectObject): return def cleanup(self): - base.setCellsActive(base.leftCells, 1) + base.setCellsAvailable(base.leftCells, 1) self.quitButton.destroy() self.hideButton.destroy() self.showButton.destroy() @@ -103,9 +102,9 @@ class GroupPanel(DirectObject.DirectObject): self.__makeGoingToLabel() self.accept('updateGroupStatus', self.__checkGroupStatus) self.accept('ToonBattleIdUpdate', self.__possibleGroupUpdate) - base.setCellsActive([base.leftCells[1], base.leftCells[2]], 0) + base.setCellsAvailable([base.leftCells[1], base.leftCells[2]], 0) if self.boardingParty.isGroupLeader(localAvatar.doId): - base.setCellsActive([base.leftCells[0]], 0) + base.setCellsAvailable([base.leftCells[0]], 0) self.__addTestNames(self.boardingParty.maxSize) self.guiBg.removeNode() guiButtons.removeNode() diff --git a/toontown/toon/TTEmote.py b/toontown/toon/TTEmote.py index d89a6c33..666b7d40 100755 --- a/toontown/toon/TTEmote.py +++ b/toontown/toon/TTEmote.py @@ -77,7 +77,7 @@ def doSleep(toon, volume = 1): toon.openEyes() toon.startBlink() toon.setPlayRate(1, 'neutral') - if toon.nametag.getChatText() == TTLocalizer.ToonSleepString: + if toon.nametag.getChat() == TTLocalizer.ToonSleepString: toon.clearChat() toon.lerpLookAt(Point3(0, 1, 0), time=0.25) diff --git a/toontown/toon/Toon.py b/toontown/toon/Toon.py index ea2f5063..6e2f2ede 100755 --- a/toontown/toon/Toon.py +++ b/toontown/toon/Toon.py @@ -2023,9 +2023,9 @@ class Toon(Avatar.Avatar, ToonHead): self.openEyes() self.startBlink() if config.GetBool('stuck-sleep-fix', 1): - doClear = SLEEP_STRING in (self.nametag.getChatText(), self.nametag.getStompChatText()) + doClear = SLEEP_STRING in (self.nametag.getChat(), self.nametag.getStompText()) else: - doClear = self.nametag.getChatText() == SLEEP_STRING + doClear = self.nametag.getChat() == SLEEP_STRING if doClear: self.clearChat() self.lerpLookAt(Point3(0, 1, 0), time=0.25) @@ -2741,10 +2741,10 @@ class Toon(Avatar.Avatar, ToonHead): name = self.getName() suitDept = SuitDNA.suitDepts.index(SuitDNA.getSuitDept(suitType)) suitName = SuitBattleGlobals.SuitAttributes[suitType]['name'] - self.nametag.setText(TTLocalizer.SuitBaseNameWithLevel % {'name': name, + self.nametag.setDisplayName(TTLocalizer.SuitBaseNameWithLevel % {'name': name, 'dept': suitName, 'level': self.cogLevels[suitDept] + 1}) - self.nametag.setWordWrap(9.0) + self.nametag.setWordwrap(9.0) def takeOffSuit(self): if not self.isDisguised: @@ -3027,7 +3027,7 @@ class Toon(Avatar.Avatar, ToonHead): if self.headMeter: return - nodePath = NodePath(self.nametag.getIcon()) + nodePath = NodePath(self.nametag.getNameIcon()) if nodePath.isEmpty(): return @@ -3055,7 +3055,7 @@ class Toon(Avatar.Avatar, ToonHead): icons = loader.loadModel('phase_3/models/props/gm_icons') self.gmIcon = icons.find('**/access_level_%s' % access) - np = NodePath(self.nametag.getIcon()) + np = NodePath(self.nametag.getNameIcon()) if np.isEmpty() or not self.gmIcon: return @@ -3081,7 +3081,7 @@ class Toon(Avatar.Avatar, ToonHead): if self.partyHat: return - nodePath = NodePath(self.nametag.getIcon()) + nodePath = NodePath(self.nametag.getNameIcon()) if nodePath.isEmpty(): return diff --git a/toontown/toon/ToonAvatarPanel.py b/toontown/toon/ToonAvatarPanel.py index fe80f5cd..13ddc0f2 100755 --- a/toontown/toon/ToonAvatarPanel.py +++ b/toontown/toon/ToonAvatarPanel.py @@ -326,7 +326,7 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase): self.ignoreAll() if hasattr(self.avatar, 'bFake') and self.avatar.bFake: self.avatar.delete() - base.setCellsActive([base.rightCells[0]], 1) + base.setCellsAvailable([base.rightCells[0]], 1) AvatarPanelBase.AvatarPanelBase.cleanup(self) return @@ -479,7 +479,7 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase): self.groupButton['image'] = self.inviteImageList self.groupButton['state'] = DGG.NORMAL if base.config.GetBool('want-boarding-groups', 1): - base.setCellsActive([base.rightCells[0]], 0) + base.setCellsAvailable([base.rightCells[0]], 0) self.groupFrame.show() return diff --git a/toontown/uberdog/ClientServicesManager.py b/toontown/uberdog/ClientServicesManager.py index f2f62a83..eaec83bc 100755 --- a/toontown/uberdog/ClientServicesManager.py +++ b/toontown/uberdog/ClientServicesManager.py @@ -5,8 +5,8 @@ from panda3d.core import * from otp.distributed.PotentialAvatar import PotentialAvatar from otp.otpbase import OTPGlobals -from toontown.chat.ChatGlobals import WTSystem -from toontown.chat.WhisperPopup import WhisperPopup +from otp.nametag.NametagConstants import WTSystem +from otp.margins.WhisperPopup import WhisperPopup class ClientServicesManager(DistributedObjectGlobal): diff --git a/toontown/uberdog/DistributedPartyManager.py b/toontown/uberdog/DistributedPartyManager.py index 8e732f15..82607988 100755 --- a/toontown/uberdog/DistributedPartyManager.py +++ b/toontown/uberdog/DistributedPartyManager.py @@ -1,7 +1,7 @@ from direct.distributed.DistributedObject import DistributedObject from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal -from toontown.chat.ChatGlobals import * +from otp.nametag.NametagConstants import * from toontown.parties import PartyGlobals from toontown.toon import ToonDNA from toontown.toonbase import TTLocalizer From 6eaaed8056b13cc1364f4ab79eadf33db3eb19e3 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Fri, 26 Jun 2015 09:19:43 -0400 Subject: [PATCH 17/27] Another fix and Dan's nametag scaling. --- otp/nametag/Nametag3d.py | 3 ++- toontown/chat/ToontownChatManager.py | 2 +- toontown/estate/House.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/otp/nametag/Nametag3d.py b/otp/nametag/Nametag3d.py index 63ad5bab..18e9834a 100644 --- a/otp/nametag/Nametag3d.py +++ b/otp/nametag/Nametag3d.py @@ -6,9 +6,10 @@ import math class Nametag3d(Nametag): WANT_DYNAMIC_SCALING = True + MAX_SCALE = 2.5 SCALING_FACTOR = 0.055 SCALING_MINDIST = 1 - SCALING_MAXDIST = 50 + SCALING_MAXDIST = math.pow(MAX_SCALE / SCALING_FACTOR, 2) BILLBOARD_OFFSET = 3.0 SHOULD_BILLBOARD = True diff --git a/toontown/chat/ToontownChatManager.py b/toontown/chat/ToontownChatManager.py index 742740ef..4c4675c3 100755 --- a/toontown/chat/ToontownChatManager.py +++ b/toontown/chat/ToontownChatManager.py @@ -35,7 +35,7 @@ class ToontownChatManager(ChatManager.ChatManager): ChatManager.ChatManager.__init__(self, cr, localAvatar) self.chatInputSpeedChat = TTChatInputSpeedChat(self) self.normalPos = Vec3(0.25, 0, -0.196) - self.whisperPos = Vec3(0, 0, -0.296) + self.whisperPos = Vec3(0.25, 0, -0.28) self.speedChatPlusPos = Vec3(-0.35, 0, 0.71) self.SCWhisperPos = Vec3(0, 0, 0) self.chatInputWhiteList = TTChatInputWhiteList() diff --git a/toontown/estate/House.py b/toontown/estate/House.py index 885f310d..9c563998 100755 --- a/toontown/estate/House.py +++ b/toontown/estate/House.py @@ -77,7 +77,7 @@ class House(Place.Place): self.accept('doorDoneEvent', self.handleDoorDoneEvent) self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger) self._telemLimiter = TLGatherAllAvs('House', RotationLimitToH) - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) self.fsm.request(requestStatus['how'], [requestStatus]) def exit(self): @@ -87,7 +87,7 @@ class House(Place.Place): self._telemLimiter.destroy() del self._telemLimiter messenger.send('exitHouse') - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) def setState(self, state): if hasattr(self, 'fsm'): From 5c2b7f455473d1f3324521d7cb572b3439a0bc18 Mon Sep 17 00:00:00 2001 From: John Cote Date: Fri, 26 Jun 2015 15:44:51 -0400 Subject: [PATCH 18/27] Another fix --- toontown/minigame/DistributedTagGame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toontown/minigame/DistributedTagGame.py b/toontown/minigame/DistributedTagGame.py index 696beef7..b6cb437f 100755 --- a/toontown/minigame/DistributedTagGame.py +++ b/toontown/minigame/DistributedTagGame.py @@ -98,7 +98,7 @@ class DistributedTagGame(DistributedMinigame): camera.setPosHpr(0, -24, 16, 0, -30, 0) base.camLens.setFar(450.0) base.transitions.irisIn(0.4) - NametagGlobals.setWant2dNametags(True) + NametagGlobals.setMasterArrowsOn(1) DistributedSmoothNode.activateSmoothing(1, 1) self.IT = None @@ -110,7 +110,7 @@ class DistributedTagGame(DistributedMinigame): def offstage(self): self.notify.debug('offstage') DistributedSmoothNode.activateSmoothing(1, 0) - NametagGlobals.setWant2dNametags(False) + NametagGlobals.setMasterArrowsOn(0) DistributedMinigame.offstage(self) self.sky.reparentTo(hidden) self.ground.reparentTo(hidden) From 67d8bb1a1decdc29f40d6b3eff050c2efe6cd923 Mon Sep 17 00:00:00 2001 From: John Cote Date: Fri, 26 Jun 2015 19:15:02 -0400 Subject: [PATCH 19/27] Add back chat balloon animation. --- otp/nametag/Nametag.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/otp/nametag/Nametag.py b/otp/nametag/Nametag.py index ac1bf1e6..1f037e2d 100644 --- a/otp/nametag/Nametag.py +++ b/otp/nametag/Nametag.py @@ -3,6 +3,7 @@ import NametagGlobals from otp.margins.ClickablePopup import ClickablePopup from otp.otpbase import OTPGlobals from pandac.PandaModules import * +from direct.interval.IntervalGlobal import * class Nametag(ClickablePopup): CName = 1 @@ -108,7 +109,10 @@ class Nametag(ClickablePopup): self.DEFAULT_CHAT_WORDWRAP, button=self.getButton(), reversed=reversed) + balloon.setScale(0) balloon.reparentTo(self.innerNP) + scaleLerp = Sequence(Wait(0.10), LerpScaleInterval(balloon, 0.2, VBase3(1, 1, 1), VBase3(0, 0, 0), blendType='easeInOut')) + scaleLerp.start() self.frame = frame def showThought(self): From 3b9a4e882080b298cd0650baf2c98f488d374ac1 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 1 Jul 2015 13:15:05 +0300 Subject: [PATCH 20/27] Access level on nametag --- otp/avatar/Avatar.py | 24 +++++++++++++++++++----- otp/nametag/Nametag.py | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/otp/avatar/Avatar.py b/otp/avatar/Avatar.py index 6d423afa..97ced08e 100755 --- a/otp/avatar/Avatar.py +++ b/otp/avatar/Avatar.py @@ -127,6 +127,7 @@ class Avatar(Actor, ShadowCaster): self.nametag.setColorCode(self.playerType) else: self.nametag.setColorCode(NametagGroup.CCNoChat) + self.setNametagName() def considerUnderstandable(self): speed = 0 @@ -223,18 +224,31 @@ class Avatar(Actor, ShadowCaster): return self.avatarType def setName(self, name): - if hasattr(self, 'isDisguised'): - if self.isDisguised: - return + if hasattr(self, 'isDisguised') and self.isDisguised: + return + self.name = name + if hasattr(self, 'nametag'): - self.nametag.setName(name) + self.setNametagName() def setDisplayName(self, str): if hasattr(self, 'isDisguised'): if self.isDisguised: return - self.nametag.setDisplayName(str) + self.setNametagName(str) + + def setNametagName(self, name=None): + if not name: + name = self.name + + if hasattr(self, 'adminAccess') and self.isAdmin(): + access = self.getAdminAccess() + + if access in OTPLocalizer.AccessToString: + name += '\n\x01shadow\x01%s\x02' % OTPLocalizer.AccessToString[access] + + self.nametag.setDisplayName(name) def getFont(self): return self.__font diff --git a/otp/nametag/Nametag.py b/otp/nametag/Nametag.py index 1f037e2d..740a5513 100644 --- a/otp/nametag/Nametag.py +++ b/otp/nametag/Nametag.py @@ -133,7 +133,7 @@ class Nametag(ClickablePopup): t.node().setAlign(TextNode.ACenter) t.node().setWordwrap(self.wordWrap) t.node().setText(self.displayName) - t.setColor(self.nameFg) + t.node().setTextColor(self.nameFg) t.setTransparency(self.nameFg[3] < 1.0) width, height = t.node().getWidth(), t.node().getHeight() From b38f8472a5775b4080a9a1a3f2e9e84b8e866575 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 3 Jul 2015 17:46:21 +0300 Subject: [PATCH 21/27] Fixed a bunch of issues at once --- otp/avatar/Avatar.py | 45 +++++++++++---------------------- otp/nametag/Nametag.py | 9 ++++--- otp/nametag/NametagConstants.py | 3 ++- otp/nametag/NametagGroup.py | 1 + toontown/suit/SuitGlobals.py | 5 ++-- 5 files changed, 25 insertions(+), 38 deletions(-) diff --git a/otp/avatar/Avatar.py b/otp/avatar/Avatar.py index 97ced08e..fdae7e63 100755 --- a/otp/avatar/Avatar.py +++ b/otp/avatar/Avatar.py @@ -130,44 +130,29 @@ class Avatar(Actor, ShadowCaster): self.setNametagName() def considerUnderstandable(self): - speed = 0 - if self.playerType in (NametagGroup.CCNormal, NametagGroup.CCFreeChat, NametagGroup.CCSpeedChat): + if self.playerType in (NametagGroup.CCNormal, NametagGroup.CCSpeedChat): self.setPlayerType(NametagGroup.CCSpeedChat) - speed = 1 - if hasattr(base, 'localAvatar') and self == base.localAvatar: + if hasattr(base, 'localAvatar') and (self == base.localAvatar): self.understandable = 1 - self.setPlayerType(NametagGroup.CCFreeChat) + 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) - elif self.playerType not in (NametagGroup.CCNormal, NametagGroup.CCFreeChat, NametagGroup.CCSpeedChat): + elif self.playerType not in (NametagGroup.CCNormal, NametagGroup.CCSpeedChat): self.understandable = 1 - self.setPlayerType(NametagGroup.CCNoChat) - elif hasattr(base, 'localAvatar') and self.commonChatFlags & base.localAvatar.commonChatFlags & OTPGlobals.CommonChat: - self.understandable = 1 - self.setPlayerType(NametagGroup.CCFreeChat) - elif self.commonChatFlags & OTPGlobals.SuperChat: - self.understandable = 1 - self.setPlayerType(NametagGroup.CCFreeChat) - elif hasattr(base, 'localAvatar') and base.localAvatar.commonChatFlags & OTPGlobals.SuperChat: - self.understandable = 1 - self.setPlayerType(NametagGroup.CCFreeChat) - elif base.cr.getFriendFlags(self.doId) & OTPGlobals.FriendChat: - self.understandable = 1 - self.setPlayerType(NametagGroup.CCFreeChat) - elif base.cr.playerFriendsManager.findPlayerIdFromAvId(self.doId) is not None: - playerInfo = base.cr.playerFriendsManager.findPlayerInfoFromAvId(self.doId) - if playerInfo.openChatFriendshipYesNo: - self.understandable = 1 - self.nametag.setColorCode(NametagGroup.CCFreeChat) - elif playerInfo.isUnderstandable(): - self.understandable = 1 - else: - self.understandable = 0 - elif hasattr(base, 'localAvatar') and self.whitelistChatFlags & base.localAvatar.whitelistChatFlags: + self.setPlayerType(NametagGroup.CCNonPlayer) + elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId): + self.understandable = 2 + self.setPlayerType(NametagGroup.CCNormal) + elif settings['speedchatPlus']: self.understandable = 1 + self.setPlayerType(NametagGroup.CCSpeedChat) else: self.understandable = 0 + self.setPlayerType(NametagGroup.CCSpeedChat) if not hasattr(self, 'nametag'): self.notify.warning('no nametag attributed, but would have been used') else: @@ -248,7 +233,7 @@ class Avatar(Actor, ShadowCaster): if access in OTPLocalizer.AccessToString: name += '\n\x01shadow\x01%s\x02' % OTPLocalizer.AccessToString[access] - self.nametag.setDisplayName(name) + self.nametag.setName(name) def getFont(self): return self.__font diff --git a/otp/nametag/Nametag.py b/otp/nametag/Nametag.py index 740a5513..079a5dc4 100644 --- a/otp/nametag/Nametag.py +++ b/otp/nametag/Nametag.py @@ -109,10 +109,11 @@ class Nametag(ClickablePopup): self.DEFAULT_CHAT_WORDWRAP, button=self.getButton(), reversed=reversed) - balloon.setScale(0) balloon.reparentTo(self.innerNP) - scaleLerp = Sequence(Wait(0.10), LerpScaleInterval(balloon, 0.2, VBase3(1, 1, 1), VBase3(0, 0, 0), blendType='easeInOut')) - scaleLerp.start() + if self.IS_3D: + balloon.setScale(0) + scaleLerp = Sequence(Wait(0.10), LerpScaleInterval(balloon, 0.2, VBase3(1, 1, 1), VBase3(0, 0, 0), blendType='easeInOut')) + scaleLerp.start() self.frame = frame def showThought(self): @@ -157,4 +158,4 @@ class Nametag(ClickablePopup): self.frame = (t.node().getLeft()-self.NAME_PADDING/2.0, t.node().getRight()+self.NAME_PADDING/2.0, t.node().getBottom()-self.NAME_PADDING/2.0, - t.node().getTop()+self.NAME_PADDING/2.0) + t.node().getTop()+self.NAME_PADDING/2.0) \ No newline at end of file diff --git a/otp/nametag/NametagConstants.py b/otp/nametag/NametagConstants.py index b4c668f0..d0de16f3 100644 --- a/otp/nametag/NametagConstants.py +++ b/otp/nametag/NametagConstants.py @@ -175,7 +175,8 @@ DEFAULT_WORDWRAPS = { CCSuitBuilding: 8.5, CCHouseBuilding: 10.0, CCSpeedChat: 7.5, - CCFreeChat: 7.5 + CCFreeChat: 7.5, + CCAdmin: 7.5 } WTNormal = 0 diff --git a/otp/nametag/NametagGroup.py b/otp/nametag/NametagGroup.py index ea7af978..8f0a3e4f 100644 --- a/otp/nametag/NametagGroup.py +++ b/otp/nametag/NametagGroup.py @@ -13,6 +13,7 @@ class NametagGroup: CCHouseBuilding = CCHouseBuilding CCSpeedChat = CCSpeedChat CCFreeChat = CCFreeChat + CCAdmin = CCAdmin CHAT_TIMEOUT_MAX = 12.0 CHAT_TIMEOUT_MIN = 4.0 diff --git a/toontown/suit/SuitGlobals.py b/toontown/suit/SuitGlobals.py index 5c2d0c6c..0ca0258f 100755 --- a/toontown/suit/SuitGlobals.py +++ b/toontown/suit/SuitGlobals.py @@ -7,7 +7,6 @@ HAND_COLOR_INDEX = 1 # The hand color HEADS_INDEX = 2 # A list of heads HEAD_TEXTURE_INDEX = 3 # The texture to use for the head HEIGHT_INDEX = 4 # The height of the cog -NAMETAG_WRAP_INDEX = 5 # The nametag wrap for the cog aSize = 6.06 # Size of body type 'a' bSize = 5.29 # Size of body type 'b' @@ -23,7 +22,7 @@ suitProperties = {'f': (4.0 / cSize, SuitDNA.corpPolyColor, ['flunky', 'glasses' 'ds': (4.5 / bSize, SuitDNA.corpPolyColor, ['beancounter'], '', 6.08), 'hh': (6.5 / aSize, SuitDNA.corpPolyColor, ['headhunter'], '', 7.45), 'cr': (6.75 / cSize, VBase4(0.85, 0.55, 0.55, 1.0), ['flunky'], 'corporate-raider.jpg', 8.23), - 'tbc': (7.0 / aSize, VBase4(0.75, 0.95, 0.75, 1.0), ['bigcheese'], '', 9.34, 7), + 'tbc': (7.0 / aSize, VBase4(0.75, 0.95, 0.75, 1.0), ['bigcheese'], '', 9.34), # Lawbots 'bf': (4.0 / cSize, SuitDNA.legalPolyColor, ['tightwad'], 'bottom-feeder.jpg', 4.81), 'b': (4.375 / bSize, VBase4(0.95, 0.95, 1.0, 1.0), ['movershaker'], 'blood-sucker.jpg', 6.17), @@ -47,7 +46,7 @@ suitProperties = {'f': (4.0 / cSize, SuitDNA.corpPolyColor, ['flunky', 'glasses' 'tm': (3.75 / bSize, SuitDNA.salesPolyColor, ['telemarketer'], '', 5.24), 'nd': (4.35 / aSize, SuitDNA.salesPolyColor, ['numbercruncher'], 'name-dropper.jpg', 5.98), 'gh': (4.75 / cSize, SuitDNA.salesPolyColor, ['gladhander'], '', 6.4), - 'ms': (4.75 / bSize, SuitDNA.salesPolyColor, ['movershaker'], '', 6.7, 7), + 'ms': (4.75 / bSize, SuitDNA.salesPolyColor, ['movershaker'], '', 6.7), 'tf': (5.25 / aSize, SuitDNA.salesPolyColor, ['twoface'], '', 6.95), 'm': (5.75 / aSize, SuitDNA.salesPolyColor, ['twoface'], 'mingler.jpg', 7.61), 'mh': (7.0 / aSize, SuitDNA.salesPolyColor, ['yesman'], '', 8.95), From 5dbf692bae946d26e133aa24ddda4acc09c50bcc Mon Sep 17 00:00:00 2001 From: John Date: Fri, 3 Jul 2015 17:52:30 +0300 Subject: [PATCH 22/27] Fixed local toon's nametags --- toontown/toon/LocalToon.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 482d2043..cae3a741 100755 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -216,9 +216,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): def announceGenerate(self): self.startLookAround() - if base.wantNametags: - self.nametag.manage(base.marginManager) - DistributedToon.DistributedToon.announceGenerate(self) acceptingNewFriends = settings.get('acceptingNewFriends', {}) @@ -253,8 +250,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): if base.wantKarts: if hasattr(self, 'kartPage'): del self.kartPage - if base.wantNametags: - self.nametag.unmanage(base.marginManager) self.ignoreAll() DistributedToon.DistributedToon.disable(self) return From c1a7d64e43a60f8dd58d01116231c3161929fe54 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 3 Jul 2015 18:00:25 +0300 Subject: [PATCH 23/27] Fix cog suit display name --- otp/avatar/Avatar.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/otp/avatar/Avatar.py b/otp/avatar/Avatar.py index fdae7e63..a8317b93 100755 --- a/otp/avatar/Avatar.py +++ b/otp/avatar/Avatar.py @@ -226,6 +226,8 @@ class Avatar(Actor, ShadowCaster): def setNametagName(self, name=None): if not name: name = self.name + + self.nametag.setName(name) if hasattr(self, 'adminAccess') and self.isAdmin(): access = self.getAdminAccess() @@ -233,7 +235,7 @@ class Avatar(Actor, ShadowCaster): if access in OTPLocalizer.AccessToString: name += '\n\x01shadow\x01%s\x02' % OTPLocalizer.AccessToString[access] - self.nametag.setName(name) + self.nametag.setDisplayName(name) def getFont(self): return self.__font From 14658250e35ddf9169876a818a9ab1673816a6ba Mon Sep 17 00:00:00 2001 From: John Date: Fri, 3 Jul 2015 18:04:17 +0300 Subject: [PATCH 24/27] Fix Ambulance Chaser nametags in the margin --- otp/margins/MarginManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otp/margins/MarginManager.py b/otp/margins/MarginManager.py index dbbbb978..60f60bac 100644 --- a/otp/margins/MarginManager.py +++ b/otp/margins/MarginManager.py @@ -16,7 +16,7 @@ class MarginManager(PandaNode): cell = MarginCell(self) cell.reparentTo(a2d) cell.setScale(0.2) - cell.setPos(x, 0, y) + cell.setPos(x, 0, y + 0.025) cell.setAvailable(True) cell.setPythonTag('MarginCell', cell) From 1c8457992491be37fadbc8e12762407cdfdea0aa Mon Sep 17 00:00:00 2001 From: John Date: Fri, 3 Jul 2015 18:11:03 +0300 Subject: [PATCH 25/27] Fix trophy score --- toontown/toon/DistributedToon.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 6fc1b770..669d7465 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -1410,7 +1410,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.trophyStarSpeed = 0 if self.trophyScore >= ToontownGlobals.TrophyStarLevels[4]: self.trophyStar = loader.loadModel('phase_3.5/models/gui/name_star') - np = NodePath(self.nametag.getIcon()) + np = NodePath(self.nametag.getNameIcon()) self.trophyStar.reparentTo(np) self.trophyStar.setScale(2) self.trophyStar.setColor(ToontownGlobals.TrophyStarColors[4]) @@ -1419,7 +1419,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute taskMgr.add(self.__starSpin, self.uniqueName('starSpin')) elif self.trophyScore >= ToontownGlobals.TrophyStarLevels[2]: self.trophyStar = loader.loadModel('phase_3.5/models/gui/name_star') - np = NodePath(self.nametag.getIcon()) + np = NodePath(self.nametag.getNameIcon()) self.trophyStar.reparentTo(np) self.trophyStar.setScale(1.5) self.trophyStar.setColor(ToontownGlobals.TrophyStarColors[2]) @@ -1428,7 +1428,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute taskMgr.add(self.__starSpin, self.uniqueName('starSpin')) elif self.trophyScore >= ToontownGlobals.TrophyStarLevels[0]: self.trophyStar = loader.loadModel('phase_3.5/models/gui/name_star') - np = NodePath(self.nametag.getIcon()) + np = NodePath(self.nametag.getNameIcon()) self.trophyStar.reparentTo(np) self.trophyStar.setScale(1.5) self.trophyStar.setColor(ToontownGlobals.TrophyStarColors[0]) From 9b5d51f65fad35e3a1a58b755bb55f7215a5b856 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 3 Jul 2015 18:28:18 +0300 Subject: [PATCH 26/27] Fix loudrob's issue --- otp/nametag/Nametag.py | 27 +++++++++++++-------------- otp/nametag/Nametag2d.py | 4 ++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/otp/nametag/Nametag.py b/otp/nametag/Nametag.py index 079a5dc4..0984cc2d 100644 --- a/otp/nametag/Nametag.py +++ b/otp/nametag/Nametag.py @@ -66,7 +66,7 @@ class Nametag(ClickablePopup): pass # Does nothing by default. def clickStateChanged(self): - self.update() + self.update(False) def getButton(self): cs = self.getClickState() @@ -77,7 +77,7 @@ class Nametag(ClickablePopup): else: return self.buttons.get(0) - def update(self): + def update(self, scale=True): if self.colorCode in NAMETAG_COLORS: cc = self.colorCode else: @@ -87,11 +87,19 @@ class Nametag(ClickablePopup): self.innerNP.node().removeAllChildren() if self.contents & self.CThought and self.chatFlags & CFThought: - self.showThought() + balloon = self.showBalloon(self.getThoughtBalloon(), self.chatString) elif self.contents & self.CSpeech and self.chatFlags&CFSpeech: - self.showSpeech() + balloon = self.showBalloon(self.getSpeechBalloon(), self.chatString) elif self.contents & self.CName and self.displayName: self.showName() + return + else: + return + + if scale and self.IS_3D: + balloon.setScale(0) + scaleLerp = Sequence(Wait(0.10), LerpScaleInterval(balloon, 0.2, VBase3(1, 1, 1), VBase3(0, 0, 0), blendType='easeInOut')) + scaleLerp.start() def showBalloon(self, balloon, text): if not self.speechFont: @@ -110,17 +118,8 @@ class Nametag(ClickablePopup): button=self.getButton(), reversed=reversed) balloon.reparentTo(self.innerNP) - if self.IS_3D: - balloon.setScale(0) - scaleLerp = Sequence(Wait(0.10), LerpScaleInterval(balloon, 0.2, VBase3(1, 1, 1), VBase3(0, 0, 0), blendType='easeInOut')) - scaleLerp.start() self.frame = frame - - def showThought(self): - self.showBalloon(self.getThoughtBalloon(), self.chatString) - - def showSpeech(self): - self.showBalloon(self.getSpeechBalloon(), self.chatString) + return balloon def showName(self): if not self.font: diff --git a/otp/nametag/Nametag2d.py b/otp/nametag/Nametag2d.py index 0622fed5..3b485556 100644 --- a/otp/nametag/Nametag2d.py +++ b/otp/nametag/Nametag2d.py @@ -67,8 +67,8 @@ class Nametag2d(Nametag, MarginPopup): self.arrow.setScale(self.ARROW_SCALE) self.arrow.setColor(ARROW_COLORS.get(self.colorCode, self.nameFg)) - def update(self): - Nametag.update(self) + def update(self, scale=True): + Nametag.update(self, scale) self.considerUpdateClickRegion() def marginVisibilityChanged(self): From 1716707f2dfa9e6eb92253676ca8b060744b6204 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Fri, 3 Jul 2015 13:14:21 -0400 Subject: [PATCH 27/27] lazy --- toontown/suit/DistributedBossbotBoss.py | 4 ++++ toontown/toonbase/TTLocalizerEnglish.py | 1 + 2 files changed, 5 insertions(+) diff --git a/toontown/suit/DistributedBossbotBoss.py b/toontown/suit/DistributedBossbotBoss.py index 31b95016..dd43d104 100755 --- a/toontown/suit/DistributedBossbotBoss.py +++ b/toontown/suit/DistributedBossbotBoss.py @@ -67,6 +67,10 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def announceGenerate(self): global OneBossCog DistributedBossCog.DistributedBossCog.announceGenerate(self) + self.setName(TTLocalizer.BossbotBossName) + nameInfo = TTLocalizer.BossCogNameWithDept % {'name': self.name, + 'dept': SuitDNA.getDeptFullname(self.style.dept)} + self.setDisplayName(nameInfo) self.loadEnvironment() self.__makeResistanceToon() base.localAvatar.chatMgr.chatInputSpeedChat.addCEOMenu() diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 37a2c66c..9222cd78 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -4689,6 +4689,7 @@ MissingKeySanityCheck = 'Ignore me' SellbotBossName = 'Senior V. P.' CashbotBossName = 'C. F. O.' LawbotBossName = 'Chief Justice' +BossbotBossName = 'C. E. O.' BossCogNameWithDept = '%(name)s\n%(dept)s' BossCogPromoteDoobers = 'You are hereby promoted to full-fledged %s. Congratulations!' BossCogDoobersAway = {'s': 'Go! And make that sale!'}