Пример #1
0
        public static void Prefix(byte amount, Vector3 newRagdoll, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, ref EPlayerKill kill, bool trackKill, ERagdollEffect newRagdollEffect, bool canCauseBleeding, PlayerLife __instance)
        {
            Player ply = __instance.channel.owner.player;
            if (ply is null) return;

            if (amount >= ply.life.health)
            {
                Transform deathboxTransform = BarricadeManager.dropBarricade(new Barricade(1283),ply.transform, ply.transform.position, 0f, 0f, 0f, (ulong) ply.channel.owner.playerID.steamID, 0UL);
                byte x;
                byte y;
                ushort plant;
                ushort index;
                BarricadeRegion region;

                if (!BarricadeManager.tryGetInfo(deathboxTransform, out x, out y, out plant, out index, out region)) return;

                InteractableStorage storage = deathboxTransform.GetComponent<InteractableStorage>();
                storage.items.resize(10, 10);

                for (byte page = 0; page < 6; page++)
                {
                    for (byte i = 0; i < ply.inventory.items[page].getItemCount(); i++)
                    {
                        ItemJar item = ply.inventory.items[page].getItem(i);
                        storage.items.tryAddItem(item.item);
                    }
                }
                TTTPlayer.ClearInventoryUnsafe(__instance.channel.owner); // Clears clothing to prevent players aqquiring detective vest ect.
            }
        }
Пример #2
0
        private void OnEnemyConnected(SteamPlayer steamPlayer)
        {
            TTTPlayer.ClearInventoryUnsafe(steamPlayer);
            steamPlayer.player.interact.sendSalvageTimeOverride(16f);
            Player ply = steamPlayer.player;

            ply.life.serverModifyHealth(100.0f); // Change this
            ply.life.serverModifyStamina(100.0f);
        }
Пример #3
0
        private void OnPlayerDied(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator)
        {
            TTTPlayer victim = PlayerManager.GetTTTPlayer(sender.channel.owner.playerID.steamID);

            if (victim.GetRole() == PlayerRole.TRAITOR || victim.GetRole() == PlayerRole.DETECTIVE)
            {
                victim.SetCredits(0);
            }

            TTTPlayer killer = PlayerManager.GetTTTPlayer(instigator);

            if (killer is null)
            {
                return;
            }

            if (victim.GetRole() == PlayerRole.TRAITOR)
            {
                RoundManager.GetAlivePlayersWithRole(PlayerRole.DETECTIVE).ForEach(p => {
                    p.AddCredits(1);
                    p.SendMessage("You have gained 1 credit");
                });
                return;
            }

            if (killer.GetRole() == PlayerRole.TRAITOR && victim.GetRole() != PlayerRole.TRAITOR)
            {
                killer.AddCredits(1);
                killer.SendMessage("You have gained 1 credit");
                return;
            }
            // Gets a list of all players in the round that arent traitors
            List <TTTPlayer> players = RoundManager.GetAlivePlayersWithRole(PlayerRole.INNOCENT);

            RoundManager.GetAlivePlayersWithRole(PlayerRole.DETECTIVE).ForEach(p => players.Add(p));
            List <TTTPlayer> alive = players.FindAll(p => p.Status == PlayerStatus.ALIVE);

            CalculateKillCredit(players, alive, 0.75);
            CalculateKillCredit(players, alive, 0.50);
            CalculateKillCredit(players, alive, 0.25);
        }