<div class="uk-margin-bottom">
<h1 class="uk-margin-top">Gambling configuration for <strong class="esm-text-color-red">server admins</strong></h1>
<p>
<span class="uk-label uk-label-danger">Important</span> This feature is only available for communities that host servers <small>(Player mode disabled)</small>.
</p>
<p>
This article will help explain how the <code>/server gamble</code> command works and how to configure it.
</p>
<h3 class="uk-margin-remove-bottom">The Gambling Equation</h3>
<small>The equation used in ESM that calculates the amount of Poptabs a Player wins</small>
<p>
<pre><span class="esm-text-color-toast-yellow">AmountGambled</span> * (random(<span class="esm-text-color-toast-blue">Randomizer</span>) * <span class="esm-text-color-toast-green">Percentage</span> + <span class="esm-text-color-toast-orange">Modifier</span>)</pre>
</p>
<p>
Let's break the equation apart:
<ul class="uk-list">
<li>
<code class="esm-text-color-toast-yellow">AmountGambled</code>
<ul class="uk-list">
<li>The amount of Poptabs the Player initially gambles</li>
</ul>
</li>
<li>
<code class="esm-text-color-toast-blue">Randomizer</code>
<ul class="uk-list">
<li>The pre-configured randomizer values, this value becomes:<br>
<code>[Payout Randomizer Min, Payout Randomizer Mid, Payout Randomizer Max]</code></li>
<li>ESM uses the <a href="https://en.wikipedia.org/wiki/Normal_distribution">normal distribution</a> randomizer to focus more on the mid value (<a href="https://community.bistudio.com/wiki/random">Alternative Syntax 1</a>)</li>
</ul>
</li>
<li>
<code class="esm-text-color-toast-green">Percentage</code>
<ul class="uk-list">
<li>The percentage of <code class="esm-text-color-toast-yellow">AmountGambled</code> to give to the Player if they win</li>
<li>This is added together with the <code class="esm-text-color-toast-orange">Modifier</code> to ensure the value is always above the amount they initially gambled <small>(More on this later)</small></li>
</ul>
</li>
<li>
<code class="esm-text-color-toast-orange">Modifier</code>
<ul class="uk-list">
<li>The value added to <code class="esm-text-color-toast-green">Percentage</code> so they will win at least what they Gambled.</li>
</ul>
</li>
</ul>
</p>
<h4 class="uk-margin-remove-bottom">What does all of that mean?</h4>
<small>Given the following example:</small>
<p>
AmountGambled: <code>100</code>
<br>
Randomizer: <small>Low:</small> <code>0.1</code>, <small>Mid:</small> <code>0.5</code>, <small>Max:</small> <code>1</code>
<br>
Percentage: <code>90</code> (This will be converted to <code>0.90</code>)
<br>
Modifier: <code>1</code>
<pre>
AmountGambled * (random(Randomizer) * Percentage + Modifier)
<span class="esm-text-subtle">// Lowest Amount</span>
<span class="esm-text-color-toast-yellow">100</span> * (<span class="esm-text-color-toast-blue">0.1</span> * <span class="esm-text-color-toast-green">0.90</span> + <span class="esm-text-color-toast-orange">1</span>)
<span class="esm-text-color-toast-yellow">100</span> * (<span class="esm-text-color-toast-green">0.09</span> + <span class="esm-text-color-toast-orange">1</span>)
<span class="esm-text-color-toast-yellow">100</span> * <span class="esm-text-color-toast-orange">1.09</span>
= 109
<span class="esm-text-subtle">// Mid Amount</span>
<span class="esm-text-color-toast-yellow">100</span> * (<span class="esm-text-color-toast-blue">0.5</span> * <span class="esm-text-color-toast-green">0.90</span> + <span class="esm-text-color-toast-orange">1</span>)
<span class="esm-text-color-toast-yellow">100</span> * (<span class="esm-text-color-toast-green">0.45</span> + <span class="esm-text-color-toast-orange">1</span>)
<span class="esm-text-color-toast-yellow">100</span> * <span class="esm-text-color-toast-orange">1.45</span>
= 145
<span class="esm-text-subtle">// Max Amount</span>
<span class="esm-text-color-toast-yellow">100</span> * (<span class="esm-text-color-toast-blue">1</span> * <span class="esm-text-color-toast-green">0.90</span> + <span class="esm-text-color-toast-orange">1</span>)
<span class="esm-text-color-toast-yellow">100</span> * (<span class="esm-text-color-toast-green">0.90</span> + <span class="esm-text-color-toast-orange">1</span>)
<span class="esm-text-color-toast-yellow">100</span> * <span class="esm-text-color-toast-orange">1.90</span>
= 190
</pre>
<p>
So if the Player gambled 100 Poptabs and won:
<br>
- The lowest they could win is <code>109</code> Poptabs
<br>
- The max amount they could win is <code>190</code> Poptabs
<br>
- But on average, they will win around <code>145</code> Poptabs
</p>
<br>
<h3 class="uk-margin-remove-bottom">Gambling Settings</h3>
<small>These are all configurable in the Server Portal under Register Server or Modify Server</small>
<h4 class="uk-margin-remove-bottom">Win Chance</h4>
<small>The percentage chance the Player has to win</small>
<p class="uk-margin-small-top">
Range: <code>0 - 100</code>
<br>
Default: <code>35</code>
</p>
<h4 class="uk-margin-remove-bottom">Payout Percentage</h4>
<p class="uk-margin-small-top">
Range: <code>0 - 100</code>
<br>
Default: <code>90</code>
</p>
<h4 class="uk-margin-remove-bottom">Payout Modifier</h4>
<p class="uk-margin-small-top">
Range: <small>Recommended to be greater or equal to 1</small>
<br>
Default: <code>1</code>
</p>
<h4 class="uk-margin-remove-bottom">Payout Randomizer Min</h4>
<small>This value should be smaller than Payout Randomizer Mid</small>
<p class="uk-margin-small-top">
Range: <code>0 - n</code>
<br>
Default: <code>0</code>
</p>
<h4 class="uk-margin-remove-bottom">Payout Randomizer Mid</h4>
<small>This value should be smaller than Payout Randomizer Max, but bigger than Payout Randomizer Min</small>
<p class="uk-margin-small-top">
Range: <code>0 - n</code>
<br>
Default: <code>0.5</code>
</p>
<h4 class="uk-margin-remove-bottom">Payout Randomizer Max</h4>
<small>This value should be bigger than Payout Randomizer Mid</small>
<p class="uk-margin-small-top">
Range: <code>0 - n</code>
<br>
Default: <code>1</code>
</p>
</div>