Пример #1
0
def command_rd(message, args):
    if len(args) != 3 and len(args) != 4 and len(args) != 1:
        send_message(
            message.channel,
            "Wrong syntax!\n/rd <stat> <stat> <stat> <talent - optional>")
        return
    if not db.check_user_has_char(message.author):
        send_message(message.channel, "User has no character!")
        return

    cID = db.get_selected_char(message.author)

    charEntry = db.db_get_char(cID, message.author)
    if len(args) == 1:
        attribute = db.get_attribute(cID, message.author, args[0])
        if attribute == None:
            send_message(
                message.channel,
                "Oops, this attribute was not found on **" + cID + "**")
            return
        if (attribute[6] == "" or attribute[4] == "" or attribute[5] == ""):
            send_message(
                message.channel, "Oops, **" + attribute[2] +
                "** has no dependencies at the moment!")
            return
        args[0] = attribute[4]
        args.append(attribute[5])
        args.append(attribute[6])
        args.append(attribute[2])
    res = dice.roll_dsa(args, charEntry)
    send_message(message.channel, res)
Пример #2
0
def command_selected(message):
    selected = db.get_selected_char(message.author)
    if selected == None:
        send_message(message.channel, "User has no character!")
        return
    send_message(
        message.channel,
        "Selected char for user " + str(message.author) + ": " + selected)
Пример #3
0
def command_remove(message, args):
    selected = db.get_selected_char(message.author)
    if selected == None:
        send_message(message.channel, "User has no character selected!")
        return
    out = ""
    for arg in args:
        if arg not in glob_vars.stats:
            out += db.db_remove_attribute(selected, message.author, arg) + "\n"
    send_message(message.channel, out)
Пример #4
0
def command_chars(message):
    chars = db.db_get_char_list(message.author)
    selected = db.get_selected_char(message.author)
    res = ""
    for char in chars:
        if char == selected:
            res += "=>"
        res = res + char.capitalize() + "\n"
    if res == "":
        res = "No chars in database!"
    msg = "You currently have " + str(len(chars)) + "/" + str(
        glob_vars.MAX_CHAR_COUNT) + " char(s)! \n\n"
    send_message(message.channel, msg + res)
Пример #5
0
def command_char(message, args):
    charname = ""

    selected_char = db.get_selected_char(message.author)
    if selected_char == None:
        send_message(message.channel, "User has no character!")
        return
    if len(args) < 1:
        charname = selected_char
    else:
        charname = args[0]
    if not db.check_char_exists(message.author, charname):
        send_message(message.channel,
                     "This character could not be found in the database!")
        return

    charEntry, attributeList = db.db_get_char(charname, message.author)
    charEntry = charEntry[0]
    stat = []
    for s in glob_vars.stats:
        stat.append(
            helper.make_str_two_digits(
                str(helper.attribute_value_from_list(attributeList, s))))

    header = "-------------**" + charname.capitalize() + "**-----------------"
    toprow = "| mu | kl | in | ch | ff | ge | ko | kk |"
    botrow = "| " + stat[0] + " | " + stat[1] + " | " + stat[2] + " | " + stat[
        3] + " | " + stat[4] + " | " + stat[5] + " | " + stat[
            6] + " | " + stat[7] + " |\n\n"

    attributes_print = "**Attributes** (" + str(
        db.get_attribute_number(charname, message.author)) + "/" + str(
            glob_vars.MAX_ATTRIBUTE_COUNT) + "): \n"
    for attribute in filter(lambda x: not x[0] in glob_vars.stats,
                            attributeList):
        dependency_print = ""
        if not attribute[2] == "":
            dependency_print = "(" + attribute[2] + "," + attribute[
                3] + "," + attribute[4] + ")"
        attributes_print += str(attribute[0]) + dependency_print + "  " + str(
            attribute[1]) + "\n"

    send_message(message.channel,
                 header + "\n" + toprow + "\n" + botrow + attributes_print)