edo9300 / edopro

A script engine for "yu-gi-oh!" and sample gui (former "ygopro")
Other
279 stars 75 forks source link

Add command line parameters #271

Open n1xx1 opened 4 months ago

n1xx1 commented 4 months ago

I added the following commands to the CLI. I also made it so the replay starts paused, it felt like it made more sense. When a new game is created there will be a log line with the game ID logged.

-q                      quit after the duel/replay ends
-n <nickname>           set nickname used
-d <deck name>          set the default deck
-replay <path>          start the client with the replay screen open
-host <config>          host a game with the specified config
-join <config>          join a game with the specified config
-deckbuilder <config>   open the deck editor with the default deck

Config definitions:

interface HostConfig {
  host: string; // default: ""; ignored if online
  port: number; // default: 7911; ignored if online
  password: string; // default: ""
  startHand: number; // default: 5
  startLP: number; // default: 8000
  drawCount: number; // default: 1
  timeLimit: number; // default: 0
  lfList: number; // default: 0; hash, 0 for the null list
  duelParam: string; // bit field of params, 64
  noCheckDeckSize: boolean; // default: false
  noCheckDeckContent: boolean; // default: false
  noShuffleDeck: boolean; // default: false
  forbiddenTypes: number; // default: 0; bit field, 32
  extraRules: number; // default: 0; bit field, 16
  serverIndex: number; // default: -1; host online
}

interface JoinConfig {
  host: string; // default: ""; ignored if online
  port: number; // default: 7911; ignored if online
  password: string; // default: ""
  serverIndex: number; // default: -1; join online
  gameId: number; // default: 0; only if online
}

interface DeckbuilderConfig {
  testHand?: {
    noOpponent?: boolean; // default: false;
    dontShuffleDeck?: boolean; // default: false;
    startingHand?: number; // default: 5;
    duelParam?: number; // default: DUEL_MODE_MR5;
    saveReplay?: boolean; // default: false;
  }; // default: null; if present, open the test hand mode
}

I would have loved to use some std::variant but I've seen the project is currently on C++14, so I just kept it simple.

n1xx1 commented 3 months ago

I've added all the cli args I wanted to add and rebased to the latest commit.