Example #1
0

def getpmname(species, forme, cangmax, isShiny):
    formtext = pmtext.forms[pt.getFormeNameIndex(species, forme)]
    t = pmtext.species[species]
    if species == 849 or species == 869 or species == 678 or species == 876 or (
        (species in pt.Galarlist or species in pt.Alolalist) and forme):
        t += '<br><small>' + formtext + '</small>'
    if cangmax:
        t += f'<br><small>{GMAXSTR}</small>'
    if isShiny:
        t += f'<br><small>{SHINYSTR}</small>'
    return t


pmtexten = PKMString('en')


def getitemimage(itemid):
    filename = pmtexten.items[itemid].replace(" ", "").replace("’",
                                                               "'").lower()
    url = f"https://www.serebii.net/itemdex/sprites/{filename}.png"
    return f'<img src="{url}" alt="{filename}">'


def getitemname(itemid):
    txt = getitemimage(itemid) + pmtext.items[itemid]
    if itemid >= 1130 and itemid <= 1229:
        tr = itemid - 1130
        return txt + " (" + pmtext.trmoves[tr] + ")"
    else:
Example #2
0
    if type1 == type2:
        return "type1=" + type1
    else:
        return "type1=" + type1 + "|type2=" + type2


def getmsg2_short(entry, rank):
    msg = f'|Raid|{entry.Level()}|{entry.Probabilities(rank)}%|'
    msg += gettype_short(entry.Species(), entry.AltForm())
    msg += getform_short(entry.Species(), entry.IsGigantamax(),
                         entry.AltForm(),
                         entry.ShinyFlag() == 2) + "}}"
    return msg


pmtext = PKMString('en')
buf = bytearray(open('../resources/bytes/local_drop', 'rb').read())
drop = NestHoleReward8Archive.GetRootAsNestHoleReward8Archive(buf, 0)
buf = bytearray(open('../resources/bytes/local_bonus', 'rb').read())
bonus = NestHoleReward8Archive.GetRootAsNestHoleReward8Archive(buf, 0)
buf = bytearray(open('../resources/bytes/personal_swsh', 'rb').read())
pt = PersonalTable(buf)

buf = bytearray(open(
    Path + 'normal_encount', 'rb').read()) if Island == 0 else bytearray(
        open(Path + f'normal_encount_rigel{Island}', 'rb').read())
eventencounter = NestHoleDistributionEncounter8Archive.GetRootAsNestHoleDistributionEncounter8Archive(
    buf, 0x20)
buf = bytearray(open(Path + 'drop_rewards', 'rb').read())
dropreward = NestHoleDistributionReward8Archive.GetRootAsNestHoleDistributionReward8Archive(
    buf, 0x20)
Example #3
0
# Go to root of PyNXBot
import sys
sys.path.append('../')
from lookups import PKMString
from nxbot import SWSHBot
from structure import EncounterNest8Archive
from structure import NestHoleReward8Archive

pmtext = PKMString()
buf = bytearray(open('../resources/bytes/local_raid', 'rb').read())
encounter = EncounterNest8Archive.GetRootAsEncounterNest8Archive(buf, 0)

buf = bytearray(open('../resources/bytes/local_drop', 'rb').read())
drop = NestHoleReward8Archive.GetRootAsNestHoleReward8Archive(buf, 0)

buf = bytearray(open('../resources/bytes/local_bonus', 'rb').read())
bonus = NestHoleReward8Archive.GetRootAsNestHoleReward8Archive(buf, 0)

if encounter.TablesIsNone():
    print('Wrong offset!')
else:
    for ii in range(encounter.TablesLength()):
        table = encounter.Tables(ii)
        print(f"Table ID:0x{table.TableID():X}")
        print(f"Game Version:{table.GameVersion()}")
        for jj in range(table.EntriesLength()):
            entry = table.Entries(jj)
            msg = f"{entry.EntryIndex()}: {'G-' if entry.IsGigantamax() else ''}{pmtext.species[entry.Species()]}{('-' + str(entry.AltForm())) if entry.AltForm() > 0 else ''}"
            msg = f"{msg:25}\t"
            if entry.Ability() == 4:
                msg += f"HA allowed\t"