historical/toontown-classic.git/toontown/suit/SuitDialog.py

34 lines
881 B
Python
Raw Normal View History

2024-01-16 11:20:27 -06:00
import random
from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPLocalizer
from toontown.toonbase import TTLocalizer
notify = DirectNotifyGlobal.directNotify.newCategory('SuitDialog')
def getBrushOffIndex(suitName):
if suitName in SuitBrushOffs:
brushoffs = SuitBrushOffs[suitName]
else:
brushoffs = SuitBrushOffs[None]
num = len(brushoffs)
chunk = 100 / num
randNum = random.randint(0, 99)
count = chunk
for i in xrange(num):
if randNum < count:
return i
count += chunk
notify.error('getBrushOffs() - no brush off found!')
return
def getBrushOffText(suitName, index):
if suitName in SuitBrushOffs:
brushoffs = SuitBrushOffs[suitName]
else:
brushoffs = SuitBrushOffs[None]
return brushoffs[index]
SuitBrushOffs = OTPLocalizer.SuitBrushOffs