Exemplo n.º 1
0
        /// <summary>Determines the Version Grouping of an input Version ID</summary>
        /// <param name="Version">Version of which to determine the group</param>
        /// <returns>Version Group Identifier or Invalid if type cannot be determined.</returns>
        public static GameVersion getMetLocationVersionGroup(GameVersion Version)
        {
            switch (Version)
            {
                case GameVersion.CXD:
                    return GameVersion.CXD;

                case GameVersion.RBY:
                    return GameVersion.RBY;

                case GameVersion.GS:
                case GameVersion.C:
                    return GameVersion.GSC;

                case GameVersion.R:
                case GameVersion.S:
                    return GameVersion.RS;

                case GameVersion.E:
                    return GameVersion.E;

                case GameVersion.FR:
                case GameVersion.LG:
                    return GameVersion.FR;

                case GameVersion.D:
                case GameVersion.P:
                    return GameVersion.DP;

                case GameVersion.Pt:
                    return GameVersion.Pt;

                case GameVersion.HG:
                case GameVersion.SS:
                    return GameVersion.HGSS;

                case GameVersion.B:
                case GameVersion.W:
                    return GameVersion.BW;

                case GameVersion.B2:
                case GameVersion.W2:
                    return GameVersion.B2W2;

                case GameVersion.X:
                case GameVersion.Y:
                    return GameVersion.XY;

                case GameVersion.OR:
                case GameVersion.AS:
                    return GameVersion.ORAS;

                case GameVersion.SN:
                case GameVersion.MN:
                    return GameVersion.SM;

                default:
                    return GameVersion.Invalid;
            }
        }
Exemplo n.º 2
0
        public GameConfig(int fileCount)
        {
            GameVersion game = GameVersion.Invalid;
            switch (fileCount)
            {
                case FILECOUNT_XY:
                    game = GameVersion.XY;
                    break;
                case FILECOUNT_ORAS:
                    game = GameVersion.ORASDEMO;
                    break;
                case FILECOUNT_ORASDEMO:
                    game = GameVersion.ORAS;
                    break;
                case FILECOUNT_SMDEMO:
                    game = GameVersion.SMDEMO;
                    break;
                case FILECOUNT_SM:
                    game = GameVersion.SM;
                    break;
            }
            if (game == GameVersion.Invalid)
                return;

            Version = game;
        }
 private void PopulateAppIdCombo(ComboBox combo, GameVersion gameVersion)
 {
     var appIdList = SongAppIdRepository.Instance().Select(gameVersion).ToArray();
     combo.DataSource = appIdList;
     combo.DisplayMember = "DisplayName";
     combo.ValueMember = "AppId";
 }
