public static void GenerateBasicRoomLayout(PrototypeDungeonRoom room, CellType DefaultCellType = CellType.FLOOR, PrototypeRoomPitEntry.PitBorderType pitBorderType = PrototypeRoomPitEntry.PitBorderType.FLAT) { int width = room.Width; int height = room.Height; int ArrayLength = (width * height); room.FullCellData = new PrototypeDungeonRoomCellData[ArrayLength]; List <Vector2> m_Pits = new List <Vector2>(); for (int X = 0; X < width; X++) { for (int Y = 0; Y < height; Y++) { int ArrayPosition = (Y * width + X); room.FullCellData[ArrayPosition] = GenerateCellData(DefaultCellType); if (DefaultCellType == CellType.PIT) { m_Pits.Add(new Vector2(X, Y)); } } } if (m_Pits.Count > 0) { room.pits = new List <PrototypeRoomPitEntry>() { new PrototypeRoomPitEntry(m_Pits) { containedCells = m_Pits, borderType = pitBorderType } }; } room.OnBeforeSerialize(); room.UpdatePrecalculatedData(); }
public static void AddObjectToRoom(PrototypeDungeonRoom room, Vector2 position, GameObject PlacableObject, int xOffset = 0, int yOffset = 0, int layer = 0, float SpawnChance = 1f, int PathID = -1, int PathStartNode = 0) { if (room == null) { return; } if (room.placedObjects == null) { room.placedObjects = new List <PrototypePlacedObjectData>(); } if (room.placedObjectPositions == null) { room.placedObjectPositions = new List <Vector2>(); } PrototypePlacedObjectData m_NewObjectData = new PrototypePlacedObjectData() { placeableContents = ExpandUtility.GenerateDungeonPlacable(PlacableObject, useExternalPrefab: true), nonenemyBehaviour = null, spawnChance = SpawnChance, unspecifiedContents = null, enemyBehaviourGuid = string.Empty, contentsBasePosition = position, layer = layer, xMPxOffset = xOffset, yMPxOffset = yOffset, fieldData = new List <PrototypePlacedObjectFieldData>(0), instancePrerequisites = new DungeonPrerequisite[0], linkedTriggerAreaIDs = new List <int>(0), assignedPathIDx = PathID, assignedPathStartNode = PathStartNode }; room.placedObjects.Add(m_NewObjectData); room.placedObjectPositions.Add(position); return; }
public static PrototypeDungeonRoom CreateEmptyRoom(int width = 12, int height = 12) { try { PrototypeDungeonRoom room = GetNewPrototypeDungeonRoom(width, height); AddExit(room, new Vector2(width / 2, height), DungeonData.Direction.NORTH); AddExit(room, new Vector2(width / 2, 0), DungeonData.Direction.SOUTH); AddExit(room, new Vector2(width, height / 2), DungeonData.Direction.EAST); AddExit(room, new Vector2(0, height / 2), DungeonData.Direction.WEST); PrototypeDungeonRoomCellData[] cellData = m_cellData.GetValue(room) as PrototypeDungeonRoomCellData[]; cellData = new PrototypeDungeonRoomCellData[width * height]; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { cellData[x + y * width] = new PrototypeDungeonRoomCellData() { state = CellType.FLOOR, appearance = new PrototypeDungeonRoomCellAppearance() { OverrideFloorType = CellVisualData.CellFloorType.Stone, }, }; } } m_cellData.SetValue(room, cellData); room.UpdatePrecalculatedData(); return(room); } catch (Exception e) { Tools.PrintException(e); return(null); } }
// Token: 0x0600004E RID: 78 RVA: 0x000050C8 File Offset: 0x000032C8 public static void AddExit(PrototypeDungeonRoom room, Vector2 location, DungeonData.Direction direction) { bool flag = room.exitData == null; bool flag2 = flag; if (flag2) { room.exitData = new PrototypeRoomExitData(); } bool flag3 = room.exitData.exits == null; bool flag4 = flag3; if (flag4) { room.exitData.exits = new List <PrototypeRoomExit>(); } PrototypeRoomExit prototypeRoomExit = new PrototypeRoomExit(direction, location); prototypeRoomExit.exitType = PrototypeRoomExit.ExitType.NO_RESTRICTION; Vector2 b = (direction == DungeonData.Direction.EAST || direction == DungeonData.Direction.WEST) ? new Vector2(0f, 1f) : new Vector2(1f, 0f); prototypeRoomExit.containedCells.Add(location + b); room.exitData.exits.Add(prototypeRoomExit); }
public static PrototypeDungeonRoom GetNewPrototypeDungeonRoom(int width = 12, int height = 12) { PrototypeDungeonRoom room = ScriptableObject.CreateInstance <PrototypeDungeonRoom>(); room.injectionFlags = new RuntimeInjectionFlags(); room.RoomId = UnityEngine.Random.Range(10000, 1000000); room.pits = new List <PrototypeRoomPitEntry>(); room.placedObjects = new List <PrototypePlacedObjectData>(); room.placedObjectPositions = new List <Vector2>(); room.additionalObjectLayers = new List <PrototypeRoomObjectLayer>(); room.eventTriggerAreas = new List <PrototypeEventTriggerArea>(); room.roomEvents = new List <RoomEventDefinition>(); room.paths = new List <SerializedPath>(); room.prerequisites = new List <DungeonPrerequisite>(); room.excludedOtherRooms = new List <PrototypeDungeonRoom>(); room.rectangularFeatures = new List <PrototypeRectangularFeature>(); room.exitData = new PrototypeRoomExitData(); room.exitData.exits = new List <PrototypeRoomExit>(); room.allowWallDecoration = false; room.allowFloorDecoration = false; room.Width = width; room.Height = height; return(room); }
public static void DumpRoomLayoutToText(PrototypeDungeonRoom overrideRoom = null) { try { if (overrideRoom == null) { RoomHandler currentRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom; int CurrentFloor = GameManager.Instance.CurrentFloor; Dungeon dungeon = null; if (CurrentFloor == 1) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Castle"); } if (CurrentFloor == 2) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Gungeon"); } if (CurrentFloor == 3) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Mines"); } if (CurrentFloor == 4) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Catacombs"); } if (CurrentFloor == 5) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Forge"); } if (CurrentFloor == 6) { dungeon = DungeonDatabase.GetOrLoadByName("Base_BulletHell"); } if (CurrentFloor == -1) { if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CASTLEGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Castle"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.SEWERGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Sewer"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.GUNGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Gungeon"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CATHEDRALGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Cathedral"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.MINEGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Mines"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.RATGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_ResourcefulRat"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CATACOMBGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Catacombs"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.OFFICEGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Nakatomi"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.FORGEGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Forge"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.HELLGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_BulletHell"); } } if (dungeon == null) { ETGModConsole.Log("Could not determine current floor/tileset!\n Attempting to use" + currentRoom.GetRoomName() + ".area.ProtoTypeDungeonRoom instead!", false); Tools.LogRoomLayout(currentRoom.area.prototypeRoom); dungeon = null; return; } if (dungeon.PatternSettings.flows != null) { if (dungeon.PatternSettings.flows[0].fallbackRoomTable != null) { if (dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements != null) { if (dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements.Count > 0) { for (int i = 0; i < dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements.Count; i++) { if (dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements[i].room != null) { if (currentRoom.GetRoomName().ToLower().StartsWith(dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements[i].room.name.ToLower())) { Tools.LogRoomLayout(dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements[i].room); ETGModConsole.Log("Logged current room layout.", false); dungeon = null; return; } } } } } } } if (dungeon.PatternSettings.flows != null && dungeon.PatternSettings.flows[0].fallbackRoomTable == null) { for (int i = 0; i < dungeon.PatternSettings.flows[0].AllNodes.Count; i++) { if (dungeon.PatternSettings.flows[0].AllNodes[i].overrideExactRoom != null) { if (currentRoom.GetRoomName().ToLower().StartsWith(dungeon.PatternSettings.flows[0].AllNodes[i].overrideExactRoom.name.ToLower())) { Tools.LogRoomLayout(dungeon.PatternSettings.flows[0].AllNodes[i].overrideExactRoom); ETGModConsole.Log("Logged current room layout.", false); dungeon = null; return; } } } } ETGModConsole.Log("Current Room's ProtoTypeDungeonRoom prefab not found.\n Attempting to use [" + currentRoom.GetRoomName() + "].area.ProtoTypeDungeonRoom instead!", false); Tools.LogRoomLayout(currentRoom.area.prototypeRoom); dungeon = null; ETGModConsole.Log("Logged current room layout.", false); } else { Tools.LogRoomLayout(overrideRoom); } } catch (System.Exception ex) { ETGModConsole.Log("Failed to log current room layout.", false); ETGModConsole.Log(" " + ex.Message, false); Debug.LogException(ex); } }
public static void AssignCellData(PrototypeDungeonRoom room, string fileName) { string[] linesFromEmbeddedResource = ResourceExtractor.GetLinesFromEmbeddedResource(fileName); int width = room.Width; int height = room.Height; CellType[,] cellData = new CellType[width, height]; for (int Y = 0; Y < height; Y++) { string text = linesFromEmbeddedResource[Y]; for (int X = 0; X < width; X++) { // Corrects final row being off by one unit (read as first line in text file) if (Y == 0 && X > 0) { char c = text[X]; if (c != '-') { if (c != 'P') { if (c == 'W') { cellData[X - 1, height - Y - 1] = CellType.WALL; } } else { cellData[X - 1, height - Y - 1] = CellType.PIT; } } else { cellData[X - 1, height - Y - 1] = CellType.FLOOR; } } else { char c = text[X]; if (c != '-') { if (c != 'P') { if (c == 'W') { cellData[X, height - Y - 1] = CellType.WALL; } } else { cellData[X, height - Y - 1] = CellType.PIT; } } else { cellData[X, height - Y - 1] = CellType.FLOOR; } } } } // Set Final Cell (it was left null for some reason) string text2 = linesFromEmbeddedResource[height - 1]; char C = text2[width - 1]; if (C != '-') { if (C != 'P') { if (C == 'W') { cellData[width - 1, height - 1] = CellType.WALL; } } else { cellData[width - 1, height - 1] = CellType.PIT; } } else { cellData[width - 1, height - 1] = CellType.FLOOR; } for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { room.GetCellDataAtPoint(i, j).state = cellData[i, j]; } } room.UpdatePrecalculatedData(); }
public static void Init() { ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "The Gungeon is a tough place, it pays to have thick skin."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "My pepaw always told me to stay prepared. So that's what I do."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "The cost of being heavily armoured is never letting anyone in."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "Names Ironside. I specialise in armour and protective supplies."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "Like the carpet? I got it custom made."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "Blanks are all well and good, but you're not always going to have them. Ask yourself, do you want bullets goin' straight to your heart(s)?"); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "I have done and I have dared, for everything to be prepared."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "Did you see that tarnished old slug rooting around in my garbage? What a freak."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_GENERIC_TALK", "Armour up Gungeoneer, the road ahead is long and the bullets don't get any softer."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_STOPPER_TALK", "No more chit-chat."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_STOPPER_TALK", "I don't have time to talk longer."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_STOPPER_TALK", "Got things to be, places to do."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_PURCHASE_TALK", "Pleasure doin' business with you."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_PURCHASE_TALK", "Pays to be prepared."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_PURCHASE_TALK", "Armoured and ready!"); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_NOSALE_TALK", "You'd better get out there and find some more armour."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_NOSALE_TALK", "Sorry pal, no shields no sale."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_INTRO_TALK", "AVAST FIEND- Oh, no. It's just you."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_INTRO_TALK", "Staying safe out there?"); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_INTRO_TALK", "Welcome back, you're looking beat up."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_INTRO_TALK", "Good grief... I didn't know someone could have that many bruises."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_ATTACKED_TALK", "Hah, no way you're getting through this armour!"); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_ATTACKED_TALK", "Nice try, but one of us is squishy and it ain't me."); ETGMod.Databases.Strings.Core.AddComplex("#IRONSIDE_ATTACKED_TALK", "You're gonna wish you hadn't done that one day."); List <int> LootTable = new List <int>() { 160, //Gunknight Stuff 161, 162, 163, 450, //Armor Synthesizer 147, //Armor of Thorns 64, //Potion of Lead Skin 65, //Knife Shield 380, //Betrayers Shield 447, //Shield of the Maiden 634, //Crisis Stone 111, //Heavy Bullets 256, //Heavy Boots 564, //Full Metal Jacket 290, //Sunglasses 312, //Blast Helmet 314, //Nanomachines 454, //Hazmat Suit 598, //Stone Dome 545, //AC-15 178, //Crestfaller 154, //Trashcannon FullArmourJacket.FullArmourJacketID, KnightlyBullets.KnightlyBulletsID, ArmourBandage.ArmourBandageID, GoldenArmour.GoldenArmourID, ExoskeletalArmour.MeatShieldID, ArmouredArmour.ArmouredArmourID, KeyBullwark.KeyBulwarkID, TinHeart.TinHeartID, HeavyChamber.HeavyChamberID, TableTechInvulnerability.TableTechInvulnerabilityID, LiquidMetalBody.LiquidMetalBodyID, HornedHelmet.HornedHelmetID, LeadSoul.LeadSoulID, GSwitch.GSwitchID, MaidenRifle.MaidenRifleID, RapidRiposte.RapidRiposteID, Converter.ConverterID, }; IronsideLootTable = LootTableTools.CreateLootTable(); foreach (int i in LootTable) { IronsideLootTable.AddItemToPool(i); } GameObject ironsideObj = ItsDaFuckinShopApi.SetUpShop( "Ironside", "omitb", new List <string>() { "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_idle_001", "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_idle_002", "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_idle_003", "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_idle_004", }, 8, new List <string>() { "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_talk_001", "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_talk_002", "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_talk_003", "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_talk_004", "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_talk_005", "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_talk_006", }, 12, IronsideLootTable, CustomShopItemController.ShopCurrencyType.CUSTOM, "#IRONSIDE_GENERIC_TALK", "#IRONSIDE_STOPPER_TALK", "#IRONSIDE_PURCHASE_TALK", "#IRONSIDE_NOSALE_TALK", "#IRONSIDE_INTRO_TALK", "#IRONSIDE_ATTACKED_TALK", new Vector3(1, 2.5f, 0), ItsDaFuckinShopApi.defaultItemPositions, 1f, false, null, Ironside.IronsideCustomCanBuy, Ironside.IronsideCustomRemoveCurrency, Ironside.IronsideCustomPrice, IronsideBuy, null, "NevernamedsItems/Resources/NPCSprites/Ironside/armourcurrency_icon.png", "Armor", true, true, "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_carpet", true, "NevernamedsItems/Resources/NPCSprites/Ironside/ironside_mapicon", true, 0.1f ); PrototypeDungeonRoom Mod_Shop_Room = RoomFactory.BuildFromResource("NevernamedsItems/Resources/EmbeddedRooms/IronsideRoom.room").room; ItsDaFuckinShopApi.RegisterShopRoom(ironsideObj, Mod_Shop_Room, new UnityEngine.Vector2(7f, 9)); }
public static DungeonFlowNode GenerateFlowNode(DungeonFlow flow, PrototypeDungeonRoom.RoomCategory category, PrototypeDungeonRoom overrideRoom = null, GenericRoomTable overrideRoomTable = null, bool loopTargetIsOneWay = false, bool isWarpWing = false, bool handlesOwnWarping = true, float weight = 1f, DungeonFlowNode.NodePriority priority = DungeonFlowNode.NodePriority.MANDATORY, string guid = "") { if (string.IsNullOrEmpty(guid)) { guid = Guid.NewGuid().ToString(); } DungeonFlowNode node = new DungeonFlowNode(flow) { isSubchainStandin = false, nodeType = DungeonFlowNode.ControlNodeType.ROOM, roomCategory = category, percentChance = weight, priority = priority, overrideExactRoom = overrideRoom, overrideRoomTable = overrideRoomTable, capSubchain = false, subchainIdentifier = string.Empty, limitedCopiesOfSubchain = false, maxCopiesOfSubchain = 1, subchainIdentifiers = new List <string>(0), receivesCaps = false, isWarpWingEntrance = isWarpWing, handlesOwnWarping = handlesOwnWarping, forcedDoorType = DungeonFlowNode.ForcedDoorType.NONE, loopForcedDoorType = DungeonFlowNode.ForcedDoorType.NONE, nodeExpands = false, initialChainPrototype = "n", chainRules = new List <ChainRule>(0), minChainLength = 3, maxChainLength = 8, minChildrenToBuild = 1, maxChildrenToBuild = 1, canBuildDuplicateChildren = false, guidAsString = guid, parentNodeGuid = string.Empty, childNodeGuids = new List <string>(0), loopTargetNodeGuid = string.Empty, loopTargetIsOneWay = loopTargetIsOneWay, flow = flow }; return(node); }
///maybe add some value proofing here (name != null, collider != IntVector2.Zero) public GameObject Build() { try { //Get texture and create sprite Texture2D tex = ResourceExtractor.GetTextureFromResource(spritePath); var shrine = GungeonAPI.SpriteBuilder.SpriteFromResource(spritePath, null, false); //Add (hopefully) unique ID to shrine for tracking string ID = $"{modID}:{name}".ToLower().Replace(" ", "_"); shrine.name = ID; //Position sprite var shrineSprite = shrine.GetComponent <tk2dSprite>(); shrineSprite.IsPerpendicular = true; shrineSprite.PlaceAtPositionByAnchor(offset, tk2dBaseSprite.Anchor.LowerCenter); //Add speech bubble origin var talkPoint = new GameObject("talkpoint").transform; talkPoint.position = shrine.transform.position + talkPointOffset; talkPoint.SetParent(shrine.transform); //Set up collider if (!usesCustomColliderOffsetAndSize) { IntVector2 spriteDimensions = new IntVector2(tex.width, tex.height); colliderOffset = new IntVector2(0, 0); colliderSize = new IntVector2(spriteDimensions.x, spriteDimensions.y / 2); } var body = ItemAPI.SpriteBuilder.SetUpSpeculativeRigidbody(shrineSprite, colliderOffset, colliderSize); //if (!string.IsNullOrEmpty(shadowSpritePath)) //{ // var shadow = ((GameObject)UnityEngine.Object.Instantiate(ResourceCache.Acquire("DefaultShadowSprite"))).GetComponent<tk2dSprite>(); // var shadowSprite = ItemAPI.SpriteBuilder.SpriteFromResource(shadowSpritePath, null, false).GetComponent<tk2dSprite>(); // Tools.Print($"Shadow material: {shadow.renderer.material.name}"); // Tools.Print($"\tShadow color: {shadow.color}"); // Tools.Print($"\tShadow material: {shadowSprite.renderer.material.name}"); // Tools.Print($"\tShadow color: {shadowSprite.color}"); // Tools.ExportTexture(shadow.renderer.material.mainTexture.GetReadable()); // //Tools.ExportTexture(shadowSprite.renderer.material.mainTexture.GetReadable()); // shrineSprite.AttachRenderer(shadow); // shadow.PlaceAtPositionByAnchor(shrineSprite.WorldBottomCenter, tk2dBaseSprite.Anchor.UpperCenter); // //shadow.color = new Color(1, 1, 1, .5f); // //shadow.HeightOffGround = -0.1f; // //shadow.renderer.material = defaultSprite.renderer.material; // DepthLookupManager.ProcessRenderer(shadow.GetComponent<Renderer>(), DepthLookupManager.GungeonSortingLayer.BACKGROUND); // //Tools.LogPropertiesAndFields(defaultSprite); //} var data = shrine.AddComponent <CustomShrineController>(); data.ID = ID; data.roomStyles = roomStyles; data.isBreachShrine = true; data.offset = offset; data.pixelColliders = body.specRigidbody.PixelColliders; data.factory = this; data.OnAccept = OnAccept; data.OnDecline = OnDecline; data.CanUse = CanUse; data.text = text; data.acceptText = acceptText; data.declineText = declineText; if (interactableComponent == null) { var simpInt = shrine.AddComponent <SimpleShrine>(); simpInt.isToggle = this.isToggle; simpInt.OnAccept = this.OnAccept; simpInt.OnDecline = this.OnDecline; simpInt.CanUse = CanUse; simpInt.text = this.text; simpInt.acceptText = this.acceptText; simpInt.declineText = this.declineText; simpInt.talkPoint = talkPoint; } else { shrine.AddComponent(interactableComponent); } shrine.name = ID; if (!isBreachShrine) { if (!room) { room = RoomFactory.CreateEmptyRoom(); } RegisterShrineRoom(shrine, room, ID, offset); } registeredShrines.Add(ID, shrine); FakePrefab.MarkAsFakePrefab(shrine); Tools.Print("Added shrine: " + ID); return(shrine); } catch (Exception e) { Tools.PrintException(e); return(null); } }
public static void AddExitToRoom(PrototypeDungeonRoom room, Vector2 ExitLocation, DungeonData.Direction ExitDirection, PrototypeRoomExit.ExitType ExitType = PrototypeRoomExit.ExitType.NO_RESTRICTION, PrototypeRoomExit.ExitGroup ExitGroup = PrototypeRoomExit.ExitGroup.A, bool ContainsDoor = true, int ExitLength = 3, int exitSize = 2, DungeonPlaceable overrideDoorObject = null) { if (room == null) { return; } if (room.exitData == null) { room.exitData = new PrototypeRoomExitData(); room.exitData.exits = new List <PrototypeRoomExit>(); } if (room.exitData.exits == null) { room.exitData.exits = new List <PrototypeRoomExit>(); } PrototypeRoomExit m_NewExit = new PrototypeRoomExit(ExitDirection, ExitLocation) { exitDirection = ExitDirection, exitType = ExitType, exitGroup = ExitGroup, containsDoor = ContainsDoor, exitLength = ExitLength, containedCells = new List <Vector2>(), }; if (ExitDirection == DungeonData.Direction.WEST | ExitDirection == DungeonData.Direction.EAST) { if (exitSize > 2) { m_NewExit.containedCells.Add(ExitLocation); m_NewExit.containedCells.Add(ExitLocation + new Vector2(0, 1)); for (int i = 2; i < exitSize; i++) { m_NewExit.containedCells.Add(ExitLocation + new Vector2(0, i)); } } else { m_NewExit.containedCells.Add(ExitLocation); m_NewExit.containedCells.Add(ExitLocation + new Vector2(0, 1)); } } else { if (exitSize > 2) { m_NewExit.containedCells.Add(ExitLocation); m_NewExit.containedCells.Add(ExitLocation + new Vector2(1, 0)); for (int i = 2; i < exitSize; i++) { m_NewExit.containedCells.Add(ExitLocation + new Vector2(i, 0)); } } else { m_NewExit.containedCells.Add(ExitLocation); m_NewExit.containedCells.Add(ExitLocation + new Vector2(1, 0)); } } if (overrideDoorObject) { m_NewExit.specifiedDoor = overrideDoorObject; } room.exitData.exits.Add(m_NewExit); }
public static void Init() { ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "I sell, yes, you! Buy! Cash yes money yes yes yes!"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "Rusty sells trash people throw at him. Make easy money. Heheh. Fools."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "You want to talk to Rusty? Nobody ever talks to Rusty."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "I used to be taaaaall once, yes, yes. Taaaall, and red. Red."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "They laugh at Rusty, yes... they all laugh..."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "Rusty has seen things... things you are not ready to see."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "Chambers lurk below. Places you've never seen. Perhaps you will be ready one day, yes."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "Don't trust the mad bullet Alhazard. Rusty trusted him, and is now Rusty."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "What is it like. To have skin. Rusty wonders?"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "One day you and Rusty will be not so different, rustythinks yes."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_GENERIC_TALK", "One day, the skies will run black with the ichor of ages, and all will be unloaded... what?"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_STOPPER_TALK", "You are boring. Rusty is bored yes bored no yes"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_STOPPER_TALK", "Rusty has no more to say to you, no, no."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_STOPPER_TALK", "Mmmmm, yesyesyesyesyesyesyes."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_PURCHASE_TALK", "YesYes! Deal Yes! Buy!"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_PURCHASE_TALK", "A good choice, yes!"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_PURCHASE_TALK", "A poor choice, yes!"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_PURCHASE_TALK", "Rusty lives another day."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_PURCHASE_TALK", "Rusty will buy a new can of polish!"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_NOSALE_TALK", "No. TooCheap. Even for me, hehehehehehh"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_NOSALE_TALK", "Cash, upfront. No credit."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_NOSALE_TALK", "Rusty no give credit. You come back when you're richer!"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_INTRO_TALK", "Oh! You are back! Yes! Heheh! BuyBuy!"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_INTRO_TALK", "You Live! Rusty is Glad! Yes!"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_INTRO_TALK", "Wallet person returns, yes, with wallet gold?"); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_ATTACKED_TALK", "Rusty no die. Rusty live forever."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_ATTACKED_TALK", "If killing Rusty was that easy, Rusty would be dead."); ETGMod.Databases.Strings.Core.AddComplex("#RUSTY_ATTACKED_TALK", "Rusty think you are a %&**@. Yes."); List<int> LootTable = new List<int>() { 120, //Armour 224, //Blank 127, //Junk 558, //Bottle 108, //Bomb 109, //Ice Bomb 66, //Proximity Mine 308, //Cluster Mine 136, //C4 366, //Molotov 234, //iBomb Companion App 77, //Supply Drop 403, //Melted Rock 432, //Jar of Bees 447, //Shield of the Maiden 644, //Portable Table Device 573, //Chest Teleporter 65, //Knife Shield 250, //Grappling Hook 353, //Enraging Photo 488, //Ring of Chest Vampirism 256, //Heavy Boots 137, //Map 565, //Glass Guon Stone 306, //Escape Rope 106, //Jetpack 487, //Book of Chest Anatomy 197, //Pea Shooter 56, //38 Special 378, //Derringer 539, //Boxing Glove 79, //Makarov 8, //Bow 9, //Dueling Pistol 202, //Sawed Off 122, //Blunderbuss 12, //Crossbow 31, //Klobbe 181, //Winchester Rifle 327, //Corsair 577, //Turbo Gun 196, //Fossilized Gun 10, //Mega Douser 363, //Trick Gun 33, //Tear Jerker 176, //Gungeon Ant 440, //Ruby Bracelet //MY ITEMS MistakeBullets.MistakeBulletsID, TracerRound.TracerRoundsID, IronSights.IronSightsID, GlassChamber.GlassChamberID, BulletBoots.BulletBootsID, DiamondBracelet.DiamondBraceletID, PearlBracelet.PearlBraceletID, RingOfAmmoRedemption.RingOfAmmoRedemptionID, MapFragment.MapFragmentID, GunGrease.GunGreaseID, LuckyCoin.LuckyCoinID, AppleActive.AppleID, SpeedPotion.SpeedPotionID, ShroomedGun.ShroomedGunID, Glock42.Glock42ID, DiscGun.DiscGunID, Purpler.PurplerID, TheLodger.TheLodgerID, HeatRay.HeatRayID, }; RustyLootTable = LootTableTools.CreateLootTable(); foreach (int i in LootTable) { RustyLootTable.AddItemToPool(i); } GameObject rustyObj = ItsDaFuckinShopApi.SetUpShop( "Rusty", //Name "omitb", //ModName new List<string>() //Idle Sprite Paths { "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_idle_001", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_idle_002", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_idle_003", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_idle_004", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_idle_005", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_idle_006", }, 12, //Idle FPS new List<string>() //Talk Sprite Paths { "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_talk_001", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_talk_002", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_talk_003", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_talk_004", "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_talk_005", }, 12, //Talk FPS //Loot Table RustyLootTable, //Currency CustomShopItemController.ShopCurrencyType.COINS, //Dialogue Strings "#RUSTY_GENERIC_TALK", "#RUSTY_STOPPER_TALK", "#RUSTY_PURCHASE_TALK", "#RUSTY_NOSALE_TALK", "#RUSTY_INTRO_TALK", "#RUSTY_ATTACKED_TALK", //Text Box Offset new Vector3(1, 1.5f, 0), //Item positions ItsDaFuckinShopApi.defaultItemPositions, //Price mult 0.5f, //Give Stats on Purchase false, //Stats to give on purchase null, //Custom Can Buy null, //Custom Remove Currency null, //Custom Price null, //On Purchase RustyBuy, // On Steal RustySteal, //Currency Icon null, //Currency name null, //Can be robbed true, //Has Carpet true, //Carpet Sprite "NevernamedsItems/Resources/NPCSprites/Rusty/rustycarpet", //Has Minimap Icon true, //Minimap icon path "NevernamedsItems/Resources/NPCSprites/Rusty/rusty_mapicon", //Add to bello shop true, 0.1f ); PrototypeDungeonRoom Mod_Shop_Room = RoomFactory.BuildFromResource("NevernamedsItems/Resources/EmbeddedRooms/RustyRoom.room").room; ItsDaFuckinShopApi.RegisterShopRoom(rustyObj, Mod_Shop_Room, new UnityEngine.Vector2(7f, 6)); }
public static void DumpCurrentRoomLayout(PrototypeDungeonRoom overrideRoom = null, RoomHandler generatedRoomHandler = null) { try { if (overrideRoom != null) { LogRoomToPNGFile(overrideRoom); ETGModConsole.Log("Succesfully saved room layout to PNG.", false); return; } else if (generatedRoomHandler != null) { LogRoomHandlerToPNGFile(generatedRoomHandler); ETGModConsole.Log("Succesfully saved room layout to PNG.", false); return; } RoomHandler currentRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom; int CurrentFloor = GameManager.Instance.CurrentFloor; Dungeon dungeon = null; if (CurrentFloor == 1) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Castle"); } if (CurrentFloor == 2) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Gungeon"); } if (CurrentFloor == 3) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Mines"); } if (CurrentFloor == 4) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Catacombs"); } if (CurrentFloor == 5) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Forge"); } if (CurrentFloor == 6) { dungeon = DungeonDatabase.GetOrLoadByName("Base_BulletHell"); } if (CurrentFloor == -1) { if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CASTLEGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Castle"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.SEWERGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Sewer"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.GUNGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Gungeon"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CATHEDRALGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Cathedral"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.MINEGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Mines"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.RATGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_ResourcefulRat"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CATACOMBGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Catacombs"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.OFFICEGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Nakatomi"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.FORGEGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_Forge"); } if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.HELLGEON) { dungeon = DungeonDatabase.GetOrLoadByName("Base_BulletHell"); } } if (dungeon == null) { ETGModConsole.Log("Could not find current Dungeon prefab for current floor!\n Attempting to use local dungeon data area of room instead.", false); LogRoomHandlerToPNGFile(currentRoom); dungeon = null; return; } if (dungeon.PatternSettings.flows != null) { if (dungeon.PatternSettings.flows[0].fallbackRoomTable != null) { if (dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements != null) { if (dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements.Count > 0) { for (int i = 0; i < dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements.Count; i++) { if (dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements[i].room != null) { if (currentRoom.GetRoomName().ToLower().StartsWith(dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements[i].room.name.ToLower())) { LogRoomToPNGFile(dungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements[i].room); ETGModConsole.Log("Succesfully saved current room layout to PNG.", false); dungeon = null; return; } } } } } } } if (dungeon.PatternSettings.flows != null && dungeon.PatternSettings.flows[0].fallbackRoomTable == null) { for (int i = 0; i < dungeon.PatternSettings.flows[0].AllNodes.Count; i++) { if (dungeon.PatternSettings.flows[0].AllNodes[i].overrideExactRoom != null) { if (currentRoom.GetRoomName().ToLower().StartsWith(dungeon.PatternSettings.flows[0].AllNodes[i].overrideExactRoom.name.ToLower())) { LogRoomToPNGFile(dungeon.PatternSettings.flows[0].AllNodes[i].overrideExactRoom); ETGModConsole.Log("Succesfully saved current room layout to PNG.", false); dungeon = null; return; } } } } ETGModConsole.Log("Current Room's ProtoTypeDungeonRoom prefab not found!\nAttempting to use local DungeonData of RoomHandler object instead...", false); LogRoomHandlerToPNGFile(currentRoom); dungeon = null; ETGModConsole.Log("Succesfully saved current room layout to PNG.", false); } catch (Exception ex) { ETGModConsole.Log("Failed to save room layout!", false); ETGModConsole.Log(" " + ex.Message, false); Debug.LogException(ex); } }
public static void Init() { ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "Explosions are the spice of life! ...and death."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "Name's Boomhildr, demolitions expert, self taught, at yer service."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "My legs? Got taken clean off by a dynamite explosion! It's what made me want to go into pyrotechnics!"); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "My arm? ...it was bitten off by a gator, why do you ask."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "My eye? It was shot out. By a bomb. With a gun."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "What am I here for?... none of your business."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "There was a little claymore running around here a while ago, screaming something about 'Booms'. Pretty cool guy."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "Some weirdo keeps coming by and calling me an 'Angel of Death'. What's up with that?"); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "I've got all the boom you could ask for. Boom comin' out the ears."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "Me and Cursula knew each other in college... before she got into mumbo jumbo."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_GENERIC_TALK", "My mama always used to say that frag grenades are the fireworks of explosive warfare."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_STOPPER_TALK", "Not now, got powder to mix, fuses to braid, you know the deal."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_STOPPER_TALK", "I'm busy riggin' up for a big blast."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_STOPPER_TALK", "Listen pal, I've only got so much patience for blabbermouths."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_PURCHASE_TALK", "Thanks for the cash."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_PURCHASE_TALK", "Have fun blowing &%*! up."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_PURCHASE_TALK", "Send 'em to kingdom come for me!"); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_PURCHASE_TALK", "Boom-boom-boom-boom, amirite?"); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_NOSALE_TALK", "Sorry mate, nothin' in this world is free."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_NOSALE_TALK", "Good explosives aren't cheap."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_NOSALE_TALK", "I'm not running a charity here."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_INTRO_TALK", "You're back. And with all your limbs too."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_INTRO_TALK", "Blow up anyone special lately?"); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_INTRO_TALK", "See any good blasts out there in the Gungeon?"); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_INTRO_TALK", "Want a bomb? I've got bombs. Let's talk."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_INTRO_TALK", "Bombs? Bombs? Bombs? You want it? It's yours, my friend- as long as you have enough cash."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_ATTACKED_TALK", "Watch it buster."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_ATTACKED_TALK", "No need to be jealous."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_ATTACKED_TALK", "You're gonna blow your chances."); ETGMod.Databases.Strings.Core.AddComplex("#BOOMHILDR_ATTACKED_TALK", "I can bring this whole chamber down on our heads, and you're attacking me?"); List <int> LootTable = new List <int>() { 108, //Bomb 109, //Ice Bomb 460, //Chaff Grenade 66, //Proximity Mine 308, //Cluster Mine 136, //C4 252, //Air Strike 443, //Big Boy 567, //Roll Bomb 234, //iBomb Companion App 438, //Explosive Decoy 403, //Melted Rock 304, //Explosive Rounds 312, //Blast Helmet 398, //Table Tech Rocket 440, //Ruby Bracelet 601, //Big Shotgun 4, //Sticky Crossbow 542, //Strafe Gun 96, //M16 6, //Zorgun 81, //Deck4rd 274, //Dark Marker 39, //RPG 19, //Grenade Launcher 92, //Stinger 563, //The Exotic 129, //Com4nd0 372, //RC Rocket 16, //Yari Launcher 332, //Lil Bomber 180, //Grasschopper 593, //Void Core Cannon 362, //Bullet Bore 186, //Machine Fist 28, //Mailbox 339, //Mahoguny 478, //Banana NitroBullets.NitroBulletsID, AntimatterBullets.AntimatterBulletsID, BombardierShells.BombardierShellsID, Blombk.BlombkID, Nitroglycylinder.NitroglycylinderID, GunpowderPheromones.GunpowderPheromonesID, RocketMan.RocketManID, ChemGrenade.ChemGrenadeID, InfantryGrenade.InfantryGrenadeID, BomberJacket.ID, Bombinomicon.ID, MagicMissile.ID, GrenadeShotgun.GrenadeShotgunID, Felissile.ID, TheThinLine.ID, RocketPistol.ID, Demolitionist.DemolitionistID, HandMortar.ID, FireLance.FireLanceID, DynamiteLauncher.DynamiteLauncherID, BottleRocket.ID, NNBazooka.BazookaID, BoomBeam.ID, Pillarocket.ID, }; BoomhildrLootTable = LootTableTools.CreateLootTable(); foreach (int i in LootTable) { BoomhildrLootTable.AddItemToPool(i); } GameObject boomhildrObj = ItsDaFuckinShopApi.SetUpShop( "Boomhildr", "omitb", new List <string>() { "NevernamedsItems/Resources/NPCSprites/Boomhildr/boomhildr_idle_001", "NevernamedsItems/Resources/NPCSprites/Boomhildr/boomhildr_idle_002", "NevernamedsItems/Resources/NPCSprites/Boomhildr/boomhildr_idle_003", "NevernamedsItems/Resources/NPCSprites/Boomhildr/boomhildr_idle_004", "NevernamedsItems/Resources/NPCSprites/Boomhildr/boomhildr_idle_005", }, 7, new List <string>() { "NevernamedsItems/Resources/NPCSprites/Boomhildr/boomhildr_talk_001", "NevernamedsItems/Resources/NPCSprites/Boomhildr/boomhildr_talk_002", }, 3, BoomhildrLootTable, CustomShopItemController.ShopCurrencyType.COINS, "#BOOMHILDR_GENERIC_TALK", "#BOOMHILDR_STOPPER_TALK", "#BOOMHILDR_PURCHASE_TALK", "#BOOMHILDR_NOSALE_TALK", "#BOOMHILDR_INTRO_TALK", "#BOOMHILDR_ATTACKED_TALK", new Vector3(0.5f, 4, 0), ItsDaFuckinShopApi.defaultItemPositions, 1f, false, null, null, null, null, null, null, null, null, true, false, null, true, "NevernamedsItems/Resources/NPCSprites/Boomhildr/boomhildr_mapicon", true, 0.1f ); PrototypeDungeonRoom Mod_Shop_Room = RoomFactory.BuildFromResource("NevernamedsItems/Resources/EmbeddedRooms/BoomhildrRoom.room").room; ItsDaFuckinShopApi.RegisterShopRoom(boomhildrObj, Mod_Shop_Room, new UnityEngine.Vector2(9f, 11)); }
public static void Get(string[] notused) { //Debug.Log("Platforms!"); //MovingPlatform[] movingplatforms = UnityEngine.GameObject.FindObjectsOfType<MovingPlatform>(); //foreach(MovingPlatform platform in movingplatforms) //{ // string name = platform.name; // Debug.Log("platform.name: " + name); //} //DungeonPlaceableBehaviour[] mylist = UnityEngine.GameObject.FindObjectsOfType<DungeonPlaceableBehaviour>(); //foreach (DungeonPlaceableBehaviour d in mylist) //{ // Debug.Log("DUNGEON " + d.name); // ETGModConsole.Log("Dungeon " + d.name); // if (d is DraGunRoomPlaceable) // { // GameObject g = d.gameObject; // ETGModConsole.Log("GameObject " + g.name); // } //} PrototypeDungeonRoom[] prototypedungeonrooms = UnityEngine.GameObject.FindObjectsOfType <PrototypeDungeonRoom>(); Dungeon d = GameManager.Instance.Dungeon; int count = d.data.rooms.Count; ETGModConsole.Log("There are rooms:" + count); ETGModConsole.Log("There are prototyperooms: " + prototypedungeonrooms.Length.ToString()); for (int i = 0; i < prototypedungeonrooms.Length; i++) { PrototypeDungeonRoom room = prototypedungeonrooms[i]; if (room.name == "DraGunRoom01") { ETGModConsole.Log("Found DraGunRoom01"); } } //foreach (RoomHandler roomHandler in d.data.rooms) for (int i = 0; i < count; i++) { RoomHandler roomHandler = d.data.rooms[i]; string roomname = roomHandler.GetRoomName(); ETGModConsole.Log("roomname: " + roomname); //if (roomname == "DraGunRoom01") //{ // ETGModConsole.Log("Found DraGunRoom01"); // foreach (Component component in roomHandler.GameObject.GetComponents(typeof(Component))) // { // } // //DraGunRoomPlaceable emberDoer = roomHandler.GetComponentsAbsoluteInRoom<DraGunRoomPlaceable>()[0]; // //if (emberDoer) // //{ // // ETGModConsole.Log("Found DraGunRoomPlaceable"); // //} // //else // //{ // // ETGModConsole.Log("No DraGunRoomPlaceable"); // //} //} //ETGModConsole.Log(roomname); //Debug.Log(roomname); } }
///maybe add some value proofing here (name != null, collider != IntVector2.Zero) public GameObject Build() { try { //Get texture and create sprite Texture2D tex = ResourceExtractor.GetTextureFromResource(spritePath); var shrine = SpecialItemPack.ItemAPI.SpriteBuilder.SpriteFromResource(spritePath, null, false); //Add (hopefully) unique ID to shrine for tracking string ID = $"{modID}:{name}".ToLower().Replace(" ", "_"); shrine.name = ID; //Position sprite var sprite = shrine.GetComponent <tk2dSprite>(); sprite.IsPerpendicular = true; sprite.PlaceAtPositionByAnchor(offset, tk2dBaseSprite.Anchor.LowerCenter); //Add speech bubble origin var talkPoint = new GameObject("talkpoint").transform; talkPoint.position = shrine.transform.position + talkPointOffset; talkPoint.SetParent(shrine.transform); //Set up collider if (!usesCustomColliderOffsetAndSize) { IntVector2 spriteDimensions = new IntVector2(tex.width, tex.height); colliderOffset = new IntVector2(0, 0); colliderSize = new IntVector2(spriteDimensions.x, spriteDimensions.y / 2); } var body = ItemAPI.SpriteBuilder.SetUpSpeculativeRigidbody(sprite, colliderOffset, colliderSize); var data = shrine.AddComponent <CustomShrineController>(); data.ID = ID; data.roomStyles = roomStyles; data.isBreachShrine = true; data.offset = offset; data.pixelColliders = body.specRigidbody.PixelColliders; data.factory = this; data.OnAccept = OnAccept; data.OnDecline = OnDecline; data.CanUse = CanUse; IPlayerInteractable interactable; //Register as interactable if (interactableComponent != null) { interactable = shrine.AddComponent(interactableComponent) as IPlayerInteractable; } else { var simpInt = shrine.AddComponent <SimpleInteractable>(); simpInt.isToggle = this.isToggle; simpInt.OnAccept = this.OnAccept; simpInt.OnDecline = this.OnDecline; simpInt.CanUse = CanUse; simpInt.text = this.text; simpInt.acceptText = this.acceptText; simpInt.declineText = this.declineText; simpInt.talkPoint = talkPoint; interactable = simpInt as IPlayerInteractable; } var prefab = FakePrefab.Clone(shrine); prefab.GetComponent <CustomShrineController>().Copy(data); prefab.name = ID; if (isBreachShrine) { if (!RoomHandler.unassignedInteractableObjects.Contains(interactable)) { RoomHandler.unassignedInteractableObjects.Add(interactable); } } else { if (!room) { room = RoomFactory.CreateEmptyRoom(); } RegisterShrineRoom(prefab, room, ID, offset); } builtShrines.Add(ID, prefab); Tools.Print("Added shrine: " + ID); return(shrine); } catch (Exception e) { Tools.PrintException(e); return(null); } }
public IEnumerator CorruptionRoomTime(PlayerController user) { RoomHandler currentRoom = user.CurrentRoom; Dungeon dungeon = GameManager.Instance.Dungeon; m_CachedScreenCapture = PortalTextureRender(); yield return(null); while (m_ScreenCapInProgress) { yield return(null); } if (currentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear)) { StunEnemiesForTeleport(currentRoom, 1f); } TogglePlayerInput(user, true); m_cachedRoomPosition = user.transform.position; AkSoundEngine.PostEvent("Play_EX_CorruptionRoomTransition_01", gameObject); ExpandShaders.Instance.GlitchScreenForDuration(1, 1.4f, 0.1f); GameObject TempFXObject = new GameObject("EXScreenFXTemp") { }; TempFXObject.transform.SetParent(dungeon.gameObject.transform); TempFXObject.SetActive(false); yield return(null); ExpandGlitchScreenFXController fxController = TempFXObject.AddComponent <ExpandGlitchScreenFXController>(); fxController.shaderType = ExpandGlitchScreenFXController.ShaderType.Glitch; fxController.GlitchAmount = 0; yield return(null); TempFXObject.SetActive(true); while (fxController.GlitchAmount < 1) { fxController.GlitchAmount += (BraveTime.DeltaTime / 0.5f); yield return(null); } bool m_CopyCurrentRoom = false; if (!string.IsNullOrEmpty(currentRoom.GetRoomName())) { m_CopyCurrentRoom = (UnityEngine.Random.value < 0.05f); } PrototypeDungeonRoom SelectedPrototypeDungeonRoom = null; bool IsExitElevatorRoom = false; if (m_CopyCurrentRoom) { try { SelectedPrototypeDungeonRoom = RoomBuilder.GenerateRoomPrefabFromTexture2D(RoomDebug.DumpRoomAreaToTexture2D(currentRoom)); } catch (Exception ex) { if (ExpandSettings.debugMode) { ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while building room!", true); Debug.LogException(ex); } AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject); TogglePlayerInput(user, false); ClearCooldowns(); yield break; } } else { float RoomSelectionSeed = UnityEngine.Random.value; bool GoingToSecretBoss = false; if (RoomSelectionSeed <= 0.01f) { GoingToSecretBoss = true; } if (!GoingToSecretBoss | ExpandSettings.HasSpawnedSecretBoss) { if (RoomSelectionSeed <= 0.05f && GameManager.Instance.CurrentFloor != 6 && GameManager.Instance.CurrentFloor != 5 && !ExpandSettings.phobosElevatorHasBeenUsed) { SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(ExitElevatorRoomList); IsExitElevatorRoom = true; } else if (RoomSelectionSeed <= 0.25f) { SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(RewardRoomList); } else if (RoomSelectionSeed <= 0.5f) { List <PrototypeDungeonRoom> m_SpecialRooms = new List <PrototypeDungeonRoom>(); m_SpecialRooms.Add(BraveUtility.RandomElement(NPCRoomList)); m_SpecialRooms.Add(BraveUtility.RandomElement(SecretRoomList)); m_SpecialRooms.Add(BraveUtility.RandomElement(ShrineRoomList)); SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(m_SpecialRooms); } else { SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(MainRoomlist); } } else { ExpandSettings.HasSpawnedSecretBoss = true; RoomHandler[] SecretBossRoomCluster = null; try { SecretBossRoomCluster = GenerateCorruptedBossRoomCluster(); } catch (Exception ex) { ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while building room!", true); if (ExpandSettings.debugMode) { Debug.LogException(ex); } AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject); TogglePlayerInput(user, false); ClearCooldowns(); yield break; } yield return(null); if (SecretBossRoomCluster == null) { AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject); TogglePlayerInput(user, false); ClearCooldowns(); yield break; } ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, SecretBossRoomCluster[0], null, true, true); ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, SecretBossRoomCluster[1], null, true, true); TeleportToRoom(user, SecretBossRoomCluster[0]); while (m_IsTeleporting) { yield return(null); } GameObject m_PortalWarpObjectBossCluster = Instantiate(ExpandPrefabs.EX_GlitchPortal, (user.gameObject.transform.position + new Vector3(0.75f, 0)), Quaternion.identity); ExpandGlitchPortalController m_PortalControllerBossCluster = m_PortalWarpObjectBossCluster.GetComponent <ExpandGlitchPortalController>(); if (m_CachedScreenCapture) { m_PortalControllerBossCluster.renderer.material.SetTexture("_PortalTex", m_CachedScreenCapture); } m_PortalControllerBossCluster.CachedPosition = m_cachedRoomPosition; m_PortalControllerBossCluster.ParentRoom = SecretBossRoomCluster[0]; SecretBossRoomCluster[0].RegisterInteractable(m_PortalControllerBossCluster); while (fxController.GlitchAmount > 0) { fxController.GlitchAmount -= (BraveTime.DeltaTime / 0.5f); yield return(null); } TogglePlayerInput(user, false); m_PortalControllerBossCluster.Configured = true; Destroy(TempFXObject); m_InUse = false; yield break; } } if (SelectedPrototypeDungeonRoom == null) { AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject); TogglePlayerInput(user, false); ClearCooldowns(); yield break; } if (m_CopyCurrentRoom) { SelectedPrototypeDungeonRoom.overrideRoomVisualType = currentRoom.RoomVisualSubtype; } RoomHandler GlitchRoom = ExpandUtility.AddCustomRuntimeRoom(SelectedPrototypeDungeonRoom, IsExitElevatorRoom, false, allowProceduralLightFixtures: (true || m_CopyCurrentRoom)); if (GlitchRoom == null) { AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject); TogglePlayerInput(user, false); ClearCooldowns(); yield break; } if (!string.IsNullOrEmpty(GlitchRoom.GetRoomName())) { GlitchRoom.area.PrototypeRoomName = ("Corrupted " + GlitchRoom.GetRoomName()); } else { GlitchRoom.area.PrototypeRoomName = ("Corrupted Room"); } if (m_CopyCurrentRoom) { if (ExpandSettings.EnableGlitchFloorScreenShader && !dungeon.IsGlitchDungeon) { GameObject GlitchShaderObject = Instantiate(ExpandPrefabs.EXGlitchFloorScreenFX, GlitchRoom.area.UnitCenter, Quaternion.identity); ExpandGlitchScreenFXController FXController = GlitchShaderObject.GetComponent <ExpandGlitchScreenFXController>(); FXController.isRoomSpecific = true; FXController.ParentRoom = GlitchRoom; FXController.UseCorruptionAmbience = m_CopyCurrentRoom; GlitchShaderObject.transform.SetParent(dungeon.gameObject.transform); } GameObject[] Objects = FindObjectsOfType <GameObject>(); try { foreach (GameObject Object in Objects) { if (Object && Object.transform.parent == currentRoom.hierarchyParent && IsValidObject(Object)) { Vector3 OrigPosition = (Object.transform.position - currentRoom.area.basePosition.ToVector3()); Vector3 NewPosition = (OrigPosition + GlitchRoom.area.basePosition.ToVector3()); GameObject newObject = Instantiate(Object, NewPosition, Quaternion.identity); newObject.transform.SetParent(GlitchRoom.hierarchyParent); if (newObject.GetComponent <BaseShopController>()) { Destroy(newObject.GetComponent <BaseShopController>()); } if (newObject.GetComponent <PathingTrapController>()) { Destroy(newObject.GetComponent <PathingTrapController>()); } if (newObject.GetComponent <IPlaceConfigurable>() != null) { newObject.GetComponent <IPlaceConfigurable>().ConfigureOnPlacement(GlitchRoom); } if (newObject.GetComponent <TalkDoerLite>()) { newObject.GetComponent <TalkDoerLite>().SpeaksGleepGlorpenese = true; } if (newObject.GetComponent <IPlayerInteractable>() != null) { GlitchRoom.RegisterInteractable(newObject.GetComponent <IPlayerInteractable>()); } if (newObject.GetComponent <FlippableCover>()) { ExpandKickableObject kickableObject = newObject.AddComponent <ExpandKickableObject>(); newObject.GetComponent <ExpandKickableObject>().ConfigureOnPlacement(GlitchRoom); GlitchRoom.RegisterInteractable(kickableObject); } if (newObject && UnityEngine.Random.value <= 0.4f && !newObject.GetComponent <AIActor>() && !newObject.GetComponent <Chest>()) { if (!string.IsNullOrEmpty(newObject.name) && !newObject.name.ToLower().StartsWith("glitchtile") && !newObject.name.ToLower().StartsWith("ex secret door") && !newObject.name.ToLower().StartsWith("lock") && !newObject.name.ToLower().StartsWith("chest")) { float RandomIntervalFloat = UnityEngine.Random.Range(0.02f, 0.04f); float RandomDispFloat = UnityEngine.Random.Range(0.06f, 0.08f); float RandomDispIntensityFloat = UnityEngine.Random.Range(0.07f, 0.1f); float RandomColorProbFloat = UnityEngine.Random.Range(0.035f, 0.1f); float RandomColorIntensityFloat = UnityEngine.Random.Range(0.05f, 0.1f); ExpandShaders.Instance.BecomeGlitched(newObject, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); } } } } } catch (Exception ex) { if (ExpandSettings.debugMode) { ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while duplicating objects for new room!", true); Debug.LogException(ex); } } IntVector2 ChestPosition = ExpandObjectDatabase.GetRandomAvailableCellForChest(dungeon, GlitchRoom, new List <IntVector2>()); if (ChestPosition != IntVector2.Zero) { GameObject newChest = Instantiate(ExpandPrefabs.SurpriseChestObject, ChestPosition.ToVector3(), Quaternion.identity); ExpandFakeChest fakeChest = newChest.GetComponent <ExpandFakeChest>(); fakeChest.ConfigureOnPlacement(GlitchRoom); GlitchRoom.RegisterInteractable(fakeChest); } } if (GlitchRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.SECRET && GlitchRoom.IsSecretRoom) { GlitchRoom.secretRoomManager.OpenDoor(); } if (m_CopyCurrentRoom) { ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, GlitchRoom, null, false, true, true); } else { ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, GlitchRoom, null, true, true, true); } if (IsExitElevatorRoom) { ElevatorDepartureController DepartureElevator = null; if (FindObjectsOfType <ElevatorDepartureController>() != null) { foreach (ElevatorDepartureController elevator in FindObjectsOfType <ElevatorDepartureController>()) { if (elevator.gameObject.transform.parent == GlitchRoom.hierarchyParent) { DepartureElevator = elevator; break; } } } if (DepartureElevator) { ExpandElevatorDepartureManager exElevator = DepartureElevator.gameObject.AddComponent <ExpandElevatorDepartureManager>(); exElevator.OverrideTargetFloor = GlobalDungeonData.ValidTilesets.PHOBOSGEON; } TeleportToRoom(user, GlitchRoom, false, m_CopyCurrentRoom, new Vector2(4, 2)); } else { TeleportToRoom(user, GlitchRoom, false, m_CopyCurrentRoom); } yield return(null); while (m_IsTeleporting) { yield return(null); } if (user.transform.position.GetAbsoluteRoom() != null) { if (user.CurrentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear)) { user.CurrentRoom.CompletelyPreventLeaving = true; } } if (GameManager.Instance.CurrentFloor == 1) { if (dungeon.data.Entrance != null) { dungeon.data.Entrance.AddProceduralTeleporterToRoom(); } } GameObject m_PortalWarpObject = Instantiate(ExpandPrefabs.EX_GlitchPortal, (user.gameObject.transform.position + new Vector3(0.75f, 0)), Quaternion.identity); ExpandGlitchPortalController m_PortalController = m_PortalWarpObject.GetComponent <ExpandGlitchPortalController>(); if (m_CachedScreenCapture) { m_PortalController.renderer.material.SetTexture("_PortalTex", m_CachedScreenCapture); } m_PortalController.CachedPosition = m_cachedRoomPosition; m_PortalController.ParentRoom = GlitchRoom; GlitchRoom.RegisterInteractable(m_PortalController); while (fxController.GlitchAmount > 0) { fxController.GlitchAmount -= (BraveTime.DeltaTime / 0.5f); yield return(null); } TogglePlayerInput(user, false); m_PortalController.Configured = true; Destroy(TempFXObject); m_InUse = false; yield break; }
public static void AddPlaceableToRoom(PrototypeDungeonRoom room, Vector2 location, string assetPath) { try { //ETGModConsole.Log("Checking: " + assetPath); if (overrideRoomPlaceables.ContainsKey(assetPath)) { //ETGModConsole.Log("FOUND: " + assetPath); if (overrideRoomPlaceables[assetPath] == null || overrideRoomPlaceables[assetPath].gameObject == null) { ETGModConsole.Log("ERROR, THINGUM IS NULL IN DICTIONARY"); } DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0]; room.placedObjectPositions.Add(location); var placeableContents = ScriptableObject.CreateInstance <DungeonPlaceable>(); placeableContents.width = 2; placeableContents.height = 2; placeableContents.respectsEncounterableDifferentiator = true; placeableContents.variantTiers = new List <DungeonPlaceableVariant>() { new DungeonPlaceableVariant() { percentChance = 1, nonDatabasePlaceable = overrideRoomPlaceables[assetPath], prerequisites = emptyReqs, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0] } }; room.placedObjects.Add(new PrototypePlacedObjectData() { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = emptyReqs, linkedTriggerAreaIDs = new List <int>(), placeableContents = placeableContents }); return; } GameObject asset = GetGameObjectFromBundles(assetPath); if (asset) { DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0]; room.placedObjectPositions.Add(location); var placeableContents = ScriptableObject.CreateInstance <DungeonPlaceable>(); placeableContents.width = 2; placeableContents.height = 2; placeableContents.respectsEncounterableDifferentiator = true; placeableContents.variantTiers = new List <DungeonPlaceableVariant>() { new DungeonPlaceableVariant() { percentChance = 1, nonDatabasePlaceable = asset, prerequisites = emptyReqs, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0] } }; room.placedObjects.Add(new PrototypePlacedObjectData() { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = emptyReqs, linkedTriggerAreaIDs = new List <int>(), placeableContents = placeableContents }); //Tools.Print($"Added {asset.name} to room."); return; } DungeonPlaceable placeable = GetPlaceableFromBundles(assetPath); if (placeable) { DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0]; room.placedObjectPositions.Add(location); room.placedObjects.Add(new PrototypePlacedObjectData() { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = emptyReqs, linkedTriggerAreaIDs = new List <int>(), placeableContents = placeable }); return; } Tools.PrintError($"Unable to find asset in asset bundles: {assetPath}"); } catch (Exception e) { Tools.PrintException(e); } }
public static void LogRoomToPNGFile(PrototypeDungeonRoom room) { int width = room.Width; int height = room.Height; Texture2D m_NewImage = new Texture2D(width, height, TextureFormat.RGBA32, false); if (!string.IsNullOrEmpty(room.name)) { m_NewImage.name = room.name; } Color WhitePixel = new Color32(255, 255, 255, 255); // Wall Cell Color PinkPixel = new Color32(255, 0, 255, 255); // Diagonal Wall Cell (North East) Color YellowPixel = new Color32(255, 255, 0, 255); // Diagonal Wall Cell (North West) Color HalfPinkPixel = new Color32(127, 0, 127, 255); // Diagonal Wall Cell (South East) Color HalfYellowPixel = new Color32(127, 127, 0, 255); // Diagonal Wall Cell (South West) Color BluePixel = new Color32(0, 0, 255, 255); // Floor Cell Color BlueHalfGreenPixel = new Color32(0, 127, 255, 255); // Floor Cell (Ice Override) Color HalfBluePixel = new Color32(0, 0, 127, 255); // Floor Cell (Water Override) Color HalfRedPixel = new Color32(0, 0, 127, 255); // Floor Cell (Carpet Override) Color GreenHalfRBPixel = new Color32(127, 255, 127, 255); // Floor Cell (Grass Override) Color HalfWhitePixel = new Color32(127, 127, 127, 255); // Floor Cell (Bone Override) Color OrangePixel = new Color32(255, 127, 0, 255); // Floor Cell (Flesh Override) Color RedHalfGBPixel = new Color32(255, 127, 127, 255); // Floor Cell (ThickGoop Override) Color GreenPixel = new Color32(0, 255, 0, 255); // Damage Floor Cell Color RedPixel = new Color32(255, 0, 0, 255); // Pit Cell Color BlackPixel = new Color32(0, 0, 0, 255); // NULL Cell for (int X = 0; X < width; X++) { for (int Y = 0; Y < height; Y++) { CellType? cellData = room.GetCellDataAtPoint(X, Y).state; bool DamageCell = false; DiagonalWallType diagonalWallType = DiagonalWallType.NONE; if (room.GetCellDataAtPoint(X, Y) != null && cellData.HasValue) { DamageCell = room.GetCellDataAtPoint(X, Y).doesDamage; diagonalWallType = room.GetCellDataAtPoint(X, Y).diagonalWallType; } if (room.GetCellDataAtPoint(X, Y) == null | !cellData.HasValue) { m_NewImage.SetPixel(X, Y, BlackPixel); } else if (cellData.Value == CellType.FLOOR) { if (DamageCell) { m_NewImage.SetPixel(X, Y, GreenPixel); } else if (room.GetCellDataAtPoint(X, Y).appearance != null) { CellVisualData.CellFloorType overrideFloorType = room.GetCellDataAtPoint(X, Y).appearance.OverrideFloorType; if (overrideFloorType == CellVisualData.CellFloorType.Stone) { m_NewImage.SetPixel(X, Y, BluePixel); } else if (overrideFloorType == CellVisualData.CellFloorType.Ice) { m_NewImage.SetPixel(X, Y, BlueHalfGreenPixel); } else if (overrideFloorType == CellVisualData.CellFloorType.Water) { m_NewImage.SetPixel(X, Y, HalfBluePixel); } else if (overrideFloorType == CellVisualData.CellFloorType.Carpet) { m_NewImage.SetPixel(X, Y, HalfRedPixel); } else if (overrideFloorType == CellVisualData.CellFloorType.Grass) { m_NewImage.SetPixel(X, Y, GreenHalfRBPixel); } else if (overrideFloorType == CellVisualData.CellFloorType.Bone) { m_NewImage.SetPixel(X, Y, HalfWhitePixel); } else if (overrideFloorType == CellVisualData.CellFloorType.Flesh) { m_NewImage.SetPixel(X, Y, OrangePixel); } else if (overrideFloorType == CellVisualData.CellFloorType.ThickGoop) { m_NewImage.SetPixel(X, Y, RedHalfGBPixel); } else { m_NewImage.SetPixel(X, Y, BluePixel); } } else { m_NewImage.SetPixel(X, Y, BluePixel); } } else if (cellData.Value == CellType.WALL) { if (diagonalWallType == DiagonalWallType.NORTHEAST) { m_NewImage.SetPixel(X, Y, PinkPixel); } else if (diagonalWallType == DiagonalWallType.NORTHWEST) { m_NewImage.SetPixel(X, Y, YellowPixel); } else if (diagonalWallType == DiagonalWallType.SOUTHEAST) { m_NewImage.SetPixel(X, Y, HalfPinkPixel); } else if (diagonalWallType == DiagonalWallType.SOUTHWEST) { m_NewImage.SetPixel(X, Y, HalfYellowPixel); } else { m_NewImage.SetPixel(X, Y, WhitePixel); } } else if (cellData.Value == CellType.PIT) { m_NewImage.SetPixel(X, Y, RedPixel); } } } m_NewImage.Apply(); string basePath = "DumpedRoomLayouts/"; string fileName = (basePath + m_NewImage.name); if (string.IsNullOrEmpty(m_NewImage.name)) { fileName += ("RoomLayout_" + Guid.NewGuid().ToString()); } fileName += "_Layout"; string path = Path.Combine(ETGMod.ResourcesDirectory, fileName.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar) + ".png"); if (!File.Exists(path)) { Directory.GetParent(path).Create(); } File.WriteAllBytes(path, ImageConversion.EncodeToPNG(m_NewImage)); }
public void TeleportToGlitchRoom() { try { PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; Dungeon dungeon = GameManager.Instance.Dungeon; ChaosRoomRandomizer roomRandomizer = new ChaosRoomRandomizer(); int SelectedRoomIndex = UnityEngine.Random.Range(0, roomRandomizer.MasterRoomArray.Length); int SelectedCombatRoomIndex = UnityEngine.Random.Range(0, ChaosPrefabs.CustomRoomTable.includedRooms.elements.Count); if (BraveUtility.RandomBool()) { SelectedPrototypeDungeonRoom = Instantiate(roomRandomizer.MasterRoomArray[SelectedRoomIndex]); } else { SelectedPrototypeDungeonRoom = Instantiate(ChaosPrefabs.CustomRoomTable.includedRooms.elements[SelectedCombatRoomIndex].room); } Destroy(roomRandomizer); // roomRandomizer = null; if (SelectedPrototypeDungeonRoom == null) { Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); return; } if (SelectedPrototypeDungeonRoom.category == PrototypeDungeonRoom.RoomCategory.SECRET) { SelectedPrototypeDungeonRoom.category = PrototypeDungeonRoom.RoomCategory.NORMAL; } SelectedPrototypeDungeonRoom.name = ("Glitched " + SelectedPrototypeDungeonRoom.name); GlitchRoom = ChaosUtility.Instance.AddCustomRuntimeRoom(SelectedPrototypeDungeonRoom); // Spawn Rainbow chest. This room doesn't spawn NPC it seems.(unless player hasn't unlocked it yet? Not likely. Most would have unlocked this one by now) if (GlitchRoom.GetRoomName().ToLower().EndsWith("earlymetashopcell")) { IntVector2 SpecialChestLocation = new IntVector2(10, 14); WeightedGameObject wChestObject = new WeightedGameObject(); Chest RainbowChest = GameManager.Instance.RewardManager.Rainbow_Chest; wChestObject.rawGameObject = RainbowChest.gameObject; WeightedGameObjectCollection wChestObjectCollection = new WeightedGameObjectCollection(); wChestObjectCollection.Add(wChestObject); Chest PlacableChest = GlitchRoom.SpawnRoomRewardChest(wChestObjectCollection, (SpecialChestLocation + GlitchRoom.area.basePosition)); } primaryPlayer.EscapeRoom(PlayerController.EscapeSealedRoomStyle.TELEPORTER, true, GlitchRoom); primaryPlayer.WarpFollowersToPlayer(); Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER) { GameManager.Instance.GetOtherPlayer(secondaryPlayer).ReuniteWithOtherPlayer(primaryPlayer, false); } } catch (Exception ex) { if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] Error! Exception occured while attempting to generate glitch room!", false); ETGModConsole.Log(ex.Message, false); ETGModConsole.Log(ex.Source, false); ETGModConsole.Log(ex.StackTrace, false); ETGModConsole.Log(ex.TargetSite.ToString(), false); Debug.LogException(ex); } Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); return; } return; }
public static void ApplyRoomData(PrototypeDungeonRoom room, RoomData roomData, bool setRoomCategory, bool autoAssignToFloor, bool assignDecorationProperties, float?Weight) { // Tools.Print("Building Exits..."); if (roomData.exitPositions != null) { for (int i = 0; i < roomData.exitPositions.Length; i++) { DungeonData.Direction dir = (DungeonData.Direction)Enum.Parse(typeof(DungeonData.Direction), roomData.exitDirections[i].ToUpper()); AddExit(room, roomData.exitPositions[i], dir); } } else { AddExit(room, new Vector2(room.Width / 2, room.Height), DungeonData.Direction.NORTH); AddExit(room, new Vector2(room.Width / 2, 0), DungeonData.Direction.SOUTH); AddExit(room, new Vector2(room.Width, room.Height / 2), DungeonData.Direction.EAST); AddExit(room, new Vector2(0, room.Height / 2), DungeonData.Direction.WEST); } // Tools.Print("Adding Enemies..."); if (roomData.enemyPositions != null) { for (int i = 0; i < roomData.enemyPositions.Length; i++) { AddEnemyToRoom(room, roomData.enemyPositions[i], roomData.enemyGUIDs[i], roomData.enemyReinforcementLayers[i], roomData.randomizeEnemyPositions); } } // Tools.Print("Adding Objects..."); if (roomData.placeablePositions != null) { for (int i = 0; i < roomData.placeablePositions.Length; i++) { AddPlaceableToRoom(room, roomData.placeablePositions[i], roomData.placeableGUIDs[i]); } } if (setRoomCategory | autoAssignToFloor) { // Set categories if (!string.IsNullOrEmpty(roomData.category)) { room.category = GetRoomCategory(roomData.category); } if (!string.IsNullOrEmpty(roomData.normalSubCategory)) { room.subCategoryNormal = GetRoomNormalSubCategory(roomData.normalSubCategory); } if (!string.IsNullOrEmpty(roomData.bossSubCategory)) { room.subCategoryBoss = GetRoomBossSubCategory(roomData.bossSubCategory); } if (!string.IsNullOrEmpty(roomData.specialSubCategory)) { room.subCategorySpecial = GetRoomSpecialSubCategory(roomData.specialSubCategory); } } if (autoAssignToFloor && roomData.floors != null) { if (!Weight.HasValue) { if (room.category == PrototypeDungeonRoom.RoomCategory.SECRET) { Weight = 15; // Normal secret rooms have weight of 15. } else { Weight = 1; } } if (room.category == PrototypeDungeonRoom.RoomCategory.SECRET) { // Secret rooms are generally shared across all floors via a specific room table. // Room Editor doesn't currently set this for secret rooms room.OverrideMusicState = DungeonFloorMusicController.DungeonMusicState.CALM; CakeMod.ModPrefabs.SecretRoomTable.includedRooms.elements.Add(CakeMod.ModRoomPrefabs.GenerateWeightedRoom(room, Weight.Value)); } else { foreach (string floor in roomData.floors) { AssignRoomToFloorRoomTable(room, GetTileSet(floor), Weight); } /*ExpandPrefabs.CustomRoomTableSecretGlitchFloor.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value)); * ExpandPrefabs.CustomRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value)); * ExpandPrefabs.CustomRoomTable2.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value));*/ } } if (assignDecorationProperties) { room.allowFloorDecoration = roomData.doFloorDecoration; room.allowWallDecoration = roomData.doWallDecoration; room.usesProceduralLighting = roomData.doLighting; } }
public IEnumerator TentacleTime(PlayerController user) { RoomHandler currentRoom = user.CurrentRoom; if (currentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear)) { StunEnemiesForTeleport(currentRoom, 4); } AkSoundEngine.PostEvent("Play_OBJ_lock_pick_01", gameObject); user.ForceStopDodgeRoll(); user.healthHaver.IsVulnerable = false; yield return(new WaitForSeconds(0.1f)); Dungeon dungeon = GameManager.Instance.Dungeon; float RoomSelectionSeed = UnityEngine.Random.value; bool GoingToSecretBoss = false; if (RoomSelectionSeed <= 0.01f) { GoingToSecretBoss = true; } if (!GoingToSecretBoss | ExpandStats.HasSpawnedSecretBoss) { PrototypeDungeonRoom SelectedPrototypeDungeonRoom = null; if (RoomSelectionSeed <= 0.05f && GameManager.Instance.CurrentFloor != 6) { SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(ExitElevatorRoomList); } else if (RoomSelectionSeed <= 0.25f) { SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(RewardRoomList); } else if (RoomSelectionSeed <= 0.5f) { List <PrototypeDungeonRoom> m_SpecialRooms = new List <PrototypeDungeonRoom>(); m_SpecialRooms.Add(BraveUtility.RandomElement(NPCRoomList)); m_SpecialRooms.Add(BraveUtility.RandomElement(SecretRoomList)); m_SpecialRooms.Add(BraveUtility.RandomElement(ShrineRoomList)); SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(m_SpecialRooms); } else { SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(MainRoomlist); } if (SelectedPrototypeDungeonRoom == null) { AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject); user.healthHaver.IsVulnerable = true; ClearCooldowns(); yield break; } RoomHandler GlitchRoom = ExpandUtility.Instance.AddCustomRuntimeRoom(SelectedPrototypeDungeonRoom); GlitchRoom.area.PrototypeRoomName = ("Corrupted " + GlitchRoom.GetRoomName()); if (GlitchRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.SECRET && GlitchRoom.IsSecretRoom) { GlitchRoom.secretRoomManager.OpenDoor(); } ExpandPlaceCorruptTiles corruptedTilePlacer = new ExpandPlaceCorruptTiles(); corruptedTilePlacer.PlaceCorruptTiles(dungeon, GlitchRoom, null, true, true); // Spawn Rainbow chest. This room doesn't spawn NPC it seems.(unless player hasn't unlocked it yet? Not likely. Most would have unlocked this one by now) /*if (GlitchRoom.GetRoomName().ToLower().EndsWith("earlymetashopcell")) { * IntVector2 SpecialChestLocation = new IntVector2(10, 14); * WeightedGameObject wChestObject = new WeightedGameObject(); * Chest RainbowChest = GameManager.Instance.RewardManager.Rainbow_Chest; * wChestObject.rawGameObject = RainbowChest.gameObject; * WeightedGameObjectCollection wChestObjectCollection = new WeightedGameObjectCollection(); * wChestObjectCollection.Add(wChestObject); * Chest PlacableChest = GlitchRoom.SpawnRoomRewardChest(wChestObjectCollection, (SpecialChestLocation + GlitchRoom.area.basePosition)); * }*/ // user.EscapeRoom(PlayerController.EscapeSealedRoomStyle.TELEPORTER, true, GlitchRoom); TeleportToRoom(user, GlitchRoom); yield return(null); while (m_IsTeleporting) { yield return(null); } if (user.transform.position.GetAbsoluteRoom() != null) { if (user.CurrentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear)) { user.CurrentRoom.CompletelyPreventLeaving = true; } } if (GameManager.Instance.CurrentFloor == 1) { if (dungeon.data.Entrance != null) { dungeon.data.Entrance.AddProceduralTeleporterToRoom(); } } corruptedTilePlacer = null; } else { ExpandStats.HasSpawnedSecretBoss = true; RoomHandler[] SecretBossRoomCluster = GenerateCorruptedBossRoomCluster(); yield return(null); if (SecretBossRoomCluster == null) { AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject); user.healthHaver.IsVulnerable = true; ClearCooldowns(); yield break; } ExpandPlaceCorruptTiles corruptedTilePlacer = new ExpandPlaceCorruptTiles(); corruptedTilePlacer.PlaceCorruptTiles(dungeon, SecretBossRoomCluster[0], null, true, true); corruptedTilePlacer.PlaceCorruptTiles(dungeon, SecretBossRoomCluster[1], null, true, true); TeleportToRoom(user, SecretBossRoomCluster[0]); yield return(null); while (m_IsTeleporting) { yield return(null); } if (GameManager.Instance.CurrentFloor == 1) { if (dungeon.data.Entrance != null) { dungeon.data.Entrance.AddProceduralTeleporterToRoom(); } } corruptedTilePlacer = null; } m_InUse = false; yield break; }
// Generate a DungeonFlowNode with a default configuration public static DungeonFlowNode GenerateDefaultNode(DungeonFlow targetflow, PrototypeDungeonRoom.RoomCategory roomType, PrototypeDungeonRoom overrideRoom = null, GenericRoomTable overrideTable = null, bool oneWayLoopTarget = false, bool isWarpWingNode = false, string nodeGUID = null, DungeonFlowNode.NodePriority priority = DungeonFlowNode.NodePriority.MANDATORY, float percentChance = 1, bool handlesOwnWarping = true) { try { if (string.IsNullOrEmpty(nodeGUID)) { nodeGUID = Guid.NewGuid().ToString(); } DungeonFlowNode m_CachedNode = new DungeonFlowNode(targetflow) { isSubchainStandin = false, nodeType = DungeonFlowNode.ControlNodeType.ROOM, roomCategory = roomType, percentChance = percentChance, priority = priority, overrideExactRoom = overrideRoom, overrideRoomTable = overrideTable, capSubchain = false, subchainIdentifier = string.Empty, limitedCopiesOfSubchain = false, maxCopiesOfSubchain = 1, subchainIdentifiers = new List <string>(0), receivesCaps = false, isWarpWingEntrance = isWarpWingNode, handlesOwnWarping = handlesOwnWarping, forcedDoorType = DungeonFlowNode.ForcedDoorType.NONE, loopForcedDoorType = DungeonFlowNode.ForcedDoorType.NONE, nodeExpands = false, initialChainPrototype = "n", chainRules = new List <ChainRule>(0), minChainLength = 3, maxChainLength = 8, minChildrenToBuild = 1, maxChildrenToBuild = 1, canBuildDuplicateChildren = false, guidAsString = nodeGUID, parentNodeGuid = string.Empty, childNodeGuids = new List <string>(0), loopTargetNodeGuid = string.Empty, loopTargetIsOneWay = oneWayLoopTarget, flow = targetflow }; return(m_CachedNode); } catch (Exception e) { ETGModConsole.Log(e.ToString()); return(null); } }
private RoomHandler[] GenerateCorruptedBossRoomCluster(Action <RoomHandler> postProcessCellData = null, DungeonData.LightGenerationStyle lightStyle = DungeonData.LightGenerationStyle.STANDARD) { Dungeon dungeon = GameManager.Instance.Dungeon; PrototypeDungeonRoom[] RoomArray = new PrototypeDungeonRoom[] { ExpandRoomPrefabs.CreepyGlitchRoom_Entrance, ExpandRoomPrefabs.CreepyGlitchRoom }; IntVector2[] basePositions = new IntVector2[] { IntVector2.Zero, new IntVector2(14, 0) }; GameObject tileMapObject = GameObject.Find("TileMap"); tk2dTileMap m_tilemap = tileMapObject.GetComponent <tk2dTileMap>(); if (m_tilemap == null) { if (ExpandStats.debugMode) { ETGModConsole.Log("ERROR: TileMap object is null! Something seriously went wrong!"); } return(null); } TK2DDungeonAssembler assembler = new TK2DDungeonAssembler(); assembler.Initialize(dungeon.tileIndices); if (RoomArray.Length != basePositions.Length) { Debug.LogError("Attempting to add a malformed room cluster at runtime!"); return(null); } RoomHandler[] RoomClusterArray = new RoomHandler[RoomArray.Length]; int num = 6; int num2 = 3; IntVector2 intVector = new IntVector2(int.MaxValue, int.MaxValue); IntVector2 intVector2 = new IntVector2(int.MinValue, int.MinValue); for (int i = 0; i < RoomArray.Length; i++) { intVector = IntVector2.Min(intVector, basePositions[i]); intVector2 = IntVector2.Max(intVector2, basePositions[i] + new IntVector2(RoomArray[i].Width, RoomArray[i].Height)); } IntVector2 a = intVector2 - intVector; IntVector2 b = IntVector2.Min(IntVector2.Zero, -1 * intVector); a += b; IntVector2 intVector3 = new IntVector2(dungeon.data.Width + num, num); int newWidth = dungeon.data.Width + num * 2 + a.x; int newHeight = Mathf.Max(dungeon.data.Height, a.y + num * 2); CellData[][] array = BraveUtility.MultidimensionalArrayResize(dungeon.data.cellData, dungeon.data.Width, dungeon.data.Height, newWidth, newHeight); dungeon.data.cellData = array; dungeon.data.ClearCachedCellData(); for (int j = 0; j < RoomArray.Length; j++) { IntVector2 d = new IntVector2(RoomArray[j].Width, RoomArray[j].Height); IntVector2 b2 = basePositions[j] + b; IntVector2 intVector4 = intVector3 + b2; CellArea cellArea = new CellArea(intVector4, d, 0); cellArea.prototypeRoom = RoomArray[j]; RoomHandler SelectedRoomInArray = new RoomHandler(cellArea); for (int k = -num; k < d.x + num; k++) { for (int l = -num; l < d.y + num; l++) { IntVector2 p = new IntVector2(k, l) + intVector4; if ((k >= 0 && l >= 0 && k < d.x && l < d.y) || array[p.x][p.y] == null) { CellData cellData = new CellData(p, CellType.WALL); cellData.positionInTilemap = cellData.positionInTilemap - intVector3 + new IntVector2(num2, num2); cellData.parentArea = cellArea; cellData.parentRoom = SelectedRoomInArray; cellData.nearestRoom = SelectedRoomInArray; cellData.distanceFromNearestRoom = 0f; array[p.x][p.y] = cellData; } } } dungeon.data.rooms.Add(SelectedRoomInArray); RoomClusterArray[j] = SelectedRoomInArray; } ConnectClusteredRooms(RoomClusterArray[1], RoomClusterArray[0], RoomArray[1], RoomArray[0], 0, 0, 3, 3); try { for (int n = 0; n < RoomClusterArray.Length; n++) { try { RoomClusterArray[n].WriteRoomData(dungeon.data); } catch (Exception) { if (ExpandStats.debugMode) { ETGModConsole.Log("WARNING: Exception caused during WriteRoomData step on room: " + RoomClusterArray[n].GetRoomName()); } } try { dungeon.data.GenerateLightsForRoom(dungeon.decoSettings, RoomClusterArray[n], GameObject.Find("_Lights").transform, lightStyle); } catch (Exception) { if (ExpandStats.debugMode) { ETGModConsole.Log("WARNING: Exception caused during GeernateLightsForRoom step on room: " + RoomClusterArray[n].GetRoomName()); } } postProcessCellData?.Invoke(RoomClusterArray[n]); if (RoomClusterArray[n].area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.SECRET) { RoomClusterArray[n].BuildSecretRoomCover(); } } GameObject gameObject = (GameObject)Instantiate(BraveResources.Load("RuntimeTileMap", ".prefab")); tk2dTileMap component = gameObject.GetComponent <tk2dTileMap>(); string str = UnityEngine.Random.Range(10000, 99999).ToString(); gameObject.name = "Corrupted_" + "RuntimeTilemap_" + str; component.renderData.name = "Corrupted_" + "RuntimeTilemap_" + str + " Render Data"; component.Editor__SpriteCollection = dungeon.tileIndices.dungeonCollection; TK2DDungeonAssembler.RuntimeResizeTileMap(component, a.x + num2 * 2, a.y + num2 * 2, m_tilemap.partitionSizeX, m_tilemap.partitionSizeY); for (int num3 = 0; num3 < RoomArray.Length; num3++) { IntVector2 intVector5 = new IntVector2(RoomArray[num3].Width, RoomArray[num3].Height); IntVector2 b3 = basePositions[num3] + b; IntVector2 intVector6 = intVector3 + b3; for (int num4 = -num2; num4 < intVector5.x + num2; num4++) { for (int num5 = -num2; num5 < intVector5.y + num2 + 2; num5++) { try { assembler.BuildTileIndicesForCell(dungeon, component, intVector6.x + num4, intVector6.y + num5); } catch (Exception ex) { if (ExpandStats.debugMode) { ETGModConsole.Log("WARNING: Exception caused during BuildTileIndicesForCell step on room: " + RoomArray[num3].name); Debug.Log("WARNING: Exception caused during BuildTileIndicesForCell step on room: " + RoomArray[num3].name); Debug.LogException(ex); } } } } } RenderMeshBuilder.CurrentCellXOffset = intVector3.x - num2; RenderMeshBuilder.CurrentCellYOffset = intVector3.y - num2; component.ForceBuild(); RenderMeshBuilder.CurrentCellXOffset = 0; RenderMeshBuilder.CurrentCellYOffset = 0; component.renderData.transform.position = new Vector3(intVector3.x - num2, intVector3.y - num2, intVector3.y - num2); for (int num6 = 0; num6 < RoomClusterArray.Length; num6++) { RoomClusterArray[num6].OverrideTilemap = component; for (int num7 = 0; num7 < RoomClusterArray[num6].area.dimensions.x; num7++) { for (int num8 = 0; num8 < RoomClusterArray[num6].area.dimensions.y + 2; num8++) { IntVector2 intVector7 = RoomClusterArray[num6].area.basePosition + new IntVector2(num7, num8); if (dungeon.data.CheckInBoundsAndValid(intVector7)) { CellData currentCell = dungeon.data[intVector7]; TK2DInteriorDecorator.PlaceLightDecorationForCell(dungeon, component, currentCell, intVector7); } } } Pathfinder.Instance.InitializeRegion(dungeon.data, RoomClusterArray[num6].area.basePosition + new IntVector2(-3, -3), RoomClusterArray[num6].area.dimensions + new IntVector2(3, 3)); if (!RoomClusterArray[num6].IsSecretRoom) { RoomClusterArray[num6].RevealedOnMap = true; RoomClusterArray[num6].visibility = RoomHandler.VisibilityStatus.VISITED; StartCoroutine(Minimap.Instance.RevealMinimapRoomInternal(RoomClusterArray[num6], true, true, false)); } RoomClusterArray[num6].PostGenerationCleanup(); } if (RoomArray.Length == RoomClusterArray.Length) { for (int i = 0; i < RoomArray.Length; i++) { if (RoomArray[i].usesProceduralDecoration && RoomArray[i].allowFloorDecoration) { TK2DInteriorDecorator decorator = new TK2DInteriorDecorator(assembler); decorator.HandleRoomDecoration(RoomClusterArray[i], dungeon, m_tilemap); } } } } catch (Exception) { } DeadlyDeadlyGoopManager.ReinitializeData(); Minimap.Instance.InitializeMinimap(dungeon.data); return(RoomClusterArray); }
public static void GenerateRoomLayoutFromPNG(PrototypeDungeonRoom room, string filePath, PrototypeRoomPitEntry.PitBorderType PitBorderType = PrototypeRoomPitEntry.PitBorderType.FLAT, CoreDamageTypes DamageCellsType = CoreDamageTypes.None) { Texture2D m_TextureFromResource = ResourceExtractor.GetTextureFromResource(TextureBasePath + filePath); float DamageToPlayersPerTick = 0; float DamageToEnemiesPerTick = 0; float TickFrequency = 0; bool RespectsFlying = true; bool DamageCellsArePoison = false; if (DamageCellsType == CoreDamageTypes.Fire) { DamageToPlayersPerTick = 0.5f; TickFrequency = 1; } else if (DamageCellsType == CoreDamageTypes.Poison) { DamageCellsArePoison = true; DamageToPlayersPerTick = 0.5f; TickFrequency = 1; } if (m_TextureFromResource == null) { ETGModConsole.Log("[ExpandTheGungeon] GenerateRoomFromImage: Error! Requested Texture Resource is Null!"); return; } Color WhitePixel = new Color32(255, 255, 255, 255); // Wall Cell Color PinkPixel = new Color32(255, 0, 255, 255); // Diagonal Wall Cell (North East) Color YellowPixel = new Color32(255, 255, 0, 255); // Diagonal Wall Cell (North West) Color HalfPinkPixel = new Color32(127, 0, 127, 255); // Diagonal Wall Cell (South East) Color HalfYellowPixel = new Color32(127, 127, 0, 255); // Diagonal Wall Cell (South West) Color BluePixel = new Color32(0, 0, 255, 255); // Floor Cell Color BlueHalfGreenPixel = new Color32(0, 127, 255, 255); // Floor Cell (Ice Override) Color HalfBluePixel = new Color32(0, 0, 127, 255); // Floor Cell (Water Override) Color HalfRedPixel = new Color32(0, 0, 127, 255); // Floor Cell (Carpet Override) Color GreenHalfRBPixel = new Color32(127, 255, 127, 255); // Floor Cell (Grass Override) Color HalfWhitePixel = new Color32(127, 127, 127, 255); // Floor Cell (Bone Override) Color OrangePixel = new Color32(255, 127, 0, 255); // Floor Cell (Flesh Override) Color RedHalfGBPixel = new Color32(255, 127, 127, 255); // Floor Cell (ThickGoop Override) Color GreenPixel = new Color32(0, 255, 0, 255); // Damage Floor Cell Color RedPixel = new Color32(255, 0, 0, 255); // Pit Cell int width = room.Width; int height = room.Height; int ArrayLength = (width * height); if (m_TextureFromResource.GetPixels32().Length != ArrayLength) { ETGModConsole.Log("[ExpandTheGungeon] GenerateRoomFromImage: Error! Image resolution doesn't match size of room!"); return; } room.FullCellData = new PrototypeDungeonRoomCellData[ArrayLength]; List <Vector2> m_Pits = new List <Vector2>(); for (int X = 0; X < width; X++) { for (int Y = 0; Y < height; Y++) { int ArrayPosition = (Y * width + X); Color? m_Pixel = m_TextureFromResource.GetPixel(X, Y); CellType cellType = CellType.FLOOR; DiagonalWallType diagonalWallType = DiagonalWallType.NONE; CellVisualData.CellFloorType OverrideFloorType = CellVisualData.CellFloorType.Stone; bool isDamageCell = false; bool cellDamagesPlayer = false; if (m_Pixel.HasValue) { if (m_Pixel.Value == WhitePixel | m_Pixel.Value == PinkPixel | m_Pixel.Value == YellowPixel | m_Pixel.Value == HalfPinkPixel | m_Pixel.Value == HalfYellowPixel) { cellType = CellType.WALL; if (m_Pixel.Value == PinkPixel) { diagonalWallType = DiagonalWallType.NORTHEAST; } else if (m_Pixel.Value == YellowPixel) { diagonalWallType = DiagonalWallType.NORTHWEST; } else if (m_Pixel.Value == HalfPinkPixel) { diagonalWallType = DiagonalWallType.SOUTHEAST; } else if (m_Pixel.Value == HalfYellowPixel) { diagonalWallType = DiagonalWallType.SOUTHWEST; } } else if (m_Pixel.Value == RedPixel) { cellType = CellType.PIT; m_Pits.Add(new Vector2(X, Y)); } else if (m_Pixel.Value == BluePixel | m_Pixel.Value == GreenPixel | m_Pixel.Value == BlueHalfGreenPixel | m_Pixel.Value == HalfBluePixel | m_Pixel.Value == HalfRedPixel | m_Pixel.Value == GreenHalfRBPixel | m_Pixel.Value == HalfWhitePixel | m_Pixel.Value == OrangePixel | m_Pixel.Value == RedHalfGBPixel) { cellType = CellType.FLOOR; if (m_Pixel.Value == GreenPixel) { isDamageCell = true; if (DamageCellsType == CoreDamageTypes.Ice) { cellDamagesPlayer = false; } else { cellDamagesPlayer = true; } } else if (m_Pixel.Value == BlueHalfGreenPixel) { OverrideFloorType = CellVisualData.CellFloorType.Ice; } else if (m_Pixel.Value == HalfBluePixel) { OverrideFloorType = CellVisualData.CellFloorType.Water; } else if (m_Pixel.Value == HalfRedPixel) { OverrideFloorType = CellVisualData.CellFloorType.Carpet; } else if (m_Pixel.Value == GreenHalfRBPixel) { OverrideFloorType = CellVisualData.CellFloorType.Grass; } else if (m_Pixel.Value == HalfWhitePixel) { OverrideFloorType = CellVisualData.CellFloorType.Bone; } else if (m_Pixel.Value == OrangePixel) { OverrideFloorType = CellVisualData.CellFloorType.Flesh; } else if (m_Pixel.Value == RedHalfGBPixel) { OverrideFloorType = CellVisualData.CellFloorType.ThickGoop; } } else { cellType = CellType.FLOOR; } } else { cellType = CellType.FLOOR; } if (DamageCellsType != CoreDamageTypes.None && isDamageCell) { room.FullCellData[ArrayPosition] = GenerateCellData(cellType, diagonalWallType, cellDamagesPlayer, DamageCellsArePoison, DamageCellsType, DamageToPlayersPerTick, DamageToEnemiesPerTick, TickFrequency, RespectsFlying); } else { room.FullCellData[ArrayPosition] = GenerateCellData(cellType, diagonalWallType, OverrideFloorType: OverrideFloorType); } } } if (m_Pits.Count > 0) { room.pits = new List <PrototypeRoomPitEntry>() { new PrototypeRoomPitEntry(m_Pits) { containedCells = m_Pits, borderType = PitBorderType } }; } room.OnBeforeSerialize(); room.OnAfterDeserialize(); room.UpdatePrecalculatedData(); }
private void ConnectClusteredRooms(RoomHandler first, RoomHandler second, PrototypeDungeonRoom firstPrototype, PrototypeDungeonRoom secondPrototype, int firstRoomExitIndex, int secondRoomExitIndex, int room1ExitLengthPadding = 3, int room2ExitLengthPadding = 3) { if (first.area.instanceUsedExits == null | second.area.exitToLocalDataMap == null | second.area.instanceUsedExits == null | first.area.exitToLocalDataMap == null) { return; } try { first.area.instanceUsedExits.Add(firstPrototype.exitData.exits[firstRoomExitIndex]); RuntimeRoomExitData runtimeRoomExitData = new RuntimeRoomExitData(firstPrototype.exitData.exits[firstRoomExitIndex]); first.area.exitToLocalDataMap.Add(firstPrototype.exitData.exits[firstRoomExitIndex], runtimeRoomExitData); second.area.instanceUsedExits.Add(secondPrototype.exitData.exits[secondRoomExitIndex]); RuntimeRoomExitData runtimeRoomExitData2 = new RuntimeRoomExitData(secondPrototype.exitData.exits[secondRoomExitIndex]); second.area.exitToLocalDataMap.Add(secondPrototype.exitData.exits[secondRoomExitIndex], runtimeRoomExitData2); first.connectedRooms.Add(second); first.connectedRoomsByExit.Add(firstPrototype.exitData.exits[firstRoomExitIndex], second); first.childRooms.Add(second); second.connectedRooms.Add(first); second.connectedRoomsByExit.Add(secondPrototype.exitData.exits[secondRoomExitIndex], first); second.parentRoom = first; runtimeRoomExitData.linkedExit = runtimeRoomExitData2; runtimeRoomExitData2.linkedExit = runtimeRoomExitData; runtimeRoomExitData.additionalExitLength = room1ExitLengthPadding; runtimeRoomExitData2.additionalExitLength = room2ExitLengthPadding; } catch (Exception) { ETGModConsole.Log("WARNING: Exception caused during CoonectClusteredRunTimeRooms method!"); return; } }
// Token: 0x0600003E RID: 62 RVA: 0x00003B70 File Offset: 0x00001D70 public static void ApplyRoomData(PrototypeDungeonRoom room, RoomFactory.RoomData roomData) { bool flag = roomData.exitPositions != null; if (flag) { for (int i = 0; i < roomData.exitPositions.Length; i++) { DungeonData.Direction direction = (DungeonData.Direction)Enum.Parse(typeof(DungeonData.Direction), roomData.exitDirections[i].ToUpper()); RoomFactory.AddExit(room, roomData.exitPositions[i], direction); } } else { RoomFactory.AddExit(room, new Vector2((float)(room.Width / 2), (float)room.Height), DungeonData.Direction.NORTH); RoomFactory.AddExit(room, new Vector2((float)(room.Width / 2), 0f), DungeonData.Direction.SOUTH); RoomFactory.AddExit(room, new Vector2((float)room.Width, (float)(room.Height / 2)), DungeonData.Direction.EAST); RoomFactory.AddExit(room, new Vector2(0f, (float)(room.Height / 2)), DungeonData.Direction.WEST); } bool flag2 = roomData.enemyPositions != null; if (flag2) { for (int j = 0; j < roomData.enemyPositions.Length; j++) { RoomFactory.AddEnemyToRoom(room, roomData.enemyPositions[j], roomData.enemyGUIDs[j], roomData.enemyReinforcementLayers[j]); } } bool flag3 = roomData.placeablePositions != null; if (flag3) { for (int k = 0; k < roomData.placeablePositions.Length; k++) { RoomFactory.AddPlaceableToRoom(room, roomData.placeablePositions[k], roomData.placeableGUIDs[k]); } } bool flag4 = roomData.floors != null; if (flag4) { foreach (string val in roomData.floors) { room.prerequisites.Add(new DungeonPrerequisite { prerequisiteType = DungeonPrerequisite.PrerequisiteType.TILESET, requiredTileset = Tools.GetEnumValue <GlobalDungeonData.ValidTilesets>(val) }); } } bool flag5 = !string.IsNullOrEmpty(roomData.category); if (flag5) { room.category = Tools.GetEnumValue <PrototypeDungeonRoom.RoomCategory>(roomData.category); } bool flag6 = !string.IsNullOrEmpty(roomData.normalSubCategory); if (flag6) { room.subCategoryNormal = Tools.GetEnumValue <PrototypeDungeonRoom.RoomNormalSubCategory>(roomData.normalSubCategory); } bool flag7 = !string.IsNullOrEmpty(roomData.bossSubCategory); if (flag7) { room.subCategoryBoss = Tools.GetEnumValue <PrototypeDungeonRoom.RoomBossSubCategory>(roomData.bossSubCategory); } bool flag8 = !string.IsNullOrEmpty(roomData.specialSubCatergory); if (flag8) { room.subCategorySpecial = Tools.GetEnumValue <PrototypeDungeonRoom.RoomSpecialSubCategory>(roomData.specialSubCatergory); } }
public static void AssignCellDataForNewRoom(PrototypeDungeonRoom room, string fileName) { string[] linesFromEmbeddedResource = ResourceExtractor.GetLinesFromEmbeddedResource(fileName); int width = room.Width; int height = room.Height; FieldInfo privateField = typeof(PrototypeDungeonRoom).GetField("m_cellData", BindingFlags.Instance | BindingFlags.NonPublic); PrototypeDungeonRoomCellData[] m_cellData = new PrototypeDungeonRoomCellData[width * height]; CellType[,] cellData = new CellType[width, height]; for (int Y = 0; Y < height; Y++) { string text = linesFromEmbeddedResource[Y]; for (int X = 0; X < width; X++) { // Corrects final row being off by one unit (read as first line in text file) if (Y == 0 && X > 0) { char c = text[X]; if (c != '-') { if (c != 'P') { if (c == 'W') { cellData[X - 1, height - Y - 1] = CellType.WALL; } } else { cellData[X - 1, height - Y - 1] = CellType.PIT; } } else { cellData[X - 1, height - Y - 1] = CellType.FLOOR; } } else { char c = text[X]; if (c != '-') { if (c != 'P') { if (c == 'W') { cellData[X, height - Y - 1] = CellType.WALL; } } else { cellData[X, height - Y - 1] = CellType.PIT; } } else { cellData[X, height - Y - 1] = CellType.FLOOR; } } } } // Set Final Cell (it was left null for some reason) string text2 = linesFromEmbeddedResource[height - 1]; char C = text2[width - 1]; if (C != '-') { if (C != 'P') { if (C == 'W') { cellData[width - 1, height - 1] = CellType.WALL; } } else { cellData[width - 1, height - 1] = CellType.PIT; } } else { cellData[width - 1, height - 1] = CellType.FLOOR; } for (int X = 0; X < width; X++) { for (int Y = 0; Y < height; Y++) { m_cellData[Y * width + X] = GenerateDefaultCellData(cellData[X, Y]); } } privateField.SetValue(room, m_cellData); room.UpdatePrecalculatedData(); }
public static void ApplyRoomData(PrototypeDungeonRoom room, RoomData roomData) { if (roomData.exitPositions != null) { for (int i = 0; i < roomData.exitPositions.Length; i++) { DungeonData.Direction dir = (DungeonData.Direction)Enum.Parse(typeof(DungeonData.Direction), roomData.exitDirections[i].ToUpper()); AddExit(room, roomData.exitPositions[i], dir); } } else { AddExit(room, new Vector2(room.Width / 2, room.Height), DungeonData.Direction.NORTH); AddExit(room, new Vector2(room.Width / 2, 0), DungeonData.Direction.SOUTH); AddExit(room, new Vector2(room.Width, room.Height / 2), DungeonData.Direction.EAST); AddExit(room, new Vector2(0, room.Height / 2), DungeonData.Direction.WEST); } if (roomData.enemyPositions != null) { for (int i = 0; i < roomData.enemyPositions.Length; i++) { AddEnemyToRoom(room, roomData.enemyPositions[i], roomData.enemyGUIDs[i], roomData.enemyReinforcementLayers[i]); } } if (roomData.placeablePositions != null) { for (int i = 0; i < roomData.placeablePositions.Length; i++) { AddPlaceableToRoom(room, roomData.placeablePositions[i], roomData.placeableGUIDs[i]); } } if (roomData.floors != null) { foreach (var floor in roomData.floors) { room.prerequisites.Add(new DungeonPrerequisite() { prerequisiteType = DungeonPrerequisite.PrerequisiteType.TILESET, requiredTileset = Tools.GetEnumValue <GlobalDungeonData.ValidTilesets>(floor) }); } } //Set categories if (!string.IsNullOrEmpty(roomData.category)) { room.category = Tools.GetEnumValue <PrototypeDungeonRoom.RoomCategory>(roomData.category); } if (!string.IsNullOrEmpty(roomData.normalSubCategory)) { room.subCategoryNormal = Tools.GetEnumValue <PrototypeDungeonRoom.RoomNormalSubCategory>(roomData.normalSubCategory); } if (!string.IsNullOrEmpty(roomData.bossSubCategory)) { room.subCategoryBoss = Tools.GetEnumValue <PrototypeDungeonRoom.RoomBossSubCategory>(roomData.bossSubCategory); } if (!string.IsNullOrEmpty(roomData.specialSubCatergory)) { room.subCategorySpecial = Tools.GetEnumValue <PrototypeDungeonRoom.RoomSpecialSubCategory>(roomData.specialSubCatergory); } }
public static void ApplyExtraFloorCellDataFromTexture2D(PrototypeDungeonRoom room, Texture2D sourceTexture) { if (sourceTexture == null) { ETGModConsole.Log("[ExpandTheGungeon] ApplyExtraFloorCellDataFromTexture2D: WARNING! Requested Texture for extra floor data is null!", ExpandSettings.debugMode); ETGModConsole.Log("[ExpandTheGungeon] Room: " + room.name + " will not have any extra floor data!", ExpandSettings.debugMode); return; } int width = room.Width; int height = room.Height; int ArrayLength = (width * height); if (sourceTexture.GetPixels32().Length != ArrayLength) { ETGModConsole.Log("[ExpandTheGungeon] ApplyExtraFloorCellDataFromTexture2D: WARNING! Image resolution doesn't match size of room!", ExpandSettings.debugMode); ETGModConsole.Log("[ExpandTheGungeon] Room: " + room.name + " will not have any extra floor data!", ExpandSettings.debugMode); return; } Color WhitePixel = new Color32(255, 255, 255, 255); // Normal Floor Color RedPixel = new Color32(255, 0, 0, 255); // Fire damage cell Color GreenPixel = new Color32(0, 255, 0, 255); // Poison damage cell Color BlueHalfGreenPixel = new Color32(0, 127, 255, 255); // Ice Override Color HalfBluePixel = new Color32(0, 0, 127, 255); // Water Override Color HalfRedPixel = new Color32(0, 0, 127, 255); // Carpet Override Color GreenHalfRBPixel = new Color32(127, 255, 127, 255); // Grass Override Color HalfWhitePixel = new Color32(127, 127, 127, 255); // Bone Override Color OrangePixel = new Color32(255, 127, 0, 255); // Flesh Override Color RedHalfGBPixel = new Color32(255, 127, 127, 255); // ThickGoop Override for (int X = 0; X < width; X++) { for (int Y = 0; Y < height; Y++) { int ArrayPosition = (Y * width + X); Color?m_Pixel = sourceTexture.GetPixel(X, Y); PrototypeDungeonRoomCellData cellData = room.FullCellData[ArrayPosition]; float DamageToPlayersPerTick = 0; float DamageToEnemiesPerTick = 0; float TickFrequency = 0; bool RespectsFlying = true; bool IsPoison = false; bool isDamageCell = false; CoreDamageTypes DamageCellsType = CoreDamageTypes.None; FloorType floorType = FloorType.Stone; if (cellData != null && m_Pixel.HasValue && cellData.state == CellType.FLOOR) { if (m_Pixel.Value == RedPixel) { floorType = FloorType.Stone; DamageCellsType = CoreDamageTypes.Fire; } else if (m_Pixel.Value == BlueHalfGreenPixel) { floorType = FloorType.Ice; } else if (m_Pixel.Value == HalfBluePixel) { floorType = FloorType.Water; } else if (m_Pixel.Value == HalfRedPixel) { floorType = FloorType.Carpet; } else if (m_Pixel.Value == GreenHalfRBPixel) { floorType = FloorType.Grass; } else if (m_Pixel.Value == HalfWhitePixel) { floorType = FloorType.Bone; } else if (m_Pixel.Value == OrangePixel) { floorType = FloorType.Flesh; } else if (m_Pixel.Value == RedHalfGBPixel) { floorType = FloorType.ThickGoop; } if (DamageCellsType == CoreDamageTypes.Fire) { isDamageCell = true; DamageToPlayersPerTick = 0.5f; TickFrequency = 1; } else if (DamageCellsType == CoreDamageTypes.Poison) { IsPoison = true; isDamageCell = true; DamageToPlayersPerTick = 0.5f; TickFrequency = 1; } ApplyExtraFloorCellData(cellData, DamageCellsType, floorType, DamageToPlayersPerTick, DamageToEnemiesPerTick, TickFrequency, RespectsFlying, isDamageCell, IsPoison); } } } }