Exemplo n.º 1
0
    def ar_SetLevel(self, player, lvl):
        if not player:
            return

        oldlvl = self.pltracker[player][TR_LEVEL]
        self.pltracker[player][TR_LEVEL] = lvl
        player.SetScore(
            lvl + 1
        )  # Correcting for the fact that "level 1" is actually 0 in the code, 2 is 1, 3 is 2, etc.
        GEUtil.EmitGameplayEvent("ar_levelchange", str(player.GetUserID()),
                                 str(lvl))

        # Play effects, but only if we actually changed level.  Also avoids playing effects on first spawn since starting level
        # is 0 and setlevel is called with 0 on first spawn.  With minimum level above 0 it will play effects, but it should.
        if lvl != oldlvl and lvl <= maxLevel:
            if self.ar_GetLevel(
                    player
            ) == maxLevel:  # Final level gets a special sound and announces to everyone.
                msg = _("#GES_GP_AR_FINALWEAPON", player.GetCleanPlayerName())
                GEUtil.PostDeathMessage(msg)
                GEUtil.PlaySoundTo(player, "GEGamePlay.Token_Grab_Enemy")
            elif lvl > oldlvl:  # Gained a level
                GEUtil.PlaySoundTo(player, "GEGamePlay.Level_Up")
            else:  # Lost a level.
                GEUtil.PlaySoundTo(player, "GEGamePlay.Level_Down")

        # Give weapons and print level.
        if lvl <= maxLevel:  # Can't give weapons if we're somehow past the max level.
            self.ar_PrintCurLevel(player)
            self.ar_GivePlayerWeapons(player)
        elif not GERules.IsIntermission():  # In fact, if we are, we just won!
            GEUtil.EmitGameplayEvent(
                "ar_completedarsenal", str(player.GetUserID()), "", "", "",
                True)  #Used for acheivements so we have to send to clients
            GERules.EndRound()
Exemplo n.º 2
0
    def OnPlayerKilled(self, victim, killer, weapon):
        if self.warmupTimer.IsInWarmup(
        ) or self.WaitingForPlayers or not victim:
            return
        else:
            if self.isBoris(victim):
                victim.AddRoundScore(-5)
                GEUtil.EmitGameplayEvent("iami_boris_suicide",
                                         "%i" % victim.GetUserID())
            else:
                GEUtil.EmitGameplayEvent("iami_killed_by_boris",
                                         "%i" % victim.GetUserID())
                GEUtil.EmitGameplayEvent("iami_boris_kills",
                                         "%i" % victim.GetUserID())
                GEScenario.OnPlayerKilled(self, victim, killer, weapon)
                weaponName = weapon.GetClassname().replace('weapon_',
                                                           '').lower()

                if self.isBoris(killer) and (weaponName == "slappers"
                                             or weaponName == "knife"):
                    GEUtil.PlaySoundToPlayer(killer, self.soundSpeedBoost,
                                             False)
                    self.timerBorisSpeedBoost = self.timerBorisSpeedBoostMax
                    GEUtil.EmitGameplayEvent("iami_boris_slap_kill",
                                             "%i" % killer.GetUserID())
                    if not self.isBorisSpeedBoosted:
                        self.isBorisSpeedBoosted = True
                        killer.SetSpeedMultiplier(self.speedBoostMultiplier)
Exemplo n.º 3
0
 def OnPlayerKilled(self, victim, killer, weapon):
     if victim == None:
         return
     if self.baron_uid != 0 and self.lld_player_isbaron(victim):
         # Baron died
         if killer == None or victim == killer:
             self.lld_eliminateplayer(victim)
             self.lld_misix_jackpot()
         elif not self.pltracker[self.baron_uid][TR_INROUND]:
             killer.AddRoundScore(self.bounty)
     else:
         # Player died
         if killer == None or victim == killer:
             # Eliminated by suicide, penalized
             self.lld_eliminateplayer(victim)
             victim.AddRoundScore(-self.lld_num_inround_players() + 1)
             baronid = self.lld_Baron().GetUserID() if (
                 self.lld_Baron()) else -1
             GEUtil.EmitGameplayEvent("lald_eliminated",
                                      str(victim.GetUserID()), str(baronid),
                                      "suicide")
         elif self.lld_player_isbaron(killer):
             killer.AddRoundScore(1)
             self.baron_frags += 1
             self.lld_eliminateplayer(victim)
             baronid = self.lld_Baron().GetUserID() if (
                 self.lld_Baron()) else -1
             GEUtil.EmitGameplayEvent("lald_eliminated",
                                      str(victim.GetUserID()), str(baronid),
                                      "baronkill")
Exemplo n.º 4
0
    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."
                )
Exemplo n.º 5
0
    def OnPlayerKilled(self, victim, killer, weapon):
        # Execute default DM scoring behavior
        GEScenario.OnPlayerKilled(self, victim, killer, weapon)

        if not victim:
            return

        if not self.game_inWaitTime and victim.GetDeaths() >= 2:
            # Lock the round (if not done already)
            GERules.LockRound()

            # Tell everyone who was eliminated
            GEUtil.ClientPrint(None,
                               Glb.HUD_PRINTTALK, "#GES_GP_YOLT_ELIMINATED",
                               victim.GetPlayerName())
            # Tell plugins who was eliminated
            GEUtil.EmitGameplayEvent("yolt_eliminated",
                                     str(victim.GetUserID()),
                                     str(killer.GetUserID() if killer else -1))
            # Tell the victim they are eliminated
            GEUtil.PopupMessage(victim, "#GES_GPH_ELIMINATED_TITLE",
                                "#GES_GPH_ELIMINATED")
            # Mark as eliminated by death
            self.pltracker[victim][TR_WASINPLAY] = True

            # Decrease the foes, eliminate the victim
            self.yolt_DecreaseFoes(victim)
