Exemplo n.º 1
0
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(
            __name__,
            "MysqLtest",
            "The Junky",
            "mysqlclient for ss",
            ".01"
        )
        self._db = Amysql(self.logger)
        # self._db.setDbCredentialsFromFile(
        #   self.module_path + R"/db.conf", "db")
        self._db.setDbCredentialsFromFile(
            self.module_path + R"/egnetdb.conf", "db")
        self._db.start()
        self.clist = [COMMAND_TYPE_PUBLIC, COMMAND_TYPE_TEAM,
                      COMMAND_TYPE_FREQ, COMMAND_TYPE_PRIVATE,
                      COMMAND_TYPE_CHAT]
        self._sql_command_id = bot.register_command(
            '!sql', None, 9, self.clist, "web", "[query]", 'sql it zz')
        self._sqlnl_command_id = bot.register_command(
            '!sqlnl', None, 9, self.clist, "web", "[query]", 'sql it zz')
        self.level = logging.DEBUG
        self.timer_man = TimerManager.TimerManager()
        self.timer_man.set(.01, 1)
        self.timer_man.set(300, 2)
        self.chat = bot.add_chat("st4ff")

        formatter = logging.Formatter('%(message)s')
        handler = LoggingRemoteHandler(logging.DEBUG, bot, "Ratio")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
Exemplo n.º 2
0
 def __init__(self, ssbot, md):
     BotInterface.__init__(self, ssbot, md)
     # register Your Module
     ssbot.register_module_info(
         __name__,
         "SG Peering Assistant",
         "The Junky",
         "adds peered arenas to ini dynamically",
         ".01"
     )
     # "CZ":[4, set()] the 4 means it will go into [peer4] section
     self.zones = {
         "TW": [0, set(), ["", "0"]],
         "SWZ": [1, set(), ["", "0"]],
         "CZ": [2, set(), ["", "0"]],
         "DSB": [3, set(), ["", "0", ]],
         "PB": [4, set(), ["", "0", "replay"]],
         "EG2": [5, set(), ["", "0", "egfl"]],
         "TS": [6, set(), ["", "0"]]
     }
     self.peers = {
         # peerid:(old, new)
         0: [set(), set()],
         1: [set(), set()],
         2: [set(), set()],
         3: [set(), set()],
         4: [set(), set()],
         5: [set(), set()],
         6: [set(), set()]
     }
     self.timer_man = TimerManager.TimerManager()
     self.timer_man.set(20, 1)
Exemplo n.º 3
0
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(__name__, "MysqLtest", "The Junky",
                                 "mysqlclient for ss", ".01")
        self._db = Amysql(self.logger)
        # self._db.setDbCredentialsFromFile(
        #   self.module_path + R"/db.conf", "db")
        self._db.setDbCredentialsFromFile(self.module_path + R"/egnetdb.conf",
                                          "db")
        self._db.start()
        self.clist = [
            COMMAND_TYPE_PUBLIC, COMMAND_TYPE_TEAM, COMMAND_TYPE_FREQ,
            COMMAND_TYPE_PRIVATE, COMMAND_TYPE_CHAT
        ]
        self._sql_command_id = bot.register_command('!sql', None, 9,
                                                    self.clist, "web",
                                                    "[query]", 'sql it zz')
        self._sqlnl_command_id = bot.register_command('!sqlnl', None, 9,
                                                      self.clist, "web",
                                                      "[query]", 'sql it zz')
        self.level = logging.DEBUG
        self.timer_man = TimerManager.TimerManager()
        self.timer_man.set(.01, 1)
        self.timer_man.set(300, 2)
        self.chat = bot.add_chat("st4ff")

        formatter = logging.Formatter('%(message)s')
        handler = LoggingRemoteHandler(logging.DEBUG, bot, "Ratio")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
