2019-11-02 22:27:54 +00: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):
|
2019-12-30 06:07:56 +00:00
|
|
|
if suitName in SuitBrushOffs:
|
2019-11-02 22:27:54 +00:00
|
|
|
brushoffs = SuitBrushOffs[suitName]
|
|
|
|
else:
|
|
|
|
brushoffs = SuitBrushOffs[None]
|
|
|
|
num = len(brushoffs)
|
|
|
|
chunk = 100 / num
|
|
|
|
randNum = random.randint(0, 99)
|
|
|
|
count = chunk
|
|
|
|
for i in range(num):
|
|
|
|
if randNum < count:
|
|
|
|
return i
|
|
|
|
count += chunk
|
|
|
|
|
|
|
|
notify.error('getBrushOffs() - no brush off found!')
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def getBrushOffText(suitName, index):
|
2019-12-30 06:07:56 +00:00
|
|
|
if suitName in SuitBrushOffs:
|
2019-11-02 22:27:54 +00:00
|
|
|
brushoffs = SuitBrushOffs[suitName]
|
|
|
|
else:
|
|
|
|
brushoffs = SuitBrushOffs[None]
|
|
|
|
return brushoffs[index]
|
|
|
|
|
|
|
|
|
|
|
|
SuitBrushOffs = OTPLocalizer.SuitBrushOffs
|