コード例 #1
0
def setup():
    tfeval("/def -mglob -agGL -p10 -q -t'∴party *' bcproxy_party = " +
           "/python_call party.triggerPartyMsg \%-1")

    for x in range(1, 5):
        for y in range(1, 5):
            tfeval(
                "/def -i -q -b'{0}' = /python_call party.changeTargetPlace {1} {2}"
                .format(PLACE_KEYBINDS[y][x], x, y))

    tfeval("/def -i -ag -c0 -p20 -mregexp -t`" +
           "^\\\|(.)(([1-3?])\\\.([1-3?])  )?"  # idle, y, x
           + "([+]?[A-Za-z ]+)  "  # name {12}
           + "([a-z]+\\\|?[0-9]?)? +"  # state
           + "([0-9]+)\\\( *([0-9]+)\\\) +"  # hp / maxhp
           + "(([0-9]+)\\\( *([0-9]+)\\\) +"  # sp / maxsp
           + "([0-9]+)\\\( *([0-9]+)\\\)|.+) +"  # ep / maxep
           + "\\\| .+ \\\| .+ \\\|\$"  # level + exp
           + "` party_pss = /python_call party.pssParse " +
           '{ "idle": "\%P1", "y": "\%P3", "x": "\%P4", ' +
           '"name": "\%P5", ' + '"state": "\%P6", ' +
           '"hp": "\%P7", "maxhp": "\%P8", ' + '"spepstring": "\%P9", ' +
           '"sp": "\%P10", "maxsp": "\%P11", ' +
           '"ep": "\%P12", "maxep": "\%P13" }' + "")
    tfeval(
        "/def -i -F -ag -p20 -msimple -t`" +
        ",-----------------------------------------------------------------------------."
        + "` party_pss_start = /python_call party.pssStart")
    tfeval(
        "/def -i -F -ag -c0 -p20 -msimple -t`" +
        "\\\`-----------------------------------------------------------------------------'"
        + "` party_pss_end = /python_call party.pssEnd")

    tfprint("Loaded party.py")
コード例 #2
0
ファイル: healer.py プロジェクト: bat-boys/bcproxy-tf-scripts
def setup():
    cmds: Sequence[str] = [
        "/def t = /python_call party.changeTargetName \%*",
        "/def f = /python_call ginfo.finger \%*",
        "/def pginfo = /python_call party.ginfo",
        "/def -i -q -b'^[z' = @cast stop",
        "/def -i -q -b'^[x' = @party prots",
        "/def -i -q -b'^[c' = @show effects",
        "/def -i -q -b'^[ ' = /python_call party.manualPs",
        "/def key_f2 = @ch heal",
        "/def key_f3 = @ch wis",
        "/def key_f4 = @ch spr",
    ]
    for cmd in cmds:
        tfeval(cmd)

    tfeval("/python_load caster")
    setupCaster(
        CATEGORY_BINDS,
        SPELLS_FOR_CATEGORY,
        SPELL_BINDS,
        PARTY_REPORT_SPELLS,
        PARTY_REPORT_SPELL_TYPES,
    )

    tfprint("Loaded blaster.py")
コード例 #3
0
ファイル: ginfo.py プロジェクト: ug-2001/bcproxy-tf-scripts
def start(s: str):
    global state
    state = state._replace(player=s[:-1])
    # n15 = maximum of 15 matches, don't match everything if end doesn't work
    tfeval(
        "/def -i -p1 -n15 -ag -mglob -t`\*` ginfo_guild = /python_call ginfo.guild \%\*"
    )
