Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No resignTime exists on any player objects: .aoe2record #35

Open
jduyon opened this issue Dec 7, 2016 · 3 comments
Open

No resignTime exists on any player objects: .aoe2record #35

jduyon opened this issue Dec 7, 2016 · 3 comments

Comments

@jduyon
Copy link

jduyon commented Dec 7, 2016

I'm trying to use recanalyst to find the players that resigned in an HD game (and whether or not they were the owner).

I wrote a little script to do this for a recorded game given from the command line. The script just looks for the first person to resign and checks if player->owner. It doesn't check the team of the player who resigned.

(A usage for this script is:
php examples/get_resigned.php some_recorded_game.aoe2record; echo $?;

require __DIR__ . '/../vendor/autoload.php';
use RecAnalyst\RecordedGame;

$filename = $argv[1];
$rec = new RecordedGame($filename);

// EXIT 0 means you did not resign
// EXIT 1 means you did resign
// EXIT 2 means could not find anyone who resigned

// Go through each of the chat messages, search for if the chat message is:
// "<player> resigned" and player is owner.
foreach ($rec->body()->chatMessages as $chat) {
    if ($chat->player && $chat->player->owner && $chat->msg === 'resigned') {
        exit(1);
    }
}
foreach ($rec->body()->chatMessages as $chat) {
    if ($chat->player && $chat->msg === 'resigned'){
        exit(0);
    }
}

// Go through each of the players and search for resignTime + player is owner
foreach($rec->players() as $player){
  if($player->resignTime && $player->owner){
    exit(1);
  }
  elseif ($player->resignTime){
    exit(0);
  }
}
exit(2);
@jduyon
Copy link
Author

jduyon commented Dec 7, 2016

no_resign_times_HD.zip

This is the attached AOE2HD game zipped (I own the expansions, but I dont think this was an expansion game).

@goto-bus-stop
Copy link
Owner

Hmm… Resignation times are determined by reading Resign actions from the recorded game body, but it looks like that game doesn't contain a Resign action.
(Perhaps AoE saves the game before the resign action is processed?)

I don't think resign times are actually saved anywhere in the recorded game, so I'm not sure if there's anything we can do about this :(

@jduyon
Copy link
Author

jduyon commented Dec 7, 2016

Ah, that makes sense. I played back the rec and didn't see any resignations in the chat or in game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants