// Token: 0x06000007 RID: 7 RVA: 0x00002D88 File Offset: 0x00000F88
        public static void Register(RoomFactory.RoomData roomData)
        {
            PrototypeDungeonRoom room = roomData.room;
            WeightedRoom         w    = new WeightedRoom
            {
                room = room,
                additionalPrerequisites = new DungeonPrerequisite[0],
                weight = ((roomData.weight == 0f) ? DungeonHandler.GlobalRoomWeight : roomData.weight)
            };

            switch (room.category)
            {
            case PrototypeDungeonRoom.RoomCategory.BOSS:
                return;

            case PrototypeDungeonRoom.RoomCategory.SPECIAL:
            {
                PrototypeDungeonRoom.RoomSpecialSubCategory subCategorySpecial     = room.subCategorySpecial;
                PrototypeDungeonRoom.RoomSpecialSubCategory roomSpecialSubCategory = subCategorySpecial;
                bool flag = roomSpecialSubCategory != PrototypeDungeonRoom.RoomSpecialSubCategory.STANDARD_SHOP;
                if (flag)
                {
                    bool flag2 = roomSpecialSubCategory != PrototypeDungeonRoom.RoomSpecialSubCategory.WEIRD_SHOP;
                    if (flag2)
                    {
                        StaticReferences.RoomTables["special"].includedRooms.Add(w);
                    }
                    else
                    {
                        StaticReferences.subShopTable.InjectionData.Add(DungeonHandler.GetFlowModifier(roomData));
                    }
                }
                else
                {
                    StaticReferences.RoomTables["shop"].includedRooms.Add(w);
                }
                return;
            }

            case PrototypeDungeonRoom.RoomCategory.SECRET:
                StaticReferences.RoomTables["secret"].includedRooms.Add(w);
                return;
            }
            List <DungeonPrerequisite> list = new List <DungeonPrerequisite>();

            foreach (DungeonPrerequisite dungeonPrerequisite in room.prerequisites)
            {
                bool requireTileset = dungeonPrerequisite.requireTileset;
                bool flag3          = requireTileset;
                if (flag3)
                {
                    StaticReferences.GetRoomTable(dungeonPrerequisite.requiredTileset).includedRooms.Add(w);
                    list.Add(dungeonPrerequisite);
                }
            }
            foreach (DungeonPrerequisite item in list)
            {
                room.prerequisites.Remove(item);
            }
        }
        public static void LoadRoomsFromRoomDirectory()
        {
            string roomDirectory = RoomDirectory();

            Directory.CreateDirectory(roomDirectory);
            foreach (string f in Directory.GetFiles(roomDirectory, "*", SearchOption.AllDirectories))
            {
                if (f.EndsWith(".room", StringComparison.OrdinalIgnoreCase))
                {
                    string name = Path.GetFullPath(f).RemovePrefix(roomDirectory).RemoveSuffix(".room");
                    Tools.Log($"Found room: \"{name}\"");
                    var roomData = BuildFromRoomFile(f);
                    DungeonHandler.Register(roomData);
                    rooms.Add(name, roomData);
                }
                else if (f.EndsWith(".zip", StringComparison.OrdinalIgnoreCase))
                {
                    Tools.Log($"Found zipped rooms: \"{f}\"");
                    var roomsData = BuildFromZipFile(f);
                    foreach (var roomData in roomsData)
                    {
                        string name = roomData.room.name;
                        Tools.Log($"Found room: \"{name}\"");
                        DungeonHandler.Register(roomData);
                        rooms.Add(roomData.room.name, roomData);
                    }
                }
            }
        }
Exemple #3
0
 public static void Init()
 {
     Tools.Init();
     StaticReferences.Init();
     ShrineFakePrefabHooks.Init();
     ShrineFactory.Init();
     DungeonHandler.Init();
 }
 public static void LoadRoomsFromRoomDirectory()
 {
     Directory.CreateDirectory(roomDirectory);
     foreach (string f in Directory.GetFiles(roomDirectory))
     {
         if (!f.EndsWith(".room"))
         {
             continue;
         }
         string name = Path.GetFileName(f);
         Tools.Log($"Found room: \"{name}\"");
         var roomData = BuildFromFile(f);
         DungeonHandler.Register(roomData);
         rooms.Add(name, roomData);
     }
 }
 // Token: 0x0600003A RID: 58 RVA: 0x00003A08 File Offset: 0x00001C08
 public static void LoadRoomsFromRoomDirectory()
 {
     Directory.CreateDirectory(RoomFactory.roomDirectory);
     foreach (string text in Directory.GetFiles(RoomFactory.roomDirectory))
     {
         bool flag = !text.EndsWith(".room");
         if (!flag)
         {
             string fileName = Path.GetFileName(text);
             Tools.Log <string>("Found room: \"" + fileName + "\"");
             RoomFactory.RoomData roomData = RoomFactory.BuildFromFile(text);
             DungeonHandler.Register(roomData);
             RoomFactory.rooms.Add(fileName, roomData);
         }
     }
 }
