From 260e5af56f690f8724fd0fbabb9ff83ba5115b44 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Tue, 31 Mar 2015 08:16:01 -0400 Subject: [PATCH] oo[pssieisss --- config/release/dev.prc | 1 + toontown/chat/TTSequenceList.py | 36 ++++++++++++++++++++++++++ toontown/suit/DistributedSuitBaseAI.py | 3 ++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 toontown/chat/TTSequenceList.py diff --git a/config/release/dev.prc b/config/release/dev.prc index 7ac6a986..48c30c26 100644 --- a/config/release/dev.prc +++ b/config/release/dev.prc @@ -27,6 +27,7 @@ want-achievements #f # Chat: want-whitelist #f +want-blacklist-sequence #f # Cashbot boss: want-resistance-toonup #t diff --git a/toontown/chat/TTSequenceList.py b/toontown/chat/TTSequenceList.py new file mode 100644 index 00000000..bf467501 --- /dev/null +++ b/toontown/chat/TTSequenceList.py @@ -0,0 +1,36 @@ +from pandac.PandaModules import * +from otp.chat.SequenceList import SequenceList +from direct.directnotify import DirectNotifyGlobal + +class TTSequenceList(SequenceList): + + def __init__(self): + self.notify = DirectNotifyGlobal.directNotify.newCategory('TTSequenceList') + sequenceListURL = config.GetString('blacklist-sequence-url', '') + if sequenceListURL == '': + self.notify.warning('No Sequence BL URL specified! Continuing with local sequence.') + SequenceList.__init__(self, self.loadSquencesLocally()) + else: + SequenceList.__init__(self, self.downloadSequences(sequenceListURL)) + + def downloadSequences(self, url): + fs = Ramfile() + http = HTTPClient.getGlobalPtr() + self.ch = http.makeChannel(True) + self.ch.getHeader(DocumentSpec(url)) + doc = self.ch.getDocumentSpec() + self.ch.getDocument(doc) + self.ch.downloadToRam(fs) + return fs.getData().split('\r\n') + + def loadSquencesLocally(self): + vfs = VirtualFileSystem.getGlobalPtr() + filename = Filename('tsequence.dat') + searchPath = DSearchPath() + searchPath.appendDirectory(Filename('/server')) + found = vfs.resolveFilename(filename, searchPath) + if not found: + self.notify.warning("Couldn't find blacklist sequence data file!") + return + data = vfs.readFile(filename, True) + return data.split('\n') diff --git a/toontown/suit/DistributedSuitBaseAI.py b/toontown/suit/DistributedSuitBaseAI.py index 687bdc91..f11d1d6d 100644 --- a/toontown/suit/DistributedSuitBaseAI.py +++ b/toontown/suit/DistributedSuitBaseAI.py @@ -117,6 +117,7 @@ class DistributedSuitBaseAI(DistributedAvatarAI.DistributedAvatarAI, SuitBase.Su def useSkeleRevive(self): self.skeleRevives -= 1 self.currHP = self.maxHP + self.d_setHP(self.currHP) self.reviveFlag = 1 def reviveCheckAndClear(self): @@ -195,4 +196,4 @@ class DistributedSuitBaseAI(DistributedAvatarAI.DistributedAvatarAI, SuitBase.Su self.d_setWaiter(flag) def getWaiter(self): - return self.waiter \ No newline at end of file + return self.waiter