示例#1
0
    def func(self):
        display = []
        attributes = self.caller.get_attributes()
        for key in attributes:
            value = self.parse_skill_value(attributes[key])
            if value > 0:
                skill_name = rules.get_skill_name(key, value)
                display.append("%s: {y%s{n" % (titlecase(key),titlecase(skill_name)))

        message = []
        for line in display:
            message.append(unicode(line))

        self.caller.msg("\n".join(message))
示例#2
0
def mutant_power_actions(caller):
    power_name = caller.db.mutant_power
    power = MUTANT_POWERS.get(power_name)
    if hasattr(caller.ndb._menutree, "activate_power"):
        caller.location.msg_contents(
            "|gSYSTEM:|n {} activate their mutant power: {} Order: {}".format(
                caller.key, titlecase(power_name), power.get("action_order")))
        caller.db.moxie = caller.db.moxie - 1
        if caller.db.moxie == 1:
            caller.location.msg_contents(
                "|gSYSTEM:|n {} completely LOSES IT! "
                "Consult the GM to determine the results.".format(caller.key))
        return "", ()
    text = "Treason huh?  Hey we've all done it.  You can't help how you were incubated.  It's just part of who you " \
           "are.  And who you are is a mutant.  A dirty, filthy mutant.  Well, might as well have some fun with it.  " \
           "Using your mutant powers costs 1 Moxie.  Remember, if your Moxie drops to 1, you will absolutely LOSE IT." \
           "\n\n|wPower:|n {}\n|wAction Order:|n {}\n|wDescription:|n {}".\
        format(power_name, power.get("action_order"), power.get("description"))
    options = ({
        "desc": "Activate",
        "exec": _wrapper(caller, "activate_power", 1),
        "goto": "mutant_power_actions"
    }, {
        "key": ["back", "b"],
        "desc": "Go Back",
        "goto": "menu_start_node"
    })
    return text, options
示例#3
0
    def func(self):
        if not self.args:
            self.caller.msg("You must supply arguments.  Try again moron.")
            return
        elif not self.rhs:
            self.caller.msg("You much provide a title and a message to make a post.")
            return
        else:
            title, message = self.rhs.split("/")
            new_post = Post(db_key=title, db_message=message, db_sender=self.caller, db_likes=0,
                            db_date_posted=datetime.datetime.now())
            new_post.save()

            board_posted_to = Board.objects.get(id=self.lhs)

            board_posted_to.db_posts.add(new_post)
            board_posted_to.save()
            self.caller.msg("Post '%s' successfully posted to Board %s" % (titlecase(title), self.lhs))
示例#4
0
def ask_fullname(caller):
    text = ""

    fullname = caller.db.fullname

    if fullname:
        text += "Current Full Name: {}\n\n".format(titlecase(fullname))

    text += "Please enter your character's full name as you wish it to appear on your Character Sheet."

    options = ({
        "key": "_default",
        "goto": set_fullname
    }, {
        "desc": "Go Back",
        "goto": "ask_personal"
    })

    return text, options
示例#5
0
def ask_species(caller, caller_input, **kwargs):
    selected_species = kwargs.get("selected_species")

    if selected_species:
        caller.db.species = selected_species
    text = ""

    if selected_species:
        text += "Currect Species: {}\n\n".format(selected_species)

    text += "Please select the species you would like to review for possible selection."

    options = ()

    for item in SPECIES.keys():
        node_dict = {
            "desc": titlecase(item),
            "goto": ("confirm_species", {
                "selected_species": item
            })
        }
        options += (node_dict, )

    options += (
        {
            "desc": "Custom",
            "goto": ("confirm_species", {
                "selected_species": "custom"
            })
        },
        {
            "desc": "Go Back",
            "goto": "ask_personal"
        },
    )

    return text, options
