Understand all the contract actions

In this section we explains all the actions inside the siegeofmytra contract, easily found here.

// signup ACTION signup(name player);

This action is used by players to create a game account.

//  getprod ACTION getprod(name player);

This action is called by players to claim turns results: get units recruited by castle, gold produced, troops maintenance, etc.

// setunitprod ACTION setunitprod(name player, uint64_t castle_id, name type);

This action assigns the unit to be produced (recruited) by castle identified by castle_id. 'type' can be "lightinfantr", "heavyinfantr", "archer", "lightcavalry" or"heavycavalry". To change the produced by a castle reset the production turns countdown. This action only can be called by the castle owner.

// unsetunitprod ACTION unsetunitprod(name player, uint64_t castle_id);

The castle owner can use this action to stop the castle (identified by castle_id) unit production.

// getrival ACTION getrival(name player);

The player can use this action to ask the game for a rival to fight. If a rival was assigned previously to this player this action has a gold cost.

// fight ACTION fight(name player, std::vector<uint64_t> units, uint64_t castle_id);

If a player has an assigned rival, he/she can use this action to attack the rival's castle identified by castle_id. Players must provide a list of non-defender unit ids who act as attackers.

// adddefenders ACTION adddefenders(name player, uint64_t castle_id, std::vector<uint64_t> units_to_add);

The player can use this action to assign non-defender units to a player's castle defense. Players must provide a list of non-defender units.

// removedef ACTION removedef(name player, uint64_t castle_id, std::vector<uint64_t> units_to_remove);

The player can use this action to remove defender units from a player's castle defense.

// newcastle ACTION newcastle(name player);

This action is called by contract to assign a new castle to a player.

// receiverand ACTION receiverand(uint64_t player, const checksum256& random_value);

This action is called by orng.wax contract to provide the game with a random number that is used to resolve combats and assign opponents to players.

// setrival ACTION setrival(uint64_t player_id, const checksum256& random_value);

This action is called by game contract to assign an opponent to a player.

// resolvecmbt ACTION resolvecmbt(uint64_t player_id, const checksum256& random_value);

This action is called by game contract resolve combats.

// nuke ACTION nuke();

Administrative action.

// turnback ACTION turnback(float gold);

Administrative action.

Last updated