• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python minqlx.get_configstring函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中minqlx.get_configstring函数的典型用法代码示例。如果您正苦于以下问题:Python get_configstring函数的具体用法?Python get_configstring怎么用?Python get_configstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_configstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: handle_vote

    def handle_vote(self, player, yes):
        if not self.is_vote_active():
            return
        
        if player in self.has_voted:
            ident = player.steam_id
            if (player.privileges != None or self.db.has_permission(ident, 3)):
                minqlx.force_vote(yes)
                if yes:
                    word = "passed"
                else:
                    word = "vetoed"
                    
                self.msg("{}^7 {} the vote.".format(player.name, word))
                return minqlx.RET_STOP_ALL

        self.has_voted.append(player)
        
        if (player.privileges != None):
            # at least give the impression that the QLDS admin/mod voted normally.
            if yes:
                yes_votes = int(minqlx.get_configstring(10))
                yes_votes += 1
                minqlx.set_configstring(10, str(yes_votes))
            else:
                no_votes = int(minqlx.get_configstring(11))
                no_votes += 1
                minqlx.set_configstring(11, str(no_votes))
            return minqlx.RET_STOP_ALL
开发者ID:BarelyMiSSeD,项目名称:Quake-Live,代码行数:29,代码来源:votemanager.py


示例2: cmd_clan

    def cmd_clan(self, player, msg, channel):
        index = 529 + player.id
        tag_key = _tag_key.format(player.steam_id)
        
        if len(msg) < 2:
            if tag_key in self.db:
                del self.db[tag_key]
                cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True)
                del cs["cn"]
                del cs["xcn"]
                new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs]).lstrip("\\")
                minqlx.set_configstring(index, new_cs)
                player.tell("The clan tag has been cleared.")
            else:
                player.tell("Usage to set a clan tag: ^4{} <clan_tag>".format(msg[0]))
            return minqlx.RET_STOP_EVENT

        if len(self.clean_text(msg[1])) > 5:
            player.tell("The clan tag can only be at most 5 characters long, excluding colors.")
            return minqlx.RET_STOP_EVENT
        
        # If the player already has a clan, we need to edit the current
        # configstring. We can't just append cn and xcn.
        tag = self.clean_tag(msg[1])
        cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True)
        cs["xcn"] = tag
        cs["cn"] = tag
        new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs])
        minqlx.set_configstring(index, new_cs)
        self.db[tag_key] = tag
        self.msg("{} changed clan tag to {}".format(player, tag))
        return minqlx.RET_STOP_EVENT
开发者ID:TomTec-Solutions,项目名称:QL-Server-Config,代码行数:32,代码来源:clan.py


示例3: current_vote_count

 def current_vote_count(cls):
     yes = minqlx.get_configstring(10)
     no = minqlx.get_configstring(11)
     if yes and no:
         return int(yes), int(no)
     else:
         return None
开发者ID:MinoMino,项目名称:minqlx,代码行数:7,代码来源:_plugin.py


示例4: set_map_subtitles

def set_map_subtitles():
    cs = minqlx.get_configstring(678)
    if cs:
        cs += " - "
    minqlx.set_configstring(678, cs + "Running minqlx ^6{}^7 with plugins ^6{}^7."
        .format(minqlx.__version__, minqlx.__plugins_version__))
    cs = minqlx.get_configstring(679)
    if cs:
        cs += " - "
    minqlx.set_configstring(679, cs + "Check ^6http://github.com/MinoMino/minqlx^7 for more details.")
开发者ID:h4t3,项目名称:minqlx,代码行数:10,代码来源:_core.py


示例5: cancel

    def cancel(self):
        # Check if there's a current vote in the first place.
        cs = minqlx.get_configstring(9)
        if not cs:
            return

        res = _re_vote.match(cs)
        vote = res.group("cmd")
        args = res.group("args") if res.group("args") else ""
        votes = (int(minqlx.get_configstring(10)), int(minqlx.get_configstring(11)))
        # Return None if the vote's cancelled (like if the round starts before vote's over).
        super().trigger(votes, vote, args, None)
开发者ID:PerpetualWar,项目名称:minqlx,代码行数:12,代码来源:_events.py


示例6: dispatch

    def dispatch(self, passed):
        # Check if there's a current vote in the first place.
        cs = minqlx.get_configstring(9)
        if not cs:
            minqlx.get_logger().warning("vote_ended went off without configstring 9.")
            return

        res = _re_vote.match(cs)
        vote = res.group("cmd")
        args = res.group("args") if res.group("args") else ""
        votes = (int(minqlx.get_configstring(10)), int(minqlx.get_configstring(11)))
        super().dispatch(votes, vote, args, passed)
开发者ID:MinoMino,项目名称:minqlx,代码行数:12,代码来源:_events.py


示例7: set_map_subtitles

def set_map_subtitles():
    # We save the actual values before setting them so that we can retrieve them in Game.
    setattr(minqlx, "_map_title", minqlx.get_configstring(3))
    setattr(minqlx, "_map_subtitle1", minqlx.get_configstring(678))
    setattr(minqlx, "_map_subtitle2", minqlx.get_configstring(679))

    cs = minqlx.get_configstring(678)
    if cs:
        cs += " - "
    minqlx.set_configstring(678, cs + "Running minqlx ^6{}^7 with plugins ^6{}^7."
        .format(minqlx.__version__, minqlx.__plugins_version__))
    cs = minqlx.get_configstring(679)
    if cs:
        cs += " - "
    minqlx.set_configstring(679, cs + "Check ^6http://github.com/MinoMino/minqlx^7 for more details.")
开发者ID:MinoMino,项目名称:minqlx,代码行数:15,代码来源:_core.py


示例8: brand_map

    def brand_map(self):
        if self.get_cvar("qlx_brandingPrependMapName", bool):
            minqlx.set_configstring(3, self.game.map_title + " " + (self.get_cvar("qlx_serverBrandName")))
        else:
            minqlx.set_configstring(3, (self.get_cvar("qlx_serverBrandName")))
            
        cs = self.game.map_subtitle1
        if cs:
            cs += " - "
        minqlx.set_configstring(678, cs + (self.get_cvar("qlx_serverBrandTopField")))
        cs = self.game.map_subtitle2
        if cs:
            cs += " - "
        minqlx.set_configstring(679, cs + (self.get_cvar("qlx_serverBrandBottomField")))

        if self.get_cvar("qlx_rainbowBrandName", bool):
            # Thanks Mino for this bit!
            def rotating_colors():
                i = 0
                while True:
                    res = (i % 7) + 1
                    i += 1
                    yield res

            map_name = minqlx.get_configstring(3)
            r = rotating_colors()
            res = ""
            for i in range(len(map_name)):
                res += "^{}{}".format(next(r), map_name[i])

            minqlx.set_configstring(3, res)
开发者ID:alpi-ua,项目名称:Quake-Live,代码行数:31,代码来源:branding.py


示例9: clan

 def clan(self, tag):
     index = self.id + 529
     cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True)
     cs["xcn"] = tag
     cs["cn"] = tag
     new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs])
     minqlx.set_configstring(index, new_cs)
开发者ID:JoolsJealous,项目名称:minqlx,代码行数:7,代码来源:_player.py


示例10: __init__

 def __init__(self, cached=True):
     self.cached = cached
     self._valid = True
     cs = minqlx.get_configstring(0)
     if not cs:
         self._valid = False
         raise NonexistentGameError("Tried to instantiate a game while no game is active.")
开发者ID:JoolsJealous,项目名称:minqlx,代码行数:7,代码来源:_game.py


示例11: __getitem__

    def __getitem__(self, key):
        cs = minqlx.get_configstring(0)
        if not cs:
            self._valid = False
            raise NonexistentGameError("Invalid game. Is the server loading a new map?")

        cvars = minqlx.parse_variables(cs)
        return cvars[key]
开发者ID:JoolsJealous,项目名称:minqlx,代码行数:8,代码来源:_game.py


示例12: handle_set_configstring

