Example #1
0
from server.endpoint import Endpoint
from server.model import Model, Field, CheckboxField, TextareaField, SelectField, ArrayField
from server import filters

talents_endpoint = Endpoint(
    "talents",
    "Talents",
    Model([
        Field("_id", "Talent", table=False),
        TextareaField("short", "Description", render=filters.description),
        TextareaField("description", "Long Description", table=False),
        SelectField("activation",
                    "Activation",
                    options=[
                        {
                            "display": "Passive",
                            "value": "passive"
                        },
                        {
                            "display": "Active",
                            "value": "active"
                        },
                        {
                            "display": "Active (Action)",
                            "value": "active_action"
                        },
                        {
                            "display": "Active (Incidental)",
                            "value": "active_incidental"
                        },
                        {
Example #2
0
import inspect

for loader, name, is_pkg in pkgutil.walk_packages(__path__):
    module = loader.find_module(name).load_module(name)

    for name, value in inspect.getmembers(module):
        if name.startswith('__'):
            continue

        globals()[name] = value
        __all__.append(name)


attachments = Endpoint("attachments", "Attachments", Model([
    ObjectIdField("_id", "ID", readonly=True),
    Field("name", "Name", table=False),
    SelectField("category", "Category", ["Armor", "Lightsaber", "Weapon"], table=False),
    NumberField("price", "Price", max=100000),
    CheckboxField("restricted", "Restricted"),
    NumberField("encumbrance", "Encumbrance"),
    NumberField("hardpoints", "HP Required"),
    NumberField("rarity", "Rarity", max=10),
    ArrayField(Field("models", "Model")),
    Field("modifiers", "Base Modifier"),
    ArrayField(
        FieldGroup("modification", "Modification", [
            NumberField("max", "Max", min=1),
            SelectField("type", "Type", [
                {"display": "Damage", "value": "damage"},
                {"display": "Weapon Quality", "value": "weapon_quality"},
                {"display": "Innate Talent", "value": "talent"},
Example #3
0
from server.endpoint import Endpoint
from server.model import Model, Field, CheckboxField, FieldGroup, NumberField

from pymongo import ASCENDING


species_endpoint = Endpoint("species", "Species", Model([
    Field("_id", "Name", table=False),
    CheckboxField("player", "Player"),
    FieldGroup("characteristics", "Characteristics", [
        NumberField("brawn", "Brawn", 1, 5, default=1),
        NumberField("agility", "Agility", 1, 5, default=1),
        NumberField("intellect", "Intellect", 1, 5, default=1),
        NumberField("cunning", "Cunning", 1, 5, default=1),
        NumberField("willpower", "Willpower", 1, 5, default=1),
        NumberField("presence", "Presence", 1, 5, default=1),
    ]),
    NumberField("wound", "Wound Threshold"),
    NumberField("strain", "Strain Threshold"),
    NumberField("xp", "Starting XP", required=False)
]))
species_endpoint.table_sort = {"key": "_id", "dir": ASCENDING}
Example #4
0
from server import filters

from server.endpoint import Endpoint
from server.model import Model, Field, SelectField, TextareaField, CheckboxField, ArrayField

qualities_endpoint = Endpoint("qualities",
                              "Qualities",
                              Model([
                                  Field("_id", "Name", table=False),
                                  SelectField("active", "Active",
                                              ["Active", "Passive"]),
                                  TextareaField("description",
                                                "Description",
                                                render=filters.description),
                                  CheckboxField("ranked",
                                                "Ranked",
                                                render=filters.format_yes_no),
                                  ArrayField(Field("index", "Index"),
                                             table=False),
                              ]),
                              objectid=False)
Example #5
0
from server import filters

from server.endpoint import Endpoint
from server.model import Model, Field, ObjectIdField, SelectField, ArrayField, FieldGroup, NumberField

creatures_endpoint = Endpoint(
    "creatures", "Creatures",
    Model([
        ObjectIdField("_id", "ID", readonly=True),
        Field("name", "Name", table=False),
        SelectField("level", "Type", ["Minion", "Rival", "Nemesis"]),
        FieldGroup("characteristics", "Characteristics", [
            NumberField("brawn", "Brawn", 1, 5, default=1),
            NumberField("agility", "Agility", 1, 5, default=1),
            NumberField("intellect", "Intellect", 1, 5, default=1),
            NumberField("cunning", "Cunning", 1, 5, default=1),
            NumberField("willpower", "Willpower", 1, 5, default=1),
            NumberField("presence", "Presence", 1, 5, default=1),
        ]),
        NumberField("soak", "Soak", table=False),
        NumberField("wound", "Wound Threshold", table=False),
        NumberField("strain", "Strain Threshold", table=False),
        ArrayField(
            FieldGroup("skills",
                       "Skills",
                       [Field("id", "Skill"),
                        NumberField("value", "Value")],
                       render_method=filters.format_skill)),
        ArrayField(Field("talents", "Talents", render=filters.format_talent)),
        ArrayField(
            Field("abilities", "Abilities", render=filters.format_ability)),
Example #6
0
import re

from server.endpoint import Endpoint
from server.model import Model, Field, CheckboxField, TextareaField, SelectField, ArrayField, NumberField, ObjectIdField

gear_endpoint = Endpoint(
    "gear", "Items",
    Model([
        ObjectIdField("_id", "ID", readonly=True),
        Field("name", "Item", table=False),
        NumberField("price", "Price"),
        NumberField("encumbrance", "Encumbrance"),
        NumberField("rarity", "Rarity"),
        CheckboxField("restricted", "Restricted"),
        TextareaField("description", "Long Description", table=False),
        SelectField("category",
                    "Category",
                    options=[
                        "Adversary", "Ancient Talismans", "Communications",
                        "Consumables", "Cybernetics", "Detection Devices",
                        "Droids", "Drugs", "Field Equipment",
                        "Illegal Equipment", "Medical", "Poison",
                        "Recreational", "Scanning and Surveillance",
                        "Security", "Storage", "Survival", "Tools", "Uniforms"
                    ],
                    table=False),
        ArrayField(Field("index", "Index"), table=False)
    ]))
gear_endpoint.table_query = {"category": {"$not": re.compile("Adversary")}}
Example #7
0
from server import filters
from server.endpoint import Endpoint
from server.model import Model, Field, CheckboxField, TextareaField, SelectField, ArrayField, NumberField, FieldGroup, \
    ObjectIdField

weapons_endpoint = Endpoint(
    "weapons", "Weapons",
    Model([
        ObjectIdField("_id", "ID"),
        Field("name", "Name", table=False),
        SelectField("category",
                    "Category",
                    options=[
                        "Brawl", "Energy", "Explosives", "Grenades",
                        "Lightsaber Hilts", "Melee", "Micro-Rockets", "Other",
                        "Portable Missiles", "Slugthrowers", "Thrown"
                    ],
                    table=False),
        SelectField("skill",
                    "Skill",
                    options=[
                        {
                            "display": "Brawl",
                            "value": "brawl"
                        },
                        {
                            "display": "Melee",
                            "value": "melee"
                        },
                        {
                            "display": "Lightsaber",
Example #8
0
from server.endpoint import Endpoint
from server.model import Model, Field, TextareaField, SelectField

book_endpoint = Endpoint("books", "Books", Model([
    Field("name", "Name", table=False),
    SelectField("system", "System", [
        "Edge of the Empire",
        "Age of Rebellion",
        "Force and Destiny",
        "Star Wars Roleplaying"
    ]),
    Field("key", "SKU"),
    Field("_id", "Initials"),  # todo should allow specifying custom order for table display
    Field("isbn", "ISBN", table=False),
    Field("ffg_url", "Product Page", html_type="url", table=False),
    Field("release_date", "Release Date", html_type="date", table=False),
    TextareaField("description", "Description", table=False)
], index=False), objectid=False)