示例#6
0
    def func(self):
        caller = None
        if self.args:
            if self.caller.locks.check_lockstring(self.caller,
                                                  "dummy:perm(Admin)"):
                if Clone.objects.filter(db_key__iexact=self.args).exists():
                    caller = self.caller.search(self.args)
                else:
                    self.caller.msg(
                        "|rERROR:|n Invalid player name.  Try again.")
                    return
            else:
                self.caller.msg(
                    "|rERROR:|n You are not authorized to use that command.")
                return
        else:
            caller = self.caller
        if not self.switches:
            message = []
            message.append(
                "|w.---|n|yAlpha Complex Identity Form|n|w----------------------------------------------.|n"
            )
            message.append(
                "|[002|w/// PART ONE    |n|[005 |wCORE INFORMATION >>>                                         |n"
            )

            name = "|wName: |n{}-{}-{}".format(caller.key, caller.db.clone,
                                               caller.db.sector)
            clearance = "|wSecurity Clearance: |n{}".format(
                CLEARANCE.get(caller.db.clearance))
            sector = "|wHome Sector: |n{}".format(caller.db.sector or "")
            clone = "|wClone #: |n{} / {}".format(caller.db.clone,
                                                  caller.db.max_clones)
            gender = "|wGender: |n{}".format(caller.db.gender)
            personality = "|wPersonality: |n{}".format(", ".join(
                caller.db.personality or []))

            table1 = evtable.EvTable(name, clearance, border=None)
            table1.reformat_column(0, width=30)
            table1.reformat_column(1, width=48)
            message.append(table1)

            table2 = evtable.EvTable(sector, clone, gender, border=None)
            table2.reformat_column(0, width=30)
            table2.reformat_column(1, width=18)
            table2.reformat_column(2, width=30)
            message.append(table2)
            message.append(" " + personality + "\n")

            message.append(
                "|[002|w/// PART TWO    |n|[005 |wDEVELOPMENT >>>                                              |n"
            )

            treason = "|wTreason: |n{}".format("*" * (caller.db.treason or 0))
            xp = "|wXP Points: |n{}".format(caller.db.xp or 0)
            table3 = evtable.EvTable(treason, xp, border=None)
            table3.reformat_column(0, width=30)
            table3.reformat_column(1, width=48)
            message.append(table3)
            message.append("\n")

            table4 = evtable.EvTable("",
                                     "",
                                     "",
                                     "",
                                     "",
                                     "",
                                     "",
                                     "",
                                     border=None)
            table4.reformat_column(0, width=16)
            table4.reformat_column(1, width=3, align="r")
            table4.reformat_column(2, width=16)
            table4.reformat_column(3, width=3, align="r")
            table4.reformat_column(4, width=16)
            table4.reformat_column(5, width=3, align="r")
            table4.reformat_column(6, width=16)
            table4.reformat_column(7, width=3, align="r")

            table4.add_row("|wViolence: |n",
                           caller.db.stats.get("violence"), "|wBrains: |n",
                           caller.db.stats.get("brains"), "|wChutzpah: |n",
                           caller.db.stats.get("chutzpah"), "|wMechanics: |n",
                           caller.db.stats.get("mechanics"))
            message.append(
                "|[035|002 STATS >>>                                                                    "
                + str(table4))
            message.append("\n")

            table5 = evtable.EvTable("",
                                     "",
                                     "",
                                     "",
                                     "",
                                     "",
                                     "",
                                     "",
                                     border=None,
                                     header=False)
            table5.reformat_column(0, width=15)
            table5.reformat_column(1, width=4, align="r")
            table5.reformat_column(2, width=16)
            table5.reformat_column(3, width=4, align="r")
            table5.reformat_column(4, width=15)
            table5.reformat_column(5, width=4, align="r")
            table5.reformat_column(6, width=15)
            table5.reformat_column(7, width=4, align="r")

            table5.add_row("|wAthletics: |n",
                           caller.db.skills.get("athletics"), "|wScience: |n",
                           caller.db.skills.get("science"), "|wBluff: |n",
                           caller.db.skills.get("bluff"), "|wOperate: |n",
                           caller.db.skills.get("operate"))

            table5.add_row("|wGuns: |n", caller.db.skills.get("guns"),
                           "|wPsychology: |n",
                           caller.db.skills.get("psychology"), "|wCharm: |n",
                           caller.db.skills.get("charm"), "|wEngineer: |n",
                           caller.db.skills.get("engineer"))

            table5.add_row("|wMelee: |n", caller.db.skills.get("melee"),
                           "|wBureaucracy: |n",
                           caller.db.skills.get("bureaucracy"),
                           "|wIntimidate: |n",
                           caller.db.skills.get("intimidate"), "|wProgram: |n",
                           caller.db.skills.get("program"))

            table5.add_row("|wThrow: |n", caller.db.skills.get("throw"),
                           "|wAlpha Complex: |n",
                           caller.db.skills.get("alpha complex"),
                           "|wStealth: |n", caller.db.skills.get("stealth"),
                           "|wDemolitions: |n",
                           caller.db.skills.get("demolitions"))
            message.append(
                "|[002|w/// PART THREE  |n|[005 |wSKILLS >>>                                                   |n"
                + str(table5))
            message.append("\n")

            message.append(
                "|[002|w/// PART FOUR   |n|[005 |wWELLBEING >>>                                                |n"
            )

            moxie = "|wMoxie: |n{} / {}".format(caller.db.moxie,
                                                caller.db.max_moxie)
            health = "|wHealth: |n{}".format(HEALTH.get(caller.db.wounds))

            table9 = evtable.EvTable(moxie, health, border=None)
            table9.reformat_column(0, width=28)
            table9.reformat_column(1, width=50)
            message.append(table9)
            message.append("\n")

            message.append(
                "|[002|w/// PART FIVE   |n|[005 |wEQUIPMENT >>>                                                |n"
            )

            equipment = [eq for eq in caller.contents]
            for eq in equipment:
                message.append(eq.key)

            message.append("\n")
            message.append(
                "*|w---------------------------------------------------" +
                "|500This form is MANDATORY|w---|n*")
            message2 = []
            for line in message:
                message2.append(line)
            self.caller.msg("\n".join(str(m) for m in message2))
        elif "actions" in self.switches:
            message = []
            message.append(
                "|w.---|n|yAction Summary Form|n|w------------------------------------------------------.|n"
            )
            message.append(
                "|[035|002 ACTIONS >>>                                                                  "
            )
            action_table = evtable.EvTable("|wAction:|n",
                                           "|wAction Order:|n",
                                           "|wReaction:|n",
                                           "|wDescription:|n",
                                           border=None)

            action_table.reformat_column(0, width=17, valign="t")
            action_table.reformat_column(1, width=15, valign="t")
            action_table.reformat_column(2, width=11, valign="t")
            action_table.reformat_column(3, width=35, valign="t")

            for act in caller.db.action_cards:
                action = ACTIONS.get(act)
                action_table.add_row(
                    titlecase(act), action.get("action_order"),
                    "Y" if action.get("reaction") == 1 else "N",
                    action.get("desc"))

            message.append(action_table)
            message.append(
                "\n|[035|002 MUTANT POWERS >>>                                                            |n"
            )

            mutant_table = evtable.EvTable("|wPower:|n",
                                           "|wAction Order:|n",
                                           "|wDescription:|n",
                                           border=None)

            mutant_table.reformat_column(0, width=20, valign="t")
            mutant_table.reformat_column(1, width=15, valign="t")
            mutant_table.reformat_column(2, width=43, valign="t")

            mutant = MUTANT_POWERS.get(caller.db.mutant_power)
            mutant_table.add_row(titlecase(caller.db.mutant_power),
                                 mutant.get("action_order"),
                                 mutant.get("description"))
            message.append("*" + "|w-|n" * 76 + "*")
            message.append(mutant_table)
            message.append("\n")
            message2 = []
            for line in message:
                message2.append(line)
            self.caller.msg("\n".join(str(m) for m in message2))
        elif "secret" in self.switches:
            message = []
            message.append(
                "|w.---|n|ySecret Information Form|n|w--------------------------------------------------.|n"
            )
            message.append(
                "|[035|002 MUTANT POWERS >>>                                                             "
            )
            mutant_table = evtable.EvTable("|wPower:|n",
                                           "|wAction Order:|n",
                                           "|wDescription:|n",
                                           border=None)

            mutant_table.reformat_column(0, width=20, valign="t")
            mutant_table.reformat_column(1, width=15, valign="t")
            mutant_table.reformat_column(2, width=43, valign="t")

            mutant = MUTANT_POWERS.get(caller.db.mutant_power)
            mutant_table.add_row(titlecase(caller.db.mutant_power),
                                 mutant.get("action_order"),
                                 mutant.get("description"))

            message.append(mutant_table)
            message.append("\n")
            message.append(
                "|[035|002 SECRET SOCIETIES >>>                                                          "
            )

            ss_table = evtable.EvTable("|wSociety:|n",
                                       "|wKeywords:|n",
                                       "|wBeliefs|n:",
                                       "|wGoals|n:",
                                       border=None)

            ss_table.reformat_column(0, width=15, valign="t")
            ss_table.reformat_column(1, width=13, valign="t")
            ss_table.reformat_column(2, width=25, valign="t")
            ss_table.reformat_column(3, width=25, valign="t")

            for soc in caller.db.secret_societies:
                society = SECRET_SOCIETIES.get(soc)
                ss_table.add_row(titlecase(soc),
                                 ", ".join(society.get("keywords")),
                                 society.get("beliefs"), society.get("goals"))

            message.append(ss_table)
            message.append("*" + "|w-|n" * 76 + "*")
            message2 = []
            for line in message:
                message2.append(line)
            self.caller.msg("\n".join(str(m) for m in message2))
