Merge branch 'develop' into friends

This commit is contained in:
John Cote 2021-07-09 12:35:28 -04:00
commit ae156a4b07
16 changed files with 29 additions and 23 deletions

View File

@ -23,7 +23,8 @@ class AIBase:
self.config = getConfigShowbase() self.config = getConfigShowbase()
__builtins__['__dev__'] = self.config.GetBool('want-dev', 0) __builtins__['__dev__'] = self.config.GetBool('want-dev', 0)
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1) __builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
logStackDump = (self.config.GetBool('log-stack-dump', (not __dev__)) or self.config.GetBool('ai-log-stack-dump', (not __dev__))) __builtins__['__execWarnings__'] = self.config.GetBool('want-exec-warnings', 0)
logStackDump = (self.config.GetBool('log-stack-dump', (not __debug__)) or self.config.GetBool('ai-log-stack-dump', (not __debug__)))
uploadStackDump = self.config.GetBool('upload-stack-dump', 0) uploadStackDump = self.config.GetBool('upload-stack-dump', 0)
if logStackDump or uploadStackDump: if logStackDump or uploadStackDump:
ExceptionVarDump.install(logStackDump, uploadStackDump) ExceptionVarDump.install(logStackDump, uploadStackDump)

View File

@ -72,7 +72,7 @@ AIMsgName2Id = {'STATESERVER_OBJECT_GENERATE_WITH_REQUIRED': 2001,
'DBSERVER_SET_STORED_VALUES': 1014, 'DBSERVER_SET_STORED_VALUES': 1014,
'SERVER_PING': 5002} 'SERVER_PING': 5002}
AIMsgId2Names = invertDictLossless(AIMsgName2Id) AIMsgId2Names = invertDictLossless(AIMsgName2Id)
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING AIMsgTypes: %s' % AIMsgName2Id) print('EXECWARNING AIMsgTypes: %s' % AIMsgName2Id)
printStack() printStack()
for name, value in list(AIMsgName2Id.items()): for name, value in list(AIMsgName2Id.items()):

View File

@ -100,16 +100,16 @@ class ChatInputNormal(DirectObject.DirectObject):
def __execMessage(self, message): def __execMessage(self, message):
if not ChatInputNormal.ExecNamespace: if not ChatInputNormal.ExecNamespace:
ChatInputNormal.ExecNamespace = {} ChatInputNormal.ExecNamespace = {}
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace) exec('from panda3d.core import *', globals(), self.ExecNamespace)
self.importExecNamespace() self.importExecNamespace()
try: try:
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputNormal eval: %s' % message) print('EXECWARNING ChatInputNormal eval: %s' % message)
printStack() printStack()
return str(eval(message, globals(), ChatInputNormal.ExecNamespace)) return str(eval(message, globals(), ChatInputNormal.ExecNamespace))
except SyntaxError: except SyntaxError:
try: try:
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputNormal exec: %s' % message) print('EXECWARNING ChatInputNormal exec: %s' % message)
printStack() printStack()
exec(message, globals(), ChatInputNormal.ExecNamespace) exec(message, globals(), ChatInputNormal.ExecNamespace)

View File

@ -130,13 +130,13 @@ class ChatInputTyped(DirectObject.DirectObject):
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace) exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
self.importExecNamespace() self.importExecNamespace()
try: try:
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputNormal eval: %s' % message) print('EXECWARNING ChatInputNormal eval: %s' % message)
printStack() printStack()
return str(eval(message, globals(), ChatInputTyped.ExecNamespace)) return str(eval(message, globals(), ChatInputTyped.ExecNamespace))
except SyntaxError: except SyntaxError:
try: try:
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputNormal exec: %s' % message) print('EXECWARNING ChatInputNormal exec: %s' % message)
printStack() printStack()
exec(message, globals(), ChatInputTyped.ExecNamespace) exec(message, globals(), ChatInputTyped.ExecNamespace)

View File

@ -285,16 +285,16 @@ class ChatInputWhiteListFrame(FSM.FSM, DirectFrame):
def __execMessage(self, message): def __execMessage(self, message):
if not ChatInputTyped.ExecNamespace: if not ChatInputTyped.ExecNamespace:
ChatInputTyped.ExecNamespace = {} ChatInputTyped.ExecNamespace = {}
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace) exec('from panda3d.core import *', globals(), self.ExecNamespace)
self.importExecNamespace() self.importExecNamespace()
try: try:
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputWhiteListFrame eval: %s' % message) print('EXECWARNING ChatInputWhiteListFrame eval: %s' % message)
printStack() printStack()
return str(eval(message, globals(), ChatInputTyped.ExecNamespace)) return str(eval(message, globals(), ChatInputTyped.ExecNamespace))
except SyntaxError: except SyntaxError:
try: try:
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputWhiteListFrame exec: %s' % message) print('EXECWARNING ChatInputWhiteListFrame exec: %s' % message)
printStack() printStack()
exec(message, globals(), ChatInputTyped.ExecNamespace) exec(message, globals(), ChatInputTyped.ExecNamespace)

