-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.cs
More file actions
243 lines (220 loc) · 13 KB
/
Plugin.cs
File metadata and controls
243 lines (220 loc) · 13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
using System.Collections.Generic;
using AsmResolver.PE.Win32Resources;
using BepInEx;
//using BepInEx.IL2CPP;
using BepInEx.Logging;
//using Cpp2IL.Core;
using BepInEx.Unity.IL2CPP;
using CoreLib;
using CoreLib.Components;
using CoreLib.Submodules.ChatCommands;
using CoreLib.Submodules.ModEntity;
using CoreLib.Submodules.ModEntity.Atributes;
using CoreLib.Submodules.DropTables;
using CoreLib.Submodules.Localization;
using CoreLib.Submodules.ModComponent;
using CoreLib.Submodules.ModEntity;
using CoreLib.Submodules.ModEntity.Atributes;
using CoreLib.Submodules.ModResources;
using CoreLib.Submodules.ModSystem;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem.IO;
using Il2CppSystem.Reflection;
using PlayerState;
using PugTilemap;
using PugTilemap.Workshop;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using Path = System.IO.Path;
using PluginInfo = BepInEx.PluginInfo;
using ResourceData = CoreLib.Submodules.ModResources.ResourceData;
//using PainMod;
//using UnhollowerBaseLib;
//using UnhollowerRuntimeLib;
//using Unity.Entities;
//using UnityEngine;
//using Logger = Cpp2IL.Core.Logger;
namespace PainMod
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency(CoreLibPlugin.GUID)]
[CoreLibSubmoduleDependency(nameof(LocalizationModule), nameof(EntityModule))]
[CoreLibSubmoduleDependency(nameof(DropTablesModule))]
[CoreLibSubmoduleDependency(nameof(CommandsModule))]
[CoreLibSubmoduleDependency(nameof(SystemModule))]
[CoreLibSubmoduleDependency(nameof(ComponentModule))]
[EntityModification]
public class Plugin : BasePlugin
{
public static Tileset brick1;
public static TileTypeColorTable.TileColor tileColor1;
//public static ObjectID ProjectileSBMod;
public static ObjectID myCustomModdedProjectile;
public static ObjectID masterArmorHelm;
public static ObjectID masterArmorBreastplate;
public static ObjectID masterArmorPants;
public static ObjectID fungalCap;
public static ManualLogSource logger;
public static ObjectID customWall;
public static ResourceData resource;
public static ObjectID myCustomShootThing;
public static bool mineChallengeActive = false;
public static bool ghormChallengeActive = false;
public static int hz;
public static bool darkChallengeActive = false;
public static ObjectID maxHealthBuffStation;
public static ObjectID wormholeIdol;
public static ObjectID octopusOrb;
public static ObjectID birdBossBarrier;
public override void Load()
{
ClassInjector.RegisterTypeInIl2Cpp<CustomEnergyModProjectile>();
ClassInjector.RegisterTypeInIl2Cpp<CustomBuffingStation>();
ClassInjector.RegisterTypeInIl2Cpp<CustomMaxHpStation>();
ClassInjector.RegisterTypeInIl2Cpp<FirstSystemTest>();
ClassInjector.RegisterTypeInIl2Cpp<OctopusProtectiveOrb>();
ClassInjector.RegisterTypeInIl2Cpp<CustomBirdBossBarrier>();
AddComponent<FirstSystemTest>();
SystemModule.RegisterSystem<CustomStateSystem>();
ComponentModule.RegisterECSComponent<OctopusModdedStateCD>();
ComponentModule.RegisterECSComponent<OctopusModdedStateCDAuthoring>();
SystemModule.RegisterSystem<LarvaFlee.LarvaFleeStateSystem>();
SystemModule.RegisterStateRequester<LarvaFlee.LarvaFleeStateRequester>();
ComponentModule.RegisterECSComponent<LarvaFleeStateCD>();
ComponentModule.RegisterECSComponent<LarvaFleeStateCDAuthoring>();
ComponentModule.RegisterECSComponent<MustBeDestroyedForOctopusLeaveStateCD>();
ComponentModule.RegisterECSComponent<MustBeDestroyedForOctopusLeaveStateCDAuthoring>();
SystemModule.RegisterSystem<AntiCheeseSystem>();
ComponentModule.RegisterECSComponent<OctopusTenticleCounterCD>();
ComponentModule.RegisterECSComponent<OctopusTenticleCounterCDAuthoring>();
ComponentModule.RegisterECSComponent<RotatingBeamCD>();
ComponentModule.RegisterECSComponent<RotatingBeamCDAuthoring>();
ComponentModule.RegisterECSComponent<DoesCircleCD>();
ComponentModule.RegisterECSComponent<DoesCircleCDAuthoring>();
SystemModule.RegisterSystem<BirdBossReworkSystem>();
ComponentModule.RegisterECSComponent<BirdBossReworkCD>();
ComponentModule.RegisterECSComponent<BirdBossReworkCDAuthoring>();
ComponentModule.RegisterECSComponent<BirdBarrierCD>();
ComponentModule.RegisterECSComponent<BirdStoneCD>();
ComponentModule.RegisterECSComponent<BirdStoneCDAuthoring>();
SystemModule.RegisterSystem<CustomSecondaryUseSystem>();
logger = Log;
// Plugin startup logic
ClassInjector.RegisterTypeInIl2Cpp<MonoStuff>();
//ClassInjector.RegisterTypeInIl2Cpp<ModEnergyProjectile>();
string pluginfolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
// logger.LogInfo("plugin folder at " + pluginfolder);
resource = new ResourceData(PluginInfo.PLUGIN_GUID, "PainMod", pluginfolder);
resource.LoadAssetBundle("modassets");
ResourcesModule.AddResource(resource);
//eeeee
// ObjectID objectID = CustomEntityModule.AddEntity("PainMod:MyModdedWall", "ModdedPrefabs/MyModWall");
// ObjectID workbench = CustomEntityModule.AddModWorkbench("PainMod:Workbench", "Assets/PainMod/Resources/kiln.png",
// new List<CraftingData> {new CraftingData(ObjectID.ScarletBar, 4)});
// CustomEntityModule.AddWorkbenchItem(workbench, objectID);
// CustomEntityModule.AddEntityLocalization(workbench,
// "ModWorkBench",
// "testing.");
EntityModule.AddCustomTileset("Assets/PainMod/ScriptableObjects/Tilesets/BrickTileset.asset");
customWall = EntityModule.AddEntity("PainMod:BrickWall", "Assets/PainMod/Assets/CustomWall.prefab");
EntityModule.AddEntityLocalization(customWall,
"Clay Bricks wall",
"A sturdy wall built from earthy bricks.");
Tileset brick = EntityModule.GetTilesetId("PainMod:BrickTileset");
brick1 = brick;
// CustomEntityModule.AddWorkbenchItem(workbench, customWall);
/*
masterArmorHelm = CustomEntityModule.AddEntity("PainMod:MasterArmorHelm", "Assets/PainMod/Assets/MasterArmor.prefab");
CustomEntityModule.AddEntityLocalization(masterArmorHelm,
"Ancient Armor Helm",
"A masterfully crafted battle helm once overtaken by a misshapen being. Its engravings tell a story you can't quite comprehend.");
masterArmorBreastplate = CustomEntityModule.AddEntity("PainMod:MasterArmorBreastplate", "Assets/PainMod/Assets/MasterArmorBreastplate.prefab");
CustomEntityModule.AddEntityLocalization(masterArmorBreastplate,
"Ancient Armor Breastplate",
"Heavy plate mail formerly worn by a legendary warrior. Pulled away from the firm grasp of an abyssal colossus, it's still as polished as it has ever been.");
masterArmorPants = CustomEntityModule.AddEntity("PainMod:MasterArmorPants", "Assets/PainMod/Assets/MasterArmorPants.prefab");
CustomEntityModule.AddEntityLocalization(masterArmorPants,
"Ancient Armor Pants",
"Divine leggings that allow its wearer to perform the most dexterous leaps and dodges. Fervently treasured by a figure of power from a bygone age. ");
*/
fungalCap = EntityModule.AddEntity("PainMod:FungalCap", "Assets/PainMod/Assets/ShroomCap.prefab");
EntityModule.AddEntityLocalization(fungalCap,
"Funbrella",
"Hm.. what an oddity, it fills you with the urge to run.");
myCustomShootThing = EntityModule.AddEntity("PainMod:ShootyThing", "Assets/PainMod/Assets/ModStaffEntity.prefab");
EntityModule.AddEntityLocalization(myCustomShootThing, "Tempest Staff", "A powerful staff with an orb of unknown origins. It calls upon the power of the deep to channel whirling energy blasts.");
DropTablesModule.AddNewDrop(LootTableID.MushroomEnemy, new DropTableInfo(fungalCap, 1, 0.0125f));
// mineChallengeActive = true;
CommandsModule.AddCommands(System.Reflection.Assembly.GetExecutingAssembly(), PluginInfo.PLUGIN_NAME);
wormholeIdol = EntityModule.AddEntity("PainMod:TeleporterToFriend", "Assets/PainMod/Assets/TeleportIdol.prefab");
EntityModule.AddEntityLocalization(wormholeIdol,
"Linking Idol",
"Teleports you to a fellow explorer, consumed in the process.");
/* Texture2D armorTexture =
byte skinId = CustomEntityModule.AddPlayerCustomization(new HelmSkin()
{
helmTexture = armorTexture,
hairType = HelmHairType.FullyShow
});
CustomEntityModule.SetEquipmentSkin(masterArmorHelm, skinId);*/
// DropTablesModule.AddNewDrop(LootTableID.HiveBoss, new DropTableInfo(masterArmorHelm, 1,1f, true));
// DropTablesModule.AddNewDrop(LootTableID.OctopusBoss, new DropTableInfo(masterArmorBreastplate, 1,1f, true));
// DropTablesModule.AddNewDrop(LootTableID.ShamanBoss, new DropTableInfo(masterArmorPants, 1,0.69f, true));
//temporary
// CustomEntityModule.AddWorkbenchItem(workbench, masterArmorHelm);
// CustomEntityModule.AddWorkbenchItem(workbench, masterArmorBreastplate);
// CustomEntityModule.AddWorkbenchItem(workbench, masterArmorPants);
hz = Screen.currentResolution.refreshRate;
//ProjectileSBMod = CustomEntityModule.AddEntity("PainMod:ModShamanProjectile", "Assets/PainMod/Assets/AnotherCustomProjectile.prefab");
myCustomModdedProjectile = EntityModule.AddEntity("PainMod:MyCustomModdedProjectile",
"Assets/PainMod/Assets/ModdedEnergyProjectileEntity.prefab");
maxHealthBuffStation = EntityModule.AddEntity("PainMod:MaxHpBuffStation", "Assets/PainMod/Assets/CustomBuffStationEntity.prefab");
EntityModule.AddEntityLocalization(maxHealthBuffStation, "Healing Supplies", "Supplies for treating bruises, scratches and wounds alike.");
octopusOrb = EntityModule.AddEntity("PainMod:OctopusOrb",
"Assets/PainMod/Assets/OctopusProtectionOrbEntity.prefab");
EntityModule.AddEntityLocalization(octopusOrb, "Octopus Orb", "yes");
birdBossBarrier = EntityModule.AddEntity("PainMod:BirdBossBarrier",
"Assets/PainMod/Assets/BirdBossBarrierEntity.prefab");
EntityModule.AddEntityLocalization(birdBossBarrier, "Bird Boss Barrier", "Wait... you shouldn't have this?");
/* CustomEntityModule.AddEntityLocalization(objectID,
"Wall",
"yeah theres no way this will work lol."); */
//logger.LogInfo("Projectile SB mod is: " + ProjectileSBMod);
LocalizationModule.AddTerm("ModEmotes/DarknessWarn", "Its dark in here");
LocalizationModule.AddTerm("ModEmotes/DarknessWarn2", "Lights out!");
LocalizationModule.AddTerm("ModEmotes/GoodLuck", "Challenge up!");
LocalizationModule.AddTerm("ModEmotes/BewareWorm", "This can't be good...");
LocalizationModule.AddTerm("ModEmotes/ShamanBossAwaken", "It's not over");
var harmony = new Harmony(PluginInfo.PLUGIN_GUID);
harmony.PatchAll();
Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
//AddComponent<MonoStuff>();
}
/*foreach (EntityMonoBehaviourData e in gae)
{
foreach (PrefabInfo prefabInfo in e.objectInfo.prefabInfos)
{
if (e.objectInfo.objectID == ObjectID.LarvaHiveBoss)
{
prefabInfo.prefab.gameObject.GetComponent<HealthCDAuthoring>().maxHealth = 69420;
prefabInfo.prefab.gameObject.GetComponent<HealthCDAuthoring>().startHealth = 69420;
prefabInfo.prefab.gameObject.GetComponent<ShootMortarProjectileStateCDAuthoring>().mortarDamage = 500;
prefabInfo.prefab.gameObject.GetComponent<ShootMortarProjectileStateCDAuthoring>().goUpTime = 0.3f;
}
}
}*/
}
[HarmonyPatch(typeof(Manager))]
internal class ManagerPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
static void ManagerUpdatePatch(Manager __instance)
{
// Your code here, use __instance to get access to the Manager Instance
}
}
}