пенис пенис елда
This commit is contained in:
+2240
-53
File diff suppressed because it is too large
Load Diff
@@ -101,8 +101,7 @@ async def admin_dashboard(
|
|||||||
|
|
||||||
recent_users = db.query(User).order_by(desc(User.created_at)).limit(10).all()
|
recent_users = db.query(User).order_by(desc(User.created_at)).limit(10).all()
|
||||||
|
|
||||||
return templates.TemplateResponse("admin/dashboard.html", {
|
return templates.TemplateResponse(request, "admin/dashboard.html", {
|
||||||
"request": request,
|
|
||||||
"user": admin,
|
"user": admin,
|
||||||
"total_users": total_users,
|
"total_users": total_users,
|
||||||
"total_items": total_items,
|
"total_items": total_items,
|
||||||
@@ -151,8 +150,7 @@ async def admin_users(
|
|||||||
"rpu_level": round(calculate_rpu_level(rpu))
|
"rpu_level": round(calculate_rpu_level(rpu))
|
||||||
})
|
})
|
||||||
|
|
||||||
return templates.TemplateResponse("admin/users.html", {
|
return templates.TemplateResponse(request, "admin/users.html", {
|
||||||
"request": request,
|
|
||||||
"user": admin,
|
"user": admin,
|
||||||
"users": users_with_rpu,
|
"users": users_with_rpu,
|
||||||
"search": search
|
"search": search
|
||||||
@@ -177,8 +175,7 @@ async def admin_user_detail(
|
|||||||
InventoryItem.user_id == user_id
|
InventoryItem.user_id == user_id
|
||||||
).order_by(desc(InventoryItem.obtained_at)).limit(50).all()
|
).order_by(desc(InventoryItem.obtained_at)).limit(50).all()
|
||||||
|
|
||||||
return templates.TemplateResponse("admin/user_detail.html", {
|
return templates.TemplateResponse(request, "admin/user_detail.html", {
|
||||||
"request": request,
|
|
||||||
"user": admin,
|
"user": admin,
|
||||||
"target_user": target_user,
|
"target_user": target_user,
|
||||||
"total_items": total_items,
|
"total_items": total_items,
|
||||||
@@ -210,8 +207,7 @@ async def admin_cases(
|
|||||||
"image_url": item.get("image_url", "")
|
"image_url": item.get("image_url", "")
|
||||||
})
|
})
|
||||||
|
|
||||||
return templates.TemplateResponse("admin/cases.html", {
|
return templates.TemplateResponse(request, "admin/cases.html", {
|
||||||
"request": request,
|
|
||||||
"user": admin,
|
"user": admin,
|
||||||
"cases": cases,
|
"cases": cases,
|
||||||
"mainpage": mainpage,
|
"mainpage": mainpage,
|
||||||
@@ -291,6 +287,9 @@ async def admin_give_item(
|
|||||||
db.add(inventory_item)
|
db.add(inventory_item)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
from achievements import check_collection_achievements
|
||||||
|
check_collection_achievements(db, user_id)
|
||||||
|
|
||||||
return JSONResponse({
|
return JSONResponse({
|
||||||
"success": True,
|
"success": True,
|
||||||
"message": f"Предмет '{item_data.get('market_hash_name')}' выдан пользователю {target_user.username}"
|
"message": f"Предмет '{item_data.get('market_hash_name')}' выдан пользователю {target_user.username}"
|
||||||
|
|||||||
+19
-10
@@ -105,27 +105,36 @@ def load_custom_items() -> List[dict]:
|
|||||||
|
|
||||||
# ─── Генерация sub-вариаций цен и float ───────────────────────────────────
|
# ─── Генерация sub-вариаций цен и float ───────────────────────────────────
|
||||||
def generate_item_variants(num_variants: int = 6):
|
def generate_item_variants(num_variants: int = 6):
|
||||||
"""Для каждого предмета генерирует sub-вариации с разными ценами и float"""
|
"""Для каждого предмета генерирует sub-вариации с разными ценами и float.
|
||||||
|
|
||||||
|
Оригиналы остаются на своих местах (индексы 0..N-1 не меняются),
|
||||||
|
sub-вариации добавляются в конец списка (индексы N..N+N*5-1),
|
||||||
|
чтобы не ломать ссылки по индексам (cases.json, база данных).
|
||||||
|
"""
|
||||||
global ALL_ITEMS
|
global ALL_ITEMS
|
||||||
new_all = []
|
n_originals = len(ALL_ITEMS)
|
||||||
for item in ALL_ITEMS:
|
sub_variants = []
|
||||||
|
|
||||||
|
for idx, item in enumerate(ALL_ITEMS):
|
||||||
base_price = item.get("price_rub", 0)
|
base_price = item.get("price_rub", 0)
|
||||||
wr = item.get("wear_range", [0, 1])
|
wr = item.get("wear_range", [0, 1])
|
||||||
mid = item.get("mid_float_used", 0.5)
|
mid = item.get("mid_float_used", 0.5)
|
||||||
wr_min, wr_max = wr
|
wr_min, wr_max = wr
|
||||||
f_range = max(wr_max - wr_min, 0.001)
|
f_range = max(wr_max - wr_min, 0.001)
|
||||||
|
|
||||||
for v in range(num_variants):
|
# v=0 — сам оригинал (оставляем как есть)
|
||||||
|
# v=1..num_variants-1 — sub-вариации (добавляем в конец)
|
||||||
|
for v in range(1, num_variants):
|
||||||
variant = dict(item)
|
variant = dict(item)
|
||||||
|
variant["is_subvariant"] = True
|
||||||
t = v / (num_variants - 1) if num_variants > 1 else 0
|
t = v / (num_variants - 1) if num_variants > 1 else 0
|
||||||
|
|
||||||
# price factor: 0.55 to 1.40 across variants
|
# price factor: 0.55 to 1.40 across variants
|
||||||
factor = 0.55 + t * 0.85
|
factor = 0.55 + t * 0.85
|
||||||
# add small random jitter
|
|
||||||
factor += random.uniform(-0.05, 0.05)
|
factor += random.uniform(-0.05, 0.05)
|
||||||
factor = max(0.30, min(1.50, factor))
|
factor = max(0.30, min(1.50, factor))
|
||||||
|
|
||||||
p = int(base_price * factor)
|
p = int(base_price * factor)
|
||||||
# scramble last digits
|
|
||||||
if p >= 1_000_000:
|
if p >= 1_000_000:
|
||||||
prefix = p // 1000
|
prefix = p // 1000
|
||||||
suffix = random.randint(100, 999)
|
suffix = random.randint(100, 999)
|
||||||
@@ -148,11 +157,11 @@ def generate_item_variants(num_variants: int = 6):
|
|||||||
new_mid = max(wr_min + 0.001, min(wr_max - 0.001, new_mid))
|
new_mid = max(wr_min + 0.001, min(wr_max - 0.001, new_mid))
|
||||||
variant["mid_float_used"] = round(new_mid, 4)
|
variant["mid_float_used"] = round(new_mid, 4)
|
||||||
|
|
||||||
new_all.append(variant)
|
sub_variants.append(variant)
|
||||||
|
|
||||||
count_before = len(ALL_ITEMS)
|
ALL_ITEMS = ALL_ITEMS + sub_variants
|
||||||
ALL_ITEMS = new_all
|
print(f"Сгенерировано {len(sub_variants)} sub-вариаций для {n_originals} предметов (x{num_variants})")
|
||||||
print(f"Сгенерировано {len(ALL_ITEMS)} sub-вариаций из {count_before} предметов (x{num_variants})")
|
print(f"Оригиналы: индексы 0..{n_originals - 1}, sub-вариации: {n_originals}..{len(ALL_ITEMS) - 1}")
|
||||||
|
|
||||||
# ─── Загрузка основных данных ─────────────────────────────────────────────
|
# ─── Загрузка основных данных ─────────────────────────────────────────────
|
||||||
def load_base_items() -> List[dict]:
|
def load_base_items() -> List[dict]:
|
||||||
|
|||||||
+14
@@ -162,6 +162,7 @@ class Achievement(Base):
|
|||||||
requirement_value = Column(Integer, nullable=False) # how many
|
requirement_value = Column(Integer, nullable=False) # how many
|
||||||
reward_amount = Column(Float, default=0.0) # bonus rubles
|
reward_amount = Column(Float, default=0.0) # bonus rubles
|
||||||
sort_order = Column(Integer, default=0)
|
sort_order = Column(Integer, default=0)
|
||||||
|
hidden = Column(Boolean, default=False) # секретные достижения
|
||||||
|
|
||||||
user_achievements = relationship("UserAchievement", back_populates="achievement")
|
user_achievements = relationship("UserAchievement", back_populates="achievement")
|
||||||
|
|
||||||
@@ -195,6 +196,19 @@ class ActivityFeed(Base):
|
|||||||
|
|
||||||
Base.metadata.create_all(bind=engine)
|
Base.metadata.create_all(bind=engine)
|
||||||
|
|
||||||
|
# Миграция: добавляем колонку hidden если её нет
|
||||||
|
try:
|
||||||
|
from sqlalchemy import inspect
|
||||||
|
inspector = inspect(engine)
|
||||||
|
cols = [c["name"] for c in inspector.get_columns("achievements")]
|
||||||
|
if "hidden" not in cols:
|
||||||
|
from sqlalchemy import text
|
||||||
|
with engine.connect() as conn:
|
||||||
|
conn.execute(text("ALTER TABLE achievements ADD COLUMN hidden BOOLEAN DEFAULT 0"))
|
||||||
|
conn.commit()
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[DB] Миграция hidden: {e}")
|
||||||
|
|
||||||
def get_db():
|
def get_db():
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
try:
|
try:
|
||||||
|
|||||||
+170
-41
@@ -17,10 +17,23 @@ from pathlib import Path
|
|||||||
from database import get_db, SessionLocal, User, InventoryItem, CaseOpening, Contract, Upgrade, UpgradeRPU
|
from database import get_db, SessionLocal, User, InventoryItem, CaseOpening, Contract, Upgrade, UpgradeRPU
|
||||||
from websocket_manager import manager, crash_game
|
from websocket_manager import manager, crash_game
|
||||||
from achievements import (
|
from achievements import (
|
||||||
seed_achievements, check_achievement, check_open_cases_achievements, check_contracts_achievements,
|
seed_achievements, check_achievement,
|
||||||
check_upgrade_achievements, check_rare_item_achievement, check_knife_achievement,
|
check_open_cases_achievements, check_contracts_achievements,
|
||||||
check_spent_achievements, check_balance_achievement, check_slot_match_achievement,
|
check_upgrade_achievements, check_upgrade_risk_achievements, check_upgrade_result_achievements,
|
||||||
check_slot_plays_achievements, check_inventory_achievement, get_user_achievements
|
check_rare_item_achievement, check_knife_achievement,
|
||||||
|
check_spent_achievements,
|
||||||
|
check_balance_achievements,
|
||||||
|
check_slot_match_achievements, check_slot_plays_achievements,
|
||||||
|
check_slot_match_count_achievements,
|
||||||
|
check_inventory_achievements,
|
||||||
|
check_dildo_achievements, check_dildo_contract_achievement,
|
||||||
|
check_crash_achievements, check_crash_cashout_achievements,
|
||||||
|
check_items_unboxed_achievements, check_total_profit_achievements,
|
||||||
|
check_achievements_count_achievements,
|
||||||
|
check_rare_item_count_achievements, check_knife_count_achievements,
|
||||||
|
check_midnight_case_achievement, check_exact_cases_achievement,
|
||||||
|
check_collection_achievements,
|
||||||
|
get_user_achievements
|
||||||
)
|
)
|
||||||
from auth import (
|
from auth import (
|
||||||
create_user, authenticate_user, create_access_token,
|
create_user, authenticate_user, create_access_token,
|
||||||
@@ -307,8 +320,7 @@ async def index(request: Request, user: Optional[User] = Depends(get_current_use
|
|||||||
if user:
|
if user:
|
||||||
return RedirectResponse(url="/cases")
|
return RedirectResponse(url="/cases")
|
||||||
|
|
||||||
return templates.TemplateResponse("index.html", {
|
return templates.TemplateResponse(request, "index.html", {
|
||||||
"request": request,
|
|
||||||
"user": None,
|
"user": None,
|
||||||
"active_page": "home"
|
"active_page": "home"
|
||||||
})
|
})
|
||||||
@@ -319,8 +331,7 @@ async def login_page(request: Request, user: Optional[User] = Depends(get_curren
|
|||||||
if user:
|
if user:
|
||||||
return RedirectResponse(url="/profile")
|
return RedirectResponse(url="/profile")
|
||||||
|
|
||||||
return templates.TemplateResponse("login.html", {
|
return templates.TemplateResponse(request, "login.html", {
|
||||||
"request": request,
|
|
||||||
"user": None,
|
"user": None,
|
||||||
"active_page": "login"
|
"active_page": "login"
|
||||||
})
|
})
|
||||||
@@ -331,8 +342,7 @@ async def register_page(request: Request, user: Optional[User] = Depends(get_cur
|
|||||||
if user:
|
if user:
|
||||||
return RedirectResponse(url="/profile")
|
return RedirectResponse(url="/profile")
|
||||||
|
|
||||||
return templates.TemplateResponse("register.html", {
|
return templates.TemplateResponse(request, "register.html", {
|
||||||
"request": request,
|
|
||||||
"user": None,
|
"user": None,
|
||||||
"active_page": "register"
|
"active_page": "register"
|
||||||
})
|
})
|
||||||
@@ -399,8 +409,7 @@ async def profile_page(
|
|||||||
if item.type:
|
if item.type:
|
||||||
types.add(item.type)
|
types.add(item.type)
|
||||||
|
|
||||||
return templates.TemplateResponse("profile.html", {
|
return templates.TemplateResponse(request, "profile.html", {
|
||||||
"request": request,
|
|
||||||
"user": user,
|
"user": user,
|
||||||
"total_items": total_items,
|
"total_items": total_items,
|
||||||
"cases_opened": cases_opened,
|
"cases_opened": cases_opened,
|
||||||
@@ -490,8 +499,7 @@ async def public_profile_page(
|
|||||||
reverse=True
|
reverse=True
|
||||||
)[:12]
|
)[:12]
|
||||||
|
|
||||||
return templates.TemplateResponse("profile.html", {
|
return templates.TemplateResponse(request, "profile.html", {
|
||||||
"request": request,
|
|
||||||
"user": current_user,
|
"user": current_user,
|
||||||
"profile_user": profile_user,
|
"profile_user": profile_user,
|
||||||
"is_public": True,
|
"is_public": True,
|
||||||
@@ -586,8 +594,7 @@ async def cases_page(
|
|||||||
|
|
||||||
#print(f"Всего секций для отображения: {len(sections)}")
|
#print(f"Всего секций для отображения: {len(sections)}")
|
||||||
|
|
||||||
return templates.TemplateResponse("cases.html", {
|
return templates.TemplateResponse(request, "cases.html", {
|
||||||
"request": request,
|
|
||||||
"user": user,
|
"user": user,
|
||||||
"sections": sections,
|
"sections": sections,
|
||||||
"active_page": "cases"
|
"active_page": "cases"
|
||||||
@@ -644,8 +651,7 @@ async def contracts_page(
|
|||||||
has_contract = any(c >= 10 for c in group_counts.values())
|
has_contract = any(c >= 10 for c in group_counts.values())
|
||||||
has_knife_contract = len(knife_items) >= 10
|
has_knife_contract = len(knife_items) >= 10
|
||||||
|
|
||||||
return templates.TemplateResponse("contracts.html", {
|
return templates.TemplateResponse(request, "contracts.html", {
|
||||||
"request": request,
|
|
||||||
"user": user,
|
"user": user,
|
||||||
"inventory_items": all_items + knife_items,
|
"inventory_items": all_items + knife_items,
|
||||||
"has_contract": has_contract or has_knife_contract,
|
"has_contract": has_contract or has_knife_contract,
|
||||||
@@ -887,8 +893,9 @@ async def api_open_case(
|
|||||||
|
|
||||||
# Проверка достижений
|
# Проверка достижений
|
||||||
unlocked_ach = []
|
unlocked_ach = []
|
||||||
|
open_count = db.query(CaseOpening).filter(CaseOpening.user_id == user.id).count()
|
||||||
unlocked_ach += check_open_cases_achievements(db, user.id)
|
unlocked_ach += check_open_cases_achievements(db, user.id)
|
||||||
total_spent = db.query(CaseOpening).filter(CaseOpening.user_id == user.id).count() * price_per_case
|
total_spent = open_count * price_per_case
|
||||||
unlocked_ach += check_spent_achievements(db, user.id, total_spent)
|
unlocked_ach += check_spent_achievements(db, user.id, total_spent)
|
||||||
|
|
||||||
# Проверка на редкий предмет
|
# Проверка на редкий предмет
|
||||||
@@ -898,7 +905,18 @@ async def api_open_case(
|
|||||||
if item_data:
|
if item_data:
|
||||||
unlocked_ach += check_knife_achievement(db, user.id, item_data)
|
unlocked_ach += check_knife_achievement(db, user.id, item_data)
|
||||||
|
|
||||||
unlocked_ach += check_inventory_achievement(db, user.id)
|
unlocked_ach += check_inventory_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_dildo_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_items_unboxed_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_rare_item_count_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_knife_count_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_balance_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_achievements_count_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_midnight_case_achievement(db, user.id)
|
||||||
|
unlocked_ach += check_exact_cases_achievement(db, user.id, open_count)
|
||||||
|
unlocked_ach += check_collection_achievements(db, user.id)
|
||||||
|
profit = user.balance + total_spent
|
||||||
|
unlocked_ach += check_total_profit_achievements(db, user.id, profit)
|
||||||
|
|
||||||
# Запись активности — каждый предмет отдельно
|
# Запись активности — каждый предмет отдельно
|
||||||
for r in results:
|
for r in results:
|
||||||
@@ -1067,7 +1085,12 @@ async def api_submit_contract(
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
unlocked_ach = check_contracts_achievements(db, user.id)
|
unlocked_ach = check_contracts_achievements(db, user.id)
|
||||||
unlocked_ach += check_inventory_achievement(db, user.id)
|
unlocked_ach += check_inventory_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_balance_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_dildo_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_dildo_contract_achievement(db, user.id)
|
||||||
|
unlocked_ach += check_collection_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_achievements_count_achievements(db, user.id)
|
||||||
|
|
||||||
act = record_activity_own_session(user.id, user.username, "contract",
|
act = record_activity_own_session(user.id, user.username, "contract",
|
||||||
f"🔄 выполнил(а) контракт и получил(а) {result.received_item.market_hash_name}",
|
f"🔄 выполнил(а) контракт и получил(а) {result.received_item.market_hash_name}",
|
||||||
@@ -1148,6 +1171,111 @@ async def get_item_image(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/web/api/inventory/item-detail/{inventory_id}")
|
||||||
|
async def api_item_detail(
|
||||||
|
inventory_id: int,
|
||||||
|
db: Session = Depends(get_db),
|
||||||
|
user: User = Depends(get_current_user)
|
||||||
|
):
|
||||||
|
"""Детальная информация о предмете с коллекцией"""
|
||||||
|
inv_item = db.query(InventoryItem).filter(
|
||||||
|
InventoryItem.id == inventory_id,
|
||||||
|
InventoryItem.user_id == user.id
|
||||||
|
).first()
|
||||||
|
if not inv_item:
|
||||||
|
# Also allow viewing if item exists (public profiles)
|
||||||
|
inv_item = db.query(InventoryItem).filter(
|
||||||
|
InventoryItem.id == inventory_id
|
||||||
|
).first()
|
||||||
|
if not inv_item:
|
||||||
|
return JSONResponse(status_code=404, content={"error": "Предмет не найден"})
|
||||||
|
|
||||||
|
item_data = get_item(inv_item.item_id)
|
||||||
|
if not item_data:
|
||||||
|
return JSONResponse(status_code=404, content={"error": "Данные предмета не найдены"})
|
||||||
|
|
||||||
|
collection = item_data.get("collection", "").strip()
|
||||||
|
# fallback to case name
|
||||||
|
if not collection or collection == "Без коллекции":
|
||||||
|
crates = item_data.get("crates_names", [])
|
||||||
|
if crates:
|
||||||
|
collection = f"Case: {crates[0]}"
|
||||||
|
|
||||||
|
item_resp = {
|
||||||
|
"id": inv_item.id,
|
||||||
|
"item_id": inv_item.item_id,
|
||||||
|
"name": inv_item.market_hash_name,
|
||||||
|
"rarity": inv_item.rarity,
|
||||||
|
"wear": inv_item.wear,
|
||||||
|
"float": inv_item.float_value,
|
||||||
|
"type": inv_item.type,
|
||||||
|
"price_rub": item_data.get("price_rub", 100),
|
||||||
|
"image_url": item_data.get("image_url", ""),
|
||||||
|
"collection": collection,
|
||||||
|
"weapon": item_data.get("weapon", ""),
|
||||||
|
"pattern": item_data.get("pattern", ""),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Собираем все предметы коллекции
|
||||||
|
coll_items = []
|
||||||
|
all_owned = True
|
||||||
|
owned_names = set()
|
||||||
|
|
||||||
|
# Получаем все item_id из коллекции
|
||||||
|
from backend import COLLECTIONS_INDEX, extract_base_name, RARITY_ORDER
|
||||||
|
collection_ids = COLLECTIONS_INDEX.get(collection, [])
|
||||||
|
|
||||||
|
# Группируем по базовому имени (без учёта вариантов)
|
||||||
|
seen_base = {}
|
||||||
|
for cid in collection_ids:
|
||||||
|
citem = get_item(cid)
|
||||||
|
if not citem:
|
||||||
|
continue
|
||||||
|
base = extract_base_name(citem.get("market_hash_name", ""))
|
||||||
|
if base and base not in seen_base:
|
||||||
|
seen_base[base] = citem
|
||||||
|
|
||||||
|
# Все предметы пользователя — для проверки владения
|
||||||
|
user_items = db.query(InventoryItem.item_id).filter(
|
||||||
|
InventoryItem.user_id == user.id
|
||||||
|
).all()
|
||||||
|
user_item_ids = {iid for (iid,) in user_items}
|
||||||
|
|
||||||
|
# Сортируем по редкости (низшая → высшая)
|
||||||
|
sorted_bases = sorted(seen_base.values(), key=lambda x: RARITY_ORDER.get(x.get("rarity", "Unknown"), -1))
|
||||||
|
|
||||||
|
for citem in sorted_bases:
|
||||||
|
base = extract_base_name(citem.get("market_hash_name", ""))
|
||||||
|
owned = False
|
||||||
|
for u_id in user_item_ids:
|
||||||
|
u_item = get_item(u_id)
|
||||||
|
if u_item and extract_base_name(u_item.get("market_hash_name", "")) == base:
|
||||||
|
owned = True
|
||||||
|
owned_names.add(base)
|
||||||
|
break
|
||||||
|
|
||||||
|
if not owned:
|
||||||
|
all_owned = False
|
||||||
|
|
||||||
|
coll_items.append({
|
||||||
|
"base_name": base,
|
||||||
|
"market_hash_name": citem.get("market_hash_name", ""),
|
||||||
|
"weapon": citem.get("weapon", ""),
|
||||||
|
"pattern": citem.get("pattern", ""),
|
||||||
|
"rarity": citem.get("rarity", ""),
|
||||||
|
"rarity_level": RARITY_ORDER.get(citem.get("rarity", "Unknown"), -1),
|
||||||
|
"owned": owned,
|
||||||
|
"image_url": citem.get("image_url", ""),
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
"item": item_resp,
|
||||||
|
"collection_name": collection if collection else "",
|
||||||
|
"items": coll_items,
|
||||||
|
"all_owned": all_owned,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_case_items(case_name: str) -> List[dict]:
|
def get_case_items(case_name: str) -> List[dict]:
|
||||||
"""Получает предметы кейса по его имени"""
|
"""Получает предметы кейса по его имени"""
|
||||||
items = []
|
items = []
|
||||||
@@ -1472,8 +1600,7 @@ async def case_detail_page(
|
|||||||
"image_url": item["image_url"]
|
"image_url": item["image_url"]
|
||||||
})
|
})
|
||||||
|
|
||||||
return templates.TemplateResponse("case_detail.html", {
|
return templates.TemplateResponse(request, "case_detail.html", {
|
||||||
"request": request,
|
|
||||||
"user": user,
|
"user": user,
|
||||||
"case_name": case_name,
|
"case_name": case_name,
|
||||||
"case_display_name": case_config.get('display_name', case_name),
|
"case_display_name": case_config.get('display_name', case_name),
|
||||||
@@ -1885,8 +2012,11 @@ async def api_open_slot_case(
|
|||||||
# Проверка достижений для слота
|
# Проверка достижений для слота
|
||||||
unlocked_ach = []
|
unlocked_ach = []
|
||||||
if match:
|
if match:
|
||||||
unlocked_ach += check_slot_match_achievement(db, user.id)
|
unlocked_ach += check_slot_match_achievements(db, user.id)
|
||||||
unlocked_ach += check_slot_plays_achievements(db, user.id)
|
unlocked_ach += check_slot_plays_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_slot_match_count_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_balance_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_achievements_count_achievements(db, user.id)
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
@@ -2234,8 +2364,7 @@ async def upgrade_page(
|
|||||||
"probability": round(u.rpu_adjusted_probability or u.probability or 0, 1)
|
"probability": round(u.rpu_adjusted_probability or u.probability or 0, 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
return templates.TemplateResponse("upgrade.html", {
|
return templates.TemplateResponse(request, "upgrade.html", {
|
||||||
"request": request,
|
|
||||||
"user": user,
|
"user": user,
|
||||||
"inventory_items": enriched_items,
|
"inventory_items": enriched_items,
|
||||||
"upgrade_rpu": upgrade_rpu,
|
"upgrade_rpu": upgrade_rpu,
|
||||||
@@ -2450,6 +2579,12 @@ async def api_execute_upgrade(
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
unlocked_ach = check_upgrade_achievements(db, user.id)
|
unlocked_ach = check_upgrade_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_upgrade_risk_achievements(db, user.id, input_price)
|
||||||
|
unlocked_ach += check_upgrade_result_achievements(db, user.id, success, base_probability, input_price)
|
||||||
|
unlocked_ach += check_dildo_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_balance_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_collection_achievements(db, user.id)
|
||||||
|
unlocked_ach += check_achievements_count_achievements(db, user.id)
|
||||||
|
|
||||||
if success:
|
if success:
|
||||||
act = record_activity_own_session(user.id, user.username, "upgrade",
|
act = record_activity_own_session(user.id, user.username, "upgrade",
|
||||||
@@ -2501,8 +2636,7 @@ async def achievements_page(
|
|||||||
total = len(achievements)
|
total = len(achievements)
|
||||||
unlocked = sum(1 for a in achievements if a["unlocked"])
|
unlocked = sum(1 for a in achievements if a["unlocked"])
|
||||||
|
|
||||||
return templates.TemplateResponse("achievements.html", {
|
return templates.TemplateResponse(request, "achievements.html", {
|
||||||
"request": request,
|
|
||||||
"user": user,
|
"user": user,
|
||||||
"achievements": achievements,
|
"achievements": achievements,
|
||||||
"total": total,
|
"total": total,
|
||||||
@@ -2534,8 +2668,7 @@ async def activity_page(
|
|||||||
):
|
):
|
||||||
activities = db.query(ActivityFeed).order_by(desc(ActivityFeed.created_at)).limit(50).all()
|
activities = db.query(ActivityFeed).order_by(desc(ActivityFeed.created_at)).limit(50).all()
|
||||||
|
|
||||||
return templates.TemplateResponse("activity.html", {
|
return templates.TemplateResponse(request, "activity.html", {
|
||||||
"request": request,
|
|
||||||
"user": user,
|
"user": user,
|
||||||
"activities": [
|
"activities": [
|
||||||
{
|
{
|
||||||
@@ -2681,8 +2814,7 @@ async def crash_page(
|
|||||||
request: Request,
|
request: Request,
|
||||||
user: User = Depends(get_current_user)
|
user: User = Depends(get_current_user)
|
||||||
):
|
):
|
||||||
return templates.TemplateResponse("crash.html", {
|
return templates.TemplateResponse(request, "crash.html", {
|
||||||
"request": request,
|
|
||||||
"user": user,
|
"user": user,
|
||||||
"active_page": "crash"
|
"active_page": "crash"
|
||||||
})
|
})
|
||||||
@@ -2711,11 +2843,9 @@ async def api_crash_bet(
|
|||||||
CrActivity.user_id == user.id,
|
CrActivity.user_id == user.id,
|
||||||
CrActivity.activity_type == "crash"
|
CrActivity.activity_type == "crash"
|
||||||
).count() + 1
|
).count() + 1
|
||||||
unlocked_ach = []
|
unlocked_ach = check_crash_achievements(db, user.id, crash_count)
|
||||||
r1 = check_achievement(db, user.id, "crash_first", 1)
|
unlocked_ach += check_balance_achievements(db, user.id)
|
||||||
if r1: unlocked_ach.append(r1)
|
unlocked_ach += check_achievements_count_achievements(db, user.id)
|
||||||
r2 = check_achievement(db, user.id, "crash_pro", crash_count)
|
|
||||||
if r2: unlocked_ach.append(r2)
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
asyncio.ensure_future(manager.send_personal(user.id, {"type": "balance_update", "balance": user.balance}))
|
asyncio.ensure_future(manager.send_personal(user.id, {"type": "balance_update", "balance": user.balance}))
|
||||||
@@ -2748,10 +2878,9 @@ async def api_crash_cashout(
|
|||||||
user.balance += payout
|
user.balance += payout
|
||||||
|
|
||||||
# Проверка достижений
|
# Проверка достижений
|
||||||
unlocked_ach = []
|
unlocked_ach = check_crash_cashout_achievements(db, user.id, g.current_multiplier)
|
||||||
if g.current_multiplier >= 5.0:
|
unlocked_ach += check_balance_achievements(db, user.id)
|
||||||
r = check_achievement(db, user.id, "crash_5x", 1)
|
unlocked_ach += check_achievements_count_achievements(db, user.id)
|
||||||
if r: unlocked_ach.append(r)
|
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,5 +12,5 @@ rsync -av \
|
|||||||
/root/dodep-simulator/ \
|
/root/dodep-simulator/ \
|
||||||
root@zernmc.ru:/root/dodep/
|
root@zernmc.ru:/root/dodep/
|
||||||
|
|
||||||
ssh root@zernmc.ru "pkill -f 'uvicorn' 2>/dev/null; pkill -f 'python3.*backend' 2>/dev/null; sleep 2; cd /root/dodep && rm -rf __pycache__ && setsid python3 -m uvicorn frontend:app --host 0.0.0.0 --port 13669 > /tmp/frontend.log 2>&1 &"
|
ssh root@zernmc.ru "cd /root/dodep && pip install --break-system-packages -r requirements.txt 2>&1 | tail -5 && pkill -f 'uvicorn' 2>/dev/null; pkill -f 'python3.*backend' 2>/dev/null; sleep 2; rm -rf __pycache__ && setsid python3 -m uvicorn frontend:app --host 0.0.0.0 --port 13669 > /tmp/frontend.log 2>&1 &"
|
||||||
echo "Deployed and restarted."
|
echo "Deployed and restarted."
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
fastapi>=0.139.0
|
||||||
|
uvicorn>=0.50.0
|
||||||
|
starlette>=1.3.1
|
||||||
|
jinja2>=3.1.6
|
||||||
|
markupsafe>=3.0.0
|
||||||
|
sqlalchemy>=2.0
|
||||||
|
python-jose[cryptography]
|
||||||
|
passlib
|
||||||
|
bcrypt
|
||||||
|
python-multipart
|
||||||
|
python-dateutil
|
||||||
|
aiofiles
|
||||||
|
tqdm
|
||||||
|
aiosqlite
|
||||||
@@ -6,6 +6,30 @@
|
|||||||
<title>Достижения - CS2 Simulator</title>
|
<title>Достижения - CS2 Simulator</title>
|
||||||
<link rel="stylesheet" href="/static/css/style.css">
|
<link rel="stylesheet" href="/static/css/style.css">
|
||||||
<style>
|
<style>
|
||||||
|
.achievement-card.secret {
|
||||||
|
border-color: #8b5cf6;
|
||||||
|
background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), transparent);
|
||||||
|
}
|
||||||
|
.achievement-card.secret.unlocked {
|
||||||
|
border-color: #8b5cf6;
|
||||||
|
background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), transparent);
|
||||||
|
}
|
||||||
|
.achievement-card.secret .achievement-icon {
|
||||||
|
background: rgba(139, 92, 246, 0.1);
|
||||||
|
}
|
||||||
|
.achievement-card.secret.unlocked .achievement-icon {
|
||||||
|
background: rgba(139, 92, 246, 0.2);
|
||||||
|
}
|
||||||
|
.achievement-card .secret-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
right: 8px;
|
||||||
|
font-size: 0.65rem;
|
||||||
|
background: rgba(139, 92, 246, 0.2);
|
||||||
|
color: #a78bfa;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
.achievements-header {
|
.achievements-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -218,10 +242,19 @@
|
|||||||
|
|
||||||
<div class="achievements-grid" id="achievementsGrid">
|
<div class="achievements-grid" id="achievementsGrid">
|
||||||
{% for ach in achievements %}
|
{% for ach in achievements %}
|
||||||
<div class="achievement-card {{ 'unlocked' if ach.unlocked else 'locked' }}"
|
<div class="achievement-card {{ 'unlocked' if ach.unlocked else 'locked' }} {{ 'secret' if ach.hidden else '' }}"
|
||||||
data-category="{{ ach.category }}">
|
data-category="{{ ach.category }}">
|
||||||
|
{% if ach.hidden and not ach.unlocked %}
|
||||||
|
<div class="achievement-icon">❓</div>
|
||||||
|
<div class="achievement-info">
|
||||||
|
<div class="achievement-title">???</div>
|
||||||
|
<div class="achievement-desc">Хммм... похоже что я не знаю как его открыть</div>
|
||||||
|
<div class="secret-badge">🔒 Секрет</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<div class="achievement-icon">{{ ach.icon }}</div>
|
<div class="achievement-icon">{{ ach.icon }}</div>
|
||||||
<div class="achievement-info">
|
<div class="achievement-info">
|
||||||
|
{% if ach.hidden %}<div class="secret-badge">🤫 Секрет</div>{% endif %}
|
||||||
<div class="achievement-title">{{ ach.title }}</div>
|
<div class="achievement-title">{{ ach.title }}</div>
|
||||||
<div class="achievement-desc">{{ ach.description }}</div>
|
<div class="achievement-desc">{{ ach.description }}</div>
|
||||||
{% if ach.reward_amount > 0 %}
|
{% if ach.reward_amount > 0 %}
|
||||||
@@ -230,7 +263,7 @@
|
|||||||
<div class="achievement-progress">
|
<div class="achievement-progress">
|
||||||
<div class="progress-bar">
|
<div class="progress-bar">
|
||||||
<div class="progress-fill {{ 'complete' if ach.unlocked else '' }}"
|
<div class="progress-fill {{ 'complete' if ach.unlocked else '' }}"
|
||||||
style="width: {{ (ach.progress / ach.requirement_value * 100)|round }}%"></div>
|
style="width: {{ (ach.progress / ach.requirement_value * 100)|round if ach.requirement_value > 0 else 100 }}%"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress-text">
|
<div class="progress-text">
|
||||||
{% if ach.unlocked %}
|
{% if ach.unlocked %}
|
||||||
@@ -241,6 +274,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1859,6 +1859,7 @@
|
|||||||
<script src="/static/js/websocket.js"></script>
|
<script src="/static/js/websocket.js"></script>
|
||||||
<script src="/static/js/notifications.js"></script>
|
<script src="/static/js/notifications.js"></script>
|
||||||
<script src="/static/js/safemode.js"></script>
|
<script src="/static/js/safemode.js"></script>
|
||||||
|
<script src="/static/js/app.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function handleAchievements(data) {
|
function handleAchievements(data) {
|
||||||
if (data && data.achievements_unlocked && Array.isArray(data.achievements_unlocked) && data.achievements_unlocked.length > 0) {
|
if (data && data.achievements_unlocked && Array.isArray(data.achievements_unlocked) && data.achievements_unlocked.length > 0) {
|
||||||
|
|||||||
@@ -704,6 +704,7 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script src="/static/js/app.js"></script>
|
||||||
<script src="/static/js/sounds.js"></script>
|
<script src="/static/js/sounds.js"></script>
|
||||||
<script src="/static/js/websocket.js"></script>
|
<script src="/static/js/websocket.js"></script>
|
||||||
<script src="/static/js/notifications.js"></script>
|
<script src="/static/js/notifications.js"></script>
|
||||||
|
|||||||
@@ -166,6 +166,7 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: all 0.25s ease;
|
transition: all 0.25s ease;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inventory-skin-card:hover {
|
.inventory-skin-card:hover {
|
||||||
@@ -443,6 +444,128 @@
|
|||||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ─── Карточка предмета (попап) ──────────────────────────────────── */
|
||||||
|
.ic-overlay {
|
||||||
|
position: fixed; inset: 0;
|
||||||
|
background: rgba(0,0,0,0.8);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
z-index: 9999;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.ic-modal {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: 14px;
|
||||||
|
max-width: 900px;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 85vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
position: relative;
|
||||||
|
padding: 1.5rem;
|
||||||
|
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
.ic-close {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px; right: 16px;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
z-index: 10;
|
||||||
|
width: 32px; height: 32px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
.ic-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
|
||||||
|
.ic-layout {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
.ic-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: var(--bg-dark);
|
||||||
|
border-radius: 10px;
|
||||||
|
min-height: 300px;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.ic-image {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 350px;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
.ic-right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
.ic-name {
|
||||||
|
font-family: 'Russo One', sans-serif;
|
||||||
|
font-size: 1.3rem;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
.ic-detail {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0.3rem 0;
|
||||||
|
border-bottom: 1px solid rgba(255,255,255,0.05);
|
||||||
|
}
|
||||||
|
.ic-label { font-size: 0.82rem; color: var(--text-secondary); }
|
||||||
|
.ic-value { font-size: 0.9rem; font-weight: 500; }
|
||||||
|
.ic-collection-title {
|
||||||
|
font-family: 'Russo One', sans-serif;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
padding-top: 0.75rem;
|
||||||
|
border-top: 1px solid var(--border-color);
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
.ic-collection-list {
|
||||||
|
max-height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.25rem;
|
||||||
|
margin-top: 0.4rem;
|
||||||
|
}
|
||||||
|
.ic-collection-item {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
padding: 0.2rem 0.4rem;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
.ic-collection-item:hover { background: rgba(255,255,255,0.03); }
|
||||||
|
.ic-coll-rarity { font-weight: 600; }
|
||||||
|
.ic-sell-btn {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.6rem;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--primary-color);
|
||||||
|
color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: filter 0.2s;
|
||||||
|
}
|
||||||
|
.ic-sell-btn:hover { filter: brightness(1.1); }
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.ic-layout { grid-template-columns: 1fr; }
|
||||||
|
.ic-left { min-height: 200px; }
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -965,7 +1088,104 @@
|
|||||||
const btn = document.getElementById('soundToggle');
|
const btn = document.getElementById('soundToggle');
|
||||||
if (btn) btn.textContent = localStorage.getItem('sound_enabled') !== 'false' ? '🔊' : '🔇';
|
if (btn) btn.textContent = localStorage.getItem('sound_enabled') !== 'false' ? '🔊' : '🔇';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ─── Карточка предмета (попап) ─────────────────────────────────────
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const grid = document.getElementById('inventoryGrid');
|
||||||
|
if (!grid) return;
|
||||||
|
grid.addEventListener('click', function(e) {
|
||||||
|
const card = e.target.closest('.inventory-skin-card');
|
||||||
|
if (!card) return;
|
||||||
|
if (e.target.closest('.item-select-checkbox, .btn-sell-single')) return;
|
||||||
|
const invId = card.dataset.inventoryId;
|
||||||
|
if (!invId) return;
|
||||||
|
openItemCard(invId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
async function openItemCard(invId) {
|
||||||
|
const modal = document.getElementById('itemCardModal');
|
||||||
|
const overlay = document.getElementById('itemCardOverlay');
|
||||||
|
overlay.style.display = 'flex';
|
||||||
|
modal.innerHTML = '<div style="padding:2rem;text-align:center;color:var(--text-secondary)">Загрузка...</div>';
|
||||||
|
try {
|
||||||
|
const res = await fetch('/web/api/inventory/item-detail/' + invId);
|
||||||
|
if (!res.ok) throw new Error('Ошибка загрузки');
|
||||||
|
const data = await res.json();
|
||||||
|
renderItemCard(data);
|
||||||
|
} catch(e) {
|
||||||
|
modal.innerHTML = '<div style="padding:2rem;text-align:center;color:var(--danger-color)">Ошибка загрузки данных</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderItemCard(data) {
|
||||||
|
const modal = document.getElementById('itemCardModal');
|
||||||
|
const item = data.item;
|
||||||
|
const colName = data.collection_name || 'Без коллекции';
|
||||||
|
const rc = (item.rarity || '').toLowerCase().replace(/\s+/g, '-');
|
||||||
|
const rarityColor = getRarityColor(item.rarity) || '#b0b0b0';
|
||||||
|
const img = item.image_url || '/static/placeholder.png';
|
||||||
|
|
||||||
|
let collHtml = '';
|
||||||
|
if (data.items && data.items.length) {
|
||||||
|
data.items.forEach(function(ci) {
|
||||||
|
const ciRc = (ci.rarity || '').toLowerCase().replace(/\s+/g, '-');
|
||||||
|
const ciColor = getRarityColor(ci.rarity) || '#b0b0b0';
|
||||||
|
let statusColor = ci.owned ? '#ffffff' : '#555';
|
||||||
|
if (data.all_owned) statusColor = '#ffd700';
|
||||||
|
collHtml += '<div class="ic-collection-item" style="color:' + statusColor + ';">'
|
||||||
|
+ '<span class="ic-coll-rarity" style="color:' + ciColor + ';">' + ci.rarity + '</span>'
|
||||||
|
+ ' <span>' + ci.market_hash_name + '</span>'
|
||||||
|
+ (ci.owned ? ' <span style="color:var(--success-color)">✓</span>' : '')
|
||||||
|
+ '</div>';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
modal.innerHTML = '<div class="ic-close" onclick="closeItemCard()">✕</div>'
|
||||||
|
+ '<div class="ic-layout">'
|
||||||
|
+ '<div class="ic-left">'
|
||||||
|
+ '<img src="' + img + '" alt="' + item.name + '" onerror="this.src=\'/static/placeholder.png\'" class="ic-image">'
|
||||||
|
+ '</div>'
|
||||||
|
+ '<div class="ic-right">'
|
||||||
|
+ '<div class="ic-name" style="color:' + rarityColor + '">' + item.name + '</div>'
|
||||||
|
+ '<div class="ic-detail"><span class="ic-label">Коллекция</span><span class="ic-value">' + colName + '</span></div>'
|
||||||
|
+ '<div class="ic-detail"><span class="ic-label">Поношенность</span><span class="ic-value">' + item.wear + '</span></div>'
|
||||||
|
+ '<div class="ic-detail"><span class="ic-label">Float</span><span class="ic-value">' + (item.float != null ? item.float.toFixed(6) : '—') + '</span></div>'
|
||||||
|
+ '<div class="ic-detail"><span class="ic-label">Редкость</span><span class="ic-value" style="color:' + rarityColor + '">' + item.rarity + '</span></div>'
|
||||||
|
+ '<div class="ic-detail"><span class="ic-label">Тип</span><span class="ic-value">' + (item.type || 'Normal') + '</span></div>'
|
||||||
|
+ '<div class="ic-detail"><span class="ic-label">Цена</span><span class="ic-value" style="color:var(--success-color)">💰 ' + (item.price_rub || 0).toLocaleString() + ' ₽</span></div>'
|
||||||
|
+ (collHtml ? '<div class="ic-collection-title">🎨 Скины коллекции</div><div class="ic-collection-list">' + collHtml + '</div>' : '')
|
||||||
|
+ '<button class="btn-sell-single ic-sell-btn" onclick="sellSingleItem(' + item.id + '); closeItemCard();">Продать за ' + (item.price_rub || 0).toLocaleString() + ' ₽</button>'
|
||||||
|
+ '</div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeItemCard() {
|
||||||
|
document.getElementById('itemCardOverlay').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRarityColor(rarity) {
|
||||||
|
const colors = {
|
||||||
|
'Consumer Grade': '#b0b0b0',
|
||||||
|
'Industrial Grade': '#5e98d9',
|
||||||
|
'Mil-Spec': '#4b69ff',
|
||||||
|
'Mil-Spec Grade': '#4b69ff',
|
||||||
|
'Restricted': '#8847ff',
|
||||||
|
'Classified': '#d32ce6',
|
||||||
|
'Covert': '#eb4b4b',
|
||||||
|
'Rare Special Item': '#ffd700',
|
||||||
|
'Extraordinary': '#ffd700',
|
||||||
|
'Contraband': '#ffaa00'
|
||||||
|
};
|
||||||
|
return colors[rarity] || '#b0b0b0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Попап карточки предмета (HTML в body) ─────────────────────────
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div id="itemCardOverlay" class="ic-overlay" style="display:none;" onclick="if(event.target===this)closeItemCard()">
|
||||||
|
<div id="itemCardModal" class="ic-modal"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if not is_public %}{% include '_activity_sidebar.html' %}{% endif %}
|
{% if not is_public %}{% include '_activity_sidebar.html' %}{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -757,6 +757,7 @@
|
|||||||
<script src="/static/js/websocket.js"></script>
|
<script src="/static/js/websocket.js"></script>
|
||||||
<script src="/static/js/notifications.js"></script>
|
<script src="/static/js/notifications.js"></script>
|
||||||
<script src="/static/js/safemode.js"></script>
|
<script src="/static/js/safemode.js"></script>
|
||||||
|
<script src="/static/js/app.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function handleAchievements(data) {
|
function handleAchievements(data) {
|
||||||
if (data && data.achievements_unlocked && Array.isArray(data.achievements_unlocked) && data.achievements_unlocked.length > 0) {
|
if (data && data.achievements_unlocked && Array.isArray(data.achievements_unlocked) && data.achievements_unlocked.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user