mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
District Reset Prevention.
This commit is contained in:
parent
b7d8cd0a3a
commit
6ac39df62a
2 changed files with 29 additions and 3 deletions
|
@ -132,7 +132,8 @@ CRBootedReasons = {100: 'You have been disconnected because someone else just lo
|
|||
102: 'You are not authorized to use administrator privileges.',
|
||||
103: 'You were banned by a moderator.\n\nBehave next time!',
|
||||
105: 'Toontown Stride is now temporarily closed for maintenance. Everyone who was playing has been disconnected from the game.\n\nFor more information, please visit the Toontown Stride website.',
|
||||
153: 'The district you were playing on has been reset. Everyone who was playing on that district has been disconnected. However, you should be able to connect again and go right back into the game.'}
|
||||
153: 'The district you were playing on has been reset. Everyone who was playing on that district has been disconnected. However, you should be able to connect again and go right back into the game.',
|
||||
166: 'You were disconnected to prevent a district reset.'}
|
||||
CRBootedReasonUnknownCode = 'An unexpected problem has occurred (error code %s). Your connection has been lost, but you should be able to connect again and go right back into the game.'
|
||||
CRTryConnectAgain = '\n\nTry to connect again?'
|
||||
CRToontownUnavailable = 'The server appears to be temporarily unavailable, still trying...'
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
from direct.distributed.AstronInternalRepository import AstronInternalRepository
|
||||
from otp.distributed.OtpDoGlobals import *
|
||||
from toontown.distributed.ToontownNetMessengerAI import ToontownNetMessengerAI
|
||||
from direct.distributed.PyDatagram import PyDatagram
|
||||
import traceback
|
||||
import sys
|
||||
|
||||
class ToontownInternalRepository(AstronInternalRepository):
|
||||
GameGlobalsId = OTP_DO_ID_TOONTOWN
|
||||
|
@ -32,13 +35,35 @@ class ToontownInternalRepository(AstronInternalRepository):
|
|||
AstronInternalRepository.handleDatagram(self, di)
|
||||
|
||||
def getAvatarIdFromSender(self):
|
||||
return self.getMsgSender() & 0xFFFFFFFF
|
||||
return int(self.getMsgSender() & 0xFFFFFFFF)
|
||||
|
||||
def getAccountIdFromSender(self):
|
||||
return (self.getMsgSender()>>32) & 0xFFFFFFFF
|
||||
return int((self.getMsgSender()>>32) & 0xFFFFFFFF)
|
||||
|
||||
def _isValidPlayerLocation(self, parentId, zoneId):
|
||||
if zoneId < 1000 and zoneId != 1:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def readerPollOnce(self):
|
||||
try:
|
||||
return AstronInternalRepository.readerPollOnce(self)
|
||||
|
||||
except SystemExit, KeyboardInterrupt:
|
||||
raise
|
||||
|
||||
except Exception as e:
|
||||
if self.getAvatarIdFromSender() > 100000000:
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(self.getMsgSender(), self.ourChannel, CLIENTAGENT_EJECT)
|
||||
dg.addUint16(166)
|
||||
dg.addString('You were disconnected to prevent a district reset.')
|
||||
self.send(dg)
|
||||
|
||||
self.writeServerEvent('INTERNAL-EXCEPTION', self.getAvatarIdFromSender(), self.getAccountIdFromSender(), repr(e), traceback.format_exc())
|
||||
self.notify.warning('INTERNAL-EXCEPTION: %s (%s)' % (repr(e), self.getAvatarIdFromSender()))
|
||||
print traceback.format_exc()
|
||||
sys.exc_clear()
|
||||
|
||||
return 1
|
||||
|
|
Loading…
Reference in a new issue