Exemplo n.º 4
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(
            __name__, "Popset", "The Junky",
            "Controls settings based on current # of players in ships", ".01")
        # register your commands
        self.cmddt = ssbot.register_command('!doTransition', "!dt", 2,
                                            COMMAND_LIST_PP, "Popset", "",
                                            "Control settings based on pop")
        self.cmdlt = ssbot.register_command('!listTransition', "!lt", 0,
                                            COMMAND_LIST_PP, "Popset", "",
                                            "list all transitions/settings")
        self.tiers = [
            Tier(10, ["Team:MaxPerTeam:4", "Team:MaxPerPrivateTeam:4"],
                 "Small"),
            Tier(20, ["Team:MaxPerTeam:7", "Team:MaxPerPrivateTeam:7"],
                 "Medium"),
            Tier(30, ["Team:MaxPerTeam:10", "Team:MaxPerPrivateTeam:10"],
                 "Normal"),
            Tier(60, ["Team:MaxPerTeam:12", "Team:MaxPerPrivateTeam:12"],
                 "Big"),
            Tier(100, ["Team:MaxPerTeam:15", "Team:MaxPerPrivateTeam:15"],
                 "WTF")
        ]

        self.current = None
        self.tm = TimerManager.TimerManager()
Exemplo n.º 5
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(__name__, "processbot", "The Junky",
                                   "displays server stats", ".01")
        # register your commands
        self.cmd_id_kb = ssbot.register_command(
            '!killbot',  # command
            "!kb",  # alias can be None if no alias
            1,  # min access level to use this command
            COMMAND_LIST_PP,  # what types of messages this command will accept
            "smods",  # category this command belongs to
            "",  # what args if any this command accepts use "" if none
            "*******")  # short description of the command displayed in help
        self.cmd_id_lkb = ssbot.register_command(
            '!listbots',  # command
            "!lk",  # alias can be None if no alias
            1,  # min access level to use this command
            COMMAND_LIST_PP,  # what types of messages this command will accept
            "smods",  # category this command belongs to
            "",  # what args if any this command accepts use "" if none
            "*******")  # short description of the command displayed in help

        self.killable_bots = {
            # display name:(accesslevel to kill, bot name in ps,
            # current status)
            "Pubvents": (1, "EGSoft.BotConsoleApp.exe", None)
        }

        self.log_player = None
        self.log_time = time.time()
Exemplo n.º 6
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(
            __name__,
            "Info/LagBot",
            "The Junky",
            "displays/checks players lag",
            ".01"
        )

        # register your commands
        self.cmd_dict = {
            ssbot.register_command(
                '!whatthef',  # command
                "!wtf",  # alias can be None if no alias
                0,  # min access level to use this command
                # what types of messages this command will accept
                COMMAND_LIST_PP,
                "w.t.f",  # category this command belongs to
                # what args if any this command accepts use "" if none
                "<name>",
                # short description of the command displayed in help
                "what the f"
            ): self.cmdWTF  # cmdHandler(self, ssbot, event)
        }
Exemplo n.º 7
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(
            __name__,
            "Popset",
            "The Junky",
            "Controls settings based on current # of players in ships",
            ".01"
        )
        # register your commands
        self.cmddt = ssbot.register_command(
            '!doTransition',
            "!dt",
            2,
            COMMAND_LIST_PP,
            "Popset",
            "",
            "Control settings based on pop"
        )
        self.cmdlt = ssbot.register_command(
            '!listTransition',
            "!lt",
            0,
            COMMAND_LIST_PP,
            "Popset",
            "",
            "list all transitions/settings"
        )
        self.tiers = [
            Tier(
                10,
                ["Team:MaxPerTeam:4", "Team:MaxPerPrivateTeam:4"],
                "Small"
            ),
            Tier(
                20,
                ["Team:MaxPerTeam:7", "Team:MaxPerPrivateTeam:7"],
                "Medium"
            ),
            Tier(
                30,
                ["Team:MaxPerTeam:10", "Team:MaxPerPrivateTeam:10"],
                "Normal"
            ),
            Tier(
                60,
                ["Team:MaxPerTeam:12", "Team:MaxPerPrivateTeam:12"],
                "Big"
            ),
            Tier(
                100,
                ["Team:MaxPerTeam:15", "Team:MaxPerPrivateTeam:15"],
                "WTF"
            )
        ]

        self.current = None
        self.tm = TimerManager.TimerManager()
Exemplo n.º 8
0
 def __init__(self, bot, md):
     BotInterface.__init__(self, bot, md)
     bot.register_module_info(__name__, "TweetBot", "The Junky",
                              "updates status on twitter", ".01")
     self._api = twitter.Api(username='******', password=self.param)
     self._tweet_command_id = bot.register_command(
         '!tweet', "!tw", 0, COMMAND_LIST_ALL, "web", "[message]",
         'update status on twitter.com/extreme_games')
Exemplo n.º 9
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        ssbot.register_module_info(__name__, "Pythonbot-Rota", "Fortunae.Rota",
                                   "Rolls a random int from 1 to 100", ".01")

        self.__command_handlers_dict = {
            ssbot.register_command('!roll', None, 0, COMMAND_LIST_PP, "random", "", "Rolls random positive int up to 100"):
            self.roll,
        }
Exemplo n.º 10
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(__name__, "subgamelogbot", "The Junky",
                                   "displays onscreen *log", ".01")
        # register your commands
        self.cmd_id_log = ssbot.register_command('!sslog', "!sl", 5,
                                                 COMMAND_LIST_PP, "smods", "",
                                                 "same as *log for nonsysops")

        self.log_player = None
        self.log_time = time.time()
Exemplo n.º 11
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(
            __name__,
            "Popset",
            "The Junky",
            "Controls settings based on current # of players in ships",
            ".03"
        )
        # register your commands
        self.cmddt = ssbot.register_command(
            '!doTransition',
            "!dt",
            2,
            COMMAND_LIST_PP,
            "Popset",
            "[on|off|normal]",
            "Control settings based on pop"
        )
        self.cmdlt = ssbot.register_command(
            '!listTransition', "!lt",
            0,
            COMMAND_LIST_PP,
            "Popset",
            "",
            "list all transitions/settings"
        )
        self.normal = Tier(
            20,
            ["Team:MaxPerTeam:10", "Team:MaxPerPrivateTeam:10"],
            "Normal",
            15 * 60
        )
        self.tiers = [
            Tier(
                10,
                ["Team:MaxPerTeam:5", "Team:MaxPerPrivateTeam:5"],
                "Small", 3 * 60
            ),
            Tier(
                16,
                ["Team:MaxPerTeam:8", "Team:MaxPerPrivateTeam:8"],
                "Medium",
                10 * 60
            ),
            self.normal
        ]

        self.current = None
        self.tm = TimerManager.TimerManager()
        self.enabled = True
Exemplo n.º 12
0
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(
            __name__,
            "stats",
            "The Junky",
            "Stats Retrieval Module",
            ".01"
        )
        self._db = Amysql(self.logger)
        self._db.setDbCredentialsFromFile(
            self.module_path + R"/statsdb.conf", "db")
        self._db.start()
        # self.clist = [COMMAND_TYPE_PUBLIC, COMMAND_TYPE_TEAM,
        #   COMMAND_TYPE_FREQ, COMMAND_TYPE_PRIVATE, COMMAND_TYPE_CHAT]
        self.clist = [COMMAND_TYPE_PRIVATE]
        # self._sql_command_id = bot.register_command(
        #   '!sql', None, 9, self.clist, "web", "[query]", 'sql it zz')
        # self._sqlnl_command_id = bot.register_command(
        #   '!sqlnl', None, 9, self.clist, "web", "[query]", 'sql it zz')
        self._last_jp = bot.register_command(
            '!jackpots', None, 0, self.clist, "Stats", "", 'last jackpots won')
        self._recs = bot.register_command(
            '!recs', None, 0, self.clist, "Stats", "[reset id]", 'top ratios')
        self._points = bot.register_command(
            '!points', None, 0, self.clist, "Stats", "[reset id]",
            'Top points')
        self._squads = bot.register_command(
            '!squads', None, 0, self.clist, "Stats", "[reset id]",
            'top squads')
        self._resets = bot.register_command(
            '!resets', None, 0, self.clist, "Stats", "", 'recentreset ids')
        self.level = logging.DEBUG
        self.timer_man = TimerManager.TimerManager()
        self.timer_man.set(.01, 1)
        self.timer_man.set(300, 2)
        self.chat = bot.add_chat("st4ff")
        self.cache = {
            # !cmd: (Cached_result, time)
            "!jackpots": (None, 0, "jackpots.txt"),
            "!recs": (None, 0, "recs.txt"),
            "!points": (None, 0, "points.txt"),
            "!squads": (None, 0, "squads.txt")
        }

        formatter = logging.Formatter('%(message)s')
        handler = LoggingRemoteHandler(logging.DEBUG, bot, "Ratio")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
Exemplo n.º 13
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        ssbot.register_module_info(__name__, "Info/LagBot", "The Junky", "displays/checks players lag", ".01")
        self.pman = PlayerInfoManager(self.module.Pinfo)

        self.__command_handlers_dict = {
            ssbot.register_command(
                "!lag", None, 0, COMMAND_LIST_PP, "info", "<name>", "request/check players lag"
            ): self.HClag,
            ssbot.register_command(
                "!limits", None, 0, COMMAND_LIST_PP, "info", None, "display bot limits"
            ): self.HCLimits,
            ssbot.register_command("!laghelp", None, 0, COMMAND_LIST_PP, "info", None, "lag glossary"): self.HCLagHelp,
        }
        self.info = Info()
        self.ReadConfig()
        self.mode = self.module.Mode()
        self.ticks = time.time()
Exemplo n.º 14
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        ssbot.register_module_info(
            __name__,
            "Info/LagBot",
            "The Junky",
            "displays/checks players lag",
            ".01"
        )
        self.pman = PlayerInfoManager(self.module.Pinfo)

        self.__command_handlers_dict = {
            ssbot.register_command(
                '!lag',
                None,
                0,
                COMMAND_LIST_PP,
                "info",
                "<name>",
                "request/check players lag"
            ): self.HClag,
            ssbot.register_command(
                '!limits',
                None,
                0,
                COMMAND_LIST_PP,
                "info",
                None,
                "display bot limits"
            ): self.HCLimits,
            ssbot.register_command(
                '!laghelp',
                None,
                0,
                COMMAND_LIST_PP,
                "info",
                None,
                "lag glossary"
            ): self.HCLagHelp
        }
        self.info = Info()
        self.ReadConfig()
        self.mode = self.module.Mode()
        self.ticks = time.time()
Exemplo n.º 15
0
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(__name__, "stats", "The Junky",
                                 "Stats Retrieval Module", ".01")
        self._db = Amysql(self.logger)
        self._db.setDbCredentialsFromFile(self.module_path + R"/statsdb.conf",
                                          "db")
        self._db.start()
        # self.clist = [COMMAND_TYPE_PUBLIC, COMMAND_TYPE_TEAM,
        #   COMMAND_TYPE_FREQ, COMMAND_TYPE_PRIVATE, COMMAND_TYPE_CHAT]
        self.clist = [COMMAND_TYPE_PRIVATE]
        # self._sql_command_id = bot.register_command(
        #   '!sql', None, 9, self.clist, "web", "[query]", 'sql it zz')
        # self._sqlnl_command_id = bot.register_command(
        #   '!sqlnl', None, 9, self.clist, "web", "[query]", 'sql it zz')
        self._last_jp = bot.register_command('!jackpots', None, 0, self.clist,
                                             "Stats", "", 'last jackpots won')
        self._recs = bot.register_command('!recs', None, 0, self.clist,
                                          "Stats", "[reset id]", 'top ratios')
        self._points = bot.register_command('!points', None, 0, self.clist,
                                            "Stats", "[reset id]",
                                            'Top points')
        self._squads = bot.register_command('!squads', None, 0, self.clist,
                                            "Stats", "[reset id]",
                                            'top squads')
        self._resets = bot.register_command('!resets', None, 0, self.clist,
                                            "Stats", "", 'recentreset ids')
        self.level = logging.DEBUG
        self.timer_man = TimerManager.TimerManager()
        self.timer_man.set(.01, 1)
        self.timer_man.set(300, 2)
        self.chat = bot.add_chat("st4ff")
        self.cache = {
            # !cmd: (Cached_result, time)
            "!jackpots": (None, 0, "jackpots.txt"),
            "!recs": (None, 0, "recs.txt"),
            "!points": (None, 0, "points.txt"),
            "!squads": (None, 0, "squads.txt")
        }

        formatter = logging.Formatter('%(message)s')
        handler = LoggingRemoteHandler(logging.DEBUG, bot, "Ratio")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
Exemplo n.º 16
0
 def __init__(self, bot, md):
     BotInterface.__init__(self, bot, md)
     bot.register_module_info(
         __name__,
         "TweetBot",
         "The Junky",
         "updates status on twitter",
         ".01"
     )
     self._api = twitter.Api(username='******', password=self.param)
     self._tweet_command_id = bot.register_command(
         '!tweet',
         "!tw",
         0,
         COMMAND_LIST_ALL,
         "web",
         "[message]",
         'update status on twitter.com/extreme_games'
     )
