public Player(Process gameProcess, int px) { GameProcess = gameProcess; PlayerAddress = BitConverter.ToInt32( Hooker.ReadMemory(GameProcess, AddressTable.Player[px], 4), 0); Name = GetString(11, AddressTable.Names[px]); }
public static void FillPointers(Process gameProcess) { int dataAddress = BitConverter.ToInt32( Hooker.ReadMemory(gameProcess, DataPointer, 4), 0); for (int i = 0; i < DataFiles.Length; i++) { DataFiles[i] = BitConverter.ToInt32( Hooker.ReadMemory(gameProcess, dataAddress + i * 4, 4), 0); } }
public void Update() { GameState = BitConverter.ToInt16( Hooker.ReadMemory(GameProcess, AddressTable.GameState, 2), 0); GameIsOn = GameState == 0; if (GameState == 1 && !GameOpenedFully) { Initialise(); GameOpenedFully = true; } #region Players ActiveAmount = 0; for (int i = 0; i < 8; i++) { Players[i].Update(); CPlayers[i].Update(); if (GameIsOn) { byte activity = Hooker.ReadMemory(GameProcess, AddressTable.PlayerInGame[i], 1)[0]; Players[i].IsActive = activity == 1; activity = Hooker.ReadMemory(GameProcess, AddressTable.CPlayerInGame[i], 1)[0]; CPlayers[i].IsActive = activity == 1; } else { Players[i].IsActive = false; CPlayers[i].IsActive = false; } if (GameIsOn) { if (Players[i].IsActive) { ActiveAmount++; Players[i].IsAlive = Players[i].Hp > 0; foreach (var character in Chars) { if (Players[i].DataAddress == character.Address) { Players[i].Char = character; } } } if (CPlayers[i].IsActive) { ActiveAmount++; CPlayers[i].IsAlive = CPlayers[i].Hp > 0; foreach (var character in Chars) { if (CPlayers[i].DataAddress == character.Address) { CPlayers[i].Char = character; } } } } } #endregion if (GameIsOn) { var timyTime = BitConverter.ToInt32( Hooker.ReadMemory(GameProcess, AddressTable.Time, 4), 0); GameSession = TimeSpan.FromSeconds(timyTime / 30); if (!weHaveTable) { BuildTable(); Board.StreamIsOn = StreamIsOn; MotherForm.Size = new Size(MotherForm.Width, Board.Panel.MaximumSize.Height); Board.StreamIsOnChanged = true; weHaveTable = true; } else { RealPlayer.Scores bestScore = new RealPlayer.Scores(); foreach (var realPlayer in Board.Players) { bestScore.Kill = Comparer(realPlayer.MyScores.Kill, bestScore.Kill); bestScore.Attack = Comparer(realPlayer.MyScores.Attack, bestScore.Attack); bestScore.HpLost = Comparer(realPlayer.MyScores.HpLost, bestScore.HpLost); bestScore.MpUsage = Comparer(realPlayer.MyScores.MpUsage, bestScore.MpUsage); bestScore.Picking = Comparer(realPlayer.MyScores.Picking, bestScore.Picking); } foreach (var realPlayer in Board.Players) { realPlayer.Has.Kill = realPlayer.MyScores.Kill == bestScore.Kill; realPlayer.Has.Attack = realPlayer.MyScores.Attack == bestScore.Attack; realPlayer.Has.HpLost = realPlayer.MyScores.HpLost == bestScore.HpLost; realPlayer.Has.MpUsage = realPlayer.MyScores.MpUsage == bestScore.MpUsage; realPlayer.Has.Picking = realPlayer.MyScores.Picking == bestScore.Picking; } } } else { weHaveTable = false; } if (weHaveTable) { Board.Update(GameSession); } }
protected string GetString(uint size, int address) { var array = Hooker.ReadMemory(GameProcess, address, size); return(Encoding.Default.GetString(array).Trim('\0')); }
protected int GetInt32(int offset) { return(BitConverter.ToInt32(Hooker.ReadMemory(GameProcess, PlayerAddress + offset, 4), 0)); }