| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using GadgetCore.API;
- using HarmonyLib;
- using UnityEngine;
- namespace MonsterNests.Patches
- {
- [HarmonyPatch(typeof(Chunk))]
- [HarmonyPatch("SpawnBiomeSlot")]
- [HarmonyGadget("MonsterNests")]
- public static class Patch_Chunk_SpawnBiomeSlot
- {
- [HarmonyPostfix]
- public static bool Prefix(Chunk __instance, int a, int i, int mid, ref GameObject[] ___spawnSpot, ref GameObject[] ___spawnSpotMid, ref GameObject[] ___networkStuff, ref int ___temp)
- {
- Transform transform;
- if (mid == 1)
- transform = ___spawnSpotMid[i].transform;
- else
- transform = ___spawnSpot[i].transform;
- int num = UnityEngine.Random.Range(0, 700);
- if (num < 5)
- {
- if (a == 0)
- {
- if (Random.Range(0, 2) == 0)
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectBugTree.Object, transform.position, Quaternion.identity, 0);
- else
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectBugspotBig.Object, transform.position, Quaternion.identity, 0);
- ___temp++;
- return false;
- }
- else if (a == 1)
- {
- if (GameScript.challengeLevel <= 0)
- ___networkStuff[___temp] = (GameObject)Network.Instantiate((GameObject)Resources.Load(Core.objectSpikePlant.ResourcePath), transform.position, Quaternion.identity, 0);
- else
- ___networkStuff[___temp] = (GameObject)Network.Instantiate((GameObject)Resources.Load(Core.objectSpikePlantCM.ResourcePath), transform.position, Quaternion.identity, 0);
- ___temp++;
- return false;
- }
- else if (a == 2)
- {
- if (GameScript.challengeLevel <= 0)
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectSpiderEgg.Object, transform.position, Quaternion.identity, 0);
- else
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectSpiderEggCM.Object, transform.position, Quaternion.identity, 0);
- ___temp++;
- return false;
- }
- else if (a == 3)
- {
- if (Random.Range(0, 2) == 0)
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectGoldenShroom.Object, transform.position, Quaternion.identity, 0);
- else
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectWizShroom.Object, transform.position, Quaternion.identity, 0);
- ___temp++;
- return false;
- }
- else if (a == 4)
- {
- if (GameScript.challengeLevel <= 0)
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectAncientCrystal.Object, transform.position, Quaternion.identity, 0);
- else
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectAncientCrystalCM.Object, transform.position, Quaternion.identity, 0);
- ___temp++;
- return false;
- }
- //else if (a == 5)
- //{
- // ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectPlagueNest.Object, transform.position, Quaternion.identity, 0);
- // ___temp++;
- // return false;
- //}
- else if (a == 6)
- {
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectFrozenWisp.Object, transform.position, Quaternion.identity, 0);
- ___temp++;
- return false;
- }
- else if (a == 7)
- {
- ___networkStuff[___temp] = (GameObject)Network.Instantiate(Core.objectMolten.Object, transform.position, Quaternion.identity, 0);
- ___temp++;
- return false;
- }
- }
- return true;
- }
- }
- }
|