Exemplo n.º 17
0
    def __init__(self, ssbot, md, config, MQueue):
        BotInterface.__init__(self, ssbot, md)
        ssbot.register_module_info(
            __name__, "MasterBot", "The Junky",
            "Manages other bots (starts/stops/lists/etc)", "1.0d")
        self.config = config
        self._cmd_handlers = {
            # Cmd_ID, cmd_handler_func
            ssbot.register_command('!startbot', "!sb", 2, COMMAND_LIST_ALL, "Master", "[type] [arena]", '!startbot type arena'):
            self.HCStartBot,
            ssbot.register_command('!killbot', "!kb", 2, COMMAND_LIST_ALL, "Master", "[name]", 'Stop a specific bot'):
            self.HCStopBot,
            ssbot.register_command('!listbots', "!lb", 2, COMMAND_LIST_ALL, "Master", "", 'lists all currently running bots'):
            self.HCListBots,
            ssbot.register_command(
                '!listbottypes', "!lt", 2, COMMAND_LIST_ALL, "Master", "", '!lists all bot types currently defined in config file'):
            self.HCListBotTypes,
            ssbot.register_command('!reloadconf', "!rc", 3, COMMAND_LIST_ALL, "Master", "", 'reload json config file'):
            self.HCLoadConfig,
            ssbot.register_command(
                '!unloadmodule', "!um", 7, COMMAND_LIST_ALL, "Master", "[modulename]", 'unload a specific module from systems.module'):
            self.HCUnloadModule,
            ssbot.register_command(
                '!log', None, 2, COMMAND_LIST_PP, "Master", "[-clear]", 'default shows last 100 lines from the core logger'):
            self.HCLog
        }
        self._last_instance_id = 0
        self._instances = {}
        # this will copy all log entries to a list, so i can use it for !log
        self.max_recs = 40
        self.listhandler = ListHandler(logging.DEBUG, self.max_recs)
        formatter = logging.Formatter(
            '%(asctime)s:%(name)s:%(levelname)s:%(message)s')
        self.listhandler.setFormatter(formatter)
        self.listhandler.load_from_file(os.path.join(os.getcwd(), "Bots.log"))
        self.logger.addHandler(self.listhandler)

        self.logger.info("Master Bot Started")
        if len(config.MasterChats) > 0:
            ssbot.add_chat(config.MasterChats)

        self.__queue = MQueue
Exemplo n.º 18
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        ssbot.register_module_info(
            __name__,
            "Pythonbot-Rota",
            "Fortunae.Rota",
            "Rolls a random int from 1 to 100",
            ".01"
        )

        self.__command_handlers_dict = {
            ssbot.register_command(
                '!roll',
                None,
                0,
                COMMAND_LIST_PP,
                "random",
                "",
                "Rolls random positive int up to 100"
            ): self.roll,
        }
Exemplo n.º 19
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(
            __name__,
            "subgamelogbot",
            "The Junky",
            "displays onscreen *log",
            ".01"
        )
        # register your commands
        self.cmd_id_log = ssbot.register_command(
            '!sslog',
            "!sl",
            5,
            COMMAND_LIST_PP,
            "smods",
            "",
            "same as *log for nonsysops"
        )

        self.log_player = None
        self.log_time = time.time()
Exemplo n.º 20
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(
            __name__,
            "processbot",
            "The Junky",
            "displays server stats",
            ".01"
        )
        # register your commands
        self.cmd_id_kb = ssbot.register_command(
            '!killbot',  # command
            "!kb",  # alias can be None if no alias
            1,  # min access level to use this command
            COMMAND_LIST_PP,  # what types of messages this command will accept
            "smods",  # category this command belongs to
            "",  # what args if any this command accepts use "" if none
            "*******")  # short description of the command displayed in help
        self.cmd_id_lkb = ssbot.register_command(
            '!listbots',  # command
            "!lk",  # alias can be None if no alias
            1,  # min access level to use this command
            COMMAND_LIST_PP,  # what types of messages this command will accept
            "smods",  # category this command belongs to
            "",  # what args if any this command accepts use "" if none
            "*******")  # short description of the command displayed in help

        self.killable_bots = {
            # display name:(accesslevel to kill, bot name in ps,
            # current status)
            "Pubvents": (1, "EGSoft.BotConsoleApp.exe", None)
        }

        self.log_player = None
        self.log_time = time.time()