Exemplo n.º 6
0
    def CalculateCustomDamage(self, victim, info, health, armor):
        attacker = GEPlayer.ToMPPlayer(info.GetAttacker())

        if self.isBoris(victim) and self.isExplosiveDamage(info):
            if self.isBoris(attacker):
                health = health * self.borisSelfDamageMultiplier
                armor = armor * self.borisSelfDamageMultiplier
            # We ignore the damage reduction for direct-hit explosions
            elif health + armor != 398.0:
                health = health * self.explosionDamageMultiplier
                armor = armor * self.explosionDamageMultiplier

        if self.isBoris(victim) and attacker and not self.isBoris(attacker):
            damageTotal = self.playerTracker.GetValue(attacker,
                                                      self.PLAYER_BORIS_DAMAGE)
            damageTotal += min(health + armor, self.breakpointDamage)

            if damageTotal >= self.breakpointDamage:
                damageTotal -= self.breakpointDamage
                attacker.AddRoundScore(1)
                GEMPGameRules.GetTeam(GEGlobal.TEAM_MI6).IncrementRoundScore(1)
                GEUtil.PlaySoundToPlayer(attacker, self.soundPoint, False)
                GEUtil.EmitGameplayEvent("iami_damage_point",
                                         "%i" % attacker.GetUserID())
            self.playerTracker.SetValue(attacker, self.PLAYER_BORIS_DAMAGE,
                                        damageTotal)
            health = 0
            armor = 0

        if self.identifyWeapon(info) == "weapon_slappers" and self.isBoris(
                attacker):
            health = 1000
            armor = 1000

        return health, armor
Exemplo n.º 7
0
    def OnTokenPicked(self, token, player):
        radar = GEMPGameRules.GetRadar()
        radar.DropRadarContact(token)
        radar.AddRadarContact(player, GEGlobal.RADAR_TYPE_PLAYER, True, "", self.CASE_COLOR)

        GEUtil.PlaySoundToPlayer(player, "GEGamePlay.Token_Grab")
        GEUtil.PostDeathMessage("^1"+player.GetPlayerName()+" ^ipicked up the Briefcase!")
        GEUtil.HudMessage(player, "You have the Briefcase!", -1, 0.75, self.CASE_COLOR, 3.0)
        GEUtil.EmitGameplayEvent("fyeo_case_picked", str(player.GetUserID()), "", "", "", True)

        player.SetScoreBoardColor(GEGlobal.SB_COLOR_GOLD)
        self.CaseOwnerID = player.GetUID

        # Case holder gets full health and armor upon case pickup, and gets slightly increased speed.
        player.SetHealth(int(GEGlobal.GE_MAX_HEALTH))
        player.SetArmor(int(GEGlobal.GE_MAX_ARMOR))
        player.SetSpeedMultiplier(1.15)

        # Explain to player what to do, now that he or she has the case. Will only show on first case pickup.
        if self.helplist.count(player.GetUID):
            return

        GEUtil.PopupMessage(player, "Briefcase", "You have the Briefcase! \nKill other players to eliminate them.")
        GEUtil.PopupMessage(player, "Scoring",
                                    "You score 1 point for every player you eliminate. "
                                    "\nIf you win the round, your score will be doubled for the round!")
        GEUtil.PopupMessage(player, "Buffs",
                                    "Upon picking up the Briefcase, you received full health and armor, "
                                    "plus increased speed. "
                                    "\nFor every player you eliminate, 1 bar of health (or armor, if health is full) "
                                    "will be restored.")
        self.helplist.append(player.GetUID)
Exemplo n.º 8
0
    def OnTokenDropped(self, token, player):
        tokenTeam = token.GetTeamNumber()
        otherTeam = OppositeTeam(tokenTeam)

        # Stop the override timer and force remove just in case
        self.game_timers[tokenTeam].Stop()
        GEUtil.RemoveHudProgressBar(player, self.PROBAR_OVERRIDE)

        GEUtil.EmitGameplayEvent("ctk_tokendropped", str(player.GetUserID()),
                                 str(tokenTeam))

        GERules.GetRadar().AddRadarContact(token, Glb.RADAR_TYPE_TOKEN, True,
                                           "", self.ctk_GetColor(tokenTeam))
        GERules.GetRadar().SetupObjective(
            token, Glb.TEAM_NONE, "", self.ctk_TokenName(tokenTeam),
            self.ctk_GetColor(tokenTeam, self.COLOR_OBJ_COLD))

        GERules.GetRadar().DropRadarContact(player)
        GERules.GetRadar().ClearObjective(player)

        player.SetSpeedMultiplier(1.0)
        player.SetScoreBoardColor(Glb.SB_COLOR_NORMAL)

        msg = _("#GES_GP_CTK_DROPPED", player.GetCleanPlayerName(),
                self.ctk_TokenName(tokenTeam))

        self.ctk_PostMessage(msg, tokenTeam, tokenTeam)
        self.ctk_PostMessage(msg, otherTeam, tokenTeam)

        GEUtil.PlaySoundTo(tokenTeam, "GEGamePlay.Token_Drop_Friend", True)
        GEUtil.PlaySoundTo(otherTeam, "GEGamePlay.Token_Drop_Enemy", True)
