TTC = 1
DD = 2
MM = 3
GS = 4
DG = 5
BR = 6
OZ = 7
DL = 8
DefaultWantNewsPageSetting = 1
gmMagicWordList = [
    'restock', 'restockUber', 'autoRestock', 'resistanceRestock',
    'restockSummons', 'uberDrop', 'rich', 'maxBankMoney', 'toonUp', 'rod',
    'cogPageFull', 'pinkSlips', 'Tickets', 'newSummons', 'who', 'who all'
]
NewsPageScaleAdjust = 0.85
AnimPropTypes = Enum(('Unknown', 'Hydrant', 'Mailbox', 'Trashcan'), start=-1)
EmblemTypes = Enum(('Silver', 'Gold'))
NumEmblemTypes = 2
DefaultMaxBankMoney = 15000
DefaultBankItemId = 1350
ToonAnimStates = set([
    'off', 'neutral', 'victory', 'Happy', 'Sad', 'Catching', 'CatchEating',
    'Sleep', 'walk', 'jumpSquat', 'jump', 'jumpAirborne', 'jumpLand', 'run',
    'swim', 'swimhold', 'dive', 'cringe', 'OpenBook', 'ReadBook', 'CloseBook',
    'TeleportOut', 'Died', 'TeleportedOut', 'TeleportIn', 'Emote', 'SitStart',
    'Sit', 'Push', 'Squish', 'FallDown', 'GolfPuttLoop', 'GolfRotateLeft',
    'GolfRotateRight', 'GolfPuttSwing', 'GolfGoodPutt', 'GolfBadPutt',
    'Flattened', 'CogThiefRunning', 'ScientistJealous', 'ScientistEmcee',
    'ScientistWork', 'ScientistLessWork', 'ScientistPlay'
])
AV_FLAG_REASON_TOUCH = 1
class TraitDistribution:
    TraitQuality = Enum('VERY_BAD, BAD, AVERAGE, GOOD, VERY_GOOD')
    TraitTypes = Enum('INCREASING, DECREASING')
    Sz2MinMax = None
    TraitType = None
    TraitCutoffs = {
        TraitTypes.INCREASING: {
            TraitQuality.VERY_BAD: 0.1,
            TraitQuality.BAD: 0.25,
            TraitQuality.GOOD: 0.75,
            TraitQuality.VERY_GOOD: 0.9
        },
        TraitTypes.DECREASING: {
            TraitQuality.VERY_BAD: 0.9,
            TraitQuality.BAD: 0.75,
            TraitQuality.GOOD: 0.25,
            TraitQuality.VERY_GOOD: 0.1
        }
    }

    def __init__(self, rndFunc=gaussian):
        self.rndFunc = rndFunc
        if not hasattr(self.__class__, 'GlobalMinMax'):
            _min = 1.0
            _max = 0.0
            minMax = self.Sz2MinMax
            for sz in minMax:
                thisMin, thisMax = minMax[sz]
                _min = min(_min, thisMin)
                _max = max(_max, thisMax)

            self.__class__.GlobalMinMax = [_min, _max]

    def getRandValue(self, szId, rng=random):
        min, max = self.getMinMax(szId)
        return self.rndFunc(min, max, rng)

    def getHigherIsBetter(self):
        return self.TraitType == TraitDistribution.TraitTypes.INCREASING

    def getMinMax(self, szId):
        return (self.Sz2MinMax[szId][0], self.Sz2MinMax[szId][1])

    def getGlobalMinMax(self):
        return (self.GlobalMinMax[0], self.GlobalMinMax[1])

    def _getTraitPercent(self, traitValue):
        gMin, gMax = self.getGlobalMinMax()
        if traitValue < gMin:
            gMin = traitValue
        elif traitValue > gMax:
            gMax = traitValue
        return (traitValue - gMin) / (gMax - gMin)

    def getPercentile(self, traitValue):
        if self.TraitType is TraitDistribution.TraitTypes.INCREASING:
            return self._getTraitPercent(traitValue)
        else:
            return 1.0 - self._getTraitPercent(traitValue)

    def getQuality(self, traitValue):
        TraitQuality = TraitDistribution.TraitQuality
        TraitCutoffs = self.TraitCutoffs[self.TraitType]
        percent = self._getTraitPercent(traitValue)
        if self.TraitType is TraitDistribution.TraitTypes.INCREASING:
            if percent <= TraitCutoffs[TraitQuality.VERY_BAD]:
                return TraitQuality.VERY_BAD
            elif percent <= TraitCutoffs[TraitQuality.BAD]:
                return TraitQuality.BAD
            elif percent >= TraitCutoffs[TraitQuality.VERY_GOOD]:
                return TraitQuality.VERY_GOOD
            elif percent >= TraitCutoffs[TraitQuality.GOOD]:
                return TraitQuality.GOOD
            else:
                return TraitQuality.AVERAGE
        elif percent <= TraitCutoffs[TraitQuality.VERY_GOOD]:
            return TraitQuality.VERY_GOOD
        elif percent <= TraitCutoffs[TraitQuality.GOOD]:
            return TraitQuality.GOOD
        elif percent >= TraitCutoffs[TraitQuality.VERY_BAD]:
            return TraitQuality.VERY_BAD
        elif percent >= TraitCutoffs[TraitQuality.BAD]:
            return TraitQuality.BAD
        else:
            return TraitQuality.AVERAGE

    def getExtremeness(self, traitValue):
        percent = self._getTraitPercent(traitValue)
        if percent < 0.5:
            howExtreme = (0.5 - percent) * 2.0
        else:
            howExtreme = (percent - 0.5) * 2.0
        return clampScalar(howExtreme, 0.0, 1.0)
Beispiel #3
0
NonPetSphereRadius = 5.0
PetSphereRadius = 3.0
UnstickSampleWindow = 20
UnstickCollisionThreshold = int(0.5 * UnstickSampleWindow)
PriorityFleeFromAvatar = 0.6
PriorityDefault = 1.0
PriorityChaseAv = 1.0
PriorityDebugLeash = 50.0
PriorityDoTrick = 100.0
PrimaryGoalDecayDur = 60.0
PrimaryGoalScale = 1.3
HungerChaseToonScale = 1.2
FleeFromOwnerScale = 0.5
GettingAttentionGoalScale = 1.2
GettingAttentionGoalScaleDur = 7.0
AnimMoods = Enum('EXCITED, SAD, NEUTRAL')
FwdSpeed = 12.0
RotSpeed = 360.0
_HappyMult = 1.0
HappyFwdSpeed = FwdSpeed * _HappyMult
HappyRotSpeed = RotSpeed * _HappyMult
_SadMult = 0.3
SadFwdSpeed = FwdSpeed * _SadMult
SadRotSpeed = RotSpeed * _SadMult
PETCLERK_TIMER = 180
PET_MOVIE_CLEAR = 0
PET_MOVIE_START = 1
PET_MOVIE_COMPLETE = 2
PET_MOVIE_FEED = 3
PET_MOVIE_SCRATCH = 4
PET_MOVIE_CALL = 5
Beispiel #4
0
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from toontown.minigame.OrthoDrive import OrthoDrive
from toontown.minigame.OrthoWalk import OrthoWalk
from toontown.parties.activityFSMs import DanceActivityFSM
from toontown.parties.PartyGlobals import ActivityIds, ActivityTypes
from toontown.parties.PartyGlobals import DancePatternToAnims, DanceAnimToName
from toontown.parties.DistributedPartyActivity import DistributedPartyActivity
from toontown.parties.PartyDanceActivityToonFSM import PartyDanceActivityToonFSM
from toontown.parties.PartyDanceActivityToonFSM import ToonDancingStates
from toontown.parties.KeyCodes import KeyCodes
from toontown.parties.KeyCodesGui import KeyCodesGui
from toontown.parties import PartyGlobals

DANCE_FLOOR_COLLISION = 'danceFloor_collision'
DanceViews = Enum(('Normal', 'Dancing', 'Isometric'))


class DistributedPartyDanceActivityBase(DistributedPartyActivity):
    notify = directNotify.newCategory('DistributedPartyDanceActivity')

    def __init__(self,
                 cr,
                 actId,
                 dancePatternToAnims,
                 model='phase_13/models/parties/danceFloor'):
        DistributedPartyActivity.__init__(self, cr, actId,
                                          ActivityTypes.Continuous)
        self.model = model
        self.danceFloor = None
        self.localToonDancing = False
