Esempio n. 1
0
 def __init__(self, *args, **kwargs):
     PokerClientFactory.__init__(self, *args, **kwargs)
     self.protocol = PokerBotProtocol
     self.join_info = kwargs["join_info"]
     self.serial = kwargs["serial"]
     settings = kwargs["settings"]
     self.level = settings.headerGetInt("/settings/@level")
     self.reconnect = settings.headerGet("/settings/@reconnect") == "yes"
     self.rebuy = settings.headerGet("/settings/@rebuy") == "yes"
     self.watch = settings.headerGet("/settings/@watch") == "yes"
     self.cash_in = settings.headerGet("/settings/@cash_in") != "no"
     self.wait = settings.headerGetInt("/settings/@wait")
     self.disconnect_delay = settings.headerGet("/settings/@disconnect_delay")
     if self.disconnect_delay:
         self.disconnect_delay = tuple(map(lambda x: int(x), split(self.disconnect_delay, ",")))
     self.reconnect_delay = settings.headerGet("/settings/@reconnect_delay")
     if self.reconnect_delay:
         self.reconnect_delay = tuple(map(lambda x: int(x), split(self.reconnect_delay, ",")))
     self.currency = settings.headerGetInt("/settings/currency")
     self.currency_id = settings.headerGet("/settings/currency/@id")
     self.verbose = settings.headerGetInt("/settings/@verbose")
     self.bot = None
     self.went_broke = False
     self.disconnected_volontarily = False
     self.can_disconnect = True
     self.name = PokerBotFactory.string_generator.getName()
     self.password = PokerBotFactory.string_generator.getPassword()
Esempio n. 2
0
 def __init__(self, *args, **kwargs):
     self.log = PokerBotFactory.log.get_instance(self, refs=[
         ("User", self, lambda factory: factory.serial if factory.serial else None)
     ])
     self.serial = kwargs["serial"]
     PokerClientFactory.__init__(self, *args, **kwargs)
     self.protocol = PokerBotProtocol
     self.join_info = kwargs["join_info"]
     settings = kwargs["settings"]
     self.level = settings.headerGetInt("/settings/@level")
     self.reconnect = settings.headerGet("/settings/@reconnect") == "yes"
     self.rebuy = settings.headerGet("/settings/@rebuy") == "yes"
     self.watch = settings.headerGet("/settings/@watch") == "yes"
     self.cash_in = settings.headerGet("/settings/@cash_in") != "no"
     self.wait = settings.headerGetInt("/settings/@wait")
     self.disconnect_delay = settings.headerGet("/settings/@disconnect_delay")
     if self.disconnect_delay:
         self.disconnect_delay = tuple(map(int, self.disconnect_delay.split(',')))
     self.reconnect_delay = settings.headerGet("/settings/@reconnect_delay")
     if self.reconnect_delay:
         self.reconnect_delay = tuple(map(int, self.reconnect_delay.split(',')))
     self.currency = settings.headerGetInt("/settings/currency")
     self.currency_id = settings.headerGet("/settings/currency/@id")
     self.bot = None
     self.went_broke = False
     self.disconnected_volontarily = False
     self.can_disconnect = True
     self.kwargs = kwargs
     self.name =  kwargs.get('name', PokerBotFactory.string_generator.getName())
     self.password = kwargs.get('password', PokerBotFactory.string_generator.getPassword())
Esempio n. 3
0
 def __init__(self, *args, **kwargs):
     PokerClientFactory.__init__(self, *args, **kwargs)
     self.protocol = PokerBotProtocol
     self.join_info = kwargs["join_info"]
     self.serial = kwargs["serial"]
     settings = kwargs["settings"]
     self.level = settings.headerGetInt("/settings/@level")
     self.reconnect = settings.headerGet("/settings/@reconnect") == "yes"
     self.rebuy = settings.headerGet("/settings/@rebuy") == "yes"
     self.watch = settings.headerGet("/settings/@watch") == "yes"
     self.cash_in = settings.headerGet("/settings/@cash_in") != "no"
     self.wait = settings.headerGetInt("/settings/@wait")
     self.disconnect_delay = settings.headerGet(
         "/settings/@disconnect_delay")
     if self.disconnect_delay:
         self.disconnect_delay = tuple(
             map(lambda x: int(x), split(self.disconnect_delay, ",")))
     self.reconnect_delay = settings.headerGet("/settings/@reconnect_delay")
     if self.reconnect_delay:
         self.reconnect_delay = tuple(
             map(lambda x: int(x), split(self.reconnect_delay, ",")))
     self.currency = settings.headerGetInt("/settings/currency")
     self.currency_id = settings.headerGet("/settings/currency/@id")
     self.verbose = settings.headerGetInt("/settings/@verbose")
     self.bot = None
     self.went_broke = False
     self.disconnected_volontarily = False
     self.can_disconnect = True
     self.name = PokerBotFactory.string_generator.getName()
     self.password = PokerBotFactory.string_generator.getPassword()
Esempio n. 4
0
 def __init__(self, *args, **kwargs):
     PokerClientFactory.__init__(self, *args, **kwargs)
     self.server = kwargs['server']
     self.verbose = self.settings.headerGetInt("/settings/@verbose")
     self.stop_service_deferred = 'stop_service_deferred' in kwargs and kwargs[
         'stop_service_deferred'] or None
     self.pokerstats = PokerStats(self)
Esempio n. 5
0
 def __init__(self, settings, config, dataDir):
     self.verbose = 5
     PokerClientFactory.__init__(self, settings = settings, config = config)
     self.display = DummyPokerDisplay(settings = settings,
                                      config = config,
                                      dataDir = dataDir,
                                      factory = self)
     self.renderer = DummyPokerRenderer(self)
     self.interface = DummyPokerInterface(self)
     self.renderer.interfaceReady(self.interface)