View File

@ -249,16 +249,16 @@ class TalkAssistant(DirectObject.DirectObject):
print('execMessage %s' % message) print('execMessage %s' % message)
if not TalkAssistant.ExecNamespace: if not TalkAssistant.ExecNamespace:
TalkAssistant.ExecNamespace = {} TalkAssistant.ExecNamespace = {}
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace) exec('from panda3d.core import *', globals(), self.ExecNamespace)
self.importExecNamespace() self.importExecNamespace()
try: try:
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING TalkAssistant eval: %s' % message) print('EXECWARNING TalkAssistant eval: %s' % message)
printStack() printStack()
return str(eval(message, globals(), TalkAssistant.ExecNamespace)) return str(eval(message, globals(), TalkAssistant.ExecNamespace))
except SyntaxError: except SyntaxError:
try: try:
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING TalkAssistant exec: %s' % message) print('EXECWARNING TalkAssistant exec: %s' % message)
printStack() printStack()
exec(message, globals(), TalkAssistant.ExecNamespace) exec(message, globals(), TalkAssistant.ExecNamespace)

View File

@ -92,7 +92,7 @@ class LevelSpec:
def getCopyOfSpec(self, spec): def getCopyOfSpec(self, spec):
specCopy = {} specCopy = {}
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING LevelSpec exec: %s' % self.getSpecImportsModuleName()) print('EXECWARNING LevelSpec exec: %s' % self.getSpecImportsModuleName())
printStack() printStack()
exec('from %s import *' % self.getSpecImportsModuleName()) exec('from %s import *' % self.getSpecImportsModuleName())

View File

@ -11,6 +11,7 @@ class OTPBase(ShowBase):
self.wantEnviroDR = False self.wantEnviroDR = False
ShowBase.__init__(self, windowType=windowType) ShowBase.__init__(self, windowType=windowType)
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1) __builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
__builtins__['__execWarnings__'] = self.config.GetBool('want-exec-warnings', 0)
OTPBase.notify.info('__astron__ == %s' % __astron__) OTPBase.notify.info('__astron__ == %s' % __astron__)
if config.GetBool('want-phase-checker', 0): if config.GetBool('want-phase-checker', 0):
from direct.showbase import Loader from direct.showbase import Loader

View File

@ -5,7 +5,7 @@ TTAIMsgName2Id = {'DBSERVER_GET_ESTATE': 1040,
'IN_GAME_NEWS_MANAGER_UD_TO_ALL_AI': 1043, 'IN_GAME_NEWS_MANAGER_UD_TO_ALL_AI': 1043,
'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044} 'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044}
TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id) TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id)
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id) print('EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id)
printStack() printStack()
for name, value in list(TTAIMsgName2Id.items()): for name, value in list(TTAIMsgName2Id.items()):

View File

@ -175,7 +175,12 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame):
def applyFilter(self, keyArgs, strict = False): def applyFilter(self, keyArgs, strict = False):
text = self.chatEntry.get(plain=True) text = self.chatEntry.get(plain=True)
if len(text) > 0 and text[0] in ['~', '>']: prefixes = []
if base.cr.magicWordManager and base.cr.wantMagicWords:
prefixes.append(base.cr.magicWordManager.chatPrefix)
if config.GetBool('exec-chat', 0):
prefixes.append('>')
if len(text) > 0 and text[0] in prefixes:
self.okayToSubmit = True self.okayToSubmit = True
else: else:
words = text.split(' ') words = text.split(' ')

View File

@ -41,7 +41,7 @@ BossbotCountryClubMiddleRoomIDs = (2, 5, 6)
BossbotCountryClubFinalRoomIDs = (18,) BossbotCountryClubFinalRoomIDs = (18,)
BossbotCountryClubConnectorRooms = ('phase_12/models/bossbotHQ/Connector_Tunnel_A', 'phase_12/models/bossbotHQ/Connector_Tunnel_B') BossbotCountryClubConnectorRooms = ('phase_12/models/bossbotHQ/Connector_Tunnel_A', 'phase_12/models/bossbotHQ/Connector_Tunnel_B')
CashbotMintSpecModules = {} CashbotMintSpecModules = {}
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING CountryClubRoomSpecs: %s' % BossbotCountryClubRoomName2RoomId) print('EXECWARNING CountryClubRoomSpecs: %s' % BossbotCountryClubRoomName2RoomId)
printStack() printStack()
for roomName, roomId in list(BossbotCountryClubRoomName2RoomId.items()): for roomName, roomId in list(BossbotCountryClubRoomName2RoomId.items()):