コード例 #4
0
def setup():
    cmds: Sequence[str] = [
        "/def t = /python_call party.changeTargetName \%*",
        "/def f = /python_call ginfo.finger \%*",
        "/def pginfo = /python_call party.ginfo",
        "/def -i -q -b'^[z' = @cast stop",
        "/def -i -q -b'^[x' = @party prots",
        "/def -i -q -b'^[c' = @show effects",
        "/def -i -q -b'^[ ' = /python_call party.manualPs",
        "/def -i -q -b'^[v' = /python_call resists.reportLast",
        "/def key_f2 = @int",
        "/def key_f3 = @wis",
        "/def key_f4 = @spr",
        "/def key_f5 = @asphy",
        "/def -i -F -msimple -ag -t`You feel your staff touching your mind.` gag_staff_ceremony",
        "/def -i -F -msimple -ag -t`You surreptitiously conceal your spell casting.` gag_conceal",
        "/def -i -F -p10 -msimple -ag -t`spec_spell: Power flows from your staff to the spell.` gag_staff_cheapen",
        "/def -i -F -p10 -msimple -ag -t`spec_spell: Your fine choice of components lowers the effort of the spell.` gag_power_regs",
        "/def -i -F -p10 -mglob -ag -t`spec_spell: You pull out * which bursts into a zillion technicolour sparkles!` gag_acid",
        "/def -i -F -p10 -msimple -ag -t`spec_spell: Your knowledge in elemental powers helps you to save the reagent for further use.` gag_reagent_save",
    ]

    for cmd in cmds:
        tfeval(cmd)

    tfeval("/python_load caster")
    setupCaster(
        CATEGORY_BINDS,
        SPELLS_FOR_CATEGORY,
        SPELL_BINDS,
        PARTY_REPORT_SPELLS,
        PARTY_REPORT_SPELL_TYPES,
    )

    tfprint("Loaded blaster.py")
コード例 #5
0
def setup():
    global state

    conn = Client(MOBINFO_SOCKET_FILE, "AF_UNIX")
    sqlConnection = psycopg2.connect("dbname=batmud user=risto")
    sqlCursor = sqlConnection.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)
    state = state._replace(conn=conn, sqlConnection=sqlConnection, sqlCursor=sqlCursor)

    cmds: Sequence[str] = [
        "/def -p10 -mglob -t`∴room *` "
        + "mobinfo_room = /python_call mobinfo.room \$[textencode({-1})]",
        "/def -p10 -F -mglob -t`"
        + "spec_skill: You take a close look at * in comparison to yourself."
        + "` mobinfo_shortname = /python_call mobinfo.shortname \%*",
        "/def -p10 -F -mglob -t`* is DEAD, R.I.P.` "
        + "mobinfo_is_dead = /python_call mobinfo.isDead \%-L3",
        "/def -agGL -msimple -t`"
        + "Astounding!  You can see things no one else can see, such as pk_trigger_starts.`"
        + " party_kills_start = /python_call mobinfo.pkillsStart",
    ]
    # this command is too difficult to get through tfeval as string
    tfeval("/load ~/bat/bcproxy-tf-scripts/mobinfo.tf")
    for cmd in cmds:
        tfprint(cmd)
        tfeval(cmd)

    tfprint("Loaded mobinfo.py")
コード例 #6
0
def setup():
    for i, msg in enumerate(MESSAGES):
        tfeval("/def -i -F -p10 -msimple -t`{1}` shrine_message_{0}".format(
            i, msg) +
               " = /substitute \%* ({0}/{1})".format(i,
                                                     len(MESSAGES) - 1))

    tfprint("Loaded shrine.py")
コード例 #7
0
def changeTargetPlace(placeRaw: str):
    global state
    placeList = placeRaw.split()
    place = Place(int(placeList[0]), int(placeList[1]))
    if place in state.places:
        target = reSub(r"^[+]", "", state.places[place].name)
        state = state._replace(target=target)
        tfeval("/trigger You are now target-healing {0}.".format(target))
コード例 #8
0
ファイル: ginfo.py プロジェクト: ug-2001/bcproxy-tf-scripts
def hidden(s: str):
    global state
    country = state.country if state.country is not None else "unknown country"
    msg = "{0}: hidden, {1}".format(s, country)
    if state.partyReport:
        tfeval("@party report {0}".format(msg))
    else:
        tfprint(msg)
    cleanup()