Exemplo n.º 9
0
    def OnTokenPicked(self, token, player):
        tokenTeam = token.GetTeamNumber()
        otherTeam = OppositeTeam(tokenTeam)

        self.game_tokens[tokenTeam].next_drop_time = GEUtil.GetTime() + 10.0

        GERules.GetRadar().DropRadarContact(token)
        GERules.GetRadar().AddRadarContact(
            player, Glb.RADAR_TYPE_PLAYER, True, "sprites/hud/radar/run",
            self.ctk_GetColor(player.GetTeamNumber()))
        GERules.GetRadar().SetupObjective(
            player, Glb.TEAM_NONE, "", self.ctk_TokenName(tokenTeam),
            self.ctk_GetColor(tokenTeam, self.COLOR_OBJ_HOT))

        GEUtil.EmitGameplayEvent("ctk_tokenpicked", str(player.GetUserID()),
                                 str(tokenTeam))

        # Token bearers move faster
        player.SetSpeedMultiplier(self.rules_speedMultiplier)
        player.SetScoreBoardColor(Glb.SB_COLOR_WHITE)

        msgFriend = _("#GES_GP_CTK_PICKED_FRIEND", player.GetCleanPlayerName(),
                      self.ctk_TokenName(tokenTeam))
        msgEnemy = _("#GES_GP_CTK_PICKED_FOE", player.GetCleanPlayerName(),
                     self.ctk_TokenName(tokenTeam))

        self.ctk_PostMessage(msgFriend, tokenTeam, tokenTeam)
        self.ctk_PostMessage(msgEnemy, otherTeam, tokenTeam)

        GEUtil.PlaySoundTo(tokenTeam, "GEGamePlay.Token_Grab", False)
        GEUtil.PlaySoundTo(otherTeam, "GEGamePlay.Token_Grab_Enemy", False)
Exemplo n.º 10
0
    def OnTokenPicked( self, token, player ):
        player.SetScoreBoardColor( GEGlobal.SB_COLOR_WHITE )
        GEMPGameRules.GetRadar().DropRadarContact( token )
        GEMPGameRules.GetRadar().AddRadarContact( player, GEGlobal.RADAR_TYPE_PLAYER, True, "sprites/hud/radar/run", choice( GEMPGameRules.IsTeamplay(), choice( player.GetTeamNumber() == GEGlobal.TEAM_MI6, self.COLOR_H_MI, self.COLOR_H_JS ), self.COLOR_HOLD ) )
        GEUtil.PlaySoundTo( player, "GEGamePlay.Token_Grab" )
        GEUtil.EmitGameplayEvent( "ld_flagpickup", str( player.GetUserID() ) )
        flagindex = self.ft_flagindexbytoken( token )
        if GEMPGameRules.IsTeamplay() and flagindex >= 0 and self.flaglist[flagindex].team_previous == player.GetTeamNumber() :
            self.ft_associate( token, player )
        else:
            self.ft_coldflaglevel( self.ft_associate( token, player ) )

        # Support team colors!
        if GEMPGameRules.IsTeamplay():
            if player.GetTeamNumber() == GEGlobal.TEAM_MI6:
                color = self.COLOR_MI6
            else:
                color = self.COLOR_JS

            GEMPGameRules.GetRadar().SetupObjective( player, GEGlobal.TEAM_NONE, "!%s" % self.TokenClass, "", color )
        else:
            GEMPGameRules.GetRadar().SetupObjective( player, GEGlobal.TEAM_NONE, "!%s" % self.TokenClass, "", self.COLOR_HOLD )

        self.ft_teambalancebars()
        self.ft_showteamflags()
Exemplo n.º 11
0
    def OnPlayerKilled(self, victim, killer, weapon):
        if self.WaitingForPlayers or self.warmupTimer.IsInWarmup(
        ) or GERules.IsIntermission() or not victim:
            return

        kL = self.ar_GetLevel(killer)
        vL = self.ar_GetLevel(victim)

        # Convert projectile entity names to their corresponding weapon
        name = weapon.GetClassname().lower()
        if name.startswith("npc_"):
            if name == "npc_grenade":
                name = "weapon_grenade"
            elif name == "npc_rocket":
                name = "weapon_rocket_launcher"
            elif name == "npc_shell":
                name = "weapon_grenade_launcher"
            elif name == "npc_mine_remote":
                name = "weapon_remotemine"
            elif name == "npc_mine_timed":
                name = "weapon_timedmine"
            elif name == "npc_mine_proximity":
                name = "weapon_proximitymine"

        if not killer or victim == killer:
            # World kill or suicide
            self.ar_IncrementKills(victim, -1)
        else:
            # Normal kill
            if name == "weapon_slappers" or name == "player":  # Slappers or killbind.
                self.ar_IncrementLevel(victim, -1)
                if vL > 0:
                    self.ar_IncrementLevel(
                        killer, 1
                    )  # Jump forward an entire level, keeping our kill count.
                    msg = _("#GES_GP_GUNGAME_SLAPPED",
                            victim.GetCleanPlayerName(),
                            killer.GetCleanPlayerName())
                    GEUtil.PostDeathMessage(msg)
                    GEUtil.EmitGameplayEvent("ar_levelsteal",
                                             str(killer.GetUserID()),
                                             str(victim.GetUserID()), "", "",
                                             True)  #Acheivement event
                else:
                    msg = _("#GES_GP_GUNGAME_SLAPPED_NOLOSS",
                            killer.GetCleanPlayerName())
                    GEUtil.PostDeathMessage(msg)
                    self.ar_IncrementKills(
                        killer, 1
                    )  # We can't steal a whole level but we can at least get a kill.

                killer.SetArmor(int(Glb.GE_MAX_ARMOR))
            elif maxLevel == self.ar_GetLevel(killer):
                self.ar_IncrementLevel(killer,
                                       1)  # Final level only needs one kill.
            else:
                self.ar_IncrementKills(killer, 1)

        victim.StripAllWeapons(
        )  # This prevents the victim from dropping weapons, which might confuse players since there are no pickups.
Exemplo n.º 12
0
    def OnPlayerKilled( self, victim, killer, weapon ):
        # Let the base scenario behavior handle scoring so we can just worry about the gun swap mechanics.
        GEScenario.OnPlayerKilled( self, victim, killer, weapon )
        
        if not victim:
            return

        if killer and victim != killer:
            # Normal kill

            # Equip new weapons
            wepname = weapon.GetClassname().lower()

            if (wepname == "weapon_slappers" or wepname == "trigger_trap"): #Slapper kills replace the victim's weapon with a random new one.
                self.gt_SubSwapWeapon( killer, victim )
            elif wepname == "player" and self.gt_GetWeaponTierOfPlayer(victim) >= self.gt_GetWeaponTierOfPlayer(killer): #Killbind greifing protection, lower tiers are better.
                self.gt_SubSwapWeapon( killer, victim )
            else:
                self.gt_SwapWeapons( killer, victim ) #Normal swap.    

            #Killer ID, Victim ID, Weapon Killer Traded Away, Weapon Victim Traded Away
            GEUtil.EmitGameplayEvent( "gt_weaponswap" , str( killer.GetUserID()), str( victim.GetUserID() ), weaponList[ self.pltracker[victim][TR_WEPINDEX] ], weaponList[ self.pltracker[killer][TR_WEPINDEX] ], True )

            self.gt_SpawnWeapon( killer ) # Only killer gets their weapon right now.
            
            GEUtil.PlaySoundTo( victim, "GEGamePlay.Woosh" )
            GEUtil.PlaySoundTo( killer, "GEGamePlay.Woosh" )

        victim.StripAllWeapons() # Victim always loses their weapons so they never drop anything, as there are no weapon pickups in this mode.
Exemplo n.º 13
0
    def OnTokenPicked(self, token, player):
        ID = str(GEEntity.GetUID(token))
        self.caseDict[ID] = Case(player)
        self.displayHold(player)

        GEUtil.PlaySoundToPlayer(player, "GEGamePlay.Token_Grab", True)
        GEUtil.HudMessage(player, self.pickText, -1, 0.67, self.colorMsg, 2.5,
                          1)

        GEMPGameRules.GetRadar().DropRadarContact(token)
        GEMPGameRules.GetRadar().AddRadarContact(player,
                                                 GEGlobal.RADAR_TYPE_PLAYER,
                                                 True, "sprites/hud/radar/run",
                                                 self.getColor(player))
        GEMPGameRules.GetRadar().SetupObjective(player, GEGlobal.TEAM_NONE,
                                                "!" + self.TokenClass, "",
                                                self.getColor(player), 0,
                                                False)

        player.SetScoreBoardColor(self.scoreboardOwner)

        GEUtil.PostDeathMessage(
            self.getTextColor(player) + player.GetCleanPlayerName() +
            self.grabText)

        GEUtil.EmitGameplayEvent("hb_casepicked", "%i" % player.GetUserID())
Exemplo n.º 14
0
 def StartWarmup(self,
                 duration=30.0,
                 endround_if_no_warmup=False,
                 keep_weaponset=False):
     now = GEUtil.GetTime()
     if duration > 0:
         self.time_endwarmup = now + duration
         self.time_nextnotice = duration
         self.keep_weaponset = keep_weaponset
         self.in_warmup = True
         GEUtil.InitHudProgressBar(None,
                                   CHAN_TIMER,
                                   "#GES_GP_INWARMUP",
                                   Glb.HUDPB_TITLEONLY,
                                   x=-1,
                                   y=.02)
         GEUtil.EmitGameplayEvent("ges_startwarmup")
         return True
     elif endround_if_no_warmup:
         self.keep_weaponset = keep_weaponset
         self.EndWarmup()
         return True
     else:
         # Just pass through...
         self.had_warmup = True
         self.in_warmup = False
         return False
Exemplo n.º 15
0
    def _think(self):
        # Don't worry about this if we are done
        if self.had_warmup:
            return

        now = GEUtil.GetTime()

        if self.in_warmup and now < self.time_endwarmup:
            time_left = self.time_endwarmup - now
            if time_left <= self.time_nextnotice:
                # Let everyone know how much time is left
                GEUtil.HudMessage(None,
                                  "#GES_GP_WARMUP\r%0.0f sec" % time_left, -1,
                                  0.75, COLOR_TIMER, 3.0, CHAN_TIMER)
                # Calculate the time to the next notice
                self.time_nextnotice = self._calc_next_notice(time_left)

        elif self.in_warmup and now >= self.time_endwarmup:
            # Notify players that warmup is now over
            self.EndWarmup()

        elif self.time_endround and now >= self.time_endround:
            # This completes our warmup
            self.time_endround = 0
            self.had_warmup = True
            GERules.EndRound(False, self.keep_weaponset)
            GEUtil.EmitGameplayEvent("ges_endwarmup")
	def OnThink(self):
		if int(GEUtil.GetCVarValue( "hb_scoring" )) == 0 and self.RoundActive:
			curtime = GEUtil.GetTime()
			if curtime >= self.nextCheckTime:
				self.updateTimers()
				self.nextCheckTime = curtime + 1.0
		
		if GEMPGameRules.GetNumActivePlayers() < 2:
			if not self.WaitingForPlayers:
				self.notice_WaitingForPlayers = 0
				GEMPGameRules.EndRound()
			elif GEUtil.GetTime() > self.notice_WaitingForPlayers:
				GEUtil.HudMessage( None, "#GES_GP_WAITING", -1, -1, self.colorMsg, 2.5, 1 )
				self.notice_WaitingForPlayers = GEUtil.GetTime() + 12.5

			self.warmupTimer.Reset()
			self.WaitingForPlayers = True
			return

		elif self.WaitingForPlayers:
			self.WaitingForPlayers = False
			if not self.warmupTimer.HadWarmup():
				self.warmupTimer.StartWarmup( int( GEUtil.GetCVarValue( "hb_warmup" ) ), True )
				if self.warmupTimer.IsInWarmup():
					GEUtil.EmitGameplayEvent( "hb_startwarmup" )
			else:
				GEMPGameRules.EndRound( False )
		else:
			if abs( GEMPGameRules.GetNumActivePlayers() - self.prevCount ) > 0 and not self.warmupTimer.IsInWarmup() and self.RoundActive:
				GEMPGameRules.GetTokenMgr().SetupToken( self.TokenClass, limit= self.getCaseLimit() )
Exemplo n.º 17
0
    def OnPlayerKilled(self, victim, killer, weapon):
        assert isinstance(victim, GEPlayer.CGEMPPlayer)
        assert isinstance(killer, GEPlayer.CGEMPPlayer)

        # In warmup? No victim?
        if self.warmupTimer.IsInWarmup() or not victim:
            return

        # death by world
        if not killer:
            victim.AddRoundScore(-1)
            return

        victimTeam = victim.GetTeamNumber()
        killerTeam = killer.GetTeamNumber()

        if victim == killer or victimTeam == killerTeam:
            # Suicide or team kill
            killer.AddRoundScore(-1)
        else:
            # Check to see if this was a kill against a token bearer (defense)
            if victim == self.game_tokens[victimTeam].GetOwner():
                clr_hint = '^i' if killerTeam == Glb.TEAM_MI6 else '^r'
                GEUtil.EmitGameplayEvent("ctk_tokendefended",
                                         str(killer.GetUserID()),
                                         str(victim.GetUserID()),
                                         str(victimTeam))
                GEUtil.PostDeathMessage(
                    _("#GES_GP_CTK_DEFENDED", clr_hint,
                      killer.GetCleanPlayerName(),
                      self.ctk_TokenName(victimTeam)))
                killer.AddRoundScore(2)
            else:
                killer.AddRoundScore(1)
Exemplo n.º 18
0
    def OnPlayerKilled(self, victim, killer, weapon):
        assert isinstance(victim, GEPlayer.CGEMPPlayer)
        assert isinstance(killer, GEPlayer.CGEMPPlayer)

        # In warmup? No victim?
        if self.warmupTimer.IsInWarmup() or not victim:
            return

        victimTeam = victim.GetTeamNumber()
        killerTeam = killer.GetTeamNumber(
        ) if killer else -1  # Only need to do this for killer since not having a victim aborts early.

        # death by world
        if not killer:
            victim.AddRoundScore(-1)
        elif victim == killer or victimTeam == killerTeam:
            # Suicide or team kill
            killer.AddRoundScore(-1)
        else:
            # Check to see if this was a kill against a token bearer (defense).  We know we have a killer and a victim but there might not be a weapon.
            if victim == self.game_tokens[victimTeam].GetOwner():
                clr_hint = '^i' if killerTeam == Glb.TEAM_MI6 else '^r'
                GEUtil.EmitGameplayEvent(
                    "ctf_tokendefended", str(killer.GetUserID()),
                    str(victim.GetUserID()), str(victimTeam),
                    weapon.GetClassname().lower() if weapon else "weapon_none",
                    True)
                GEUtil.PostDeathMessage(
                    _("#GES_GP_CTK_DEFENDED", clr_hint,
                      killer.GetCleanPlayerName(),
                      self.ctk_TokenName(victimTeam)))
                killer.AddRoundScore(2)
            else:
                killer.AddRoundScore(1)