Esempio n. 6
0
    def __init__(self, *args, **kwargs):
        PokerClientFactory.__init__(self, *args, **kwargs)

        if self.settings.headerGet("/settings/@batch") != "yes":
            self.skin = PokerSkin2D(settings=self.settings)
            self.renderer = PokerRenderer(self)
            self.initDisplay()

            self.interface = PokerInterface2D(self.settings)
            self.skin.interfaceReady(self.interface, self.display)
            self.renderer.interfaceReady(self.interface)

        self.checkNetwork("pokersource.info")
Esempio n. 7
0
    def __init__(self, *args, **kwargs):
        PokerClientFactory.__init__(self, *args, **kwargs)

        if self.settings.headerGet("/settings/@batch") != "yes":
            self.skin = PokerSkin2D(settings = self.settings)
            self.renderer = PokerRenderer(self)
            self.initDisplay()

            self.interface = PokerInterface2D(self.settings)
            self.skin.interfaceReady(self.interface, self.display)
            self.renderer.interfaceReady(self.interface)

        self.checkNetwork("pokersource.info")
Esempio n. 8
0
 def buildProtocol(self, addr):
     protocol = PokerClientFactory.buildProtocol(self, addr)
     pokerbot = PokerBot(self)
     protocol._poll = False
     protocol.registerHandler(True, PACKET_BOOTSTRAP,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_ERROR,
                              pokerbot._handleConnection)
     protocol.registerHandler('outbound', PACKET_SERIAL,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_BATCH_MODE,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_STREAM_MODE,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_ERROR,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_TABLE_LIST,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_TOURNEY_LIST,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_WIN,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_PLAYER_LEAVE,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_SEAT,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_BLIND_REQUEST,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_SELF_IN_POSITION,
                              pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_SELF_LOST_POSITION,
                              pokerbot._handleConnection)
     return protocol
Esempio n. 9
0
 def buildProtocol(self, addr):
     protocol = PokerClientFactory.buildProtocol(self, addr)
     protocol._poll = False
     pokerstats = self.pokerstats
     pokerstats.connect()
     protocol.registerHandler(True, PACKET_POKER_MONITOR_EVENT, pokerstats.pokerMonitorEvent)
     protocol.registerHandler(True, PACKET_BOOTSTRAP, pokerstats.bootstrap)
     def ack_and_stop(protocol, packet):
         pokerstats.ack(protocol, packet)
         if self.stop_service_deferred:
             self.stop_service_deferred.callback(True)
     protocol.registerHandler(True, PACKET_ACK, ack_and_stop)
     return protocol
Esempio n. 10
0
    def buildProtocol(self, addr):
        protocol = PokerClientFactory.buildProtocol(self, addr)
        protocol._poll = False
        pokerstats = self.pokerstats
        pokerstats.connect()
        protocol.registerHandler(True, PACKET_POKER_MONITOR_EVENT,
                                 pokerstats.pokerMonitorEvent)
        protocol.registerHandler(True, PACKET_BOOTSTRAP, pokerstats.bootstrap)

        def ack_and_stop(protocol, packet):
            pokerstats.ack(protocol, packet)
            if self.stop_service_deferred:
                self.stop_service_deferred.callback(True)

        protocol.registerHandler(True, PACKET_ACK, ack_and_stop)
        return protocol
Esempio n. 11
0
 def buildProtocol(self, addr):
     protocol = PokerClientFactory.buildProtocol(self, addr)
     pokerbot = PokerBot(self)
     protocol._poll = False
     protocol.registerHandler(True, PACKET_BOOTSTRAP, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_ERROR, pokerbot._handleConnection)
     protocol.registerHandler('outbound', PACKET_SERIAL, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_BATCH_MODE, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_STREAM_MODE, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_ERROR, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_TABLE_LIST, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_TOURNEY_LIST, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_WIN, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_PLAYER_LEAVE, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_SEAT, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_BLIND_REQUEST, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_SELF_IN_POSITION, pokerbot._handleConnection)
     protocol.registerHandler(True, PACKET_POKER_SELF_LOST_POSITION, pokerbot._handleConnection)
     return protocol
Esempio n. 12
0
 def buildProtocol(self, addr):
     protocol = PokerClientFactory.buildProtocol(self, addr)
     self.renderer.setProtocol(protocol)
     self.display.setProtocol(protocol)
     return protocol
Esempio n. 13
0
 def __init__(self, *args, **kwargs):
     PokerClientFactory.__init__(self, *args, **kwargs)
     self.server = kwargs['server']
     self.verbose = self.settings.headerGetInt("/settings/@verbose")
     self.stop_service_deferred = kwargs.has_key('stop_service_deferred') and kwargs['stop_service_deferred'] or None
     self.pokerstats = PokerStats(self)
Esempio n. 14
0
 def __init__(self, *args, **kwargs):
     PokerClientFactory.__init__(self, *args, **kwargs)
     self.server = kwargs["server"]
     self.verbose = self.settings.headerGetInt("/settings/@verbose")
     self.stop_service_deferred = "stop_service_deferred" in kwargs and kwargs["stop_service_deferred"] or None
     self.pokerstats = PokerStats(self)
Esempio n. 15
0
 def buildProtocol(self, addr):
     protocol = PokerClientFactory.buildProtocol(self, addr)
     self.renderer.setProtocol(protocol)
     self.display.setProtocol(protocol)
     return protocol