Promotion
Use the Ethereal promo ui
Configure the UI to have the promotions:
ETHEREAL.ui.config({
[UiComponentType.PROMO]: {
autoEnablePromo?: true;
waitUntilRoundEnd?: true;
onAdjustBet: (maxBet: number) => {
/** Example: Get the closest bet that is the same or below the maximum bet allowed */
let index = listOfBets.findLastIndex((b: number) => b <= maxBet);
let bet = bets[index >= 0? index : 0];
return bet;
},
onStartPromo?: () => {
/** If needed, prepare your game for a promotion, like disable autoplay,
* turbo mode or don't visually substract balance when starting a play */
},
onEndPromo?: () => {
/** If needed, set your game to normal flow */
},
}
})
- autoEnablePromo: (Default: true) If the promotions will be automatically enabled once received. (Currently the promotions are enabled automatically, once the functionality to be able to enable the promotions manually is added, this parameter will be used)
- waitUntilRoundEnd: (Default: true) If false, the UI will show the popup with the promotion info as soon as it receive the last play call of the round. If true, the game can show any animations needed first (like the stop of the slot machine with the symbols, wins, etc) and then call the end of the round (ETHEREAL.notifyRoundEnd()), this will be then the moment the UI shows the popup.
- onStartPromo: Action to do when a promo start, if any.
- onEndPromo: Action to do when a promo end, if any.
- onAdjustBet: This will be used at the beginning of each round with a promotion active. It allows to determine the bet to be used on the promotion given a maximum allowed bet by the promotion and if the game needs to prepare any other data for the promotion to work and use, as maximum, the given bet. Without this, the promotion plugin will NOT activate.
- maxTotalBet Maximum bet in base value (NOT in currency) that this round can have.
- Return: Total bet in base value (NOT in currency) the game can use based on the maximum bet. This total bet may be lower or the same as the maxTotalBet but never higher.
Make sure you block the bets, buy into functionality and everything that allows the player to change the total bet when requested by the connector:
ETHEREAL.onRequestBlockBet((block: boolean, totalBet?: number) => { /** Your code here */ });
With this the game will connect with the promotion system.
Test it
- Go to the lab
- Select the casino, player and wallet you want to test
- On the right lateral select the "Promos" tab and create a promotion with the data you need.
- It might take a little bit for the promotion to be enabled for the player. Reload the game. If the player is in the middle of a round, the promotion will appear once this round finish.
- To test locally, on the url data section you can copy the token and add it to your local url, so it looks like something like this:
http://localhost:3000/index.html?devApiRoute=test.rgsplatform.win&casinoId=<casinoId>&gameId=<gameId>&token=<token>