Exemplo n.º 19
0
 def ft_creditescape( self, flag ):
     player = ep_player_by_id( flag.player_id )
     ep_incrementscore( player, flag.escapes )
     self.ft_escapee_armorup( flag, player )
     self.ft_announceescaping( flag )
     self.ft_escapebar_remove( flag )
     GEUtil.EmitGameplayEvent( "ld_flagpoint", str( player.GetUserID() ), "-1", "escape", str( flag.escapes ) )
Exemplo n.º 20
0
 def giveSkip(self, player):
     if self.playerTracker.GetValue(player, self.USED_SKIP):
         self.playerTracker.SetValue(player, self.USED_SKIP, False)
         GEUtil.EmitGameplayEvent("cr_restoredskip",
                                  "%i" % player.GetUserID())
         GEUtil.PlaySoundToPlayer(player, "GEGamePlay.Token_Chime", True)
         self.showSkipText(player)
Exemplo n.º 21
0
    def OnPlayerKilled(self, victim, killer, weapon):
        if self.waitingForPlayers or self.warmupTimer.IsInWarmup() or GERules.IsIntermission() or not victim:
            # Nothing to do but wait...
            return

        if not killer == victim:
            self.blood_counter[killer.GetUID()] = self.max_blood
            self.lostALife(victim)
            GEUtil.EmitGameplayEvent("vampire_death", str(victim.GetUID))
            killer.AddRoundScore(1)
            killer.SetHealth(killer.GetMaxHealth())
            if GERules.IsTeamplay():
                GERules.GetTeam(killer.GetTeamNumber()).AddRoundScore(1)
        else:
            self.lostALife(victim)
            GEUtil.EmitGameplayEvent("vampire_death_blood", str(victim.GetUID))
Exemplo n.º 22
0
 def CalculateCustomDamage(self, victim, info, health, armour):
     assert isinstance(victim, GEPlayer.CGEMPPlayer)
     if victim == None:
         return health, armour
     killer = GEPlayer.ToMPPlayer(info.GetAttacker())
     v_flagindex = self.ft_flagindexbyplayer(victim)
     k_flagindex = self.ft_flagindexbyplayer(killer)
     # ep_shout("[SDCD] %d %d" % (v_flagindex, k_flagindex) )
     if v_flagindex >= 0:
         # Suicide or friendly fire exacerbates but does not trigger escape.
         total_damage = health + armour
         if killer == None or GEEntity.GetUID(victim) == GEEntity.GetUID(
                 killer) or GEMPGameRules.IsTeamplay(
                 ) and victim.GetTeamNumber() == killer.GetTeamNumber():
             self.flaglist[v_flagindex].escape(False, total_damage)
         else:
             self.flaglist[v_flagindex].escape(True, total_damage)
             self.ft_escapebar(self.flaglist[v_flagindex], victim)
     if k_flagindex >= 0:
         # Flag carrier steals a point on successful attack.
         if victim.GetRoundScore() > 0:
             ep_incrementscore(victim, -self.THEFT_DELTA)
             ep_incrementscore(killer, self.THEFT_DELTA)
             GEUtil.PlaySoundTo(killer, "Buttons.beep_ok")
             GEUtil.PlaySoundTo(victim, "Buttons.Token_Knock")
             ep_shout("Point stolen from %s via slap." %
                      victim.GetPlayerName())
             GEUtil.EmitGameplayEvent("ld_flagpoint",
                                      str(killer.GetUserID()),
                                      str(victim.GetUserID()), "flaghit",
                                      "1")
     return health, armour
Exemplo n.º 23
0
    def OnThink(self):
        self.updateRings()

        if GEMPGameRules.GetNumActivePlayers() < 2:
            if not self.WaitingForPlayers:
                self.notice_WaitingForPlayers = 0
                GEMPGameRules.EndRound()
            elif GEUtil.GetTime() > self.notice_WaitingForPlayers:
                GEUtil.HudMessage(None, "#GES_GP_WAITING", -1, -1,
                                  GEUtil.Color(255, 255, 255, 255), 2.5, 1)
                self.notice_WaitingForPlayers = GEUtil.GetTime() + 12.5

            self.warmupTimer.Reset()
            self.WaitingForPlayers = True
            return

        elif self.WaitingForPlayers:
            self.WaitingForPlayers = False
            if not self.warmupTimer.HadWarmup():
                self.warmupTimer.StartWarmup(
                    int(GEUtil.GetCVarValue("up_warmup")), True)
                GEUtil.EmitGameplayEvent("up_startwarmup")
            else:
                GEMPGameRules.EndRound(False)

        if not self.warmupTimer.IsInWarmup() and not self.WaitingForPlayers:
            if GEMPGameRules.IsTeamplay():
                scoreMI6 = GEMPGameRules.GetTeam(
                    GEGlobal.TEAM_MI6).GetRoundScore()
                scoreJanus = GEMPGameRules.GetTeam(
                    GEGlobal.TEAM_JANUS).GetRoundScore()
            for uplinkPoint in list(self.areaDictionary):
                updated = self.areaDictionary[uplinkPoint].updateUplinkTimer(
                    self.uplinkTimerMax)
                self.updateBar(self.areaDictionary[uplinkPoint].playerList,
                               self.areaDictionary[uplinkPoint].name)
                if updated:
                    self.uplinkCaptured(self.areaDictionary[uplinkPoint].name,
                                        self.areaDictionary[uplinkPoint].UID,
                                        updated)
                if GEMPGameRules.IsTeamplay():
                    self.areaDictionary[uplinkPoint].updatePointTimer(
                        self.pointTimerMax)

                if not updated and (
                    (self.areaDictionary[uplinkPoint].timerJanus +
                     self.areaDictionary[uplinkPoint].timerMI6)
                        or len(self.areaDictionary[uplinkPoint].playerList)):
                    self.createObjective(
                        self.areaDictionary[uplinkPoint].UID,
                        self.areaDictionary[uplinkPoint].name,
                        self.areaDictionary[uplinkPoint].inProgress)
            if GEMPGameRules.IsTeamplay():
                if scoreMI6 != GEMPGameRules.GetTeam(
                        GEGlobal.TEAM_MI6).GetRoundScore(
                        ) or scoreJanus != GEMPGameRules.GetTeam(
                            GEGlobal.TEAM_JANUS).GetRoundScore():
                    self.showRoundScore(None)