from toontown.toonbase.ToonPythonUtil import Enum
from direct.gui.DirectGui import DirectFrame, DGG
from pandac.PandaModules import Vec2, VBase4D, LVecBase4f
from pandac.PandaModules import CardMaker, NodePath
from pandac.PandaModules import Texture, PNMImage
DEFAULT_MASK_RESOLUTION = 32
DEFAULT_RADIUS_RATIO = 0.05
MAP_RESOLUTION = 320
MazeRevealType = Enum(('SmoothCircle', 'HardCircle', 'Square'))
MAZE_REVEAL_TYPE = MazeRevealType.SmoothCircle


class MazeMapGui(DirectFrame):
    notify = directNotify.newCategory('MazeMapGui')

    def __init__(self,
                 mazeCollTable,
                 maskResolution=None,
                 radiusRatio=None,
                 bgColor=(0.8, 0.8, 0.8),
                 fgColor=(0.5, 0.5, 0.5, 1.0)):
        DirectFrame.__init__(self,
                             relief=None,
                             state=DGG.NORMAL,
                             sortOrder=DGG.BACKGROUND_SORT_INDEX)
        self.hide()
        self._bgColor = bgColor
        self._fgColor = fgColor
        self._mazeCollTable = mazeCollTable
        self._mazeWidth = len(self._mazeCollTable[0])
        self._mazeHeight = len(self._mazeCollTable)
from toontown.toonbase.ToonPythonUtil import Enum, invertDictLossless
from direct.interval.IntervalGlobal import *
import types
import random
Tricks = Enum('JUMP, BEG, PLAYDEAD, ROLLOVER, BACKFLIP, DANCE, SPEAK, BALK,')
NonHappyMinActualTrickAptitude = 0.1
NonHappyMaxActualTrickAptitude = 0.6
MinActualTrickAptitude = 0.5
MaxActualTrickAptitude = 0.97
AptitudeIncrementDidTrick = 0.0005
MaxAptitudeIncrementGotPraise = 0.0003
MaxTrickFatigue = 0.65
MinTrickFatigue = 0.1
ScId2trickId = {
    21200: Tricks.JUMP,
    21201: Tricks.BEG,
    21202: Tricks.PLAYDEAD,
    21203: Tricks.ROLLOVER,
    21204: Tricks.BACKFLIP,
    21205: Tricks.DANCE,
    21206: Tricks.SPEAK
}
TrickId2scIds = invertDictLossless(ScId2trickId)
TrickAnims = {
    Tricks.JUMP: 'jump',
    Tricks.BEG: ('toBeg', 'beg', 'fromBeg'),
    Tricks.PLAYDEAD: ('playDead', 'fromPlayDead'),
    Tricks.ROLLOVER: 'rollover',
    Tricks.BACKFLIP: 'backflip',
    Tricks.DANCE: 'dance',
    Tricks.SPEAK: 'speak',
Beispiel #7
0

def getEventName(zoneId):
    return 'PetObserve-%s' % zoneId


def send(zoneIds, petObserve):
    if petObserve.isValid():
        if type(zoneIds) not in (types.ListType, types.TupleType):
            zoneIds = [zoneIds]
        for zoneId in zoneIds:
            messenger.send(getEventName(zoneId), [petObserve])


Phrases = Enum(
    'HI, BYE, YES, NO, SOOTHE, PRAISE, CRITICISM, HAPPY,SAD, ANGRY, HURRY, QUESTION, FRIENDLY, LETS_PLAY,COME, FOLLOW_ME, STAY, NEED_LAFF, NEED_GAGS, NEED_JB,GO_AWAY, DO_TRICK,'
)
Actions = Enum(
    'FEED, SCRATCH,ATTENDED_START, ATTENDED_STOP,ATTENDING_START, ATTENDING_STOP,CHANGE_ZONE, LOGOUT,GARDEN'
)


class PetObserve:
    def isValid(self):
        return 1

    def isForgettable(self):
        return 0

    def _influence(self, petBrain):
        petBrain._handleGenericObserve(self)