diff --git a/Fika.Core/Coop/Players/CoopBot.cs b/Fika.Core/Coop/Players/CoopBot.cs index 3cce0158..d27bcf34 100644 --- a/Fika.Core/Coop/Players/CoopBot.cs +++ b/Fika.Core/Coop/Players/CoopBot.cs @@ -131,17 +131,47 @@ public override void OnBeenKilledByAggressor(IPlayer aggressor, DamageInfoStruct { base.OnBeenKilledByAggressor(aggressor, damageInfo, bodyPart, lethalDamageType); - if (FikaPlugin.Instance.SharedQuestProgression && FikaPlugin.EasyKillConditions.Value) + if (aggressor.GroupId == "Fika" && !aggressor.IsYourPlayer) { - if (aggressor.Profile.Info.GroupId == "Fika" && !aggressor.IsYourPlayer) + WildSpawnType role = Profile.Info.Settings.Role; + bool countAsBoss = role.CountAsBossForStatistics() && !(role is WildSpawnType.pmcUSEC or WildSpawnType.pmcBEAR); + int experience = Profile.Info.Settings.Experience; + if (experience < 0) { + experience = Singleton.Instance.Experience.Kill.VictimBotLevelExp; + } + + if (FikaPlugin.SharedKillExperience.Value && !countAsBoss) + { + int toReceive = experience / 2; +#if DEBUG + FikaPlugin.Instance.FikaLogger.LogInfo($"Received shared kill XP of {toReceive} from {killer.Profile.Nickname}"); +#endif + + Profile.EftStats.SessionCounters.AddInt(toReceive, SessionCounterTypesAbstractClass.ExpKillBase); + } + + if (FikaPlugin.SharedBossExperience.Value && countAsBoss) + { + int toReceive = experience / 2; +#if DEBUG + FikaPlugin.Instance.FikaLogger.LogInfo($"Received shared boss XP of {toReceive} from {killer.Profile.Nickname}"); +#endif + Profile.EftStats.SessionCounters.AddInt(toReceive, SessionCounterTypesAbstractClass.KilledBoss); + } + + if (FikaPlugin.Instance.SharedQuestProgression && FikaPlugin.EasyKillConditions.Value) + { +#if DEBUG + FikaPlugin.Instance.FikaLogger.LogInfo("Handling teammate kill from teammate: " + aggressor.Profile.Nickname); +#endif CoopPlayer mainPlayer = (CoopPlayer)Singleton.Instance.MainPlayer; if (mainPlayer != null) { float distance = Vector3.Distance(aggressor.Position, Position); - mainPlayer.HandleTeammateKill(ref damageInfo, bodyPart, Side, Profile.Info.Settings.Role, ProfileId, + mainPlayer.HandleTeammateKill(ref damageInfo, bodyPart, Side, role, ProfileId, distance, Inventory.EquippedInSlotsTemplateIds, HealthController.BodyPartEffects, TriggerZones, - (CoopPlayer)aggressor, Profile.Info.Settings.Experience); + (CoopPlayer)aggressor); } } } diff --git a/Fika.Core/Coop/Players/CoopPlayer.cs b/Fika.Core/Coop/Players/CoopPlayer.cs index 9b6f41d7..ae7751ec 100644 --- a/Fika.Core/Coop/Players/CoopPlayer.cs +++ b/Fika.Core/Coop/Players/CoopPlayer.cs @@ -8,7 +8,6 @@ using EFT.Interactive; using EFT.InventoryLogic; using EFT.SynchronizableObjects; -using EFT.UI; using EFT.Vehicle; using Fika.Core.Coop.ClientClasses; using Fika.Core.Coop.ClientClasses.HandsControllers; @@ -425,7 +424,7 @@ public override void OnBeenKilledByAggressor(IPlayer aggressor, DamageInfoStruct public void HandleTeammateKill(ref DamageInfoStruct damage, EBodyPart bodyPart, EPlayerSide playerSide, WildSpawnType role, string playerProfileId, float distance, List targetEquipment, - HealthEffects enemyEffects, List zoneIds, CoopPlayer killer, int experience) + HealthEffects enemyEffects, List zoneIds, CoopPlayer killer) { if (!HealthController.IsAlive) { @@ -478,27 +477,6 @@ public void HandleTeammateKill(ref DamageInfoStruct damage, EBodyPart bodyPart, bodyPart, Location, distance, role.ToStringNoBox(), hour, enemyEffects, killer.HealthController.BodyPartEffects, zoneIds, killer.HealthController.ActiveBuffsNames());*/ } - - bool countAsBoss = role.CountAsBossForStatistics() && !(role is WildSpawnType.pmcUSEC or WildSpawnType.pmcBEAR); - - if (FikaPlugin.SharedKillExperience.Value && !countAsBoss) - { - int toReceive = experience / 2; -#if DEBUG - FikaPlugin.Instance.FikaLogger.LogInfo($"Received shared kill XP of {toReceive} from {killer.Profile.Nickname}"); -#endif - Profile.EftStats.SessionCounters.AddInt(toReceive, SessionCounterTypesAbstractClass.Kills); - return; - } - - if (FikaPlugin.SharedBossExperience.Value && countAsBoss) - { - int toReceive = experience / 2; -#if DEBUG - FikaPlugin.Instance.FikaLogger.LogInfo($"Received shared boss XP of {toReceive} from {killer.Profile.Nickname}"); -#endif - Profile.EftStats.SessionCounters.AddInt(toReceive, SessionCounterTypesAbstractClass.KilledBoss); - } } #if DEBUG diff --git a/Fika.Core/Coop/Players/ObservedCoopPlayer.cs b/Fika.Core/Coop/Players/ObservedCoopPlayer.cs index 7004b8b4..3b5a20f1 100644 --- a/Fika.Core/Coop/Players/ObservedCoopPlayer.cs +++ b/Fika.Core/Coop/Players/ObservedCoopPlayer.cs @@ -901,18 +901,45 @@ public override void HandleDamagePacket(ref DamagePacket packet) LastDamagedBodyPart = packet.BodyPartType; } - public override void OnBeenKilledByAggressor(IPlayer aggressor, DamageInfoStruct DamageInfo, EBodyPart bodyPart, EDamageType lethalDamageType) + public override void OnBeenKilledByAggressor(IPlayer aggressor, DamageInfoStruct damageInfo, EBodyPart bodyPart, EDamageType lethalDamageType) { // Only handle if it was ourselves as otherwise it's irrelevant if (LastAggressor.IsYourPlayer) { - base.OnBeenKilledByAggressor(aggressor, DamageInfo, bodyPart, lethalDamageType); + base.OnBeenKilledByAggressor(aggressor, damageInfo, bodyPart, lethalDamageType); return; } - if (FikaPlugin.Instance.SharedQuestProgression && FikaPlugin.EasyKillConditions.Value) + if (aggressor.GroupId == "Fika" && !aggressor.IsYourPlayer) { - if (aggressor.GroupId == "Fika" && !aggressor.IsYourPlayer) + WildSpawnType role = Profile.Info.Settings.Role; + bool countAsBoss = role.CountAsBossForStatistics() && !(role is WildSpawnType.pmcUSEC or WildSpawnType.pmcBEAR); + int experience = Profile.Info.Settings.Experience; + if (experience < 0) + { + experience = Singleton.Instance.Experience.Kill.VictimBotLevelExp; + } + + if (FikaPlugin.SharedKillExperience.Value && !countAsBoss) + { + int toReceive = experience / 2; +#if DEBUG + FikaPlugin.Instance.FikaLogger.LogInfo($"Received shared kill XP of {toReceive} from {killer.Profile.Nickname}"); +#endif + + Profile.EftStats.SessionCounters.AddInt(toReceive, SessionCounterTypesAbstractClass.ExpKillBase); + } + + if (FikaPlugin.SharedBossExperience.Value && countAsBoss) + { + int toReceive = experience / 2; +#if DEBUG + FikaPlugin.Instance.FikaLogger.LogInfo($"Received shared boss XP of {toReceive} from {killer.Profile.Nickname}"); +#endif + Profile.EftStats.SessionCounters.AddInt(toReceive, SessionCounterTypesAbstractClass.KilledBoss); + } + + if (FikaPlugin.Instance.SharedQuestProgression && FikaPlugin.EasyKillConditions.Value) { #if DEBUG FikaPlugin.Instance.FikaLogger.LogInfo("Handling teammate kill from teammate: " + aggressor.Profile.Nickname); @@ -921,9 +948,9 @@ public override void OnBeenKilledByAggressor(IPlayer aggressor, DamageInfoStruct if (mainPlayer != null) { float distance = Vector3.Distance(aggressor.Position, Position); - mainPlayer.HandleTeammateKill(ref DamageInfo, bodyPart, Side, Profile.Info.Settings.Role, ProfileId, + mainPlayer.HandleTeammateKill(ref damageInfo, bodyPart, Side, role, ProfileId, distance, Inventory.EquippedInSlotsTemplateIds, HealthController.BodyPartEffects, TriggerZones, - (CoopPlayer)aggressor, Profile.Info.Settings.Experience); + (CoopPlayer)aggressor); } } }