Exemplo n.º 24
0
	def awardRoundScore(self):
		# For non-zero ties, award both teams a point
		if self.roundScoreMI6 == self.roundScoreJanus and not self.roundScoreJanus == 0:
			GEUtil.PostDeathMessage( self.winMsgTie )
			GEMPGameRules.GetTeam(GEGlobal.TEAM_MI6).IncrementRoundScore( 1 )
			GEMPGameRules.GetTeam(GEGlobal.TEAM_JANUS).IncrementRoundScore( 1 )
			GEUtil.EmitGameplayEvent( "cr_team_tie", str(GEGlobal.TEAM_MI6), str(GEGlobal.TEAM_JANUS) )
		
		elif self.roundScoreMI6 > self.roundScoreJanus:
			GEUtil.PostDeathMessage( self.winMsgMI6 )
			GEMPGameRules.GetTeam(GEGlobal.TEAM_MI6).IncrementRoundScore( 1 )
			GEUtil.EmitGameplayEvent( "cr_team_win", str(GEGlobal.TEAM_MI6) )
			GEUtil.EmitGameplayEvent( "cr_team_lose", str(GEGlobal.TEAM_JANUS) )
		
		elif self.roundScoreMI6 < self.roundScoreJanus:
			GEUtil.PostDeathMessage( self.winMsgJanus )
			GEMPGameRules.GetTeam(GEGlobal.TEAM_JANUS).IncrementRoundScore( 1 )
			GEUtil.EmitGameplayEvent( "cr_team_win", str(GEGlobal.TEAM_JANUS) )
			GEUtil.EmitGameplayEvent( "cr_team_lose", str(GEGlobal.TEAM_MI6) )

		self.resetRoundScore()
Exemplo n.º 25
0
    def CanRoundEnd(self):
        if self.warmupTimer.IsInWarmup():
            return False

        # No overtime with only 1 player.
        if GERules.GetNumActivePlayers() < 2:
            self.game_canFinishRound = True
            return True

        # See if any tokens are picked, if so we postpone the ending
        # We can only break overtime if a token is dropped or captured
        if not self.game_inOvertime and not GERules.IsIntermission():
            mi6Score = GERules.GetTeam(Glb.TEAM_MI6).GetRoundScore()
            janusScore = GERules.GetTeam(Glb.TEAM_JANUS).GetRoundScore()

            # Only go into overtime if our match scores are close and we have a token in hand
            if abs(mi6Score - janusScore) <= 0 and (self.ctk_IsTokenHeld(
                    Glb.TEAM_MI6) or self.ctk_IsTokenHeld(Glb.TEAM_JANUS)):
                GEUtil.HudMessage(None, "#GES_GPH_OVERTIME_TITLE", -1,
                                  self.MSG_MISC_YPOS, self.COLOR_NEUTRAL, 4.0,
                                  self.MSG_MISC_CHANNEL)
                GEUtil.PopupMessage(None, "#GES_GPH_OVERTIME_TITLE",
                                    "#GES_GPH_OVERTIME")
                GEUtil.EmitGameplayEvent("ctf_overtime")
                GEUtil.PlaySoundTo(None, "GEGamePlay.Overtime", True)
                self.game_inOvertime = True
                self.game_inOvertimeDelay = False
                self.game_canFinishRound = False
                # Ensure overtime never lasts longer than 5 minutes
                self.overtime.StartOvertime(300.0)

        elif not self.game_inOvertimeDelay and not GERules.IsIntermission():
            # Exit overtime if a team is eliminated, awarding the other team a point
            if GERules.GetNumInRoundTeamPlayers(Glb.TEAM_MI6) == 0:
                GERules.GetTeam(Glb.TEAM_JANUS).AddRoundScore(1)
                GEUtil.HudMessage(None, _("#GES_GP_CTK_OVERTIME_SCORE",
                                          "Janus"), -1, -1, self.COLOR_NEUTRAL,
                                  5.0)
                self.timerTracker.OneShotTimer(self.OVERTIME_DELAY,
                                               EndRoundCallback)
                self.game_inOvertimeDelay = True
            elif GERules.GetNumInRoundTeamPlayers(Glb.TEAM_JANUS) == 0:
                GERules.GetTeam(Glb.TEAM_MI6).AddRoundScore(1)
                GEUtil.HudMessage(None, _("#GES_GP_CTK_OVERTIME_SCORE", "MI6"),
                                  -1, -1, self.COLOR_NEUTRAL, 5.0)
                self.timerTracker.OneShotTimer(self.OVERTIME_DELAY,
                                               EndRoundCallback)
                self.game_inOvertimeDelay = True
            elif not self.overtime.CheckOvertime():
                # Overtime failsafe tripped, end the round now
                return True

        return self.game_canFinishRound