コード例 #9
0
ファイル: ginfo.py プロジェクト: ug-2001/bcproxy-tf-scripts
def end(s: str):
    global state
    state = state._replace(background=s)
    tfeval("/undef ginfo_guild")
    if state.partyReport:
        tfeval("@party report {0}".format(toString()))
    else:
        tfprint(toString())
    cleanup()
コード例 #10
0
def pkillsStart(s: str):
    cmds = [
        "/def -agGL -mregexp -t`^\\\| [0-9]{1,2}:[0-9]{2}\\\s+[0-9]+: .+\\\|\$` "
        + "party_kills_line = /python_call mobinfo.updateExp \%*",
        "/def -agGL -mregexp -n1 -t`^This party has killed \\\d+ monsters? \\\(avg exp/mon: \\\d+\\\)\\\.\$` "
        + "party_kills_end = /undef party_kills_line",
        "@party kills 1",
    ]
    for cmd in cmds:
        tfeval(cmd)
コード例 #11
0
def cons(s: str):
    global state
    [i, name] = s.split(" ", 1)
    try:
        state = state._replace(currentMobInfo=CurrentMobInfo(int(i), None))
        tfeval("@consider {0}".format(name))
    except:
        tfprint(s)
        tfprint(i)
        tfprint(name)
        return
コード例 #12
0
def setup():

    for i, msg in enumerate(AURAS):
        tfeval("/def -i -F -p10 -msimple -t`{1}` channeller_supply_{0}".format(
            i, msg) + " = /substitute \%* ({0}/{1})".format(i,
                                                            len(AURAS) - 1))

    tfeval("/def -i -F -ag -p10 -msimple " +
           "-t`You take a deep breath and close your eyes.` " +
           "channeller_gag_supply_start")

    tfprint("Loaded channeller.py")
コード例 #13
0
def ginfo(s: str):
    global state
    # we'll want front row to be first, so this is done in a bit difficult way
    names = list()
    places = state.places
    for y in [1, 2, 3]:
        for x in [1, 2, 3]:
            place = Place(x, y)
            if place in places:
                names.append(places[place].name)
    for place in UNKNOWN_PLACES:
        if place in places:
            names.append(places[place].name)
    tfeval("/python_call ginfo.partyReport {0}".format(" ".join(names)))
コード例 #14
0
ファイル: ginfo.py プロジェクト: ug-2001/bcproxy-tf-scripts
def ginfo(players: str):
    global state
    state = state._replace(playersLeft=players.split(" "))
    tfeval("/edit -c100 ginfo_start")
    tfeval("/edit -c100 ginfo_end")
    tfeval("/edit -c100 ginfo_hidden")
    tfeval("/edit -c100 ginfo_no_such_player")
    nextPlayer()
コード例 #15
0
ファイル: druid.py プロジェクト: bat-boys/bcproxy-tf-scripts
def setup():

    for i, msg in enumerate(CHARGES):
        tfeval(
            "/def -i -F -p10 -msimple -t`{1}` druid_staff_charge_{0}".format(i, msg)
            + " = /substitute \%* ({0}/{1})".format(i, len(CHARGES) - 1)
        )

    tfeval(
        "/def -i -F -ag -p10 -msimple "
        + "-t`spec_spell: You sense power flowing into your Staff of Druids.` "
        + "druid_charge_staff_done = @ch spr;sensecharge staff"
    )

    tfprint("Loaded druid.py")
