The current BepInExPack is broken due to the Oakveil update, and mods installed through a mod manager may not work. Join the modding Discord for more information.
Decompiled source of BloodyBoss v1.1.14
BloodyBoss.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Bloodstone.API; using Bloody.Core; using Bloody.Core.API.v1; using Bloody.Core.GameData.v1; using Bloody.Core.Helper.v1; using Bloody.Core.Methods; using Bloody.Core.Models.v1; using Bloody.Core.Models.v1.Base; using Bloody.Core.Patch.Server; using BloodyBoss.Configuration; using BloodyBoss.DB; using BloodyBoss.DB.Models; using BloodyBoss.Exceptions; using BloodyBoss.Hooks; using BloodyBoss.Systems; using HarmonyLib; using ProjectM; using ProjectM.Gameplay.Systems; using ProjectM.Network; using ProjectM.Shared; using Stunlock.Core; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Transforms; using VampireCommandFramework; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("BloodyBoss")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("BloodyBoss mod for VRising")] [assembly: AssemblyFileVersion("1.1.14.0")] [assembly: AssemblyInformationalVersion("1.1.14+1.Branch.master.Sha.033e1dbd9755ab860ea7685b6f8fbbfa4ea8ed1b")] [assembly: AssemblyProduct("BloodyBoss")] [assembly: AssemblyTitle("BloodyBoss")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.14.0")] [module: UnverifiableCode] namespace BloodyBoos.Exceptions { internal class NPCExistException : Exception { public NPCExistException() { } public NPCExistException(string message) : base(message) { } public NPCExistException(string message, Exception innerException) : base(message, innerException) { } protected NPCExistException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } namespace BloodyBoss { [BepInPlugin("BloodyBoss", "BloodyBoss", "1.1.14")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [Reloadable] public class Plugin : BasePlugin, IRunOnInitialized { private Harmony _harmony; public static Logger Logger; public static SystemsCore SystemsCore; public override void Load() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val; if (!Core.IsServer) { ManualLogSource log = ((BasePlugin)this).Log; val = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BloodyBoss"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is only for server!"); } log.LogInfo(val); return; } ManualLogSource log2 = ((BasePlugin)this).Log; val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BloodyBoss"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.1.14"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log2.LogInfo(val); _harmony = new Harmony("BloodyBoss"); _harmony.PatchAll(typeof(DealDamageHook)); EventsHandlerSystem.OnInitialize += new OnGameDataInitializedEventHandler(GameDataOnInitialize); Logger = new Logger(((BasePlugin)this).Log); CommandRegistry.RegisterAll(); } public override bool Unload() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EventsHandlerSystem.OnInitialize -= new OnGameDataInitializedEventHandler(GameDataOnInitialize); CommandRegistry.UnregisterAssembly(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } return true; } private static void GameDataOnInitialize(World world) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown Logger.LogInfo("GameDataOnInitialize"); SystemsCore = Core.SystemsCore; Logger.LogInfo("Loading main data"); Database.Initialize(); Logger.LogInfo("Binding configuration"); PluginConfig.Initialize(); EventsHandlerSystem.OnDeathVBlood += new DeathVbloodEventHandler(VBloodSystemHook.OnDeathVblood); EventsHandlerSystem.OnDeath += new DeathEventHandler(DeathNpcHook.OnDeathNpc); BossSystem.GenerateStats(); BossSystem.CheckBoss(); } private static void GameFrame_OnUpdate() { Logger.LogInfo("GameFrame"); } public void OnGameInitialized() { Logger.LogDebug("OnGameInitialized"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "BloodyBoss"; public const string PLUGIN_NAME = "BloodyBoss"; public const string PLUGIN_VERSION = "1.1.14"; } } namespace BloodyBoss.Systems { internal class BossSystem { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__3_0; public static Action <>9__4_0; public static Func<BossEncounterModel, bool> <>9__8_0; internal void <StartTimer>b__3_0() { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass3_0 CS$<>8__locals0 = new <>c__DisplayClass3_0 { date = DateTime.Now }; if (lastDateMinute.ToString("HH:mm") != CS$<>8__locals0.date.ToString("HH:mm")) { lastDateMinute = CS$<>8__locals0.date; List<BossEncounterModel> list = Database.BOSSES.Where((BossEncounterModel x) => x.Hour == CS$<>8__locals0.date.ToString("HH:mm")).ToList(); if (list.Count > 0) { using List<BossEncounterModel>.Enumerator enumerator = list.GetEnumerator(); while (enumerator.MoveNext()) { ActionScheduler.RunActionOnMainThread((Action)new <>c__DisplayClass3_1 { spawnBoss = enumerator.Current }.<StartTimer>b__2); } } } if (!(lastDateSecond.ToString("HH:mm:ss") != CS$<>8__locals0.date.ToString("HH:mm:ss"))) { return; } lastDateSecond = CS$<>8__locals0.date; List<BossEncounterModel> list2 = Database.BOSSES.Where((BossEncounterModel x) => x.HourDespawn == CS$<>8__locals0.date.ToString("HH:mm:ss") && x.bossSpawn).ToList(); if (list2 == null) { return; } using List<BossEncounterModel>.Enumerator enumerator = list2.GetEnumerator(); while (enumerator.MoveNext()) { <>c__DisplayClass3_2 CS$<>8__locals1 = new <>c__DisplayClass3_2 { deSpawnBoss = enumerator.Current }; if (ECSExtensions.Has<VBloodUnit>(Plugin.SystemsCore.PrefabCollectionSystem._PrefabGuidToEntityMap[new PrefabGUID(CS$<>8__locals1.deSpawnBoss.PrefabGUID)])) { ActionScheduler.RunActionOnMainThread((Action)delegate { CS$<>8__locals1.deSpawnBoss.CheckSpawnDespawn(); }); } else { Plugin.Logger.LogError("The PrefabGUID does not correspond to a VBlood Unit. Ignore Spawn"); } } } internal void <StartTimerteam>b__4_0() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) QueryComponents.GetEntitiesByComponentTypes<VBloodUnit, LifeTime>((EntityQueryOptions)0, true); } internal bool <GenerateStats>b__8_0(BossEncounterModel x) { return x.unitStats == null; } } [CompilerGenerated] private sealed class <>c__DisplayClass3_0 { public DateTime date; internal bool <StartTimer>b__1(BossEncounterModel x) { return x.Hour == date.ToString("HH:mm"); } internal bool <StartTimer>b__3(BossEncounterModel x) { if (x.HourDespawn == date.ToString("HH:mm:ss")) { return x.bossSpawn; } return false; } } [CompilerGenerated] private sealed class <>c__DisplayClass3_1 { public BossEncounterModel spawnBoss; internal void <StartTimer>b__2() { spawnBoss.CheckSpawnDespawn(); } } [CompilerGenerated] private sealed class <>c__DisplayClass3_2 { public BossEncounterModel deSpawnBoss; internal void <StartTimer>b__4() { deSpawnBoss.CheckSpawnDespawn(); } } private static DateTime lastDateMinute = DateTime.Now; private static DateTime lastDateSecond = DateTime.Now; public static Action bossAction; public static void StartTimer() { Plugin.Logger.LogInfo("Start Timner for BloodyBoss"); bossAction = delegate { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) DateTime date = DateTime.Now; if (lastDateMinute.ToString("HH:mm") != date.ToString("HH:mm")) { lastDateMinute = date; List<BossEncounterModel> list = Database.BOSSES.Where((BossEncounterModel x) => x.Hour == date.ToString("HH:mm")).ToList(); if (list.Count > 0) { foreach (BossEncounterModel spawnBoss in list) { ActionScheduler.RunActionOnMainThread((Action)delegate { spawnBoss.CheckSpawnDespawn(); }); } } } if (lastDateSecond.ToString("HH:mm:ss") != date.ToString("HH:mm:ss")) { lastDateSecond = date; List<BossEncounterModel> list2 = Database.BOSSES.Where((BossEncounterModel x) => x.HourDespawn == date.ToString("HH:mm:ss") && x.bossSpawn).ToList(); if (list2 != null) { foreach (BossEncounterModel deSpawnBoss in list2) { if (ECSExtensions.Has<VBloodUnit>(Plugin.SystemsCore.PrefabCollectionSystem._PrefabGuidToEntityMap[new PrefabGUID(deSpawnBoss.PrefabGUID)])) { ActionScheduler.RunActionOnMainThread((Action)delegate { deSpawnBoss.CheckSpawnDespawn(); }); } else { Plugin.Logger.LogError("The PrefabGUID does not correspond to a VBlood Unit. Ignore Spawn"); } } } } }; CoroutineHandler.StartRepeatingCoroutine(bossAction, 1f); } public void StartTimerteam() { if (<>c.<>9__4_0 == null) { <>c.<>9__4_0 = delegate { //IL_0002: Unknown result type (might be due to invalid IL or missing references) QueryComponents.GetEntitiesByComponentTypes<VBloodUnit, LifeTime>((EntityQueryOptions)0, true); }; } } internal static void CheckBoss() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) NativeArray<Entity> entitiesByComponentTypes = QueryComponents.GetEntitiesByComponentTypes<NameableInteractable, UnitStats>((EntityQueryOptions)2, false); Enumerator<Entity> enumerator = entitiesByComponentTypes.GetEnumerator(); while (enumerator.MoveNext()) { Entity entity = enumerator.Current; NameableInteractable _nameableInteractable = ECSExtensions.Read<NameableInteractable>(entity); if (!((FixedString64Bytes)(ref _nameableInteractable.Name)).Value.Contains("bb")) { continue; } BossEncounterModel bossModel = Database.BOSSES.Where((BossEncounterModel x) => x.nameHash + "bb" == ((FixedString64Bytes)(ref _nameableInteractable.Name)).Value).FirstOrDefault(); if (bossModel == null) { continue; } try { DateTime now = DateTime.Now; DateTime dateTime = DateTime.ParseExact(bossModel.HourDespawn, "HH:mm:ss", null, DateTimeStyles.None); Entity entity2 = ((EntityModel)GameData.Users.All.FirstOrDefault()).Entity; if (now >= dateTime) { bossModel.bossSpawn = false; StatChangeUtility.KillOrDestroyEntity(Plugin.SystemsCore.EntityManager, entity, entity2, entity2, 0.0, (StatChangeReason)0, true); DeleteIcon(bossModel); continue; } bossModel.ModifyBoss(entity2, entity); CheckTeams(entity); if (PluginConfig.ClearDropTable.Value) { CoroutineHandler.StartFrameCoroutine((Action)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) bossModel.ClearDropTable(entity); }, 10, 1); } bossModel.bossSpawn = true; } catch (Exception ex) { Plugin.Logger.LogError(ex.Message); } } entitiesByComponentTypes.Dispose(); StartTimer(); } internal static void CheckTeams(Entity boss) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.TeamBossEnable.Value) { Plugin.Logger.LogWarning("Adding the same team to the boss"); if (!Database.TeamDefault.HasValue) { Database.TeamDefault = ECSExtensions.Read<Team>(boss); Database.TeamReferenceDefault = ECSExtensions.Read<TeamReference>(boss); Plugin.Logger.LogWarning("There is no team created, so we create the new Team"); return; } Plugin.Logger.LogWarning("There is a team created, we are going to apply the same team to the boss."); ECSExtensions.Read<Team>(boss); ECSExtensions.Read<TeamReference>(boss); Team valueOrDefault = Database.TeamDefault.GetValueOrDefault(); TeamReference valueOrDefault2 = Database.TeamReferenceDefault.GetValueOrDefault(); ECSExtensions.Write<Team>(boss, valueOrDefault); ECSExtensions.Write<TeamReference>(boss, valueOrDefault2); Plugin.Logger.LogWarning("We apply the changes so that they are from the same team."); } } internal static void DeleteIcon(BossEncounterModel model) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) NativeArray<Entity> entitiesByComponentTypes = QueryComponents.GetEntitiesByComponentTypes<NameableInteractable, MapIconData>((EntityQueryOptions)2, false); Enumerator<Entity> enumerator = entitiesByComponentTypes.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; NameableInteractable val = ECSExtensions.Read<NameableInteractable>(current); if (((FixedString64Bytes)(ref val.Name)).Value == model.nameHash + "ibb") { Entity entity = ((EntityModel)GameData.Users.All.FirstOrDefault()).Entity; StatChangeUtility.KillOrDestroyEntity(Plugin.SystemsCore.EntityManager, current, entity, entity, 0.0, (StatChangeReason)0, true); break; } } entitiesByComponentTypes.Dispose(); } internal static void GenerateStats() { foreach (BossEncounterModel item in Database.BOSSES.Where((BossEncounterModel x) => x.unitStats == null).ToList()) { item.GenerateStats(); } Database.saveDatabase(); } } } namespace BloodyBoss.Hooks { [HarmonyPatch(typeof(DealDamageSystem), "DealDamage")] internal class DealDamageHook { private static EntityManager _entityManager = Plugin.SystemsCore.EntityManager; private static PrefabCollectionSystem _prefabCollectionSystem = Plugin.SystemsCore.PrefabCollectionSystem; internal static bool Prefix(DealDamageSystem __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) EntityQuery query = __instance._Query; Enumerator<DealDamageEvent> enumerator = ((EntityQuery)(ref query)).ToComponentDataArray<DealDamageEvent>(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator(); while (enumerator.MoveNext()) { DealDamageEvent current = enumerator.Current; try { FixedString128Bytes npcAssetName = _prefabCollectionSystem._PrefabDataLookup[ECSExtensions.Read<PrefabGUID>(current.Target)].AssetName; foreach (BossEncounterModel item in Database.BOSSES.Where((BossEncounterModel x) => x.AssetName == ((object)(FixedString128Bytes)(ref npcAssetName)).ToString() && x.bossSpawn).ToList()) { if (item == null || !item.GetBossEntity() || !ECSExtensions.Has<NameableInteractable>(item.bossEntity)) { continue; } NameableInteractable val = ECSExtensions.Read<NameableInteractable>(item.bossEntity); if (!(((FixedString64Bytes)(ref val.Name)).Value == item.nameHash + "bb")) { continue; } if (((EntityManager)(ref _entityManager)).HasComponent<PlayerCharacter>(ECSExtensions.Read<EntityOwner>(current.SpellSource).Owner)) { if (!ECSExtensions.Has<VBloodUnit>(item.bossEntity)) { ECSExtensions.Read<EntityOwner>(current.SpellSource); PlayerCharacter componentData = ((EntityManager)(ref _entityManager)).GetComponentData<PlayerCharacter>(ECSExtensions.Read<EntityOwner>(current.SpellSource).Owner); User componentData2 = ((EntityManager)(ref _entityManager)).GetComponentData<User>(componentData.UserEntity); item.AddKiller(((object)(FixedString64Bytes)(ref componentData2.CharacterName)).ToString()); } continue; } if (PluginConfig.MinionDamage.Value) { return false; } return true; } } catch { } } return true; } } internal class DeathNpcHook { private static PrefabCollectionSystem _prefabCollectionSystem = Plugin.SystemsCore.PrefabCollectionSystem; private static EntityManager _entityManager = Plugin.SystemsCore.EntityManager; internal static void OnDeathNpc(DeathEventListenerSystem sender, NativeArray<DeathEvent> deathEvents) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) Enumerator<DeathEvent> enumerator = deathEvents.GetEnumerator(); while (enumerator.MoveNext()) { DeathEvent current = enumerator.Current; if (!((EntityManager)(ref _entityManager)).HasComponent<PlayerCharacter>(current.Killer)) { continue; } PrefabGUID val = ECSExtensions.Read<PrefabGUID>(current.Died); FixedString128Bytes npc = _prefabCollectionSystem._PrefabDataLookup[val].AssetName; PlayerCharacter componentData = ((EntityManager)(ref _entityManager)).GetComponentData<PlayerCharacter>(current.Killer); User componentData2 = ((EntityManager)(ref _entityManager)).GetComponentData<User>(componentData.UserEntity); foreach (BossEncounterModel item in Database.BOSSES.Where((BossEncounterModel x) => x.AssetName == ((object)(FixedString128Bytes)(ref npc)).ToString() && x.bossSpawn).ToList()) { try { item.GetBossEntity(); if (!ECSExtensions.Has<VBloodUnit>(item.bossEntity)) { Health val2 = ECSExtensions.Read<Health>(item.bossEntity); if (val2.IsDead || val2.Value == 0f) { GameData.Users.GetUserByCharacterName(((FixedString64Bytes)(ref componentData2.CharacterName)).Value); item.BuffKillers(); item.SendAnnouncementMessage(); break; } } } catch (Exception ex) { Plugin.Logger.LogError(ex.Message); if (ex.Message.Contains("The entity does not exist")) { item.BuffKillers(); item.SendAnnouncementMessage(); } } } } } } internal class VBloodSystemHook { private static EntityManager _entityManager = Plugin.SystemsCore.EntityManager; private static PrefabCollectionSystem _prefabCollectionSystem = Plugin.SystemsCore.PrefabCollectionSystem; public static void OnDeathVblood(VBloodSystem __instance, NativeList<VBloodConsumed> deathEvents) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) Enumerator<VBloodConsumed> enumerator = deathEvents.GetEnumerator(); while (enumerator.MoveNext()) { VBloodConsumed current = enumerator.Current; if (!((EntityManager)(ref _entityManager)).HasComponent<PlayerCharacter>(current.Target)) { continue; } PlayerCharacter componentData = ((EntityManager)(ref _entityManager)).GetComponentData<PlayerCharacter>(current.Target); User componentData2 = ((EntityManager)(ref _entityManager)).GetComponentData<User>(componentData.UserEntity); GameData.Users.GetUserByCharacterName(((object)(FixedString64Bytes)(ref componentData2.CharacterName)).ToString()); FixedString128Bytes vblood = _prefabCollectionSystem._PrefabDataLookup[current.Source].AssetName; foreach (BossEncounterModel modelBoss in Database.BOSSES.Where((BossEncounterModel x) => x.AssetName == ((object)(FixedString128Bytes)(ref vblood)).ToString() && x.bossSpawn).ToList()) { if (modelBoss.vbloodFirstKill) { modelBoss.AddKiller(((object)(FixedString64Bytes)(ref componentData2.CharacterName)).ToString()); modelBoss.BuffKillers(); } else { if (!modelBoss.GetBossEntity()) { continue; } Health val = ECSExtensions.Read<Health>(modelBoss.bossEntity); if (!val.IsDead && val.Value != 0f) { continue; } modelBoss.vbloodFirstKill = true; modelBoss.AddKiller(((object)(FixedString64Bytes)(ref componentData2.CharacterName)).ToString()); modelBoss.BuffKillers(); if (modelBoss.bossSpawn) { CoroutineHandler.StartGenericCoroutine((Action)delegate { modelBoss.vbloodFirstKill = false; modelBoss.SendAnnouncementMessage(); }, 2f); } } } } } } } namespace BloodyBoss.Exceptions { internal class BossDontExistException : Exception { public BossDontExistException() { } public BossDontExistException(string message) : base(message) { } public BossDontExistException(string message, Exception innerException) : base(message, innerException) { } protected BossDontExistException(SerializationInfo info, StreamingContext context) : base(info, context) { } } internal class BossExistException : Exception { public BossExistException() { } public BossExistException(string message) : base(message) { } public BossExistException(string message, Exception innerException) : base(message, innerException) { } protected BossExistException(SerializationInfo info, StreamingContext context) : base(info, context) { } } internal class NPCDontExistException : Exception { public NPCDontExistException() { } public NPCDontExistException(string message) : base(message) { } public NPCDontExistException(string message, Exception innerException) : base(message, innerException) { } protected NPCDontExistException(SerializationInfo info, StreamingContext context) : base(info, context) { } } internal class ProductDontExistException : Exception { public ProductDontExistException() { } public ProductDontExistException(string message) : base(message) { } public ProductDontExistException(string message, Exception innerException) : base(message, innerException) { } protected ProductDontExistException(SerializationInfo info, StreamingContext context) : base(info, context) { } } internal class ProductExistException : Exception { public ProductExistException() { } public ProductExistException(string message) : base(message) { } public ProductExistException(string message, Exception innerException) : base(message, innerException) { } protected ProductExistException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } namespace BloodyBoss.DB { internal static class Database { private static readonly Random Random = new Random(); public static readonly string ConfigPath = Path.Combine(Paths.ConfigPath, "BloodyBoss"); public static string BOSSESListFile = Path.Combine(ConfigPath, "Bosses.json"); public static Team? TeamDefault { get; set; } = null; public static TeamReference? TeamReferenceDefault { get; set; } = null; public static List<BossEncounterModel> BOSSES { get; set; } = new List<BossEncounterModel>(); public static void Initialize() { createDatabaseFiles(); loadDatabase(); } public static bool createDatabaseFiles() { if (!Directory.Exists(ConfigPath)) { Directory.CreateDirectory(ConfigPath); } if (!File.Exists(BOSSESListFile)) { File.WriteAllText(BOSSESListFile, "[]"); } Plugin.Logger.LogDebug("Create Database: OK"); return true; } public static bool saveDatabase() { try { string contents = JsonSerializer.Serialize(BOSSES, new JsonSerializerOptions { WriteIndented = true }); File.WriteAllText(BOSSESListFile, contents); Plugin.Logger.LogDebug("Save Database: OK"); return true; } catch (Exception ex) { Plugin.Logger.LogError("Error SaveDatabase: " + ex.Message); return false; } } public static bool loadDatabase() { try { BOSSES = JsonSerializer.Deserialize<List<BossEncounterModel>>(File.ReadAllText(BOSSESListFile)); Plugin.Logger.LogDebug("Load Database: OK"); return true; } catch (Exception ex) { Plugin.Logger.LogError("Error LoadDatabase: " + ex.Message); return false; } } public static bool GetBoss(string NPCName, out BossEncounterModel boss) { boss = BOSSES.Where((BossEncounterModel x) => x.name == NPCName).FirstOrDefault(); if (boss == null) { return false; } return true; } public static bool GetBOSSFromEntity(Entity npcEntity, out BossEncounterModel boss) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) boss = BOSSES.Where((BossEncounterModel x) => ((Entity)(ref x.bossEntity)).Equals(npcEntity)).FirstOrDefault(); if (boss == null) { return false; } return true; } public static bool AddBoss(string NPCName, int prefabGUIDOfNPC, int level, int multiplier, int lifetime) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (GetBoss(NPCName, out var boss)) { throw new BossExistException(); } ConvertedAssetData val = Plugin.SystemsCore.PrefabCollectionSystem._PrefabDataLookup[new PrefabGUID(prefabGUIDOfNPC)]; string assetName = ((object)(FixedString128Bytes)(ref val.AssetName)).ToString(); Entity val2 = Plugin.SystemsCore.PrefabCollectionSystem._PrefabGuidToEntityMap[new PrefabGUID(prefabGUIDOfNPC)]; boss = new BossEncounterModel(); boss.name = NPCName; boss.nameHash = NPCName.GetHashCode().ToString(); boss.PrefabGUID = prefabGUIDOfNPC; boss.AssetName = assetName; boss.level = level; boss.multiplier = multiplier; boss.Lifetime = lifetime; UnitStats stats = ECSExtensions.Read<UnitStats>(val2); boss.unitStats = new UnitStatsModel(); boss.unitStats.SetStats(stats); BOSSES.Add(boss); saveDatabase(); return true; } public static bool RemoveBoss(string BossName) { if (GetBoss(BossName, out var boss)) { BOSSES.Remove(boss); saveDatabase(); return true; } throw new BossDontExistException(); } public static T GetRandomItem<T>(this List<T> items) { if (items == null || items.Count == 0) { return default(T); } return items[Random.Next(items.Count)]; } } } namespace BloodyBoss.DB.Models { internal class BossEncounterModel { private Entity icontEntity; public Entity bossEntity; private const double SendMessageDelay = 2.0; public static List<string> vbloodKills = new List<string>(); public bool vbloodFirstKill; private static readonly Random Random = new Random(); private BossEncounterModel bossRandom; public string name { get; set; } = string.Empty; public string nameHash { get; set; } = string.Empty; public string AssetName { get; set; } = string.Empty; public string Hour { get; set; } = string.Empty; public string HourDespawn { get; set; } = string.Empty; public int PrefabGUID { get; set; } public int level { get; set; } public int multiplier { get; set; } public List<ItemEncounterModel> items { get; set; } = new List<ItemEncounterModel>(); public bool bossSpawn { get; set; } public float Lifetime { get; set; } public float x { get; set; } public float y { get; set; } public float z { get; set; } public UnitStatsModel unitStats { get; set; } public List<ItemEncounterModel> GetItems() { return items; } public bool GetItem(int itemPrefabID, out ItemEncounterModel item) { item = items.Where((ItemEncounterModel x) => x.ItemID == itemPrefabID).FirstOrDefault(); if (item == null) { return false; } return true; } public bool GetItemFromName(string ItemName, out ItemEncounterModel item) { item = items.Where((ItemEncounterModel x) => x.name == ItemName).FirstOrDefault(); if (item == null) { return false; } return true; } public bool AddItem(string ItemName, int ItemPrefabID, int Stack, int Chance = 1) { if (!GetItem(ItemPrefabID, out var item)) { item = new ItemEncounterModel(); item.name = ItemName; item.ItemID = ItemPrefabID; item.Stack = Stack; item.Chance = Chance; items.Add(item); Database.saveDatabase(); return true; } throw new ProductExistException(); } public bool RemoveItem(string ItemName) { if (GetItemFromName(ItemName, out var item)) { items.Remove(item); Database.saveDatabase(); return true; } throw new ProductDontExistException(); } public bool Spawn(Entity sender) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) SpawnSystem.SpawnUnitWithCallback(sender, new PrefabGUID(PrefabGUID), new float2(x, z), Lifetime + 5f, (Action<Entity>)delegate(Entity e) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) bossEntity = e; ModifyBoss(sender, e); if (PluginConfig.ClearDropTable.Value) { CoroutineHandler.StartFrameCoroutine((Action)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ClearDropTable(e); }, 10, 1); } Action obj = delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BossSystem.CheckTeams(e); }; Random random = new Random(); CoroutineHandler.StartFrameCoroutine(obj, random.Next(60), 1); ActionScheduler.RunActionOnceAfterDelay((Action)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) AddIcon(bossEntity); }, 3.0); }); string value = PluginConfig.SpawnMessageBossTemplate.Value; value = value.Replace("#time#", FontColorChatSystem.Yellow($"{Lifetime / 60f}")); value = value.Replace("#worldbossname#", FontColorChatSystem.Yellow(name ?? "")); ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, FontColorChatSystem.Green(value ?? "")); return true; } public bool Spawn(Entity sender, float locationX, float locationZ) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) SpawnSystem.SpawnUnitWithCallback(sender, new PrefabGUID(PrefabGUID), new float2(locationX, locationZ), Lifetime + 5f, (Action<Entity>)delegate(Entity e) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) bossEntity = e; ModifyBoss(sender, e); if (PluginConfig.ClearDropTable.Value) { CoroutineHandler.StartFrameCoroutine((Action)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ClearDropTable(e); }, 10, 1); } ActionScheduler.RunActionOnceAfterDelay((Action)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) AddIcon(bossEntity, locationX, locationZ); }, 3.0); Action obj = delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BossSystem.CheckTeams(e); }; new Random(); ActionScheduler.RunActionOnceAfterDelay(obj, 2.0); }); string value = PluginConfig.SpawnMessageBossTemplate.Value; value = value.Replace("#time#", FontColorChatSystem.Yellow($"{Lifetime / 60f}")); value = value.Replace("#worldbossname#", FontColorChatSystem.Yellow(name ?? "")); ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, FontColorChatSystem.Green(value ?? "")); return true; } public void ClearDropTable(Entity boss) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) ECSExtensions.ReadBuffer<DropTableBuffer>(boss).Clear(); } public bool DropItems() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) PrefabGUID val = default(PrefabGUID); Entity val2 = default(Entity); foreach (ItemEncounterModel item in items) { if (!probabilityGeneratingReward(item.Chance)) { continue; } foreach (string killer in GetKillers()) { UserModel userByCharacterName = GameData.Users.GetUserByCharacterName(killer); ((PrefabGUID)(ref val))..ctor(item.ItemID); int stack = item.Stack; if (!UserModelMethods.TryGiveItem(userByCharacterName, val, stack, ref val2)) { UserModelMethods.DropItemNearby(userByCharacterName, val, stack); } } } if (string.Empty != Hour) { HourDespawn = DateTime.Parse(Hour).AddSeconds(Lifetime).ToString("HH:mm:ss"); } return true; } private static bool probabilityGeneratingReward(int percentage) { if (new Random().Next(1, 100) <= percentage) { return true; } return false; } public void ModifyBoss(Entity user, Entity boss) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) ConvertedAssetData val = Plugin.SystemsCore.PrefabCollectionSystem._PrefabDataLookup[new PrefabGUID(PrefabGUID)]; AssetName = ((object)(FixedString128Bytes)(ref val.AssetName)).ToString(); int count = GameData.Users.Online.ToList().Count; UnitLevel val2 = ECSExtensions.Read<UnitLevel>(boss); val2.Level = new ModifiableInt(level); ECSExtensions.Write<UnitLevel>(boss, val2); Health val3 = ECSExtensions.Read<Health>(boss); if (PluginConfig.PlayersMultiplier.Value) { val3.MaxHealth._Value = ModifiableFloat.op_Implicit(val3.MaxHealth) * (float)(count * multiplier); } else { val3.MaxHealth._Value = ModifiableFloat.op_Implicit(val3.MaxHealth) * (float)multiplier; } if (!IsVBlood(boss) && ECSExtensions.Has<BloodConsumeSource>(boss)) { BloodConsumeSource val4 = ECSExtensions.Read<BloodConsumeSource>(boss); val4.CanBeConsumed = false; ECSExtensions.Write<BloodConsumeSource>(boss, val4); } UnitStats stats = ECSExtensions.Read<UnitStats>(boss); if (unitStats == null) { GenerateStats(); } ECSExtensions.Write<UnitStats>(boss, unitStats.FillStats(stats)); val3.Value = ((ModifiableFloat)(ref val3.MaxHealth)).Value; ECSExtensions.Write<Health>(boss, val3); BuffSystem.BuffNPC(boss, user, new PrefabGUID(PluginConfig.BuffForWorldBoss.Value), 0); RenameBoss(boss); bossSpawn = true; } private void AddIcon(Entity boss) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) SpawnSystem.SpawnUnitWithCallback(boss, Prefabs.MapIcon_POI_VBloodSource, new float2(x, z), Lifetime + 5f, (Action<Entity>)delegate(Entity e) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) icontEntity = e; ECSExtensions.Add<MapIconData>(e); ECSExtensions.Add<MapIconTargetEntity>(e); MapIconTargetEntity val = ECSExtensions.Read<MapIconTargetEntity>(e); val.TargetEntity = NetworkedEntity.ServerEntity(boss); val.TargetNetworkId = ECSExtensions.Read<NetworkId>(boss); ECSExtensions.Write<MapIconTargetEntity>(e, val); ECSExtensions.Add<NameableInteractable>(e); NameableInteractable val2 = ECSExtensions.Read<NameableInteractable>(e); val2.Name = new FixedString64Bytes(nameHash + "ibb"); ECSExtensions.Write<NameableInteractable>(e, val2); }); } private void AddIcon(Entity boss, float locationX, float locationZ) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) SpawnSystem.SpawnUnitWithCallback(boss, Prefabs.MapIcon_POI_VBloodSource, new float2(locationX, locationZ), Lifetime + 5f, (Action<Entity>)delegate(Entity e) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) icontEntity = e; ECSExtensions.Add<MapIconData>(e); ECSExtensions.Add<MapIconTargetEntity>(e); MapIconTargetEntity val = ECSExtensions.Read<MapIconTargetEntity>(e); val.TargetEntity = NetworkedEntity.ServerEntity(boss); val.TargetNetworkId = ECSExtensions.Read<NetworkId>(boss); ECSExtensions.Write<MapIconTargetEntity>(e, val); ECSExtensions.Add<NameableInteractable>(e); NameableInteractable val2 = ECSExtensions.Read<NameableInteractable>(e); val2.Name = new FixedString64Bytes(nameHash + "ibb"); ECSExtensions.Write<NameableInteractable>(e, val2); }); } public void GenerateStats() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) UnitStats stats = ECSExtensions.Read<UnitStats>(Plugin.SystemsCore.PrefabCollectionSystem._PrefabGuidToEntityMap[new PrefabGUID(PrefabGUID)]); unitStats = new UnitStatsModel(); unitStats.SetStats(stats); } private bool GetIcon() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) NativeArray<Entity> entitiesByComponentTypes = QueryComponents.GetEntitiesByComponentTypes<NameableInteractable, MapIconData>((EntityQueryOptions)2, false); Enumerator<Entity> enumerator = entitiesByComponentTypes.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; NameableInteractable val = ECSExtensions.Read<NameableInteractable>(current); if (((FixedString64Bytes)(ref val.Name)).Value == nameHash + "ibb") { icontEntity = current; entitiesByComponentTypes.Dispose(); return true; } } entitiesByComponentTypes.Dispose(); return false; } public bool GetBossEntity() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) NativeArray<Entity> entitiesByComponentTypes = QueryComponents.GetEntitiesByComponentTypes<NameableInteractable, UnitStats>((EntityQueryOptions)2, false); Enumerator<Entity> enumerator = entitiesByComponentTypes.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; NameableInteractable val = ECSExtensions.Read<NameableInteractable>(current); if (((FixedString64Bytes)(ref val.Name)).Value == nameHash + "bb") { bossEntity = current; entitiesByComponentTypes.Dispose(); return true; } } entitiesByComponentTypes.Dispose(); return false; } public bool IsVBlood(Entity boss) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (ECSExtensions.Has<VBloodUnit>(boss)) { return true; } return false; } public void RemoveIcon(Entity user) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (GetIcon()) { StatChangeUtility.KillOrDestroyEntity(Plugin.SystemsCore.EntityManager, icontEntity, user, user, 0.0, (StatChangeReason)0, true); } } internal void SetLocation(float3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) x = position.x; z = position.z; y = position.y; Database.saveDatabase(); } private void RenameBoss(Entity boss) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) ECSExtensions.Add<NameableInteractable>(boss); NameableInteractable val = ECSExtensions.Read<NameableInteractable>(boss); val.Name = new FixedString64Bytes(nameHash + "bb"); ECSExtensions.Write<NameableInteractable>(boss, val); } internal void SetAssetName(string v) { AssetName = v; Database.saveDatabase(); } internal void SetHour(string hour) { Hour = hour; HourDespawn = DateTime.Parse(hour).AddSeconds(Lifetime).ToString("HH:mm:ss"); Database.saveDatabase(); } internal void SetHourDespawn() { HourDespawn = DateTime.Now.AddSeconds(Lifetime).ToString("HH:mm:ss"); Database.saveDatabase(); } internal void KillBoss(Entity user) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (GetIcon()) { StatChangeUtility.KillOrDestroyEntity(Plugin.SystemsCore.EntityManager, bossEntity, user, user, 0.0, (StatChangeReason)0, true); } if (GetBossEntity()) { StatChangeUtility.KillOrDestroyEntity(Plugin.SystemsCore.EntityManager, bossEntity, user, user, 0.0, (StatChangeReason)0, true); } } internal void DespawnBoss(Entity user) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) RemoveIcon(user); KillBoss(user); bossSpawn = false; } internal void CheckSpawnDespawn() { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) DateTime now = DateTime.Now; if (now.ToString("HH:mm") == Hour) { if (!bossSpawn) { Entity entity = ((EntityModel)GameData.Users.All.FirstOrDefault()).Entity; if (Database.BOSSES.Count > 1 && PluginConfig.RandomBoss.Value) { Plugin.Logger.LogInfo("Spawn Random Boss"); bossRandom = Database.BOSSES[Random.Next(Database.BOSSES.Count)]; bossRandom.Spawn(entity, x, z); bossRandom.bossSpawn = true; Database.saveDatabase(); } else { Plugin.Logger.LogInfo("Spawn Boss"); Spawn(entity); bossSpawn = true; Database.saveDatabase(); } } else { Plugin.Logger.LogWarning("The boss " + name + " cannot be summoned again, since it is currently active"); } } if (!(now.ToString("HH:mm:ss") == HourDespawn)) { return; } Entity entity2 = ((EntityModel)GameData.Users.All.FirstOrDefault()).Entity; if (Database.BOSSES.Count > 1 && PluginConfig.RandomBoss.Value) { if (bossRandom.bossSpawn) { Plugin.Logger.LogInfo("Despawn Random Boss"); string value = PluginConfig.DespawnMessageBossTemplate.Value; value = value.Replace("#worldbossname#", FontColorChatSystem.Yellow(name ?? "")); ServerChatUtils.SendSystemMessageToAllClients(Plugin.SystemsCore.EntityManager, FontColorChatSystem.Green(value ?? "")); bossRandom.DespawnBoss(entity2); bossRandom.bossSpawn = false; bossRandom = null; Database.saveDatabase(); } } else if (bossSpawn) { Plugin.Logger.LogInfo("Despawn Boss"); string value2 = PluginConfig.DespawnMessageBossTemplate.Value; value2 = value2.Replace("#worldbossname#", FontColorChatSystem.Yellow(name ?? "")); ServerChatUtils.SendSystemMessageToAllClients(Plugin.SystemsCore.EntityManager, FontColorChatSystem.Green(value2 ?? "")); DespawnBoss(entity2); bossSpawn = false; Database.saveDatabase(); } } public void AddKiller(string killerCharacterName) { if (vbloodKills.Where((string x) => x == killerCharacterName).FirstOrDefault() == null) { vbloodKills.Add(killerCharacterName); } } public void RemoveKillers() { vbloodKills = new List<string>(); } public List<string> GetKillers() { return vbloodKills; } public void SendAnnouncementMessage() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) string announcementMessage = GetAnnouncementMessage(); if (announcementMessage == null) { return; } List<string> killers = GetKillers(); DropItems(); ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, announcementMessage); foreach (string item in killers) { ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, FontColorChatSystem.Yellow("- " + item) ?? ""); } RemoveKillers(); bossSpawn = false; RemoveIcon(((EntityModel)GameData.Users.All.FirstOrDefault()).Entity); Database.saveDatabase(); } public void BuffKillers() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!PluginConfig.BuffAfterKillingEnabled.Value) { return; } foreach (string killer in GetKillers()) { UserModel userByCharacterName = GameData.Users.GetUserByCharacterName(killer); BuffSystem.BuffPlayer(userByCharacterName.Character.Entity, ((EntityModel)userByCharacterName).Entity, new PrefabGUID(PluginConfig.BuffAfterKillingPrefabGUID.Value), 3, false); } } public string GetAnnouncementMessage() { return FontColorChatSystem.Green(PluginConfig.KillMessageBossTemplate.Value.Replace("#vblood#", FontColorChatSystem.Red(name) ?? "") ?? ""); } } internal class ItemEncounterModel { public string name { get; set; } public int ItemID { get; set; } public int Stack { get; set; } public int Chance { get; set; } = 1; public string Color { get; set; } = "#daa520"; } internal class UnitStatsModel { public float PhysicalCriticalStrikeChance { get; set; } public float PhysicalCriticalStrikeDamage { get; set; } public float SpellCriticalStrikeChance { get; set; } public float SpellCriticalStrikeDamage { get; set; } public float PhysicalPower { get; set; } public float SpellPower { get; set; } public float ResourcePower { get; set; } public float SiegePower { get; set; } public float ResourceYieldModifier { get; set; } public float ReducedResourceDurabilityLoss { get; set; } public float PhysicalResistance { get; set; } public float SpellResistance { get; set; } public int SunResistance { get; set; } public int FireResistance { get; set; } public int HolyResistance { get; set; } public int SilverResistance { get; set; } public int SilverCoinResistance { get; set; } public int GarlicResistance { get; set; } public float PassiveHealthRegen { get; set; } public int CCReduction { get; set; } public float HealthRecovery { get; set; } public float DamageReduction { get; set; } public float HealingReceived { get; set; } public float ShieldAbsorbModifier { get; set; } public float BloodEfficiency { get; set; } public void SetStats(UnitStats stats) { PhysicalCriticalStrikeChance = ((ModifiableFloat)(ref stats.PhysicalCriticalStrikeChance)).Value; PhysicalCriticalStrikeDamage = ((ModifiableFloat)(ref stats.PhysicalCriticalStrikeDamage)).Value; SpellCriticalStrikeChance = ((ModifiableFloat)(ref stats.SpellCriticalStrikeChance)).Value; SpellCriticalStrikeDamage = ((ModifiableFloat)(ref stats.SpellCriticalStrikeDamage)).Value; PhysicalPower = ((ModifiableFloat)(ref stats.PhysicalPower)).Value; SpellPower = ((ModifiableFloat)(ref stats.SpellPower)).Value; ResourcePower = ((ModifiableFloat)(ref stats.ResourcePower)).Value; SiegePower = ((ModifiableFloat)(ref stats.SiegePower)).Value; ResourceYieldModifier = ((ModifiableFloat)(ref stats.ResourceYieldModifier)).Value; ReducedResourceDurabilityLoss = ((ModifiableFloat)(ref stats.ReducedResourceDurabilityLoss)).Value; PhysicalResistance = ((ModifiableFloat)(ref stats.PhysicalResistance)).Value; SpellResistance = ((ModifiableFloat)(ref stats.SpellResistance)).Value; SunResistance = ((ModifiableInt)(ref stats.SunResistance)).Value; FireResistance = ((ModifiableInt)(ref stats.FireResistance)).Value; HolyResistance = ((ModifiableInt)(ref stats.HolyResistance)).Value; SilverResistance = ((ModifiableInt)(ref stats.SilverResistance)).Value; SilverCoinResistance = ((ModifiableInt)(ref stats.SilverCoinResistance)).Value; GarlicResistance = ((ModifiableInt)(ref stats.GarlicResistance)).Value; PassiveHealthRegen = ((ModifiableFloat)(ref stats.PassiveHealthRegen)).Value; CCReduction = ((ModifiableInt)(ref stats.CCReduction)).Value; HealthRecovery = ((ModifiableFloat)(ref stats.HealthRecovery)).Value; DamageReduction = ((ModifiableFloat)(ref stats.DamageReduction)).Value; HealingReceived = ((ModifiableFloat)(ref stats.HealingReceived)).Value; ShieldAbsorbModifier = ((ModifiableFloat)(ref stats.ShieldAbsorbModifier)).Value; BloodEfficiency = ((ModifiableFloat)(ref stats.BloodEfficiency)).Value; } public UnitStats FillStats(UnitStats stats) { //IL_01c2: Unknown result type (might be due to invalid IL or missing references) stats.PhysicalCriticalStrikeChance._Value = PhysicalCriticalStrikeChance; stats.PhysicalCriticalStrikeDamage._Value = PhysicalCriticalStrikeDamage; stats.SpellCriticalStrikeChance._Value = SpellCriticalStrikeChance; stats.SpellCriticalStrikeDamage._Value = SpellCriticalStrikeDamage; stats.PhysicalPower._Value = PhysicalPower; stats.SpellPower._Value = SpellPower; stats.ResourcePower._Value = ResourcePower; stats.SiegePower._Value = SiegePower; stats.ResourceYieldModifier._Value = ResourceYieldModifier; stats.ReducedResourceDurabilityLoss._Value = ReducedResourceDurabilityLoss; stats.PhysicalResistance._Value = PhysicalResistance; stats.SpellResistance._Value = SpellResistance; stats.SunResistance._Value = SunResistance; stats.FireResistance._Value = FireResistance; stats.HolyResistance._Value = HolyResistance; stats.SilverResistance._Value = SilverResistance; stats.SilverCoinResistance._Value = SilverCoinResistance; stats.GarlicResistance._Value = GarlicResistance; stats.PassiveHealthRegen._Value = PassiveHealthRegen; stats.CCReduction._Value = CCReduction; stats.HealthRecovery._Value = HealthRecovery; stats.DamageReduction._Value = DamageReduction; stats.HealingReceived._Value = HealingReceived; stats.ShieldAbsorbModifier._Value = ShieldAbsorbModifier; stats.BloodEfficiency._Value = BloodEfficiency; return stats; } } } namespace BloodyBoss.Configuration { internal class PluginConfig { private static ConfigFile _mainConfig; public static ConfigEntry<bool> Enabled { get; private set; } public static ConfigEntry<int> BuffForWorldBoss { get; private set; } public static ConfigEntry<string> SpawnMessageBossTemplate { get; private set; } public static ConfigEntry<string> DespawnMessageBossTemplate { get; private set; } public static ConfigEntry<string> KillMessageBossTemplate { get; private set; } public static ConfigEntry<string> VBloodFinalConcatCharacters { get; private set; } public static ConfigEntry<bool> PlayersMultiplier { get; private set; } public static ConfigEntry<bool> ClearDropTable { get; private set; } public static ConfigEntry<bool> MinionDamage { get; private set; } public static ConfigEntry<bool> RandomBoss { get; private set; } public static ConfigEntry<bool> BuffAfterKillingEnabled { get; private set; } public static ConfigEntry<int> BuffAfterKillingPrefabGUID { get; private set; } public static ConfigEntry<bool> TeamBossEnable { get; private set; } public static void Initialize() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown string path = Paths.ConfigPath ?? Path.Combine("BepInEx", "config"); string path2 = Path.Combine(path, "BloodyBoss"); if (!Directory.Exists(path2)) { Directory.CreateDirectory(path2); } string text = Path.Combine(path, "BloodyBoss.cfg"); _mainConfig = (File.Exists(text) ? new ConfigFile(text, false) : new ConfigFile(text, true)); Enabled = _mainConfig.Bind<bool>("Main", "Enabled", true, "Determines whether the boss spawn timer is enabled or not."); KillMessageBossTemplate = _mainConfig.Bind<string>("Main", "KillMessageBossTemplate", "The #vblood# boss has been defeated by the following brave warriors:", "The message that will appear globally once the boss gets killed."); SpawnMessageBossTemplate = _mainConfig.Bind<string>("Main", "SpawnMessageBossTemplate", "A Boss #worldbossname# has been summon you got #time# minutes to defeat it!.", "The message that will appear globally one the boss gets spawned."); DespawnMessageBossTemplate = _mainConfig.Bind<string>("Main", "DespawnMessageBossTemplate", "You failed to kill the Boss #worldbossname# in time.", "The message that will appear globally if the players failed to kill the boss."); BuffForWorldBoss = _mainConfig.Bind<int>("Main", "BuffForWorldBoss", 1163490655, "Buff that applies to each of the Bosses that we create with our mod."); PlayersMultiplier = _mainConfig.Bind<bool>("Main", "PlayersOnlineMultiplier", false, "If you activate this option, the boss life formula changes from \"bosslife * multiplier\" to \"bosslife * multiplier * numberofonlineplayers\"."); ClearDropTable = _mainConfig.Bind<bool>("Main", "ClearDropTable", false, "If you activate this option it will remove the original vblood droptable."); MinionDamage = _mainConfig.Bind<bool>("Main", "MinionDamage", true, "Disable minion damage to bosses."); RandomBoss = _mainConfig.Bind<bool>("Main", "RandomBoss", false, "If you activate this option instead of spawning a specific boss at a specific time, the system will search for a random boss and spawn the random boss instead of the original boss at the original boss's specific time.."); BuffAfterKillingEnabled = _mainConfig.Bind<bool>("Main", "BuffAfterKillingEnabled", true, "Deactivates the buff animation received by players who have participated in the battle for three seconds."); BuffAfterKillingPrefabGUID = _mainConfig.Bind<int>("Main", "BuffAfterKillingPrefabGUID", -2061047741, "PrefabGUID of the buff received by players who have participated in the battle for three seconds."); TeamBossEnable = _mainConfig.Bind<bool>("Main", "TeamBossEnable", false, "If you activate this option, the bosses will not attack each other and will team up if two bosses are summoned together.."); } public static void Destroy() { _mainConfig.Clear(); } private static string CleanupName(string name) { return new Regex("[^a-zA-Z0-9 -]").Replace(name, ""); } } } namespace BloodyBoss.Commands { [CommandGroup("bb items", null)] internal class ItemsBoosCommand { [Command("list", null, "<NameOfBoss>", "List items of Boss drop", null, true)] public void ListBossItems(ChatCommandContext ctx, string BossName) { try { if (Database.GetBoss(BossName, out var boss)) { ctx.Reply(boss.name + " Items List"); ctx.Reply("----------------------------"); ctx.Reply("--"); foreach (ItemEncounterModel item in boss.GetItems()) { ctx.Reply($"Item {item.ItemID}"); ctx.Reply($"Stack {item.Stack}"); ctx.Reply($"Chance {item.Chance}"); ctx.Reply("--"); } ctx.Reply("----------------------------"); return; } throw new BossDontExistException(); } catch (BossDontExistException) { throw ctx.Error("Boss with name '" + BossName + "' does not exist."); } catch (ProductExistException) { throw ctx.Error("This item configuration already exists at Boss '" + BossName + "'"); } catch (Exception ex3) { throw ctx.Error("Error: " + ex3.Message); } } [Command("add", null, "<NameOfBoss> <ItemName> <ItemPrefabID> <Stack> <Chance>", "Add a item to a Boss drop. Chance is number between 0 to 1, Example 0.5 for 50% of drop", null, true)] public void CreateItem(ChatCommandContext ctx, string BossName, string ItemName, int ItemPrefabID, int Stack, int Chance) { try { if (Database.GetBoss(BossName, out var boss)) { boss.AddItem(ItemName, ItemPrefabID, Stack, Chance); ctx.Reply("Item successfully added to Boss '" + BossName + "'"); return; } throw new BossDontExistException(); } catch (BossDontExistException) { throw ctx.Error("Boss with name '" + BossName + "' does not exist."); } catch (ProductExistException) { throw ctx.Error("This item configuration already exists at Boss '" + BossName + "'"); } catch (Exception ex3) { throw ctx.Error("Error: " + ex3.Message); } } [Command("remove", null, "<NameOfBoss> <ItemName>", "Remove a item to a Boss", null, true)] public void RemoveProduct(ChatCommandContext ctx, string BossName, string ItemName) { try { if (Database.GetBoss(BossName, out var boss)) { boss.RemoveItem(ItemName); ctx.Reply("Boss '" + BossName + "''s item has been successfully removed"); return; } throw new BossDontExistException(); } catch (BossDontExistException) { throw ctx.Error("Boss with name '" + BossName + "' does not exist."); } catch (ProductDontExistException) { throw ctx.Error("This item does not exist at Boss '" + BossName + "'"); } catch (Exception ex3) { throw ctx.Error("Error: " + ex3.Message); } } } } namespace BloodyBoss.Command { [CommandGroup("bb", null)] public static class BossCommand { [Command("list", null, "", "List of Boss", null, true)] public static void ListBoss(ChatCommandContext ctx) { List<BossEncounterModel> bOSSES = Database.BOSSES; if (bOSSES.Count == 0) { throw ctx.Error("There are no boss created"); } ctx.Reply("Boss List"); ctx.Reply("----------------------------"); ctx.Reply("--"); foreach (BossEncounterModel item in bOSSES) { ctx.Reply("Boss " + item.name); ctx.Reply("--"); } ctx.Reply("----------------------------"); } [Command("test", null, "", "Test Boss", null, true)] public static void Test(ChatCommandContext ctx, string bossName) { SetLocation(ctx, bossName); SetHour(ctx, bossName, DateTime.Now.AddMinutes(1.0).ToString("HH:mm")); } [Command("reload", null, "", "Reload Database Boss", null, true)] public static void ReloadDatabase(ChatCommandContext ctx) { try { Database.loadDatabase(); ctx.Reply("Boss database reload successfully"); } catch (Exception ex) { throw ctx.Error("Error: " + ex.Message); } } [Command("create", null, "<NameOfBOSS> <PrefabGUIDOfBOSS> <Level> <Multiplier> <LifeTimeSeconds>", "Create a Boss", null, true)] public static void CreateBOSS(ChatCommandContext ctx, string bossName, int prefabGUID, int level, int multiplier, int lifeTime) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) try { _ = Plugin.SystemsCore.PrefabCollectionSystem._PrefabGuidToEntityMap[new PrefabGUID(prefabGUID)]; if (Database.AddBoss(bossName, prefabGUID, level, multiplier, lifeTime)) { ctx.Reply("Boss '" + bossName + "' created successfully"); } } catch (BossExistException) { throw ctx.Error("Boss with name '" + bossName + "' exist."); } catch (Exception ex2) { throw ctx.Error("Error: " + ex2.Message); } } [Command("remove", null, "", "Remove a Boss", null, true)] public static void RemoveBoss(ChatCommandContext ctx, string bossName) { try { if (Database.RemoveBoss(bossName)) { ctx.Reply("Boss '" + bossName + "' remove successfully"); } } catch (NPCDontExistException) { throw ctx.Error("Boss with name '" + bossName + "' does not exist."); } catch (Exception ex2) { throw ctx.Error("Error: " + ex2.Message); } } [Command("set location", null, "<NameOfBoss>", "Adds the current location of the player who sets it to the Boss.", null, true)] public static void SetLocation(ChatCommandContext ctx, string BossName) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) try { Entity senderUserEntity = ctx.Event.SenderUserEntity; EntityManager entityManager = Plugin.SystemsCore.EntityManager; LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(senderUserEntity); float3 position = ((LocalToWorld)(ref componentData)).Position; if (Database.GetBoss(BossName, out var boss)) { boss.SetLocation(position); ctx.Reply($"Position {position.x},{position.y},{position.z} successfully set to Boss '{BossName}'"); return; } throw new BossDontExistException(); } catch (BossDontExistException) { throw ctx.Error("Boss with name '" + BossName + "' does not exist."); } catch (Exception ex2) { throw ctx.Error("Error: " + ex2.Message); } } [Command("set hour", null, "<NameOfBoss> <Hour>", "Adds the hour and minutes in which the Boss spawn.", null, true)] public static void SetHour(ChatCommandContext ctx, string BossName, string hour) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) try { _ = ctx.Event.SenderUserEntity; if (Database.GetBoss(BossName, out var boss)) { boss.SetHour(hour); ctx.Reply($"Hour {hour} successfully set to Boss '{BossName}'"); return; } throw new BossDontExistException(); } catch (BossDontExistException) { throw ctx.Error("Boss with name '" + BossName + "' does not exist."); } catch (Exception ex2) { throw ctx.Error("Error: " + ex2.Message); } } [Command("start", null, "<NameOfBoss>", "The confrontation with a Boss begins.", null, true)] public static void start(ChatCommandContext ctx, string BossName) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) try { Entity senderUserEntity = ctx.Event.SenderUserEntity; if (Database.GetBoss(BossName, out var boss)) { boss.SetHourDespawn(); boss.Spawn(senderUserEntity); return; } throw new BossDontExistException(); } catch (BossDontExistException) { throw ctx.Error("Boss with name '" + BossName + "' does not exist."); } catch (Exception ex2) { throw ctx.Error("Error: " + ex2.Message); } } [Command("clearicon", null, "<NameOfBoss>", "The confrontation with a Boss begins.", null, true)] public static void ClearIcon(ChatCommandContext ctx, string BossName) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) try { _ = ctx.Event.SenderUserEntity; if (Database.GetBoss(BossName, out var boss)) { Users users = GameData.Users; User user = ctx.Event.User; UserModel userByCharacterName = users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value); boss.RemoveIcon(((EntityModel)userByCharacterName).Entity); return; } throw new BossDontExistException(); } catch (BossDontExistException) { throw ctx.Error("Boss with name '" + BossName + "' does not exist."); } catch (Exception ex2) { throw ctx.Error("Error: " + ex2.Message); } } [Command("clearallicons", null, null, "The confrontation with a Boss begins.", null, true)] public static void ClearAllIcons(ChatCommandContext ctx) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) try { Entity entity = ((EntityModel)GameData.Users.All.FirstOrDefault()).Entity; NativeArray<Entity> entitiesByComponentTypes = QueryComponents.GetEntitiesByComponentTypes<MapIconData>((EntityQueryOptions)2, false); int num = 0; Enumerator<Entity> enumerator = entitiesByComponentTypes.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; PrefabGUID val = ECSExtensions.Read<PrefabGUID>(current); _ = Plugin.SystemsCore.PrefabCollectionSystem._PrefabDataLookup[val]; int guidHash = ((PrefabGUID)(ref val)).GuidHash; PrefabGUID mapIcon_POI_VBloodSource = Prefabs.MapIcon_POI_VBloodSource; if (guidHash == ((PrefabGUID)(ref mapIcon_POI_VBloodSource)).GuidHash) { num++; StatChangeUtility.KillOrDestroyEntity(Plugin.SystemsCore.EntityManager, current, entity, entity, 0.0, (StatChangeReason)0, true); } } entitiesByComponentTypes.Dispose(); ctx.Reply($"Removed icons ['{num}']"); } catch (Exception ex) { throw ctx.Error("Error: " + ex.Message); } } } }