示例#7
0
def confirm_species(caller, caller_input, **kwargs):
    text = ""
    options = ()
    caller.msg("Skill Dice: {}\n\n".format(caller.ndb._menutree.skill_dice))
    dice = caller.ndb._menutree.skill_dice / 3
    pips = caller.ndb._menutree.skill_dice % 3
    text += "Remaining Skill Dice: {}D{}\n\n".format(dice, pips)

    if "selected_perk" in kwargs.keys():

        if hasattr(caller.ndb._menutree, 'perks'):
            if kwargs.get("selected_perk") in caller.ndb._menutree.perks:
                caller.msg(
                    "You cannot select the same perk twice.  Please try again."
                )
            else:
                perk = RACIAL_PERKS.get(kwargs.get("selected_perk"))
                cost = perk.get("cost")
                if caller.ndb._menutree.skill_dice >= cost:
                    caller.ndb._menutree.skill_dice -= cost
                    caller.ndb._menutree.perks.append(
                        kwargs.get("selected_perk"))
            text += "Currently selected perks: {}\n\n".format(", ".join(
                caller.ndb._menutree.perks))
        else:
            caller.ndb._menutree.perks = [kwargs.get("selected_perk")]
            text += "Currently selected perks: {}\n\n".format(", ".join(
                caller.ndb._menutree.perks))
            perk = RACIAL_PERKS.get(kwargs.get("selected_perk"))
            cost = perk.get("cost")
            if caller.ndb._menutree.skill_dice >= cost:
                caller.ndb._menutree.skill_dice -= cost
                caller.ndb._menutree.perks.append(kwargs.get("selected_perk"))
    if kwargs.get("selected_species") == "custom":
        text += "Creating a custom species can be fun and rewarding for players.  Often, the built-in species do not " \
                "quite satisfy the creative desires of the character customization process.  To create a custom " \
                "species, you simply need to pick one or more (or zero) racial perks.  Each perk has an associated " \
                "cost as well as description.  To view these details, select one of the options below.\n\nTo remove a " \
                "perk, select the perk from the list and you will be presented with an option to remove it from your " \
                "character."

        for item in RACIAL_PERKS.keys():
            node_dict = {
                "desc":
                titlecase(item),
                "goto": ("ask_racial_perks", {
                    "perk": item,
                    "selected_species": "custom"
                })
            }
            options += (node_dict, )

        options += ({"desc": "Go Back", "goto": "ask_species"}, )
    else:
        species = SPECIES.get(kwargs.get("selected_species"))
        text += "Species: {}\n".format(
            titlecase(kwargs.get("selected_species")))
        text += "Description: {}\n".format(species.get("description"))
        text += "Perks: {}".format(", ".join(species.get("perks")))
        text += "Cost: {}".format(species.get("cost"))

        options += (
            {
                "desc":
                "Confirm",
                "goto": (ask_species, {
                    "selected_species": kwargs.get("selected_species")
                })
            },
            {
                "desc": "Go Back",
                "goto": "ask_species"
            },
        )

    return text, options