def hud_check(self): new_ratio = int((self.stamina / INITIAL_STAMINA) * 10) if new_ratio == self.stamina_ratio: return self.stamina_ratio = new_ratio if USE_OVERLAY: self.player.client_command( 'r_screenoverlay {}'.format(OVERLAY_PATH.format(new_ratio))) else: hud_msg = HudMsg( HUD_STRINGS[new_ratio], color1=STAMINA_MSG_COLOR, x=STAMINA_MSG_X, y=STAMINA_MSG_Y, effect=STAMINA_MSG_EFFECT, fade_in=STAMINA_MSG_FADEIN, fade_out=STAMINA_MSG_FADEOUT, hold_time=STAMINA_MSG_HOLDTIME, fx_time=STAMINA_MSG_FXTIME, channel=STAMINA_MSG_CHANNEL ) hud_msg.send(self.player.index)
def on_cs_win_panel_match(game_event): # Check if the vote is still in progress if status.vote_status == VoteStatus.IN_PROGRESS: logger.log_debug("on_cs_win_panel_match: vote was still in " "progress, finishing") finish_vote() # Check if next map is decided if status.next_map is None: logger.log_debug("on_cs_win_panel_match: no next_map defined!") return if config_manager['nextmap_show_on_match_end']: # HudMsg hud_msg = HudMsg( common_strings['nextmap_msg'].tokenized(map=status.next_map.name), color1=NEXTMAP_MSG_COLOR, x=NEXTMAP_MSG_X, y=NEXTMAP_MSG_Y, effect=NEXTMAP_MSG_EFFECT, fade_in=NEXTMAP_MSG_FADEIN, fade_out=NEXTMAP_MSG_FADEOUT, hold_time=NEXTMAP_MSG_HOLDTIME, fx_time=NEXTMAP_MSG_FXTIME, channel=NEXTMAP_MSG_CHANNEL, ) hud_msg.send() # SayText2 broadcast(common_strings['nextmap_msg_colored'].tokenized( map=status.next_map.name))
def refresh(self): if self._refresh_delay is not None and self._refresh_delay.running: self._refresh_delay.cancel() if not config_manager['votemap_show_progress']: return if self._message: time_left = int(status.vote_start_time + config_manager['vote_duration'] - time()) message_tokenized = self._message.tokenized( **self._message.tokens, time_left="{:02d}:{:02d}".format(*divmod(time_left, 60))) if config_manager['votemap_progress_use_hudmsg']: HudMsg( message_tokenized, color1=HUDMSG_MSG_COLOR, x=HUDMSG_MSG_X, y=HUDMSG_MSG_Y, effect=HUDMSG_MSG_EFFECT, fade_in=HUDMSG_MSG_FADEIN, fade_out=HUDMSG_MSG_FADEOUT, hold_time=HUDMSG_MSG_HOLDTIME, fx_time=HUDMSG_MSG_FXTIME, channel=HUDMSG_MSG_CHANNEL, ).send() else: HintText(message_tokenized).send() self._refresh_delay = Delay(REFRESH_INTERVAL, self.refresh)
def _centermessage_command(command): message = command.arg_string for player in PlayerIter(): if SOURCE_ENGINE_BRANCH == "css": queue_command_string("es_centertell %s %s" % (player.userid, message)) else: HudMsg(message, -1, 0.35, hold_time=5.0).send(player.index)
def announce_killstreak(self, user, killstreak): # Get target indexes indexes = set() if killstreak.targets & KillstreakTarget.TEAMMATES: for user_ in self.values(): if user_.player.team == user.player.team and not user_.isbot: indexes.add(user_.player.index) if killstreak.targets & KillstreakTarget.ENEMIES: for user_ in self.values(): if user_.player.team != user.player.team and not user_.isbot: indexes.add(user_.player.index) if killstreak.targets & KillstreakTarget.ATTACKER: if not user.isbot: indexes.add(user.player.index) # Play sound if killstreak.sound is not None: killstreak.sound.play(*indexes) # Show HudMsg if killstreak.text_on_killstreak is not None: if killstreak.show_kills: is_on_killstreak_string = 'is_on_killstreak show_kills' else: is_on_killstreak_string = 'is_on_killstreak' hud_msg = HudMsg( strings_popups[is_on_killstreak_string].tokenize( name=user.player.name, on_killstreak_text=killstreak.text_on_killstreak, kills=user.killstreak, ), color1=KS_MSG_COLOR, x=KS_MSG_X, y=KS_MSG_Y, effect=KS_MSG_EFFECT, fade_in=KS_MSG_FADEIN, fade_out=KS_MSG_FADEOUT, hold_time=KS_MSG_HOLDTIME, fx_time=KS_MSG_FXTIME, channel=KS_MSG_CHANNEL, ) hud_msg.send(*indexes)
def on_cs_win_panel_match(game_event): # Check if the vote is still in progress if status.vote_status == status.VoteStatus.IN_PROGRESS: log.log_debug("on_cs_win_panel_match: vote was still in " "progress, finishing") finish_vote() # Check if next map is decided if status.next_map is None: log.log_debug("on_cs_win_panel_match: no next_map defined!") return # Check if we need to show it on player screens if not config_manager['nextmap_show_on_match_end']: return # HudMsg hud_msg = HudMsg( strings_popups['nextmap_msg'].tokenize( map=status.next_map.name), color1=NEXTMAP_MSG_COLOR, x=NEXTMAP_MSG_X, y=NEXTMAP_MSG_Y, effect=NEXTMAP_MSG_EFFECT, fade_in=NEXTMAP_MSG_FADEIN, fade_out=NEXTMAP_MSG_FADEOUT, hold_time=NEXTMAP_MSG_HOLDTIME, fx_time=NEXTMAP_MSG_FXTIME ) hud_msg.send(*[user.player.index for user in user_manager.values()]) # SayText2 broadcast(strings_common['nextmap_msg'], map=status.next_map.name)
def _centertell(command): userid = command[1] if userid != '': userid = int(userid) else: return if exists(userid): command_string = command.arg_string command_string = command_string.replace(str(userid) + " ", '') index = index_from_userid(userid) if SOURCE_ENGINE_BRANCH == "css": queue_command_string("es_centertell %s %s" % (userid, command_string)) else: HudMsg(command_string, -1, 0.35, hold_time=5.0).send(index)
def repeat_flag_stat_display(): if not _flags or not _team_points: return HudMsg(common_strings['flag_stats'].tokenized( red_points=_team_points[FlagTeam.RED.value], red_flag=_flags[FlagTeam.RED.value].state_string, blue_points=_team_points[FlagTeam.BLUE.value], blue_flag=_flags[FlagTeam.BLUE.value].state_string, ), color1=FLAGMSG_COLOR, x=FLAGMSG_X, y=FLAGMSG_Y, effect=FLAGMSG_EFFECT, fade_in=FLAGMSG_FADEIN, fade_out=FLAGMSG_FADEOUT, hold_time=FLAGMSG_HOLDTIME, fx_time=FLAGMSG_FXTIME, channel=FLAGMSG_CHANNEL).send()
def send_flag_message(message, flag, player=None): if player is None: message = message.tokenized(flag=colorize( common_strings['flag name ' + flag.team.name.lower()]), ) else: message = message.tokenized( player=player.name, flag=colorize(common_strings['flag name ' + flag.team.name.lower()]), ) SayText2(tagged(colorize(message))).send() HudMsg( strip_colors(message), color1=HUDMSG_COLOR, x=HUDMSG_X, y=HUDMSG_Y, effect=HUDMSG_EFFECT, fade_in=HUDMSG_FADEIN, fade_out=HUDMSG_FADEOUT, hold_time=HUDMSG_HOLDTIME, fx_time=HUDMSG_FXTIME, channel=HUDMSG_CHANNEL, ).send()
def wcs_centertell_command(command_info, player:convert_userid_to_player, *message:str): if player is None: return HudMsg(' '.join(message), y=0.2).send(player.index)
def wcs_centermsg_command(command_info, *message:str): HudMsg(' '.join(message), y=0.2).send()
def wcs_xcentertell_command(command_info, userid:str, name:str, *args:str): players, message = _format_message(userid, name, args) for player in players: HudMsg(message[message.get(player.language, 'en')], y=0.2).send(player.index)
# Helpers from ....core.helpers.overwrites import SayText2 # Modules from ....core.modules.races.calls import SkillEvent from ....core.modules.races.calls import RaceEvent from ....core.modules.races.manager import race_manager # Players from ....core.players.entity import Player from ....core.players.filters import PlayerReadyIter # ============================================================================ # >> GLOBAL VARIABLES # ============================================================================ settings = race_manager.find(__name__) vampiric_aura_leech_message = HudMsg(settings.strings['vampiric_aura leech'], y=0.20) unholy_aura_message = SayText2(settings.strings['unholy_aura message']) levitation_message = SayText2(settings.strings['levitation message']) max_health = settings.config['skills']['vampiric_aura']['other']['max_health'] min_health_gain = settings.config['skills']['vampiric_aura']['other'][ 'min_health_gain'] max_health_gain = settings.config['skills']['vampiric_aura']['other'][ 'max_health_gain'] spawncmd_effect = settings.get_effect_entry('spawncmd') vampiric_aura_effect_0 = settings.get_effect_entry('vampiric_aura_0') vampiric_aura_effect_1 = settings.get_effect_entry('vampiric_aura_1') vampiric_aura_effect_2 = settings.get_effect_entry('vampiric_aura_2') vampiric_aura_effect_3 = settings.get_effect_entry('vampiric_aura_3')
_remove_requests_queue = [] _protected_immune_areas = [] _entities_spawned_this_approach = 0 _entities_removed_this_approach = 0 _entities_spawned_this_tick = 0 _entities_removed_this_tick = 0 _total_entities = 0 _debug_mode = False _debug_msg = HudMsg( common_strings['debug_msg'], color1=HUDMSG_COLOR, x=HUDMSG_X, y=HUDMSG_Y, effect=HUDMSG_EFFECT, fade_out=HUDMSG_FADEOUT, hold_time=HUDMSG_HOLDTIME, fx_time=HUDMSG_FXTIME, channel=HUDMSG_CHANNEL, ) # ============================================================================= # >> CLASSES # ============================================================================= class RatPlayer: def __init__(self, index): self.player = Player(index) self._last_area_id = -1 self._last_block = None
# Modules from ....core.modules.races.calls import SkillEvent from ....core.modules.races.calls import RaceEvent from ....core.modules.races.manager import race_manager # Players from ....core.players.entity import Player from ....core.players.filters import PlayerReadyIter # ============================================================================ # >> GLOBAL VARIABLES # ============================================================================ settings = race_manager.find(__name__) _delays = {} reincarnation_counter_message = HudMsg( settings.strings['reincarnation counter'], y=0.2) reincarnation_complete_message = HudMsg( settings.strings['reincarnation complete'], y=0.2) reincarnation_initialize_message = SayText2( settings.strings['reincarnation initialize']) chain_lightning_count_message = SayText2( settings.strings['chain_lightning count']) chain_lightning_failed_message = SayText2( settings.strings['chain_lightning failed']) chain_lightning_block_attacker_message = SayText2( settings.strings['chain_lightning block attacker']) chain_lightning_block_victim_message = SayText2( settings.strings['chain_lightning block victim']) critical_strike_effect = settings.get_effect_entry('critical_strike') critical_grenade_0_effect = settings.get_effect_entry('critical_grenade_0')
from ....core.modules.races.calls import SkillEvent from ....core.modules.races.calls import RaceEvent from ....core.modules.races.manager import race_manager # Players from ....core.players.entity import Player # ============================================================================ # >> GLOBAL VARIABLES # ============================================================================ settings = race_manager.find(__name__) _delays = defaultdict(list) invisibility_message = SayText2(settings.strings['invisibility message']) devotion_aura_message = SayText2(settings.strings['devotion_aura message']) bash_attacker_message = HudMsg(settings.strings['bash attacker'], y=0.2) bash_victim_message = HudMsg(settings.strings['bash victim'], y=0.2) teleport_failed_message = SayText2(settings.strings['teleport failed']) spawncmd_effect = settings.get_effect_entry('spawncmd') bash_effect_0 = settings.get_effect_entry('bash_0') bash_effect_1 = settings.get_effect_entry('bash_1') teleport_effect_0 = settings.get_effect_entry('teleport_0') teleport_effect_1 = settings.get_effect_entry('teleport_1') teleport_effect_2 = settings.get_effect_entry('teleport_2') teleport_effect_3 = settings.get_effect_entry('teleport_3') # ============================================================================ # >> RACE CALLBACKS # ============================================================================