Exemple #6
0
        public static void RegisterShrineRoom(GameObject shrine, PrototypeDungeonRoom protoroom, string ID, Vector2 offset)
        {
            protoroom.category = PrototypeDungeonRoom.RoomCategory.NORMAL;

            DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0];
            Vector2 position = new Vector2(protoroom.Width / 2 + offset.x, protoroom.Height / 2 + offset.y);

            protoroom.placedObjectPositions.Add(position);

            var placeableContents = ScriptableObject.CreateInstance <DungeonPlaceable>();

            placeableContents.width  = 2;
            placeableContents.height = 2;
            placeableContents.respectsEncounterableDifferentiator = true;
            placeableContents.variantTiers = new List <DungeonPlaceableVariant>()
            {
                new DungeonPlaceableVariant()
                {
                    percentChance        = 1,
                    nonDatabasePlaceable = shrine,
                    prerequisites        = emptyReqs,
                    materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0]
                }
            };

            protoroom.placedObjects.Add(new PrototypePlacedObjectData()
            {
                contentsBasePosition  = position,
                fieldData             = new List <PrototypePlacedObjectFieldData>(),
                instancePrerequisites = emptyReqs,
                linkedTriggerAreaIDs  = new List <int>(),
                placeableContents     = placeableContents
            });

            var data = new RoomFactory.RoomData()
            {
                room               = protoroom,
                isSpecialRoom      = true,
                category           = "SPECIAL",
                specialSubCategory = "UNSPECIFIED_SPECIAL"
            };

            RoomFactory.rooms.Add(ID, data);
            DungeonHandler.Register(data);
        }
Exemple #7
0
        public static void LoadRoomsFromRoomDirectory()
        {
            string roomDirectory     = Initialisation.ZipFilePath;
            string unzippedDirectory = Initialisation.FilePath;

            if (File.Exists(roomDirectory))
            {
                using (ZipFile zip = ZipFile.Read(roomDirectory))

                    foreach (ZipEntry f in zip.Entries)
                    {
                        if (f.FileName.Contains("rooms") && !FailSafeCheck)
                        {
                            FailSafeCheck = true;
                            //ItemAPI.Tools.PrintNoID("this is being read");
                            var roomData = BuildFromZipFile(roomDirectory);
                            foreach (var roomsData in roomData)
                            {
                                string name = roomsData.room.name;
                                //Debug.Log("Found room: "+name);
                                DungeonHandler.Register(roomsData);
                                rooms.Add(roomsData.room.name, roomsData);
                            }
                        }
                    }
            }
            else
            {
                Directory.CreateDirectory(unzippedDirectory);
                foreach (string g in Directory.GetFiles(unzippedDirectory, "*", SearchOption.AllDirectories))
                {
                    if (g.EndsWith(".room", StringComparison.OrdinalIgnoreCase))
                    {
                        string name = Path.GetFullPath(g).RemovePrefix(unzippedDirectory).RemoveSuffix(".room");
                        // Debug.Log("Found room: " + name);
                        var roomData = BuildFromRoomFile(g);
                        DungeonHandler.Register(roomData);
                        rooms.Add(name, roomData);
                    }
                }
            }
        }
        // Token: 0x0600005A RID: 90 RVA: 0x000050E4 File Offset: 0x000032E4
        public static void RegisterShrineRoom(GameObject shrine, PrototypeDungeonRoom protoroom, string ID, Vector2 offset)
        {
            protoroom.category = PrototypeDungeonRoom.RoomCategory.NORMAL;
            DungeonPrerequisite[] array = new DungeonPrerequisite[0];
            Vector2 vector = new Vector2((float)(protoroom.Width / 2) + offset.x, (float)(protoroom.Height / 2) + offset.y);

            protoroom.placedObjectPositions.Add(vector);
            protoroom.placedObjects.Add(new PrototypePlacedObjectData
            {
                contentsBasePosition  = vector,
                fieldData             = new List <PrototypePlacedObjectFieldData>(),
                instancePrerequisites = array,
                linkedTriggerAreaIDs  = new List <int>(),
                placeableContents     = new DungeonPlaceable
                {
                    width  = 2,
                    height = 2,
                    respectsEncounterableDifferentiator = true,
                    variantTiers = new List <DungeonPlaceableVariant>
                    {
                        new DungeonPlaceableVariant
                        {
                            percentChance        = 1f,
                            nonDatabasePlaceable = shrine,
                            prerequisites        = array,
                            materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0]
                        }
                    }
                }
            });
            RoomFactory.RoomData roomData = new RoomFactory.RoomData
            {
                room                = protoroom,
                isSpecialRoom       = true,
                category            = "SPECIAL",
                specialSubCatergory = "UNSPECIFIED_SPECIAL"
            };
            RoomFactory.rooms.Add(ID, roomData);
            DungeonHandler.Register(roomData);
        }
        // Token: 0x06000018 RID: 24 RVA: 0x0000399C File Offset: 0x00001B9C
        public static void RegisterShrineRoom(GameObject shrine, PrototypeDungeonRoom protoroom, string ID, Vector2 offset, float roomweight)
        {
            DungeonPrerequisite[] array = new DungeonPrerequisite[0];
            Vector2 vector = new Vector2((float)(protoroom.Width / 2) + offset.x, (float)(protoroom.Height / 2) + offset.y);

            protoroom.placedObjectPositions.Add(vector);
            protoroom.placedObjects.Add(new PrototypePlacedObjectData
            {
                contentsBasePosition  = vector,
                fieldData             = new List <PrototypePlacedObjectFieldData>(),
                instancePrerequisites = array,
                linkedTriggerAreaIDs  = new List <int>(),
                placeableContents     = new DungeonPlaceable
                {
                    width  = 2,
                    height = 2,
                    respectsEncounterableDifferentiator = true,
                    variantTiers = new List <DungeonPlaceableVariant>
                    {
                        new DungeonPlaceableVariant
                        {
                            percentChance        = 1f,
                            nonDatabasePlaceable = shrine,
                            prerequisites        = array,
                            materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0]
                        }
                    }
                }
            });
            RoomFactory.RoomData roomData = new RoomFactory.RoomData
            {
                room     = protoroom,
                category = protoroom.category.ToString(),
                weight   = roomweight,
            };
            //RoomFactory.RoomData roomData = RoomFactory.ExtractRoomDataFromResource(roomPath);
            RoomFactory.rooms.Add(ID, roomData);
            DungeonHandler.RegisterForShrine(roomData);
        }