def update(self, NPCID, count=0, fCallable=0): oldNPCID = self['NPCID'] self['NPCID'] = NPCID if NPCID != oldNPCID: if self.NPCHead: self.NPCHead.detachNode() self.NPCHead.delete() if NPCID is None: self.showBack() return self.front.show() self.back.hide() self.NPCName['text'] = TTLocalizer.NPCToonNames[NPCID] self.NPCHead = self.createNPCToonHead(NPCID, dimension=self.NPCHeadDim) self.NPCHead.reparentTo(self.front) self.NPCHead.setZ(self.NPCHeadPosZ) track, level, hp, rarity = NPCToons.getNPCTrackLevelHpRarity(NPCID) sosText = self.sosTracks[track] if track == ToontownBattleGlobals.NPC_RESTOCK_GAGS: if level == -1: sosText += ' All' else: sosText += ' ' + self.sosTracks[level] # hide secret cards if NPCToons.isSecret(NPCID): sosText = '???' sosText = TextEncoder.upper(sosText) self.sosTypeInfo['text'] = sosText for i in range(self.maxRarity): if i < rarity: self.rarityStars[i].show() else: self.rarityStars[i].hide() if fCallable: self.sosCallButton.show() self.sosCountInfo.setPos(-0.4, 0, self.sosCountInfoPosZ) self.sosCountInfo['text_scale'] = self.sosCountInfoScale self.sosCountInfo['text_align'] = TextNode.ALeft else: self.sosCallButton.hide() self.sosCountInfo.setPos(0, 0, self.sosCountInfo2PosZ) self.sosCountInfo['text_scale'] = self.sosCountInfo2Scale self.sosCountInfo['text_align'] = TextNode.ACenter if count > 0: countText = TTLocalizer.NPCFriendPanelRemaining % count self.sosCallButton['state'] = DGG.NORMAL else: countText = 'Unavailable' self.sosCallButton['state'] = DGG.DISABLED self.sosCountInfo['text'] = countText return
def update(self, NPCID, count = 0, fCallable = 0): oldNPCID = self['NPCID'] self['NPCID'] = NPCID if NPCID != oldNPCID: if self.NPCHead: self.NPCHead.detachNode() self.NPCHead.delete() if NPCID is None: self.showBack() return self.front.show() self.back.hide() self.NPCName['text'] = TTLocalizer.NPCToonNames[NPCID] self.NPCHead = self.createNPCToonHead(NPCID, dimension=self.NPCHeadDim) self.NPCHead.reparentTo(self.front) self.NPCHead.setZ(self.NPCHeadPosZ) track, level, hp, rarity = NPCToons.getNPCTrackLevelHpRarity(NPCID) sosText = self.sosTracks[track] if track == ToontownBattleGlobals.NPC_RESTOCK_GAGS: if level == -1: sosText += ' All' else: sosText += ' ' + self.sosTracks[level] # hide secret cards if NPCToons.isSecret(NPCID): sosText = '???' sosText = TextEncoder.upper(sosText) self.sosTypeInfo['text'] = sosText for i in range(self.maxRarity): if i < rarity: self.rarityStars[i].show() else: self.rarityStars[i].hide() if fCallable: self.sosCallButton.show() self.sosCountInfo.setPos(-0.4, 0, self.sosCountInfoPosZ) self.sosCountInfo['text_scale'] = self.sosCountInfoScale self.sosCountInfo['text_align'] = TextNode.ALeft else: self.sosCallButton.hide() self.sosCountInfo.setPos(0, 0, self.sosCountInfo2PosZ) self.sosCountInfo['text_scale'] = self.sosCountInfo2Scale self.sosCountInfo['text_align'] = TextNode.ACenter if count > 0: countText = TTLocalizer.NPCFriendPanelRemaining % count self.sosCallButton['state'] = DGG.NORMAL else: countText = 'Unavailable' self.sosCallButton['state'] = DGG.DISABLED self.sosCountInfo['text'] = countText return
def update(self): friendList = sorted(self.friendDict.keys(), reverse=True, key=lambda id: NPCToons.getNPCTrackLevelHpRarity(id)[3]) cardNum = 0 for i in xrange(self.pos, self.pos + 16): card = self.cardList[cardNum] if len(friendList) > i: npcId = friendList[i] card.update(npcId, self.friendDict[npcId], self.callable) self.rightArrow.show() else: card.update(None, 0, self.callable) self.rightArrow.hide() cardNum += 1
def update(self): friendList = sorted( self.friendDict.keys(), reverse=True, key=lambda id: NPCToons.getNPCTrackLevelHpRarity(id)[3]) cardNum = 0 for i in xrange(self.pos, self.pos + 16): card = self.cardList[cardNum] if len(friendList) > i: npcId = friendList[i] card.update(npcId, self.friendDict[npcId], self.callable) self.rightArrow.show() else: card.update(None, 0, self.callable) self.rightArrow.hide() cardNum += 1
def update(self, NPCID, count=0, fCallable=0): # Record ID for next update oldNPCID = self['NPCID'] self['NPCID'] = NPCID if NPCID != oldNPCID: # Update things that only change when NPC ID changes if self.NPCHead: # New NPC, get rid of old head if it exists self.NPCHead.detachNode() self.NPCHead.delete() if NPCID is None: # Show back of card self.showBack() return # Show front of card self.front.show() self.back.hide() # Update labels self.NPCName['text'] = TTLocalizer.NPCToonNames[NPCID] # Creat new toon head self.NPCHead = self.createNPCToonHead(NPCID, dimension = 1.4) self.NPCHead.reparentTo(self.front) self.NPCHead.setZ(0.3) # Get details about toon track, level, hp, rarity = NPCToons.getNPCTrackLevelHpRarity(NPCID) # Update sos type info sosText = self.sosTracks[track] if track == ToontownBattleGlobals.NPC_RESTOCK_GAGS: # In this case level is the track being restocked if level == -1: sosText += " All" else: sosText += " " + self.sosTracks[level] sosText = TextEncoder.upper(sosText) self.sosTypeInfo['text'] = sosText # Update Rarity stars for i in range(self.maxRarity): if i < rarity: self.rarityStars[i].show() else: self.rarityStars[i].hide() if fCallable: self.sosCallButton.show() self.sosCountInfo.setPos(-0.4, 0, -1.54) self.sosCountInfo['text_scale'] = 0.28 self.sosCountInfo['text_align'] = TextNode.ALeft else: self.sosCallButton.hide() self.sosCountInfo.setPos(0, 0, -1.5) self.sosCountInfo['text_scale'] = 0.4 self.sosCountInfo['text_align'] = TextNode.ACenter if count > 0: countText = (TTLocalizer.NPCFriendPanelRemaining % (count)) self.sosCallButton['state'] = DGG.NORMAL else: countText = "Unavailable" self.sosCallButton['state'] = DGG.DISABLED self.sosCountInfo['text'] = countText