def parseResponse(self): hardcoreRoninPattern = PatternManager.getOrCompilePattern('userInHardcoreRonin') ignoringPattern = PatternManager.getOrCompilePattern('userIgnoringUs') notEnoughItemsPattern = PatternManager.getOrCompilePattern('notEnoughItemsToSend') sentMessagePattern = PatternManager.getOrCompilePattern('messageSent') if hardcoreRoninPattern.search(self.responseText): raise Error.Error("Unable to send items or meat. User is in hardcore or ronin.", Error.USER_IN_HARDCORE_RONIN) elif ignoringPattern.search(self.responseText): raise Error.Error("Unable to send message. User is ignoring us.", Error.USER_IS_IGNORING) elif notEnoughItemsPattern.search(self.responseText): raise Error.Error("You don't have enough of one of the items you're trying to send.", Error.ITEM_NOT_FOUND) elif sentMessagePattern.search(self.responseText) == None: Report.alert("system", "Received unknown response when attempting to send a message.") Report.alert("system", self.responseText) raise Error.Error("Unknown error", Error.REQUEST_FATAL)
def parseResponse(self): hardcoreRoninPattern = PatternManager.getOrCompilePattern('userInHardcoreRonin') ignoringPattern = PatternManager.getOrCompilePattern('userIgnoringUs') notEnoughItemsPattern = PatternManager.getOrCompilePattern('notEnoughItemsToSend') sentMessagePattern = PatternManager.getOrCompilePattern('messageSent') if hardcoreRoninPattern.search(self.responseText): raise UserInHardcoreRoninError("Unable to send items or meat. User is in hardcore or ronin.") elif ignoringPattern.search(self.responseText): raise UserIsIgnoringError("Unable to send message. User is ignoring us.") elif notEnoughItemsPattern.search(self.responseText): raise NotEnoughItemsError("You don't have enough of one of the items you're trying to send.") elif sentMessagePattern.search(self.responseText) == None: Report.alert("system", "Received unknown response when attempting to send a message.") Report.alert("system", self.responseText) raise RequestError("Unknown error")
def parseResponse(self): hardcoreRoninPattern = PatternManager.getOrCompilePattern( 'userInHardcoreRonin') ignoringPattern = PatternManager.getOrCompilePattern('userIgnoringUs') notEnoughItemsPattern = PatternManager.getOrCompilePattern( 'notEnoughItemsToSend') sentMessagePattern = PatternManager.getOrCompilePattern('messageSent') trendyPattern = PatternManager.getOrCompilePattern( 'kmailNotSentUserTrendy') ignoringUserPattern = PatternManager.getOrCompilePattern( 'weAreIgnoringUser') if hardcoreRoninPattern.search(self.responseText): raise Error.Error( "Unable to send items or meat. User is in hardcore or ronin.", Error.USER_IN_HARDCORE_RONIN) elif ignoringPattern.search(self.responseText): raise Error.Error("Unable to send message. User is ignoring us.", Error.USER_IS_IGNORING) elif notEnoughItemsPattern.search(self.responseText): raise Error.Error( "You don't have enough of one of the items you're trying to send.", Error.ITEM_NOT_FOUND) elif trendyPattern.search(self.responseText): raise Error.Error( "Unable to send items or meat. User is too trendy.", Error.USER_IN_HARDCORE_RONIN) elif ignoringUserPattern.search(self.responseText): raise Error.Error( "Unable to send message. We are ignoring the other player.", Error.USER_IS_IGNORING) elif _badPlayerId.search(self.responseText): raise Error.Error("Cannot send Kmail. Bad userId.", Error.INVALID_USER) elif sentMessagePattern.search(self.responseText) == None: Report.alert( "system", "Received unknown response when attempting to send a message.") Report.alert("system", self.responseText) raise Error.Error("Unknown error", Error.REQUEST_FATAL)
def parseResponse(self): hardcoreRoninPattern = PatternManager.getOrCompilePattern( 'userInHardcoreRonin') ignoringPattern = PatternManager.getOrCompilePattern('userIgnoringUs') notEnoughItemsPattern = PatternManager.getOrCompilePattern( 'notEnoughItemsToSend') sentMessagePattern = PatternManager.getOrCompilePattern('messageSent') if hardcoreRoninPattern.search(self.responseText): raise UserInHardcoreRoninError( "Unable to send items or meat. User is in hardcore or ronin.") elif ignoringPattern.search(self.responseText): raise UserIsIgnoringError( "Unable to send message. User is ignoring us.") elif notEnoughItemsPattern.search(self.responseText): raise NotEnoughItemsError( "You don't have enough of one of the items you're trying to send." ) elif sentMessagePattern.search(self.responseText) == None: Report.alert( "system", "Received unknown response when attempting to send a message.") Report.alert("system", self.responseText) raise RequestError("Unknown error")