Рыба
This commit is contained in:
1 parent
ee3a493940
commit
19595c3caa
7 files changed
+197
-56
No files matched your search
+12
-4
@@ -64,9 +64,13 @@ def parse(text, legacy=False):
|
||||
rows = re.findall(r'id = "(\w+)",\s*name = "[^"]*",\s*rarity = "(\w+)",\s*price = (\d+),\s*xp = (\d+)', zones)
|
||||
c['fish'] = [dict(id=a, rarity=b, price=int(p), xp=int(x)) for a, b, p, x in rows]
|
||||
else:
|
||||
rows = re.findall(r'id = "(\w+)",\s*name = "[^"]*",\s*rarity = "(\w+)",\s*price = (\d+)', zones)
|
||||
c['fish'] = [dict(id=a, rarity=b, price=int(p)) for a, b, p in rows]
|
||||
assert len(c['fish']) == 36, len(c['fish'])
|
||||
c['fish'] = []
|
||||
for world in WORLDS:
|
||||
rows = re.findall(r'id = "(\w+)",\s*name = "[^"]*",\s*rarity = "(\w+)",\s*price = (\d+)([^\n]*)', block(zones, world + ' = {'))
|
||||
for a, b, p, rest in rows:
|
||||
sh = re.search(r'share = ([\d.]+)', rest)
|
||||
c['fish'].append(dict(id=a, rarity=b, price=int(p), world=world, share=float(sh.group(1)) if sh else 1.0))
|
||||
assert len(c['fish']) == (36 if legacy else 38), len(c['fish'])
|
||||
rods = re.findall(r'\{ id = "(\w+)",\s*name = "[^"]*",\s*price = (\d+),\s*level = (\d+),\s*luck = ([\d.]+),\s*speed = ([\d.]+),\s*zone = ([\d.]+),\s*upgradeCost = (\d+)', block(text, 'Config.Rods = {'))
|
||||
c['rods'] = [dict(id=a, price=int(p), level=int(l), luck=float(lu), speed=float(s), upgradeCost=int(u)) for a, p, l, lu, s, z, u in rods]
|
||||
bags = re.findall(r'\{ id = "(\w+)",\s*name = "[^"]*",\s*price = (\d+),\s*level = (\d+),\s*capacity = (\d+)', block(text, 'Config.Bags = {'))
|
||||
@@ -127,7 +131,10 @@ def eff_luck(c, luck):
|
||||
|
||||
|
||||
def fish_dist(c, world, luck, legacy=False, max_rank=None):
|
||||
rows = c['fish'][WORLDS.index(world) * 12:(WORLDS.index(world) + 1) * 12]
|
||||
if legacy:
|
||||
rows = c['fish'][WORLDS.index(world) * 12:(WORLDS.index(world) + 1) * 12]
|
||||
else:
|
||||
rows = [f for f in c['fish'] if f['world'] == world]
|
||||
ws = []
|
||||
for f in rows:
|
||||
rank = RAR.index(f['rarity']) + 1
|
||||
@@ -138,6 +145,7 @@ def fish_dist(c, world, luck, legacy=False, max_rank=None):
|
||||
be = eff_luck(c, luck)
|
||||
k = c['rarity_luck'][f['rarity']]
|
||||
w = base / max(0.2, 1 + be * k) if rank == 1 else base * max(0.2, 1 + be * k)
|
||||
w *= f.get('share', 1.0)
|
||||
if max_rank and rank > max_rank:
|
||||
w = 0
|
||||
ws.append(w)
|
||||
|
||||
Reference in new issue
Block a user