Example #1
0
 private void GameAnalyzer_OnPlayerMove(object sender, CoordinatesEventArgs e) {
     this.selfPoint = e.point;
     if (followSelf) {
         centerView();
     }
     lblXLoc.Content = selfPoint.X.ToString("0.0");
     lblYLoc.Content = selfPoint.Y.ToString("0.0");
     lblZLoc.Content = selfPoint.Z.ToString("0.0");
 }
Example #2
0
 private void GameAnalyzer_OnPlayerMove(object sender, CoordinatesEventArgs e) {
     throw new NotImplementedException();
 }
Example #3
0
 private void GameAnalyzer_OnPlayerMove(object sender, CoordinatesEventArgs e) {
     //do something
 }
Example #4
0
        private void analyze(GameState newGameState) {
            //ontick always goes off
            if(OnTick != null) {
                OnTick(this);
            }
            //see if we zoned
            if (newGameState.zone != "" && oldGameState.zone != newGameState.zone) {
                oldGameState.spawnList.Clear();
                StringEventArgs zoneArgs = new StringEventArgs();
                zoneArgs.value = newGameState.zone;
                if (OnZone != null) {
                    OnZone(this, zoneArgs);
                }
            }
            //spawnlistUpdate events
            //add new spawns
            foreach (Spawn s in newGameState.spawnList.Except(oldGameState.spawnList, new SpawnComparer()).ToArray()) {
                SpawnEventArgs args = new SpawnEventArgs();
                args.spawn = s;
                if(OnSpawnAdd != null) {
                    OnSpawnAdd(this, args);
                }              
            }
            //update position on existing spawns
            foreach (Spawn s in newGameState.spawnList.Intersect(oldGameState.spawnList, new SpawnComparer()).ToArray()) {
                Spawn tmpSpawn = oldGameState.spawnList.Find(x => x.id == s.id);
                if (s.xLoc != tmpSpawn.xLoc || s.yLoc != tmpSpawn.yLoc || s.heading != tmpSpawn.heading) {
                    SpawnEventArgs args = new SpawnEventArgs();
                    args.spawn = s;
                    if (OnSpawnUpdate != null) {
                        OnSpawnUpdate(this, args);
                    }
                }
                if (s.type != tmpSpawn.type) {
                    //something died so the spawn poofs and corpse is spawned
                    SpawnEventArgs args = new SpawnEventArgs();
                    args.spawn = s;
                    if (OnSpawnDelete != null) {
                        OnSpawnDelete(this, args);
                    }
                    if (OnSpawnAdd != null) {
                        OnSpawnAdd(this, args);
                    }   
                }
            }
            //remove missing spawns
            foreach (Spawn s in oldGameState.spawnList.Except(newGameState.spawnList, new SpawnComparer()).ToArray()) {
                SpawnEventArgs args = new SpawnEventArgs();
                args.spawn = s;
                if (OnSpawnDelete != null) {
                    OnSpawnDelete(this, args);
                }
            }

            //ToDo: groundSpawnListUpdate events

            //check for new target
            if (newGameState.spawnList.Count > 0 && oldGameState.target != newGameState.target) {
                SpawnEventArgs args = new SpawnEventArgs();
                args.spawn = newGameState.target;
                if (OnTargetChange != null) {
                    OnTargetChange(this, args);
                }
            }
            //check if target moved
            if(oldGameState.target.xLoc != newGameState.target.xLoc
                || oldGameState.target.yLoc != newGameState.target.yLoc
                || oldGameState.target.zLoc != newGameState.target.zLoc) {
                    CoordinatesEventArgs OnTargetMoveArgs = new CoordinatesEventArgs();
                    OnTargetMoveArgs.point.X = newGameState.target.xLoc;
                    OnTargetMoveArgs.point.Y = newGameState.target.yLoc;
                    OnTargetMoveArgs.point.Z = newGameState.target.zLoc;
                    if(OnTargetMove != null) {
                        OnTargetMove(this, OnTargetMoveArgs);
                }
            }   
            //check if we moved
            if (oldGameState.self.xLoc != newGameState.self.xLoc
                || oldGameState.self.yLoc != newGameState.self.yLoc
                || oldGameState.self.zLoc != newGameState.self.zLoc) {
                    CoordinatesEventArgs playerMoveArgs = new CoordinatesEventArgs();
                    playerMoveArgs.point.X = newGameState.self.xLoc;
                    playerMoveArgs.point.Y = newGameState.self.yLoc;
                    playerMoveArgs.point.Z = newGameState.self.zLoc;
                    if (OnPlayerMove != null) {
                        OnPlayerMove(this, playerMoveArgs);
                    }
            }     
            //check if we changed level
            if (oldGameState.self.level != newGameState.self.level) {
                IntEventArgs intEventArgs = new IntEventArgs();
                intEventArgs.value = newGameState.self.level;
                if (OnPlayerLevelChange != null) {
                    OnPlayerLevelChange(this, intEventArgs);
                }
            }
        }