Skip to main content

general-functionality


General functionality

Reload game

Request the connector to reload the game.

ETHEREAL.reloadGame();

Go to the casino home page

Request to exit the game and navigate to the website's lobby.

ETHEREAL.goToHome();

Make sure you can perform this action checking first:

ETHEREAL.data.canShowHomeButton();
Test it

You can test this functionality adding the url param homeButton=false


Go to the casino deposit page

Request to exit the game and navigate to the website's deposit page.

ETHEREAL.goToDeposit();

Make sure you can perform this action checking first:

ETHEREAL.data.canShowDepositButton();
Test it

You can test this functionality adding the url param depositButton=false


Open full screen

Request to open the fullscreen mode for the game.

ETHEREAL.goToFullscreen();

Make sure you can perform this action checking first:

ETHEREAL.data.canShowFullscreenButton();
Test it

You can test this functionality adding the url param fullscreenButton=false


Language

The connector gives you the data of the laguage the game should be played:

let language: string = ETHEREAL.data.language();

:::doc Extra functionality If your translation files are located in a route such as /locale/<language>/<name>.json they will be automatically translated if a specific language doesn't exist (The file for english (en) must exist). This is explained in more detail here. :::

Test it

You can test the language using the url param lang=<language>

You can change the language and listen to the changes of language:

ETHEREAL.notifyLanguageChange(<language>);
ETHEREAL.onRequestLanguageChange((language:string) => { /** Your code here */ );

:::doc Extra functionality You can use your own translation module or use the Ethereal translate module, as explained here. :::


Currency

The platform uses a money system that abstract the engine from any currency, so the game client must translate that to the actual currency the game must show. You can use the connector to make the conversion:

let currencyAmount: number = ETHEREAL.rgs.amountToCurrency(baseAmount);
let baseAmount: number = ETHEREAL.rgs.currencyToAmount(currencyAmount);

:::doc Extra functionality You can use the Ethereal UI to format the numbers, using the current language, as explained here. :::

Test it

Go to the lab, select a player, create a wallet with the currency desired. (Try currencies with different scales, such as EUR and TZS) and open the game with that currency.


Bet and balance

The platform is prepared to fail when the balance is not enough for the bet played, but it's a better experience for the player if the frontend block the action directly and show a message to go to the deposit page (if any) to continue playing.

:::doc Extra functionality You can use the Ethereal UI to show the message:

ETHEREAL.ui.showMessage("NOT_ENOUGH_BALANCE");

You can see a more explained version here :::

Details

If you use a custom message instead of the Ethereal UI Make sure the displayed popup has the following functionality:

  • A button for the player to request an update of the balance:
let balance = await ETHEREAL.rgs.balance(true);
  • A button for the player to go to the deposit page if enabled:
let canShowDeposit = ETHEREAL.data.canShowDepositButton();
await ETHEREAL.goToDeposit();
  • A button for the player to close the popup and continue the game, so he can change the bet.

You can use the already translated texts:

  • "noMoneyTitle": Out of Money
  • "noMoneyText": Please reduce your bet or deposit more money to continue playing
  • "DEPOSIT": Deposit
  • "CONTINUE": Continue
let title = ETHEREAL.ui.translate("noMoneyTitle");
let message = ETHEREAL.ui.translate("noMoneyText");
Warning

Make sure the player can still play if there is a promotion active, even if the balance is not enough, as it doesn't consume from the balance.

You can see more information about the promotion system here

Listen to the connector balance update notifications to change the balance ingame:

ETHEREAL.onRequestUpdateBalance((balanceInCurrency: number) => { /** Your code here */ });

Listen to the connector for when it blocks / unblock the player to change the bet and if it should set a certain bet:

ETHEREAL.onRequestBlockBet((block: boolean, bet: number) => void) { /** Your code here */ };

Notify when the balance or bet changes:

ETHEREAL.notifyBalanceChange(balanceInCurrency);
ETHEREAL.notifyBetChange(totalBetInCurrency);

Max win cap

Some operators doesn't allow the player to win more than a certain amount per round. When a player reach this amount, the round win is capped to that maximum amount and the round is terminated, forcing the end of any feature or bonus. This is handled by the platform automatically, but the player should show a message in this event. You can know when the round is capped after each play:

let capped: boolean = ETHEREAL.rgs.isWinCapped();
Test it

To test it, go to the lab, select the Ethereal Sandbox casino, go to the Url Data section and add token=player1+maxExposure(1). (Make sure that there is no player selected). This will set a max win cap of 1 EUR (or whatever currency you have selected)

Open the game and do a play with a win higher than the max exposure set.

:::doc Extra functionality Once the max win cap is reached, you can show a message notifying it using the Ethereal UI:

ETHEREAL.notifyMessage(MessageType.INFO, "cappedTitle", "cappedText", [ MessageAction.CONTINUE ]);

You can see a more explained version here :::


Demo vs real mode

The game can be played in demo mode, where there is no real money involved. When the game is in this mode, some regulations request to show it somewhere. Check the game mode on the connector after the open call is made:

let isDemo: boolean = ETHEREAL.rgs.getPlayMode() === PlayMode.FUN;

Certain functionalities of the connector such as promotions, jackpot or player history are not available on Demo mode.

The game cannot be recovered in demo mode.

Test it

To test this functionality, go to the lab and open the game with or without a player / wallet selected. To test locally, go to the lab, select a player and wallet, check the url generated on the URL Data section, copy the token url param and add it to your local url. If no token is used the game will load in demo mode.