Exemplo n.º 4
0
        public GameInfo(Process gameProcess)
        {
            this.gameProcess = gameProcess;
            if (gameProcess.MainModuleWow64Safe().ModuleMemorySize == 5029888)
            {
                gameVersion = GameVersion.v2014_12_03;
            }
            else if (gameProcess.MainModuleWow64Safe().ModuleMemorySize == 5033984)
            {
                gameVersion = GameVersion.v2016_01_12;
            }
            else
            {
                MessageBox.Show("Unsupported game version", "LiveSplit.Quake2", 
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                gameVersion = GameVersion.v2014_12_03;
            }

            switch (gameVersion)
            {
                case GameVersion.v2014_12_03:
                    gameStateAddress = new DeepPointer(0x31BDC0);
                    mapAddress = new DeepPointer(0x3086C4);
                    inIntermissionAddress = new DeepPointer(0x2C679C);
                    break;
                case GameVersion.v2016_01_12:
                    gameStateAddress = new DeepPointer(0x286400);
                    mapAddress = new DeepPointer(0x33FF44);
                    inIntermissionAddress = new DeepPointer(0x2FDF28);
                    break;
            }
        }
Exemplo n.º 5
0
        public string GetDataAsHtml( GameVersion version, TSS.TSSFile stringDic, Dictionary<uint, TSS.TSSEntry> inGameIdDict )
        {
            StringBuilder sb = new StringBuilder();
            sb.Append( "<tr>" );
            /*
            sb.Append( "<td>" );
            sb.Append( RefString );
            sb.Append( "</td>" );
            //*/
            sb.Append( "<td>" );
            sb.Append( "<span class=\"itemname\">" );
            sb.Append( inGameIdDict[NameStringDicID].StringJpnHtml( version ) );
            sb.Append( "</span>" );
            sb.Append( "<br>" );
            sb.Append( inGameIdDict[DescStringDicID].StringJpnHtml( version ) );
            sb.Append( "</td>" );
            sb.Append( "<td>" );
            sb.Append( "<span class=\"itemname\">" );
            sb.Append( inGameIdDict[NameStringDicID].StringEngHtml( version ) );
            sb.Append( "</span>" );
            sb.Append( "<br>" );
            sb.Append( inGameIdDict[DescStringDicID].StringEngHtml( version ) );
            sb.Append( "</td>" );
            sb.Append( "<td>" );
            sb.Append( GradeCost + " Grade" );
            sb.Append( "</td>" );

            return sb.ToString();
        }
Exemplo n.º 6
0
Arquivo: SAV4.cs Projeto: kwsch/PKHeX
        public SAV4(byte[] data = null, GameVersion versionOverride = GameVersion.Any)
        {
            Data = data == null ? new byte[SaveUtil.SIZE_G4RAW] : (byte[])data.Clone();
            BAK = (byte[])Data.Clone();
            Exportable = !Data.SequenceEqual(new byte[Data.Length]);

            // Get Version
            if (data == null)
                Version = GameVersion.HGSS;
            else if (versionOverride != GameVersion.Any)
                Version = versionOverride;
            else Version = SaveUtil.getIsG4SAV(Data);
            if (Version == GameVersion.Invalid)
                return;

            getActiveGeneralBlock();
            getActiveStorageBlock();
            getSAVOffsets();

            switch (Version)
            {
                case GameVersion.DP: Personal = PersonalTable.DP; break;
                case GameVersion.Pt: Personal = PersonalTable.Pt; break;
                case GameVersion.HGSS: Personal = PersonalTable.HGSS; break;
            }

            if (!Exportable)
                resetBoxes();
        }
Exemplo n.º 7
0
        internal static IEnumerable<int> getBaseEggMoves(PKM pkm, int skipOption, GameVersion gameSource)
        {
            int species = getBaseSpecies(pkm, skipOption);

            if (gameSource == GameVersion.Any)
                gameSource = (GameVersion) pkm.Version;

            switch (gameSource)
            {
                case GameVersion.X:
                case GameVersion.Y:
                case GameVersion.XY:
                    if (pkm.InhabitedGeneration(6))
                        return LevelUpXY[species].getMoves(1);
                    break;

                case GameVersion.AS:
                case GameVersion.OR:
                case GameVersion.ORAS:
                    if (pkm.InhabitedGeneration(6))
                        return LevelUpAO[species].getMoves(1);
                    break;

                case GameVersion.SN:
                case GameVersion.MN:
                case GameVersion.SM:
                    if (pkm.InhabitedGeneration(7))
                        return LevelUpSM[species].getMoves(1);
                    break;
            }
            return null;
        }
Exemplo n.º 8
0
        public NSFBox(NSF nsf,GameVersion gameversion)
        {
            this.nsf = nsf;
            this.controller = new NSFController(nsf,gameversion);

            this.searchresults = new List<TreeNode>();

            controller.Node.Expand();

            trvMain = new TreeView();
            trvMain.Dock = DockStyle.Fill;
            trvMain.ImageList = imglist;
            trvMain.HideSelection = false;
            trvMain.Nodes.Add(controller.Node);
            trvMain.SelectedNode = controller.Node;
            trvMain.AllowDrop = true;
            trvMain.AfterSelect += new TreeViewEventHandler(trvMain_AfterSelect);
            trvMain.ItemDrag += new ItemDragEventHandler(trvMain_ItemDrag);
            trvMain.DragOver += new DragEventHandler(trvMain_DragOver);
            trvMain.DragDrop += new DragEventHandler(trvMain_DragDrop);

            pnSplit = new SplitContainer();
            pnSplit.Dock = DockStyle.Fill;
            pnSplit.Panel1.Controls.Add(trvMain);

            this.Controls.Add(pnSplit);
        }
Exemplo n.º 9
0
        public string GetDataAsHtml( string stratum, int floor, T8BTEMST.T8BTEMST Enemies, T8BTEMGP.T8BTEMGP EnemyGroups, T8BTEMEG.T8BTEMEG EncounterGroups, GameVersion version, T8BTXTMT treasures, ItemDat.ItemDat items, Dictionary<uint, TSS.TSSEntry> inGameIdDict, bool surroundingTable = true, bool phpLinks = false )
        {
            StringBuilder sb = new StringBuilder();

            if ( surroundingTable ) {
                sb.Append( "<div id=\"" + stratum + floor + "\">" );
                sb.Append( "<table class=\"necropolisfloor\">" );
                sb.Append( "<tr>" );
                sb.Append( "<th colspan=\"6\">" );
                sb.Append( "<div class=\"itemname\" style=\"text-align: center;\">" );
                sb.Append( stratum + "-" + floor );
                sb.Append( "</div>" );
                sb.Append( "</td>" );
                sb.Append( "</tr>" );
            }
            for ( int y = 0; y < VerticalTiles; y++ ) {
                sb.Append( "<tr>" );
                for ( int x = 0; x < HorizontalTiles; x++ ) {
                    sb.Append( TileList[(int)( y * HorizontalTiles + x )].GetDataAsHtml( stratum, floor, Enemies, EnemyGroups, EncounterGroups, version, treasures, items, inGameIdDict, phpLinks: phpLinks ) );
                }
                sb.Append( "</tr>" );
                //sb.Append( "<tr><td colspan=\"" + HorizontalTiles + "\"><hr></td></tr>" );
            }
            if ( surroundingTable ) {
                sb.Append( "</table>" );
                sb.Append( "</div>" );
            }

            return sb.ToString();
        }
        public TuningDefinition(TuningStrings tStrings, GameVersion rsVersion, string name = "", bool custom = true)
        {
            Custom = custom;
            Tuning = tStrings;
            GameVersion = rsVersion;

            UIName = Name = !string.IsNullOrEmpty(name) ? name : NameFromStrings(tStrings);
        }
Exemplo n.º 11
0
 /// <summary>
 ///     Initializes a new _instance of the Travian class.
 /// </summary>
 public Travian(GameVersion version)
 {
     Version = version;
     AI = new AI();
     Servers = new List<Server>();
     StructureData = new XmlDocument();
     //StructureData.Load("structures.xml");
 }
Exemplo n.º 12
0
        public ItemForm( GameVersion version, ItemDat itemDat, TSSFile TSS, T8BTSK.T8BTSK skills, T8BTEMST.T8BTEMST enemies, COOKDAT.COOKDAT cookdat, WRLDDAT.WRLDDAT locations )
        {
            InitializeComponent();

            this.Version = version;
            this.itemDat = itemDat;
            this.TSS = TSS;
            this.Skills = skills;
            this.Enemies = enemies;
            this.Recipes = cookdat;
            this.Locations = locations;
            this.InGameIdDict = TSS.GenerateInGameIdDictionary();

            labels = new List<Label>();
            textboxes = new List<TextBox>();

            for ( int i = 0; i < ItemDatSingle.size / 4; ++i ) {
                Label l = new Label();
                l.Text = "";
                l.Size = new System.Drawing.Size( 100, 20 );
                TextBox b = new TextBox();
                b.Size = new System.Drawing.Size( 50, 20 );
                b.Text = "";

                labels.Add( l );
                textboxes.Add( b );

                FlowLayoutPanel p = new FlowLayoutPanel();
                p.Size = new System.Drawing.Size( 200, 20 );
                p.FlowDirection = FlowDirection.LeftToRight;
                p.Controls.Add( l );
                p.Controls.Add( b );

                switch ( (ItemData)i ) {
                    case ItemData.NamePointer:
                    case ItemData.DescriptionPointer:
                    case ItemData.UnknownTextPointer:
                    case ItemData.TextIDPart1:
                    case ItemData.TextIDPart2:
                    case ItemData.TextIDPart3:
                    case ItemData.TextIDPart4:
                    case ItemData.TextIDPart5:
                    case ItemData.TextIDPart6:
                    case ItemData.TextIDPart7:
                    case ItemData.TextIDPart8:
                        break;
                    default:
                        flowLayoutPanel1.Controls.Add( p );
                        break;
                }
            }

            foreach ( ItemDatSingle i in itemDat.items ) {
                var entry = GetEntry( i.Data[(int)ItemData.NamePointer] );
                listBox1.Items.Add( entry.StringEngOrJpn );
            }
        }
Exemplo n.º 13
0
 public static string GetCategoryName( uint cat, GameVersion version, Dictionary<uint, TSS.TSSEntry> inGameIdDict )
 {
     switch ( cat ) {
         case 6: return inGameIdDict[33912145u].StringEngOrJpnHtml( version );
         case 7: return inGameIdDict[33912144u].StringEngOrJpnHtml( version );
         case 8: return inGameIdDict[33912162u].StringEngOrJpnHtml( version );
         default: return inGameIdDict[33912138u + cat].StringEngOrJpnHtml( version );
     }
 }
 public ArrangementForm(DLCPackageCreator control, GameVersion gameVersion)
     : this(new Arrangement
     {
         SongFile = new SongFile { File = "" },
         SongXml = new SongXML { File = "" },
         ArrangementType = ArrangementType.Guitar
     }, control, gameVersion)
 {
 }
Exemplo n.º 15
0
        public EvolutionTree(byte[][] data, GameVersion game, PersonalTable personal, int maxSpecies)
        {
            Game = game;
            Personal = personal;
            MaxSpecies = maxSpecies;
            switch (game)
            {
                case GameVersion.SM:
                    Entries.AddRange(data.Select(d => new EvolutionSet7(d)));
                    break;
                case GameVersion.ORAS:
                    Entries.AddRange(data.Select(d => new EvolutionSet6(d)));
                    break;
            }
            
            // Create Lineages
            Lineage = new EvolutionLineage[Entries.Count];
            for (int i = 0; i < Entries.Count; i++)
                Lineage[i] = new EvolutionLineage();
            if (Game == GameVersion.ORAS)
                Array.Resize(ref Lineage, maxSpecies + 1);

            // Populate Lineages
            for (int i = 1; i < Lineage.Length; i++)
            {
                // Iterate over all possible evolutions
                var s = Entries[i];
                foreach (EvolutionMethod evo in s.PossibleEvolutions)
                {
                    int index = getIndex(evo);
                    if (index < 0)
                        continue;

                    var sourceEvo = evo.Copy(i);

                    Lineage[index].Insert(sourceEvo);
                    // If current entries has a pre-evolution, propagate to evolution as well
                    if (Lineage[i].Chain.Count > 0)
                        Lineage[index].Insert(Lineage[i].Chain[0]);

                    if (index >= i) continue;
                    // If destination species evolves into something (ie a 'baby' Pokemon like Cleffa)
                    // Add it to the corresponding parent chains
                    foreach (EvolutionMethod mid in Entries[index].PossibleEvolutions)
                    {
                        int newIndex = getIndex(mid);
                        if (newIndex < 0)
                            continue;

                        Lineage[newIndex].Insert(sourceEvo);
                    }
                }
            }
            fixEvoTreeManually();
        }
Exemplo n.º 16
0
        public string GetDataAsHtml( GameVersion version, ItemDat.ItemDat items, Dictionary<uint, TSS.TSSEntry> inGameIdDict, bool phpLinks = false )
        {
            StringBuilder sb = new StringBuilder();

            var item = items.itemIdDict[ItemID];
            sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
            sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon] ) + "\">" );
            sb.Append( inGameIdDict[item.NamePointer].StringEngOrJpnHtml( version ) + "</a>" );

            return sb.ToString();
        }
Exemplo n.º 17
0
 public string GetDataAsHtml( GameVersion version, ItemDat.ItemDat items, TSSFile stringDic, Dictionary<uint, TSSEntry> inGameIdDict, List<SearchPointItem> searchPointItems, bool phpLinks = false )
 {
     StringBuilder sb = new StringBuilder();
     //sb.Append( "Percentage: " ).Append( Percentage ).Append( "%" ).Append( "<br>" );
     for ( uint i = 0; i < SearchPointItemCount; ++i ) {
         //sb.Append( "Item #" ).Append( i ).Append( ":" );
         sb.Append( searchPointItems[(int)( SearchPointItemIndex + i )].GetDataAsHtml( version, items, stringDic, inGameIdDict, phpLinks: phpLinks ) );
         sb.Append( "<br>" );
     }
     return sb.ToString();
 }
Exemplo n.º 18
0
 public static void AppendCharacterBitfieldAsImageString( StringBuilder sb, GameVersion version, uint equip )
 {
     if ( ( equip & 1 ) == 1 ) { sb.Append( "<img src=\"chara-icons/YUR.png\" height=\"32\" width=\"24\" title=\"Yuri\">" ); }
     if ( ( equip & 2 ) == 2 ) { sb.Append( "<img src=\"chara-icons/EST.png\" height=\"32\" width=\"24\" title=\"Estelle\">" ); }
     if ( ( equip & 4 ) == 4 ) { sb.Append( "<img src=\"chara-icons/KAR.png\" height=\"32\" width=\"24\" title=\"Karol\">" ); }
     if ( ( equip & 8 ) == 8 ) { sb.Append( "<img src=\"chara-icons/RIT.png\" height=\"32\" width=\"24\" title=\"Rita\">" ); }
     if ( ( equip & 16 ) == 16 ) { sb.Append( "<img src=\"chara-icons/RAV.png\" height=\"32\" width=\"24\" title=\"Raven\">" ); }
     if ( ( equip & 32 ) == 32 ) { sb.Append( "<img src=\"chara-icons/JUD.png\" height=\"32\" width=\"24\" title=\"Judith\">" ); }
     if ( ( equip & 64 ) == 64 ) { sb.Append( "<img src=\"chara-icons/RAP.png\" height=\"32\" width=\"24\" title=\"Repede\">" ); }
     if ( ( equip & 128 ) == 128 ) { sb.Append( "<img src=\"chara-icons/FRE.png\" height=\"32\" width=\"24\" title=\"Flynn\">" ); }
     if ( version == GameVersion.PS3 && ( equip & 256 ) == 256 ) { sb.Append( "<img src=\"chara-icons/PAT.png\" height=\"32\" width=\"24\" title=\"Patty\">" ); }
 }