Exemplo n.º 26
0
	def updatePlayers(self):
		GEUtil.EmitGameplayEvent( "cr_weaponchange" )
		
		newWeapon = self.weaponList[ self.weaponIndex[0] ][ self.weaponIndex[1] ]
		GEUtil.HudMessage( None, "New Weapon: " + newWeapon.printName , -1, self.weaponMsgYPos, self.weaponMsgColor, 3.0, self.weaponMsgChannel )
		
		for i in range(32):
			if not GEPlayer.IsValidPlayerIndex(i):
				continue
			player = GEPlayer.GetMPPlayer(i)
			GEUtil.PlaySoundToPlayer( player, "GEGamePlay.Token_Drop_Enemy", True )
			if player.GetTeamNumber() != GEGlobal.TEAM_SPECTATOR:
				self.giveWeapons(player)
Exemplo n.º 27
0
    def OnTokenPicked( self, token, player ):
        self.aug_holder = player
        self.lld_progress()
        player.SetScoreBoardColor( GEGlobal.SB_COLOR_GOLD )

        radar = GEMPGameRules.GetRadar()
        radar.DropRadarContact( token )
        radar.AddRadarContact( player, GEGlobal.RADAR_TYPE_PLAYER, True, "", self.RADAR_SCARAMANGA )
        radar.SetupObjective( player, GEGlobal.TEAM_NONE, "", "", self.RADAR_SCARAMANGA )

        GEUtil.PlaySoundTo( player, "GEGamePlay.Token_Grab" )
        GEUtil.ClientPrint( None, GEGlobal.HUD_PRINTTALK, "#GES_GP_MWGG_PICKED", player.GetPlayerName() )
        GEUtil.HudMessage( player, "#GES_GP_MWGG_HAVEGG", -1, 0.75, self.RADAR_SCARAMANGA, 3.0 )
        GEUtil.EmitGameplayEvent( "lald_ggpickup", str( player.GetUserID() ) )
Exemplo n.º 28
0
    def OnPlayerKilled(self, victim, killer, weapon):
        # Let the base scenario behavior handle scoring so we can just worry about the thunderball mechanics.
        GEScenario.OnPlayerKilled(self, victim, killer, weapon)

        if self.waitingForPlayers or self.warmupTimer.IsInWarmup(
        ) or GERules.IsIntermission() or not victim:
            return

        # Pass the thunderball off
        if killer.GetUID() == Thunderball.TB_CARRIER:
            if self.isinplay(
                    victim):  # Bots don't work well at getting removed
                self.assignThunderball(victim, killer)
                GEUtil.EmitGameplayEvent("tb_passed", str(killer.GetUID()),
                                         str(victim.GetUID()), "", "", True)
Exemplo n.º 29
0
    def OnPlayerKilled(self, victim, killer, weapon):
        if not victim:
            return

        if not killer or victim == killer:
            # Death by world or suicide
            if victim == self.gg_owner:
                GEUtil.EmitGameplayEvent("mwgg_suicide",
                                         str(victim.GetUserID()))
                GEUtil.ClientPrint(None, GEGlobal.HUD_PRINTTALK,
                                   "#GES_GP_MWGG_SUICIDE")

            victim.AddRoundScore(-1)
        else:
            # Regular kill
            if victim == self.gg_owner:
                GEUtil.EmitGameplayEvent("mwgg_killed",
                                         str(victim.GetUserID()),
                                         str(killer.GetUserID()))
                GEUtil.ClientPrint(None, GEGlobal.HUD_PRINTTALK,
                                   "#GES_GP_MWGG_KILLED",
                                   killer.GetCleanPlayerName())

            killer.AddRoundScore(1)
Exemplo n.º 30
0
    def OnRoundEnd( self ):
        GEMPGameRules.GetRadar().DropAllContacts()

        # Describe default win type based on result
        endtype = "bondwin" if self.result == self.RESULT_BONDWIN else "baronwin"
        baronid = self.lld_Baron().GetUserID() if ( self.lld_Baron() ) else -1
        bondid = self.aug_holder.GetUserID() if ( self.aug_holder ) else -1

        if self.result == self.RESULT_BARONWIN and self.bounty >= 4 and self.baron_stats_hitbyaug == 0:
            GEUtil.PlaySoundTo( None, "GEGamePlay.Baron_Flawless", True )
            endtype = "baronflawless"
        elif self.result == self.RESULT_BONDWIN and self.bounty >= 4 and self.baron_frags == 0:
            GEUtil.PlaySoundTo( None, "GEGamePlay.Baron_EpicFail", True )
            endtype = "bondflawless"

        GEUtil.EmitGameplayEvent( "lald_roundend", endtype, str( baronid ), str( bondid ) )