mirror of
https://github.com/evennia/evennia.git
synced 2026-03-19 06:16:31 +01:00
429 lines
No EOL
27 KiB
HTML
429 lines
No EOL
27 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>evennia.contrib.rpg.dice.dice — Evennia 2.x documentation</title>
|
||
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="next" title="evennia.contrib.rpg.dice.tests" href="evennia.contrib.rpg.dice.tests.html" />
|
||
<link rel="prev" title="evennia.contrib.rpg.dice" href="evennia.contrib.rpg.dice.html" />
|
||
</head><body>
|
||
|
||
|
||
|
||
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.contrib.rpg.dice.tests.html" title="evennia.contrib.rpg.dice.tests"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.contrib.rpg.dice.html" title="evennia.contrib.rpg.dice"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 2.x</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.contrib.html" >evennia.contrib</a> »</li>
|
||
<li class="nav-item nav-item-5"><a href="evennia.contrib.rpg.html" >evennia.contrib.rpg</a> »</li>
|
||
<li class="nav-item nav-item-6"><a href="evennia.contrib.rpg.dice.html" accesskey="U">evennia.contrib.rpg.dice</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.contrib.rpg.dice.dice</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
|
||
<div class="documentwrapper">
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
|
||
</a></p>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<h3><a href="../index.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">evennia.contrib.rpg.dice.dice</a><ul>
|
||
<li><a class="reference internal" href="#dice">Dice</a></li>
|
||
<li><a class="reference internal" href="#installation">Installation:</a></li>
|
||
<li><a class="reference internal" href="#usage">Usage:</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="evennia.contrib.rpg.dice.html"
|
||
title="previous chapter">evennia.contrib.rpg.dice</a></p>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="evennia.contrib.rpg.dice.tests.html"
|
||
title="next chapter">evennia.contrib.rpg.dice.tests</a></p>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/api/evennia.contrib.rpg.dice.dice.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com/docs/latest/index.html">Documentation Top</a> </li>
|
||
<li><a href="https://www.evennia.com">Evennia Home</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li>
|
||
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
|
||
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
|
||
<a href="https://evennia.blogspot.com/">Blog</a>
|
||
</li>
|
||
</ul>
|
||
<h3>Doc Versions</h3>
|
||
<ul>
|
||
|
||
<li><a href="evennia.contrib.rpg.dice.dice.html">2.x (main branch)</a></li>
|
||
<ul>
|
||
<li><a href="../1.3.0/index.html">1.3.0 (v1.3.0 branch)</a></li>
|
||
|
||
<li><a href="../0.9.5/index.html">0.9.5 (v0.9.5 branch)</a></li>
|
||
|
||
|
||
</ul>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="module-evennia.contrib.rpg.dice.dice">
|
||
<span id="evennia-contrib-rpg-dice-dice"></span><h1>evennia.contrib.rpg.dice.dice<a class="headerlink" href="#module-evennia.contrib.rpg.dice.dice" title="Permalink to this headline">¶</a></h1>
|
||
<section id="dice">
|
||
<h2>Dice<a class="headerlink" href="#dice" title="Permalink to this headline">¶</a></h2>
|
||
<p>Rolls dice for roleplaying, in-game gambling or GM:ing</p>
|
||
<p>Evennia contribution - Griatch 2012</p>
|
||
<p>This module implements a a dice-roller and a <strong>dice</strong>/<strong>roll</strong> command
|
||
to go with it. It uses standard RPG ‘d’-syntax (e.g. 2d6 to roll two
|
||
six-sided die) and also supports modifiers such as 3d6 + 5.</p>
|
||
<blockquote>
|
||
<div><p>> roll 1d20 + 2</p>
|
||
</div></blockquote>
|
||
<p>One can also specify a standard Python operator in order to specify
|
||
eventual target numbers and get results in a fair and guaranteed
|
||
unbiased way. For example a GM could (using the dice command) from
|
||
the start define the roll as 2d6 < 8 to show that a roll below 8 is
|
||
required to succeed. The command will normally echo this result to all
|
||
parties (although it also has options for hidden and secret rolls).</p>
|
||
</section>
|
||
<section id="installation">
|
||
<h2>Installation:<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h2>
|
||
<p>Add the <strong>CmdDice</strong> command from this module to your character’s cmdset
|
||
(and then restart the server):</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/commands/default_cmdsets.py</span>
|
||
|
||
<span class="c1"># ...</span>
|
||
<span class="kn">from</span> <span class="nn">evennia.contrib.rpg</span> <span class="kn">import</span> <span class="n">dice</span> <span class="o"><---</span>
|
||
|
||
<span class="k">class</span> <span class="nc">CharacterCmdSet</span><span class="p">(</span><span class="n">default_cmds</span><span class="o">.</span><span class="n">CharacterCmdSet</span><span class="p">):</span>
|
||
<span class="c1"># ...</span>
|
||
<span class="k">def</span> <span class="nf">at_cmdset_creation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="c1"># ...</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dice</span><span class="o">.</span><span class="n">CmdDice</span><span class="p">())</span> <span class="c1"># <---</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="usage">
|
||
<h2>Usage:<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
|
||
<blockquote>
|
||
<div><p>roll 1d100 + 10</p>
|
||
</div></blockquote>
|
||
<p>To roll dice in code, use the <strong>roll</strong> function from this module:</p>
|
||
<blockquote>
|
||
<div><p>from evennia.contrib.rpg import dice</p>
|
||
<p>dice.roll(“3d10 + 2”)</p>
|
||
</div></blockquote>
|
||
<p>If your system generates the dice dynamically you can also enter each part
|
||
of the roll separately:</p>
|
||
<blockquote>
|
||
<div><p>dice.roll(3, 10, (“+”, 2)) # 3d10 + 2</p>
|
||
</div></blockquote>
|
||
<dl class="py function">
|
||
<dt id="evennia.contrib.rpg.dice.dice.roll">
|
||
<code class="sig-prename descclassname">evennia.contrib.rpg.dice.dice.</code><code class="sig-name descname">roll</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">dice</span></em>, <em class="sig-param"><span class="n">dicetype</span><span class="o">=</span><span class="default_value">6</span></em>, <em class="sig-param"><span class="n">modifier</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">conditional</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">return_tuple</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">max_dicenum</span><span class="o">=</span><span class="default_value">10</span></em>, <em class="sig-param"><span class="n">max_dicetype</span><span class="o">=</span><span class="default_value">1000</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/dice/dice.html#roll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.roll" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This is a standard dice roller.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>dice</strong> (<em>int</em><em> or </em><em>str</em>) – If an <strong>int</strong>, this is the number of dice to roll, and <strong>dicetype</strong> is used
|
||
to determine the type. If a <strong>str</strong>, it should be on the form <strong>NdM</strong> where <strong>N</strong> is the number
|
||
of dice and <strong>M</strong> is the number of sides on each die. Also
|
||
<strong>NdM [modifier] [number] [conditional]</strong> is understood, e.g. <strong>1d6 + 3</strong>
|
||
or <strong>2d10 / 2 > 10</strong>.</p></li>
|
||
<li><p><strong>dicetype</strong> (<em>int</em><em>, </em><em>optional</em>) – Number of sides of the dice to be rolled. Ignored if
|
||
<strong>dice</strong> is a string.</p></li>
|
||
<li><p><strong>modifier</strong> (<em>tuple</em><em>, </em><em>optional</em>) – A tuple <strong>(operator, value)</strong>, where operator is
|
||
one of <strong>“+”</strong>, <strong>“-”</strong>, <strong>“/”</strong> or <strong>“*”</strong>. The result of the dice
|
||
roll(s) will be modified by this value. Ignored if <strong>dice</strong> is a string.</p></li>
|
||
<li><p><strong>conditional</strong> (<em>tuple</em><em>, </em><em>optional</em>) – A tuple <strong>(conditional, value)</strong>, where
|
||
conditional is one of <strong>“==”</strong>,**”<”<strong>,</strong>”>”<strong>,</strong>”>=”<strong>,</strong>”<=**” or “<strong>!=</strong>”.
|
||
Ignored if <strong>dice</strong> is a string.</p></li>
|
||
<li><p><strong>return_tuple</strong> (<em>bool</em>) – Return a tuple with all individual roll
|
||
results or not.</p></li>
|
||
<li><p><strong>max_dicenum</strong> (<em>int</em>) – The max number of dice to allow to be rolled.</p></li>
|
||
<li><p><strong>max_dicetype</strong> (<em>int</em>) – The max number of sides on the dice to roll.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><em>int, bool or tuple</em> – By default, this is the result of the roll + modifiers. If
|
||
<strong>conditional</strong> is given, or <strong>dice</strong> is a string defining a conditional, then a True/False
|
||
value is returned. Finally, if <strong>return_tuple</strong> is set, this is a tuple
|
||
<strong>(result, outcome, diff, rolls)</strong>, where, <strong>result</strong> is the the normal result of the
|
||
roll + modifiers, <strong>outcome</strong> and <strong>diff</strong> are the boolean absolute difference between the roll
|
||
and the <strong>conditional</strong> input; both will be will be <strong>None</strong> if <strong>conditional</strong> is not set.
|
||
The <strong>rolls</strong> a tuple holding all the individual rolls (one or more depending on how many
|
||
dice were rolled).</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><strong>TypeError if non-supported modifiers</strong><strong> or </strong><strong>conditionals are given.</strong> – </p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>All input numbers are converted to integers.</p>
|
||
<p class="rubric">Examples</p>
|
||
<dl>
|
||
<dt>::</dt><dd><p># string form
|
||
print roll(“3d6 + 2”)
|
||
10
|
||
print roll(“2d10 + 2 > 10”)
|
||
True
|
||
print roll(“2d20 - 2 >= 10”)
|
||
(8, False, 2, (4, 6)) # roll was 4 + 6 - 2 = 8</p>
|
||
<p># explicit arguments
|
||
print roll(2, 6) # 2d6
|
||
7
|
||
print roll(1, 100, (‘+’, 5) # 1d100 + 5
|
||
4
|
||
print roll(1, 20, conditional=(‘<’, 10) # let’say we roll 3
|
||
True
|
||
print roll(3, 10, return_tuple=True)
|
||
(11, None, None, (2, 5, 4))
|
||
print roll(2, 20, (‘-’, 2), conditional=(‘>=’, 10), return_tuple=True)
|
||
(8, False, 2, (4, 6)) # roll was 4 + 6 - 2 = 8</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.contrib.rpg.dice.dice.roll_dice">
|
||
<code class="sig-prename descclassname">evennia.contrib.rpg.dice.dice.</code><code class="sig-name descname">roll_dice</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">dice</span></em>, <em class="sig-param"><span class="n">dicetype</span><span class="o">=</span><span class="default_value">6</span></em>, <em class="sig-param"><span class="n">modifier</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">conditional</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">return_tuple</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">max_dicenum</span><span class="o">=</span><span class="default_value">10</span></em>, <em class="sig-param"><span class="n">max_dicetype</span><span class="o">=</span><span class="default_value">1000</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.roll_dice" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This is a standard dice roller.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>dice</strong> (<em>int</em><em> or </em><em>str</em>) – If an <strong>int</strong>, this is the number of dice to roll, and <strong>dicetype</strong> is used
|
||
to determine the type. If a <strong>str</strong>, it should be on the form <strong>NdM</strong> where <strong>N</strong> is the number
|
||
of dice and <strong>M</strong> is the number of sides on each die. Also
|
||
<strong>NdM [modifier] [number] [conditional]</strong> is understood, e.g. <strong>1d6 + 3</strong>
|
||
or <strong>2d10 / 2 > 10</strong>.</p></li>
|
||
<li><p><strong>dicetype</strong> (<em>int</em><em>, </em><em>optional</em>) – Number of sides of the dice to be rolled. Ignored if
|
||
<strong>dice</strong> is a string.</p></li>
|
||
<li><p><strong>modifier</strong> (<em>tuple</em><em>, </em><em>optional</em>) – A tuple <strong>(operator, value)</strong>, where operator is
|
||
one of <strong>“+”</strong>, <strong>“-”</strong>, <strong>“/”</strong> or <strong>“*”</strong>. The result of the dice
|
||
roll(s) will be modified by this value. Ignored if <strong>dice</strong> is a string.</p></li>
|
||
<li><p><strong>conditional</strong> (<em>tuple</em><em>, </em><em>optional</em>) – A tuple <strong>(conditional, value)</strong>, where
|
||
conditional is one of <strong>“==”</strong>,**”<”<strong>,</strong>”>”<strong>,</strong>”>=”<strong>,</strong>”<=**” or “<strong>!=</strong>”.
|
||
Ignored if <strong>dice</strong> is a string.</p></li>
|
||
<li><p><strong>return_tuple</strong> (<em>bool</em>) – Return a tuple with all individual roll
|
||
results or not.</p></li>
|
||
<li><p><strong>max_dicenum</strong> (<em>int</em>) – The max number of dice to allow to be rolled.</p></li>
|
||
<li><p><strong>max_dicetype</strong> (<em>int</em>) – The max number of sides on the dice to roll.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><em>int, bool or tuple</em> – By default, this is the result of the roll + modifiers. If
|
||
<strong>conditional</strong> is given, or <strong>dice</strong> is a string defining a conditional, then a True/False
|
||
value is returned. Finally, if <strong>return_tuple</strong> is set, this is a tuple
|
||
<strong>(result, outcome, diff, rolls)</strong>, where, <strong>result</strong> is the the normal result of the
|
||
roll + modifiers, <strong>outcome</strong> and <strong>diff</strong> are the boolean absolute difference between the roll
|
||
and the <strong>conditional</strong> input; both will be will be <strong>None</strong> if <strong>conditional</strong> is not set.
|
||
The <strong>rolls</strong> a tuple holding all the individual rolls (one or more depending on how many
|
||
dice were rolled).</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><strong>TypeError if non-supported modifiers</strong><strong> or </strong><strong>conditionals are given.</strong> – </p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>All input numbers are converted to integers.</p>
|
||
<p class="rubric">Examples</p>
|
||
<dl>
|
||
<dt>::</dt><dd><p># string form
|
||
print roll(“3d6 + 2”)
|
||
10
|
||
print roll(“2d10 + 2 > 10”)
|
||
True
|
||
print roll(“2d20 - 2 >= 10”)
|
||
(8, False, 2, (4, 6)) # roll was 4 + 6 - 2 = 8</p>
|
||
<p># explicit arguments
|
||
print roll(2, 6) # 2d6
|
||
7
|
||
print roll(1, 100, (‘+’, 5) # 1d100 + 5
|
||
4
|
||
print roll(1, 20, conditional=(‘<’, 10) # let’say we roll 3
|
||
True
|
||
print roll(3, 10, return_tuple=True)
|
||
(11, None, None, (2, 5, 4))
|
||
print roll(2, 20, (‘-’, 2), conditional=(‘>=’, 10), return_tuple=True)
|
||
(8, False, 2, (4, 6)) # roll was 4 + 6 - 2 = 8</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.contrib.rpg.dice.dice.CmdDice">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.rpg.dice.dice.</code><code class="sig-name descname">CmdDice</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/dice/dice.html#CmdDice"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.CmdDice" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.muxcommand.html#evennia.commands.default.muxcommand.MuxCommand" title="evennia.commands.default.muxcommand.MuxCommand"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.muxcommand.MuxCommand</span></code></a></p>
|
||
<p>roll dice</p>
|
||
<dl class="simple">
|
||
<dt>Usage:</dt><dd><p>dice[/switch] <nr>d<sides> [modifier] [success condition]</p>
|
||
</dd>
|
||
<dt>Switch:</dt><dd><p>hidden - tell the room the roll is being done, but don’t show the result
|
||
secret - don’t inform the room about neither roll nor result</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Examples</p>
|
||
<p>dice 3d6 + 4
|
||
dice 1d100 - 2 < 50</p>
|
||
<p>This will roll the given number of dice with given sides and modifiers.
|
||
So e.g. 2d6 + 3 means to ‘roll a 6-sided die 2 times and add the result,
|
||
then add 3 to the total’.
|
||
Accepted modifiers are +, -, * and /.
|
||
A success condition is given as normal Python conditionals
|
||
(<,>,<=,>=,==,!=). So e.g. 2d6 + 3 > 10 means that the roll will succeed
|
||
only if the final result is above 8. If a success condition is given, the
|
||
outcome (pass/fail) will be echoed along with how much it succeeded/failed
|
||
with. The hidden/secret switches will hide all or parts of the roll from
|
||
everyone but the person rolling.</p>
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.rpg.dice.dice.CmdDice.key">
|
||
<code class="sig-name descname">key</code><em class="property"> = 'dice'</em><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.CmdDice.key" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.rpg.dice.dice.CmdDice.aliases">
|
||
<code class="sig-name descname">aliases</code><em class="property"> = ['@dice', 'roll']</em><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.CmdDice.aliases" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.rpg.dice.dice.CmdDice.locks">
|
||
<code class="sig-name descname">locks</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.CmdDice.locks" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.rpg.dice.dice.CmdDice.func">
|
||
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/dice/dice.html#CmdDice.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.CmdDice.func" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Mostly parsing for calling the dice roller function</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.rpg.dice.dice.CmdDice.help_category">
|
||
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.CmdDice.help_category" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.rpg.dice.dice.CmdDice.lock_storage">
|
||
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.CmdDice.lock_storage" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.rpg.dice.dice.CmdDice.search_index_entry">
|
||
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '@dice roll', 'category': 'general', 'key': 'dice', 'no_prefix': ' dice roll', 'tags': '', 'text': "\n roll dice\n\n Usage:\n dice[/switch] <nr>d<sides> [modifier] [success condition]\n\n Switch:\n hidden - tell the room the roll is being done, but don't show the result\n secret - don't inform the room about neither roll nor result\n\n Examples:\n dice 3d6 + 4\n dice 1d100 - 2 < 50\n\n This will roll the given number of dice with given sides and modifiers.\n So e.g. 2d6 + 3 means to 'roll a 6-sided die 2 times and add the result,\n then add 3 to the total'.\n Accepted modifiers are +, -, * and /.\n A success condition is given as normal Python conditionals\n (<,>,<=,>=,==,!=). So e.g. 2d6 + 3 > 10 means that the roll will succeed\n only if the final result is above 8. If a success condition is given, the\n outcome (pass/fail) will be echoed along with how much it succeeded/failed\n with. The hidden/secret switches will hide all or parts of the roll from\n everyone but the person rolling.\n "}</em><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.CmdDice.search_index_entry" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.contrib.rpg.dice.dice.DiceCmdSet">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.rpg.dice.dice.</code><code class="sig-name descname">DiceCmdSet</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">cmdsetobj</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">key</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/dice/dice.html#DiceCmdSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.DiceCmdSet" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.commands.cmdset.html#evennia.commands.cmdset.CmdSet" title="evennia.commands.cmdset.CmdSet"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.cmdset.CmdSet</span></code></a></p>
|
||
<p>a small cmdset for testing purposes.
|
||
Add with @py self.cmdset.add(“contrib.dice.DiceCmdSet”)</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.rpg.dice.dice.DiceCmdSet.at_cmdset_creation">
|
||
<code class="sig-name descname">at_cmdset_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/dice/dice.html#DiceCmdSet.at_cmdset_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.DiceCmdSet.at_cmdset_creation" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Called when set is created</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.rpg.dice.dice.DiceCmdSet.path">
|
||
<code class="sig-name descname">path</code><em class="property"> = 'evennia.contrib.rpg.dice.dice.DiceCmdSet'</em><a class="headerlink" href="#evennia.contrib.rpg.dice.dice.DiceCmdSet.path" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.contrib.rpg.dice.tests.html" title="evennia.contrib.rpg.dice.tests"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.contrib.rpg.dice.html" title="evennia.contrib.rpg.dice"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 2.x</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.contrib.html" >evennia.contrib</a> »</li>
|
||
<li class="nav-item nav-item-5"><a href="evennia.contrib.rpg.html" >evennia.contrib.rpg</a> »</li>
|
||
<li class="nav-item nav-item-6"><a href="evennia.contrib.rpg.dice.html" >evennia.contrib.rpg.dice</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.contrib.rpg.dice.dice</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2023, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |