AddKill() public method

public AddKill ( bool player, bool npc ) : void
player bool
npc bool
return void
Example #1
0
        // BaseAnimal.Die()
        public static void NPCDied(BaseAnimal animal, HitInfo info)
        {
            if (info.Initiator != null)
            {
                Player      p     = new Player(info.Initiator as BasePlayer);
                PlayerStats stats = new PlayerStats(p.SteamID);
                stats.AddKill(false, true);
                p.Stats = stats;
            }

            var npc = new NPC(animal);

            OnNPCDied.OnNext(new Events.NPCDeathEvent(npc, info));
        }
Example #2
0
        // BasePlayer.Die()
        public static void PlayerDied(BasePlayer player, HitInfo info)
        {
            // works
            if (info == null)
            {
                info            = new HitInfo();
                info.damageType = player.metabolism.lastDamage;
                info.Initiator  = player as BaseEntity;
            }

            Player victim = new Player(player);

            if (info.Initiator != null)
            {
                PlayerStats statsV = new PlayerStats(victim.SteamID);

                if (info.Initiator is BasePlayer)
                {
                    Player      p     = new Player(info.Initiator as BasePlayer);
                    PlayerStats stats = new PlayerStats(p.SteamID);
                    stats.AddKill(true, false);
                    p.Stats = stats;

                    statsV.AddDeath(true, false);
                }
                else if (info.Initiator is BaseAnimal)
                {
                    statsV.AddDeath(false, true);
                }
                victim.Stats = statsV;
            }

            Events.PlayerDeathEvent pde = new Events.PlayerDeathEvent(victim, info);
            OnPlayerDied.OnNext(pde);

            if (!pde.dropLoot)
            {
                player.inventory.Strip();
            }
        }