Remove treasure rewards for comments.
Given that coins are not visible in many contexts, the conspicuous appearance of treasure chests (random coin rewards on 1% of comments) seems out of place. This removes the logic which rewards treasure, the visible display of treasure, and drops the column containing treasure information which has already been awarded to at least one comment on prod.
This commit is contained in:
parent
cccb26cb3f
commit
e12b0eea1a
7 changed files with 28 additions and 47 deletions
|
@ -4946,11 +4946,6 @@ html {
|
||||||
margin-top: 0.5rem !important;
|
margin-top: 0.5rem !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.treasure {
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-right: 3px;
|
|
||||||
margin-top: -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.emojitab {
|
a.emojitab {
|
||||||
padding: 0.5rem 0.7rem !important;
|
padding: 0.5rem 0.7rem !important;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB |
|
@ -47,7 +47,6 @@ class Comment(Base):
|
||||||
slots_result = Column(String)
|
slots_result = Column(String)
|
||||||
blackjack_result = Column(String)
|
blackjack_result = Column(String)
|
||||||
wordle_result = Column(String)
|
wordle_result = Column(String)
|
||||||
treasure_amount = Column(String)
|
|
||||||
filter_state = Column(String, nullable=False)
|
filter_state = Column(String, nullable=False)
|
||||||
|
|
||||||
Index('comment_parent_index', parent_comment_id)
|
Index('comment_parent_index', parent_comment_id)
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
import random
|
|
||||||
|
|
||||||
special_min = 100
|
|
||||||
special_max = 200
|
|
||||||
standard_min = 10
|
|
||||||
standard_max = 100
|
|
||||||
|
|
||||||
def check_for_treasure(in_text, from_comment):
|
|
||||||
if '!slots' not in in_text and '!blackjack' not in in_text and '!wordle' not in in_text:
|
|
||||||
seed = random.randint(1, 1000)
|
|
||||||
is_special = seed == 1000
|
|
||||||
is_standard = seed >= 990
|
|
||||||
amount = 0
|
|
||||||
|
|
||||||
if is_special:
|
|
||||||
amount = random.randint(special_min, special_max)
|
|
||||||
elif is_standard:
|
|
||||||
amount = random.randint(standard_min, standard_max)
|
|
||||||
if random.randint(1, 100) > 90:
|
|
||||||
user = from_comment.author
|
|
||||||
if amount > user.coins: amount = user.coins
|
|
||||||
amount = -amount
|
|
||||||
|
|
||||||
|
|
||||||
if amount != 0:
|
|
||||||
user = from_comment.author
|
|
||||||
user.coins += amount
|
|
||||||
|
|
||||||
from_comment.treasure_amount = str(amount)
|
|
|
@ -4,7 +4,6 @@ from files.helpers.images import *
|
||||||
from files.helpers.const import *
|
from files.helpers.const import *
|
||||||
from files.helpers.slots import *
|
from files.helpers.slots import *
|
||||||
from files.helpers.blackjack import *
|
from files.helpers.blackjack import *
|
||||||
from files.helpers.treasure import *
|
|
||||||
from files.classes import *
|
from files.classes import *
|
||||||
from files.routes.front import comment_idlist
|
from files.routes.front import comment_idlist
|
||||||
from pusher_push_notifications import PushNotifications
|
from pusher_push_notifications import PushNotifications
|
||||||
|
@ -387,8 +386,6 @@ def api_comment(v):
|
||||||
if not c.slots_result and not c.blackjack_result and v.marseyawarded and parent_post.id not in ADMINISTRATORS and marseyaward_body_regex.search(body_html):
|
if not c.slots_result and not c.blackjack_result and v.marseyawarded and parent_post.id not in ADMINISTRATORS and marseyaward_body_regex.search(body_html):
|
||||||
return {"error":"You can only type marseys!"}, 403
|
return {"error":"You can only type marseys!"}, 403
|
||||||
|
|
||||||
check_for_treasure(body, c)
|
|
||||||
|
|
||||||
if "!wordle" in body:
|
if "!wordle" in body:
|
||||||
answer = random.choice(WORDLE_LIST)
|
answer = random.choice(WORDLE_LIST)
|
||||||
c.wordle_result = f'_active_{answer}'
|
c.wordle_result = f'_active_{answer}'
|
||||||
|
|
|
@ -224,15 +224,6 @@
|
||||||
<span class="time-edited" id="time-edit-{{c.id}}" onmouseover="timestamp('time-edit-{{c.id}}','{{c.edited_utc}}')"><span>·</span> <span class="font-italic">Edited {{c.edited_string}}</span></span>
|
<span class="time-edited" id="time-edit-{{c.id}}" onmouseover="timestamp('time-edit-{{c.id}}','{{c.edited_utc}}')"><span>·</span> <span class="font-italic">Edited {{c.edited_string}}</span></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if c.treasure_amount and c.treasure_amount != '0' %}
|
|
||||||
<img class="treasure" alt="treasure" src="{{ 'images/chest.webp' | asset }}" width="20" />
|
|
||||||
{% if '-' in c.treasure_amount %}
|
|
||||||
<em>A Mimic Ate {{c.treasure_amount.replace('-', '')}} Coins!</em>
|
|
||||||
{% else %}
|
|
||||||
<em>Found {{c.treasure_amount}} Coins!</em>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if c.slots_result %}
|
{% if c.slots_result %}
|
||||||
<em style="position: relative; top: 2px; margin-left: 0.5rem">{{c.slots_result}}</em>
|
<em style="position: relative; top: 2px; margin-left: 0.5rem">{{c.slots_result}}</em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
"""Remove treasure_amount from comments.
|
||||||
|
|
||||||
|
Revision ID: c217c608d86c
|
||||||
|
Revises: c5bbdae9a233
|
||||||
|
Create Date: 2022-09-04 21:49:42.471406+00:00
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'c217c608d86c'
|
||||||
|
down_revision = 'c5bbdae9a233'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('comments', 'treasure_amount')
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('comments', sa.Column('treasure_amount', sa.VARCHAR(length=10), autoincrement=False, nullable=True))
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Add table
Add a link
Reference in a new issue