Exemplo n.º 21
0
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(
            __name__,
            "MysqLtest",
            "The Junky",
            "egdldb helper",
            ".01b"
        )
        self._db = Amysql(self.logger)
        self._db.setDbCredentialsFromFile(
            self.module_path + R"/egdldb.conf", "db")
        self._db.start()
        self.clist = [COMMAND_TYPE_PUBLIC, COMMAND_TYPE_TEAM,
                      COMMAND_TYPE_FREQ, COMMAND_TYPE_PRIVATE,
                      COMMAND_TYPE_CHAT]
        self.commands = {
            # bot.register_command(
            #     '!sql',
            #     None,
            #     9,
            #     self.clist,
            #     "db",
            #     "[query]",
            #     'sql it zz'
            # ): (self.cmd_sql, ""),
            bot.register_command(
                '!sqlnl',
                None,
                9,
                self.clist,
                "db",
                "[query]",
                'sql it zz'
            ): (self.cmd_sql, "nl"),
            bot.register_command(
                '!addplayer',
                "!ap",
                5,
                self.clist,
                "egdl",
                "[name:vp:squadid]",
                'create/add new player to current league'
            ): (self.cmd_ap, ""),
            bot.register_command(
                '!changeplayer',
                "!cp",
                5,
                self.clist,
                "egdl",
                "[name:vp:squadid]",
                'update existing player'
            ): (self.cmd_cp, ""),
            bot.register_command(
                '!deleteplayer',
                "!dp",
                5,
                self.clist,
                "egdl",
                "[name]",
                'update existing player'
            ): (self.cmd_dp, ""),
            bot.register_command(
                '!listsquads',
                "!ls",
                5,
                self.clist,
                "egdl",
                "",
                'list squads'
            ): (self.cmd_ls, ""),
            bot.register_command(
                '!listplayers',
                "!lp",
                5,
                self.clist,
                "egdl",
                "[squad]",
                'list squads'
            ): (self.cmd_lp, "")
        }
        self.level = logging.DEBUG
        self.timer_man = TimerManager.TimerManager()
        self.timer_man.set(.01, 1)
        self.timer_man.set(300, 2)
        self.chat = bot.add_chat("st4ff")

        formatter = logging.Formatter('%(message)s')
        handler = LoggingRemoteHandler(logging.DEBUG, bot, "Ratio")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
Exemplo n.º 22
0
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(
            __name__,
            "Population Monitoring/Logger",
            "The Junky",
            "logs some pop stats to chart later",
            ".001"
        )
        self._db = Amysql(self.logger)
        self._db.setDbCredentialsFromFile(
            self.module_path + R"/popmon.conf", "db")
        self._db.start()
        self.clist = [
            COMMAND_TYPE_PUBLIC,
            COMMAND_TYPE_TEAM,
            COMMAND_TYPE_FREQ,
            COMMAND_TYPE_PRIVATE,
            COMMAND_TYPE_CHAT
        ]
        self.CID_SP = bot.register_command(
            '!showpop',
            "!sp",
            2,
            self.clist,
            "Pop",
            "limit",
            'show last x entries'
        )
        self.CID_SPG = bot.register_command(
            '!showpopgraph',
            "!spg",
            2,
            self.clist,
            "Pop",
            "",
            'graph last 70 pop entries'
        )
        self.level = logging.DEBUG

        self.chat = bot.add_chat("st4ff")
        self.QTYPE_SQL = 1
        self.QTYPE_SPG = 2
        self.QTYPE_ADDPOP = 3

        self.timer_man = TimerManager.TimerManager()

        self.TID_CHECK_RESULTS = 1
        self.TID_PING_DB = 2
        self.TID_PARSE_STATS = 3
        self.TID_LOG_STATS = 4

        self.timer_man.set(.01, self.TID_CHECK_RESULTS)
        self.timer_man.set(300, self.TID_PING_DB)
        self.timer_man.set(30, self.TID_PARSE_STATS)

        formatter = logging.Formatter('%(message)s')
        handler = LoggingPublicHandler(logging.DEBUG, bot, "*bot")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
        # gayness because of master bot doesnt auto load all the other
        # classes in the file int ts context

        try:  # if running in stand alone
            self.popStats = PopStats()
        except NameError:
            self.popStats = md.module.PopStats()
Exemplo n.º 23
0
    def __init__(self, ssbot, md):
        BotInterface.__init__(self, ssbot, md)
        # register Your Module
        ssbot.register_module_info(
            __name__,
            "Flaginfo",
            "The Junky",
            "allows mods to neut specific flags",
            ".01"
        )
        # register your commands
        self.cmd_dict = {
            # ssbot.register_command(
            #   # command
            #   # alias can be None if no alias
            #   # min access level to use this command
            #   # what types of messages this command will accept
            #   # category this command belongs to
            #   # what args if any this command accepts use "" if none
            #   # short description of the command displayed in help
            # ) : # cmdHandler(self, ssbot, event)
            ssbot.register_command(
                '!listflags',
                "!lf",
                1,
                COMMAND_LIST_PP,
                "Flag",
                "",
                "List all flags in the arena"): self.cmdLF,

            ssbot.register_command(
                '!pickupflags',
                "!pf",
                1,
                COMMAND_LIST_PP,
                "Flag",
                "fid1, fid2...",
                "pickup flags by id"): self.cmdPF,

            ssbot.register_command(
                '!warpto',
                "!wt",
                1,
                COMMAND_LIST_PP,
                "Mod",
                "SScoord",
                "e.g A1 or T20 use -!+ for low, mid, high"): self.cmdWT,

            ssbot.register_command(
                '!flagwarpto',
                "!fwt",
                1,
                COMMAND_LIST_PP,
                "Mod",
                "flag_id",
                "warpto the coords of a flag"): self.cmdFWT
        }
        # do any other initialization code here
        # ...
        self.maxflags = 30
        self.pstate = 0
        self.flist = []
        self.fc = 0
Exemplo n.º 24
0
    def __init__(self, ssbot, md, config, MQueue):
        BotInterface.__init__(self, ssbot, md)
        ssbot.register_module_info(
            __name__,
            "MasterBot",
            "The Junky",
            "Manages other bots (starts/stops/lists/etc)",
            "1.0d"
        )
        self.config = config
        self._cmd_handlers = {
            # Cmd_ID, cmd_handler_func
            ssbot.register_command(
                '!startbot',
                "!sb",
                2,
                COMMAND_LIST_ALL,
                "Master",
                "[type] [arena]",
                '!startbot type arena'
            ): self.HCStartBot,
            ssbot.register_command(
                '!killbot',
                "!kb",
                2,
                COMMAND_LIST_ALL,
                "Master",
                "[name]",
                'Stop a specific bot'
            ): self.HCStopBot,
            ssbot.register_command(
                '!listbots',
                "!lb",
                2,
                COMMAND_LIST_ALL,
                "Master",
                "",
                'lists all currently running bots'
            ): self.HCListBots,
            ssbot.register_command(
                '!listbottypes',
                "!lt",
                2,
                COMMAND_LIST_ALL,
                "Master",
                "",
                '!lists all bot types currently defined in config file'
            ): self.HCListBotTypes,
            ssbot.register_command(
                '!reloadconf',
                "!rc",
                3,
                COMMAND_LIST_ALL,
                "Master",
                "",
                'reload json config file'
            ): self.HCLoadConfig,
            ssbot.register_command(
                '!unloadmodule',
                "!um",
                7,
                COMMAND_LIST_ALL,
                "Master",
                "[modulename]",
                'unload a specific module from systems.module'
            ): self.HCUnloadModule,
            ssbot.register_command(
                '!log',
                None,
                2,
                COMMAND_LIST_PP,
                "Master",
                "[-clear]",
                'default shows last 100 lines from the core logger'
            ): self.HCLog
        }
        self._last_instance_id = 0
        self._instances = {}
        # this will copy all log entries to a list, so i can use it for !log
        self.max_recs = 40
        self.listhandler = ListHandler(logging.DEBUG, self.max_recs)
        formatter = logging.Formatter(
            '%(asctime)s:%(name)s:%(levelname)s:%(message)s')
        self.listhandler.setFormatter(formatter)
        self.listhandler.load_from_file(os.path.join(os.getcwd(), "Bots.log"))
        self.logger.addHandler(self.listhandler)

        self.logger.info("Master Bot Started")
        if len(config.MasterChats) > 0:
            ssbot.add_chat(config.MasterChats)

        self.__queue = MQueue