Exemplo n.º 19
0
 public Entry Process(GameVersion gameversion)
 {
     Dictionary<int,EntryLoader> loaders = GetLoaders(gameversion);
     if (loaders.ContainsKey(type))
     {
         return loaders[type].Load(((List<byte[]>)Items).ToArray(),EID);
     }
     else
     {
         ErrorManager.SignalError("UnprocessedEntry: Unknown entry type");
         return null;
     }
 }
 private static void FixPaths(DLCPackageData info, string templateDir, GameVersion gameVersion)
 {
     foreach (var arr in info.Arrangements) {
         arr.SongXml.File = Path.Combine(Path.GetDirectoryName(templateDir), arr.SongXml.File);
         if (gameVersion == GameVersion.RS2014)
             UpdateTones(arr);
     }
     info.AlbumArtPath = Path.Combine(Path.GetDirectoryName(templateDir), info.AlbumArtPath);
     if (!String.IsNullOrEmpty(info.OggPath))
         info.OggPath = Path.Combine(Path.GetDirectoryName(templateDir), info.OggPath);
     if (!String.IsNullOrEmpty(info.OggPreviewPath))
         info.OggPreviewPath = Path.Combine(Path.GetDirectoryName(templateDir), info.OggPreviewPath);
 }
Exemplo n.º 21
0
        public void DownloadFileFromServer_Then_Make_Sure_It_Exists()
        {
            //arrange
            var gameVersion = new GameVersion
            {
                Version = 0.4
            };

            //act
            var result = this._gameUpdater.DownloadFileFromServer(gameVersion);

            //assert
            Assert.That(result);
        }
Exemplo n.º 22
0
 public NSFController(NSF nsf,GameVersion gameversion)
 {
     this.nsf = nsf;
     this.gameversion = gameversion;
     Node.Text = "NSF File";
     Node.ImageKey = "nsf";
     Node.SelectedImageKey = "nsf";
     foreach (Chunk chunk in nsf.Chunks)
     {
         if (chunk is NormalChunk)
         {
             AddNode(new NormalChunkController(this,(NormalChunk)chunk));
         }
         else if (chunk is TextureChunk)
         {
             AddNode(new TextureChunkController(this,(TextureChunk)chunk));
         }
         else if (chunk is OldSoundChunk)
         {
             AddNode(new OldSoundChunkController(this,(OldSoundChunk)chunk));
         }
         else if (chunk is SoundChunk)
         {
             AddNode(new SoundChunkController(this,(SoundChunk)chunk));
         }
         else if (chunk is WavebankChunk)
         {
             AddNode(new WavebankChunkController(this,(WavebankChunk)chunk));
         }
         else if (chunk is SpeechChunk)
         {
             AddNode(new SpeechChunkController(this,(SpeechChunk)chunk));
         }
         else if (chunk is UnprocessedChunk)
         {
             AddNode(new UnprocessedChunkController(this,(UnprocessedChunk)chunk));
         }
         else
         {
             throw new NotImplementedException();
         }
     }
     AddMenu("Add Chunk - Normal",Menu_Add_NormalChunk);
     AddMenu("Add Chunk - Sound",Menu_Add_SoundChunk);
     AddMenu("Add Chunk - Wavebank",Menu_Add_WavebankChunk);
     AddMenu("Add Chunk - Speech",Menu_Add_SpeechChunk);
     AddMenuSeparator();
     AddMenu("Fix Nitro Detonators",Menu_Fix_Detonator);
     AddMenu("Fix Box Count",Menu_Fix_BoxCount);
 }
Exemplo n.º 23
0
        public void UpdateVersionInFile_Then_Read_New_Version_Return_Correct_GameVersion()
        {
            //arrange
            var newVersion = 0.5;
            var gameVersionToUpdate = new GameVersion
            {
                Version = newVersion
            };

            //act
            var result = _versionProvider.UpdateVersionInFile(gameVersionToUpdate);

            //assert
            Assert.AreEqual(newVersion, result.Version);
        }
Exemplo n.º 24
0
        public void UpdateGame_When_All_Correct()
        {
            // arrange
            var expectedGameVersion = new GameVersion
            {
                Version = 0.4
            };

            //act
            var result = this._gameUpdater.Update();
            

            // assert
            Assert.That(result.HasSucceed);
            Assert.AreEqual(expectedGameVersion.Version, result.GameVersion.Version);
        }
Exemplo n.º 25
0
Arquivo: SAV4.cs Projeto: kwsch/PKHeX
        public override int MaxGameID => 15; // Colo/XD

        // Checksums
        private static int[][] getCHKOffsets(GameVersion g)
        {
            // start, end, chkoffset
            switch (g)
            {
                case GameVersion.DP:
                    return new[] {new[] {0x0000, 0xC0EC, 0xC0FE}, new[] {0xc100, 0x1E2CC, 0x1E2DE}};
                case GameVersion.Pt:
                    return new[] {new[] {0x0000, 0xCF18, 0xCF2A}, new[] {0xCF2C, 0x1F0FC, 0x1F10E}};
                case GameVersion.HGSS:
                    return new[] {new[] {0x0000, 0xF618, 0xF626}, new[] {0xF700, 0x21A00, 0x21A0E}};
                    
                default:
                    return null;
            }
        }
Exemplo n.º 26
0
        public static String GetButtonName( GameVersion version, ControllerButton button )
        {
            switch ( version ) {
                case GameVersion.X360:
                    switch ( button ) {
                        case ControllerButton.Start: return "Start";
                        case ControllerButton.Select: return "Back";
                        case ControllerButton.RightButton: return "B";
                        case ControllerButton.LowerButton: return "A";
                        case ControllerButton.LeftButton: return "X";
                        case ControllerButton.UpperButton: return "Y";
                        case ControllerButton.L1: return "LB";
                        case ControllerButton.L2: return "LT";
                        case ControllerButton.L3: return "Push LS";
                        case ControllerButton.R1: return "RB";
                        case ControllerButton.R2: return "RT";
                        case ControllerButton.R3: return "Push RS";
                        case ControllerButton.LeftStick: return "Left Stick";
                        case ControllerButton.RightStick: return "Right Stick";
                        case ControllerButton.DPad: return "D-Pad";
                        case ControllerButton.System: return "Guide";
                    }
                    break;
                case GameVersion.PS3:
                    switch ( button ) {
                        case ControllerButton.Start: return "Start";
                        case ControllerButton.Select: return "Select";
                        case ControllerButton.RightButton: return "Circle";
                        case ControllerButton.LowerButton: return "Cross";
                        case ControllerButton.LeftButton: return "Square";
                        case ControllerButton.UpperButton: return "Triangle";
                        case ControllerButton.L1: return "L1";
                        case ControllerButton.L2: return "L2";
                        case ControllerButton.L3: return "L3";
                        case ControllerButton.R1: return "R1";
                        case ControllerButton.R2: return "R2";
                        case ControllerButton.R3: return "R3";
                        case ControllerButton.LeftStick: return "Left Stick";
                        case ControllerButton.RightStick: return "Right Stick";
                        case ControllerButton.DPad: return "D-Pad";
                        case ControllerButton.System: return "PS";
                    }
                    break;
            }

            return "None";
        }
Exemplo n.º 27
0
        public void DownloadFileFromServer_ThenUnzipFileToFolder_DirectoryShouldExists()
        {
            // arrange
            var gameVersion = new GameVersion
            {
                Version = 0.4
            };
            var expectedPathDirectory = string.Format("TestData/my-game-patch-{0}", gameVersion.Version);

            //act
            if (this._gameUpdater.DownloadFileFromServer(gameVersion))
            {
                this._gameUpdater.UnzipDownloadedFiles(gameVersion);
            }

            //assert
        }