def handle_set_configstring(index, value):
    """Called whenever the server tries to set a configstring. Can return
    False to stop the event.

    """
    try:
        res = minqlx.EVENT_DISPATCHERS["set_configstring"].dispatch(index, value)
        if res == False:
            return False
        elif isinstance(res, str):
            value = res

        # GAME STATE CHANGES
        if index == 0:
            old_cs = minqlx.parse_variables(minqlx.get_configstring(index))
            if not old_cs:
                return

            new_cs = minqlx.parse_variables(value)
            old_state = old_cs["g_gameState"]
            new_state = new_cs["g_gameState"]
            if old_state != new_state:
                if old_state == "PRE_GAME" and new_state == "IN_PROGRESS":
                    minqlx.EVENT_DISPATCHERS["vote_ended"].cancel()  # Cancel current vote if any.
                    # minqlx.EVENT_DISPATCHERS["game_start"].dispatch()
                elif old_state == "PRE_GAME" and new_state == "COUNT_DOWN":
                    minqlx.EVENT_DISPATCHERS["game_countdown"].dispatch()
                elif old_state == "COUNT_DOWN" and new_state == "IN_PROGRESS":
                    minqlx.EVENT_DISPATCHERS["vote_ended"].cancel()  # Cancel current vote if any.
                    # minqlx.EVENT_DISPATCHERS["game_start"].dispatch()
                elif old_state == "IN_PROGRESS" and new_state == "PRE_GAME":
                    pass
                elif old_state == "COUNT_DOWN" and new_state == "PRE_GAME":
                    pass
                else:
                    logger = minqlx.get_logger()
                    logger.warning("UNKNOWN GAME STATES: {} - {}".format(old_state, new_state))

        # ROUND COUNTDOWN AND START
        if index == 661:
            cvars = minqlx.parse_variables(value)
            if cvars:
                round_number = int(cvars["round"])
                if round_number and "time" in cvars:
                    if round_number == 1:  # This is the case when the first countdown starts.
                        minqlx.EVENT_DISPATCHERS["round_countdown"].dispatch(round_number)
                        return

                    minqlx.EVENT_DISPATCHERS["round_countdown"].dispatch(round_number)
                    return
                elif round_number:
                    minqlx.EVENT_DISPATCHERS["round_start"].dispatch(round_number)
                    return

        return res
    except:
        minqlx.log_exception()
        return True
开发者ID:PerpetualWar,项目名称:minqlx,代码行数:58,代码来源:_handlers.py


示例13: red_score

 def red_score(self):
     return int(minqlx.get_configstring(6))
开发者ID:JoolsJealous,项目名称:minqlx,代码行数:2,代码来源:_game.py


示例14: is_vote_active

 def is_vote_active(cls):
     if minqlx.get_configstring(9):
         return True
     else:
         return False
开发者ID:MinoMino,项目名称:minqlx,代码行数:5,代码来源:_plugin.py


示例15: reference_steamworks

def reference_steamworks(item_id):
    new_ref = minqlx.get_configstring(715) + "{} ".format(item_id)
    minqlx.set_configstring(715, new_ref)
开发者ID:h4t3,项目名称:minqlx,代码行数:3,代码来源:_core.py


示例16: set_player_configstring

 def set_player_configstring(self, player, index, key, value): # will let you set a configstring on a per-player basis.
     original_configstring = minqlx.parse_variables(minqlx.get_configstring(index))
     original_configstring[key] = value
     modified_configstring = (("\\") + ("\\".join("\\".join((k,str(v))) for k,v in sorted(original_configstring.items()))))
     minqlx.send_server_command(player.id, "cs {} {}".format(index, modified_configstring))
开发者ID:TomTec-Solutions,项目名称:QL-Server-Config,代码行数:5,代码来源:tomtec_logic.py


示例17: cvars

    def cvars(self):
        """A dictionary of unprocessed cvars. Use attributes whenever possible, but since some
        cvars might not have attributes on this class, this could be useful.

        """
        return minqlx.parse_variables(minqlx.get_configstring(0))
开发者ID:JoolsJealous,项目名称:minqlx,代码行数:6,代码来源:_game.py


示例18: workshop_items

 def workshop_items(self):
     return [int(i) for i in minqlx.get_configstring(715).split()]
开发者ID:JoolsJealous,项目名称:minqlx,代码行数:2,代码来源:_game.py


示例19: blue_score

 def blue_score(self):
     return int(minqlx.get_configstring(7))
开发者ID:JoolsJealous,项目名称:minqlx,代码行数:2,代码来源:_game.py


示例20: steamworks_items

 def steamworks_items(self):
     return minqlx.get_configstring(715).split()
开发者ID:h4t3,项目名称:minqlx,代码行数:2,代码来源:_game.py



注:本文中的minqlx.get_configstring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python minqlx.log_exception函数代码示例发布时间:2022-05-27
下一篇:
Python minqlx.console_command函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap