mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-27 05:32:41 -06:00
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
|
from direct.showbase import PythonUtil
|
||
|
from otp.speedchat.SCMenu import SCMenu
|
||
|
from otp.speedchat.SCMenuHolder import SCMenuHolder
|
||
|
from toontown.chat import ResistanceChat
|
||
|
from TTSCResistanceTerminal import TTSCResistanceTerminal
|
||
|
|
||
|
class TTSCResistanceMenu(SCMenu):
|
||
|
|
||
|
def __init__(self):
|
||
|
SCMenu.__init__(self)
|
||
|
self.accept('resistanceMessagesChanged', self.__resistanceMessagesChanged)
|
||
|
self.__resistanceMessagesChanged()
|
||
|
submenus = []
|
||
|
|
||
|
def destroy(self):
|
||
|
SCMenu.destroy(self)
|
||
|
|
||
|
def clearMenu(self):
|
||
|
SCMenu.clearMenu(self)
|
||
|
|
||
|
def __resistanceMessagesChanged(self):
|
||
|
self.clearMenu()
|
||
|
try:
|
||
|
lt = base.localAvatar
|
||
|
except:
|
||
|
return
|
||
|
|
||
|
phrases = lt.resistanceMessages
|
||
|
for menuIndex in ResistanceChat.resistanceMenu:
|
||
|
menu = SCMenu()
|
||
|
for itemIndex in ResistanceChat.getItems(menuIndex):
|
||
|
textId = ResistanceChat.encodeId(menuIndex, itemIndex)
|
||
|
charges = lt.getResistanceMessageCharges(textId)
|
||
|
if charges > 0:
|
||
|
menu.append(TTSCResistanceTerminal(textId, charges))
|
||
|
|
||
|
textId = ResistanceChat.encodeId(menuIndex, 0)
|
||
|
menuName = ResistanceChat.getMenuName(textId)
|
||
|
self.append(SCMenuHolder(menuName, menu))
|