def OnPlayerKilled(self, victim, killer, weapon): if victim == None: return # Disconnecting player_previous to prevent multiple penalties. flagindex = self.ft_flagindexbyplayer(victim) if flagindex >= 0: self.flaglist[flagindex].player_previous = 0 GEUtil.EmitGameplayEvent("ld_flagdropped", str(victim.GetUserID()), str(killer.GetUserID())) vid = GEEntity.GetUID(victim) kid = GEEntity.GetUID(killer) ep_shout("[OPK] Victim %d, Killer %d, VFlag Index %d" % (vid, kid, flagindex)) bounty = min(self.flaglist[flagindex].earnings, self.flaglist[flagindex].LEVEL_LIMIT) # Suicide if killer == None or killer.GetIndex( ) == 0 or vid == kid or GEMPGameRules.IsTeamplay( ) and victim.GetTeamNumber() == killer.GetTeamNumber(): suicide_bounty = -choice(flagindex >= 0, bounty + bounty, 1) ep_incrementscore(victim, suicide_bounty) if flagindex >= 0: GEUtil.EmitGameplayEvent("ld_flagpoint", str(victim.GetUserID()), "-1", "suicide", str(suicide_bounty)) return # slap and snatch TODO: Verify if weapon != None and weapon.GetClassname( ) == "weapon_slappers" and flagindex >= 0: delta = choice(flagindex >= 0, bounty, 0) if delta > 0: ep_incrementscore(victim, -delta) GEUtil.HudMessage( victim, _(plural(delta, "#GES_GP_LD_LOSEPOINTS"), delta), -1, -1, EP_SHOUT_COLOR, 2.0) ep_incrementscore(killer, delta) GEUtil.HudMessage( killer, _(plural(delta, "#GES_GP_LD_STOLEPOINTS"), delta), -1, -1, EP_SHOUT_COLOR, 2.0) GEUtil.EmitGameplayEvent("ld_flagpoint", str(victim.GetUserID()), str(killer.GetUserID()), "slapperkill", str(-delta)) # credit if token will be removed from play. TODO: Verify if self.ft_flagdebt() < 0: if flagindex >= 0: ep_incrementscore(killer, self.flaglist[flagindex].level) else: ep_shout( "[OPK] No flag index associated with slain carrier whose flag is removed." )
def ft_announceescaping(self, flag): player = ep_player_by_id(flag.player_id) GEUtil.HudMessage( player, _(plural(flag.escapes, "#GES_GP_LD_ESCAPED"), flag.escapes), -1, -1, EP_SHOUT_COLOR, 2.0) GEUtil.PlaySoundTo(player, "Buttons.beep_ok") ep_shout("Escaped successfully.")
def OnPlayerKilled( self, victim, killer, weapon ): if victim == None: return # Disconnecting player_previous to prevent multiple penalties. flagindex = self.ft_flagindexbyplayer( victim ) if flagindex >= 0: self.flaglist[flagindex].player_previous = 0 GEUtil.EmitGameplayEvent( "ld_flagdropped", str( victim.GetUserID() ), str( killer.GetUserID() ) ) vid = GEEntity.GetUID( victim ) kid = GEEntity.GetUID( killer ) ep_shout( "[OPK] Victim %d, Killer %d, VFlag Index %d" % ( vid, kid, flagindex ) ) bounty = min( self.flaglist[flagindex].earnings, self.flaglist[flagindex].LEVEL_LIMIT ) # Suicide if killer == None or killer.GetIndex() == 0 or vid == kid or GEMPGameRules.IsTeamplay() and victim.GetTeamNumber() == killer.GetTeamNumber(): suicide_bounty = -choice( flagindex >= 0, bounty + bounty, 1 ) ep_incrementscore( victim, suicide_bounty ) if flagindex >= 0: GEUtil.EmitGameplayEvent( "ld_flagpoint", str( victim.GetUserID() ), "-1", "suicide", str( suicide_bounty ) ) return # slap and snatch TODO: Verify if weapon != None and weapon.GetClassname() == "weapon_slappers" and flagindex >= 0: delta = choice( flagindex >= 0, bounty, 0 ) if delta > 0: ep_incrementscore( victim, -delta ) GEUtil.HudMessage( victim, _( plural( delta, "#GES_GP_LD_LOSEPOINTS" ), delta ), -1, -1, EP_SHOUT_COLOR, 2.0 ) ep_incrementscore( killer, delta ) GEUtil.HudMessage( killer, _( plural( delta, "#GES_GP_LD_STOLEPOINTS" ), delta ), -1, -1, EP_SHOUT_COLOR, 2.0 ) GEUtil.EmitGameplayEvent( "ld_flagpoint", str( victim.GetUserID() ), str( killer.GetUserID() ), "slapperkill", str( -delta ) ) # credit if token will be removed from play. TODO: Verify if self.ft_flagdebt() < 0: if flagindex >= 0: ep_incrementscore( killer, self.flaglist[flagindex].level ) else: ep_shout( "[OPK] No flag index associated with slain carrier whose flag is removed." )
def PrintFragMessages( self, killer, teamName, teamScore ): if not self.FirstBlood and self.FragLimit > 1: GEUtil.ClientPrint( None, GEGlobal.HUD_PRINTTALK, "#GES_GP_TDM_FIRSTBLOOD", teamName ) self.PlayTeamSounds( killer.GetTeamNumber() ) self.FirstBlood = True if not self.LateAttendance: scoreToWin = self.FragLimit - teamScore if scoreToWin == 0: GEUtil.ClientPrint( None, GEGlobal.HUD_PRINTTALK, "#GES_GP_TDM_WON", teamName ) elif scoreToWin <= 3: GEUtil.ClientPrint( None, GEGlobal.HUD_PRINTTALK, plural( scoreToWin, "#GES_GP_TDM_FRAGS_LEFT" ), teamName, str( scoreToWin ) ) self.PlayTeamSounds( killer.GetTeamNumber() )
def PrintFragMessages(self, killer, teamName, teamScore): if not self.FirstBlood and self.FragLimit > 1: GEUtil.ClientPrint(None, GEGlobal.HUD_PRINTTALK, "#GES_GP_TDM_FIRSTBLOOD", teamName) self.PlayTeamSounds(killer.GetTeamNumber()) self.FirstBlood = True if not self.LateAttendance: scoreToWin = self.FragLimit - teamScore if scoreToWin == 0: GEUtil.ClientPrint(None, GEGlobal.HUD_PRINTTALK, "#GES_GP_TDM_WON", teamName) elif scoreToWin <= 3: GEUtil.ClientPrint( None, GEGlobal.HUD_PRINTTALK, plural(scoreToWin, "#GES_GP_TDM_FRAGS_LEFT"), teamName, str(scoreToWin)) self.PlayTeamSounds(killer.GetTeamNumber())
def lld_baron_levelup( self ): self.baron_level = clamp( self.baron_level + 1, 1, self.BARON_LEVEL_MAX ) if self.baron_level <= self.BARON_WEAPON_LIMIT: GEUtil.ClientPrint( None, GEGlobal.HUD_PRINTTALK, plural( self.baron_level, "#GES_GP_LALD_WEAPON" ), str( self.baron_level ) ) else: GEUtil.ClientPrint( None, GEGlobal.HUD_PRINTTALK, "#GES_GP_LALD_DAMAGE", str( self.lld_baron_damageamp() ) )
def ft_announceescaping( self, flag ): player = ep_player_by_id( flag.player_id ) GEUtil.HudMessage( player, _( plural( flag.escapes, "#GES_GP_LD_ESCAPED" ), flag.escapes ), -1, -1, EP_SHOUT_COLOR, 2.0 ) GEUtil.PlaySoundTo( player, "Buttons.beep_ok" ) ep_shout( "Escaped successfully." )