public static void CreateBridgePoints(string cName) { if (rope && axe && cName == "Player1") { Move1.AddDialog(1, "Is that a rope?"); Move1.AddDialog(2, "Yeah, my route was a dead end, but i thought this would be useful"); Move1.AddDialog(1, "So was mine, but I found an axe"); Move1.AddDialog(2, "Nifty!"); Move1.AddDialog(1, "We should be able to make a bridge with those trees"); SavedVars.Instance.StartCoroutine(Move1.Talk()); CreateTrigger("bridge1", 167, 100, 149.5F); CreateTrigger("bridge2", 167, 100, 156.5F); triggered = 3; Move1.P1Tips = "Get back to the chasm"; Move1.P2Tips = "Get back to the chasm"; } else if (rope && axe && cName == "Player2") { Move1.AddDialog(2, "Is that a rope?"); Move1.AddDialog(1, "Yeah, my route was a dead end, but i thought this would be useful"); Move1.AddDialog(2, "So was mine, but I found an axe"); Move1.AddDialog(1, "Nifty!"); Move1.AddDialog(2, "We should be able to make a bridge with those trees"); SavedVars.Instance.StartCoroutine(Move1.Talk()); CreateTrigger("bridge1", 167, 100, 149.5F); CreateTrigger("bridge2", 167, 100, 156.5F); triggered = 3; Move1.P1Tips = "Get back to the chasm"; Move1.P2Tips = "Get back to the chasm"; } }
public void init(AudioSource _audioSource, AudioClip[] _audio, Move1 _moveFunc, Hero2 _hero, GameObject _heroObject) { this.audio = _audio; this.audioSource = _audioSource; this.moveFunc = _moveFunc; this.hero = _hero; this.heroObject = _heroObject; }
public static void SpawnBranch() { NamedDestroy("Plane"); Move1.AddDialog(2, "Help me, i'm stuck under some rubble"); Move1.AddDialog(2, "Maybe you can find something to use as leverage"); Move1.P1Tips = "Get the tree branch from the next waypoint"; SavedVars.Instance.StartCoroutine(Move1.Talk()); CreateTrigger("TreeBranch", 141, 158); }
public static void CreatePickups() { if (triggered == 0) { Move1.AddDialog(1, "Great, we've got a giant stream in our way"); Move1.AddDialog(2, "We need to get across. These boulders should be able to create a path"); Move1.AddDialog(1, "Good idea. We'll need to be quick if we want to beat the stream"); Move1.P1Tips = "Move to the Red Waypoint"; Move1.P2Tips = "Move to the Blue Waypoint"; SavedVars.Instance.StartCoroutine(Move1.Talk()); } DestroyNamed("RiverStart"); print(triggered); if (triggered % 2 == 0) { switch (triggered) { // pos rot scale case 2: CreateRock(116.1F, 99.33F, 157.89F, 0, 0, 0, 2.2518F, 1.608F, 1.943F); break; case 4: CreateRock(109.76F, 99.23f, 159, 36.6f, 168.17F, 150.18F, 1.8f, 1.282f, 1.55f); break; case 6: CreateRock(112.42f, 99.05F, 158, 0, 90, 0, 1.89f, 1.352f, 1.63f); break; case 8: CreateRock(106.6f, 99.5f, 159.3f, 312.3f, 240.43f, 293.81f, 1.579f, 1.128f, -1.363f); break; case 10: CreateRock(104.39f, 99.46f, 159.3738f, 322.24f, 170.59f, 335.38f, 1.668f, 1.191f, 1.44f); break; case 12: CreateRock(101.46f, 99.28f, 159.92f, 307.551f, 124.335f, 221.14f, 1.831f, 1.275f, 1.541f); damCreated = true; break; } if (triggered < 12) { var t1 = CreateTrigger("P1Pickup", 122.5F, 100, 184); var t2 = CreateTrigger("P2Pickup", 137.5F, 100, 223); Move1.P1Tips = "Pickup rock at the red waypoint"; Move1.P2Tips = "Pickup rock at the blue waypoint"; t1.GetComponent <MeshRenderer>().material.color = Color.red; t1.transform.Find("Cylinder").GetComponent <MeshRenderer>().material.color = Color.red; t2.GetComponent <MeshRenderer>().material.color = Color.blue; t2.transform.Find("Cylinder").GetComponent <MeshRenderer>().material.color = Color.blue; } } }
// Use this for initialization void Start() { CreateTrigger("Trees", 127.5f, 191); p2 = GameObject.Find("Player2"); p2.SetActive(false); Move1.AddDialog(1, "wha...what happened? "); Move1.AddDialog(1, "where's Steve? I hope he's alright"); Move1.P1Tips = "Move Bob with w,a,s and d\nMove to the next Waypoint"; print("talk"); StartCoroutine(Move1.Talk()); }
public static void ActivatePlayer2() { NamedDestroy("Player2Trigger"); Move1.AddDialog(1, "Are you okay?"); Move1.AddDialog(2, "Somehow we both are."); Move1.AddDialog(1, "Seriously right? lets find a place to set up camp so we can rest"); Move1.P2Tips = "Move Steve with o,k,l and ;\nGo to the next waypoint"; Move1.P1Tips = "Go to the next waypoint"; SavedVars.Instance.StartCoroutine(Move1.Talk()); CreateTrigger("End", 25.5f, 217.5f); Move2.movable = true; }
public static void StartPlayer2() { SavedVars.Instance.speed = 4; NamedDestroy("Trees"); CreateTrigger("Plane", 125, 181); p2.SetActive(true); Move1.AddDialog(2, "Bob, Where are you?"); Move1.AddDialog(1, "Hey, i hear Steve, he's past those trees"); Move1.P1Tips = "Move to the next waypoint"; SavedVars.Instance.StartCoroutine(Move1.Talk()); Move2.movable = false; print(SavedVars.Instance.speed.ToString()); }
public void OnTriggerEnter(Collider collider) { if (collider.name == "Player1") { Move1.P1Tips = "You fell off the cliff! Be careful!"; Move1.Death(); } else if (collider.name == "Player2") { Move1.P2Tips = "You fell off the cliff! Be careful!"; Move1.Death(); } }
public void OnTriggerEnter(Collider collider) { if (collider.name == "Player1" || collider.name == "Player2") { if (collider.name == "Player1") { Move1.P1Tips = "You died! Don't fall in the water!"; } else { Move1.P2Tips = "You died! Don't fall in the water!"; } Move1.Death(); } }
private static void CreateBridge() { if (GameObject.Find("Smoke") == null) { CreateGameObject("Smoke", "Smoke", 142, 100, 153); } if (bridgeKeys > 10) { CreateGameObject("BridgeInstance", "Bridge", 142, 100, 153); Destroy(GameObject.Find("bridge1")); Destroy(GameObject.Find("bridge2")); Destroy(GameObject.Find("Smoke")); Move1.P1Tips = "Get to the waypoint"; Move1.P2Tips = "Get to the waypoint"; Move1.AddDialog(2, "Great idea! it worked!"); SavedVars.Instance.StartCoroutine(Move1.Talk()); CreateTrigger("End", 15, 100, 191); triggered = 5; } }
public static void CreateRopeAndAxe() { Destroy(GameObject.Find("Start")); Move1.P1Tips = "Split up and get the objects"; Move1.P2Tips = "Split up and get the objects"; var go = CreateTrigger("Axe", 194, 100, 53.5F); var goChild = CreateGameObject("Axe", "AxeMesh", 193f, 102f, 53.23f); goChild.transform.Rotate(52.1f, 232, 319.78f); goChild.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); //go.AddComponent<GameObject>((GameObject)Instantiate(Resources.Load("BridgeTrigger")));Add when get objects go = (GameObject)Instantiate(Resources.Load("BridgeTrigger")); go.name = "Rope"; go.transform.position = new Vector3(198F, 100F, 226F); goChild = CreateGameObject("Rope", "RopeMesh", 198.21f, 100.44f, 228.8f); Move1.AddDialog(2, "Oh man, It's always something isn't it"); Move1.AddDialog(1, "Yesterday a stream, today a giant FISSURE"); Move1.AddDialog(1, "Lets split up. There might be another way around. We'll meet up here again."); SavedVars.Instance.StartCoroutine(Move1.Talk()); triggered = 2; }
public void OnTriggerEnter(Collider collider) { isActive = true; if (gameObject.name == "BearTrapStart") { Move1.AddDialog(1, "Whoa! What's That?"); Move1.AddDialog(2, "It looks like a Bear Trap."); Move1.AddDialog(1, "It's huge!"); Move1.AddDialog(2, "Wouldn't want to go near that it could mean instant death. "); Move1.AddDialog(2, "We're going to have to find another way around it."); Move1.AddDialog(1, "Hmm.... I got it! How about a slingshot. "); Move1.AddDialog(1, "Do you see that rock above the trap? I could launch you over the trap and we"); Move1.AddDialog(1, "could try to pull the rock down from both sides with these ropey sticks to smash the trap."); Move1.AddDialog(2, "Good idea. We'll need some supplies and a lot of rope. "); Move1.AddDialog(1, "Alright lets look for some."); SavedVars.Instance.StartCoroutine(Move1.Talk()); } else if (gameObject.name == "BearTrapEnd") { SavedVars.Instance.score += 2000 - BearPuzzleScript.LevelTime * 10; Application.LoadLevel("FinalLevel"); } }
public void Activate(BattlePokemon pokemonToTransformInto) { Active = true; Type1 = pokemonToTransformInto.Type1; Type2 = pokemonToTransformInto.Type2; Stats = new Stats( 0f, pokemonToTransformInto.PokemonsAttackStat, pokemonToTransformInto.PokemonsDefenseStat, pokemonToTransformInto.PokemonsSpecialStat, pokemonToTransformInto.PokemonsSpeedStat); Move1 = MoveFactory.Create(pokemonToTransformInto.Move1.Index); Move2 = MoveFactory.Create(pokemonToTransformInto.Move2.Index); Move3 = MoveFactory.Create(pokemonToTransformInto.Move3.Index); Move4 = MoveFactory.Create(pokemonToTransformInto.Move4.Index); while (Move1.CurrentPP > 5) { Move1.SubtractPP(1); } while (Move2.CurrentPP > 5) { Move2.SubtractPP(1); } while (Move3.CurrentPP > 5) { Move3.SubtractPP(1); } while (Move4.CurrentPP > 5) { Move4.SubtractPP(1); } }
public override int GetHashCode() { int hash = 1; if (PokemonId != 0UL) { hash ^= PokemonId.GetHashCode(); } if (PokedexEntryNumber != 0) { hash ^= PokedexEntryNumber.GetHashCode(); } if (OriginalCp != 0) { hash ^= OriginalCp.GetHashCode(); } if (AdjustedCpMin != 0) { hash ^= AdjustedCpMin.GetHashCode(); } if (AdjustedCpMax != 0) { hash ^= AdjustedCpMax.GetHashCode(); } if (OriginalStamina != 0) { hash ^= OriginalStamina.GetHashCode(); } if (AdjustedStaminaMin != 0) { hash ^= AdjustedStaminaMin.GetHashCode(); } if (AdjustedStaminaMax != 0) { hash ^= AdjustedStaminaMax.GetHashCode(); } if (FriendLevelCap != false) { hash ^= FriendLevelCap.GetHashCode(); } if (Move1 != 0) { hash ^= Move1.GetHashCode(); } if (Move2 != 0) { hash ^= Move2.GetHashCode(); } if (pokemonDisplay_ != null) { hash ^= PokemonDisplay.GetHashCode(); } if (CapturedS2CellId != 0L) { hash ^= CapturedS2CellId.GetHashCode(); } if (tradedPokemon_ != null) { hash ^= TradedPokemon.GetHashCode(); } if (pokeball_ != null) { hash ^= Pokeball.GetHashCode(); } if (IndividualAttack != 0) { hash ^= IndividualAttack.GetHashCode(); } if (IndividualDefense != 0) { hash ^= IndividualDefense.GetHashCode(); } if (IndividualStamina != 0) { hash ^= IndividualStamina.GetHashCode(); } if (Nickname.Length != 0) { hash ^= Nickname.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (Id != 0UL) { hash ^= Id.GetHashCode(); } if (PokemonId != 0) { hash ^= PokemonId.GetHashCode(); } if (Cp != 0) { hash ^= Cp.GetHashCode(); } if (Stamina != 0) { hash ^= Stamina.GetHashCode(); } if (StaminaMax != 0) { hash ^= StaminaMax.GetHashCode(); } if (Move1 != 0) { hash ^= Move1.GetHashCode(); } if (Move2 != 0) { hash ^= Move2.GetHashCode(); } if (DeployedFortId.Length != 0) { hash ^= DeployedFortId.GetHashCode(); } if (OwnerName.Length != 0) { hash ^= OwnerName.GetHashCode(); } if (IsEgg != false) { hash ^= IsEgg.GetHashCode(); } if (EggKmWalkedTarget != 0D) { hash ^= EggKmWalkedTarget.GetHashCode(); } if (EggKmWalkedStart != 0D) { hash ^= EggKmWalkedStart.GetHashCode(); } if (Origin != 0) { hash ^= Origin.GetHashCode(); } if (HeightM != 0F) { hash ^= HeightM.GetHashCode(); } if (WeightKg != 0F) { hash ^= WeightKg.GetHashCode(); } if (IndividualAttack != 0) { hash ^= IndividualAttack.GetHashCode(); } if (IndividualDefense != 0) { hash ^= IndividualDefense.GetHashCode(); } if (IndividualStamina != 0) { hash ^= IndividualStamina.GetHashCode(); } if (CpMultiplier != 0F) { hash ^= CpMultiplier.GetHashCode(); } if (Pokeball != 0) { hash ^= Pokeball.GetHashCode(); } if (CapturedCellId != 0UL) { hash ^= CapturedCellId.GetHashCode(); } if (BattlesAttacked != 0) { hash ^= BattlesAttacked.GetHashCode(); } if (BattlesDefended != 0) { hash ^= BattlesDefended.GetHashCode(); } if (EggIncubatorId.Length != 0) { hash ^= EggIncubatorId.GetHashCode(); } if (CreationTimeMs != 0UL) { hash ^= CreationTimeMs.GetHashCode(); } if (NumUpgrades != 0) { hash ^= NumUpgrades.GetHashCode(); } if (AdditionalCpMultiplier != 0F) { hash ^= AdditionalCpMultiplier.GetHashCode(); } if (Favorite != 0) { hash ^= Favorite.GetHashCode(); } if (Nickname.Length != 0) { hash ^= Nickname.GetHashCode(); } if (FromFort != 0) { hash ^= FromFort.GetHashCode(); } if (BuddyCandyAwarded != 0) { hash ^= BuddyCandyAwarded.GetHashCode(); } if (BuddyTotalKmWalked != 0F) { hash ^= BuddyTotalKmWalked.GetHashCode(); } if (DisplayPokemonId != 0) { hash ^= DisplayPokemonId.GetHashCode(); } if (DisplayCp != 0) { hash ^= DisplayCp.GetHashCode(); } return(hash); }
public static void Death() { SavedVars.Instance.StartCoroutine(Move1.Die()); }
// Update is called once per frame void Update() { LevelTime += Time.deltaTime; if (gameObject.tag == "RockPullPosition" && count < 4) { if (Input.GetKeyDown(KeyCode.P) && p2turn) { p2turn = false; p1turn = true; Move1.P2Tips = ""; count++; } else if (Input.GetKeyDown(KeyCode.R) && p1turn) { p2turn = true; p1turn = false; Move1.P1Tips = ""; count++; } } if (count == 4 && gameObject.name == "Rock01") { if (pullPosition == BearPuzzleScript.chosenPosition) { correctPosition = true; } Move1.P1Tips = ""; Move1.P2Tips = ""; GameObject[] lt = GameObject.FindGameObjectsWithTag("RockPullPosition"); foreach (GameObject go in lt) { Destroy(go); } rigidbody.AddForce(Vector3.back * 1000f); count = 5; if (!correctPosition) { var position = gameObject.transform.position; position.x = 420F; position.y = 36F; position.z = 170F; var newObject = (GameObject)Instantiate(Resources.Load("HoleTrigger"), position, Quaternion.identity); newObject.name = "EnterHole"; newObject.tag = "TriggerPosition"; newObject.transform.localScale = new Vector3(4.4f, 1f, 35f); invisibleCollider.collider.isTrigger = false; invisibleCollider2.collider.isTrigger = false; Move1.AddDialog(1, "...... "); Move1.AddDialog(1, "......."); Move1.AddDialog(1, "Oh no. We broke the ground."); Move1.AddDialog(2, "Perfect. Now we have to waste time getting me in and out. Let's Hurry."); SavedVars.Instance.StartCoroutine(Move1.Talk()); } else { Move1.AddDialog(1, "...... "); Move1.AddDialog(1, "......."); Move1.AddDialog(1, "Whew. we didn't break the ground."); Move1.AddDialog(2, "Good. let's go."); SavedVars.Instance.StartCoroutine(Move1.Talk()); } } if (count == 6 && gameObject.name == "EnterHole") { if (Input.GetKeyDown(KeyCode.Space)) { Move1.P2Tips = ""; Destroy(GameObject.Find("EnterHole")); BearPuzzleScript.player2.transform.position = new Vector3(408F, 31F, 168F); count = 7; var position = gameObject.transform.position; position.x = 393F; position.y = 36F; position.z = 165F; var newObject = (GameObject)Instantiate(Resources.Load("HoleTrigger"), position, Quaternion.identity); newObject.name = "DropRope"; newObject.tag = "TriggerPosition"; newObject.transform.localScale = new Vector3(4.4f, 1f, 40f); //BridgePuzzle.CreateGameObject("Rope","RopeMesh",355F,36F,167F); Move1.AddDialog(2, "Hey, Buddy lend me some rope."); Move1.AddDialog(1, "Right."); SavedVars.Instance.StartCoroutine(Move1.Talk()); } } if (count == 7 && gameObject.name == "DropRope") { if (Input.GetKeyDown(KeyCode.Space)) { print("drop"); Move1.P1Tips = ""; Destroy(GameObject.Find("DropRope")); var position = gameObject.transform.position; position.x = 402F; position.y = 29F; position.z = 168F; var newObject = (GameObject)Instantiate(Resources.Load("PullPosition"), position, Quaternion.identity); newObject.name = "Rope"; newObject.tag = "TriggerPosition"; BridgePuzzle.CreateGameObject("Rope", "RopeMesh", 403F, 29F, 169F); count = 8; } } if (count == 8 && gameObject.name == "Rope") { if (Input.GetKeyDown(KeyCode.Space)) { Move1.P2Tips = ""; Destroy(GameObject.Find("Rope")); Destroy(GameObject.Find("RopeMesh")); BearPuzzleScript.player2.transform.position = new Vector3(390F, 37F, 165F); count = 9; Move1.AddDialog(1, "Lets go."); SavedVars.Instance.StartCoroutine(Move1.Talk()); } } if (count == 9) { } }
// Update is called once per frame void Update() { if (isActive) { if (objects.Count == 0 && picked == 0) { //Destroy(GameObject.Find("BearTrapStart")); CreateObject("Rope", 351F, 32F, 49F); BridgePuzzle.CreateGameObject("Rope", "RopeMesh", 353F, 32F, 51F); CreateObject("Rope2", 307F, 40F, 67F); BridgePuzzle.CreateGameObject("Rope", "RopeMesh2", 309F, 40F, 69F); CreateObject("Axe", 447F, 30F, 99F); var goChild = BridgePuzzle.CreateGameObject("Axe", "AxeMesh", 448F, 30F, 99F); goChild.transform.Rotate(52.1f, 232, 319.78f); goChild.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); picked = 1; } else if (objects.Count == 0 && picked == 1) { if (BearPuzzleScript.gotTheAxe == 0) { Move1.AddDialog(1, "I managed to find a lot of rope."); Move1.AddDialog(2, "Great! and I found an axe. Let's meet back at the Bear trap and make the slingshot."); SavedVars.Instance.StartCoroutine(Move1.Talk()); } else { Move1.AddDialog(2, "I managed to find a lot of rope."); Move1.AddDialog(1, "Great! and I found an axe. Let's meet back at the Bear trap and make the slingshot."); SavedVars.Instance.StartCoroutine(Move1.Talk()); } var position = gameObject.transform.position; position.x = 457F; position.y = 35F; position.z = 190F; var newObject = (GameObject)Instantiate(Resources.Load("BearTrapTrigger"), position, Quaternion.identity); newObject.name = "SlingShot"; newObject.tag = "TriggerPosition"; objects.Add(newObject); picked = 2; } else if (objects.Count == 0 && picked == 2) { Move1.AddDialog(2, "Alright. Get into a position and i'll launch you from here. "); Move1.AddDialog(2, "Be careful we don't want you to launch too close to the trap or too far."); Move1.AddDialog(2, "Also we should remember what position we launched in so that we can use it to pull the rock."); Move1.AddDialog(1, "Right. The ground looks a little weak under the trap. "); Move1.AddDialog(1, "Standing in the wrong position could cause us to pull the rock with too much force and break the ground."); SavedVars.Instance.StartCoroutine(Move1.Talk()); var position = gameObject.transform.position; position.x = 457F; position.y = 35; position.z = 190F; var newObject = (GameObject)Instantiate(Resources.Load("LaunchPrefab"), position, Quaternion.identity); newObject.name = "Launch"; newObject.tag = "LaunchTrigger"; picked = 3; CreateLaunchPositions("Position1", 437F, 177F); CreateLaunchPositions("Position2", 444F, 177F); CreateLaunchPositions("Position3", 450F, 178F); CreateLaunchPositions("Position4", 456F, 177F); } if (BearPuzzleScript.launchedCorrectly && picked == 3) { Move1.AddDialog(1, "Ah. Ahhhhhhhhhhhhhhhh"); Move1.AddDialog(1, "....................."); Move1.AddDialog(1, "That went well. Now lets stand in the same position we launched in to pull the rock."); Move1.AddDialog(2, "Ok."); SavedVars.Instance.StartCoroutine(Move1.Talk()); CreatePullPositions("Position1", 437F, 177F); CreatePullPositions("Position2", 444F, 177F); CreatePullPositions("Position3", 450F, 178F); CreatePullPositions("Position4", 456F, 177F); CreatePullPositions("Position5", 381F, 178F); CreatePullPositions("Position6", 376F, 180F); CreatePullPositions("Position7", 374F, 184F); CreatePullPositions("Position8", 373F, 189F); picked = 4; } } }
private void AddValuesFromUnitbase(int UnitBaseEndOffset, int UnitBaseBlockLength, int UnitStatBlockLength, string Game, string region) { /* StatsBlock Layout * Length: 0x40 in IE(JAP) 0x50 in IE(EUR) & IE2, 0x48 in IE3 * IE3 doesn't have the garbage values * (short[3]) TP: 0x0 - MinTP, 0x2 - MaxTP, 0x4 - FPGrowthRate * short 0x6 - unk * (short[3]) FP: 0x8 - MinFP, 0xA - MaxFP, 0xC - TPGrowthRate * short 0xE - unk * (byte[2]) Kick: 0x10 - Min, 0x11 - Max, short 0x12 - GrowthRate * (byte[2]) Body: 0x14 - Min, 0x15 - Max, short 0x16 - GrowthRate * (byte[2]) Guard: 0x18 - Min, 0x19 - Max, short 0x1A - GrowthRate * (byte[2]) Control: 0x1C - Min, 0x1D - Max, short 0x1E - GrowthRate * (byte[2]) Speed: 0x20 - Min, 0x21 - Max, short 0x22 - GrowthRate * (byte[2]) Guts: 0x24 - Min, 0x25 - Max, short 0x26 - GrowthRate * (byte[2]) Stamina: 0x28 - Min, 0x29 - Max, short 0x2A - GrowthRate * (short[8]) Moves: 0x2C - MoveID_Slot1, 0x2E UnlockLevel, 0x30 - MoveID_Slot2, 0x32 UnlockLevel, (byte[8]) in IE(JAP)!! * 0x34 MoveID_Slot3, 0x36 UnlockLevel, 0x38 MoveID_Slot4, 0x3A UnlockLevel * (short[5]) 0x3C - Max total, unk, unk, unk, unk * Garbage data most likely */ IECommonDictionary D = new IECommonDictionary(); string PlayerNamesFileName = @"Game Files/" + region + "/" + Game + "/unitbase.dat"; string StatsFileName = @"Game Files/" + region + "/" + Game + "/unitstat.dat"; byte NicknameStartPosJAP = 0x10; byte StringLength = 0x20; byte NickNameLength = 0x20; byte EXPOffset = 0x40; byte ScoutIDOffset = 0x42; byte ElementOffset = 0x5A; byte GenderOffset = 0x52; byte PlayerIndex = 0x5E; byte[] NameFile = FileIO.ReadFile(PlayerNamesFileName); byte[] StatsFile = FileIO.ReadFile(StatsFileName); if (Game == "IE3") { EXPOffset = 0x4C; ScoutIDOffset = 0x4E; StringLength = 0x1C; ElementOffset = 0x62; NickNameLength = 0x10; GenderOffset = 0x5A; NicknameStartPosJAP = 0x1C; PlayerIndex = 0x66; } StringBuilder sb = new StringBuilder(); byte[] NameBlock = new byte[UnitBaseBlockLength]; byte[] StatsBlock = new byte[UnitStatBlockLength]; for (int i = UnitBaseBlockLength; i <= UnitBaseEndOffset; i += UnitBaseBlockLength) { NameBlock = NameFile.Skip(i).Take(UnitBaseBlockLength).ToArray(); ushort index = BitConverter.ToUInt16(NameBlock.Skip(PlayerIndex).Take(2).ToArray(), 0); StatsBlock = StatsFile.Skip(index * UnitStatBlockLength).Take(UnitStatBlockLength).ToArray(); if (Game == "IE3") { Cryptography.Decrypt(ref StatsBlock); } string FullPlayerName = ""; string PlayerNickName = ""; switch (region) { case "EUR": { // Currently using SJIS as text encoding // Still need a better text encoding for IE3, German, Spanish and some French names are incorrect FullPlayerName = Encoding.GetEncoding(932).GetString(NameBlock.Skip(0).Take(0x1C).ToArray()); PlayerNickName = Encoding.GetEncoding(932).GetString(NameBlock.Skip(StringLength).Take(NickNameLength).ToArray()); break; } case "JAP": { FullPlayerName = Encoding.GetEncoding(932).GetString(NameBlock.Skip(0).Take(0x10).ToArray()); PlayerNickName = Encoding.GetEncoding(932).GetString(NameBlock.Skip(NicknameStartPosJAP).Take(0x10).ToArray()); break; } } FullPlayerName = FullPlayerName.Replace("\0", ""); PlayerNickName = PlayerNickName.Replace("\0", ""); ushort ScoutHexID = BitConverter.ToUInt16(NameBlock.Skip(ScoutIDOffset).Take(2).ToArray(), 0); byte EXPType = NameBlock[EXPOffset]; byte Gender = NameBlock[GenderOffset]; byte Position = NameBlock.Skip(GenderOffset).Take(4).ToArray()[3]; byte PlayerSize = NameBlock.Skip(GenderOffset).Take(4).ToArray()[2]; byte Element = NameBlock[ElementOffset]; ushort MinFP = BitConverter.ToUInt16(StatsBlock.Skip(0).Take(2).ToArray(), 0); ushort MaxFP = BitConverter.ToUInt16(StatsBlock.Skip(2).Take(2).ToArray(), 0); byte FPgrowthRate = StatsBlock[0x4]; ushort MinTP = BitConverter.ToUInt16(StatsBlock.Skip(0x8).Take(2).ToArray(), 0); ushort MaxTP = BitConverter.ToUInt16(StatsBlock.Skip(0xA).Take(2).ToArray(), 0); byte TPgrowthRate = StatsBlock[0xC]; ushort MinKick = StatsBlock[0x10]; ushort MaxKick = StatsBlock[0x11]; ushort MinBody = StatsBlock[0x14]; ushort MaxBody = StatsBlock[0x15]; ushort MinGuard = StatsBlock[0x18]; ushort MaxGuard = StatsBlock[0x19]; ushort MinControl = StatsBlock[0x1C]; ushort MaxControl = StatsBlock[0x1D]; ushort MinSpeed = StatsBlock[0x20]; ushort MaxSpeed = StatsBlock[0x21]; ushort MinGuts = StatsBlock[0x24]; ushort MaxGuts = StatsBlock[0x25]; ushort MinStamina = StatsBlock[0x28]; ushort MaxStamina = StatsBlock[0x29]; byte[] growthRate = new byte[7]; for (int K = 0; K < 7; K++) { growthRate[K] = StatsBlock[0x12 + (K * 4)]; } ushort Move1, Move1ObtainLevel; ushort Move2, Move2ObtainLevel; ushort Move3, Move3ObtainLevel; ushort Move4, Move4ObtainLevel; ushort Maxtotal; if (Game == "IE" && region == "JAP") { Move1 = StatsBlock[0x2C]; Move1ObtainLevel = StatsBlock[0x2D]; Move2 = StatsBlock[0x2E]; Move2ObtainLevel = StatsBlock[0x2F]; Move3 = StatsBlock[0x30]; Move3ObtainLevel = StatsBlock[0x31]; Move4 = StatsBlock[0x32]; Move4ObtainLevel = StatsBlock[0x33]; Maxtotal = BitConverter.ToUInt16(StatsBlock.Skip(0x34).Take(2).ToArray(), 0); } else { Move1 = BitConverter.ToUInt16(StatsBlock.Skip(0x2C).Take(2).ToArray(), 0); Move1ObtainLevel = StatsBlock[0x2E]; Move2 = BitConverter.ToUInt16(StatsBlock.Skip(0x30).Take(2).ToArray(), 0); Move2ObtainLevel = StatsBlock[0x32]; Move3 = BitConverter.ToUInt16(StatsBlock.Skip(0x34).Take(2).ToArray(), 0); Move3ObtainLevel = StatsBlock[0x36]; Move4 = BitConverter.ToUInt16(StatsBlock.Skip(0x38).Take(2).ToArray(), 0); Move4ObtainLevel = StatsBlock[0x3A]; Maxtotal = BitConverter.ToUInt16(StatsBlock.Skip(0x3C).Take(2).ToArray(), 0); } ushort StatsTotal = (ushort)(MaxKick + MaxBody + MaxGuard + MaxControl + MaxSpeed + MaxGuts + MaxStamina); short Freedom = (short)(Maxtotal - StatsTotal); // has to be signed since in IE3 it can be negative #if DEBUG string consoleOutput = String.Concat("private static Player ", FullPlayerName.Replace(" ", "_").Replace("\'", "_").Replace(".", "_").Replace("-", "_").Replace("’", "_").Replace("?", "_"), " = new Player(" + MaxFP, ", ", MaxTP, ", ", (byte)MaxKick, ", ", (byte)MaxBody, ", ", (byte)MaxControl, ", ", (byte)MaxGuard, ", ", (byte)MaxSpeed, ", ", (byte)MaxStamina, ", ", (byte)MaxGuts, ", ", StatsTotal, ", " , MinFP, ", ", MinTP, ", ", (byte)MinKick, ", ", (byte)MinBody, ", ", (byte)MinControl, ", ", (byte)MinGuard, ", ", (byte)MinSpeed, ", ", (byte)MinStamina, ", ", (byte)MinGuts, ", " , FPgrowthRate, ", ", TPgrowthRate, ", ", growthRate[0], ", ", growthRate[1], ", ", growthRate[3], ", ", growthRate[2], ", ", growthRate[4], ", ", growthRate[6], ", ", growthRate[5], ", " , "0x", Move1.ToString("X2"), ", 0x", Move2.ToString("X2"), ", 0x", Move3.ToString("X2"), ", 0x", Move4.ToString("X2"), ", " , "0x", Move1ObtainLevel.ToString("X2"), ", 0x", Move2ObtainLevel.ToString("X2"), ", 0x", Move3ObtainLevel.ToString("X2"), ", 0x", Move4ObtainLevel.ToString("X2"), ", " , EXPType, "); // 0x", ScoutHexID.ToString("X2")); // Code for dumping structs sb.AppendLine(consoleOutput); Console.WriteLine((i / UnitBaseBlockLength).ToString("X2")); #else dataGridViewStats.Rows.Add(FullPlayerName, PlayerNickName, D.PosByteToString(Position), D.GenderToString[Gender], D.SizeToString(PlayerSize), D.ElementToStr[Element], MaxFP, MaxTP, MaxKick, MaxBody, MaxControl, MaxGuard, MaxSpeed, MaxStamina, MaxGuts, Freedom, StatsTotal, Maxtotal, D.MoveToStr[Move1], D.MoveObtainLevel(Move1ObtainLevel), D.MoveToStr[Move2], D.MoveObtainLevel(Move2ObtainLevel), D.MoveToStr[Move3], D.MoveObtainLevel(Move3ObtainLevel), D.MoveToStr[Move4], D.MoveObtainLevel(Move4ObtainLevel), "0x" + ScoutHexID.ToString("X2") ); #endif } Console.WriteLine(sb.ToString()); }