Exemplo n.º 28
0
        public string GetDataAsHtml( GameVersion version, TSS.TSSFile stringDic, Dictionary<uint, TSS.TSSEntry> inGameIdDict )
        {
            StringBuilder sb = new StringBuilder();
            sb.Append( "<tr id=\"skill" + InGameID + "\">" );
            //sb.Append( RefString + "<br>" );

            sb.Append( "<td>" );
            sb.Append( "<img src=\"skill-icons/category-" + Category + ".png\" width=\"32\" height=\"32\">" );
            sb.Append( "</td>" );

            sb.Append( "<td class=\"skilljpn\">" );
            sb.Append( "<span class=\"itemname\">" );
            sb.Append( inGameIdDict[NameStringDicID].StringJpnHtml( version ) );
            sb.Append( "</span>" );
            sb.Append( "<br>" );
            sb.Append( inGameIdDict[DescStringDicID].StringJpnHtml( version ) );
            sb.Append( "</td>" );

            sb.Append( "<td>" );
            sb.Append( "<span class=\"itemname\">" );
            sb.Append( inGameIdDict[NameStringDicID].StringEngHtml( version ) );
            sb.Append( "</span>" );
            sb.Append( "<br>" );
            sb.Append( inGameIdDict[DescStringDicID].StringEngHtml( version ) );
            sb.Append( "</td>" );

            sb.Append( "<td class=\"skilldata\">" );
            if ( LearnableByBitmask > 0 ) {
                sb.Append( "<span class=\"equip\">" );
                Website.GenerateWebsite.AppendCharacterBitfieldAsImageString( sb, version, LearnableByBitmask );
                sb.Append( "</span>" );
            }
            sb.Append( EquipCost + "&nbsp;SP<br>" );
            sb.Append( LearnCost + "&nbsp;LP<br>" );
            sb.Append( "Symbol Weight: " + SymbolValue + "<br>" );

            //sb.Append( "~7: " + Unknown7 + "<br>" );
            //sb.Append( "~13: " + Unknown13 + "<br>" );
            //sb.Append( "~14: " + Unknown14 + "<br>" );
            //sb.Append( "~15: " + Unknown15 + "<br>" );
            if ( Inactive == 0 ) { sb.Append( "Unusable<br>" ); }
            sb.Append( "</td>" );
            sb.Append( "</tr>" );
            return sb.ToString();
        }
Exemplo n.º 29
0
        public string GetDataAsHtml( GameVersion version, TSS.TSSFile stringDic, Dictionary<uint, TSS.TSSEntry> inGameIdDict )
        {
            StringBuilder sb = new StringBuilder();
            sb.Append( "<td>" );

            sb.Append( "<span class=\"itemname\">" );
            sb.Append( inGameIdDict[NameStringDicId].StringJpnHtml( version ) );
            sb.Append( "</span><br>" );
            sb.Append( inGameIdDict[TextStringDicId].StringJpnHtml( version ) );
            sb.Append( "</td>" );
            sb.Append( "<td>" );
            sb.Append( "<span class=\"itemname\">" );
            sb.Append( inGameIdDict[NameStringDicId].StringEngHtml( version ) );
            sb.Append( "</span><br>" );
            sb.Append( inGameIdDict[TextStringDicId].StringEngHtml( version ) );
            sb.Append( "</td>" );
            return sb.ToString();
        }
        // old fashioned but reliable way to load xml file to list object
        public static List<TuningDefinition> LoadFile(string fileName, GameVersion gameVersion)
        {
            List<TuningDefinition> tuningDefinitionsFiltered = new List<TuningDefinition>();

            using (FileStream stream = File.OpenRead(fileName))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(List<TuningDefinition>));
                List<TuningDefinition> tuningDefinitions = (List<TuningDefinition>)serializer.Deserialize(stream);

                foreach (var tuningDefinition in tuningDefinitions)
                {
                    if (tuningDefinition.GameVersion == gameVersion)
                        tuningDefinitionsFiltered.Add(tuningDefinition);
                }
            }

            return tuningDefinitionsFiltered;
        }
 public IEnumerable <TuningDefinition> Select(GameVersion gameVersion)
 {
     return(List.Where(s => s.GameVersion == gameVersion));
 }
Exemplo n.º 32
0
 private static bool HasOtherGamePair(GameVersion ver)
 {
     return(ver < GameVersion.GP); // lgpe and sw/sh don't have a sister pair
 }
Exemplo n.º 33
0
    private static void PlayerLoad(string save_name)
    {
        if (SaveGame.m_State != SaveGame.State.None)
        {
            Debug.LogWarning("Can't load, state = " + SaveGame.m_State.ToString());
            return;
        }
        Debug.Log("PLAYER_LOAD - " + save_name);
        SaveGame.m_State = SaveGame.State.Load;
        SaveGame.m_IVals.Clear();
        SaveGame.m_SVals.Clear();
        SaveGame.m_FVals.Clear();
        SaveGame.m_BVals.Clear();
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        int             fileSize        = GreenHellGame.Instance.m_RemoteStorage.GetFileSize(save_name);

        byte[] array = new byte[fileSize];
        GreenHellGame.Instance.m_RemoteStorage.FileRead(save_name, array, fileSize);
        MemoryStream memoryStream = new MemoryStream(array);
        GameVersion  gameVersion  = new GameVersion((GameVersion)binaryFormatter.Deserialize(memoryStream));

        SaveGame.m_SaveGameVersion = gameVersion;
        GameMode gameMode = (GameMode)binaryFormatter.Deserialize(memoryStream);
        long     num      = (long)binaryFormatter.Deserialize(memoryStream);
        int      num2     = (int)binaryFormatter.Deserialize(memoryStream);
        int      num3     = (int)binaryFormatter.Deserialize(memoryStream);

        if (gameVersion < GreenHellGame.s_GameVersionEarlyAccessUpdate13 && num3 >= 0 && num3 < 6)
        {
            DifficultySettings.SetActivePresetType((DifficultySettings.PresetType)num3);
        }
        if (gameVersion >= GreenHellGame.s_GameVersionEarlyAccessUpdate8)
        {
            bool flag = (bool)binaryFormatter.Deserialize(memoryStream);
        }
        if (gameVersion >= GreenHellGame.s_GameVersionEarlyAccessUpdate12 && gameVersion < GreenHellGame.s_GameVersionEarlyAccessUpdate13 && (bool)binaryFormatter.Deserialize(memoryStream))
        {
            DifficultySettings.SetActivePresetType(DifficultySettings.PresetType.PermaDeath);
        }
        if (gameVersion >= GreenHellGame.s_GameVersionEarlyAccessUpdate13)
        {
            bool flag2 = (bool)binaryFormatter.Deserialize(memoryStream);
        }
        try
        {
            if (gameVersion >= GreenHellGame.s_GameVersionMasterShelters1_3)
            {
                bool flag3 = (bool)binaryFormatter.Deserialize(memoryStream);
                P2PSession.Instance.SetSessionId((string)binaryFormatter.Deserialize(memoryStream));
            }
        }
        catch
        {
        }
        SaveGame.m_IVals = (Dictionary <string, int>)binaryFormatter.Deserialize(memoryStream);
        SaveGame.m_SVals = (Dictionary <string, string>)binaryFormatter.Deserialize(memoryStream);
        SaveGame.m_FVals = (Dictionary <string, float>)binaryFormatter.Deserialize(memoryStream);
        SaveGame.m_BVals = (Dictionary <string, bool>)binaryFormatter.Deserialize(memoryStream);
        memoryStream.Close();
        Player.Get().Load();
        GreenHellGame.Instance.m_LoadGameState = LoadGameState.PreloadCompleted;
        SaveGame.m_State = SaveGame.State.None;
    }
Exemplo n.º 34
0
        public static IEnumerable <EncounterSlot> GetPossible(PKM pkm, IReadOnlyList <DexLevel> chain, GameVersion gameSource = GameVersion.Any)
        {
            var possibleAreas = GetAreasByGame(pkm, gameSource);

            return(possibleAreas.SelectMany(area => area.Slots).Where(z => chain.Any(v => v.Species == z.Species)));
        }
Exemplo n.º 35
0
 internal static IEnumerable <int> GetValidRelearn(PKM pkm, int species, int form, GameVersion version = GameVersion.Any)
 {
     return(GetValidRelearn(pkm, species, form, GetCanInheritMoves(species), version));
 }
Exemplo n.º 36
0
        /// <summary>Determines the Version Grouping of an input Version ID</summary>
        /// <param name="Version">Version of which to determine the group</param>
        /// <returns>Version Group Identifier or Invalid if type cannot be determined.</returns>
        public static GameVersion GetMetLocationVersionGroup(GameVersion Version)
        {
            switch (Version)
            {
            case GameVersion.CXD:
                return(GameVersion.CXD);

            case GameVersion.GO:
                return(GameVersion.GO);

            case GameVersion.RBY:
            case GameVersion.RD:
            case GameVersion.BU:
            case GameVersion.YW:
            case GameVersion.GN:
                return(GameVersion.RBY);

            case GameVersion.GS:
            case GameVersion.GD:
            case GameVersion.SV:
            case GameVersion.C:
                return(GameVersion.GSC);

            case GameVersion.R:
            case GameVersion.S:
                return(GameVersion.RS);

            case GameVersion.E:
                return(GameVersion.E);

            case GameVersion.FR:
            case GameVersion.LG:
                return(GameVersion.FR);

            case GameVersion.D:
            case GameVersion.P:
                return(GameVersion.DP);

            case GameVersion.Pt:
                return(GameVersion.Pt);

            case GameVersion.HG:
            case GameVersion.SS:
                return(GameVersion.HGSS);

            case GameVersion.B:
            case GameVersion.W:
                return(GameVersion.BW);

            case GameVersion.B2:
            case GameVersion.W2:
                return(GameVersion.B2W2);

            case GameVersion.X:
            case GameVersion.Y:
                return(GameVersion.XY);

            case GameVersion.OR:
            case GameVersion.AS:
                return(GameVersion.ORAS);

            case GameVersion.SN:
            case GameVersion.MN:
                return(GameVersion.SM);

            case GameVersion.US:
            case GameVersion.UM:
                return(GameVersion.USUM);

            default:
                return(GameVersion.Invalid);
            }
        }