コード例 #16
0
ファイル: resists.py プロジェクト: ug-2001/bcproxy-tf-scripts
def setup():
    cmds: Sequence[str] = [
        "/def -i -F -p10 -mglob -t`spec_spell: You watch with self-pride as your *` spell_hits = /python_call resists.hits \%-7",
        "/def -i -F -p10 -c0 -mglob -t`spec_spell: * screams in pain.` resist_scream = /python_call resists.scream \%-L3",
        "/def -i -F -p10 -c0 -mglob -t`spec_spell: * writhes in agony.` resist_writhe = /python_call resists.writhe \%-L3",
        "/def -i -F -p10 -c0 -mglob -t`spec_spell: * shudders from the force of the attack.` resist_shudder = /python_call resists.shudder \%-L7",
        "/def -i -F -p10 -c0 -mglob -t`spec_spell: * grunts from the pain.` resist_grunt = /python_call resists.grunt \%-L4",
        "/def -i -F -p10 -c0 -mglob -t`spec_spell: * winces a little from the pain.` resist_wince = /python_call resists.wince \%-L6",
        "/def -i -F -p10 -c0 -mglob -t`spec_spell: * shrugs off the attack.` resist_shrug = /python_call resists.shrug \%-L4",
        "/def -i -F -p10 -msimple -t`Astounding!  You can see things no one else can see, such as pk_trigger_starts.` resist_reset = /python_call resists.reset",
    ]

    for cmd in cmds:
        tfeval(cmd)

    tfprint("Loaded resists.py")
コード例 #17
0
def castSpell(spellBindId: SPELL_BIND_ID, atTarget: bool):
    global state
    if (state.category in state.spellsForCategory
            and spellBindId in state.spellsForCategory[state.category]):
        spell = state.spellsForCategory[state.category][spellBindId]

        if spell != None:
            spell = cast(Spell, spell)
            castStr = castString(spell, atTarget, state.target)
            state = state._replace(currentSpell=castStr)

            tfeval("@cast {0}".format(castStr))

            if partyReportCast(spell, state.partyReportSpellTypes,
                               state.partyReportSpells):
                tfeval("@quote 'cast info' party report")
コード例 #18
0
ファイル: ginfo.py プロジェクト: ug-2001/bcproxy-tf-scripts
def setup():
    cmds = [
        "/def -i -p10 -c0 -ag -mglob -t`Guild information for *` ginfo_start = /python_call ginfo.start \%-3",
        "/def -i -p10 -c0 -ag -mglob -t`Background: *` ginfo_end = /python_call ginfo.end \%-1",
        "/def -i -p10 -c0 -ag -mglob -t`* has chosen to hide their guild information.` ginfo_hidden = /python_call ginfo.hidden \%1",
        "/def -i -p10 -c0 -ag -mglob -t`No such player (*).` ginfo_no_such_player",
        "/def -i -p10 -c0 -ag -mglob -t`* does not seem to have any guild information (offline).` ginfo_hidden2 = /python_call ginfo.hidden \%1",
        "/def ginfo = /python_call ginfo.ginfo \%*",
        "/def giwho = /python_call ginfo.who \%*",
        "/def pwho = /python_call ginfo.who party \%*",
    ]

    for cmd in cmds:
        tfeval(cmd)

    tfprint("Loaded ginfo.py")
コード例 #19
0
def setup():
    cmds: Sequence[str] = [
        "/def -i -agGL -p10 -msimple -t`Dunk dunk` heartbeat = /python_call heartbeat.heartbeat",
        "/def -i -F -p10 -mregexp -t`" +
        "^H:(-?[0-9]+)/(-?[0-9]+) \\\[([+-]?[0-9]*)\\\] " +
        "S:(-?[0-9]+)/(-?[0-9]+) \\\[([+-]?[0-9]*)\\\] " +
        "E:(-?[0-9]+)/(-?[0-9]+) \\\[([+-]?[0-9]*)\\\] " +
        "\\\\\$:(-?[0-9]+) \\\[[+-]?[0-9]*\\\] " +
        "exp:(-?[0-9]+) \\\[[+-]?[0-9]*\\\]\$" +
        "` sc_update = /python_call heartbeat.tick \%P6",
    ]

    for cmd in cmds:
        tfprint(cmd)
        tfeval(cmd)

    tfprint("Loaded heartbeat.py")
