public override void CreateFish(FishInfo fishInfo) { //base.CreateFish(fishInfo); GameObject fish = GameManager.Instance.CreateFishByNameOffline(fishInfo.IdFish); fish.transform.SetParent(this.fishContainer); Move2 move2 = fish.GetComponent <Move2>(); move2.FishInf = fishInfo; move2.start_game = true; fishsDic.Add(fishInfo.Id, fish); }
public override void CreateFish(FishInfo fishInfo) { //base.CreateFish(fishInfo); if (!this.fishsDic.ContainsKey(fishInfo.Id)) { GameObject fish = PhotonNetwork.Instantiate(fishInfo.NameFish, Vector3.zero, Quaternion.identity, 0) as GameObject; Move2 move2 = fish.GetComponent <Move2>(); move2.FishInf = fishInfo; //move2.photonView.viewID = fishInfo.Id; move2.StartGame(gameState == GameState.GAME_RUN); this.fishsDic.Add(fishInfo.Id, fish); } }
// Start is called before the first frame update void Start() { GenerateBoard(); GenerateValues(); Button mov1 = Move1.GetComponent <Button>(); Button mov2 = Move2.GetComponent <Button>(); Button back = BackUp.GetComponent <Button>(); Button left = TurnLeft.GetComponent <Button>(); Button right = TurnRight.GetComponent <Button>(); Button turn180 = UTurn.GetComponent <Button>(); mov1.onClick.AddListener(MovePlayer1); mov2.onClick.AddListener(MovePlayer2); back.onClick.AddListener(BackPlayerUp); left.onClick.AddListener(TurnPlayerLeft); right.onClick.AddListener(TurnPlayerRight); turn180.onClick.AddListener(TurnPlayerU); player.GetComponent <PlayerManager>().ai = ai; ai.GetComponent <AIManager>().player = player; endCanvas.SetActive(false); normalCanvas.SetActive(true); }
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 (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 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); }
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()); }