Ejemplo n.º 1
0
 public ComPlayer(Process gameProcess, int px) : base(gameProcess, px)
 {
     GameProcess   = gameProcess;
     playerAddress = BitConverter.ToInt32(
         Hookers.ReadMemory(GameProcess, AddressTable.Computer[px], 4), 0);
     Name = "Com" + (px + 1);
 }
Ejemplo n.º 2
0
        public Player(Process gameProcess, int px)
        {
            GameProcess   = gameProcess;
            playerAddress = BitConverter.ToInt32(
                Hookers.ReadMemory(GameProcess, AddressTable.Player[px], 4), 0);

            Name = GetString(11, AddressTable.Names[px]);
        }
Ejemplo n.º 3
0
        public static void FillPointers(Process gameProcess)
        {
            int dataAddress = BitConverter.ToInt32(
                Hookers.ReadMemory(gameProcess, DataPointer, 4), 0);

            for (int i = 0; i < DataFiles.Length; i++)
            {
                DataFiles[i] = BitConverter.ToInt32(
                    Hookers.ReadMemory(gameProcess, dataAddress + i * 4, 4), 0);
            }
        }
Ejemplo n.º 4
0
        public void Update()
        {
            GameState = BitConverter.ToInt16(
                Hookers.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 = Hookers.ReadMemory(GameProcess, AddressTable.PlayerInGame[i], 1)[0];
                    Players[i].IsActive  = activity == 1;
                    activity             = Hookers.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(
                    Hookers.ReadMemory(GameProcess, AddressTable.Time, 4), 0);
                GameSession = TimeSpan.FromSeconds(timyTime / 30);

                if (!WeHaveTable)
                {
                    BuildTable();
                    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);
            }
        }
Ejemplo n.º 5
0
        protected string GetString(uint size, int address)
        {
            var array = Hookers.ReadMemory(GameProcess, address, size);

            return(Encoding.Default.GetString(array).Trim('\0'));
        }
Ejemplo n.º 6
0
 protected int GetInt32(int offset)
 {
     return(BitConverter.ToInt32(Hookers.ReadMemory(GameProcess, playerAddress + offset, 4), 0));
 }