Esempio n. 1
0
 def __init__(self, config_data: Dict = None):
     if not config_data:
         config_data = json.loads(
             pkg_resources.resource_string(__name__,
                                           'resources/config.json'))
     self.config_data = config_data
     self.endpoints = []
     endpoints = config_data.get('endpoints')
     for endpoint_data in endpoints:
         self.endpoints.append(Endpoint(endpoint_data))
Esempio n. 2
0
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"
                        },
                        {
                            "display": "Active (Incidental, Out Of Turn)",
                            "value": "active_incidental_oot"
                        },
                        {
                            "display": "Active (Maneuver)",
                            "value": "active_maneuver"
                        },
                    ],
                    render=lambda x: activation(x)),
        CheckboxField("ranked", "Ranked"),
        CheckboxField("force", "Force Sensitive"),
        ArrayField(Field("index", "Index"), table=False)
    ]),
    objectid=False)
Esempio n. 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}
Esempio n. 4
0
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"},
                {"display": "Skill", "value": "skill"},
                {"display": "Characteristic", "value": "characteristic"},
                {"display": "Additional", "value": "other"},
            ]),
            Field("value", "Value"),
            Field("quality", "Weapon Quality", required=False),
            Field("talent", "Talent", required=False),
            Field("skill", "Skill", required=False),
            Field("characteristic", "Characteristic", required=False),
        ]), table=False),
    TextareaField("description", "Description"),
    ArrayField(Field("index", "Index"), table=False)
]))
Esempio n. 5
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)
Esempio n. 6
0
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)),
        ArrayField(
            FieldGroup(
                "equipment",
                "Weapons", [
                    Field("name", "Name"),
                    Field("damage", "Damage"),
                    Field("critical", "Critical"),
                    SelectField(
                        "range", "Range",
                        ["Engaged", "Short", "Medium", "Long", "Extreme"]),
                    SelectField("skill", "Skill",
                                ["Brawl", "Ranged_Light", "Ranged_Heavy"]),
                    ArrayField(
                        FieldGroup("special", "Special", [
                            Field("id", "Quality ID"),
                            NumberField("value", "Value"),
                        ]))
                ],
                render_method=lambda x: x["name"])),
        ArrayField(Field("index", "Index"), table=False)
    ]))
Esempio n. 7
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")}}
Esempio n. 8
0
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",
                            "value": "lightsaber"
                        },
                        {
                            "display": "Ranged (Light)",
                            "value": "ranged_light"
                        },
                        {
                            "display": "Ranged (Heavy)",
                            "value": "ranged_heavy"
                        },
                        {
                            "display": "Gunnery",
                            "value": "gunnery"
                        },
                    ],
                    render=filters.format_skill),
        Field("damage", "Damage", default=0),
        Field("critical", "Critical", default="-"),
        SelectField("range",
                    "Range",
                    options=["Engaged", "Short", "Medium", "Long", "Extreme"]),
        NumberField("encumbrance", "Encumbrance"),
        NumberField("hardpoints", "Hardpoints"),
        NumberField("price", "Price", max=100000),
        CheckboxField("restricted", "Restricted"),
        NumberField("rarity", "Rarity", max=10),
        ArrayField(
            FieldGroup("qualities", "Special", [
                Field("id", "Quality ID"),
                NumberField("value", "Rating"),
            ], filters.format_quality_object)),
        TextareaField("short", "Short Description", table=False),
        TextareaField("description", "Long Description", table=False),
        ArrayField(Field("index", "Index"), table=False),
    ]))
Esempio n. 9
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)