Exemplo n.º 37
0
        internal static IEnumerable <int> GetValidRelearn(PKM pkm, int species, int form, bool inheritlvlmoves, GameVersion version = GameVersion.Any)
        {
            var r = new List <int> {
                0
            };

            if (pkm.GenNumber < 6)
            {
                return(r);
            }

            r.AddRange(MoveEgg.GetRelearnLVLMoves(pkm, species, 1, form, version));

            if (pkm.Format == 6 && pkm.Species != 678)
            {
                form = 0;
            }

            r.AddRange(MoveEgg.GetEggMoves(pkm, species, form, version));
            if (inheritlvlmoves)
            {
                r.AddRange(MoveEgg.GetRelearnLVLMoves(pkm, species, 100, form, version));
            }
            return(r.Distinct());
        }
Exemplo n.º 38
0
        /// <summary>
        /// Creates an instance of a SaveFile with a blank base.
        /// </summary>
        /// <param name="game">Version to create the save file for.</param>
        /// <returns>Blank save file from the requested game, null if no game exists for that <see cref="GameVersion"/>.</returns>
        private static SaveFile GetBlankSAV(GameVersion game)
        {
            switch (game)
            {
            case RD:
            case BU:
            case GN:
            case YW:
            case RBY:
                return(new SAV1(version: game));

            case GS:
            case GD:
            case SV:
                return(new SAV2(version: GS));

            case GSC:
            case C:
                return(new SAV2(version: C));

            case R:
            case S:
            case E:
            case FR:
            case LG:
                return(new SAV3(version: game));

            case FRLG:
                return(new SAV3(version: FR));

            case RS:
                return(new SAV3(version: R));

            case RSE:
                return(new SAV3(version: E));

            case CXD:
            case COLO:
                return(new SAV3Colosseum());

            case XD:
                return(new SAV3XD());

            case RSBOX:
                return(new SAV3RSBox());

            case D:
            case P:
            case DP:
            case DPPt:
                return(new SAV4DP());

            case Pt:
                return(new SAV4Pt());

            case HG:
            case SS:
            case HGSS:
                return(new SAV4HGSS());

            case B:
            case W:
            case BW:
                return(new SAV5BW());

            case B2:
            case W2:
            case B2W2:
                return(new SAV5B2W2());

            case X:
            case Y:
            case XY:
                return(new SAV6XY());

            case ORASDEMO:
                return(new SAV6AODemo());

            case OR:
            case AS:
            case ORAS:
                return(new SAV6AO());

            case SN:
            case MN:
            case SM:
                return(new SAV7SM());

            case US:
            case UM:
            case USUM:
                return(new SAV7USUM());

            case GO:
            case GP:
            case GE:
            case GG:
                return(new SAV7b());

            case SW:
            case SH:
            case SWSH:
                return(new SAV8SWSH());

            default:
                throw new ArgumentException(nameof(game));
            }
        }
Exemplo n.º 39
0
        public PKM ConvertToPKM(ITrainerInfo SAV)
        {
            int gen = Version.GetGeneration();

            if (gen < 2)
            {
                gen     = 2;
                Version = GameVersion.C;
            }
            var pk = PKMConverter.GetBlank(gen, Version);

            SAV.ApplyToPKM(pk);

            pk.Species      = Species;
            pk.Nickname     = PKX.GetSpeciesNameGeneration(Species, SAV.Language, gen);
            pk.CurrentLevel = Level;
            pk.Version      = (int)Version;
            int[] moves = GetCurrentEggMoves(pk);
            pk.Moves = moves;
            pk.SetMaximumPPCurrent(moves);
            pk.OT_Friendship = pk.PersonalInfo.BaseFriendship;

            pk.SetRandomIVs(flawless: 3);

            if (pk.Format <= 2 && Version != GameVersion.C)
            {
                return(pk);
            }

            pk.Met_Level    = EncounterSuggestion.GetSuggestedEncounterEggMetLevel(pk);
            pk.Met_Location = Math.Max(0, EncounterSuggestion.GetSuggestedEggMetLocation(pk));

            if (pk.Format < 3)
            {
                return(pk);
            }

            pk.Ball = 4;

            int gender = pk.PersonalInfo.RandomGender;
            int nature = Util.Rand.Next(25);

            if (pk.Format <= 5)
            {
                pk.SetPIDGender(gender);
                pk.Gender = gender;
                pk.SetPIDNature(nature);
                pk.Nature = nature;
                pk.RefreshAbility(pk.PIDAbility);
            }
            else
            {
                pk.PID    = Util.Rand32();
                pk.Nature = nature;
                pk.Gender = gender;
                pk.RefreshAbility(Util.Rand.Next(2));
            }

            bool traded = (int)Version == SAV.Game;
            var  today  = pk.MetDate = DateTime.Today;

            if (pk.GenNumber >= 4)
            {
                pk.Egg_Location = EncounterSuggestion.GetSuggestedEncounterEggLocationEgg(pk, traded);
                pk.EggMetDate   = today;
            }

            if (pk.Format < 6)
            {
                return(pk);
            }
            if (pk.Gen6)
            {
                pk.SetHatchMemory6();
            }

            switch (Species)
            {
            case 774:     // Minior
                pk.AltForm = Util.Rand.Next(7, 14);
                break;

            case 664:     // Scatterbug
                pk.AltForm = Legal.GetVivillonPattern(SAV.Country, SAV.SubRegion);
                break;
            }

            pk.SetRandomEC();
            pk.RelearnMoves = moves;

            return(pk);
        }
Exemplo n.º 40
0
 public EncounterGift(GameVersion gameVersion) : base(gameVersion)
 {
 }
Exemplo n.º 41
0
 public GameInfo(GameVersion game)
 {
     Game       = game;
     Generation = game.GetGeneration();
     GetInitMethod(game)();
 }
Exemplo n.º 42
0
    // Build GAME.DAT using files from the specified directory
    public static void Build(string executable, string inDir, string gameDat)
    {
        Console.Write("\nBuilding ...");

        using (FileStream exeStream = File.Open(executable, FileMode.Open, FileAccess.ReadWrite))
        {
            // Determine the game version
            GameVersion gameVersion = GameVersion.Unknown;
            if (exeStream.Length == 2678816) // Wii version
            {
                gameVersion = GameVersion.Wii;
            }
            else if (exeStream.Length == 2716853) // PSP version
            {
                gameVersion = GameVersion.PSP;
            }
            else
            {
                return;
            }

            uint numFiles = 0;
            if (gameVersion == GameVersion.Wii)
            {
                exeStream.Position = 0x18A058;
            }
            else if (gameVersion == GameVersion.PSP)
            {
                exeStream.Position = 0x1978FC;
            }

            // Get the number of files in the file entry table
            exeStream.Position += 20;
            if (gameVersion == GameVersion.Wii)
            {
                numFiles            = PTStream.ReadUInt32BE(exeStream);
                exeStream.Position += 152; // Now go to the position of the first file in the file entry table
            }
            else if (gameVersion == GameVersion.PSP)
            {
                numFiles            = PTStream.ReadUInt32(exeStream);
                exeStream.Position += 136; // Now go to the position of the first file in the file entry table
            }

            string[] fileList = new string[numFiles];

            Console.WriteLine(" " + numFiles + " files detected.");

            // Now let's make sure all the files exist
            for (uint i = 0; i < numFiles; i++)
            {
                string[] file = Directory.GetFiles(inDir, i.ToString("D4") + ".*");
                if (file.Length == 0)
                {
                    Console.WriteLine("{0} does not exist. Terminating.", i.ToString("D4"));
                    return;
                }
                else if (file.Length > 1)
                {
                    Console.WriteLine("Multiple copies of {0} exist. Terminating.", i.ToString("D4"));
                    return;
                }

                fileList[i] = file[0];
            }

            // Ok, looks like we're good. Let's build GAME.DAT
            using (FileStream gameDatStream = File.Create(gameDat))
            {
                uint offset = 0;
                for (uint i = 0; i < numFiles; i++)
                {
                    Console.Write("Adding file " + Path.GetFileName(fileList[i]) + " ... ");

                    // Go to the next file entry
                    NextFileEntry(exeStream);

                    exeStream.Position += 4;

                    using (FileStream inStream = File.OpenRead(fileList[i]))
                    {
                        if (gameVersion == GameVersion.Wii)
                        {
                            PTStream.WriteUInt32BE(exeStream, offset);
                            PTStream.WriteUInt32BE(exeStream, (uint)inStream.Length);
                        }
                        else if (gameVersion == GameVersion.PSP)
                        {
                            PTStream.WriteUInt32(exeStream, offset);
                            PTStream.WriteUInt32(exeStream, (uint)inStream.Length);
                        }

                        PTStream.CopyPartToPadded(inStream, gameDatStream, (int)inStream.Length, 2048, 0);

                        offset += (uint)PTMethods.RoundUp((int)inStream.Length, 2048);
                    }

                    exeStream.Position += 12;

                    Console.WriteLine("OK");
                }
            }
        }
    }
Exemplo n.º 43
0
        internal static List <int> GetValidPostEvolutionMoves(PKM pkm, int species, IReadOnlyList <EvoCriteria>[] evoChains, GameVersion Version)
        {
            // Return moves that the pokemon could learn after evolving
            var moves = new List <int>();

            for (int i = 1; i < evoChains.Length; i++)
            {
                if (evoChains[i].Count != 0)
                {
                    moves.AddRange(GetValidPostEvolutionMoves(pkm, species, evoChains[i], i, Version));
                }
            }

            if (pkm.GenNumber >= 6)
            {
                moves.AddRange(pkm.RelearnMoves.Where(m => m != 0));
            }
            return(moves.Distinct().ToList());
        }
Exemplo n.º 44
0
        private static bool InnerBruteForce(PKM pk, GameVersion game, bool shiny, int abilitynum, IBattleTemplate set)
        {
            pk.ClearRelearnMoves();
            switch (game)
            {
            case GameVersion.RD:
            case GameVersion.BU:
            case GameVersion.YW:
            case GameVersion.GN:
                pk.Met_Location = 30013;
                pk.Met_Level    = 100;
                break;

            case GameVersion.GD:
            case GameVersion.SV:
            case GameVersion.C:
                pk.Met_Location = 30017;
                pk.Met_Level    = 100;
                break;

            case GameVersion.CXD:
                pk.Met_Location = 30001;
                pk.Met_Level    = 100;
                break;

            default:
                try
                {
                    pk.SetSuggestedMetLocation();
                }
                catch { }
                break;
            }
            try
            {
                pk.SetSuggestedRelearnMoves();
            }
            catch { }
            pk.CurrentHandler = 1;
            pk.HT_Name        = "Archit";
            pk.PID            = PKX.GetRandomPID(Util.Rand, pk.Species, pk.Gender, pk.Version, pk.Nature, pk.Format, (uint)(pk.AbilityNumber * 0x10001));
            if (shiny)
            {
                pk.SetShiny();
            }
            if (pk.PID == 0)
            {
                pk.PID = PKX.GetRandomPID(Util.Rand, pk.Species, pk.Gender, pk.Version, pk.Nature, pk.Format, (uint)(pk.AbilityNumber * 0x10001));
                if (shiny)
                {
                    pk.SetShiny();
                }
            }

            pk.RefreshAbility(abilitynum);
            pk.SetSuggestedMemories();
            if (pk.GenNumber < 6)
            {
                pk.EncryptionConstant = pk.PID;
            }

            if (CommonErrorHandling2(pk))
            {
                pk.HyperTrain();
                if (shiny)
                {
                    pk.SetShiny();
                }
                return(true);
            }

            pk.HyperTrain();
            bool legalized = new LegalityAnalysis(pk).Valid;

            AlternateAbilityRefresh(pk);
            if (pk.GenNumber < 6 && !legalized)
            {
                pk.EncryptionConstant = pk.PID;
            }

            if (new LegalityAnalysis(pk).Valid&& pk.Format >= pk.GenNumber)
            {
                pk.SetFriendship(new LegalityAnalysis(pk).EncounterMatch);
                if (shiny && pk.IsShiny)
                {
                    return(true);
                }
                if (!set.Shiny || pk.IsShiny)
                {
                    return(true);
                }

                pk.SetShinySID();
                if (new LegalityAnalysis(pk).Valid)
                {
                    return(true);
                }

                pk.SetShiny();
                if (new LegalityAnalysis(pk).Valid)
                {
                    return(true);
                }
            }
            else
            {
                var edge = EncounterMovesetGenerator.GenerateEncounters(pk).OfType <EncounterStatic>();
                foreach (EncounterStatic el in edge)
                {
                    ApplyEncounterAttributes(pk, set, el);
                    var la = new LegalityAnalysis(pk);
                    if (la.Valid)
                    {
                        return(true);
                    }
                    Debug.WriteLine(la.Report());
                }
            }

            return(false);
        }
Exemplo n.º 45
0
        internal static int[] GetBaseEggMoves(PKM pkm, int species, int form, GameVersion gameSource, int lvl)
        {
            if (gameSource == GameVersion.Any)
            {
                gameSource = (GameVersion)pkm.Version;
            }

            switch (gameSource)
            {
            case GameVersion.GSC:
            case GameVersion.GS:
                // If checking back-transfer specimen (GSC->RBY), remove moves that must be deleted prior to transfer
                int[] getRBYCompatibleMoves(int[] moves) => pkm.Format == 1 ? moves.Where(m => m <= MaxMoveID_1).ToArray() : moves;

                if (pkm.InhabitedGeneration(2))
                {
                    return(getRBYCompatibleMoves(LevelUpGS[species].GetMoves(lvl)));
                }
                break;

            case GameVersion.C:
                if (pkm.InhabitedGeneration(2))
                {
                    return(getRBYCompatibleMoves(LevelUpC[species].GetMoves(lvl)));
                }
                break;

            case GameVersion.R:
            case GameVersion.S:
            case GameVersion.RS:
                if (pkm.InhabitedGeneration(3))
                {
                    return(LevelUpRS[species].GetMoves(lvl));
                }
                break;

            case GameVersion.E:
                if (pkm.InhabitedGeneration(3))
                {
                    return(LevelUpE[species].GetMoves(lvl));
                }
                break;

            case GameVersion.FR:
            case GameVersion.LG:
            case GameVersion.FRLG:
                // only difference in FR/LG is deoxys which doesn't breed.
                if (pkm.InhabitedGeneration(3))
                {
                    return(LevelUpFR[species].GetMoves(lvl));
                }
                break;

            case GameVersion.D:
            case GameVersion.P:
            case GameVersion.DP:
                if (pkm.InhabitedGeneration(4))
                {
                    return(LevelUpDP[species].GetMoves(lvl));
                }
                break;

            case GameVersion.Pt:
                if (pkm.InhabitedGeneration(4))
                {
                    return(LevelUpPt[species].GetMoves(lvl));
                }
                break;

            case GameVersion.HG:
            case GameVersion.SS:
            case GameVersion.HGSS:
                if (pkm.InhabitedGeneration(4))
                {
                    return(LevelUpHGSS[species].GetMoves(lvl));
                }
                break;

            case GameVersion.B:
            case GameVersion.W:
            case GameVersion.BW:
                if (pkm.InhabitedGeneration(5))
                {
                    return(LevelUpBW[species].GetMoves(lvl));
                }
                break;

            case GameVersion.B2:
            case GameVersion.W2:
            case GameVersion.B2W2:
                if (pkm.InhabitedGeneration(5))
                {
                    return(LevelUpB2W2[species].GetMoves(lvl));
                }
                break;

            case GameVersion.X:
            case GameVersion.Y:
            case GameVersion.XY:
                if (pkm.InhabitedGeneration(6))
                {
                    return(LevelUpXY[species].GetMoves(lvl));
                }
                break;

            case GameVersion.AS:
            case GameVersion.OR:
            case GameVersion.ORAS:
                if (pkm.InhabitedGeneration(6))
                {
                    return(LevelUpAO[species].GetMoves(lvl));
                }
                break;

            case GameVersion.SN:
            case GameVersion.MN:
            case GameVersion.SM:
                if (species > MaxSpeciesID_7)
                {
                    break;
                }
                if (pkm.InhabitedGeneration(7))
                {
                    int index = PersonalTable.SM.GetFormeIndex(species, form);
                    return(LevelUpSM[index].GetMoves(lvl));
                }
                break;

            case GameVersion.US:
            case GameVersion.UM:
            case GameVersion.USUM:
                if (pkm.InhabitedGeneration(7))
                {
                    int index = PersonalTable.USUM.GetFormeIndex(species, form);
                    return(LevelUpUSUM[index].GetMoves(lvl));
                }
                break;

            case GameVersion.SW:
            case GameVersion.SH:
            case GameVersion.SWSH:
                if (pkm.InhabitedGeneration(8))
                {
                    int index = PersonalTable.SWSH.GetFormeIndex(species, form);
                    return(LevelUpSWSH[index].GetMoves(lvl));
                }
                break;
            }
            return(Array.Empty <int>());
        }
Exemplo n.º 46
0
        private static CheckMoveResult[] ParseMovesForEncounters(PKM pkm, LegalInfo info, GameVersion game, int[] Moves)
        {
            if (pkm.Species == 235)                              // special handling for Smeargle
            {
                return(ParseMovesForSmeargle(pkm, Moves, info)); // Smeargle can have any moves except a few
            }
            // Iterate over encounters
            bool pre3DS = info.Generation < 6;

            // gather valid moves for encounter species
            info.EncounterMoves = new ValidEncounterMoves(pkm, info);

            if (info.Generation <= 3)
            {
                pkm.WasEgg = info.EncounterMatch.EggEncounter;
            }

            var EncounterMatchGen   = info.EncounterMatch as IGeneration;
            var defaultG1LevelMoves = info.EncounterMoves.LevelUpMoves[1];
            var defaultG2LevelMoves = pkm.InhabitedGeneration(2) ? info.EncounterMoves.LevelUpMoves[2] : null;
            var defaultTradeback    = pkm.TradebackStatus;

            if (EncounterMatchGen != null)
            {
                // Generation 1 can have different minimum level in different encounter of the same species; update valid level moves
                UptateGen1LevelUpMoves(pkm, info.EncounterMoves, info.EncounterMoves.MinimumLevelGen1, EncounterMatchGen.Generation, info);

                // The same for Generation 2; if move reminder from Stadium 2 is not allowed
                if (!Legal.AllowGen2MoveReminder(pkm) && pkm.InhabitedGeneration(2))
                {
                    UptateGen2LevelUpMoves(pkm, info.EncounterMoves, info.EncounterMoves.MinimumLevelGen2, EncounterMatchGen.Generation, info);
                }
            }

            var res = pre3DS
                ? ParseMovesPre3DS(pkm, Moves, info)
                : ParseMoves3DS(pkm, Moves, info);

            if (res.All(x => x.Valid))
            {
                return(res);
            }

            if (EncounterMatchGen?.Generation == 1 || EncounterMatchGen?.Generation == 2) // not valid, restore generation 1 and 2 moves
            {
                info.EncounterMoves.LevelUpMoves[1] = defaultG1LevelMoves;
                if (pkm.InhabitedGeneration(2))
                {
                    info.EncounterMoves.LevelUpMoves[2] = defaultG2LevelMoves;
                }
            }
            pkm.TradebackStatus = defaultTradeback;
            return(res);
        }
Exemplo n.º 47
0
 private static IEnumerable <EncounterArea> GetAreasByGame(PKM pkm, GameVersion gameSource) => gameSource switch
 {
Exemplo n.º 48
0
        /// <summary>
        /// User is done. Start cloning or faking, depending on the clicked radio button.
        /// Close the window if everything went right.
        /// </summary>
        private async void buttonOK_Click(object sender, EventArgs e)
        {
            string existingPath = textBoxClonePath.Text;
            string newName      = textBoxNewName.Text;
            string newPath      = textBoxNewPath.Text;

            // Do some basic checks.
            if (String.IsNullOrWhiteSpace(newName))
            {
                user.RaiseError(Properties.Resources.CloneFakeKspDialogEnterName);
                return;
            }
            if (String.IsNullOrWhiteSpace(newPath))
            {
                user.RaiseError(Properties.Resources.CloneFakeKspDialogEnterPath);
                return;
            }

            // Show progress bar and deactivate controls.
            progressBar.Style = ProgressBarStyle.Marquee;
            progressBar.Show();
            foreach (Control ctrl in this.Controls)
            {
                ctrl.Enabled = false;
            }

            // Clone the specified instance.
            // Done in a new task to not block the GUI thread.
            if (radioButtonClone.Checked)
            {
                user.RaiseMessage(Properties.Resources.CloneFakeKspDialogCloningInstance);

                try
                {
                    GameInstance instanceToClone = null;
                    if (!manager.Instances.TryGetValue(comboBoxKnownInstance.SelectedItem as string, out instanceToClone) ||
                        existingPath != instanceToClone.GameDir().Replace('/', Path.DirectorySeparatorChar))
                    {
                        IGame sourceGame = manager.DetermineGame(new DirectoryInfo(existingPath), user);
                        if (sourceGame == null)
                        {
                            // User cancelled, let them try again
                            reactivateDialog();
                            return;
                        }
                        instanceToClone = new GameInstance(
                            sourceGame,
                            existingPath,
                            "irrelevant",
                            user
                            );
                    }
                    await Task.Run(() =>
                    {
                        if (instanceToClone.Valid)
                        {
                            manager.CloneInstance(instanceToClone, newName, newPath);
                        }
                        else
                        {
                            throw new NotKSPDirKraken(instanceToClone.GameDir());
                        }
                    });
                }
                catch (InstanceNameTakenKraken)
                {
                    user.RaiseError(Properties.Resources.CloneFakeKspDialogNameAlreadyUsed);
                    reactivateDialog();
                    return;
                }
                catch (NotKSPDirKraken kraken)
                {
                    user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogInstanceNotValid, kraken.path.Replace('/', Path.DirectorySeparatorChar)));
                    reactivateDialog();
                    return;
                }
                catch (PathErrorKraken kraken)
                {
                    user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogDestinationNotEmpty, kraken.path.Replace('/', Path.DirectorySeparatorChar)));
                    reactivateDialog();
                    return;
                }
                catch (IOException ex)
                {
                    user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogCloneFailed, ex.Message));
                    reactivateDialog();
                    return;
                }
                catch (Exception ex)
                {
                    user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogCloneFailed, ex.Message));
                    reactivateDialog();
                    return;
                }

                if (checkBoxSetAsDefault.Checked)
                {
                    manager.SetAutoStart(newName);
                }

                if (checkBoxSwitchInstance.Checked)
                {
                    manager.SetCurrentInstance(newName);
                }

                user.RaiseMessage(Properties.Resources.CloneFakeKspDialogSuccessfulClone);

                DialogResult = DialogResult.OK;
                this.Close();
            }

            // Create a new dummy instance.
            // Also in a separate task.
            else if (radioButtonFake.Checked)
            {
                GameVersion GameVersion = GameVersion.Parse(comboBoxGameVersion.Text);

                Dictionary <DLC.IDlcDetector, GameVersion> dlcs = new Dictionary <DLC.IDlcDetector, GameVersion>();
                if (!String.IsNullOrWhiteSpace(textBoxMHDlcVersion.Text) && textBoxMHDlcVersion.Text.ToLower() != "none")
                {
                    if (GameVersion.TryParse(textBoxMHDlcVersion.Text, out GameVersion ver))
                    {
                        dlcs.Add(new DLC.MakingHistoryDlcDetector(), ver);
                    }
                    else
                    {
                        user.RaiseError(Properties.Resources.CloneFakeKspDialogDlcVersionMalformatted, "Making History");
                        reactivateDialog();
                        return;
                    }
                }
                if (!String.IsNullOrWhiteSpace(textBoxBGDlcVersion.Text) && textBoxBGDlcVersion.Text.ToLower() != "none")
                {
                    if (GameVersion.TryParse(textBoxBGDlcVersion.Text, out GameVersion ver))
                    {
                        dlcs.Add(new DLC.BreakingGroundDlcDetector(), ver);
                    }
                    else
                    {
                        user.RaiseError(Properties.Resources.CloneFakeKspDialogDlcVersionMalformatted, "Breaking Ground");
                        reactivateDialog();
                        return;
                    }
                }

                user.RaiseMessage(Properties.Resources.CloneFakeKspDialogCreatingInstance);

                try
                {
                    await Task.Run(() =>
                    {
                        manager.FakeInstance(new KerbalSpaceProgram(), newName, newPath, GameVersion, dlcs);
                    });
                }
                catch (InstanceNameTakenKraken)
                {
                    user.RaiseError(Properties.Resources.CloneFakeKspDialogNameAlreadyUsed);
                    reactivateDialog();
                    return;
                }
                catch (BadInstallLocationKraken)
                {
                    user.RaiseError(Properties.Resources.CloneFakeKspDialogDestinationNotEmpty, newPath);
                    reactivateDialog();
                    return;
                }
                catch (Exception ex)
                {
                    user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogFakeFailed, ex.Message));
                    reactivateDialog();
                    return;
                }

                if (checkBoxSetAsDefault.Checked)
                {
                    manager.SetAutoStart(newName);
                }

                if (checkBoxSwitchInstance.Checked)
                {
                    manager.SetCurrentInstance(newName);
                }

                user.RaiseMessage(Properties.Resources.CloneFakeKspDialogSuccessfulCreate);

                DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Exemplo n.º 49
