> For the complete documentation index, see [llms.txt](https://onikami.gitbook.io/siege-of-mytra-extract-from-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onikami.gitbook.io/siege-of-mytra-extract-from-whitepaper/understand-all-the-contract-actions.md).

# Understand all the contract actions

In this section we explains all the actions inside the siegeofmytra contract, easily found [here](https://wax-test.bloks.io/account/siegeofmytra).

```
// 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.&#x20;

```
// 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://onikami.gitbook.io/siege-of-mytra-extract-from-whitepaper/understand-all-the-contract-actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