コード例 #20
0
def pssEnd(opts):
    global state
    if state.pssHasMinions:
        state = state._replace(pssHasMinions=False)
    else:
        tfeval("/edit -c0 -ag party_pss")
        tfeval("/edit -c0 -ag party_pss_end")
        tfeval("/edit -ag party_pss_start")
コード例 #21
0
ファイル: resists.py プロジェクト: ug-2001/bcproxy-tf-scripts
def report(mobResist: MobResist):
    # sort resists from smallest to largest
    rs = sorted(list(mobResist.resists.items()), key=lambda x: x[1].value)
    tfeval("@party report {0} resists {1}".format(
        mobResist.name,
        ", ".join(map(lambda r: "{0}: {1}".format(r[0].value, r[1].value),
                      rs)),
    ))

    with Client(STATUS_SOCKET_FILE, "AF_UNIX") as conn:
        msg = Message(
            StatusType.RESISTS,
            "{0} {1}".format(
                mobResist.name,
                ", ".join(
                    map(
                        lambda r: "{0}: {1}".format(
                            colorize(r[0].value[:4], getDamtypeColor(r[0])), r[
                                1].value),
                        rs,
                    )),
            ),
        )
        conn.send_bytes(dill.dumps(msg))
コード例 #22
0
def setup(
    categoryBinds: CategoryBinds,
    spellsForCategory: SpellsForCategory,
    spellBinds: SpellBinds,
    partyReportSpells: PartyReportSpells,
    partyReportSpellTypes: PartyReportSpellTypes,
):
    global state
    state = state._replace(
        categoryBinds=categoryBinds,
        spellsForCategory=spellsForCategory,
        spellBinds=spellBinds,
        partyReportSpells=partyReportSpells,
        partyReportSpellTypes=partyReportSpellTypes,
    )
    cmds: Sequence[str] = [
        "/def -i -F -msimple -ag -t`You start chanting.` spell_start = " +
        "/python_call caster.castStart",
        "/def -i -F -msimple -agGL -t`∴cast_cancelled` cast_cancelled = " +
        "/python_call caster.castStop",
        "/def -i -F -msimple -ag -t`You are done with the chant.` gag_spell_done",
        "/def -i -F -msimple -ag -t`You skillfully cast the spell with haste.` gag_haste",
        "/def -i -F -msimple -ag -t`You skillfully cast the spell with greater haste.` gag_ghaste",
        "/def -i -F -mglob -t`You are now targetting *` set_target = " +
        "/python_call caster.setTarget \%-4",
        "/def -i -F -mglob -t`You are now target-healing *` set_target_heal = "
        + "/python_call caster.setTarget \%-4",
    ]
    for cmd in cmds:
        tfeval(cmd)

    for key, category, explanation in flatten(state.categoryBinds):
        tfeval("/def -i -q -b`{0}` = /python_call caster.changeCategory {1}".
               format(key, category.value))

    for key, spellBindId, atTarget in spellBinds:
        if atTarget:
            tfeval(
                "/def -i -q -b`{0}` = /python_call caster.castSpellWithTarget {1}"
                .format(key, spellBindId))
        else:
            tfeval(
                "/def -i -q -b`{0}` = /python_call caster.castSpellWithoutTarget {1}"
                .format(key, spellBindId))

    tfprint("Loaded caster.py")
コード例 #23
0
ファイル: ginfo.py プロジェクト: ug-2001/bcproxy-tf-scripts
def who(params: str):
    global whoState
    whoState = set()
    tfeval(
        "/def -i -p10 -ag -n9 -mregexp -t`^[\\[({]........... ([A-Za-z]+)` ginfo_who = /python_call ginfo.whoAddPlayer \%P1"
    )
    tfeval(
        "/def -i -p10 -ag -mregexp -t`^[0-9]+ players shown.` ginfo_who_end = /python_call ginfo.whoEnd"
    )
    tfeval("@who {0}".format(params))
コード例 #24
0
ファイル: resists.py プロジェクト: ug-2001/bcproxy-tf-scripts
def resists(resist: Resist, mobnameRaw: str):
    global state
    resists: MutableMapping[DamType, Resist] = {}
    mobname = mobnameRaw[12:]  # raw has "spec_spell: " in the beginning

    if (state.previousSpell is not None
            and state.previousSpell.damType is not None
            and state.previousMob is not None
            and state.previousMob == mobname):
        if state.previousDead == False and state.mobs[0].name == mobname:
            # this mob was shot already previously
            resists = state.mobs[0].resists
            damType = state.previousSpell.damType

            # new damtype, or changed resist to existing one
            if damType is not None and (damType not in resists
                                        or resists[damType] != resist):
                resists[damType] = resist
                report(state.mobs[0])
        else:
            # first or otherwise new mob
            mobs = state.mobs
            damType = state.previousSpell.damType
            resists[damType] = resist
            mobs.insert(0, MobResist(mobname, resists))  # add to front
            report(state.mobs[0])
            state = state._replace(previousDead=False)

    tfeval("/edit -c0 resist_scream")
    tfeval("/edit -c0 resist_writhe")
    tfeval("/edit -c0 resist_shudder")
    tfeval("/edit -c0 resist_grunt")
    tfeval("/edit -c0 resist_wince")
    tfeval("/edit -c0 resist_shrug")
コード例 #25
0
ファイル: resists.py プロジェクト: ug-2001/bcproxy-tf-scripts
def hits(mobAndSpell: str):
    global state
    splitted = mobAndSpell.split(" hits ")
    if len(splitted) == 2:
        spellname = splitted[0]
        mobname = splitted[1].strip(".")
        spell = getSpellByName(spellname)
        if spell is not None:
            state = state._replace(previousMob=mobname, previousSpell=spell)
            tfeval("/edit -c100 resist_scream")
            tfeval("/edit -c100 resist_writhe")
            tfeval("/edit -c100 resist_shudder")
            tfeval("/edit -c100 resist_grunt")
            tfeval("/edit -c100 resist_wince")
            tfeval("/edit -c100 resist_shrug")
    else:
        tfprint("Unknown resist string: {0}".format(mobAndSpell))
コード例 #26
0
ファイル: resists.py プロジェクト: ug-2001/bcproxy-tf-scripts
def reset(args: str):
    global state
    state = state._replace(previousDead=True)
    tfeval("/edit -c0 resist_scream")
    tfeval("/edit -c0 resist_writhe")
    tfeval("/edit -c0 resist_shudder")
    tfeval("/edit -c0 resist_grunt")
    tfeval("/edit -c0 resist_wince")
    tfeval("/edit -c0 resist_shrug")
コード例 #27
0
def manualPs(opts: str):
    tfeval("/edit -an party_pss")
    tfeval("/edit -an party_pss_start")
    tfeval("/edit -an party_pss_end")
    tfeval("@ps")
コード例 #28
0
def pssStart(opts):
    tfeval("/edit -c100 party_pss")
    tfeval("/edit -c100 party_pss_end")
コード例 #29
0
def changeTargetName(name: str):
    global state
    tfeval("/trigger You are now target-healing {0}.".format(name))
    state = state._replace(target=name)
    sendState()
コード例 #30
0
ファイル: ginfo.py プロジェクト: ug-2001/bcproxy-tf-scripts
def whoEnd(opts: str):
    global whoState
    tfeval("/undef ginfo_who")
    tfeval("/undef ginfo_who_end")
    if len(whoState) > 0:
        ginfo(" ".join(whoState))