3be9a30dcc
El build de Nova WoW es 54261 (WotLK Classic 3.4.3), que caía en la franja marcada como Cataclysm. WotLK Classic llega a 54261 y Cataclysm Classic empieza en 4.4.0=54332, así que el corte se fija en 54261. ServerSelection -> build 54261. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
90 lines
3.4 KiB
Python
90 lines
3.4 KiB
Python
from django.db import models
|
||
from django_ckeditor_5.fields import CKEditor5Field
|
||
|
||
|
||
def expansion_from_gamebuild(gamebuild):
|
||
"""Etiqueta de expansión a partir del build del cliente.
|
||
|
||
Reconoce tanto los clientes retail antiguos (3.3.5a=12340, 4.3.4=15595) como
|
||
los de WoW Classic: WotLK Classic 3.4.x (~44832–51536) y Cataclysm Classic
|
||
4.4.x (~54332+). Nova WoW corre 3.4.3 (WotLK Classic), luego debe dar 'WotLK'.
|
||
"""
|
||
# WotLK Classic llega hasta 3.4.3 (build 54261); Cataclysm Classic empieza
|
||
# en 4.4.0 (build 54332) — están muy pegados, de ahí el corte en 54261.
|
||
if gamebuild is None:
|
||
return 'Unknown'
|
||
if gamebuild == 12340 or 44000 <= gamebuild <= 54261:
|
||
return 'WotLK'
|
||
if gamebuild == 15595 or 54262 <= gamebuild <= 60000:
|
||
return 'Cataclysm'
|
||
return 'Unknown'
|
||
|
||
|
||
class Noticia(models.Model):
|
||
titulo = models.CharField(max_length=200)
|
||
contenido = CKEditor5Field('Contenido', config_name='default')
|
||
fecha_publicacion = models.DateTimeField(auto_now=True) # Cambiado a DateTimeField
|
||
fecha_fin_evento = models.DateField(null=True, blank=True)
|
||
enlace = models.URLField(max_length=200, blank=True, null=True)
|
||
|
||
def __str__(self):
|
||
return self.titulo
|
||
|
||
class MaintenanceMode(models.Model):
|
||
is_active = models.BooleanField(default=False)
|
||
|
||
def __str__(self):
|
||
return "Maintenance Mode"
|
||
|
||
class ClienteCategoria(models.Model):
|
||
nombre = models.CharField(max_length=100)
|
||
descripcion = models.CharField(max_length=200, blank=True, null=True)
|
||
|
||
def __str__(self):
|
||
return self.nombre
|
||
|
||
class SistemaOperativo(models.Model):
|
||
categoria = models.ForeignKey(ClienteCategoria, related_name='sistemas_operativos', on_delete=models.CASCADE)
|
||
nombre = models.CharField(max_length=100)
|
||
url_descarga = models.URLField()
|
||
|
||
def __str__(self):
|
||
return f"{self.nombre} - {self.categoria.nombre}"
|
||
|
||
class ServerSelection(models.Model):
|
||
server_id = models.IntegerField()
|
||
name = models.CharField(max_length=100)
|
||
address = models.CharField(max_length=100)
|
||
port = models.IntegerField()
|
||
gamebuild = models.IntegerField()
|
||
|
||
@property
|
||
def expansion(self):
|
||
return expansion_from_gamebuild(self.gamebuild)
|
||
|
||
def __str__(self):
|
||
return f"{self.name} ({self.expansion})"
|
||
|
||
class DownloadClientPage(models.Model):
|
||
title = models.CharField(max_length=255, default="Descarga del cliente")
|
||
content = CKEditor5Field('Contenido', config_name='default')
|
||
mac_instructions = CKEditor5Field('Instrucciones para macOS', blank=True, null=True, config_name='default')
|
||
updated_at = models.DateTimeField(auto_now=True)
|
||
|
||
def __str__(self):
|
||
return self.title
|
||
|
||
class ContentCreator(models.Model):
|
||
title = models.CharField(max_length=200)
|
||
description = CKEditor5Field('Descripción', config_name='default')
|
||
content_type = models.CharField(max_length=60, default="Contenido general")
|
||
subtitle = models.CharField(max_length=60, default="Nova WoW")
|
||
youtube_video_url = models.URLField(max_length=300, blank=True, null=True)
|
||
avatar_image_url = models.URLField(max_length=300, blank=True, null=True)
|
||
youtube_channel_url = models.URLField(max_length=300, blank=True, null=True)
|
||
facebook_page_url = models.URLField(max_length=300, blank=True, null=True)
|
||
updated_at = models.DateTimeField(auto_now=True)
|
||
|
||
def __str__(self):
|
||
return self.title
|