0
 public static IEnumerable <EncounterStatic> GetPossibleGBGifts(PKM pkm, IReadOnlyList <DexLevel> chain, GameVersion gameSource = GameVersion.Any)
 {
     if (gameSource == GameVersion.Any)
     {
         gameSource = (GameVersion)pkm.Version;
     }
Exemplo n.º 50
0
    public static void FullLoad(string save_name)
    {
        if (SaveGame.m_State != SaveGame.State.None)
        {
            Debug.LogWarning("Can't load, state = " + SaveGame.m_State.ToString());
            return;
        }
        if (!GreenHellGame.Instance.FileExistsInRemoteStorage(save_name))
        {
            DebugUtils.Assert("SaveGame::FullLoad - file doesn't exists in remote storage " + save_name, true, DebugUtils.AssertType.Info);
            return;
        }
        Debug.Log("FULL_LOAD - " + save_name);
        MainLevel.Instance.ResetGameBeforeLoad();
        SaveGame.m_State = SaveGame.State.Load;
        SaveGame.SetupObjects();
        SaveGame.m_IVals.Clear();
        SaveGame.m_SVals.Clear();
        SaveGame.m_FVals.Clear();
        SaveGame.m_BVals.Clear();
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        int             fileSize        = GreenHellGame.Instance.m_RemoteStorage.GetFileSize(save_name);

        byte[] array = new byte[fileSize];
        GreenHellGame.Instance.m_RemoteStorage.FileRead(save_name, array, fileSize);
        MemoryStream memoryStream = new MemoryStream(array);
        GameVersion  gameVersion  = new GameVersion((GameVersion)binaryFormatter.Deserialize(memoryStream));

        SaveGame.m_SaveGameVersion = gameVersion;
        GameMode gameMode = (GameMode)binaryFormatter.Deserialize(memoryStream);
        long     num      = (long)binaryFormatter.Deserialize(memoryStream);
        int      num2     = (int)binaryFormatter.Deserialize(memoryStream);
        int      num3     = (int)binaryFormatter.Deserialize(memoryStream);

        if (gameVersion < GreenHellGame.s_GameVersionEarlyAccessUpdate13 && num3 >= 0 && num3 < 6)
        {
            DifficultySettings.SetActivePresetType((DifficultySettings.PresetType)num3);
        }
        if (gameVersion >= GreenHellGame.s_GameVersionEarlyAccessUpdate8)
        {
            bool flag = (bool)binaryFormatter.Deserialize(memoryStream);
        }
        if (gameVersion >= GreenHellGame.s_GameVersionEarlyAccessUpdate12 && gameVersion < GreenHellGame.s_GameVersionEarlyAccessUpdate13 && (bool)binaryFormatter.Deserialize(memoryStream))
        {
            DifficultySettings.SetActivePresetType(DifficultySettings.PresetType.PermaDeath);
        }
        if (gameVersion >= GreenHellGame.s_GameVersionEarlyAccessUpdate13)
        {
            bool flag2 = (bool)binaryFormatter.Deserialize(memoryStream);
        }
        try
        {
            if (gameVersion >= GreenHellGame.s_GameVersionMasterShelters1_3)
            {
                bool flag3 = (bool)binaryFormatter.Deserialize(memoryStream);
                P2PSession.Instance.SetSessionId((string)binaryFormatter.Deserialize(memoryStream));
            }
        }
        catch
        {
        }
        SaveGame.m_IVals = (Dictionary <string, int>)binaryFormatter.Deserialize(memoryStream);
        SaveGame.m_SVals = (Dictionary <string, string>)binaryFormatter.Deserialize(memoryStream);
        SaveGame.m_FVals = (Dictionary <string, float>)binaryFormatter.Deserialize(memoryStream);
        SaveGame.m_BVals = (Dictionary <string, bool>)binaryFormatter.Deserialize(memoryStream);
        memoryStream.Close();
        foreach (ISaveLoad saveLoad in SaveGame.m_Objects)
        {
            saveLoad.Load();
        }
        GreenHellGame.Instance.m_LoadGameState = LoadGameState.FullLoadWaitingForScenario;
    }
Exemplo n.º 51
0
        public static IEnumerable <EncounterStatic> GetPossible(PKM pkm, IReadOnlyList <DexLevel> chain, GameVersion gameSource = GameVersion.Any)
        {
            if (gameSource == GameVersion.Any)
            {
                gameSource = (GameVersion)pkm.Version;
            }

            var table = GetEncounterStaticTable(pkm, gameSource);

            return(table.Where(e => chain.Any(d => d.Species == e.Species)));
        }
Exemplo n.º 52
0
 public ServerStatus(GameVersion version, PlayerInfo players, TextComponent description)
 {
     Version     = version;
     Players     = players;
     Description = description;
 }
        // LINQ method produces unexpected results on subsequent calls
        // so produce expected results the good old fashioned way
        public List <TuningDefinition> LoadTuningDefinitions(GameVersion gameVersion)
        {
            string tdFilePath = Path.Combine(Application.StartupPath, FILENAME);

            return(TuningDefinition.LoadFile(tdFilePath, gameVersion));
        }
Exemplo n.º 54
0
        private static List <int> GetValidPostEvolutionMoves(PKM pkm, int species, IReadOnlyList <EvoCriteria> evoChain, int generation, GameVersion Version)
        {
            var evomoves = new List <int>();
            var index    = EvolutionChain.GetEvoChainSpeciesIndex(evoChain, species);

            for (int i = 0; i <= index; i++)
            {
                var evo   = evoChain[i];
                var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, evo.Form, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: true, RemoveTransferHM: false, generation: generation);
                // Moves from Species or any species after in the evolution phase
                evomoves.AddRange(moves);
            }
            return(evomoves);
        }
Exemplo n.º 55
0
 public EntryTypeAttribute(int type, GameVersion gameversion)
 {
     this.type        = type;
     this.gameversion = gameversion;
 }
 //Tuning Strings + GameVersion
 public TuningDefinition Select(TuningStrings tuningStrings, GameVersion gameVersion)
 {
     return(List.FirstOrDefault(s => s.Tuning.ToArray().SequenceEqual(tuningStrings.ToArray()) && s.GameVersion == gameVersion));
 }
        public TuningDefinition SelectAny(TuningStrings tuningStrings, GameVersion gameVersion)
        {
            var g = Select(tuningStrings, gameVersion);

            return(g); //Accurate compare, no mercy for bass.
        }
 public TuningDefinition Select(string uiName, GameVersion gameVersion)
 {
     return(List.FirstOrDefault(s => s.UIName == uiName && s.GameVersion == gameVersion));
 }
Exemplo n.º 59
0
        internal static IEnumerable <int> GetExclusivePreEvolutionMoves(PKM pkm, int Species, IReadOnlyList <EvoCriteria> evoChain, int generation, GameVersion Version)
        {
            var preevomoves = new List <int>();
            var evomoves    = new List <int>();
            var index       = EvolutionChain.GetEvoChainSpeciesIndex(evoChain, Species);

            for (int i = 0; i < evoChain.Count; i++)
            {
                var evo   = evoChain[i];
                var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, evo.Form, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: true, RemoveTransferHM: false, generation: generation);
                var list  = i >= index ? preevomoves : evomoves;
                list.AddRange(moves);
            }
            return(preevomoves.Except(evomoves).Distinct());
        }
Exemplo n.º 60
0
    // Extract GAME.DAT to the specified directory
    public static void Extract(string executable, string gameDat, string outDir)
    {
        Console.Write("\nExtracting ...");

        using (FileStream exeStream = File.OpenRead(executable), gameDatStream = File.OpenRead(gameDat))
        {
            FileStream input        = File.OpenRead(executable);
            FileStream gameDatInput = File.OpenRead(gameDat);

            // Determine the game version
            GameVersion gameVersion = GameVersion.Unknown;
            if (exeStream.Length == 2678816) // Wii version
            {
                gameVersion = GameVersion.Wii;
            }
            else if (exeStream.Length == 2716853) // PSP version
            {
                gameVersion = GameVersion.PSP;
            }
            else
            {
                return;
            }

            uint numFiles = 0;
            if (gameVersion == GameVersion.Wii)
            {
                exeStream.Position = 0x18A058;
            }
            else if (gameVersion == GameVersion.PSP)
            {
                exeStream.Position = 0x1978FC;
            }

            // Get the number of files in the file entry table
            exeStream.Position += 20;
            if (gameVersion == GameVersion.Wii)
            {
                numFiles            = PTStream.ReadUInt32BE(exeStream);
                exeStream.Position += 152; // Now go to the position of the first file in the file entry table
            }
            else if (gameVersion == GameVersion.PSP)
            {
                numFiles            = PTStream.ReadUInt32(exeStream);
                exeStream.Position += 136; // Now go to the position of the first file in the file entry table
            }

            Console.WriteLine(" " + numFiles + " files detected.");

            for (uint i = 0; i < numFiles; i++)
            {
                Console.Write("Extracting file " + i.ToString("D4") + " ... ");

                // Go to the next file entry
                NextFileEntry(exeStream);

                exeStream.Position += 4;

                uint offset = 0, length = 0;
                if (gameVersion == GameVersion.Wii)
                {
                    offset = PTStream.ReadUInt32BE(exeStream);
                    length = PTStream.ReadUInt32BE(exeStream);
                }
                else if (gameVersion == GameVersion.PSP)
                {
                    offset = PTStream.ReadUInt32(exeStream);
                    length = PTStream.ReadUInt32(exeStream);
                }

                exeStream.Position += 12;

                // Now let's extract the file
                ExtractFile(gameDatStream, outDir, i, offset, length);
            }
        }
    }