Skip to content
This repository was archived by the owner on Jul 21, 2026. It is now read-only.
This repository was archived by the owner on Jul 21, 2026. It is now read-only.

Add a method where you can use the player’s balance #41

Description

@JavierLeon9966

Currently there is no way to make Player A pay Player B depending on its balance (ex: a percentage of Player A) without causing a race condition. I would suggest having some parameter where it accepts a promise and that in the first argument it has the player A balance. Example:

$promise = function(int $balance) use($percentage){
    return $balance * $percentage / 100;
};
yield from $capital->payWithBalance(
    "SellHeads",
    $player1,
    $player2,
    $this->selector,
    $promise, //This could also be async just like `Capital::api()`
    new LabelSet(["reason" => "Claimed head"])
);

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions