forked from rDrama/rDrama
Make hole cost constant instead of variable
parent
934b631730
commit
2b82f95a98
|
@ -126,7 +126,6 @@ class User(Base):
|
|||
ban_evade = Column(Integer, default=0)
|
||||
original_username = deferred(Column(String))
|
||||
referred_by = Column(Integer, ForeignKey("users.id"))
|
||||
subs_created = Column(Integer, default=0)
|
||||
can_gamble = Column(Boolean, default=True)
|
||||
currently_held_lottery_tickets = Column(Integer, default=0)
|
||||
total_held_lottery_tickets = Column(Integer, default=0)
|
||||
|
|
|
@ -84,7 +84,7 @@ def merge(v, id1, id2):
|
|||
g.db.add(exile)
|
||||
g.db.flush()
|
||||
|
||||
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truecoins', 'procoins', 'subs_created'):
|
||||
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truecoins', 'procoins'):
|
||||
amount = getattr(user1, kind) + getattr(user2, kind)
|
||||
setattr(user1, kind, amount)
|
||||
setattr(user2, kind, 0)
|
||||
|
@ -131,7 +131,7 @@ def merge_all(v, id):
|
|||
g.db.flush()
|
||||
|
||||
for alt in user.alts_unique:
|
||||
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truecoins', 'procoins', 'subs_created'):
|
||||
for kind in ('comment_count', 'post_count', 'winnings', 'received_award_count', 'coins_spent', 'lootboxes_bought', 'coins', 'truecoins', 'procoins'):
|
||||
amount = getattr(user, kind) + getattr(alt, kind)
|
||||
setattr(user, kind, amount)
|
||||
setattr(alt, kind, 0)
|
||||
|
|
|
@ -265,12 +265,8 @@ def remove_mod(v, sub):
|
|||
@app.get("/create_hole")
|
||||
@is_not_permabanned
|
||||
def create_sub(v):
|
||||
num = v.subs_created + 1
|
||||
for a in v.alts:
|
||||
num += a.subs_created
|
||||
cost = num * HOLE_COST
|
||||
|
||||
return render_template("sub/create_hole.html", v=v, cost=cost)
|
||||
return render_template("sub/create_hole.html", v=v, cost=HOLE_COST)
|
||||
|
||||
|
||||
@app.post("/create_hole")
|
||||
|
@ -282,22 +278,16 @@ def create_sub2(v):
|
|||
if not name: abort(400)
|
||||
name = name.strip().lower()
|
||||
|
||||
num = v.subs_created + 1
|
||||
for a in v.alts:
|
||||
num += a.subs_created
|
||||
cost = num * HOLE_COST
|
||||
|
||||
if not valid_sub_regex.fullmatch(name):
|
||||
return render_template("sub/create_hole.html", v=v, cost=cost, error="Sub name not allowed."), 400
|
||||
return render_template("sub/create_hole.html", v=v, cost=HOLE_COST, error="Sub name not allowed."), 400
|
||||
|
||||
sub = g.db.query(Sub).filter_by(name=name).one_or_none()
|
||||
if not sub:
|
||||
if v.coins < cost:
|
||||
return render_template("sub/create_hole.html", v=v, cost=cost, error="You don't have enough coins!"), 403
|
||||
if v.coins < HOLE_COST:
|
||||
return render_template("sub/create_hole.html", v=v, cost=HOLE_COST, error="You don't have enough coins!"), 403
|
||||
|
||||
v.coins -= cost
|
||||
v.coins -= HOLE_COST
|
||||
|
||||
v.subs_created += 1
|
||||
g.db.add(v)
|
||||
|
||||
sub = Sub(name=name)
|
||||
|
|
|
@ -671,7 +671,6 @@ CREATE TABLE public.users (
|
|||
patron_utc integer DEFAULT 0 NOT NULL,
|
||||
rehab integer,
|
||||
house character varying(16),
|
||||
subs_created integer DEFAULT 0 NOT NULL,
|
||||
deflector integer,
|
||||
reddit character varying(15) NOT NULL,
|
||||
animations boolean DEFAULT true NOT NULL,
|
||||
|
|
Loading…
Reference in New Issue