Simple sanity-check to prevent generating r0 characters

This commit is contained in:
Zergling_man 2023-10-28 16:15:40 +11:00
parent 7c692902c3
commit 5c6582628d
2 changed files with 1 additions and 3 deletions

View File

@ -141,6 +141,7 @@ def generate(officer=None,name=None):
else: out.insert(1,tables.gunmaps_wrapped[out[0]]) else: out.insert(1,tables.gunmaps_wrapped[out[0]])
rank,cap=min(rank,pro['guns'][out[1]][0]),min(cap,pro['guns'][out[1]][1]) # Derp2, forgot to actually cap on gun rank,cap=min(rank,pro['guns'][out[1]][0]),min(cap,pro['guns'][out[1]][1]) # Derp2, forgot to actually cap on gun
cap=(cap-(cap<10)+(cap>10))//3 # Derp cap=(cap-(cap<10)+(cap>10))//3 # Derp
if rank<1 or cap<0: print("You have selected a locked item, go unlock it first."); return
out[-1]=tables.clas[out[0]].index(out[-1]) out[-1]=tables.clas[out[0]].index(out[-1])
muxed=shared.muxhero(out[0],out[3],out[4]) muxed=shared.muxhero(out[0],out[3],out[4])
meds=[] meds=[]

View File

@ -3,7 +3,6 @@ import random
import tables import tables
def encode(name,clas,gun,armour,trait,spec,talent,rank=-1,cap=-1,xp=0, key=False,moh=False,pcc=False,cob=False,lsa=False,rem=False,seed=-1): def encode(name,clas,gun,armour,trait,spec,talent,rank=-1,cap=-1,xp=0, key=False,moh=False,pcc=False,cob=False,lsa=False,rem=False,seed=-1):
print(name,clas,gun,armour,trait,spec,talent,rank,cap,xp, key,moh,pcc,cob,lsa,rem,seed)
if rank==-1: # actually means gun wasn't given, so shift them if rank==-1: # actually means gun wasn't given, so shift them
gun,armour,trait,spec,talent,rank=-1,gun,armour,trait,spec,talent gun,armour,trait,spec,talent,rank=-1,gun,armour,trait,spec,talent
gtalent=tables.clas[clas][talent] gtalent=tables.clas[clas][talent]
@ -27,9 +26,7 @@ def encode_data(clas,armour,trait,spec,talent,rank,cap=-1,xp=0, key=False,moh=Fa
if clas==8: clas=6; armour=0 # LR WM is light borg if clas==8: clas=6; armour=0 # LR WM is light borg
if clas==9: clas=6; armour=1 # GL WM is med borg if clas==9: clas=6; armour=1 # GL WM is med borg
seed,clas=rand(seed,clas) seed,clas=rand(seed,clas)
print(rank,cap)
rank,cap=adjust_rank(rank,cap,key,moh,pcc) rank,cap=adjust_rank(rank,cap,key,moh,pcc)
print(rank,cap,key,moh,pcc)
code1=0 code1=0
weight=1 weight=1
for n in list(zip(tables.weights,[xp//10,rank,cap,cob,lsa,rem,clas,armour,trait,spec,talent])): for n in list(zip(tables.weights,[xp//10,rank,cap,cob,lsa,rem,clas,armour,trait,spec,talent])):