View File

@ -62,7 +62,7 @@ CashbotMintMiddleRoomIDs = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1
CashbotMintFinalRoomIDs = (17, 18, 19, 20, 21, 22, 23, 24, 25) CashbotMintFinalRoomIDs = (17, 18, 19, 20, 21, 22, 23, 24, 25)
CashbotMintConnectorRooms = ('phase_10/models/cashbotHQ/connector_7cubeL2', 'phase_10/models/cashbotHQ/connector_7cubeR2') CashbotMintConnectorRooms = ('phase_10/models/cashbotHQ/connector_7cubeL2', 'phase_10/models/cashbotHQ/connector_7cubeR2')
CashbotMintSpecModules = {} CashbotMintSpecModules = {}
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING MintRoomSpecs: %s' % CashbotMintRoomName2RoomId) print('EXECWARNING MintRoomSpecs: %s' % CashbotMintRoomName2RoomId)
printStack() printStack()
for roomName, roomId in list(CashbotMintRoomName2RoomId.items()): for roomName, roomId in list(CashbotMintRoomName2RoomId.items()):

View File

@ -48,7 +48,7 @@ CashbotStageMiddleRoomIDs = (1,)
CashbotStageFinalRoomIDs = (2,) CashbotStageFinalRoomIDs = (2,)
CashbotStageConnectorRooms = ('phase_11/models/lawbotHQ/LB_connector_7cubeL2', 'phase_11/models/lawbotHQ/LB_connector_7cubeLR') CashbotStageConnectorRooms = ('phase_11/models/lawbotHQ/LB_connector_7cubeL2', 'phase_11/models/lawbotHQ/LB_connector_7cubeLR')
CashbotStageSpecModules = {} CashbotStageSpecModules = {}
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING StageRoomSpecs: %s' % CashbotStageRoomName2RoomId) print('EXECWARNING StageRoomSpecs: %s' % CashbotStageRoomName2RoomId)
printStack() printStack()
for roomName, roomId in list(CashbotStageRoomName2RoomId.items()): for roomName, roomId in list(CashbotStageRoomName2RoomId.items()):

View File

@ -785,7 +785,7 @@ class DistributedCannon(DistributedObject.DistributedObject):
if not self.toonHead: if not self.toonHead:
return Task.done return Task.done
flightResults = self.__calcFlightResults(avId, launchTime) flightResults = self.__calcFlightResults(avId, launchTime)
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING DistributedCannon: %s' % flightResults) print('EXECWARNING DistributedCannon: %s' % flightResults)
printStack() printStack()
for key in flightResults: for key in flightResults:

View File

@ -262,7 +262,7 @@ class DistributedPartyCannonActivity(DistributedPartyActivity):
if self.isLocalToonId(toonId): if self.isLocalToonId(toonId):
self.inWater = 0 self.inWater = 0
flightResults = self.__calcFlightResults(cannon, toonId, launchTime) flightResults = self.__calcFlightResults(cannon, toonId, launchTime)
if not isClient(): if not __debug__ or __execWarnings__:
print('EXECWARNING DistributedPartyCannonActivity: %s' % flightResults) print('EXECWARNING DistributedPartyCannonActivity: %s' % flightResults)
printStack() printStack()
for key in flightResults: for key in flightResults:

View File

@ -49,8 +49,7 @@ class ToontownMagicWordManager(DistributedObject.DistributedObject):
DistributedObject.DistributedObject.announceGenerate(self) DistributedObject.DistributedObject.announceGenerate(self)
# Only use a custom Magic Word activator if the index is allowed # Only use a custom Magic Word activator if the index is allowed
# TODO: Uncomment after adding settings support activatorIndex = base.settings.getSetting('magic-word-activator', 0)
activatorIndex = 0 # base.settings.getInt('game', 'magic-word-activator', 0)
if 0 <= activatorIndex <= (len(PREFIX_ALLOWED) - 1): if 0 <= activatorIndex <= (len(PREFIX_ALLOWED) - 1):
self.chatPrefix = PREFIX_ALLOWED[activatorIndex] self.chatPrefix = PREFIX_ALLOWED[activatorIndex]