Пример #1
0
        public void Rand_CratesRemoved(Random rand)
        {
            string LevelsPathA = @"LEVELS\A\";
            string LevelsPathC = @"LEVELS\C\";
            string Ext         = ".CRT";

            if (ConsolePipeline.Metadata.Console != ConsoleMode.PS2)
            {
                LevelsPathA = LevelsPathA.ToLower();
                LevelsPathC = LevelsPathC.ToLower();
                Ext         = Ext.ToLower();
            }
            else
            {
                Ext += ";1";
            }

            for (int i = 0; i < LevelNames.Length; i++)
            {
                string path = ConsolePipeline.ExtractedPath + LevelsPathA + LevelNames[i] + @"\" + FileNames[i] + Ext;
                if (i > 24)
                {
                    path = ConsolePipeline.ExtractedPath + LevelsPathC + LevelNames[i] + @"\" + FileNames[i] + Ext;
                }
                if (File.Exists(path))
                {
                    TWOC_File_CRT CrateFile = new TWOC_File_CRT(path, false);

                    for (int g = 0; g < CrateFile.CrateGroups.Count; g++)
                    {
                        for (int c = 0; c < CrateFile.CrateGroups[g].Crates.Count; c++)
                        {
                            if (CratesToRemove.Contains(CrateFile.CrateGroups[g].Crates[c].Type) && rand.Next(2) == 0)
                            {
                                CrateFile.CrateGroups[g].Crates.RemoveAt(c);
                                c--;
                            }
                        }
                        if (CrateFile.CrateGroups[g].Crates.Count == 0)
                        {
                            CrateFile.CrateGroups.RemoveAt(g);
                            g--;
                        }
                    }

                    CrateFile.Save(path);
                }
            }
        }
Пример #2
0
        public void Rand_RandomizeCrates(Random rand)
        {
            string LevelsPathA = @"LEVELS\A\";
            string LevelsPathC = @"LEVELS\C\";
            string Ext         = ".CRT";

            if (ConsolePipeline.Metadata.Console != ConsoleMode.PS2)
            {
                LevelsPathA = LevelsPathA.ToLower();
                LevelsPathC = LevelsPathC.ToLower();
                Ext         = Ext.ToLower();
            }
            else
            {
                Ext += ";1";
            }

            for (int i = 0; i < LevelNames.Length; i++)
            {
                string path = ConsolePipeline.ExtractedPath + LevelsPathA + LevelNames[i] + @"\" + FileNames[i] + Ext;
                if (i > 24)
                {
                    path = ConsolePipeline.ExtractedPath + LevelsPathC + LevelNames[i] + @"\" + FileNames[i] + Ext;
                }
                if (File.Exists(path))
                {
                    TWOC_File_CRT CrateFile = new TWOC_File_CRT(path, false);

                    foreach (TWOC_File_CRT.CrateGroup Group in CrateFile.CrateGroups)
                    {
                        foreach (TWOC_File_CRT.Crate Crate in Group.Crates)
                        {
                            if (CratesToChange.Contains(Crate.Type))
                            {
                                int r = rand.Next(CratesToInsert.Count);
                                Crate.Type = CratesToInsert[r];
                            }
                        }
                    }

                    CrateFile.Save(path);
                }
            }
        }
Пример #3
0
        public void Rand_WumpaCrates(Random rand)
        {
            string LevelsPathA = @"LEVELS\A\";
            string LevelsPathC = @"LEVELS\C\";
            string ExtWMP      = ".WMP";
            string ExtCRT      = ".CRT";

            if (ConsolePipeline.Metadata.Console != ConsoleMode.PS2)
            {
                LevelsPathA = LevelsPathA.ToLower();
                LevelsPathC = LevelsPathC.ToLower();
                ExtWMP      = ExtWMP.ToLower();
                ExtCRT      = ExtCRT.ToLower();
            }
            else
            {
                ExtCRT += ";1";
                ExtWMP += ";1";
            }

            for (int i = 0; i < LevelNames.Length - 5; i++)
            {
                string path = ConsolePipeline.ExtractedPath + LevelsPathA + LevelNames[i] + @"\" + FileNames[i] + ExtWMP;
                if (i > 24)
                {
                    path = ConsolePipeline.ExtractedPath + LevelsPathC + LevelNames[i] + @"\" + FileNames[i] + ExtWMP;
                }
                if (File.Exists(path))
                {
                    TWOC_File_WMP WumpaFile = new TWOC_File_WMP(path, false);

                    List <TWOC_Vector3> WumpaPos = new List <TWOC_Vector3>();

                    for (int w = 0; w < WumpaFile.Wumpas.Count; w++)
                    {
                        if (rand.Next(0, 5) == 0)
                        {
                            WumpaPos.Add(WumpaFile.Wumpas[w]);
                            WumpaFile.Wumpas.RemoveAt(w);
                            w--;
                        }
                    }

                    WumpaFile.Save(path);

                    path = ConsolePipeline.ExtractedPath + LevelsPathA + LevelNames[i] + @"\" + FileNames[i] + ExtCRT;
                    if (i > 24)
                    {
                        path = ConsolePipeline.ExtractedPath + LevelsPathC + LevelNames[i] + @"\" + FileNames[i] + ExtCRT;
                    }

                    if (File.Exists(path))
                    {
                        TWOC_File_CRT CrateFile = new TWOC_File_CRT(path, false);

                        ushort CrateCount = CrateFile.GetCrateCount();

                        for (int w = 0; w < WumpaPos.Count; w++)
                        {
                            TWOC_File_CRT.CrateGroup Group = new TWOC_File_CRT.CrateGroup();
                            Group.Crates = new List <TWOC_File_CRT.Crate>();
                            TWOC_File_CRT.Crate BaseCrate = new TWOC_File_CRT.Crate();
                            BaseCrate.Pos = new TWOC_Vector3(WumpaPos[w].X, WumpaPos[w].Y, WumpaPos[w].Z);
                            Group.ID      = CrateCount;
                            CrateCount++;
                            Group.unkFlags = 0; // ??
                            if (rand.Next(0, 2) == 0)
                            {
                                Group.Rot = new TWOC_Vector3((float)rand.NextDouble() * 180f, 0, 0);
                            }
                            else
                            {
                                Group.Rot = new TWOC_Vector3((float)rand.NextDouble() * -180f, 0, 0);
                            }

                            BaseCrate.unkFlags = new byte[10] {
                                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                            };
                            int r = rand.Next(CratesToInsert.Count);
                            BaseCrate.Type = CratesToInsert[r];
                            if (rand.Next(0, 3) == 0)
                            {
                                r = rand.Next(TimeCrates.Count);
                                BaseCrate.TypeTT = TimeCrates[r];
                            }
                            else
                            {
                                BaseCrate.TypeTT = BaseCrate.Type;
                            }
                            BaseCrate.Type3     = TWOC_File_CRT.CrateType.NULL;
                            BaseCrate.Type4     = TWOC_File_CRT.CrateType.NULL;
                            BaseCrate.unkFlags2 = new byte[14] {
                                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                            };
                            Group.Crates.Add(BaseCrate);
                            CrateFile.CrateGroups.Add(Group);
                        }

                        CrateFile.Save(path);
                    }
                }
            }
        }