def load(self): oneCard = loader.loadModel( 'phase_4/models/minigames/garden_sign_memory') prop = self.attachNewNode('prop') PlayingCardGlobals.getImage(self.style, self.suit, self.rank).copyTo(prop) prop.setScale(7) oneCard.find('**/glow').removeNode() cs = oneCard.find('**/collision') for solidIndex in range(cs.node().getNumSolids()): cs.node().modifySolid(solidIndex).setTangible(False) cs.node().setName('cardCollision-%d' % self.value) sign = oneCard.find('**/sign1') if self.UseDifferentCardColors: index = self.rank % len(self.CardColors) color = self.CardColors[index] sign.setColorScale(*color) prop.setPos(0.0, 0.0, 0.08) prop.setP(-90) prop.reparentTo(oneCard) oneCard.reparentTo(self) cardBack = oneCard.find('**/sign2') cardBack.setColorScale(0.12, 0.35, 0.5, 1.0) cardModel = loader.loadModel('phase_3.5/models/gui/playingCard') cardModel.removeNode() self.setR(0) self.setScale(2.5) self.flipIval = None self.turnUpSound = base.loadSfx( 'phase_4/audio/sfx/MG_pairing_card_flip_face_up.ogg') self.turnDownSound = base.loadSfx( 'phase_4/audio/sfx/MG_pairing_card_flip_face_down.ogg') return
def load(self): """Load the assets.""" # these are just temp assets oneCard = loader.loadModel( "phase_4/models/minigames/garden_sign_memory") # grab the gag icon prop = self.attachNewNode('prop') PlayingCardGlobals.getImage(self.style, self.suit, self.rank).copyTo(prop) prop.setScale(7) # remove the bits we don't want oneCard.find('**/glow').removeNode() #oneCard.find('**/shadow').removeNode() # munge the collision to fit just the sign cs = oneCard.find('**/collision') #cs.setScale(1, 1.0, 0.5) #cs.setPos(0,0, 0.9) for solidIndex in range(cs.node().getNumSolids()): cs.node().modifySolid(solidIndex).setTangible(False) cs.node().setName('cardCollision-%d' % self.value) # munge the sign to fit the rank sign = oneCard.find('**/sign1') if self.UseDifferentCardColors: index = self.rank % len(self.CardColors) color = self.CardColors[index] sign.setColorScale(*color) # set up the prop that shows which tree it is prop.setPos(0.0, 0.0, 0.08) prop.setP(-90) prop.reparentTo(oneCard) oneCard.reparentTo(self) #set up the back of the card cardBack = oneCard.find('**/sign2') cardBack.setColorScale(0.12, 0.35, 0.5, 1.0) cardModel = loader.loadModel('phase_3.5/models/gui/playingCard') logo = cardModel.find('**/logo') logo.reparentTo(self) logo.setScale(0.45) logo.setP(90) logo.setZ(0.025) logo.setX(-0.05) logo.setH(180) cardModel.remove() self.setR(0) # the default value is face Up self.setScale(2.5) self.flipIval = None self.turnUpSound = base.loadSfx( "phase_4/audio/sfx/MG_pairing_card_flip_face_up.mp3") self.turnDownSound = base.loadSfx( "phase_4/audio/sfx/MG_pairing_card_flip_face_down.mp3")
def setImage(self): if self.faceUp: image = PlayingCardGlobals.getImage(self.style, self.suit, self.rank) else: image = PlayingCardGlobals.getBack(self.style) self['image'] = image
def setImage(self): if self.faceUp: image = PlayingCardGlobals.getImage(self.style, self.suit, self.rank) else: image = PlayingCardGlobals.getBack(self.style) if self.image: self.image.removeNode() self.image = image.copyTo(self)
def dropTier1(): chance5 = random.randrange(1, 6, 1) chance4 = random.randrange(1, 5, 1) if chance5 == 5: rank = '08' else: if chance5 == 4: rank = '07' else: if chance5 == 3: rank = '06' else: if chance5 == 2: rank = '05' else: rank = '04' if chance4 == 4: suit = 's' else: if chance4 == 3: suit = 'c' else: if chance4 == 2: suit = 'd' else: suit = 'h' return PlayingCardGlobals.getCardEncoding(suit, rank)
def load(self): oneCard = loader.loadModel('phase_4/models/minigames/garden_sign_memory') prop = self.attachNewNode('prop') PlayingCardGlobals.getImage(self.style, self.suit, self.rank).copyTo(prop) prop.setScale(7) oneCard.find('**/glow').removeNode() cs = oneCard.find('**/collision') for solidIndex in xrange(cs.node().getNumSolids()): cs.node().modifySolid(solidIndex).setTangible(False) cs.node().setName('cardCollision-%d' % self.value) sign = oneCard.find('**/sign1') if self.UseDifferentCardColors: index = self.rank % len(self.CardColors) color = self.CardColors[index] sign.setColorScale(*color) prop.setPos(0.0, 0.0, 0.08) prop.setP(-90) prop.reparentTo(oneCard) oneCard.reparentTo(self) cardBack = oneCard.find('**/sign2') cardBack.setColorScale(0.12, 0.35, 0.5, 1.0) cardModel = loader.loadModel('phase_3.5/models/gui/playingCard') logo = cardModel.find('**/logo') logo.reparentTo(self) logo.setScale(0.45) logo.setP(90) logo.setZ(0.025) logo.setX(-0.05) logo.setH(180) cardModel.removeNode() self.setR(0) self.setScale(2.5) self.flipIval = None self.turnUpSound = base.loadSfx('phase_4/audio/sfx/MG_pairing_card_flip_face_up.ogg') self.turnDownSound = base.loadSfx('phase_4/audio/sfx/MG_pairing_card_flip_face_down.ogg') return
def dropTier3(): chance2 = random.randrange(1, 3, 1) chance4 = random.randrange(1, 5, 1) if chance2 == 2: rank = '01' else: rank = '13' if chance4 == 4: suit = 's' elif chance4 == 3: suit = 'c' elif chance4 == 2: suit = 'd' else: suit = 'h' return PlayingCardGlobals.getCardEncoding(suit, rank)
def dropTier0(): chance100 = random.randrange(1, 100, 1) chance4 = random.randrange(1, 5, 1) if chance100 > chanceOfHigherCard: rank = '03' else: rank = '02' if chance4 == 4: suit = 's' elif chance4 == 3: suit = 'c' elif chance4 == 2: suit = 'd' else: suit = 'h' return PlayingCardGlobals.getCardEncoding(suit, rank)
def cheatResponse(self, cheatType, cheatTarget, success, hand): swap = False if cheatType == PlayingCardGlobals.ReplaceHoleCardOneCheat: self.setLocalAvatarHand(hand) swap = True else: if cheatType == PlayingCardGlobals.ReplaceHoleCardTwoCheat: self.setLocalAvatarHand(hand) swap = True else: if cheatType == PlayingCardGlobals.CaughtCheating: self.guiCallback(PlayingCardGlobals.Leave) self.deleteDialogs() string = PLocalizer.PokerCaughtCheatingMessage % PlayingCardGlobals.CheatingFine self.dialog = PDialog.PDialog(text=string, style=OTPDialog.Acknowledge, command=self.dialogCallback) self.setDialogBin(self.dialog) if self.gui: if swap: if success: string = PLocalizer.PokerSwapSuccessMessage else: string = PLocalizer.PokerSwapFailureMessage self.swapResultDialog = PDialog.PDialog( text=string, style=OTPDialog.Acknowledge, giveMouse=False, command=self.swapResultCallback) self.setDialogBin(self.swapResultDialog) position = self.swapResultDialog.getPos() position.setZ(position[2] + 0.35) self.swapResultDialog.setPos(position) self.gui.updateSplitAndDoubleDown(hand) self.gui.updatePlayButtions() self.setTableState(self.allHands, self.chipsCount) value = PlayingCardGlobals.getBlackjackHandValue(hand) if value >= 21: self.gui.disableAllPlayButtons() self.gui.endTimer() self.guiCallback(PlayingCardGlobals.AutoStay) if self.isLocalAvatarSeated(): actor = self.isLocalAvatarPlaying() and self.actors[ self.localAvatarSeat] actor and actor.play('cards_cheat')
def dropTier2(): chanceSuit4 = random.randrange(1, 5, 1) chance4 = random.randrange(1, 5, 1) if chanceSuit4 == 4: rank = '12' elif chanceSuit4 == 3: rank = '11' elif chanceSuit4 == 2: rank = '10' else: rank = '09' if chance4 == 4: suit = 's' elif chance4 == 3: suit = 'c' elif chance4 == 2: suit = 'd' else: suit = 'h' return PlayingCardGlobals.getCardEncoding(suit, rank)
def dropTier1(): chance5 = random.randrange(1, 6, 1) chance4 = random.randrange(1, 5, 1) if chance5 == 5: rank = '08' elif chance5 == 4: rank = '07' elif chance5 == 3: rank = '06' elif chance5 == 2: rank = '05' else: rank = '04' if chance4 == 4: suit = 's' elif chance4 == 3: suit = 'c' elif chance4 == 2: suit = 'd' else: suit = 'h' return PlayingCardGlobals.getCardEncoding(suit, rank)
def cheatResponse(self, cheatType, cheatTarget, success, hand): swap = False if cheatType == PlayingCardGlobals.ReplaceHoleCardOneCheat: self.setLocalAvatarHand(hand) swap = True elif cheatType == PlayingCardGlobals.ReplaceHoleCardTwoCheat: self.setLocalAvatarHand(hand) swap = True elif cheatType == PlayingCardGlobals.CaughtCheating: self.guiCallback(PlayingCardGlobals.Leave) self.deleteDialogs() string = PLocalizer.PokerCaughtCheatingMessage % PlayingCardGlobals.CheatingFine self.dialog = PDialog.PDialog(text = string, style = OTPDialog.Acknowledge, command = self.dialogCallback) self.setDialogBin(self.dialog) if self.gui and swap: if success: string = PLocalizer.PokerSwapSuccessMessage else: string = PLocalizer.PokerSwapFailureMessage self.swapResultDialog = PDialog.PDialog(text = string, style = OTPDialog.Acknowledge, giveMouse = False, command = self.swapResultCallback) self.setDialogBin(self.swapResultDialog) position = self.swapResultDialog.getPos() position.setZ(position[2] + 0.34999999999999998) self.swapResultDialog.setPos(position) self.gui.updateSplitAndDoubleDown(hand) self.gui.updatePlayButtions() self.setTableState(self.allHands, self.chipsCount) value = PlayingCardGlobals.getBlackjackHandValue(hand) if value >= 21: self.gui.disableAllPlayButtons() self.gui.endTimer() self.guiCallback(PlayingCardGlobals.AutoStay) if self.isLocalAvatarSeated() and self.isLocalAvatarPlaying(): actor = self.actors[self.localAvatarSeat] if actor: actor.play('cards_cheat')
def getCardName(self): PlayingCardGlobals.getCardName(self.value)