public bool playerDeath(Player victim, Player killer, Helpers.KillType killType, CS_VehicleDeath update)
 {
     //Calculate rewards AGAIN if double exp
     if (doubleXP == 2 && killer != null)
     {
         Logic_Rewards.calculatePlayerKillRewards(victim, killer, update);
     }
     return(true);
 }
Esempio n. 2
0
        public bool playerDeath(Player victim, Player killer, Helpers.KillType killType, CS_VehicleDeath update)
        {
            //Was it a player kill?
            if (killType == Helpers.KillType.Player)
            {   //No team killing!
                if (victim._team != killer._team)
                {
                    //Does the killer have an HQ?
                    if (_hqs[killer._team] != null)
                    {
                        //Reward his HQ! (Victims bounty + half of own)
                        _hqs[killer._team].Bounty += victim.Bounty + (killer.Bounty / 2);
                    }
                }
            }

            //Was it a computer kill?
            if (killType == Helpers.KillType.Computer)
            {
                //Let's find the vehicle!
                Computer cvehicle  = victim._arena.Vehicles.FirstOrDefault(v => v._id == update.killerPlayerID) as Computer;
                Player   vehKiller = cvehicle._creator;
                //Do they exist?
                if (cvehicle != null && vehKiller != null)
                {   //We'll take it from here...
                    update.type           = Helpers.KillType.Player;
                    update.killerPlayerID = vehKiller._id;

                    //Don't reward for teamkills
                    if (vehKiller._team == victim._team)
                    {
                        Logic_Assets.RunEvent(vehKiller, _arena._server._zoneConfig.EventInfo.killedTeam);
                    }
                    else
                    {
                        Logic_Assets.RunEvent(vehKiller, _arena._server._zoneConfig.EventInfo.killedEnemy);
                    }

                    //Increase stats/HQ bounty and notify arena of the kill!
                    if (_hqs[vehKiller._team] != null)
                    {
                        //Reward his HQ! (Victims bounty + half of own)
                        _hqs[vehKiller._team].Bounty += victim.Bounty + (vehKiller.Bounty / 2);
                    }

                    vehKiller.Kills++;
                    victim.Deaths++;
                    Logic_Rewards.calculatePlayerKillRewards(victim, vehKiller, update);
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 3
0
        public bool playerDeath(Player victim, Player killer, Helpers.KillType killType, CS_VehicleDeath update)
        {
            //Respawn flag where it was initially spawn if a marine died carrying one
            try
            {
                _arena.flagResetPlayer(victim);
            }
            catch (Exception e)
            {
                Log.write(TLog.Exception, "exception in flagResetPlayer(victim):: '{0}'", e);
            }
            //Was it a computer kill?
            if (killType == Helpers.KillType.Computer)
            {
                //Let's find the vehicle!
                Computer cvehicle  = victim._arena.Vehicles.FirstOrDefault(v => v._id == update.killerPlayerID) as Computer;
                Player   vehKiller = cvehicle._creator;
                //Does it exist?
                if (cvehicle != null && vehKiller != null)
                {
                    //We'll take it from here...
                    update.type           = Helpers.KillType.Player;
                    update.killerPlayerID = vehKiller._id;

                    //Don't reward for teamkills
                    if (vehKiller._team == victim._team)
                    {
                        Logic_Assets.RunEvent(vehKiller, _arena._server._zoneConfig.EventInfo.killedTeam);
                    }
                    else
                    {
                        Logic_Assets.RunEvent(vehKiller, _arena._server._zoneConfig.EventInfo.killedEnemy);
                    }

                    //Increase stats and notify arena of the kill!
                    vehKiller.Kills++;
                    victim.Deaths++;
                    Logic_Rewards.calculatePlayerKillRewards(victim, vehKiller, update);
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 4
0
        public bool playerDeath(Player victim, Player killer, Helpers.KillType killType, CS_VehicleDeath update)
        {
            if (killer == null)
            {
                return(true);
            }

            //Was it a player kill?
            if (killType == Helpers.KillType.Player)
            {   //No team killing!
                if (victim._team != killer._team)
                {
                    //Does the killer have an HQ?
                    if (_hqs[killer._team] != null)
                    {
                        //Reward his HQ! (Victims bounty + half of own)
                        _hqs[killer._team].Bounty += victim.Bounty + (killer.Bounty / 2);
                    }
                }

                //Find out if KOTH is running
                if (_activeCrowns.Count == 0 || killer == null)
                {
                    return(true);
                }

                //Handle crowns
                if (_playerCrownStatus.ContainsKey(victim) && _playerCrownStatus[victim].crown)
                {   //Incr crownDeaths
                    _playerCrownStatus[victim].crownDeaths++;

                    if (_playerCrownStatus[victim].crownDeaths >= _config.king.deathCount)
                    {
                        //Take it away now
                        _playerCrownStatus[victim].crown = false;
                        _noCrowns.Remove(victim);
                        Helpers.Player_Crowns(_arena, false, _noCrowns);
                    }
                    if (_playerCrownStatus.ContainsKey(killer))
                    {
                        if (!_playerCrownStatus[killer].crown)
                        {
                            _playerCrownStatus[killer].crownKills++;
                        }
                    }
                }

                //Reset their timer
                if (_playerCrownStatus.ContainsKey(killer))
                {
                    if (_playerCrownStatus[killer].crown)
                    {
                        updateCrownTime(killer);
                    }
                    else if (_config.king.crownRecoverKills != 0)
                    {   //Should they get a crown?
                        if (_playerCrownStatus[killer].crownKills >= _config.king.crownRecoverKills)
                        {
                            _playerCrownStatus[killer].crown = true;
                            giveCrown(killer);
                        }
                    }
                }
            }

            //Was it a computer kill?
            if (killType == Helpers.KillType.Computer)
            {
                //Let's find the vehicle!
                Computer cvehicle  = victim._arena.Vehicles.FirstOrDefault(v => v._id == update.killerPlayerID) as Computer;
                Player   vehKiller = cvehicle._creator;
                //Do they exist?
                if (cvehicle != null && vehKiller != null)
                {   //We'll take it from here...
                    update.type           = Helpers.KillType.Player;
                    update.killerPlayerID = vehKiller._id;

                    //Don't reward for teamkills
                    if (vehKiller._team == victim._team)
                    {
                        Logic_Assets.RunEvent(vehKiller, _arena._server._zoneConfig.EventInfo.killedTeam);
                    }
                    else
                    {
                        Logic_Assets.RunEvent(vehKiller, _arena._server._zoneConfig.EventInfo.killedEnemy);
                    }

                    //Increase stats/HQ bounty and notify arena of the kill!
                    if (_hqs[vehKiller._team] != null)
                    {
                        //Reward his HQ! (Victims bounty + half of own)
                        _hqs[vehKiller._team].Bounty += victim.Bounty + (vehKiller.Bounty / 2);
                    }

                    vehKiller.Kills++;
                    victim.Deaths++;
                    Logic_Rewards.calculatePlayerKillRewards(victim, vehKiller, update);
                    return(false);
                }
            }
            return(true);
        }