public void OnDying(DyingEventArgs ev) { if (ev.Killer.Role == RoleType.Scp096) { dDamageToBeDone -= plugin.Config.DamagePerTarget; } }
/// <inheritdoc cref="Exiled.Events.Handlers.Player.OnDying(DyingEventArgs)"/> public static void OnDying(DyingEventArgs ev) { if (!ev.HitInformation.IsPlayer) { return; } if (!Methods.InfectedPlayers.Contains(ev.Target)) { return; } Methods.InfectedPlayers.Remove(ev.Target); foreach (Player player in Player.List) { if (player.Role != RoleType.Scp049 || player.IsNpc()) { continue; } if (Vector3.Distance(ev.Target.Position, player.Position) > Plugin.Instance.Config.Range) { continue; } ev.Target.DropItems(); ev.Target.SetRole(RoleType.Scp0492, true); } }
protected void PlayerDied(DOLEvent e, object sender, EventArgs args) { DyingEventArgs arg = args as DyingEventArgs; if (arg == null) { return; } GameObject killer = arg.Killer as GameObject; GamePlayer playerKiller = null; if (killer is GamePlayer) { playerKiller = killer as GamePlayer; } else if (killer is GameNPC && (killer as GameNPC).Brain != null && (killer as GameNPC).Brain is AI.Brain.IControlledBrain) { playerKiller = ((killer as GameNPC).Brain as AI.Brain.IControlledBrain).Owner as GamePlayer; } Stop(); m_player.Guild.SendMessageToGuildMembers(m_player.Name + " has dropped the guild banner!", eChatType.CT_Guild, eChatLoc.CL_SystemWindow); gameItem = new WorldInventoryItem(m_item); var point = m_player.GetPointFromHeading(m_player.Heading, 30); gameItem.Position = new Vector3(point, m_player.Position.Z); gameItem.Heading = m_player.Heading; gameItem.CurrentRegionID = m_player.CurrentRegionID; gameItem.AddOwner(m_player); if (playerKiller != null) { // Guild banner can be picked up by anyone in the enemy group if (playerKiller.Group != null) { foreach (GamePlayer player in playerKiller.Group.GetPlayersInTheGroup()) { gameItem.AddOwner(player); } } else { gameItem.AddOwner(playerKiller); } } // Guild banner can be picked up by anyone in the dead players group if (m_player.Group != null) { foreach (GamePlayer player in m_player.Group.GetPlayersInTheGroup()) { gameItem.AddOwner(player); } } gameItem.StartPickupTimer(10); m_item.OnLose(m_player); gameItem.AddToWorld(); }
internal static void OnKill(DyingEventArgs ev) { if (ev.Target?.UserId == null || ev.Target.IsHost || !ev.Target.IsVerified || PauseRound || !ev.IsAllowed || !Helper.IsPlayerValid(ev.Target, false) || !RoundSummary.RoundInProgress()) { return; } if (!ev.Target.DoNotTrack && ev.Target.IPAddress != "127.0.0.WAN" && ev.Target.IPAddress != "127.0.0.1") { StatHandler.SendRequest(RequestType.Death, "{\"playerid\": \"" + Helper.HandleId(ev.Target) + "\", \"killerrole\": \"" + (ev.Killer == null ? ((int)ev.Target.Role).ToString() : ((int)ev.Killer.Role).ToString()) + "\", \"playerrole\": \"" + ((int)ev.Target.Role).ToString() + "\", \"damagetype\": \"" + DamageTypes.ToIndex(ev.HitInformation.GetDamageType()).ToString() + "\"}"); } if (ev.HitInformation.GetDamageType() == DamageTypes.Pocket && PocketPlayers.TryGetValue(Helper.HandleId(ev.Target), out var killer)) { StatHandler.SendRequest(RequestType.Kill, "{\"playerid\": \"" + killer + "\", \"targetrole\": \"" + ((int)ev.Target.Role).ToString() + "\", \"playerrole\": \"" + ((int)RoleType.Scp106).ToString() + "\", \"damagetype\": \"" + DamageTypes.ToIndex(ev.HitInformation.GetDamageType()).ToString() + "\"}"); return; } if (ev.Killer?.UserId == null || ev.Killer.IsHost || !ev.Killer.IsVerified || ev.Killer.IPAddress == "127.0.0.WAN" || ev.Killer.IPAddress == "127.0.0.1" || ev.Killer.RawUserId == ev.Target.RawUserId || ev.Killer.DoNotTrack || !Helper.IsPlayerValid(ev.Killer, false)) { return; } StatHandler.SendRequest(RequestType.Kill, "{\"playerid\": \"" + Helper.HandleId(ev.Killer) + "\", \"targetrole\": \"" + ((int)ev.Target.Role).ToString() + "\", \"playerrole\": \"" + ((int)ev.Killer.Role).ToString() + "\", \"damagetype\": \"" + DamageTypes.ToIndex(ev.HitInformation.GetDamageType()).ToString() + "\"}"); }
private void OnDying(DyingEventArgs ev) { if (Check(ev.Target)) { Plugin.Instance.StopRagdollsList.Add(ev.Target); } }
internal void OnDying(DyingEventArgs ev) { if (IsLobby) { ev.Target.ClearInventory(); } }
internal void OnPlayerDeath(DyingEventArgs ev) { if ((ev.Target.Team == Team.SCP || (pluginInstance.Config.AreTutorialsSCP && ev.Target.Team == Team.TUT)) && Round.IsStarted && pluginInstance.Config.EnableSCPSuicideAutoWarn && !TemporarilyDisabledWarns) { if ((DateTime.Now - lastTeslaEvent).Seconds >= pluginInstance.Config.Scp079TeslaEventWait) { if (ev.HitInformation.Tool.Name == "TESLA" || (ev.HitInformation.Tool.Name == "WALL" && ev.HitInformation.Amount >= 50000) || (ev.HitInformation.Tool.Name == "GRENADE" && ev.Killer == ev.Target)) { pluginInstance.Functions.LogWarn(ev.Target, ev.HitInformation.Tool.Name); pluginInstance.Functions.OnQuitOrSuicide(ev.Target); } else if ((ev.HitInformation.Tool.Name == "WALL" && ev.HitInformation.Amount == -1f) && ev.Killer == ev.Target && pluginInstance.Config.QuitEqualsSuicide) { pluginInstance.Functions.LogWarn(ev.Target, "Disconnect"); pluginInstance.Functions.OnQuitOrSuicide(ev.Target); } } } if (pluginInstance.Config.NotifyLastPlayerAlive) { List <Features.Player> team = Features.Player.Get(ev.Target.Team).ToList(); if (team.Count - 1 == 1) { if (team[0] == ev.Target) { team[1].ShowHint(pluginInstance.Config.LastPlayerAliveNotificationText, pluginInstance.Config.LastPlayerAliveMessageDuration); } else { team[0].ShowHint(pluginInstance.Config.LastPlayerAliveNotificationText, pluginInstance.Config.LastPlayerAliveMessageDuration); } } } if (ev.Target.IsScp || ev.Target.Role == RoleType.Tutorial && pluginInstance.Config.AreTutorialsSCP) { if (ev.Target.Nickname != ev.Killer.Nickname) { if (pluginInstance.Config.ScpDeathMessage.Show) { var message = pluginInstance.Config.ScpDeathMessage.Content; message = message.Replace("%playername%", ev.Target.Nickname).Replace("%scpname%", ev.Target.Role.ToString()).Replace("%killername%", ev.Killer.Nickname).Replace("%reason%", pluginInstance.Config.DamageTypesTranslations[ev.HitInformation.Tool.Name]); Map.Broadcast(pluginInstance.Config.ScpDeathMessage.Duration, message, pluginInstance.Config.ScpDeathMessage.Type); } } if (ev.Target.Nickname == ev.Killer.Nickname) { if (pluginInstance.Config.ScpSuicideMessage.Show) { var message = pluginInstance.Config.ScpSuicideMessage.Content; message = message.Replace("%playername%", ev.Target.Nickname).Replace("%scpname%", ev.Target.Role.ToString()).Replace("%reason%", pluginInstance.Config.DamageTypesTranslations[ev.HitInformation.Tool.Name]); Map.Broadcast(pluginInstance.Config.ScpSuicideMessage.Duration, message, pluginInstance.Config.ScpSuicideMessage.Type); } } } }
public void OnPlayerDying(DyingEventArgs ev) { Grenade grenade = GameObject.Instantiate(ev.Target.ReferenceHub.GetComponent <GrenadeManager>().availableGrenades[0].grenadeInstance).GetComponent <Grenade>(); grenade.NetworkfuseTime = Plugin.Singleton.Config.ExplodeTime; grenade.InitData(ev.Target.ReferenceHub.GetComponent <GrenadeManager>(), Vector3.zero, Vector3.zero); NetworkServer.Spawn(grenade.gameObject); }
public async void OnDying(DyingEventArgs ev) { if (Instance.Config.EventsToLog.PlayerDying && ev.Killer != null && ev.Target != null && ((!ev.Killer.DoNotTrack && !ev.Target.DoNotTrack) || !Instance.Config.ShouldRespectDoNotTrack) && (!Instance.Config.ShouldLogFriendlyFireKillsOnly || (Instance.Config.ShouldLogFriendlyFireKillsOnly && ev.Killer.Side == ev.Target.Side && ev.Killer != ev.Target))) { await Network.SendAsync(new RemoteCommand("log", "gameEvents", string.Format(Language.HasKilledWith, ev.Killer.Nickname, Instance.Config.ShouldLogUserIds ? ev.Killer.UserId : Language.Redacted, ev.Killer.Role, ev.Target.Nickname, Instance.Config.ShouldLogUserIds ? ev.Target.UserId : Language.Redacted, ev.Target.Role, DamageTypes.FromIndex(ev.HitInformation.Tool).name))).ConfigureAwait(false); } }
public void OnDying(DyingEventArgs ev) { if (ev.Target.IsNPC()) { Npc cmp = Npc.Get(ev.Target); NPCDiedEvent npc_ev = new NPCDiedEvent(cmp, ev.Killer); cmp.FireEvent(npc_ev); cmp.Kill(ev.HitInformation.GetDamageType() != DamageTypes.RagdollLess); ev.IsAllowed = false; } }
public void OnPlayerDying(DyingEventArgs ev) { if (ev.Target.Role == RoleType.Scp0492) { ClearSCP008(ev.Target); Log.Debug($"Called ClearSCP008() method for {ev.Target}.", SCP008X.Instance.Config.DebugMode); } if (ev.Target.ReferenceHub.TryGetComponent(out SCP008 scp008)) { ev.Target.SetRole(RoleType.Scp0492, Exiled.API.Enums.SpawnReason.Died, true); } }
public async void OnDying(DyingEventArgs ev) { if (Instance.Config.EventsToLog.PlayerDying && ev.Target != null && (ev.Killer == null || !Instance.Config.ShouldLogFriendlyFireKillsOnly || ev.Killer.Side == ev.Target.Side) && (!Instance.Config.ShouldRespectDoNotTrack || (ev.Killer == null || (!ev.Killer.DoNotTrack && !ev.Target.DoNotTrack)))) { await Network.SendAsync(new RemoteCommand("log", "gameEvents", string.Format(Language.HasKilledWith, ev.Killer != null ? ev.Killer.Nickname : "Server", Instance.Config.ShouldLogUserIds ? ev.Killer != null ? ev.Killer.UserId : string.Empty : Language.Redacted, ev.Killer?.Role ?? RoleType.None, ev.Target.Nickname, Instance.Config.ShouldLogUserIds ? ev.Target.UserId : Language.Redacted, ev.Target.Role, ev.Handler.Type))).ConfigureAwait(false); } if (Instance.Config.StaffOnlyEventsToLog.PlayerDying && ev.Target != null && (ev.Killer == null || !Instance.Config.ShouldLogFriendlyFireKillsOnly || ev.Killer.Side == ev.Target.Side)) { await Network.SendAsync(new RemoteCommand("log", "staffCopy", string.Format(Language.HasKilledWith, ev.Killer != null ? ev.Killer.Nickname : "Server", Instance.Config.ShouldLogUserIds ? ev.Killer != null ? ev.Killer.UserId : string.Empty : Language.Redacted, ev.Killer?.Role ?? RoleType.None, ev.Target.Nickname, Instance.Config.ShouldLogUserIds ? ev.Target.UserId : Language.Redacted, ev.Target.Role, ev.Handler.Type))).ConfigureAwait(false); } }
private static bool Prefix(PlayerStats __instance, ref PlayerStats.HitInfo info, GameObject go) { try { if (go == null) { return(true); } API.Features.Player attacker = API.Features.Player.Get(info.IsPlayer ? info.RHub.gameObject : __instance.gameObject); API.Features.Player target = API.Features.Player.Get(go); if (attacker == null || target == null || attacker.IsHost || target.IsHost) { return(true); } var ev = new HurtingEventArgs(attacker, target, info); if (ev.Target.IsHost) { return(true); } Player.OnHurting(ev); info = ev.HitInformations; if (!ev.IsAllowed) { return(false); } if (ev.Amount >= ev.Target.Health + ev.Target.AdrenalineHealth) { var dyingEventArgs = new DyingEventArgs(ev.Attacker, ev.Target, ev.HitInformations); Player.OnDying(dyingEventArgs); if (!dyingEventArgs.IsAllowed) { return(false); } } return(true); } catch (Exception e) { Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.Hurting: {e}\n{e.StackTrace}"); return(true); } }
public static void DyingCallback(DOLEvent e, object sender, EventArgs args) { GamePlayer dyingPlayer = sender as GamePlayer; DyingEventArgs dargs = args as DyingEventArgs; if (dyingPlayer == null || dargs == null) { return; } GamePlayer killer = dargs.Killer as GamePlayer; if (killer == null) { return; } PlayerStatistics killerStats = killer.Statistics as PlayerStatistics; PlayerStatistics dyingPlayerStats = dyingPlayer.Statistics as PlayerStatistics; if (killerStats == null || dyingPlayerStats == null) { return; } killerStats.Deathblows++; if (dyingPlayer.RealmPointsValue > 0) { killerStats.KillsThatHaveEarnedRPs++; killerStats.RealmPointsEarnedFromKills += RPsEarnedFromKill(killer, dyingPlayer); if (killer.Group != null) { foreach (GamePlayer member in killer.Group.GetPlayersInTheGroup()) { if (member != killer) { PlayerStatistics memberStats = member.Statistics as PlayerStatistics; if (memberStats != null) { memberStats.KillsThatHaveEarnedRPs++; memberStats.RealmPointsEarnedFromKills += RPsEarnedFromKill(member, dyingPlayer); } } } } } dyingPlayerStats.Deaths++; }
private void OnDying(DyingEventArgs ev) { if (!ev.Target.IsHuman || (ev.Killer != null && ev.Killer.Role != RoleType.Scp049)) { return; } if (!previousRoles.ContainsKey(ev.Target)) { previousRoles.Add(ev.Target, RoleType.None); } previousRoles[ev.Target] = ev.Target.Role; }
private void OnDying(DyingEventArgs ev) { if (Check(ev.Killer) && !Check(ev.Target)) { IncreasePower(ev.Killer); } else if (Check(ev.Target)) { Log.Warn($"Adding {ev.Target.Nickname} to stop doll list."); Plugin.Singleton.StopRagdollList.Add(ev.Target); RagdollInfo info = new RagdollInfo(ev.Target.ReferenceHub, ev.Handler.Base, Role, ev.Target.Position, Quaternion.Euler(ev.Target.Rotation), ev.Target.Nickname, NetworkTime.time); Ragdoll.Spawn(info); } }
public void OnPlayerDying(DyingEventArgs ev) { /* if (shPlayers.Contains(ev.Target.Id)) * { * shPlayers.Remove(ev.Target.Id); * } * * if (ev.Target.Role == RoleType.Scp106 && !SerpentsHand.instance.Config.FriendlyFire) * { * foreach (Player player in Player.List.Where(x => shPocketPlayers.Contains(x.Id))) * { * player.ReferenceHub.playerStats.HurtPlayer(new PlayerStats.HitInfo(50000, "WORLD", ev.HitInformation.GetDamageType(), player.Id), player.GameObject); * } * }*/ }
internal void OnPlayerDeath(DyingEventArgs ev) { if ((ev.Target.Team == Team.SCP || (pluginInstance.Config.AreTutorialsSCP && ev.Target.Team == Team.TUT)) && Round.IsStarted && pluginInstance.Config.EnableSCPSuicideAutoWarn && !TemporarilyDisabledWarns) { if ((DateTime.Now - lastTeslaEvent).Seconds >= pluginInstance.Config.Scp079TeslaEventWait) { if (ev.HitInformation.GetDamageType() == DamageTypes.Tesla || (ev.HitInformation.GetDamageType() == DamageTypes.Wall && ev.HitInformation.Amount >= 50000) || (ev.HitInformation.GetDamageType() == DamageTypes.Grenade && ev.Killer == ev.Target)) { pluginInstance.Functions.LogWarn(ev.Target, ev.HitInformation.GetDamageName()); pluginInstance.Functions.OnQuitOrSuicide(ev.Target); } else if ((ev.HitInformation.GetDamageType() == DamageTypes.Wall && ev.HitInformation.Amount == -1f) && ev.Killer == ev.Target && pluginInstance.Config.QuitEqualsSuicide) { pluginInstance.Functions.LogWarn(ev.Target, "Disconnect"); pluginInstance.Functions.OnQuitOrSuicide(ev.Target); } } } if (pluginInstance.Config.NotifyLastPlayerAlive) { System.Collections.Generic.List <Exiled.API.Features.Player> team = Exiled.API.Features.Player.Get(ev.Target.Team).ToList(); if (team.Count - 1 == 1) { if (team[0] == ev.Target) { team[1].ShowHint(pluginInstance.Config.LastPlayerAliveNotificationText, pluginInstance.Config.LastPlayerAliveMessageDuration); } else { team[0].ShowHint(pluginInstance.Config.LastPlayerAliveNotificationText, pluginInstance.Config.LastPlayerAliveMessageDuration); } } } if (pluginInstance.Config.DeathMessageModuleEnabled && ev.Target.IsScp || ev.Target.Role == RoleType.Tutorial && pluginInstance.Config.AreTutorialsSCP) { if (ev.Target.Nickname != ev.Killer.Nickname) { Map.Broadcast(pluginInstance.Config.ScpDeathMessageDuration, pluginInstance.Config.ScpDeathMessage.Replace("%playername%", ev.Target.Nickname).Replace("%scpname%", ev.Target.Role.ToString()).Replace("%killername%", ev.Killer.Nickname).Replace("%reason%", ev.HitInformation.GetDamageName()), Broadcast.BroadcastFlags.Normal); } if (ev.Target.Nickname == ev.Killer.Nickname) { Map.Broadcast(pluginInstance.Config.ScpDeathMessageDuration, pluginInstance.Config.ScpSuicideMessage.Replace("%playername%", ev.Target.Nickname).Replace("%scpname%", ev.Target.Role.ToString()).Replace("%reason%", ev.HitInformation.GetDamageName()), Broadcast.BroadcastFlags.Normal); } } }
/// <summary> /// Initializes a new instance of the <see cref="OwnerDyingEventArgs"/> class. /// </summary> /// <param name="item"><inheritdoc cref="Item"/></param> /// <param name="ev">The <see cref="HandcuffingEventArgs"/> instance.</param> public OwnerDyingEventArgs(Item item, DyingEventArgs ev) : base(ev.Target, ev.Handler.Base) { if (item is null) { Log.Warn("Item is null"); } if (ev.Target is null) { Log.Warn("Target is null"); } if (ev.Handler.Base is null) { Log.Warn("handler base is null"); } Item = item; }
// Player internal void OnDying(DyingEventArgs ev) { if (!Round.IsStarted) { return; } if (!ev.IsAllowed) { return; } if (ev.Killer != null && ev.Killer.Role != RoleType.None && ev.Killer.Role != RoleType.Spectator && data.FirstKiller == null) { data.FirstKiller = ev.Killer; data.FirstKillerRole = ev.Killer.Role; data.FirstKillerRoleColor = ev.Killer.RoleColor.ToHex(); } data.TotalDeaths++; }
internal void OnDying(DyingEventArgs ev) { if (ev.Target.Role == RoleType.Scp0492) { if (ev.Killer != null) { Methods.GiveAmmo(Configs.AmountConfig.AmmoGainAmount, AmmoType.Nato9, ev.Killer); } Timing.CallDelayed(.5f, () => { if (Round.ElapsedTime.TotalSeconds < Configs.TimeConfig.GameTime) { ev.Target?.SetRole(RoleType.Scp0492); } }); } }
public void OnKills(DyingEventArgs ev) { if (ev.HitInformation.GetDamageType() == DamageTypes.MicroHid && !FFREVERSE.Instance.Config.FFMicro) { return; } if (ev.Killer != null && ev.Killer.UserId != ev.Target.UserId && Round.IsStarted) { PlayerInfo pinfo = PlayerInfoDict[ev.Killer.UserId]; Exiled.API.Enums.Side aTeam = pinfo.lastSide; Exiled.API.Enums.Side tTeam = PlayerInfoDict[ev.Target.UserId].lastSide; if (aTeam == tTeam) { pinfo.teamKills++; } } }
public void OnKills(DyingEventArgs ev) { if (ev.HitInformation.GetDamageType() == DamageTypes.MicroHid && !FFREVERSE.Instance.Config.FFMicro) { return; } if (ev.Killer != null && ev.Killer.UserId != ev.Target.UserId && !roundend) { if (PlayerInfoDict.ContainsKey(ev.Killer.UserId)) { addPlayer(ev.Killer); } PlayerInfo pinfo = PlayerInfoDict[ev.Killer.UserId]; if (ev.Killer.Side == ev.Target.Side) { pinfo.teamKills += 1; } } }
public async void OnDying(DyingEventArgs ev) { if (Instance.Config.EventsToLog.PlayerDying && ev.Killer != null && ev.Target != null && (!ev.Killer.DoNotTrack || !ev.Target.DoNotTrack || !Instance.Config.ShouldRespectDoNotTrack) && (!Instance.Config.ShouldLogFriendlyFireKillsOnly || (Instance.Config.ShouldLogFriendlyFireKillsOnly && ev.Killer.Side == ev.Target.Side && ev.Killer != ev.Target))) { await Network.SendAsync(new RemoteCommand("log", "gameEvents", string.Format(Language.HasKilledWith, ev.Killer.Nickname, ev.Killer.Id.ToString(), ev.Killer.Role.Translate(), ev.Target.Nickname, ev.Target.Id.ToString(), ev.Target.Role.Translate(), DamageTypes.FromIndex(ev.HitInformation.Tool).name))).ConfigureAwait(false); } else if (Instance.Config.EventsToLog.PlayerDying && ev.Killer != null && ev.Target != null && (!ev.Killer.DoNotTrack || !ev.Target.DoNotTrack || !Instance.Config.ShouldRespectDoNotTrack) && (!Instance.Config.ShouldLogFriendlyFireKillsOnly || (Instance.Config.ShouldLogFriendlyFireKillsOnly && ev.Killer.Side == ev.Target.Side && ev.Killer != ev.Target && ev.Target.IsCuffed && ev.Target.Role == RoleType.ClassD && ev.Killer.Team == Team.MTF))) { await Network.SendAsync(new RemoteCommand("log", "gameEvents", $"<:ClassDShook:817324555654791199> | {ev.Killer.Nickname} (ID:{ev.Killer.Id} - ROL: {ev.Killer.Role.Translate()} ) Mato a {ev.Target.Nickname} (ID: {ev.Target.Id} - ROL: {ev.Target.Role.Translate()} ) que era un Class-D Arrestado. Lo mato con {DamageTypes.FromIndex(ev.HitInformation.Tool).name}")).ConfigureAwait(false); } }
public void OnDying(DyingEventArgs ev) { if (!Singleton.Config.IsEnabled) { return; } else { if (!Singleton.Config.ItemDrop) { return; } else { if (ev.HitInformation.GetDamageType() == DamageTypes.Pocket) { ev.Target.ClearInventory(); Log.Debug($"{ev.Target.Nickname} lost all of their items.", Singleton.Config.Debug); } } } }
private void OnInternalDying(DyingEventArgs ev) { if (Check(ev.Target)) { CustomRoles.Instance.StopRagdollPlayers.Add(ev.Target); Role role = CharacterClassManager._staticClasses.SafeGet(Role); // TODO: This /* * Ragdoll.Info info = new Ragdoll.Info * { * ClassColor = role.classColor, * DeathCause = ev.HitInformation, * FullName = Name, * Nick = ev.Target.Nickname, * ownerHLAPI_id = ev.Target.GameObject.GetComponent<MirrorIgnorancePlayer>().PlayerId, * PlayerId = ev.Target.Id, * }; * Exiled.API.Features.Ragdoll.Spawn(role, info, ev.Target.Position, Quaternion.Euler(ev.Target.Rotation), default, false, false); */ } }
public void OnPlayerDying(DyingEventArgs ev) { if (!isToggled || !Round.IsStarted) { return; } if (ev.Killer.Team == ev.Target.Team && ev.Killer.UserId != ev.Target.UserId && PlayerXP.instance.Config.TeamKillPunishment > 0) { int xp = CalcXP(ev.Killer, PlayerXP.instance.Config.TeamKillPunishment); RemoveXP(ev.Killer.UserId, xp, PlayerXP.instance.Config.PlayerTeamkillMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname)); // Player teamkilled } if (ev.Killer.Team == Team.CDP) { int gainedXP = 0; bool isUnarmed = false; if (ev.Target.Team == Team.RSC) { gainedXP = PlayerXP.instance.Config.DclassScientistKill; isUnarmed = IsUnarmed(ev.Target); } if (ev.Target.Team == Team.MTF) { gainedXP = PlayerXP.instance.Config.DclassMtfKill; } if (ev.Target.Team == Team.SCP) { gainedXP = PlayerXP.instance.Config.DclassScpKill; } if (ev.Target.Team == Team.TUT) { gainedXP = PlayerXP.instance.Config.DclassTutorialKill; } if (gainedXP > 0 && ev.Target.UserId != ev.Killer.UserId) { int xp = CalcXP(ev.Killer, gainedXP); AddXP(ev.Killer.UserId, xp, PlayerXP.instance.Config.PlayerKillMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname), isUnarmed ? -PlayerXP.instance.Config.KarmaLostOnDefenselessKill : -1f); } } else if (ev.Killer.Team == Team.RSC) { int gainedXP = 0; bool isUnarmed = false; if (ev.Target.Team == Team.CDP) { gainedXP = PlayerXP.instance.Config.ScientistDclassKill; isUnarmed = IsUnarmed(ev.Target); } if (ev.Target.Team == Team.CHI) { gainedXP = PlayerXP.instance.Config.ScientistChaosKill; } if (ev.Target.Team == Team.SCP) { gainedXP = PlayerXP.instance.Config.ScientistScpKill; } if (ev.Target.Team == Team.TUT) { gainedXP = PlayerXP.instance.Config.ScientistTutorialKill; } if (gainedXP > 0 && ev.Target.UserId != ev.Killer.UserId) { int xp = CalcXP(ev.Killer, gainedXP); AddXP(ev.Killer.UserId, xp, PlayerXP.instance.Config.PlayerKillMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname), isUnarmed ? -PlayerXP.instance.Config.KarmaLostOnDefenselessKill : -1f); } } else if (ev.Killer.Team == Team.MTF) { int gainedXP = 0; if (ev.Target.Team == Team.CDP) { gainedXP = PlayerXP.instance.Config.MtfDclassKill; } if (ev.Target.Team == Team.CHI) { gainedXP = PlayerXP.instance.Config.MtfChaosKill; } if (ev.Target.Team == Team.SCP) { gainedXP = PlayerXP.instance.Config.MtfScpKill; } if (ev.Target.Team == Team.TUT) { gainedXP = PlayerXP.instance.Config.MtfTutorialKill; } if (gainedXP > 0 && ev.Target.UserId != ev.Killer.UserId) { int xp = CalcXP(ev.Killer, gainedXP); AddXP(ev.Killer.UserId, xp, PlayerXP.instance.Config.PlayerKillMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname)); } } else if (ev.Killer.Team == Team.CHI) { int gainedXP = 0; if (ev.Target.Team == Team.RSC) { gainedXP = PlayerXP.instance.Config.ChaosScientistKill; } if (ev.Target.Team == Team.MTF) { gainedXP = PlayerXP.instance.Config.ChaosMtfKill; } if (ev.Target.Team == Team.SCP) { gainedXP = PlayerXP.instance.Config.ChaosScpKill; } if (ev.Target.Team == Team.TUT) { gainedXP = PlayerXP.instance.Config.ChaosTutorialKill; } if (gainedXP > 0 && ev.Target.UserId != ev.Killer.UserId) { int xp = CalcXP(ev.Killer, gainedXP); AddXP(ev.Killer.UserId, xp, PlayerXP.instance.Config.PlayerKillMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname)); } } else if (ev.Killer.Team == Team.TUT) { int gainedXP = 0; if (ev.Target.Team == Team.CDP) { gainedXP = PlayerXP.instance.Config.TutorialDclassKill; } if (ev.Target.Team == Team.RSC) { gainedXP = PlayerXP.instance.Config.TutorialScientistKill; } if (ev.Target.Team == Team.MTF) { gainedXP = PlayerXP.instance.Config.TutorialMtfKill; } if (ev.Target.Team == Team.CHI) { gainedXP = PlayerXP.instance.Config.TutorialChaosKill; } if (gainedXP > 0 && ev.Target.UserId != ev.Killer.UserId) { int xp = CalcXP(ev.Killer, gainedXP); AddXP(ev.Killer.UserId, xp, PlayerXP.instance.Config.PlayerKillMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname)); } } else if (ev.Killer.Team == Team.SCP) { int gainedXP = 0; if (ev.Target.UserId != ev.Killer.UserId) { if (ev.Killer.Role == RoleType.Scp049) { gainedXP = PlayerXP.instance.Config.Scp049Kill; } else if (ev.Killer.Role == RoleType.Scp0492) { gainedXP = PlayerXP.instance.Config.Scp0492Kill; } else if (ev.Killer.Role == RoleType.Scp096) { gainedXP = PlayerXP.instance.Config.Scp096Kill; } else if (ev.Killer.Role == RoleType.Scp106) { gainedXP = PlayerXP.instance.Config.Scp106Kill; } else if (ev.Killer.Role == RoleType.Scp173) { gainedXP = PlayerXP.instance.Config.Scp173Kill; } else if (ev.Killer.Role == RoleType.Scp93953 || ev.Killer.Role == RoleType.Scp93989) { gainedXP = PlayerXP.instance.Config.Scp939Kill; } if (gainedXP > 0) { int xp = CalcXP(ev.Killer, gainedXP); AddXP(ev.Killer.UserId, xp, PlayerXP.instance.Config.PlayerKillMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname)); } } if (PlayerXP.instance.Config.TutorialScpKillsPlayer > 0 && ev.Target.Team != Team.TUT && ev.Target.UserId != ev.Killer.UserId) { foreach (Player player in Player.List) { if (player.Role == RoleType.Tutorial) { int xp = CalcXP(player, PlayerXP.instance.Config.TutorialScpKillsPlayer); AddXP(player.UserId, xp, PlayerXP.instance.Config.TutorialScpKillsPlayerMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname)); } } } if (PlayerXP.instance.Config.Scp079AssistedKill > 0 && ev.Target.UserId != ev.Killer.UserId && ev.Target.Team != Team.TUT) { foreach (Player player in Player.List) { if (player.Role == RoleType.Scp079) { int xp = CalcXP(player, PlayerXP.instance.Config.Scp079AssistedKill); AddXP(player.UserId, xp, PlayerXP.instance.Config.Scp079AssistedKillMessage.Replace("{xp}", xp.ToString()).Replace("{target}", ev.Target.Nickname)); } } } } if (ev.Killer.Id != ev.Target.Id) { SendHint(ev.Target, PlayerXP.instance.Config.PlayerDeathMessage.Replace("{xp}", GetXP(ev.Killer.UserId).ToString()).Replace("{level}", GetLevel(ev.Killer.UserId).ToString()).Replace("{killer}", ev.Killer.Nickname)); ev.Target.SendConsoleMessage($"You have {GetXP(ev.Target.UserId)}/{XpToLevelUp(ev.Target.UserId)} xp until you reach level {GetLevel(ev.Target.UserId) + 1}.", "yellow"); } }
/// <summary> /// Invoked before a player dies. /// </summary> /// <param name="ev"><see cref="DyingEventArgs"/> instance.</param> public static void OnDying(DyingEventArgs ev) => Dying.InvokeSafely(ev);
/// <inheritdoc cref="Exiled.Events.Handlers.Player.OnDying(DyingEventArgs)"/> public void OnDying(DyingEventArgs ev) { Log.Info($"{ev.Target.Nickname} ({ev.Target.Role}) is getting killed by {ev.Killer.Nickname} ({ev.Killer.Role})!"); }
private static bool Prefix(PlayerStats __instance, ref PlayerStats.HitInfo info, GameObject go) { try { if (go == null) { return(true); } API.Features.Player attacker = API.Features.Player.Get(info.IsPlayer ? info.RHub.gameObject : __instance.gameObject); API.Features.Player target = API.Features.Player.Get(go); if (target == null || target.IsHost) { return(true); } if (info.GetDamageType() == DamageTypes.Recontainment && target.Role == RoleType.Scp079) { Scp079.OnRecontained(new RecontainedEventArgs(target)); var eventArgs = new DiedEventArgs(null, target, info); Player.OnDied(eventArgs); } if (attacker == null || attacker.IsHost) { return(true); } var ev = new HurtingEventArgs(attacker, target, info); if (ev.Target.IsHost) { return(true); } Player.OnHurting(ev); info = ev.HitInformations; if (!ev.IsAllowed) { return(false); } if (!ev.Target.IsGodModeEnabled && (ev.Amount == -1 || ev.Amount >= ev.Target.Health + ev.Target.AdrenalineHealth)) { var dyingEventArgs = new DyingEventArgs(ev.Attacker, ev.Target, ev.HitInformations); Player.OnDying(dyingEventArgs); if (!dyingEventArgs.IsAllowed) { return(false); } } return(true); } catch (Exception e) { Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.Hurting: {e}\n{e.StackTrace}"); return(true); } }