diff --git a/docker-compose.yml b/docker-compose.yml
index 43f22f4..6576208 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,31 +1,31 @@
-version: "3.9"
-
-services:
- indianpong:
- image: aktas/indianpong:latest
- build:
- context: ./indianpong
- container_name: indianpong
- restart: always
- ports:
- - 8000:8000
-# depends_on:
-# - db
-# env_file:
-# - .env
-# networks:
-# - indianpongnet
-
-# db:
-# container_name: db
-# image: db
-# build:
-# context: ./
-# dockerfile: docker.dockerfile
-# restart: always
-# networks:
-# - indianpongnet
-#
-#networks:
-# indianpongnet:
-# driver: bridge
+version: "3.9"
+
+services:
+ indianpong:
+ image: aktas/indianpong:latest
+ build:
+ context: ./indianpong
+ container_name: indianpong
+ restart: always
+ ports:
+ - 8000:8000
+# depends_on:
+# - db
+# env_file:
+# - .env
+# networks:
+# - indianpongnet
+
+# db:
+# container_name: db
+# image: db
+# build:
+# context: ./
+# dockerfile: docker.dockerfile
+# restart: always
+# networks:
+# - indianpongnet
+#
+#networks:
+# indianpongnet:
+# driver: bridge
diff --git a/docker.dockerfile b/docker.dockerfile
index a0b2c05..946b66a 100644
--- a/docker.dockerfile
+++ b/docker.dockerfile
@@ -1,15 +1,15 @@
-FROM postgres:13
-
-# Veritabanı adını ve kullanıcı adını ayarla
-ENV POSTGRES_DB=pong
-ENV POSTGRES_USER=indianpong
-ENV POSTGRES_PASSWORD=indianpong123
-ENV POSTGRES_HOST_AUTH_METHOD=trust
-
-# Docker imajı oluşturulduğunda çalıştırılacak SQL dosyalarını kopyala
-
-# PostgreSQL'in varsayılan bağlantı noktası
-EXPOSE 5432
-
-RUN pg_createcluster 13 main --start
-RUN service postgresql start
+FROM postgres:13
+
+# Veritabanı adını ve kullanıcı adını ayarla
+ENV POSTGRES_DB=pong
+ENV POSTGRES_USER=indianpong
+ENV POSTGRES_PASSWORD=indianpong123
+ENV POSTGRES_HOST_AUTH_METHOD=trust
+
+# Docker imajı oluşturulduğunda çalıştırılacak SQL dosyalarını kopyala
+
+# PostgreSQL'in varsayılan bağlantı noktası
+EXPOSE 5432
+
+RUN pg_createcluster 13 main --start
+RUN service postgresql start
diff --git a/indianpong/pong/apps.py b/indianpong/pong/apps.py
index a46cb47..d00f297 100644
--- a/indianpong/pong/apps.py
+++ b/indianpong/pong/apps.py
@@ -1,21 +1,21 @@
-from django.apps import AppConfig
-from django.contrib.auth.signals import user_logged_in, user_logged_out
-from django.dispatch import receiver
-
-
-class PongConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'pong'
-
-""" def ready(self):
-
- @receiver(user_logged_in)
- def user_logged_in_handler(sender, request, **kwargs):
- request.user.is_online = True
- request.user.save()
-
- @receiver(user_logged_out)
- def user_logged_out_handler(sender, request, **kwargs):
- request.user.is_online = False
- request.user.save() """
-
+from django.apps import AppConfig
+from django.contrib.auth.signals import user_logged_in, user_logged_out
+from django.dispatch import receiver
+
+
+class PongConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'pong'
+
+""" def ready(self):
+
+ @receiver(user_logged_in)
+ def user_logged_in_handler(sender, request, **kwargs):
+ request.user.is_online = True
+ request.user.save()
+
+ @receiver(user_logged_out)
+ def user_logged_out_handler(sender, request, **kwargs):
+ request.user.is_online = False
+ request.user.save() """
+
diff --git a/indianpong/pong/consumer_chat.py b/indianpong/pong/consumer_chat.py
index 0ece607..6bcc49f 100644
--- a/indianpong/pong/consumer_chat.py
+++ b/indianpong/pong/consumer_chat.py
@@ -1,173 +1,173 @@
-import json
-from channels.generic.websocket import AsyncWebsocketConsumer
-
-class ChatConsumer(AsyncWebsocketConsumer):
- async def connect(self):
- self.room_name = self.scope["url_route"]["kwargs"]["room_name"]
- self.room_group_name = "chat_%s" % self.room_name
- self.user = self.scope["user"]
-
- # Join room group
- await self.channel_layer.group_add(self.room_group_name, self.channel_name)
-
- await self.accept()
-
- async def disconnect(self, close_code):
- # Leave room group
- await self.channel_layer.group_discard(self.room_group_name, self.channel_name)
- await self.close()
-
- # Receive message from WebSocket
- async def receive(self, text_data):
- from .models import UserProfile, Message, Game
- data = json.loads(text_data)
- action = data["action"]
- if action == "chat":
- message = data["message"]
- user = await UserProfile.objects.aget(username=self.user.username)
- m = await Message.objects.acreate(content=message, user=user, room_id=self.room_name) #room_id is the room name
- # Send message to room group
- await self.channel_layer.group_send(
- self.room_group_name,
- {
- "type": "chat.message",
- "message": message,
- "user": user.username,
- "created_date": m.get_short_date(), #? blocking?
- }
- )
-
- elif action == "invite.game":
- # Send invite message to room group which have accept button and decline button in it
- await self.channel_layer.group_send(
- self.room_group_name,
- {
- "type": "invite.game",
- "inviter": self.user.username,
- }
- )
-
- elif action == "accept.game":
- # if accept it create game object and send link in form: /remote-game/invite/game_id to both
- # send message to room group that user accepted the game make it in client side
- accepted = data["accepted"]
- group_name = f"{accepted}_{accepter}"
- accepted = await UserProfile.objects.aget(username=accepted)
- accepter = await UserProfile.objects.aget(username=self.user.username)
- # create game object
- game = await Game.objects.acreate(group_name=group_name, player1=accepted, player2=accepter)
- message = f"/remote-game/invite/{game.id}" #? Maybe do these in client side
- m = await Message.objects.acreate(content=message, user=accepted, room_id=self.room_name) #?
- await self.channel_layer.group_send(
- self.room_group_name,
- {
- "type": "accept.game",
- "message": message,
- "user": accepted.username,
- "created_date": m.get_short_date(), #? blocking?
- }
- )
-
- elif action == "decline.game":
- # if decline it send message to room group that user declined the game
- await self.channel_layer.group_send(
- self.room_group_name,
- {
- "type": "decline.game",
- "decliner": self.user.username,
- }
- )
-
- elif action == "block":
- blocked = data["blocked"]
- # add user to block list
- me = await UserProfile.objects.aget(username=self.user.username)
- blocked = await UserProfile.objects.aget(username=blocked)
- await me.blocked_users.aadd(blocked)
- await self.channel_layer.group_send(
- self.room_group_name,
- {
- "type": "blocked",
- "blocker": self.user.username,
- "blocked": blocked.username,
- }
- )
-
- elif action == "unblock":
- # remove user from block list
- blocked = data["unblocked"]
- # add user to block list
- me = await UserProfile.objects.aget(username=self.user.username)
- blocked = await UserProfile.objects.aget(username=blocked)
- await me.blocked_users.aremove(blocked)
- await self.channel_layer.group_send(
- self.room_group_name,
- {
- "type": "unblocked",
- "unblocker": self.user.username,
- "unblocked": blocked.username,
- }
- )
-
- # Receive message from room group
- async def chat_message(self, event):
- message = event["message"]
- user = event["user"]
- created_date = event["created_date"]
- # Send message to WebSocket
- await self.send(text_data=json.dumps({
- "type": "chat.message",
- "message": message,
- "user": user,
- "created_date": created_date,
- }))
-
- async def invite_game(self, event):
- inviter = event["inviter"]
- # Send message to WebSocket
- await self.send(text_data=json.dumps({
- "type": "invite.game",
- "inviter": inviter,
- }))
-
- async def accept_game(self, event):
- message = event["message"]
- user = event["user"]
- created_date = event["created_date"]
- # Send message to WebSocket
- await self.send(text_data=json.dumps({
- "type": "accept.game",
- "message": message,
- "user": user,
- "created_date": created_date,
- }))
-
- async def decline_game(self, event):
- decliner = event["decliner"]
- # Send message to WebSocket
- await self.send(text_data=json.dumps({
- "type": "decline.game",
- "decliner": decliner,
- }))
-
- async def blocked(self, event):
- # Handle the "blocked" message
- blocker = event["blocker"]
- blocked = event["blocked"]
-
- await self.send(text_data=json.dumps({
- "type": "blocked",
- "blocker": blocker,
- "blocked": blocked,
- }))
-
- async def unblocked(self, event):
- # Handle the "unblocked" message
- unblocker = event["unblocker"]
- unblocked = event["unblocked"]
-
- await self.send(text_data=json.dumps({
- "type": "unblocked",
- "unblocker": unblocker,
- "unblocked": unblocked,
- }))
+import json
+from channels.generic.websocket import AsyncWebsocketConsumer
+
+class ChatConsumer(AsyncWebsocketConsumer):
+ async def connect(self):
+ self.room_name = self.scope["url_route"]["kwargs"]["room_name"]
+ self.room_group_name = "chat_%s" % self.room_name
+ self.user = self.scope["user"]
+
+ # Join room group
+ await self.channel_layer.group_add(self.room_group_name, self.channel_name)
+
+ await self.accept()
+
+ async def disconnect(self, close_code):
+ # Leave room group
+ await self.channel_layer.group_discard(self.room_group_name, self.channel_name)
+ await self.close()
+
+ # Receive message from WebSocket
+ async def receive(self, text_data):
+ from .models import UserProfile, Message, Game
+ data = json.loads(text_data)
+ action = data["action"]
+ if action == "chat":
+ message = data["message"]
+ user = await UserProfile.objects.aget(username=self.user.username)
+ m = await Message.objects.acreate(content=message, user=user, room_id=self.room_name) #room_id is the room name
+ # Send message to room group
+ await self.channel_layer.group_send(
+ self.room_group_name,
+ {
+ "type": "chat.message",
+ "message": message,
+ "user": user.username,
+ "created_date": m.get_short_date(), #? blocking?
+ }
+ )
+
+ elif action == "invite.game":
+ # Send invite message to room group which have accept button and decline button in it
+ await self.channel_layer.group_send(
+ self.room_group_name,
+ {
+ "type": "invite.game",
+ "inviter": self.user.username,
+ }
+ )
+
+ elif action == "accept.game":
+ # if accept it create game object and send link in form: /remote-game/invite/game_id to both
+ # send message to room group that user accepted the game make it in client side
+ accepted = data["accepted"]
+ group_name = f"{accepted}_{accepter}"
+ accepted = await UserProfile.objects.aget(username=accepted)
+ accepter = await UserProfile.objects.aget(username=self.user.username)
+ # create game object
+ game = await Game.objects.acreate(group_name=group_name, player1=accepted, player2=accepter)
+ message = f"/remote-game/invite/{game.id}" #? Maybe do these in client side
+ m = await Message.objects.acreate(content=message, user=accepted, room_id=self.room_name) #?
+ await self.channel_layer.group_send(
+ self.room_group_name,
+ {
+ "type": "accept.game",
+ "message": message,
+ "user": accepted.username,
+ "created_date": m.get_short_date(), #? blocking?
+ }
+ )
+
+ elif action == "decline.game":
+ # if decline it send message to room group that user declined the game
+ await self.channel_layer.group_send(
+ self.room_group_name,
+ {
+ "type": "decline.game",
+ "decliner": self.user.username,
+ }
+ )
+
+ elif action == "block":
+ blocked = data["blocked"]
+ # add user to block list
+ me = await UserProfile.objects.aget(username=self.user.username)
+ blocked = await UserProfile.objects.aget(username=blocked)
+ await me.blocked_users.aadd(blocked)
+ await self.channel_layer.group_send(
+ self.room_group_name,
+ {
+ "type": "blocked",
+ "blocker": self.user.username,
+ "blocked": blocked.username,
+ }
+ )
+
+ elif action == "unblock":
+ # remove user from block list
+ blocked = data["unblocked"]
+ # add user to block list
+ me = await UserProfile.objects.aget(username=self.user.username)
+ blocked = await UserProfile.objects.aget(username=blocked)
+ await me.blocked_users.aremove(blocked)
+ await self.channel_layer.group_send(
+ self.room_group_name,
+ {
+ "type": "unblocked",
+ "unblocker": self.user.username,
+ "unblocked": blocked.username,
+ }
+ )
+
+ # Receive message from room group
+ async def chat_message(self, event):
+ message = event["message"]
+ user = event["user"]
+ created_date = event["created_date"]
+ # Send message to WebSocket
+ await self.send(text_data=json.dumps({
+ "type": "chat.message",
+ "message": message,
+ "user": user,
+ "created_date": created_date,
+ }))
+
+ async def invite_game(self, event):
+ inviter = event["inviter"]
+ # Send message to WebSocket
+ await self.send(text_data=json.dumps({
+ "type": "invite.game",
+ "inviter": inviter,
+ }))
+
+ async def accept_game(self, event):
+ message = event["message"]
+ user = event["user"]
+ created_date = event["created_date"]
+ # Send message to WebSocket
+ await self.send(text_data=json.dumps({
+ "type": "accept.game",
+ "message": message,
+ "user": user,
+ "created_date": created_date,
+ }))
+
+ async def decline_game(self, event):
+ decliner = event["decliner"]
+ # Send message to WebSocket
+ await self.send(text_data=json.dumps({
+ "type": "decline.game",
+ "decliner": decliner,
+ }))
+
+ async def blocked(self, event):
+ # Handle the "blocked" message
+ blocker = event["blocker"]
+ blocked = event["blocked"]
+
+ await self.send(text_data=json.dumps({
+ "type": "blocked",
+ "blocker": blocker,
+ "blocked": blocked,
+ }))
+
+ async def unblocked(self, event):
+ # Handle the "unblocked" message
+ unblocker = event["unblocker"]
+ unblocked = event["unblocked"]
+
+ await self.send(text_data=json.dumps({
+ "type": "unblocked",
+ "unblocker": unblocker,
+ "unblocked": unblocked,
+ }))
diff --git a/indianpong/pong/consumer_pong.py b/indianpong/pong/consumer_pong.py
index a0b4c31..a753ea9 100644
--- a/indianpong/pong/consumer_pong.py
+++ b/indianpong/pong/consumer_pong.py
@@ -1,654 +1,654 @@
-import asyncio
-import json
-from channels.generic.websocket import AsyncWebsocketConsumer
-from channels.db import database_sync_to_async
-from asgiref.sync import sync_to_async, async_to_sync
-from pong.utils import AsyncLockedDict
-from django.core.cache import cache
-from .utils import add_to_cache, remove_from_cache
-#from .models import Game, Tournament, UserProfile
-from pong.game import *
-import datetime
-
-USER_CHANNEL_NAME = AsyncLockedDict() # key: username, value: channel_name
-GAMES = AsyncLockedDict() # key: game_id, value: PongGame object
-USER_STATUS = AsyncLockedDict() # key: username, value: game_id or lobby
-
-
-class PongConsumer(AsyncWebsocketConsumer):
-
- async def connect(self):
-
- self.game_type = self.scope['url_route']['kwargs']['game_type'] # tournament or peer-to-peer or invite
- self.game_id = self.scope['url_route']['kwargs']['game_id'] # game_id or new
- self.user = self.scope['user']
-
- await self.accept()
-
- # Add the user to the 'lobby' group
- await self.channel_layer.group_add("lobby", self.channel_name)
-
- # Set the user's channel name
- await USER_CHANNEL_NAME.set(self.user.username, self.channel_name)
- # Add user username to lobby cache
- await USER_STATUS.set(self.user.username, "lobby")
- # Get the list of online users usernames
- lobby_users_usernames = await USER_STATUS.get_keys_with_value('lobby')
- lobby_users_usernames.remove(self.user.username)
- await self.send(text_data=json.dumps({
- 'type': 'inlobby',
- 'user': self.user.username,
- 'users': lobby_users_usernames,
- }))
- await self.channel_layer.group_send("lobby", {
- 'type': 'user.inlobby',
- 'user': self.user.username,
- })
- if self.game_type == 'tournament':
- await self.tournament_match_handler()
- elif self.game_type == 'invite':
- await self.from_chat_handler()
-
- async def disconnect(self, close_code):
- game_id = await USER_STATUS.get(self.user.username)
- if game_id != 'lobby':
- game = await GAMES.get(game_id)
- if game != None:
- other_player_channel_name = await USER_CHANNEL_NAME.get(game.otherPlayer(self.user.username))
- await self.record_for_disconnected(game_id, game)
- await self.exit_handler(game_id, game)
- await self.channel_layer.send(other_player_channel_name, {
- 'type': 'game.disconnect',
- 'game_id': game_id,
- 'disconnected': self.user.username,
- })
-
- # Remove the user from the 'lobby' group
- await self.channel_layer.group_discard("lobby", self.channel_name)
-
- # Remove the user's channel name
- await USER_CHANNEL_NAME.delete(self.user.username)
-
- # Remove user username from lobby cache
- await USER_STATUS.delete(self.user.username)
-
- # Set the user's status to offline
- await self.channel_layer.group_send("lobby", {
- 'type': 'user.outlobby',
- 'user': self.user.username,
- })
-
- # Close the websocket connection
- await self.close(close_code)
-
- async def receive(self, text_data):
- data = json.loads(text_data)
- action = data.get('action')
-
- if action == 'invite':
- matchmaking = data.get('matchmaking')
- invitee_username = data.get('invitee_username')
- if matchmaking == 'true':
- invitee_username = await self.matchmaking_handler()
- if invitee_username == None:
- await self.send(text_data=json.dumps({
- "error": "No suitable opponent found.",
- }))
- return
- if await self.check_is_user_inlobby(invitee_username):
- invitee_channel_name = await USER_CHANNEL_NAME.get(invitee_username)
- if invitee_channel_name:
- await self.channel_layer.send(invitee_channel_name, {
- 'type': 'game.invite',
- 'inviter': self.user.username,
- 'invitee': invitee_username,
- })
-
- elif action == 'accept':
- inviter_username = data.get('inviter_username')
- await self.accept_handler(inviter_username)
-
- elif action == 'decline':
- inviter_username = data.get('inviter_username')
- await self.decline_handler(inviter_username)
-
-
- elif action == 'start.request':
- opponent_username = data.get('opponent')
- game_id = data.get('game_id')
- vote = data.get('vote')
- await self.start_handler(game_id, opponent_username, vote)
-
- elif action == 'leave.game':
- game_id = data.get('game_id')
- left = data.get('left')
- opponent = data.get('opponent')
- await self.leave_handler(game_id, left, opponent)
-
- elif action == 'restart': #? not sure is needed or not
- invitee_username = data.get('invitee_username')
- invitee_channel_name = await USER_CHANNEL_NAME.get(invitee_username)
- if invitee_channel_name:
- await self.channel_layer.send(invitee_channel_name, {
- 'type': 'game.restart',
- 'inviter': self.user.username,
- })
- elif action == 'exit':
- game_id = data.get('game_id')
- game = await GAMES.get(game_id)
- if await self.check_is_users_ingame(game_id, game):
- await self.exit_handler(game_id, game)
-
- #TODO Maybe remove this
- elif action == 'pause.game':
- game_id = data.get('game_id')
- game = await GAMES.get(game_id)
- if (game != None):
- game.pauseGame()
- await self.channel_layer.group_send(
- game.group_name,
- {
- "type": "game.pause",
- "game_id": game_id,
- }
- )
-
- #TODO Maybe remove this
- elif action == 'resume.game':
- game_id = data.get('game_id')
- game = await GAMES.get(game_id)
- if (game != None):
- game.resumeGame()
- await self.channel_layer.group_send(
- game.group_name,
- {
- "type": "game.resume",
- "game_id": game_id,
- }
- )
-
- elif action == "ball": #? Needs validation
- # Make a move in a game and get the ball coordinates
- # we send a message to the clients with the ball coordinates
- game_id = data["game_id"]
- # Move and Get ball coordinates
- game = await GAMES.get(game_id) #? When games status is ended, game_id is deleted from GAMES cache
- if (game != None): #? So game becomes None. Is this check enough? or moving delete to end solve without this
- if (game.status == Status.PLAYING):
- x, y, player1_score, player2_score = game.moveBall()
- # Send a message to the game group with the game id, the move coordinates
- await self.channel_layer.group_send(
- game.group_name,
- {
- "type": "game.ball",
- "game_id": game_id,
- "x": x,
- "y": y,
- "player1_score": player1_score,
- "player2_score": player2_score,
- }
- )
- elif (game.status == Status.ENDED and not game.no_more):
- await self.end_handler(game_id, game)
- game.no_more = True
-
-
- elif action == "paddle": #? Needs validation
- # Make a move in a game
- game_id = data["game_id"]
- dir = data["direction"]
- # Move and Get paddle coordinate
- game = await GAMES.get(game_id) #? When games status is ended, game_id is deleted from GAMES cache
- if (game != None): #? So game becomes None. Is this check enough? or moving delete to end solve without this
- y = game.movePaddle(self.user.username, dir)
- # Send a message to the game group with the game id, the paddle coordinate, and the player's username
- await self.channel_layer.group_send(
- game.group_name,
- {
- "type": "game.paddle",
- "game_id": game_id,
- "y": y,
- "player": self.user.username,
- }
- )
- elif action == "ability":
- game_id = data["game_id"]
- ability = data["abilities"]
- game = await GAMES.get(game_id)
- if (game != None):
- if (game.status == Status.PLAYING):
- game.activateAbility(self.user.username, ability)
- await self.channel_layer.group_send(
- game.group_name,
- {
- "type": "game.ability",
- "game_id": game_id,
- "player": self.user.username,
- "ability": ability,
- }
- )
-
- ### HANDLERS ###
- async def tournament_match_handler(self):
- game_id, player1, player2, group_name, tournament_id = await self.match_details()
- if await self.check_is_user_inlobby(player1) and await self.check_is_user_inlobby(player2):
- player1_channel_name = await USER_CHANNEL_NAME.get(player1)
- player2_channel_name = await USER_CHANNEL_NAME.get(player2)
-
- await self.channel_layer.group_add(group_name, player1_channel_name)
- await self.channel_layer.group_add(group_name, player2_channel_name)
-
- await GAMES.set(game_id, PongGame(player1, player2, tournament_id))
-
- await self.channel_layer.group_send(group_name, {
- 'type': 'tournament.match',
- 'tournament_id': tournament_id,
- 'game_id': game_id,
- 'player1': player1,
- 'player2': player2,
- })
-
- async def from_chat_handler(self):
- game_id, player1, player2, group_name, tournament_id = await self.match_details()
- if await self.check_is_user_inlobby(player1) and await self.check_is_user_inlobby(player2):
- player1_channel_name = await USER_CHANNEL_NAME.get(player1)
- player2_channel_name = await USER_CHANNEL_NAME.get(player2)
-
- await self.channel_layer.group_add(group_name, player1_channel_name)
- await self.channel_layer.group_add(group_name, player2_channel_name)
-
- await GAMES.set(game_id, PongGame(player1, player2))
-
- await self.channel_layer.group_send(group_name, {
- 'type': 'chat.game',
- 'game_id': game_id,
- 'player1': player1,
- 'player2': player2,
- })
-
- async def accept_handler(self, inviter_username):
- inviter_channel_name = await USER_CHANNEL_NAME.get(inviter_username)
- group_name = f"{inviter_username}-{self.user.username}"
- await self.channel_layer.group_add(group_name, self.channel_name)
- await self.channel_layer.group_add(group_name, inviter_channel_name)
-
- # Create a new game instance and save it to the database
- game = await self.create_game(group_name, inviter_username, self.user.username)
- # Create a new game instance and save it to the cache
- await GAMES.set(game.id, PongGame(inviter_username, self.user.username))
-
- await self.channel_layer.group_send(group_name, {
- 'type': 'game.accept',
- 'accepter': self.user.username,
- 'accepted': inviter_username,
- 'game_id': game.id,
- })
-
- async def decline_handler(self, inviter_username):
- inviter_channel_name = await USER_CHANNEL_NAME.get(inviter_username)
- await self.channel_layer.send(inviter_channel_name, {
- 'type': 'game.decline',
- 'decliner': self.user.username,
- 'declined': inviter_username,
- })
-
- async def start_handler(self, game_id, opponent_username, vote):
- # Get the current game status and update it with the vote count
- game = await GAMES.get(game_id)
- current = game.status.value + int(vote)
- await GAMES.set_field_value(game_id, Status(current), "status")
-
- # Check both players voted to start the game
- if Status(current) == Status.PLAYING: # both players voted to start the game
- await USER_STATUS.set(self.user.username, game_id)
- await USER_STATUS.set(opponent_username, game_id)
- cache.set(f"playing_{self.user.username}", True)
- cache.set(f"playing_{opponent_username}", True)
-
- """ # Send message to lobby #? Maybe unnecesary bcs playing_username cache
- await self.channel_layer.group_send('lobby', {
- 'type': 'users.ingame',
- 'game_type': self.game_type,
- 'players': [self.user.username, opponent_username],
- }) """
- await self.channel_layer.group_send(game.group_name, {
- 'type': 'game.start',
- 'game_id': game_id,
- 'vote': current,
- })
-
- async def leave_handler(self, game_id, left, opponent):
- # Get scores
- game = await GAMES.get(game_id)
- left_score = game.getScore(left) # blocking?
- opponent_score = MAX_SCORE # set max score automaticaly
- duration = game.getDuration()
- # Record the game
- await self.record_stats_elo_wallet(game_id, opponent_score, left_score, opponent, left, duration)
- await USER_STATUS.set(game.player1.username, 'lobby') #?
- await USER_STATUS.set(game.player2.username, 'lobby') #?
-
- await self.channel_layer.group_send(
- game.group_name,
- {
- "type": "game.leave",
- "game_id": game_id,
- "left": self.user.username,
- "left_score": left_score,
- "opponent_score": opponent_score,
- "winner": opponent,
- "loser": left,
- }
- )
- #await self.exit_handler(game_id, game, opponent) #! Invalid channel name error
-
- async def exit_handler(self, game_id, game):
- # Discard both from the game group
- opponent = game.otherPlayer(self.user.username)
- opponent_channel_name = await USER_CHANNEL_NAME.get(opponent)
- await self.channel_layer.group_discard(game.group_name, self.channel_name)
- await self.channel_layer.group_discard(game.group_name, opponent_channel_name)
- cache.set(f"playing_{self.user.username}", False)
- cache.set(f"playing_{opponent}", False)
- # delete the game from the cache
- await GAMES.delete(game_id)
-
- async def end_handler(self, game_id, game):
- # Get scores
- player1_score = game.player1.score
- player2_score = game.player2.score
- duration = game.getDuration()
- winner, loser, winner_score, loser_score = game.getWinnerLoserandScores()
- # Set the game winner, scores and save it to the database
- await self.record_stats_elo_wallet(game_id, winner_score, loser_score, winner, loser, duration)
- await USER_STATUS.set(game.player1.username, 'lobby') #?
- await USER_STATUS.set(game.player2.username, 'lobby') #?
-
- #? Maybe unnecesary
- await self.channel_layer.group_send(
- game.group_name,
- {
- "type": "game.end",
- "game_id": game_id,
- "player1_score": player1_score,
- "player2_score": player2_score,
- "winner": winner,
- "loser": loser,
- }
- )
-
-
- ## SENDERS ##
- async def user_inlobby(self, event):
- user = event['user']
- await self.send(text_data=json.dumps({
- 'type': 'user.inlobby',
- 'user': user,
- }))
-
- async def user_outlobby(self, event):
- user = event['user']
- await self.send(text_data=json.dumps({
- 'type': 'user.outlobby',
- 'user': user,
- }))
-
- async def game_disconnect(self, event):
- game_id = event['game_id']
- disconnected = event['disconnected']
- await self.send(text_data=json.dumps({
- 'type': 'game.disconnect',
- 'game_id': game_id,
- 'disconnected': disconnected,
- }))
-
- async def game_invite(self, event):
- inviter = event['inviter']
- invitee = event['invitee']
- await self.send(text_data=json.dumps({
- 'type': 'game.invite',
- 'inviter': inviter,
- 'invitee': invitee,
- }))
-
- async def tournament_match(self, event):
- tournament_id = event['tournament_id']
- game_id = event['game_id']
- player1 = event['player1']
- player2 = event['player2']
- await self.send(text_data=json.dumps({
- 'type': 'tournament.match',
- 'tournament_id': tournament_id,
- 'game_id': game_id,
- 'player1': player1,
- 'player2': player2,
- }))
-
- async def chat_game(self, event):
- game_id = event['game_id']
- player1 = event['player1']
- player2 = event['player2']
- await self.send(text_data=json.dumps({
- 'type': 'tournament.match',
- 'game_id': game_id,
- 'player1': player1,
- 'player2': player2,
- }))
-
- async def game_accept(self, event):
- accepter = event['accepter']
- accepted = event['accepted']
- game_id = event['game_id']
- await self.send(text_data=json.dumps({
- 'type': 'game.accept',
- 'accepter': accepter,
- 'accepted': accepted,
- 'game_id': game_id,
- }))
-
- async def game_decline(self, event):
- decliner = event['decliner']
- declined = event['declined']
- await self.send(text_data=json.dumps({
- 'type': 'game.decline',
- 'decliner': decliner,
- 'declined': declined,
- }))
-
- async def game_start(self, event):
- game_id = event['game_id']
- vote = event['vote']
- await self.send(text_data=json.dumps({
- 'type': 'game.start',
- 'game_id': game_id,
- 'vote': vote,
- }))
-
- #? Maybe unnecesary
- async def users_ingame(self, event):
- game_type = event['game_type']
- players = event['players']
- await self.send(text_data=json.dumps({
- 'type': 'users.ingame',
- 'game_type': game_type,
- 'players': players,
- }))
-
- async def game_leave(self, event):
- game_id = event['game_id']
- left = event['left']
- left_score = event['left_score']
- opponent_score = event['opponent_score']
- winner = event['winner']
- loser = event['loser']
- await self.send(text_data=json.dumps({
- 'type': 'game.leave',
- 'game_id': game_id,
- 'left': left,
- 'left_score': left_score,
- 'opponent_score': opponent_score,
- 'winner': winner,
- 'loser': loser,
- }))
-
- async def game_end(self, event):
- game_id = event['game_id']
- player1_score = event['player1_score']
- player2_score = event['player2_score']
- winner = event['winner']
- loser = event['loser']
-
- await self.send(text_data=json.dumps({
- 'type': 'game.end',
- 'game_id': game_id,
- 'player1_score': player1_score,
- 'player2_score': player2_score,
- 'winner': winner,
- 'loser': loser,
- }))
-
- async def game_restart(self, event):
- inviter = event['inviter']
- await self.send(text_data=json.dumps({
- 'type': 'game.restart',
- 'inviter': inviter,
- }))
-
- async def game_pause(self, event):
- game_id = event['game_id']
- await self.send(text_data=json.dumps({
- 'type': 'game.pause',
- 'game_id': game_id,
- }))
-
- async def game_resume(self, event):
- game_id = event['game_id']
- await self.send(text_data=json.dumps({
- 'type': 'game.resume',
- 'game_id': game_id,
- }))
-
- async def game_ball(self, event):
- game_id = event['game_id']
- x = event['x']
- y = event['y']
- player1_score = event['player1_score']
- player2_score = event['player2_score']
- await self.send(text_data=json.dumps({
- 'type': 'game.ball',
- 'game_id': game_id,
- 'x': x,
- 'y': y,
- 'player1_score': player1_score,
- 'player2_score': player2_score,
- }))
-
- async def game_paddle(self, event):
- game_id = event['game_id']
- y = event['y']
- player = event['player']
- await self.send(text_data=json.dumps({
- 'type': 'game.paddle',
- 'game_id': game_id,
- 'y': y,
- 'player': player,
- }))
-
- async def game_ability(self, event):
- game_id = event['game_id']
- player = event['player']
- ability = event['ability']
- await self.send(text_data=json.dumps({
- 'type': 'game.ability',
- 'game_id': game_id,
- 'player': player,
- 'ability': ability,
- }))
-
- # Helper methods to interact with the database #
- async def create_game(self, group_name, player1, player2):
- from .models import Game, UserProfile
- # Create a new game instance with the given players and an group_name
- accepted = await UserProfile.objects.aget(username=player1)
- accepter = await UserProfile.objects.aget(username=player2)
- game = await Game.objects.acreate(group_name=group_name, player1=accepted, player2=accepter)
- return game
-
-
- @database_sync_to_async
- def match_details(self):
- from .models import Game
- game = Game.objects.get(id=self.game_id)
- game_id = game.id
- player1 = game.player1.username
- player2 = game.player2.username
- group_name = game.group_name
- tournament_id = game.tournament_id
- return game_id, player1, player2, group_name, tournament_id
-
- @database_sync_to_async
- def record_stats_elo_wallet(self, game_id, winner_score, loser_score, winner, loser, game_duration):
- from .models import Game, UserProfile
- from .update import update_wallet_elo, update_stats_pong, update_tournament
-
- game = Game.objects.get(id=game_id)
- game.winner_score = winner_score
- game.loser_score = loser_score
- game.winner =UserProfile.objects.get(username=winner)
- game.loser = UserProfile.objects.get(username=loser)
- game.game_duration = datetime.timedelta(seconds=game_duration)
- game.save()
-
- update_wallet_elo(game.winner, game.loser)
- update_stats_pong(game.winner, game.loser, winner_score, loser_score, game_duration, "remote")
-
- # İf the game is a tournament game
- if game.tournament_id: #? Check
- update_tournament(game)
-
-
- async def record_for_disconnected(self, game_id, game):
- duration = game.getDuration()
- if game.player1.username == self.user.username:
- await self.record_stats_elo_wallet(game_id, game.player1.score, MAX_SCORE, game.player2.username, game.player1.username, duration)
- else:
- await self.record_stats_elo_wallet(game_id, MAX_SCORE, game.player2.score, game.player1.username, game.player2.username, duration)
-
- async def check_is_user_inlobby(self, username):
- answer = await USER_STATUS.get(username) == 'lobby'
- if not answer:
- await self.send(text_data=json.dumps({
- "error": "User is not in the lobby.",
- }))
- return answer
-
- async def check_is_users_ingame(self, game_id, game):
- answer = await USER_STATUS.get(game.player1.username) == game_id and await USER_STATUS.get(game.player2.username) == game_id
- return answer
-
- async def matchmaking_handler(self):
- from .models import UserProfile
- # Get the current user's elo_point
- current_user = await UserProfile.objects.aget(username=self.user.username)
- current_user_elo = current_user.elo_point
- # Get a list of online users
- lobby_users_usernames = await USER_STATUS.get_keys_with_value('lobby')
- lobby_users_usernames.remove(self.user.username) #TODO if user not in lobby
-
- return await self.get_similar_users(lobby_users_usernames, current_user_elo)
-
-
-
- @database_sync_to_async
- def get_similar_users(self, lobby_users_usernames, current_user_elo):
- from .models import UserProfile
- users = UserProfile.objects.filter(username__in=lobby_users_usernames, elo_point__gte=current_user_elo-100, elo_point__lte=current_user_elo+100).all()
- similar_users = [user.username for user in users]
- if similar_users:
- invitee_username = random.choice(similar_users)
- else:
- invitee_username = random.choice(lobby_users_usernames) if lobby_users_usernames else None
-
- return invitee_username
-
-
+import asyncio
+import json
+from channels.generic.websocket import AsyncWebsocketConsumer
+from channels.db import database_sync_to_async
+from asgiref.sync import sync_to_async, async_to_sync
+from pong.utils import AsyncLockedDict
+from django.core.cache import cache
+from .utils import add_to_cache, remove_from_cache
+#from .models import Game, Tournament, UserProfile
+from pong.game import *
+import datetime
+
+USER_CHANNEL_NAME = AsyncLockedDict() # key: username, value: channel_name
+GAMES = AsyncLockedDict() # key: game_id, value: PongGame object
+USER_STATUS = AsyncLockedDict() # key: username, value: game_id or lobby
+
+
+class PongConsumer(AsyncWebsocketConsumer):
+
+ async def connect(self):
+
+ self.game_type = self.scope['url_route']['kwargs']['game_type'] # tournament or peer-to-peer or invite
+ self.game_id = self.scope['url_route']['kwargs']['game_id'] # game_id or new
+ self.user = self.scope['user']
+
+ await self.accept()
+
+ # Add the user to the 'lobby' group
+ await self.channel_layer.group_add("lobby", self.channel_name)
+
+ # Set the user's channel name
+ await USER_CHANNEL_NAME.set(self.user.username, self.channel_name)
+ # Add user username to lobby cache
+ await USER_STATUS.set(self.user.username, "lobby")
+ # Get the list of online users usernames
+ lobby_users_usernames = await USER_STATUS.get_keys_with_value('lobby')
+ lobby_users_usernames.remove(self.user.username)
+ await self.send(text_data=json.dumps({
+ 'type': 'inlobby',
+ 'user': self.user.username,
+ 'users': lobby_users_usernames,
+ }))
+ await self.channel_layer.group_send("lobby", {
+ 'type': 'user.inlobby',
+ 'user': self.user.username,
+ })
+ if self.game_type == 'tournament':
+ await self.tournament_match_handler()
+ elif self.game_type == 'invite':
+ await self.from_chat_handler()
+
+ async def disconnect(self, close_code):
+ game_id = await USER_STATUS.get(self.user.username)
+ if game_id != 'lobby':
+ game = await GAMES.get(game_id)
+ if game != None:
+ other_player_channel_name = await USER_CHANNEL_NAME.get(game.otherPlayer(self.user.username))
+ await self.record_for_disconnected(game_id, game)
+ await self.exit_handler(game_id, game)
+ await self.channel_layer.send(other_player_channel_name, {
+ 'type': 'game.disconnect',
+ 'game_id': game_id,
+ 'disconnected': self.user.username,
+ })
+
+ # Remove the user from the 'lobby' group
+ await self.channel_layer.group_discard("lobby", self.channel_name)
+
+ # Remove the user's channel name
+ await USER_CHANNEL_NAME.delete(self.user.username)
+
+ # Remove user username from lobby cache
+ await USER_STATUS.delete(self.user.username)
+
+ # Set the user's status to offline
+ await self.channel_layer.group_send("lobby", {
+ 'type': 'user.outlobby',
+ 'user': self.user.username,
+ })
+
+ # Close the websocket connection
+ await self.close(close_code)
+
+ async def receive(self, text_data):
+ data = json.loads(text_data)
+ action = data.get('action')
+
+ if action == 'invite':
+ matchmaking = data.get('matchmaking')
+ invitee_username = data.get('invitee_username')
+ if matchmaking == 'true':
+ invitee_username = await self.matchmaking_handler()
+ if invitee_username == None:
+ await self.send(text_data=json.dumps({
+ "error": "No suitable opponent found.",
+ }))
+ return
+ if await self.check_is_user_inlobby(invitee_username):
+ invitee_channel_name = await USER_CHANNEL_NAME.get(invitee_username)
+ if invitee_channel_name:
+ await self.channel_layer.send(invitee_channel_name, {
+ 'type': 'game.invite',
+ 'inviter': self.user.username,
+ 'invitee': invitee_username,
+ })
+
+ elif action == 'accept':
+ inviter_username = data.get('inviter_username')
+ await self.accept_handler(inviter_username)
+
+ elif action == 'decline':
+ inviter_username = data.get('inviter_username')
+ await self.decline_handler(inviter_username)
+
+
+ elif action == 'start.request':
+ opponent_username = data.get('opponent')
+ game_id = data.get('game_id')
+ vote = data.get('vote')
+ await self.start_handler(game_id, opponent_username, vote)
+
+ elif action == 'leave.game':
+ game_id = data.get('game_id')
+ left = data.get('left')
+ opponent = data.get('opponent')
+ await self.leave_handler(game_id, left, opponent)
+
+ elif action == 'restart': #? not sure is needed or not
+ invitee_username = data.get('invitee_username')
+ invitee_channel_name = await USER_CHANNEL_NAME.get(invitee_username)
+ if invitee_channel_name:
+ await self.channel_layer.send(invitee_channel_name, {
+ 'type': 'game.restart',
+ 'inviter': self.user.username,
+ })
+ elif action == 'exit':
+ game_id = data.get('game_id')
+ game = await GAMES.get(game_id)
+ if await self.check_is_users_ingame(game_id, game):
+ await self.exit_handler(game_id, game)
+
+ #TODO Maybe remove this
+ elif action == 'pause.game':
+ game_id = data.get('game_id')
+ game = await GAMES.get(game_id)
+ if (game != None):
+ game.pauseGame()
+ await self.channel_layer.group_send(
+ game.group_name,
+ {
+ "type": "game.pause",
+ "game_id": game_id,
+ }
+ )
+
+ #TODO Maybe remove this
+ elif action == 'resume.game':
+ game_id = data.get('game_id')
+ game = await GAMES.get(game_id)
+ if (game != None):
+ game.resumeGame()
+ await self.channel_layer.group_send(
+ game.group_name,
+ {
+ "type": "game.resume",
+ "game_id": game_id,
+ }
+ )
+
+ elif action == "ball": #? Needs validation
+ # Make a move in a game and get the ball coordinates
+ # we send a message to the clients with the ball coordinates
+ game_id = data["game_id"]
+ # Move and Get ball coordinates
+ game = await GAMES.get(game_id) #? When games status is ended, game_id is deleted from GAMES cache
+ if (game != None): #? So game becomes None. Is this check enough? or moving delete to end solve without this
+ if (game.status == Status.PLAYING):
+ x, y, player1_score, player2_score = game.moveBall()
+ # Send a message to the game group with the game id, the move coordinates
+ await self.channel_layer.group_send(
+ game.group_name,
+ {
+ "type": "game.ball",
+ "game_id": game_id,
+ "x": x,
+ "y": y,
+ "player1_score": player1_score,
+ "player2_score": player2_score,
+ }
+ )
+ elif (game.status == Status.ENDED and not game.no_more):
+ await self.end_handler(game_id, game)
+ game.no_more = True
+
+
+ elif action == "paddle": #? Needs validation
+ # Make a move in a game
+ game_id = data["game_id"]
+ dir = data["direction"]
+ # Move and Get paddle coordinate
+ game = await GAMES.get(game_id) #? When games status is ended, game_id is deleted from GAMES cache
+ if (game != None): #? So game becomes None. Is this check enough? or moving delete to end solve without this
+ y = game.movePaddle(self.user.username, dir)
+ # Send a message to the game group with the game id, the paddle coordinate, and the player's username
+ await self.channel_layer.group_send(
+ game.group_name,
+ {
+ "type": "game.paddle",
+ "game_id": game_id,
+ "y": y,
+ "player": self.user.username,
+ }
+ )
+ elif action == "ability":
+ game_id = data["game_id"]
+ ability = data["abilities"]
+ game = await GAMES.get(game_id)
+ if (game != None):
+ if (game.status == Status.PLAYING):
+ game.activateAbility(self.user.username, ability)
+ await self.channel_layer.group_send(
+ game.group_name,
+ {
+ "type": "game.ability",
+ "game_id": game_id,
+ "player": self.user.username,
+ "ability": ability,
+ }
+ )
+
+ ### HANDLERS ###
+ async def tournament_match_handler(self):
+ game_id, player1, player2, group_name, tournament_id = await self.match_details()
+ if await self.check_is_user_inlobby(player1) and await self.check_is_user_inlobby(player2):
+ player1_channel_name = await USER_CHANNEL_NAME.get(player1)
+ player2_channel_name = await USER_CHANNEL_NAME.get(player2)
+
+ await self.channel_layer.group_add(group_name, player1_channel_name)
+ await self.channel_layer.group_add(group_name, player2_channel_name)
+
+ await GAMES.set(game_id, PongGame(player1, player2, tournament_id))
+
+ await self.channel_layer.group_send(group_name, {
+ 'type': 'tournament.match',
+ 'tournament_id': tournament_id,
+ 'game_id': game_id,
+ 'player1': player1,
+ 'player2': player2,
+ })
+
+ async def from_chat_handler(self):
+ game_id, player1, player2, group_name, tournament_id = await self.match_details()
+ if await self.check_is_user_inlobby(player1) and await self.check_is_user_inlobby(player2):
+ player1_channel_name = await USER_CHANNEL_NAME.get(player1)
+ player2_channel_name = await USER_CHANNEL_NAME.get(player2)
+
+ await self.channel_layer.group_add(group_name, player1_channel_name)
+ await self.channel_layer.group_add(group_name, player2_channel_name)
+
+ await GAMES.set(game_id, PongGame(player1, player2))
+
+ await self.channel_layer.group_send(group_name, {
+ 'type': 'chat.game',
+ 'game_id': game_id,
+ 'player1': player1,
+ 'player2': player2,
+ })
+
+ async def accept_handler(self, inviter_username):
+ inviter_channel_name = await USER_CHANNEL_NAME.get(inviter_username)
+ group_name = f"{inviter_username}-{self.user.username}"
+ await self.channel_layer.group_add(group_name, self.channel_name)
+ await self.channel_layer.group_add(group_name, inviter_channel_name)
+
+ # Create a new game instance and save it to the database
+ game = await self.create_game(group_name, inviter_username, self.user.username)
+ # Create a new game instance and save it to the cache
+ await GAMES.set(game.id, PongGame(inviter_username, self.user.username))
+
+ await self.channel_layer.group_send(group_name, {
+ 'type': 'game.accept',
+ 'accepter': self.user.username,
+ 'accepted': inviter_username,
+ 'game_id': game.id,
+ })
+
+ async def decline_handler(self, inviter_username):
+ inviter_channel_name = await USER_CHANNEL_NAME.get(inviter_username)
+ await self.channel_layer.send(inviter_channel_name, {
+ 'type': 'game.decline',
+ 'decliner': self.user.username,
+ 'declined': inviter_username,
+ })
+
+ async def start_handler(self, game_id, opponent_username, vote):
+ # Get the current game status and update it with the vote count
+ game = await GAMES.get(game_id)
+ current = game.status.value + int(vote)
+ await GAMES.set_field_value(game_id, Status(current), "status")
+
+ # Check both players voted to start the game
+ if Status(current) == Status.PLAYING: # both players voted to start the game
+ await USER_STATUS.set(self.user.username, game_id)
+ await USER_STATUS.set(opponent_username, game_id)
+ cache.set(f"playing_{self.user.username}", True)
+ cache.set(f"playing_{opponent_username}", True)
+
+ """ # Send message to lobby #? Maybe unnecesary bcs playing_username cache
+ await self.channel_layer.group_send('lobby', {
+ 'type': 'users.ingame',
+ 'game_type': self.game_type,
+ 'players': [self.user.username, opponent_username],
+ }) """
+ await self.channel_layer.group_send(game.group_name, {
+ 'type': 'game.start',
+ 'game_id': game_id,
+ 'vote': current,
+ })
+
+ async def leave_handler(self, game_id, left, opponent):
+ # Get scores
+ game = await GAMES.get(game_id)
+ left_score = game.getScore(left) # blocking?
+ opponent_score = MAX_SCORE # set max score automaticaly
+ duration = game.getDuration()
+ # Record the game
+ await self.record_stats_elo_wallet(game_id, opponent_score, left_score, opponent, left, duration)
+ await USER_STATUS.set(game.player1.username, 'lobby') #?
+ await USER_STATUS.set(game.player2.username, 'lobby') #?
+
+ await self.channel_layer.group_send(
+ game.group_name,
+ {
+ "type": "game.leave",
+ "game_id": game_id,
+ "left": self.user.username,
+ "left_score": left_score,
+ "opponent_score": opponent_score,
+ "winner": opponent,
+ "loser": left,
+ }
+ )
+ #await self.exit_handler(game_id, game, opponent) #! Invalid channel name error
+
+ async def exit_handler(self, game_id, game):
+ # Discard both from the game group
+ opponent = game.otherPlayer(self.user.username)
+ opponent_channel_name = await USER_CHANNEL_NAME.get(opponent)
+ await self.channel_layer.group_discard(game.group_name, self.channel_name)
+ await self.channel_layer.group_discard(game.group_name, opponent_channel_name)
+ cache.set(f"playing_{self.user.username}", False)
+ cache.set(f"playing_{opponent}", False)
+ # delete the game from the cache
+ await GAMES.delete(game_id)
+
+ async def end_handler(self, game_id, game):
+ # Get scores
+ player1_score = game.player1.score
+ player2_score = game.player2.score
+ duration = game.getDuration()
+ winner, loser, winner_score, loser_score = game.getWinnerLoserandScores()
+ # Set the game winner, scores and save it to the database
+ await self.record_stats_elo_wallet(game_id, winner_score, loser_score, winner, loser, duration)
+ await USER_STATUS.set(game.player1.username, 'lobby') #?
+ await USER_STATUS.set(game.player2.username, 'lobby') #?
+
+ #? Maybe unnecesary
+ await self.channel_layer.group_send(
+ game.group_name,
+ {
+ "type": "game.end",
+ "game_id": game_id,
+ "player1_score": player1_score,
+ "player2_score": player2_score,
+ "winner": winner,
+ "loser": loser,
+ }
+ )
+
+
+ ## SENDERS ##
+ async def user_inlobby(self, event):
+ user = event['user']
+ await self.send(text_data=json.dumps({
+ 'type': 'user.inlobby',
+ 'user': user,
+ }))
+
+ async def user_outlobby(self, event):
+ user = event['user']
+ await self.send(text_data=json.dumps({
+ 'type': 'user.outlobby',
+ 'user': user,
+ }))
+
+ async def game_disconnect(self, event):
+ game_id = event['game_id']
+ disconnected = event['disconnected']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.disconnect',
+ 'game_id': game_id,
+ 'disconnected': disconnected,
+ }))
+
+ async def game_invite(self, event):
+ inviter = event['inviter']
+ invitee = event['invitee']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.invite',
+ 'inviter': inviter,
+ 'invitee': invitee,
+ }))
+
+ async def tournament_match(self, event):
+ tournament_id = event['tournament_id']
+ game_id = event['game_id']
+ player1 = event['player1']
+ player2 = event['player2']
+ await self.send(text_data=json.dumps({
+ 'type': 'tournament.match',
+ 'tournament_id': tournament_id,
+ 'game_id': game_id,
+ 'player1': player1,
+ 'player2': player2,
+ }))
+
+ async def chat_game(self, event):
+ game_id = event['game_id']
+ player1 = event['player1']
+ player2 = event['player2']
+ await self.send(text_data=json.dumps({
+ 'type': 'tournament.match',
+ 'game_id': game_id,
+ 'player1': player1,
+ 'player2': player2,
+ }))
+
+ async def game_accept(self, event):
+ accepter = event['accepter']
+ accepted = event['accepted']
+ game_id = event['game_id']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.accept',
+ 'accepter': accepter,
+ 'accepted': accepted,
+ 'game_id': game_id,
+ }))
+
+ async def game_decline(self, event):
+ decliner = event['decliner']
+ declined = event['declined']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.decline',
+ 'decliner': decliner,
+ 'declined': declined,
+ }))
+
+ async def game_start(self, event):
+ game_id = event['game_id']
+ vote = event['vote']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.start',
+ 'game_id': game_id,
+ 'vote': vote,
+ }))
+
+ #? Maybe unnecesary
+ async def users_ingame(self, event):
+ game_type = event['game_type']
+ players = event['players']
+ await self.send(text_data=json.dumps({
+ 'type': 'users.ingame',
+ 'game_type': game_type,
+ 'players': players,
+ }))
+
+ async def game_leave(self, event):
+ game_id = event['game_id']
+ left = event['left']
+ left_score = event['left_score']
+ opponent_score = event['opponent_score']
+ winner = event['winner']
+ loser = event['loser']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.leave',
+ 'game_id': game_id,
+ 'left': left,
+ 'left_score': left_score,
+ 'opponent_score': opponent_score,
+ 'winner': winner,
+ 'loser': loser,
+ }))
+
+ async def game_end(self, event):
+ game_id = event['game_id']
+ player1_score = event['player1_score']
+ player2_score = event['player2_score']
+ winner = event['winner']
+ loser = event['loser']
+
+ await self.send(text_data=json.dumps({
+ 'type': 'game.end',
+ 'game_id': game_id,
+ 'player1_score': player1_score,
+ 'player2_score': player2_score,
+ 'winner': winner,
+ 'loser': loser,
+ }))
+
+ async def game_restart(self, event):
+ inviter = event['inviter']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.restart',
+ 'inviter': inviter,
+ }))
+
+ async def game_pause(self, event):
+ game_id = event['game_id']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.pause',
+ 'game_id': game_id,
+ }))
+
+ async def game_resume(self, event):
+ game_id = event['game_id']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.resume',
+ 'game_id': game_id,
+ }))
+
+ async def game_ball(self, event):
+ game_id = event['game_id']
+ x = event['x']
+ y = event['y']
+ player1_score = event['player1_score']
+ player2_score = event['player2_score']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.ball',
+ 'game_id': game_id,
+ 'x': x,
+ 'y': y,
+ 'player1_score': player1_score,
+ 'player2_score': player2_score,
+ }))
+
+ async def game_paddle(self, event):
+ game_id = event['game_id']
+ y = event['y']
+ player = event['player']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.paddle',
+ 'game_id': game_id,
+ 'y': y,
+ 'player': player,
+ }))
+
+ async def game_ability(self, event):
+ game_id = event['game_id']
+ player = event['player']
+ ability = event['ability']
+ await self.send(text_data=json.dumps({
+ 'type': 'game.ability',
+ 'game_id': game_id,
+ 'player': player,
+ 'ability': ability,
+ }))
+
+ # Helper methods to interact with the database #
+ async def create_game(self, group_name, player1, player2):
+ from .models import Game, UserProfile
+ # Create a new game instance with the given players and an group_name
+ accepted = await UserProfile.objects.aget(username=player1)
+ accepter = await UserProfile.objects.aget(username=player2)
+ game = await Game.objects.acreate(group_name=group_name, player1=accepted, player2=accepter)
+ return game
+
+
+ @database_sync_to_async
+ def match_details(self):
+ from .models import Game
+ game = Game.objects.get(id=self.game_id)
+ game_id = game.id
+ player1 = game.player1.username
+ player2 = game.player2.username
+ group_name = game.group_name
+ tournament_id = game.tournament_id
+ return game_id, player1, player2, group_name, tournament_id
+
+ @database_sync_to_async
+ def record_stats_elo_wallet(self, game_id, winner_score, loser_score, winner, loser, game_duration):
+ from .models import Game, UserProfile
+ from .update import update_wallet_elo, update_stats_pong, update_tournament
+
+ game = Game.objects.get(id=game_id)
+ game.winner_score = winner_score
+ game.loser_score = loser_score
+ game.winner =UserProfile.objects.get(username=winner)
+ game.loser = UserProfile.objects.get(username=loser)
+ game.game_duration = datetime.timedelta(seconds=game_duration)
+ game.save()
+
+ update_wallet_elo(game.winner, game.loser)
+ update_stats_pong(game.winner, game.loser, winner_score, loser_score, game_duration, "remote")
+
+ # İf the game is a tournament game
+ if game.tournament_id: #? Check
+ update_tournament(game)
+
+
+ async def record_for_disconnected(self, game_id, game):
+ duration = game.getDuration()
+ if game.player1.username == self.user.username:
+ await self.record_stats_elo_wallet(game_id, game.player1.score, MAX_SCORE, game.player2.username, game.player1.username, duration)
+ else:
+ await self.record_stats_elo_wallet(game_id, MAX_SCORE, game.player2.score, game.player1.username, game.player2.username, duration)
+
+ async def check_is_user_inlobby(self, username):
+ answer = await USER_STATUS.get(username) == 'lobby'
+ if not answer:
+ await self.send(text_data=json.dumps({
+ "error": "User is not in the lobby.",
+ }))
+ return answer
+
+ async def check_is_users_ingame(self, game_id, game):
+ answer = await USER_STATUS.get(game.player1.username) == game_id and await USER_STATUS.get(game.player2.username) == game_id
+ return answer
+
+ async def matchmaking_handler(self):
+ from .models import UserProfile
+ # Get the current user's elo_point
+ current_user = await UserProfile.objects.aget(username=self.user.username)
+ current_user_elo = current_user.elo_point
+ # Get a list of online users
+ lobby_users_usernames = await USER_STATUS.get_keys_with_value('lobby')
+ lobby_users_usernames.remove(self.user.username) #TODO if user not in lobby
+
+ return await self.get_similar_users(lobby_users_usernames, current_user_elo)
+
+
+
+ @database_sync_to_async
+ def get_similar_users(self, lobby_users_usernames, current_user_elo):
+ from .models import UserProfile
+ users = UserProfile.objects.filter(username__in=lobby_users_usernames, elo_point__gte=current_user_elo-100, elo_point__lte=current_user_elo+100).all()
+ similar_users = [user.username for user in users]
+ if similar_users:
+ invitee_username = random.choice(similar_users)
+ else:
+ invitee_username = random.choice(lobby_users_usernames) if lobby_users_usernames else None
+
+ return invitee_username
+
+
diff --git a/indianpong/pong/consumer_rps.py b/indianpong/pong/consumer_rps.py
index 62c7ab3..c82f82b 100644
--- a/indianpong/pong/consumer_rps.py
+++ b/indianpong/pong/consumer_rps.py
@@ -1,259 +1,259 @@
-import datetime
-import json
-import random
-from channels.db import database_sync_to_async
-from django.core.cache import cache
-from channels.generic.websocket import AsyncWebsocketConsumer
-from .utils import AsyncLockedDict
-from .rps import *
-
-RPS_USER_CHANNEL_NAME = AsyncLockedDict() # key: username, value: channel_name
-RPS_GAMES = AsyncLockedDict() # key: game_id, value: RPSGame object
-RPS_USER_STATUS = AsyncLockedDict() # key: username, value: game_id or search
-
-
-class RPSConsumer(AsyncWebsocketConsumer):
-
- async def connect(self):
- self.user = self.scope['user']
-
- await self.accept()
-
- # Add the user to the 'lobby' group
- await self.channel_layer.group_add("search", self.channel_name)
-
- # Set the user's channel name
- await RPS_USER_CHANNEL_NAME.set(self.user.username, self.channel_name)
- # Add user username to lobby cache
- await RPS_USER_STATUS.set(self.user.username, "search")
-
- # Get the number of users in the lobby
- lobby_users_usernames = await RPS_USER_STATUS.get_keys_with_value('search')
- lobby_users_count = len(lobby_users_usernames)
- await self.send(text_data=json.dumps({
- 'type': 'insearch',
- 'user': self.user.username,
- 'user_count': lobby_users_count,
- }))
-
- #? Maybe unnecessary
- await self.channel_layer.group_send("search", {
- 'type': 'user.insearch',
- 'user': self.user.username,
- })
-
- async def disconnect(self, close_code):
- game_id = await RPS_USER_STATUS.get(self.user.username)
- if game_id != 'search':
- game = await RPS_GAMES.get(game_id)
- if game != None:
- other_player_channel_name = await RPS_USER_CHANNEL_NAME.get(game.otherPlayer(self.user.username))
- await self.record_for_disconnected(game_id, game)
- await self.exit_handler(game_id, game)
- await self.channel_layer.send(other_player_channel_name, {
- 'type': 'game.disconnect',
- 'game_id': game_id,
- 'disconnected': self.user.username,
- })
-
- # Remove the user from the 'lobby' group
- await self.channel_layer.group_discard("search", self.channel_name)
-
- # Remove the user's channel name
- await RPS_USER_CHANNEL_NAME.delete(self.user.username)
-
- # Remove user username from lobby cache
- await RPS_USER_STATUS.delete(self.user.username)
-
- #? Maybe unnecessary
- # Set the user's status to offline
- await self.channel_layer.group_send("search", {
- 'type': 'user.outsearch',
- 'user': self.user.username,
- })
-
- # Close the websocket connection
- await self.close(close_code)
-
- async def receive(self, text_data):
- data = json.loads(text_data)
- action = data.get('type')
-
- if action == 'matchmaking':
- opponent = await self.matchmaking_handler()
- if opponent == None:
- await self.send(text_data=json.dumps({
- "error": "No suitable opponent found.",
- }))
- return
- if opponent:
- # Get the channel name of the shaker
- opponent_channel_name = await RPS_USER_CHANNEL_NAME.get(opponent)
- group_name = f'rps_{self.user.username}_{opponent}'
- # Create a new game instance in database
- game = await self.create_game(group_name, self.user.username, opponent)
- # Add both players to the group
- await self.channel_layer.group_add(group_name, self.channel_name)
- await self.channel_layer.group_add(group_name, opponent_channel_name)
- # Save the game instance in the cache
- await RPS_GAMES.set(game.id, RPS(self.user.username, opponent))
- # Set the user's status to playing
- await RPS_USER_STATUS.set(self.user.username, game.id)
- await RPS_USER_STATUS.set(opponent, game.id)
- cache.set(f"playing_{self.user.username}", True)
- cache.set(f"playing_{opponent}", True)
-
- # Send the game id to both players
- await self.channel_layer.group_send(group_name, {
- 'type': 'start',
- 'game_id': game.id,
- 'player1': self.user.username,
- 'player2': opponent,
- })
- else:
- await self.send(text_data=json.dumps({
- 'type': 'matchmaking.notfound',
- }))
-
- elif action == 'choice':
- game_id = data.get('game_id')
- choice = data.get('choice')
- game = await RPS_GAMES.get(game_id)
- game.play(self.user.username, choice)
- if game.both_played():
- player1_choice, player2_choice = game.getChoices()
- result = game.round_result()
- player1_score, player2_score = game.get_scores()
- await self.channel_layer.group_send(game.group_name, {
- 'type': 'result',
- 'game_id': game_id,
- 'result': result,
- 'player1_choice': player1_choice,
- 'player2_choice': player2_choice,
- 'player1_score': player1_score,
- 'player2_score': player2_score,
- })
- if game.check_is_over():
- winner, loser, winner_score, loser_score = game.getWinnerLoserandScores()
- game_duration = game.getDuration()
- await self.record_stats_elo_wallet(game_id, winner_score, loser_score, winner, loser, game_duration)
- await self.channel_layer.group_send(game.group_name, {
- 'type': 'result',
- 'game_id': game_id,
- 'result': 'OVER',
- 'player1_choice': player1_choice,
- 'player2_choice': player2_choice,
- 'player1_score': player1_score,
- 'player2_score': player2_score,
- })
-
-
- ### Handlers ###
- async def matchmaking_handler(self):
- from .models import UserProfile
- # Get the current user's elo_point
- current_user = await UserProfile.objects.aget(username=self.user.username)
- current_user_elo = current_user.elo_point
- # Get a list of online users
- lobby_users_usernames = await RPS_USER_STATUS.get_keys_with_value('search')
- lobby_users_usernames.remove(self.user.username) #TODO if user not in search
-
- return await self.get_similar_users(lobby_users_usernames, current_user_elo)
-
-
- @database_sync_to_async
- def get_similar_users(self, lobby_users_usernames, current_user_elo):
- from .models import UserProfile
- users = UserProfile.objects.filter(username__in=lobby_users_usernames, elo_point__gte=current_user_elo-100, elo_point__lte=current_user_elo+100).all()
- similar_users = [user.username for user in users]
- if similar_users:
- invitee_username = random.choice(similar_users)
- else:
- invitee_username = random.choice(lobby_users_usernames) if lobby_users_usernames else None
-
- return invitee_username
-
- async def exit_handler(self, game_id, game):
- # Discard both from the game group
- opponent = game.otherPlayer(self.user.username)
- opponent_channel_name = await RPS_USER_CHANNEL_NAME.get(opponent)
- await self.channel_layer.group_discard(game.group_name, self.channel_name)
- await self.channel_layer.group_discard(game.group_name, opponent_channel_name)
- cache.set(f"playing_{self.user.username}", False)
- cache.set(f"playing_{opponent}", False)
- # delete the game from the cache
- await RPS_GAMES.delete(game_id)
-
- ## Senders ##
- async def user_insearch(self, event):
- await self.send(text_data=json.dumps({
- 'type': 'user.insearch',
- 'user': event['user'],
- }))
-
- async def user_outsearch(self, event):
- await self.send(text_data=json.dumps({
- 'type': 'user.outsearch',
- 'user': event['user'],
- }))
-
- async def game_disconnect(self, event):
- await self.send(text_data=json.dumps({
- 'type': 'game.disconnect',
- 'game_id': event['game_id'],
- 'disconnected': event['disconnected'],
- }))
-
- async def result(self, event):
- await self.send(text_data=json.dumps({
- 'type': 'result',
- 'game_id': event['game_id'],
- 'result': event['result'],
- 'player1_choice': event['player1_choice'],
- 'player2_choice': event['player2_choice'],
- 'player1_score': event['player1_score'],
- 'player2_score': event['player2_score'],
- }))
-
-
-
- async def start(self, event):
- await self.send(text_data=json.dumps({
- 'type': 'start',
- 'game_id': event['game_id'],
- 'player1': event['player1'],
- 'player2': event['player2'],
- }))
-
- # Helpers #
- async def create_game(self,group_name, player1, player2):
- from .models import Game, UserProfile
- # Create a new game instance with the given players and an group_name
- player1 = await UserProfile.objects.aget(username=player1)
- player2 = await UserProfile.objects.aget(username=player2)
- game = await Game.objects.acreate(game_kind="rps", group_name=group_name, player1=player1, player2=player2)
- return game
-
- @database_sync_to_async
- def record_stats_elo_wallet(self, game_id, winner_score, loser_score, winner, loser, game_duration):
- from .models import Game, UserProfile
- from .update import update_wallet_elo, update_stats_rps
-
- game = Game.objects.get(id=game_id)
- game.game_kind = "rps"
- game.winner_score = winner_score
- game.loser_score = loser_score
- game.winner =UserProfile.objects.get(username=winner)
- game.loser = UserProfile.objects.get(username=loser)
- game.game_duration = datetime.timedelta(seconds=game_duration)
- game.save()
-
- update_wallet_elo(game.winner, game.loser)
- update_stats_rps(game.winner, game.loser, winner_score, loser_score, game_duration, "remote")
-
- async def record_for_disconnected(self, game_id, game):
- duration = game.getDuration()
- if game.shaker1.username == self.user.username:
- await self.record_stats_elo_wallet(game_id, game.shaker1.score, game.max_score, game.shaker2.username, game.shaker1.username, duration)
- else:
+import datetime
+import json
+import random
+from channels.db import database_sync_to_async
+from django.core.cache import cache
+from channels.generic.websocket import AsyncWebsocketConsumer
+from .utils import AsyncLockedDict
+from .rps import *
+
+RPS_USER_CHANNEL_NAME = AsyncLockedDict() # key: username, value: channel_name
+RPS_GAMES = AsyncLockedDict() # key: game_id, value: RPSGame object
+RPS_USER_STATUS = AsyncLockedDict() # key: username, value: game_id or search
+
+
+class RPSConsumer(AsyncWebsocketConsumer):
+
+ async def connect(self):
+ self.user = self.scope['user']
+
+ await self.accept()
+
+ # Add the user to the 'lobby' group
+ await self.channel_layer.group_add("search", self.channel_name)
+
+ # Set the user's channel name
+ await RPS_USER_CHANNEL_NAME.set(self.user.username, self.channel_name)
+ # Add user username to lobby cache
+ await RPS_USER_STATUS.set(self.user.username, "search")
+
+ # Get the number of users in the lobby
+ lobby_users_usernames = await RPS_USER_STATUS.get_keys_with_value('search')
+ lobby_users_count = len(lobby_users_usernames)
+ await self.send(text_data=json.dumps({
+ 'type': 'insearch',
+ 'user': self.user.username,
+ 'user_count': lobby_users_count,
+ }))
+
+ #? Maybe unnecessary
+ await self.channel_layer.group_send("search", {
+ 'type': 'user.insearch',
+ 'user': self.user.username,
+ })
+
+ async def disconnect(self, close_code):
+ game_id = await RPS_USER_STATUS.get(self.user.username)
+ if game_id != 'search':
+ game = await RPS_GAMES.get(game_id)
+ if game != None:
+ other_player_channel_name = await RPS_USER_CHANNEL_NAME.get(game.otherPlayer(self.user.username))
+ await self.record_for_disconnected(game_id, game)
+ await self.exit_handler(game_id, game)
+ await self.channel_layer.send(other_player_channel_name, {
+ 'type': 'game.disconnect',
+ 'game_id': game_id,
+ 'disconnected': self.user.username,
+ })
+
+ # Remove the user from the 'lobby' group
+ await self.channel_layer.group_discard("search", self.channel_name)
+
+ # Remove the user's channel name
+ await RPS_USER_CHANNEL_NAME.delete(self.user.username)
+
+ # Remove user username from lobby cache
+ await RPS_USER_STATUS.delete(self.user.username)
+
+ #? Maybe unnecessary
+ # Set the user's status to offline
+ await self.channel_layer.group_send("search", {
+ 'type': 'user.outsearch',
+ 'user': self.user.username,
+ })
+
+ # Close the websocket connection
+ await self.close(close_code)
+
+ async def receive(self, text_data):
+ data = json.loads(text_data)
+ action = data.get('type')
+
+ if action == 'matchmaking':
+ opponent = await self.matchmaking_handler()
+ if opponent == None:
+ await self.send(text_data=json.dumps({
+ "error": "No suitable opponent found.",
+ }))
+ return
+ if opponent:
+ # Get the channel name of the shaker
+ opponent_channel_name = await RPS_USER_CHANNEL_NAME.get(opponent)
+ group_name = f'rps_{self.user.username}_{opponent}'
+ # Create a new game instance in database
+ game = await self.create_game(group_name, self.user.username, opponent)
+ # Add both players to the group
+ await self.channel_layer.group_add(group_name, self.channel_name)
+ await self.channel_layer.group_add(group_name, opponent_channel_name)
+ # Save the game instance in the cache
+ await RPS_GAMES.set(game.id, RPS(self.user.username, opponent))
+ # Set the user's status to playing
+ await RPS_USER_STATUS.set(self.user.username, game.id)
+ await RPS_USER_STATUS.set(opponent, game.id)
+ cache.set(f"playing_{self.user.username}", True)
+ cache.set(f"playing_{opponent}", True)
+
+ # Send the game id to both players
+ await self.channel_layer.group_send(group_name, {
+ 'type': 'start',
+ 'game_id': game.id,
+ 'player1': self.user.username,
+ 'player2': opponent,
+ })
+ else:
+ await self.send(text_data=json.dumps({
+ 'type': 'matchmaking.notfound',
+ }))
+
+ elif action == 'choice':
+ game_id = data.get('game_id')
+ choice = data.get('choice')
+ game = await RPS_GAMES.get(game_id)
+ game.play(self.user.username, choice)
+ if game.both_played():
+ player1_choice, player2_choice = game.getChoices()
+ result = game.round_result()
+ player1_score, player2_score = game.get_scores()
+ await self.channel_layer.group_send(game.group_name, {
+ 'type': 'result',
+ 'game_id': game_id,
+ 'result': result,
+ 'player1_choice': player1_choice,
+ 'player2_choice': player2_choice,
+ 'player1_score': player1_score,
+ 'player2_score': player2_score,
+ })
+ if game.check_is_over():
+ winner, loser, winner_score, loser_score = game.getWinnerLoserandScores()
+ game_duration = game.getDuration()
+ await self.record_stats_elo_wallet(game_id, winner_score, loser_score, winner, loser, game_duration)
+ await self.channel_layer.group_send(game.group_name, {
+ 'type': 'result',
+ 'game_id': game_id,
+ 'result': 'OVER',
+ 'player1_choice': player1_choice,
+ 'player2_choice': player2_choice,
+ 'player1_score': player1_score,
+ 'player2_score': player2_score,
+ })
+
+
+ ### Handlers ###
+ async def matchmaking_handler(self):
+ from .models import UserProfile
+ # Get the current user's elo_point
+ current_user = await UserProfile.objects.aget(username=self.user.username)
+ current_user_elo = current_user.elo_point
+ # Get a list of online users
+ lobby_users_usernames = await RPS_USER_STATUS.get_keys_with_value('search')
+ lobby_users_usernames.remove(self.user.username) #TODO if user not in search
+
+ return await self.get_similar_users(lobby_users_usernames, current_user_elo)
+
+
+ @database_sync_to_async
+ def get_similar_users(self, lobby_users_usernames, current_user_elo):
+ from .models import UserProfile
+ users = UserProfile.objects.filter(username__in=lobby_users_usernames, elo_point__gte=current_user_elo-100, elo_point__lte=current_user_elo+100).all()
+ similar_users = [user.username for user in users]
+ if similar_users:
+ invitee_username = random.choice(similar_users)
+ else:
+ invitee_username = random.choice(lobby_users_usernames) if lobby_users_usernames else None
+
+ return invitee_username
+
+ async def exit_handler(self, game_id, game):
+ # Discard both from the game group
+ opponent = game.otherPlayer(self.user.username)
+ opponent_channel_name = await RPS_USER_CHANNEL_NAME.get(opponent)
+ await self.channel_layer.group_discard(game.group_name, self.channel_name)
+ await self.channel_layer.group_discard(game.group_name, opponent_channel_name)
+ cache.set(f"playing_{self.user.username}", False)
+ cache.set(f"playing_{opponent}", False)
+ # delete the game from the cache
+ await RPS_GAMES.delete(game_id)
+
+ ## Senders ##
+ async def user_insearch(self, event):
+ await self.send(text_data=json.dumps({
+ 'type': 'user.insearch',
+ 'user': event['user'],
+ }))
+
+ async def user_outsearch(self, event):
+ await self.send(text_data=json.dumps({
+ 'type': 'user.outsearch',
+ 'user': event['user'],
+ }))
+
+ async def game_disconnect(self, event):
+ await self.send(text_data=json.dumps({
+ 'type': 'game.disconnect',
+ 'game_id': event['game_id'],
+ 'disconnected': event['disconnected'],
+ }))
+
+ async def result(self, event):
+ await self.send(text_data=json.dumps({
+ 'type': 'result',
+ 'game_id': event['game_id'],
+ 'result': event['result'],
+ 'player1_choice': event['player1_choice'],
+ 'player2_choice': event['player2_choice'],
+ 'player1_score': event['player1_score'],
+ 'player2_score': event['player2_score'],
+ }))
+
+
+
+ async def start(self, event):
+ await self.send(text_data=json.dumps({
+ 'type': 'start',
+ 'game_id': event['game_id'],
+ 'player1': event['player1'],
+ 'player2': event['player2'],
+ }))
+
+ # Helpers #
+ async def create_game(self,group_name, player1, player2):
+ from .models import Game, UserProfile
+ # Create a new game instance with the given players and an group_name
+ player1 = await UserProfile.objects.aget(username=player1)
+ player2 = await UserProfile.objects.aget(username=player2)
+ game = await Game.objects.acreate(game_kind="rps", group_name=group_name, player1=player1, player2=player2)
+ return game
+
+ @database_sync_to_async
+ def record_stats_elo_wallet(self, game_id, winner_score, loser_score, winner, loser, game_duration):
+ from .models import Game, UserProfile
+ from .update import update_wallet_elo, update_stats_rps
+
+ game = Game.objects.get(id=game_id)
+ game.game_kind = "rps"
+ game.winner_score = winner_score
+ game.loser_score = loser_score
+ game.winner =UserProfile.objects.get(username=winner)
+ game.loser = UserProfile.objects.get(username=loser)
+ game.game_duration = datetime.timedelta(seconds=game_duration)
+ game.save()
+
+ update_wallet_elo(game.winner, game.loser)
+ update_stats_rps(game.winner, game.loser, winner_score, loser_score, game_duration, "remote")
+
+ async def record_for_disconnected(self, game_id, game):
+ duration = game.getDuration()
+ if game.shaker1.username == self.user.username:
+ await self.record_stats_elo_wallet(game_id, game.shaker1.score, game.max_score, game.shaker2.username, game.shaker1.username, duration)
+ else:
await self.record_stats_elo_wallet(game_id, game.max_score, game.shaker2.score, game.shaker1.username, game.shaker2.username, duration)
\ No newline at end of file
diff --git a/indianpong/pong/consumer_status.py b/indianpong/pong/consumer_status.py
index 5151468..bf68d55 100644
--- a/indianpong/pong/consumer_status.py
+++ b/indianpong/pong/consumer_status.py
@@ -1,74 +1,74 @@
-from channels.generic.websocket import AsyncWebsocketConsumer
-from django.core.cache import cache
-from .utils import add_to_cache, remove_from_cache
-#from .models import UserProfile
-import json
-
-class OnlineStatusConsumer(AsyncWebsocketConsumer):
- async def connect(self):
- self.user = self.scope['user']
- if self.user.is_anonymous:
- return
-
- """ # get UserProfile object
- user_profile = await UserProfile.objects.aget(id=self.user.id)
- user_profile.is_online = True
- await user_profile.asave()
- # Add user ID to online_users list
- add_to_cache('online_users', set(), self.user.id) """
- cache.set(f'online_{self.user.username}', True)
- cache.set(f'playing_{self.user.username}', False) #TODO spada çalışmıyabilir
- # Maybe add playing to the cache
- await self.accept()
-
- await self.send(text_data=json.dumps({
- 'status': 'online',
- }))
-
-
- async def disconnect(self, close_code):
- if self.user.is_anonymous:
- return
-
- cache.set(f'online_{self.user.username}', False)
- # Maybe add playing to the cache
- """ user_profile = await UserProfile.objects.aget(id=self.user.id)
- user_profile.is_online = False
- await user_profile.asave()
- # Remove user ID from online_users list
- remove_from_cache('online_users', set(), self.user.id) """
- await self.close()
-
-"""
-def is_user_online(user):
- return cache.get(f'online_{user.id}') is not None"""
-
-"""
-def get_online_users():
- online_user_ids = cache.get('online_users', set())
- return UserProfile.objects.filter(id__in=online_user_ids)"""
-
-
-
-""" # Receive message from WebSocket
- async def receive(self, text_data):
- text_data_json = json.loads(text_data)
- message = text_data_json['message']
-
- # Send message to group
- await self.channel_layer.group_send(
- 'online_status',
- {
- 'type': 'online_status_message',
- 'message': message
- }
- )
-
- # Receive message from group
- async def online_status_message(self, event):
- message = event['message']
-
- # Send message to WebSocket
- await self.send(text_data=json.dumps({
- 'message': message
+from channels.generic.websocket import AsyncWebsocketConsumer
+from django.core.cache import cache
+from .utils import add_to_cache, remove_from_cache
+#from .models import UserProfile
+import json
+
+class OnlineStatusConsumer(AsyncWebsocketConsumer):
+ async def connect(self):
+ self.user = self.scope['user']
+ if self.user.is_anonymous:
+ return
+
+ """ # get UserProfile object
+ user_profile = await UserProfile.objects.aget(id=self.user.id)
+ user_profile.is_online = True
+ await user_profile.asave()
+ # Add user ID to online_users list
+ add_to_cache('online_users', set(), self.user.id) """
+ cache.set(f'online_{self.user.username}', True)
+ cache.set(f'playing_{self.user.username}', False) #TODO spada çalışmıyabilir
+ # Maybe add playing to the cache
+ await self.accept()
+
+ await self.send(text_data=json.dumps({
+ 'status': 'online',
+ }))
+
+
+ async def disconnect(self, close_code):
+ if self.user.is_anonymous:
+ return
+
+ cache.set(f'online_{self.user.username}', False)
+ # Maybe add playing to the cache
+ """ user_profile = await UserProfile.objects.aget(id=self.user.id)
+ user_profile.is_online = False
+ await user_profile.asave()
+ # Remove user ID from online_users list
+ remove_from_cache('online_users', set(), self.user.id) """
+ await self.close()
+
+"""
+def is_user_online(user):
+ return cache.get(f'online_{user.id}') is not None"""
+
+"""
+def get_online_users():
+ online_user_ids = cache.get('online_users', set())
+ return UserProfile.objects.filter(id__in=online_user_ids)"""
+
+
+
+""" # Receive message from WebSocket
+ async def receive(self, text_data):
+ text_data_json = json.loads(text_data)
+ message = text_data_json['message']
+
+ # Send message to group
+ await self.channel_layer.group_send(
+ 'online_status',
+ {
+ 'type': 'online_status_message',
+ 'message': message
+ }
+ )
+
+ # Receive message from group
+ async def online_status_message(self, event):
+ message = event['message']
+
+ # Send message to WebSocket
+ await self.send(text_data=json.dumps({
+ 'message': message
})) """
\ No newline at end of file
diff --git a/indianpong/pong/langs.py b/indianpong/pong/langs.py
index 5957e66..7220e5a 100644
--- a/indianpong/pong/langs.py
+++ b/indianpong/pong/langs.py
@@ -1,1436 +1,1436 @@
-def get_langs(lang):
- if lang == "en":
- return get_lang_en()
- if lang == "hi":
- return get_lang_hi()
- if lang == "tr":
- return get_lang_tr()
- if lang == "pt":
- return get_lang_pt()
-
-
-def get_lang_en():
- context = {
- #index
- "basePageTittle": "Indian-Pong",
- "baseHeaderText": "Indian-Pong",
- "baseSubHeaderText": "Indian-Pong created for 42 school by Indian Dev!",
- "basePlayButtonText": "Get Started!",
-
- "baseInfoHeaderText": "Welcome to Indian-Pong!",
- "baseInfoHeaderDescription": "Pong brings the excitement and competition of classic table tennis to the internet. On this platform, you can have fun, showcase your skills, and rise in the rankings to become one of the best.",
- "baseInfoSubHeaderText": "Play and Win",
- "baseInfoSubHeaderDescription1": "Gain Pong Points with each game you win to climb the ranks.",
- "baseInfoSubHeaderDescription2": "Use your earnings to purchase new items, rackets, and tables from the store to enhance your gaming experience.",
- "baseInfoSubHeaderText2": "Get Started Now",
- "baseInfoSubHeaderDescription3": "Create an account to personalize your profile, track your statistics, and see where you stand in the rankings.",
- "baseInfoSubHeaderText3": "More Features",
- "baseInfoSubHeaderDescription4": "Participate in tournaments to face off against your opponents.",
- "baseInfoSubHeaderDescription5": "Enjoy quality time with your friends by hosting private games.",
- "baseInfoSubHeaderDescription6": "Chat with other players, share tactics, and join the Pong community.",
-
- #Login
- "loginPageTittle": "Login",
- "loginHeaderText1": "Welcome,",
- "loginHeaderText2": "sign in to continue",
- "loginInputUsernameText": "Username",
- "loginInputPasswordText": "Password",
- "loginForgotPasswordText": "Forgot Password?",
- "loginButtonLogin": "Let's go",
- "loginButtonJoin": "Join Us",
-
- #404
- "notFoundPageTittle": "404 Not Found",
- "notFoundHeaderText": "404 ERROR",
- "notFoundSubHeaderText": "Probably you lost in our website!",
- "notFoundButtonText": "GO HOME",
-
- #Signup
- "signupPageTittle": "Sign Up",
- "signupHeaderText1": "Welcome,",
- "signupHeaderText2": "sign up to continue",
- "signupInputUsernameText": "Username",
- "signupInputDisplayNameText": "Display Name",
- "signupInputEmailText": "Email",
- "signupInputPasswordText": "Password",
- "signupInputConfirmPasswordText": "Password (again)",
- "signupImageUploadText": "Upload Image",
- "signupGdprText1": "I accept the",
- "signupGdprText2": "GDPR Privacy Policy",
- "signupButtonSignup": "Let's shine!",
-
- #ForgotPassword
- "forgotPasswordPageTittle": "Forgot Password",
- "forgotPasswordHeaderText": "Forgot Password",
- "forgotPasswordInputEmailText": "Email",
- "forgotPasswordButtonSend": "Send Email",
- "forgotPasswordLinkText": "Don't have an account?",
- "forgotPasswordLinkButtonText": "Join Us",
-
- #Password-Reset-Done
- "passwordResetDonePageTittle": "Email Send Done",
- "passwordResetDoneHeaderText": "EMAIL SEND DONE",
- "passwordResetDoneSubHeaderText": "We have emailed your password reset link. Please check your email.",
- "passwordResetButtonText": "GO LOGIN",
-
- #ChangePassword
- "changePasswordPageTittle": "Change Password",
- "changePasswordHeaderText": "Change Password",
- "changePassswordSubHeaderText": "change your password",
-
- #Dashboard
- "dashboardPageTittle": "Dashboard",
- "dashboardText1": "Welcome, ",
- "dashboardText2": "Indian Pong is a collaborative project developed for the 42 school community, offering a nostalgic gaming experience through the classic Atari game, Ping-Pong. This platform allows users to engage in Ping-Pong matches with each other, fostering a sense of friendly competition. In addition to the gaming aspect, Indian Pong provides a social dimension, featuring chat rooms where users can communicate and connect with one another. The platform also enables users to expand their network by adding friends within the 42 school community. Overall, Indian Pong combines the joy of retro gaming with modern social interaction, creating a vibrant and interactive experience for the 42 school community.",
-
- "dashboardGamesPlayed": "Games Played",
- "dashboardWinCount": "Win Count",
- "dashboardWinStreak": "Win Streak",
- "dashboardLoseStreak": "Lose Streak",
- "dashboardWinRate": "Win Rate",
- "dashboardAverageGameDuration": "Average Game Duration",
- "dashboardAveragePointsWon": "Average Points Won",
- "dashboardAveragePointsLost": "Average Points Lost",
-
- #Chat
- "chatPageTittle": "Chat",
- "chatHeaderText": "Chats",
- "chatRecentlyText": "Recently",
- "chatDMText": "Direct Messages",
- "chatContainerSelectText": "Select a chat to start messaging",
- "chatTodayText": "Today",
- "chatTypeHereText": "Type a message here...",
-
-
- #Pong-Game
- "pongGamePageTittle": "Pong Game",
- "pongGameHeaderText": "Welcome to Pong Lobby",
- "pongGameSubHeaderText": "You can improve yourself by playing with Artificial Intelligence. If you want to play with a real person, consider the other option; if we don't find someone to match with in 5 minutes, the match will be canceled. Good luck before we forget!",
- "pongGameAIButtonText": "Play with AI",
- "pongGameLocalButtonText": "Local Game",
- "pongGameRemoteButtonText": "Remote Player",
- "pongGameLocalTournamentButtonText": "Local Tournament",
- "pongGameTournamentButtonText": "Tournament",
-
- #AI-Game
- "aiGamePageTittle": "AI Game",
- "aiGameReactionDelayText": "Reaction Delay",
- "aiGameGetReadyText": "Get Ready",
- "aiGameStartButtonText": "Start",
-
- "aiGameGameOverText": "Game Over",
- "aiGameRestartButtonText": "Restart",
- "aiGameExitButtonText": "Exit",
-
- "aiGameInfoHeaderText": "About the Game",
- "aiGameInfoSubHeaderText": "How to Play the Game?",
- "aiGameInfoSubHeaderDescription1": "In Pong game, players engage in a table tennis match against their opponents. The W-S keys (or up-down arrow keys) are used to control the ball.",
- "aiGameInfoSubHeaderText2": "Win and Improve",
- "aiGameInfoSubHeaderDescription2": "You earn Pong Points with every game you win. With these points, you can purchase new items, rackets, and tables from the store to enhance your gaming experience.",
- "aiGameInfoSubHeaderText3": "Get Started Now",
- "aiGameInfoSubHeaderDescription3": "You can create an account to personalize your gaming experience. With an account, you can track your statistics and see your position in the rankings.",
- "aiGameInfoSubHeaderText4": "More Features",
- "aiGameInfoSubHeaderDescription4": "You can participate in tournaments to face off against your opponents and test your skills. Additionally, you can create private games with your friends and join the Pong community.",
-
- "aiGameInfoSubHeaderText5": "Controls",
- "aiGameInfoSubHeaderDescription5": "Up",
- "aiGameInfoSubHeaderDescription6": "Down",
- "aiGameInfoSubHeaderText6": "Skills",
- "aiGameInfoSubHeaderDescription7": "Like a Cheater",
- "aiGameInfoSubHeaderDescription8": "Fast and Furious",
- "aiGameInfoSubHeaderDescription9": "Frozen Ball",
-
- #Local-Game
- "localGamePageTittle": "Local Game",
- "localGameHeaderText": "1v1 Local Game",
- "localGamePlayer1Text": "Player1 Name",
- "localGamePlayer2Text": "Player2 Name",
- "localGameMaxScoreText": "Max Score",
- "localGameGameModeText": "Game Mode",
- "localGameChooseModeText1": "Vanilla",
- "localGameChooseModeText2": "Abilities",
- "localGameButtonStart": "Start",
-
- #Local-Tournament
- "localTournamentPageTittle": "Local Tournament",
- "localTournamentGameHeaderText": "Local Tournament",
- "localTournamentPlayer1Text": "Player1 Name",
- "localTournamentPlayer2Text": "Player2 Name",
- "localTournamentPlayer3Text": "Player3 Name",
- "localTournamentPlayer4Text": "Player4 Name",
- "localTournamentMaxScoreText": "Max Score",
- "localTournamentGameModeText": "Game Mode",
- "localTournamentChooseModeText1": "Vanilla",
- "localTournamentChooseModeText2": "Abilities",
- "localTournamentButtonStart": "Start & Bracket",
- "localTournamentBracketTitle": "Tournament Bracket",
- "localTournamentBracketStartButtonText": "Start Tournament",
- "localTournamentTournamentOverText": "Tournament Over",
- "localTournamentOverButtonText": "Over",
-
- "localTournamentNextButtonText": "Next",
-
-
- #Tournament
- "tournamentPageTittle": "Tournament",
- "tournamentHeaderText": "Welcome to Tournament Lobby for Pong",
- "tournamentSubHeaderText": "Here you can join a tournament lobby or create your own tournament lobby. You can invite your friends by sharing the invite code after creating the room. Good luck before I forget!",
- "tournamentJoinButtonText": "Join Tournament",
- "tournamentCreateButtonText": "Create Tournament",
-
- #Tournament-Create
- "tournamentCreatePageTittle": "Create Tournament",
- "tournamentCreateHeaderText": "CREATE TOURNAMENT",
- "tournamentCreateSubHeaderText": "To create a tournament I need a tournament name, how many max points each game will have. Good luck before I forget!",
- "tournamentCreateNameText": "Tournament Name",
- "tournamentCreateMaxPointsText": "Max Score Games",
- "tournamentCreateGameModeText": "Game Mode",
- "tournamentCreateChooseModeText1": "Vanilla",
- "tournamentCreateChooseModeText2": "Abilities",
- "tournamentCreateButtonCreate": "Create Tournament",
-
- #Joined-Tournament-Room
- "tournamentroomPageTittle": "Tournament Room",
- "tournamentroomHeaderText": "Tournament Room",
- "tournamentroomRoomText": "Room",
- "tournamentroomLeaveButtonText": "LEAVE TOURNAMENT",
- "tournamentroomStartButtonText": "START TOURNAMENT",
- "tournamentroomJoinButtonText": "JOIN TOURNAMENT",
- "tournamentCheckBracketButtonText": "CHECK BRACKET",
- "tournamentOverWinnerGuyText": "the tournament is over and the only person worthy of this throne",
- "tournamentOverLosersText": "the tournament is over and these are the losers club",
- "tournamentroomTournamentRoomButton": "TOURNAMENT ROOM",
- "tournamentroomWaitingText": "Waiting",
- "tournamentroomForPlayerText": "for player...",
-
- #Tournament Room List
- "tournamentRoomListPageTittle": "Tournament Rooms",
- "tournamentRoomListHeaderText": "Tournament Rooms",
-
- #Remote Pong Game
- "remotePongGamePageTittle": "Remote Pong Game",
- "remotePongGameTableName": "Name",
- "remotePongGameTableActions": "Actions",
- "remotePongGameMatchmakingButtonText": "MATCHMAKING",
- "remotePongGameLeaveButtonText": "LEAVE",
- "remotePongGameStartText": "Before to start, u can choose game mode!",
- "remotePongGameStartButtonText": "START GAME",
- "remotePongSelectedMode": "Vanilla",
-
-
- #RPS Game
- "rpsGamePageTittle": "Rock Paper Scissors",
- "rpsGameText1": "Welcome to RPS Lobby",
- "rpsGameText2": "You can improve yourself by playing with Artificial Intelligence. If you want to play with a real person, consider the other option; if we don't find someone to match with in 5 minutes, the match will be canceled. Good luck before we forget!",
- "rpsGameAIButtonText": "Play with AI",
- "rpsGameLocalButtonText": "Local Game",
- "rpsGameSearchOpponentButtonText": "Search Opponent ",
- "rpsUserCountText": "number of people looking for a match right now",
-
- #AI-Game
- "rpsGamePageTittle": "RPS Game with Artificial Intelligence",
- "rpsGameScoreText": "score",
- "rpsGameRockText": "ROCK",
- "rpsGamePaperText": "PAPER",
- "rpsGameScissorsText": "SCISSORS",
- "rpsGamePickedText": "you picked",
- "rpsGamePickedText2": "the house picked",
- "rpsGameAgainText": "Play again",
- "rpsGameGameOverText": "Game Over",
- "rpsGameRestartButtonText": "Restart",
- "rpsGameExitButtonText": "Exit",
-
- #Rankings
- "rankingsPageTittle": "Rankings",
- "rankingsTableRankText": "Rank",
- "rankingsTableNameText": "Name",
- "rankingsTableUsernameText": "Username",
- "rankingsTableWinsText": "Wins",
- "rankingsTableLossesText": "Losses",
- "rankingsTableWinRateText": "Win Rate",
- "rankingsTablePongPointsText": "Pong Point",
-
- #Store
- "storePageTittle": "Store",
- "storeText": "Store",
- "storeTagText": "All",
- "storeWalletText": "Wallet",
- "storeWalleinfoText1": "Oyun oynayarak ",
- "storeWalleinfoText2": " kazanabilirsin.",
-
- #Inventory
- "inventoryPageTittle": "Inventory",
- "inventoryText": "Inventory",
- "inventoryTagText": "All",
- "inventoryWalletText": "Wallet",
- "inventoryWalleinfoText1": " playing games",
- "inventoryWalleinfoText2": " can win.",
- "inventoryModalHeaderText": "Set Featured Item",
- "inventoryModalSaveButton": "Save",
- "inventoryModalCloseButton": "Close",
- "inventoryItemKeyboardInfoText": "Use the",
- "inventoryItemKeyboardInfoText2": "key to use this ability. And remember, you must equip this ability.",
- "inventoryItemKeyboardInfoText3": "There is no special keypad for this item, it is used automatically.",
-
- #Search
- "searchPageTittle": "Search",
- "searchInputText": "Email or Username or Displayname Search...",
- "searchMessageButtonText": "Message",
- "searchFollowButtonText": "Follow",
- "searchFollowingButtonText": "Unfollow",
- "searchNoResultFoundText": "No result found.",
-
- #Profile
- "profilePageTittle": "Profile",
- "profileRankAIText": "I'M JUST ROBOT",
- "profileRankUserText1": " IN RANKINGS",
- "profileRankUserText2": " NO RANKING",
- "profileFollowButton": "Follow",
- "profileFollowingButton": "Unfollow",
- "profileTitleText1": "42 Kocaeli Student",
- "profileTitleText2": "Software Developer",
-
- "profileLinkedinSocialText": "No Linkedin",
- "profileGithubSocialText": "No Github",
- "profileTwitterSocialText": "No Twitter",
- "profileIntra42SocialText": "No Intra42",
-
- "profileMatchHistoryText1": "Opponent",
- "profileMatchHistoryText2": "Result",
- "profileMatchHistoryText3": "Score",
- "profileMatchHistoryText4": "Duration",
-
- "profileMatchHistoryWinText": "Win",
- "profileMatchHistoryLoseText": "Lose",
-
- "profileRankText1": "Rank",
- "profileStatsText": "Stats",
-
- "profileGameStats1": "Games Played:",
- "profileGameStats2": "Wins:",
- "profileGameStats3": "Loses:",
- "profileGameStats4": "Win Rate:",
- "profileGameStats5": "Win Streak:",
- "profileGameStats6": "Average Game Duration:",
-
- #Friends
- "friendsPageTittle": "Friends",
- "friendsMessageButtonText": "Message",
- "friendsNoResultFoundText": "No result found.",
-
- #ProfileSettings
- "profileSettingsPageTittle": "Profile Settings",
- "profileSettingsNavbar1": "Edit Profile",
- "profileSettingsNavbar2": "Change Password",
- "profileSettingsNavbar3": "Add Socials",
- "profileSettingsNavbar4": "Blocked Users",
- "profileSettingsNavbar5": "Close Account",
-
- #Edit-Profile
- "editProfileChangeImageText": "Change Image",
- "editProfileUsernameText": "Username (how your name will appear to other users on the site)",
- "editProfileUsernameTimeText": "You can change your username every 7 days.",
- "editProfileEmailText": "Email",
- "editProfile42EmailText": "Since you are logged in with 42, your email setting feature is disabled.",
- "editProfileDisplayNameText": "Display Name",
- "editProfileSaveButtonText": "Save Changes",
-
- #Change-Passwordg
- "changePasswordCurrentPasswordText": "Current Password",
- "changePasswordNewPasswordText": "New Password",
- "changePasswordNewConfirmPasswordText": "Confirm New Password",
- "changePassword42Text": "Since you are logged in with 42, your password setting feature is disabled.",
- "changePasswordSaveButtonText": "Save Password",
-
- #Add-Socials
- "addSocialsLinkedinInputText": "Enter your LinkedIn username",
- "addSocialsTwitterInputText": "Enter your Twitter username",
- "addSocialsGithubInputText": "Enter your Github username",
- "addSocialsIntraInputText": "Enter your 42 Intra username",
- "addSocialsSaveButtonText": "Save Socials",
-
- #Blocked-Users
- "blockedUsersHeaderText": "Blocked Accounts",
- "blockedUsersSubHeaderText": "You can unblock the accounts you have blocked here.",
- "blockedStatusText": "Blocked",
-
- #Close-Account
- "closeAccountHeaderText": "Close Account",
- "closeAccountInputText": "Email",
- "closeAccountSubHeaderText": "You can delete your account here. This action is irreversible.",
- "closeAccountButton": "Close Account",
-
-
- }
- return context
-
-def get_lang_tr():
- context = {
- #index
- "basePageTittle": "Indian-Pong",
- "baseHeaderText": "Indian-Pong",
- "baseSubHeaderText": "Indian-Pong Hintli geliştiriciler tarafından 42 okulu için geliştirilmiştir!",
- "basePlayButtonText": "YOLCULUĞA BAŞLA!",
-
- "baseInfoHeaderText": "Indian-Pong'a hoş geldiniz!",
- "baseInfoHeaderDescription": "Pong, klasik masa tenisi oyununun heyecanını ve rekabetini internet ortamına taşıyor. Bu platformda hem eğlenebilir hem de yeteneğini konuşturabilir, sıralamada yükselip en iyiler arasına girebilirsin.",
- "baseInfoSubHeaderText": "Oyna ve Kazan",
- "baseInfoSubHeaderDescription1": "Her oyun kazandığında Pong Point kazanarak sıralamada yüksel.",
- "baseInfoSubHeaderDescription2": "Kazançlarınla mağazadan yeni eşyalar, raket ve masalar satın alarak oyun deneyimini geliştir.",
- "baseInfoSubHeaderText2": "Hemen Başla",
- "baseInfoSubHeaderDescription3": "Hesap oluşturarak profilini kişiselleştir, istatistiklerini takip et ve sıralamadaki yerini gör.",
- "baseInfoSubHeaderText3": "Daha Fazlası",
- "baseInfoSubHeaderDescription4": "Turnuvalara katılarak rakiplerinle yüzleş.",
- "baseInfoSubHeaderDescription5": "Arkadaşlarınla özel oyunlar kurarak keyifli vakit geçir.",
- "baseInfoSubHeaderDescription6": "Diğer oyuncularla sohbet et, taktikler paylaş ve Pong topluluğuna katıl.",
-
- #Login
- "loginPageTittle": "Giriş Yap",
- "loginHeaderText1": "Hoş geldiniz,",
- "loginHeaderText2": "devam etmek için giriş yapın",
- "loginInputUsernameText": "Kullanıcı Adı",
- "loginInputPasswordText": "Şifre",
- "loginForgotPasswordText": "Şifremi Unuttum?",
- "loginButtonLogin": "Giriş Yap",
- "loginButtonJoin": "Üye Ol",
-
- #404
- "notFoundPageTittle": "Sayfa Bulunamadı",
- "notFoundHeaderText": "404 HATA",
- "notFoundSubHeaderText": "Muhtemelen sitemizde kayboldunuz!",
- "notFoundButtonText": "ANA SAYFA'YA DÖN",
-
- #Signup
- "signupPageTittle": "Kayıt Ol",
- "signupHeaderText1": "Hoş geldiniz,",
- "signupHeaderText2": "devam etmek için kayıt olun",
- "signupInputUsernameText": "Kullanıcı Adı",
- "signupInputDisplayNameText": "Görünen Ad",
- "signupInputEmailText": "E-posta",
- "signupInputPasswordText": "Şifre",
- "signupInputConfirmPasswordText": "Şifreyi Onayla",
- "signupImageUploadText": "Resim Yükle",
- "signupGdprText1": "Kabul ediyorum",
- "signupGdprText2": "GDPR Gizlilik Politikası",
- "signupButtonSignup": "Kayıt Ol",
-
- #ForgotPassword
- "forgotPasswordPageTittle": "Şifremi Unuttum",
- "forgotPasswordHeaderText": "Şifremi Unuttum",
- "forgotPasswordInputEmailText": "E-posta",
- "forgotPasswordButtonSend": "E-posta Gönder",
- "forgotPasswordLinkText": "Hesabınız yok mu?",
- "forgotPasswordLinkButtonText": "Kayıt Ol",
-
- #Password-Reset-Done
- "passwordResetDonePageTittle": "E-Posta Gönderildi",
- "passwordResetDoneHeaderText": "E-POSTA GÖNDERİLDİ",
- "passwordResetDoneSubHeaderText": "Şifre sıfırlama bağlantınızı e-posta ile gönderdik. Lütfen e-postanızı kontrol edin.",
- "passwordResetButtonText": "GİRİŞ'E DÖN",
-
- #ChangePassword
- "changePasswordPageTittle": "Şifre Değiştir",
- "changePasswordHeaderText": "Şifre Değiştir",
- "changePassswordSubHeaderText": "şifreni değiştir",
-
- #Dashboard
- "dashboardPageTittle": "Ana Sayfa",
- "dashboardText1": "HOŞ GELDİNİZ, ",
- "dashboardText2": "Indian Pong, 42 okulu toplulugu için geliştirilmiş bir takım projesidir ve klasik Atari oyunu Ping-Pong ile nostaljik bir oyun deneyimi sunar. Bu platform, kullanıcıların birbirleriyle Ping-Pong maçlari yapmalarina olanak tanır ve dostane rekabet ortamı oluşturur. Oyun deneyimi dışında, Indian Pong, kullanıcıların birbirleriyle iletişim kurabileceği ve bağlanti kurabilecegi sohbet odalarını içeren bir sosyal boyut sunar. Platform ayrıca, kullanicilarin 42 okulu topluluğunda arkadaş ekleyerek ağlarını genişletmelerine olanak tanır. Genel olarak, Indian Pong, retro oyun keyfini modern sosyal etkileşimle birleştirerek, 42 okulu topluluğu icin canlı ve etkileşimli bir deneyim sunar.",
-
- "dashboardGamesPlayed": "Oynanan Oyunlar",
- "dashboardWinCount": "Kazanma Sayısı",
- "dashboardWinStreak": "Kazanma Serisi",
- "dashboardLoseStreak": "Kaybetme Serisi",
- "dashboardWinRate": "Kazanma Oranı",
- "dashboardAverageGameDuration": "Ortalama Oyun Süresi",
- "dashboardAveragePointsWon": "Ortalama Kazanılan Puanlar",
- "dashboardAveragePointsLost": "Ortalama Kaybedilen Puanlar",
-
- #Chat
- "chatPageTittle": "Sohbet",
- "chatHeaderText": "Sohbetler",
- "chatRecentlyText": "Son Zamanlar",
- "chatDMText": "Direkt Mesajlar",
- "chatContainerSelectText": "Mesajlaşmaya başlamak için bir sohbet seçin",
- "chatTodayText": "Bugün",
- "chatTypeHereText": "Bir mesaj yazın...",
-
- #Pong-Game
- "pongGamePageTittle": "Pong Oyunu",
- "pongGameHeaderText": "Pong Lobisine Hoş Geldiniz",
- "pongGameSubHeaderText": "Yapay Zeka ile oynayarak kendinizi geliştirebilir. Gerçek bir kişiyle oynamak istiyorsanız, diğer seçeneği düşünün; 5 dakika içinde eşleşecek birini bulamazsak, eşleşme iptal edilecektir. Unutmadan önce iyi şanslar!",
- "pongGameAIButtonText": "Yapay Zeka Oyunu",
- "pongGameLocalButtonText": "Yerel Oyun",
- "pongGameRemoteButtonText": "Uzak Oyuncu",
- "pongGameLocalTournamentButtonText": "Yerel Turnuva",
- "pongGameTournamentButtonText": "Turnuva",
-
- #AI-Game
- "aiGamePageTittle": "Pong Yapay Zeka Oyunu",
- "aiGameReactionDelayText": "Tepki Gecikmesi",
- "aiGameGetReadyText": "Hazir Ol",
- "aiGameStartButtonText": "Başlat",
-
- "aiGameGameOverText": "Oyun Bitti",
- "aiGameRestartButtonText": "Yeniden",
- "aiGameExitButtonText": "Cikis",
-
- "aiGameInfoHeaderText": "Oyun Hakkında",
- "aiGameInfoSubHeaderText": "Oyunu Nasıl Oynarım?",
- "aiGameInfoSubHeaderDescription1": "Pong oyununda oyuncular rakiplerine karşı bir masa tenisi maçı yaparlar. W-S tuşları (veya yukarı-aşağı ok tuşları) topu kontrol etmek için kullanılır.",
- "aiGameInfoSubHeaderText2": "Kazan ve Geliş",
- "aiGameInfoSubHeaderDescription2": "Her oyun kazandığında Pong Puan kazanırsın. Bu puanlarla mağazadan yeni eşyalar, raket ve masalar satın alarak oyun deneyimini geliştirebilirsin.",
- "aiGameInfoSubHeaderText3": "Hemen Başla",
- "aiGameInfoSubHeaderDescription3": "Hesap oluşturarak oyun deneyimini kişiselleştirebilirsin. Bir hesapla istatistiklerini takip edebilir ve sıralamandaki yerini görebilirsin.",
- "aiGameInfoSubHeaderText4": "Daha Fazlası",
- "aiGameInfoSubHeaderDescription4": "Rakiplerinle yüzleşmek ve becerilerini test etmek icin turnuvalara katılabilirsin. Ayrıca arkadaşlarınla özel oyunlar oluşturabilir ve Pong topluluğuna katılabilirsin.",
-
- "aiGameInfoSubHeaderText5": "Kontroller",
- "aiGameInfoSubHeaderDescription5": "Yukarı",
- "aiGameInfoSubHeaderDescription6": "Aşağı",
- "aiGameInfoSubHeaderText6": "Yetenekler",
- "aiGameInfoSubHeaderDescription7": "Bir Hilekar Gibi",
- "aiGameInfoSubHeaderDescription8": "Hızlı ve Öfkeli",
- "aiGameInfoSubHeaderDescription9": "Dondurulmuş Top",
-
- #Local-Game
- "localGamePageTittle": "Yerel Oyun",
- "localGameHeaderText": "1v1 Yerel Oyun",
- "localGamePlayer1Text": "1. Oyuncu Adı",
- "localGamePlayer2Text": "2. Oyuncu Adı",
- "localGameMaxScoreText": "Maksimum Skor",
- "localGameGameModeText": "Oyun Modu",
- "localGameChooseModeText1": "Klasik",
- "localGameChooseModeText2": "Yetenekler",
- "localGameButtonStart": "Başla",
-
- #Local-Tournament
- "localTournamentPageTittle": "Yerel Turnuva",
- "localTournamentGameHeaderText": "Yerel Turnuva",
- "localTournamentPlayer1Text": "1. Oyuncu Adı",
- "localTournamentPlayer2Text": "2. Oyuncu Adı",
- "localTournamentPlayer3Text": "3. Oyuncu Adı",
- "localTournamentPlayer4Text": "4. Oyuncu Adı",
- "localTournamentMaxScoreText": "Maksimum Skor",
- "localTournamentGameModeText": "Oyun Modu",
- "localTournamentChooseModeText1": "Klasik",
- "localTournamentChooseModeText2": "Yetenekler",
- "localTournamentButtonStart": "Başlat & Eşleşme",
- "localTournamentBracketTitle": "Turnuva Eşleşmesi",
- "localTournamentBracketStartButtonText": "Turnuvayı Başlat",
- "localTournamentTournamentOverText": "Turnuva Bitti",
- "localTournamentOverButtonText": "Bitti",
-
- "localTournamentNextButtonText": "Sonraki",
-
- #Tournament
- "tournamentPageTittle": "Turnuva",
- "tournamentHeaderText": "Pong için Turnuva Lobisine Hoş Geldiniz",
- "tournamentSubHeaderText": "Burada bir turnuva lobisine katılabilir veya kendi turnuva lobinizi oluşturabilirsiniz. Odanızı oluşturduktan sonra davet kodunu paylaşarak arkadaşlarınızı davet edebilirsiniz. Unutmadan önce iyi şanslar!",
- "tournamentJoinButtonText": "Turnuvaya Katıl",
- "tournamentCreateButtonText": "Turnuva Oluştur",
-
- #Tournament-Create
- "tournamentCreatePageTittle": "Turnuva Oluştur",
- "tournamentCreateHeaderText": "TURNUVA OLUŞTUR",
- "tournamentCreateSubHeaderText": "Bir turnuva oluşturmak için bir turnuva adına ve her oyunun maksimum kaç puan alacağına ihtiyacım var. Unutmadan önce iyi şanslar!",
- "tournamentCreateNameText": "Turnuva Adı",
- "tournamentCreateMaxPointsText": "Oyun Başına Maksimum Skor",
- "tournamentCreateGameModeText": "Oyun Modu",
- "tournamentCreateChooseModeText1": "Klasik",
- "tournamentCreateChooseModeText2": "Yetenekler",
- "tournamentCreateButtonCreate": "Turnuva Oluştur",
-
- #Joined-Tournament-Room
- "tournamentroomPageTittle": "Turnuva Odası",
- "tournamentroomHeaderText": "Turnuva Odası",
- "tournamentroomRoomText": "Oda",
- "tournamentroomLeaveButtonText": "TURNUVADAN AYRIL",
- "tournamentroomStartButtonText": "TURNUVAYI BAŞLAT",
- "tournamentroomJoinButtonText": "TURNUVAYA KATIL",
- "tournamentCheckBracketButtonText": "BRAKETI GÖRÜNTÜLE",
- "tournamentOverWinnerGuyText": "turnuva bitti ve tahtın tek kişilik hakimi",
- "tournamentOverLosersText": "turnuva bitti ve işte kaybedenler kulübü",
- "tournamentroomTournamentRoomButton": "TURNUVA ODASI",
- "tournamentroomWaitingText": "Bekleniyor,",
- "tournamentroomForPlayerText": " oyuncu...",
-
- #Tournament Room List
- "tournamentRoomListPageTittle": "Turnuva Odaları",
- "tournamentRoomListHeaderText": "Turnuva Odaları",
-
- #Remote Pong Game
- "remotePongGamePageTittle": "Pong Oyunu",
- "remotePongGameTableName": "Ad",
- "remotePongGameTableActions": "Eylemler",
- "remotePongGameMatchmakingButtonText": "EŞLEŞME",
- "remotePongGameLeaveButtonText": "AYRIL",
- "remotePongGameStartText": "Başlamadan önce, oyun modunu seçebilirsin!",
- "remotePongGameStartButtonText": "OYUNU BAŞLAT",
- "remotePongSelectedMode": "Vanilya",
-
-
-
- #RPS Game
- "rpsGamePageTittle": "Taş Kağıt Makas",
- "rpsGameText1": "Taş Taş Kağıt Makas Lobisine Hoş Geldiniz",
- "rpsGameText2": "Yapay Zeka ile oynayarak kendinizi geliştirebilir. Gerçek bir kişiyle oynamak istiyorsanız, diğer seçeneği düşünün; 5 dakika içinde eşleşecek birini bulamazsak, eşleşme iptal edilecektir. Unutmadan önce iyi şanslar!",
- "rpsGameAIButtonText": "Yapay Zeka Oyunu",
- "rpsGameLocalButtonText": "Yerel Oyun",
- "rpsGameSearchOpponentButtonText": "Rakip Arayın ",
- "rpsUserCountText": "şu anda eşleşme arayan kişi sayısı",
-
- #AI-Game
- "rpsGamePageTittle": "RPS Yapay Zeka Oyunu",
- "rpsGameScoreText": "skor",
- "rpsGameRockText": "TAŞ",
- "rpsGamePaperText": "KAĞIT",
- "rpsGameScissorsText": "MAKAS",
- "rpsGamePickedText": "seçtin",
- "rpsGamePickedText2": "rakibin seçti",
- "rpsGameAgainText": "tekrar oyna",
- "rpsGameGameOverText": "Oyun Bitti",
- "rpsGameRestartButtonText": "Yeniden",
- "rpsGameExitButtonText": "Çıkış",
-
-
- #Rankings
- "rankingsPageTittle": "Sıralamalar",
- "rankingsTableRankText": "Sıra",
- "rankingsTableNameText": "Ad",
- "rankingsTableUsernameText": "Kullanıcı Adı",
- "rankingsTableWinsText": "Kazanmalar",
- "rankingsTableLossesText": "Kayıplar",
- "rankingsTableWinRateText": "Kazanma Yüzdesi",
- "rankingsTablePongPointsText": "Pong Puanı",
-
- #Store
- "storePageTittle": "Mağaza",
- "storeText": "Mağaza",
- "storeTagText": "Tümü",
- "storeWalletText": "Cüzdan",
- "storeWalleinfoText1": "Oyun oynayarak ",
- "storeWalleinfoText2": " kazanabilirsin.",
-
- #Inventory
- "inventoryPageTittle": "Envanter",
- "inventoryText": "Envanter",
- "inventoryTagText": "Tümü",
- "inventoryWalletText": "Cüzdan",
- "inventoryWalleinfoText1": "Oyun oynayarak ",
- "inventoryWalleinfoText2": " kazanabilirsin.",
- "inventoryModalHeaderText": "Öğeyi Ayarla",
- "inventoryModalSaveButton": "Kaydet",
- "inventoryModalCloseButton": "Kapat",
- "inventoryItemKeyboardInfoText": "Yetenek kullanmak için",
- "inventoryItemKeyboardInfoText2": "tuşunu kullan. Unutma, bu yeteneği kullanabilmek için kuşanmalısın.",
- "inventoryItemKeyboardInfoText3": "Bu öğe için özel bir tuş takımı yok, otomatik olarak kullanılır.",
-
-
- #Search
- "searchPageTittle": "Arama",
- "searchInputText": "E-posta, kullanıcı adı veya görünen ad ara...",
- "searchMessageButtonText": "Mesaj Gönder",
- "searchFollowButtonText": "Takip Et",
- "searchFollowingButtonText": "Takipten Çık",
-
-
- "searchNoResultFoundText": "Sonuç bulunamadı.",
-
- #Profile
- "profilePageTittle": "Profili",
- "profileRankAIText": "SADECE ROBOTUM",
- "profileRankUserText1": " SIRALAMADA",
- "profileRankUserText2": " SIRALAMA YOK",
- "profileFollowButton": "Takip Et",
- "profileFollowingButton": "Takipten Çık",
- "profileTitleText1": "42 Kocaeli Öğrencisi",
- "profileTitleText2": "Yazılım Geliştirici",
-
- "profileLinkedinSocialText": "LinkedIn Yok",
- "profileGithubSocialText": "Github Yok",
- "profileTwitterSocialText": "Twitter Yok",
- "profileIntra42SocialText": "Intra42 Yok",
-
- "profileMatchHistoryText1": "Rakip",
- "profileMatchHistoryText2": "Sonuç",
- "profileMatchHistoryText3": "Puan",
- "profileMatchHistoryText4": "Süre",
-
- "profileMatchHistoryWinText": "Kazandı",
- "profileMatchHistoryLoseText": "Kaybetti",
-
- "profileRankText1": "Sıra",
- "profileStatsText": "İstatistikler",
-
- "profileGameStats1": "Oynanan Oyunlar:",
- "profileGameStats2": "Kazanmalar:",
- "profileGameStats3": "Kayıplar:",
- "profileGameStats4": "Kazanma Oranı:",
- "profileGameStats5": "Kazanma Serisi:",
- "profileGameStats6": "Ortalama Oyun Süresi:",
-
- #Friends
- "friendsPageTittle": "Arkadaşlar",
- "friendsMessageButtonText": "Mesaj Gönder",
- "friendsNoResultFoundText": "Sonuç bulunamadı.",
-
- #ProfileSettings
- "profileSettingsPageTittle": "Profil Ayarları",
- "profileSettingsNavbar1": "Profili Düzenle",
- "profileSettingsNavbar2": "Şifre Değişitr",
- "profileSettingsNavbar3": "Sosyal Medya Ekle",
- "profileSettingsNavbar4": "Engellenen Kullanıcılar",
- "profileSettingsNavbar5": "Hesabı Kapat",
-
- #Edit-Profile
- "editProfileChangeImageText": "Resmi Değiştir",
- "editProfileUsernameText": "Kullanıcı Adı (sitenin diğer kullanıcıları tarafından nasıl görüneceği)",
- "editProfileUsernameTimeText": "Kullanıcı adınızı her 7 günde bir değiştirebilirsiniz.",
- "editProfileEmailText": "E-posta",
- "editProfile42EmailText": "42 ile oturum açtığınız için e-posta ayarlama özelliği devre dışı bırakılmıştır.",
- "editProfileDisplayNameText": "Görünen Ad",
- "editProfileSaveButtonText": "Değişiklikleri Kaydet",
-
- #Change-Passwordg
- "changePasswordCurrentPasswordText": "Mevcut Şifre",
- "changePasswordNewPasswordText": "Yeni Şifre",
- "changePasswordNewConfirmPasswordText": "Yeni Şifreyi Onayla",
- "changePassword42Text": "42 ile oturum açtığınız için şifre ayarlama özelliği devre dışı bırakılmıştır.",
- "changePasswordSaveButtonText": "Şifreyi Kaydet",
-
- #Add-Socials
- "addSocialsLinkedinInputText": "LinkedIn kullanıcı adınızı girin",
- "addSocialsTwitterInputText": "Twitter kullanıcı adınızı girin",
- "addSocialsGithubInputText": "Github kullanıcı adınızı girin",
- "addSocialsIntraInputText": "42 Intra kullanıcı adınızı girin",
- "addSocialsSaveButtonText": "Sosyal Medyaları Kaydet",
-
- #Blocked-Users
- "blockedUsersHeaderText": "Engellenen Hesaplar",
- "blockedUsersSubHeaderText": "Burada engellediğiniz hesapları açabilirsiniz.",
- "blockedStatusText": "Engellendi",
-
- #Close-Account
- "closeAccountHeaderText": "Hesabı Kapat",
- "closeAccountInputText": "E-posta",
- "closeAccountSubHeaderText": "Burada hesabınızı silebilirsiniz. Bu işlem geri alınamaz.",
- "closeAccountButton": "Hesabı Kapat",
-
-
- }
- return context
-
-
-def get_lang_pt():
- context = {
- #index
- "basePageTittle": "Indian-Pong",
- "baseHeaderText": "Indian-Pong",
- "baseSubHeaderText": "A versão indiana do clássico jogo Pong",
- "basePlayButtonText": "Vamos Comecar!",
-
- "baseInfoHeaderText": "Bem-vindo ao Indian-Pong!",
- "baseInfoHeaderDescription": "Pong traz a emoção e a competição do tênis de mesa clássico para a internet. Nesta plataforma, você pode se divertir, mostrar suas habilidades e subir no ranking para se tornar um dos melhores.",
- "baseInfoSubHeaderText": "Jogue e Ganhe",
- "baseInfoSubHeaderDescription1": "Ganhe Pong Points a cada jogo que vencer para subir no ranking.",
- "baseInfoSubHeaderDescription2": "Use seus ganhos para comprar novos itens, raquetes e mesas da loja para aprimorar sua experiência de jogo.",
- "baseInfoSubHeaderText2": "Comece Agora",
- "baseInfoSubHeaderDescription3": "Crie uma conta para personalizar seu perfil, acompanhar suas estatísticas e ver onde você está no ranking.",
- "baseInfoSubHeaderText3": "Mais Recursos",
- "baseInfoSubHeaderDescription4": "Participe de torneios para enfrentar seus oponentes.",
- "baseInfoSubHeaderDescription5": "Divirta-se com seus amigos hospedando jogos privados.",
- "baseInfoSubHeaderDescription6": "Converse com outros jogadores, compartilhe táticas e participe da comunidade Pong.",
-
- #Login
- "loginPageTittle": "Iniciar sessão",
- "loginHeaderText1": "Bem-vindo,",
- "loginHeaderText2": "faca login para continuar",
- "loginInputUsernameText": "Nome de Usuário",
- "loginInputPasswordText": "Senha",
- "loginForgotPasswordText": "Esqueceu a Senha?",
- "loginButtonLogin": "Vamos lá",
- "loginButtonJoin": "Junte-se",
-
- #404
- "notFoundPageTittle": "Página não encontrada",
- "notFoundHeaderText": "404 ERRO",
- "notFoundSubHeaderText": "Você provavelmente se perdeu em nosso site!",
- "notFoundButtonText": "VENHA PARA CASA",
-
- #Signup
- "signupPageTittle": "Inscreva-se",
- "signupHeaderText1": "Bem-vindo,",
- "signupHeaderText2": "inscreva-se para continuar",
- "signupInputUsernameText": "Nome de Usuário",
- "signupInputDisplayNameText": "Nome de Exibicão",
- "signupInputEmailText": "E-mail",
- "signupInputPasswordText": "Senha",
- "signupInputConfirmPasswordText": "Senha (novamente)",
- "signupImageUploadText": "Imagem",
- "signupGdprText1": "Concordo ",
- "signupGdprText2": "GDPR Política de Privacidade",
- "signupButtonSignup": "Vamos!",
-
- #ForgotPassword
- "forgotPasswordPageTittle": "Esqueceu a Senha",
- "forgotPasswordHeaderText": "Esqueceu a Senha",
- "forgotPasswordInputEmailText": "E-mail",
- "forgotPasswordButtonSend": "Enviar E-mail",
- "forgotPasswordLinkText": "Não tem uma conta?",
- "forgotPasswordLinkButtonText": "Junte-se a Nós",
-
- #Password-Reset-Done
- "passwordResetDonePageTittle": "Email Enviado",
- "passwordResetDoneHeaderText": "EMAIL ENVIADO",
- "passwordResetDoneSubHeaderText": "Enviamos o link de redefinição de senha para o seu e-mail. Por favor, verifique seu e-mail.",
- "passwordResetButtonText": "VOLTAR AO LOGIN",
-
- #ChangePassword
- "changePasswordPageTittle": "Mudar Senha",
- "changePasswordHeaderText": "Mudar Senha",
- "changePassswordSubHeaderText": "alterar a sua palavra-passe",
-
-
- #Dashboard
- "dashboardPageTittle": "Painel",
- "dashboardText1": "Bem-vindo, ",
- "dashboardText2": "O Indian Pong é um projeto colaborativo desenvolvido para a comunidade da escola 42, oferecendo uma experiência de jogo nostálgica através do clássico jogo Atari, Ping-Pong. Esta plataforma permite que os usuários participem de partidas de Ping-Pong uns com os outros, promovendo uma sensacão de competicão amigável. Além do aspecto de jogo, o Indian Pong oferece uma dimensão social, apresentando salas de bate-papo onde os usuários podem se comunicar e se conectar uns com os outros. A plataforma também permite que os usuários expandam sua rede adicionando amigos dentro da comunidade da escola 42. No geral, o Indian Pong combina a alegria dos jogos retrô com a interacão social moderna, criando uma experiência vibrante e interativa para a comunidade da escola 42.",
-
- "dashboardGamesPlayed": "Jogos Jogados",
- "dashboardWinCount": "Contagem de Vitórias",
- "dashboardWinStreak": "Sequência de Vitórias",
- "dashboardLoseStreak": "Sequência de Derrotas",
- "dashboardWinRate": "Taxa de Vitória",
- "dashboardAverageGameDuration": "Duracão Média do Jogo",
- "dashboardAveragePointsWon": "Pontos Médios Ganhos",
- "dashboardAveragePointsLost": "Pontos Médios Perdidos",
-
- #Chat
- "chatPageTittle": "Bate-papo",
- "chatHeaderText": "Bate-papos",
- "chatRecentlyText": "Recentemente",
- "chatDMText": "Mensagens Diretas",
- "chatContainerSelectText": "Selecione um bate-papo para começar a conversar",
- "chatTodayText": "Hoje",
- "chatTypeHereText": "Digite uma mensagem...",
-
-
- #Pong-Game
- "pongGamePageTittle": "Jogo de Pong",
- "pongGameHeaderText": "Bem-vindo ao Lobby de Pong",
- "pongGameSubHeaderText": "Podes melhorar o teu desempenho jogando com a Inteligência Artificial. Se quiseres jogar com uma pessoa real, considera a outra opção; se não encontrarmos alguém com quem jogar no espaço de 5 minutos, o jogo será cancelado. Boa sorte antes que nos esqueçamos!",
- "pongGameAIButtonText": "Jogar com a IA",
- "pongGameLocalButtonText": "Jogo Local",
- "pongGameRemoteButtonText": "Jogador Remoto",
- "pongGameLocalTournamentButtonText": "Locais Torneio",
- "pongGameTournamentButtonText": "Torneio",
-
- #AI-Game
- "aiGamePageTittle": "Jogo de Pong com a IA",
- "aiGameReactionDelayText": "Atraso na Reacão",
- "aiGameGetReadyText": "Prepare-se",
- "aiGameStartButtonText":"Começar",
-
- "aiGameGameOverText": "Fim de Jogo",
- "aiGameRestartButtonText": "Reiniciar",
- "aiGameExitButtonText": "Sair",
-
- "aiGameInfoHeaderText": "Sobre o Jogo",
- "aiGameInfoSubHeaderText": "Como Jogar o Jogo?",
- "aiGameInfoSubHeaderDescription1": "No jogo Pong, os jogadores participam de uma partida de tênis de mesa contra seus oponentes. As teclas W-S (ou as setas cima-baixo) são usadas para controlar a bola.",
- "aiGameInfoSubHeaderText2": "Ganhe e Melhore",
- "aiGameInfoSubHeaderDescription2": "Você ganha Pong Points a cada jogo que vence. Com esses pontos, você pode comprar novos itens, raquetes e mesas da loja para aprimorar sua experiência de jogo.",
- "aiGameInfoSubHeaderText3": "Comece Agora",
- "aiGameInfoSubHeaderDescription3": "Você pode criar uma conta para personalizar sua experiência de jogo. Com uma conta, você pode acompanhar suas estatísticas e ver sua posição no ranking.",
- "aiGameInfoSubHeaderText4": "Mais Recursos",
- "aiGameInfoSubHeaderDescription4": "Você pode participar de torneios para enfrentar seus oponentes e testar suas habilidades. Além disso, você pode criar jogos privados com seus amigos e se juntar à comunidade Pong.",
-
- "aiGameInfoSubHeaderText5": "Controles",
- "aiGameInfoSubHeaderDescription5": "Cima",
- "aiGameInfoSubHeaderDescription6": "Baixo",
- "aiGameInfoSubHeaderText6": "Habilidades",
- "aiGameInfoSubHeaderDescription7": "Como um Trapaceiro",
- "aiGameInfoSubHeaderDescription8": "Veloz e Furioso",
- "aiGameInfoSubHeaderDescription9": "Bola Congelada",
-
- #Local-Game
- "localGamePageTittle": "Jogo Local",
- "localGameHeaderText": "Jogo Local 1v1",
- "localGamePlayer1Text": "Nome do Jogador 1",
- "localGamePlayer2Text": "Nome do Jogador 2",
- "localGameMaxScoreText": "Pontuacão Máxima",
- "localGameGameModeText": "Modo de Jogo",
- "localGameChooseModeText1": "Vanilla",
- "localGameChooseModeText2": "Habilidades",
- "localGameButtonStart": "Iniciar",
-
- #Local-Tournament
- "localTournamentPageTittle": "Torneio Local",
- "localTournamentGameHeaderText": "Torneio Local",
- "localTournamentPlayer1Text": "Nome do Jogador 1",
- "localTournamentPlayer2Text": "Nome do Jogador 2",
- "localTournamentPlayer3Text": "Nome do Jogador 3",
- "localTournamentPlayer4Text": "Nome do Jogador 4",
- "localTournamentMaxScoreText": "Pontuacão Máxima",
- "localTournamentGameModeText": "Modo de Jogo",
- "localTournamentChooseModeText1": "Vanilla",
- "localTournamentChooseModeText2": "Habilidades",
- "localTournamentButtonStart": "Iniciar & Empar.",
- "localTournamentBracketTitle": "Empar. Torneio",
- "localTournamentBracketStartButtonText": "Iniciar Torneio",
- "localTournamentTournamentOverText": "Torneio Terminado",
- "localTournamentOverButtonText": "Terminado",
-
- "localTournamentNextButtonText": "Próximo",
-
- #Tournament
- "tournamentPageTittle": "Torneio",
- "tournamentHeaderText": "Bem-vindo ao Lobby do Torneio de Pong",
- "tournamentSubHeaderText": "Aqui você pode entrar em um lobby de torneio ou criar seu próprio lobby de torneio. Você pode convidar seus amigos compartilhando o código de convite após criar a sala. Boa sorte antes que eu esqueca!",
- "tournamentJoinButtonText": "Entrar no Torneio",
- "tournamentCreateButtonText": "Criar Torneio",
-
- #Tournament-Create
- "tournamentCreatePageTittle": "Criar Torneio",
- "tournamentCreateHeaderText": "CRIAR TORNEIO",
- "tournamentCreateSubHeaderText": "Para criar um torneio, eu preciso de um nome de torneio, quantos pontos máximos cada jogo terá. Boa sorte antes que eu esqueca!",
- "tournamentCreateNameText": "Nome do Torneio",
- "tournamentCreateMaxPointsText": "Pontuacão Máxima dos Jogos",
- "tournamentCreateGameModeText": "Modo de Jogo",
- "tournamentCreateChooseModeText1": "Vanilla",
- "tournamentCreateChooseModeText2": "Habilidades",
- "tournamentCreateButtonCreate": "Criar Torneio",
-
- #Joined-Tournament-Room
- "tournamentroomPageTittle": "Sala de Torneio",
- "tournamentroomHeaderText": "Sala de Torneio",
- "tournamentroomRoomText": "Sala",
- "tournamentroomLeaveButtonText": "SAIR DO TORNEIO",
- "tournamentroomStartButtonText": "INICIAR TORNEIO",
- "tournamentroomJoinButtonText": "ENTRAR NO TORNEIO",
- "tournamentCheckBracketButtonText": "VER BRACKET",
- "tournamentOverWinnerGuyText": "o torneio acabou e o rei da mesa é",
- "tournamentOverLosersText": "o torneio acabou e aqui está o clube dos perdedores",
- "tournamentroomTournamentRoomButton": "SALA DE TORNEIO",
- "tournamentroomWaitingText": "Aguardando,",
- "tournamentroomForPlayerText": "jogadores...",
-
- #Tournament Room List
- "tournamentRoomListPageTittle": "Salas de Torneio",
- "tournamentRoomListHeaderText": "Salas de Torneio",
-
- #Remote Pong Game
- "remotePongGamePageTittle": "Jogo de Pong",
- "remotePongGameTableName": "Nome",
- "remotePongGameTableActions": "Ações",
- "remotePongGameMatchmakingButtonText": "MATCHMAKING",
- "remotePongGameLeaveButtonText": "SAIR",
- "remotePongGameStartText": "Antes de começar, você pode escolher o modo de jogo!",
- "remotePongGameStartButtonText": "INICIAR JOGO",
- "remotePongSelectedMode": "Vanilla",
-
- #RPS Game
- "rpsGamePageTittle": "Pedra, Papel e Tesoura",
- "rpsGameText1": "Bem-vindo ao Lobby de Pedra, Papel e Tesoura",
- "rpsGameText2": "Podes melhorar o teu desempenho jogando com a Inteligência Artificial. Se quiseres jogar com uma pessoa real, considera a outra opção; se não encontrarmos alguém com quem jogar no espaço de 5 minutos, o jogo será cancelado. Boa sorte antes que nos esqueçamos!",
- "rpsGameAIButtonText": "Jogar com a IA",
- "rpsGameLocalButtonText": "Jogo Local",
- "rpsGameSearchOpponentButtonText": "Buscar Oponente ",
- "rpsUserCountText": "Jogadores Online",
-
- #AI-Game
- "rpsGamePageTittle": "Jogo de Pedra, Papel e Tesoura com Inteligência Artificial",
- "rpsGameScoreText": "pontuação",
- "rpsGameRockText": "PEDRA",
- "rpsGamePaperText": "PAPEL",
- "rpsGameScissorsText": "TESOURA",
- "rpsGamePickedText": "escolheste",
- "rpsGamePickedText2": "o adversário escolheu",
- "rpsGameAgainText": "jogar novamente",
- "rpsGameGameOverText": "Jogo Terminado",
- "rpsGameRestartButtonText": "Reiniciar",
- "rpsGameExitButtonText": "Sair",
-
- #Rankings
- "rankingsPageTittle": "Classificacão",
- "rankingsTableRankText": "Classificacão",
- "rankingsTableNameText": "Nome",
- "rankingsTableUsernameText": "Nome de Usuário",
- "rankingsTableWinsText": "Vitórias",
- "rankingsTableLossesText": "Derrotas",
- "rankingsTableWinRateText": "Taxa de Vitória",
- "rankingsTablePongPointsText": "Pontos Pong",
-
- #Store
- "storePageTittle": "Loja",
- "storeText": "Loja",
- "storeTagText": "Tudo",
- "storeWalletText": "Carteira",
- "storeWalleinfoText1": "Você pode ganhar ",
- "storeWalleinfoText2": " jogando.",
-
- #Inventory
- "inventoryPageTittle": "Inventário",
- "inventoryText": "Inventário",
- "inventoryTagText": "Tudo",
- "inventoryWalletText": "Carteira",
- "inventoryWalleinfoText1": "Você pode ganhar ",
- "inventoryWalleinfoText2": " jogando.",
- "inventoryModalHeaderText": "Definir Item",
- "inventoryModalSaveButton": "Salvar",
- "inventoryModalCloseButton": "Fechar",
- "inventoryItemKeyboardInfoText": "Use a tecla",
- "inventoryItemKeyboardInfoText2": "para usar essa habilidade. E lembre-se, você deve equipar essa habilidade.",
- "inventoryItemKeyboardInfoText3": "Este item não tem um teclado personalizado, é usado automaticamente.",
-
-
- #Search
- "searchPageTittle": "Procurar",
- "searchInputText": "Procurar por e-mail, nome de usuário ou nome de exibicão...",
- "searchMessageButtonText": "Mensagem",
- "searchFollowButtonText": "Seguir",
- "searchFollowingButtonText": "Deixar",
- "searchNoResultFoundText": "Nenhum resultado encontrado.",
-
- #Profile
- "profilePageTittle": "Perfil",
- "profileRankAIText": "APENAS ROBÔ",
- "profileRankUserText1": " RANKING",
- "profileRankUserText2": " SEM RANKING",
- "profileFollowButton": "Seguir",
- "profileFollowingButton": "Deixar",
- "profileTitleText1": "Estudante da 42 Kocaeli",
- "profileTitleText2": "Desenvolvedor de Software",
-
- "profileLinkedinSocialText": "Sem LinkedIn",
- "profileGithubSocialText": "Sem Github",
- "profileTwitterSocialText": "Sem Twitter",
- "profileIntra42SocialText": "Sem Intra42",
-
- "profileMatchHistoryText1": "Oponente",
- "profileMatchHistoryText2": "Resultado",
- "profileMatchHistoryText3": "Pontos",
- "profileMatchHistoryText4": "Tempo",
-
- "profileMatchHistoryWinText": "Venceu",
- "profileMatchHistoryLoseText": "Perdeu",
-
- "profileRankText1": "Classificacão",
- "profileStatsText": "Estatísticas",
-
- "profileGameStats1": "Jogos Jogados:",
- "profileGameStats2": "Vitórias:",
- "profileGameStats3": "Derrotas:",
- "profileGameStats4": "Taxa de Vitória:",
- "profileGameStats5": "Sequência de Vitórias:",
- "profileGameStats6": "Duração Média do Jogo:",
-
- #Friends
- "friendsPageTittle": "Amigos",
- "friendsMessageButtonText": "Mensagem",
- "friendsNoResultFoundText": "Nenhum resultado encontrado.",
-
- #ProfileSettings
- "profileSettingsPageTittle": "Configurações do Perfil",
- "profileSettingsNavbar1": "Editar Perfil",
- "profileSettingsNavbar2": "Alterar Senha",
- "profileSettingsNavbar3": "Adicionar Redes Sociais",
- "profileSettingsNavbar4": "Usuários Bloqueados",
- "profileSettingsNavbar5": "Fechar Conta",
-
- #Edit-Profile
- "editProfileChangeImageText": "Alterar Imagem",
- "editProfileUsernameText": "Nome de usuário (como seu nome aparecerá para outros usuários no site)",
- "editProfileUsernameTimeText": "Você pode alterar seu nome de usuário a cada 7 dias.",
- "editProfileEmailText": "Email",
- "editProfile42EmailText": "Como você está logado com 42, o recurso de configuração de e-mail está desativado.",
- "editProfileDisplayNameText": "Nome de Exibição",
- "editProfileSaveButtonText": "Salvar Alterações",
-
- #Change-Password
- "changePasswordCurrentPasswordText": "Senha Atual",
- "changePasswordNewPasswordText": "Nova Senha",
- "changePasswordNewConfirmPasswordText": "Confirmar Nova Senha",
- "changePassword42Text": "Como você está logado com 42, o recurso de configuração de senha está desativado.",
- "changePasswordSaveButtonText": "Salvar Senha",
-
- #Add-Socials
- "addSocialsLinkedinInputText": "Insira seu nome de usuário do LinkedIn",
- "addSocialsTwitterInputText": "Insira seu nome de usuário do Twitter",
- "addSocialsGithubInputText": "Insira seu nome de usuário do Github",
- "addSocialsIntraInputText": "Insira seu nome de usuário do 42 Intra",
- "addSocialsSaveButtonText": "Salvar Redes Sociais",
-
- #Blocked-Users
- "blockedUsersHeaderText": "Contas Bloqueadas",
- "blockedUsersSubHeaderText": "Você pode desbloquear as contas que bloqueou aqui.",
- "blockedStatusText": "Bloqueado",
-
-
- #Close-Account
- "closeAccountHeaderText": "Fechar Conta",
- "closeAccountInputText": "E-mail",
- "closeAccountSubHeaderText": "Você pode excluir sua conta aqui. Esta ação é irreversível.",
- "closeAccountButton": "Fechar Conta",
- }
- return context
-
-def get_lang_hi():
- context = {
- #index
- "basePageTittle": "इंडियन-पॉन्ग",
- "baseHeaderText": "इंडियन-पॉन्ग",
- "baseSubHeaderText": "प्रसिद्ध खेल पॉन्ग का भारतीय संस्करण",
- "basePlayButtonText": "शुरू करें!",
-
- "baseInfoHeaderText": "इंडियन-पॉन्ग में आपका स्वागत है!",
- "baseInfoHeaderDescription": "पॉन्ग इंटरनेट पर क्लासिक टेबल टेनिस खेल के उत्साह और प्रतिस्पर्धा को लाता है। इस प्लेटफ़ॉर्म पर आप मजा कर सकते हैं, अपने कौशल का परिचय दे सकते हैं और शीर्ष में आने के लिए रैंकिंग में चढ़ सकते हैं।",
- "baseInfoSubHeaderText": "खेलें और जीतें",
- "baseInfoSubHeaderDescription1": "जीतने पर प्रत्येक खेल से पॉन्ग पॉइंट्स कमाकर रैंकिंग में चढ़ें।",
- "baseInfoSubHeaderDescription2": "अपनी जीत से नए आइटम, रैकेट और टेबल्स खरीदने के लिए दुकान से खर्च करें।",
- "baseInfoSubHeaderText2": "अभी शुरू करें",
- "baseInfoSubHeaderDescription3": "प्रोफ़ाइल को व्यक्तिगत बनाने, अपने स्टैटिस्टिक्स को ट्रैक करने और रैंकिंग में अपनी जगह देखने के लिए खाता बनाएं।",
- "baseInfoSubHeaderText3": "अधिक सुविधाएं",
- "baseInfoSubHeaderDescription4": "अपने प्रतिद्वंद्वियों के साथ टूर्नामेंट में भाग लेने के लिए।",
- "baseInfoSubHeaderDescription5": "अपने दोस्तों के साथ निजी खेल खेलकर मजा करें।",
- "baseInfoSubHeaderDescription6": "अन्य खिलाड़ियों के साथ चैट करें, रणनीतियाँ साझा करें और पॉन्ग समुदाय में शामिल हों।",
-
- #Login
- "loginPageTittle": "लॉग इन करें",
- "loginHeaderText1": "स्वागत है,",
- "loginHeaderText2": "जारी रखने के लिए साइन इन करें",
- "loginInputUsernameText": "उपयोगकर्ता नाम",
- "loginInputPasswordText": "पासवर्ड",
- "loginForgotPasswordText": "पासवर्ड भूल गए?",
- "loginButtonLogin": "चलो चलते हैं",
- "loginButtonJoin": "हमारे साथ",
-
- #404
- "notFoundPageTittle": "पृष्ठ नहीं मिला",
- "notFoundHeaderText": "404 त्रुटि",
- "notFoundSubHeaderText": "आप शायद हमारी वेबसाइट में खो गए हैं!",
- "notFoundButtonText": "घर वापस जाओ",
-
- #Signup
- "signupPageTittle": "साइन अप करें",
- "signupHeaderText1": "स्वागत है,",
- "signupHeaderText2": "जारी रखने के लिए साइन अप करें",
- "signupInputUsernameText": "उपयोगकर्ता नाम",
- "signupInputDisplayNameText": "डिस्प्ले नाम",
- "signupInputEmailText": "ईमेल",
- "signupInputPasswordText": "पासवर्ड",
- "signupInputConfirmPasswordText": "पासवर्ड (फिर से)",
- "signupImageUploadText": "छवि अपलोड करें",
- "signupGdprText1": "मैं सहमत हूं",
- "signupGdprText2": "GDPR गोपनीयता नीति",
- "signupButtonSignup": "चमकाओ!",
-
- #ForgotPassword
- "forgotPasswordPageTittle": "पासवर्ड भूल गए",
- "forgotPasswordHeaderText": "पासवर्ड भूल गए",
- "forgotPasswordInputEmailText": "ईमेल",
- "forgotPasswordButtonSend": "ईमेल भेजें",
- "forgotPasswordLinkText": "खाता नहीं है?",
- "forgotPasswordLinkButtonText": "हमारे साथ शामिल हों",
-
- #Password-Reset-Done
- "passwordResetDonePageTittle": "ईमेल भेजा गया",
- "passwordResetDoneHeaderText": "ईमेल भेजा गया",
- "passwordResetDoneSubHeaderText": "हमने आपके ईमेल पर पासवर्ड रीसेट लिंक भेज दिया है। कृपया अपने ईमेल की जाँच करें।",
- "passwordResetButtonText": "ईमेल भेजा गया",
-
- #ChangePassword
- "changePasswordPageTittle": "पासवर्ड बदलें",
- "changePasswordHeaderText": "पासवर्ड बदलें",
- "changePassswordSubHeaderText": "अपना पासवर्ड बदलें",
-
-
- #Dashboard
- "dashboardPageTittle": "डैशबोर्ड",
- "dashboardText1": "स्वागत, ",
- "dashboardText2": "इंडियन पॉन्ग एक सहयोगी परियोजना है जो 42 स्कूल समुदाय के लिए विकसित की गई है, जो शास्त्रीय खेल पिंग-पोंग के माध्यम से नोस्टाल्जिक गेमिंग अनुभव प्रदान करता है। यह प्लेटफ़ॉर्म प्रतिद्वंद्वियों के साथ पिंग-पोंग मैच खेलने की अनुमति देता है, जो एक दूसरे के साथ दोस्ताना प्रतिस्पर्धा का मूल्यांकन करता है। खेल के पहले पहल में, इंडियन पॉन्ग को सामाजिक आयाम प्रदान करता है, जिसमें उपयोगकर्ताओं को एक-दूसरे के साथ संवाद करने और जुड़ने का अवसर प्रदान किया जाता है। प्लेटफ़ॉर्म उपयोगकर्ताओं को 42 स्कूल समुदाय के भीतर दोस्तों को जोड़ने की सुविधा भी प्रदान करता है। समग्र रूप में, इंडियन पॉन्ग पुराने गेमिंग का आनंद और आधुनिक सामाजिक आक्रोश जोड़ते हैं, 42 स्कूल समुदाय के लिए एक जीवंत और अंतर्क्रियात्मक अनुभव बनाते हैं।",
-
- "dashboardGamesPlayed": "खेल खेले गए",
- "dashboardWinCount": "जीत की गई बार",
- "dashboardWinStreak": "जीत की रेकार्ड",
- "dashboardLoseStreak": "हार की रेकार्ड",
- "dashboardWinRate": "जीतने की दर",
- "dashboardAverageGameDuration": "औसत खेल की अवधि",
- "dashboardAveragePointsWon": "औसत अंक जीते",
- "dashboardAveragePointsLost": "औसत अंक हारे",
-
- #Chat
- "chatPageTittle": "चैट",
- "chatHeaderText": "चैट",
- "chatRecentlyText": "हाल ही में",
- "chatDMText": "डायरेक्ट मैसेज",
- "chatContainerSelectText": "चैट शुरू करने के लिए एक चैट चुनें",
- "chatTodayText": "आज",
- "chatTypeHereText": "एक संदेश लिखें...",
-
-
- #Pong-Game
- "pongGamePageTittle": "पॉन्ग खेल",
- "pongGameHeaderText": "पॉन्ग लॉबी में आपका स्वागत है",
- "pongGameSubHeaderText": "आप आर्टिफिशियल इंटेलिजेंस के साथ खेलकर खुद को बेहतर बना सकते हैं। यदि आप किसी वास्तविक व्यक्ति के साथ खेलना चाहते हैं, तो दूसरे विकल्प पर विचार करें; यदि हमें 5 मिनट के भीतर मैच के लिए कोई नहीं मिल सका, तो मैच रद्द कर दिया जाएगा। इससे पहले कि मैं भूल जाऊँ, शुभकामनाएँ!",
- "pongGameAIButtonText": "ए.आई. के साथ खेलें",
- "pongGameLocalButtonText": "स्थानीय खेल",
- "pongGameRemoteButtonText": "दूरस्थ खिलाड़ी",
- "pongGameLocalTournamentButtonText": "स्थानीय टूर्नामेंट",
- "pongGameTournamentButtonText": "टूर्नामेंट",
-
- #AI-Game
- "aiGamePageTittle": "ए.आई. के साथ पॉन्ग खेल",
- "aiGameReactionDelayText": "प्रतिक्रिया में देरी",
- "aiGameGetReadyText": "तैयार हो जाओ",
- "aiGameStartButtonText": "शुरू करें",
-
- "aiGameGameOverText": "खेल समाप्त हो गया",
- "aiGameRestartButtonText": "पुनः आरंभ",
- "aiGameExitButtonText": "निकास",
-
- "aiGameInfoHeaderText": "खेल के बारे में",
- "aiGameInfoSubHeaderText": "खेल कैसे खेलें?",
- "aiGameInfoSubHeaderDescription1": "पॉन्ग खेल में खिलाड़ी अपने प्रतिद्वंद्वी के खिलाफ एक टेनिस की मैच खेलते हैं। W-S (या ऊपर-नीचे तीर) तीरों को नियंत्रित करने के लिए उपयोग किया जाता है।",
- "aiGameInfoSubHeaderText2": "जीतें और सुधारें",
- "aiGameInfoSubHeaderDescription2": "आप हर जीते खेल के बाद पॉन्ग पॉइंट्स कमाते हैं। इन पॉइंट्स के साथ आप खेल का अनुभव बेहतर बनाने के लिए दुकान से नए आइटम, रैकेट और टेबल खरीद सकते हैं।",
- "aiGameInfoSubHeaderText3": "अभी शुरू करें",
- "aiGameInfoSubHeaderDescription3": "आप अपने खेल का अनुभव व्यक्तिगत करने के लिए एक खाता बना सकते हैं। एक खाते के साथ, आप अपने स्टैटिस्टिक्स को ट्रैक कर सकते हैं और रैंकिंग में अपनी जगह देख सकते हैं।",
- "aiGameInfoSubHeaderText4": "अधिक सुविधाएं",
- "aiGameInfoSubHeaderDescription4": "आप अपने प्रतिद्वंद्वियों के साथ टूर्नामेंट में भाग लेने के लिए और अपने कौशल का परीक्षण करने के लिए टूर्नामेंट में भाग ले सकते हैं। इसके अलावा, आप अपने दोस्तों के साथ निजी खेल बना सकते हैं और पॉन्ग समुदाय में शामिल हो सकते हैं।",
-
- "aiGameInfoSubHeaderText5": "नियंत्रण",
- "aiGameInfoSubHeaderDescription5": "ऊपर",
- "aiGameInfoSubHeaderDescription6": "नीचे",
- "aiGameInfoSubHeaderText6": "कौशल",
- "aiGameInfoSubHeaderDescription7": "जैसे एक धोखेबाज",
- "aiGameInfoSubHeaderDescription8": "तेज और उत्तेजित",
- "aiGameInfoSubHeaderDescription9": "जमीन गेंद",
-
- #Local-Game
- "localGamePageTittle": "स्थानीय खेल",
- "localGameHeaderText": "1v1 स्थानीय खेल",
- "localGamePlayer1Text": "प्लेयर1 नाम",
- "localGamePlayer2Text": "प्लेयर2 नाम",
- "localGameMaxScoreText": "अधिकतम स्कोर",
- "localGameGameModeText": "खेल मोड",
- "localGameChooseModeText1": "वनिला",
- "localGameChooseModeText2": "क्षमताएँ",
- "localGameButtonStart": "प्रारंभ करें",
-
- #Local-Tournament
- "localTournamentPageTittle": "स्थानीय टूर्नामेंट",
- "localTournamentGameHeaderText": "स्थानीय टूर्नामेंट",
- "localTournamentPlayer1Text": "1. खिलाड़ी नाम",
- "localTournamentPlayer2Text": "2. खिलाड़ी नाम",
- "localTournamentPlayer3Text": "3. खिलाड़ी नाम",
- "localTournamentPlayer4Text": "4. खिलाड़ी नाम",
- "localTournamentMaxScoreText": "अधिकतम स्कोर",
- "localTournamentGameModeText": "खेल मोड",
- "localTournamentChooseModeText1": "वनिला",
- "localTournamentChooseModeText2": "क्षमताएँ",
- "localTournamentButtonStart": "टूर्नामेंट शुरू करें",
- "localTournamentBracketTitle": "ब्रैकेट",
- "localTournamentBracketStartButtonText": "टूर्नामेंट शुरू करें",
- "localTournamentTournamentOverText": "टूर्नामेंट खत्म हो गया",
- "localTournamentOverButtonText": "खत्म करें",
-
-
- "localTournamentNextButtonText": "अगला",
-
- #Tournament
- "tournamentPageTittle": "टूर्नामेंट",
- "tournamentHeaderText": "पॉन्ग के टूर्नामेंट लॉबी में आपका स्वागत है",
- "tournamentSubHeaderText": "यहां आप एक टूर्नामेंट लॉबी में शामिल हो सकते हैं या अपनी खुद की टूर्नामेंट लॉबी बना सकते हैं। आप अपने दोस्तों को रुम बनाने के बाद इनवाइट कोड साझा करके इन्वाइट कर सकते हैं। भूलने से पहले शुभकामनाएं!",
- "tournamentJoinButtonText": "टूर्नामेंट में शामिल हों",
- "tournamentCreateButtonText": "टूर्नामेंट बनाएं",
-
- #Tournament-Create
- "tournamentCreatePageTittle": "टूर्नामेंट बनाएं",
- "tournamentCreateHeaderText": "टूर्नामेंट बनाएं",
- "tournamentCreateSubHeaderText": "एक टूर्नामेंट बनाने के लिए मुझे एक टूर्नामेंट का नाम, हर खेल के लिए कितना अधिकतम स्कोर होगा। भूलने से पहले शुभकामनाएं!",
- "tournamentCreateNameText": "टूर्नामेंट का नाम",
- "tournamentCreateMaxPointsText": "अधिकतम स्कोर खेलें",
- "tournamentCreateGameModeText": "खेल मोड",
- "tournamentCreateChooseModeText1": "वनिला",
- "tournamentCreateChooseModeText2": "क्षमताएँ",
- "tournamentCreateButtonCreate": "टूर्नामेंट बनाएं",
-
- #Joined-Tournament-Room
- "tournamentroomPageTittle": "टूर्नामेंट रूम",
- "tournamentroomHeaderText": "टूर्नामेंट रूम",
- "tournamentroomLeaveButtonText": "छोड़ें",
- "tournamentroomRoomText": "रूम",
- "tournamentroomStartButtonText": "शुरू करें",
- "tournamentroomJoinButtonText": "शामिल हों",
- "tournamentCheckBracketButtonText": "ब्रैकेट देखें",
- "tournamentOverWinnerGuyText": "विजेता",
- "tournamentOverLosersText": "हारने वाले",
- "tournamentroomTournamentRoomButton": "टूर्नामेंट रूम",
- "tournamentroomWaitingText": "इंतजार कर",
- "tournamentroomForPlayerText": "खिलाड़ी ",
-
- #Tournament Room List
- "tournamentRoomListPageTittle": "टूर्नामेंट रूम सूची",
- "tournamentRoomListHeaderText": "टूर्नामेंट रूम सूची",
-
- #Remote Pong Game
- "remotePongGamePageTittle": "दूरस्थ पॉन्ग खेल",
- "remotePongGameTableName": "नाम",
- "remotePongGameTableActions": "कार्रवाई",
- "remotePongGameMatchmakingButtonText": "मैचमेकिंग",
- "remotePongGameLeaveButtonText": "छोड़ें",
- "remotePongGameStartText": "शुरू करें",
- "remotePongGameStartButtonText": "शुरू करें",
- "remotePongSelectedMode": "चयनित मोड",
-
-
-
- #RPS Game
- "rpsGamePageTittle": "रॉक-पेपर-सैंड खेल",
- "rpsGameText1": "रॉक-पेपर-सैंड लॉबी में आपका स्वागत है",
- "rpsGameText2": "आप आर्टिफिशियल इंटेलिजेंस के साथ खेलकर खुद को बेहतर बना सकते हैं। यदि आप किसी वास्तविक व्यक्ति के साथ खेलना चाहते हैं, तो दूसरे विकल्प पर विचार करें; यदि हमें 5 मिनट के भीतर मैच के लिए कोई नहीं मिल सका, तो मैच रद्द कर दिया जाएगा। इससे पहले कि मैं भूल जाऊँ, शुभकामनाएँ!",
- "rpsGameAIButtonText": "ए.आई. के साथ खेलें",
- "rpsGameLocalButtonText": "स्थानीय खेल",
- "rpsGameSearchOpponentButtonText": "विरोधी खोजें ",
- "rpsUserCountText": "उपयोगकर्ता",
- #AI-Game
- "rpsGamePageTittle": "रॉक कागज कैंची आर्टिफिशियल इंटेलिजेंस गेम",
- "rpsGameScoreText": "स्कोर",
- "rpsGameRockText": "पत्थर",
- "rpsGamePaperText": "कागज",
- "rpsGameScissorsText": "कैंची",
- "rpsGamePickedText": "तुमने चुना",
- "rpsGamePickedText2": "विरोधी चुना",
- "rpsGameAgainText": "फिर से खेलें",
- "rpsGameGameOverText": "खेल समाप्त",
- "rpsGameRestartButtonText": "फिर से शुरू करें",
- "rpsGameExitButtonText": "बाहर जाएं",
-
-
- #Rankings
- "rankingsPageTittle": "रैंकिंग",
- "rankingsTableRankText": "रैंक",
- "rankingsTableNameText": "नाम",
- "rankingsTableUsernameText": "उपयोगकर्ता नाम",
- "rankingsTableWinsText": "जीतें",
- "rankingsTableLossesText": "हारें",
- "rankingsTableWinRateText": "जीतने की दर",
- "rankingsTablePongPointsText": "पॉन्ग अंक",
-
- #Store
- "storePageTittle": "दुकान",
- "storeText": "दुकान",
- "storeTagText": "सभी",
- "storeWalletText": "वॉलेट",
- "storeWalleinfoText1": "खेल खेलकर ",
- "storeWalleinfoText2": " जीत सकते हैं।",
-
- #Inventory
- "inventoryPageTittle": "इन्वेंटरी",
- "inventoryText": "इन्वेंटरी",
- "inventoryTagText": "सभी",
- "inventoryWalletText": "वॉलेट",
- "inventoryWalleinfoText1": "खेल खेलकर ",
- "inventoryWalleinfoText2": " जीत सकते हैं।",
- "inventoryModalHeaderText": "आइटम खरीदें",
- "inventoryModalSaveButton": "खरीदें",
- "inventoryModalCloseButton": "बंद करें",
- "inventoryItemKeyboardInfoText": "उपयोग",
- "inventoryItemKeyboardInfoText2": "इस आइटम के लिए कोई विशेष कीपैड नहीं है, यह स्वचालित रूप से उपयोग किया जाता है।",
- "inventoryItemKeyboardInfoText3": "इस आइटम के लिए कोई विशेष कीपैड नहीं है, यह स्वचालित रूप से उपयोग किया जाता है।",
-
-
- #Search
- "searchPageTittle": "खोजें",
- "searchInputText": "ईमेल या उपयोगकर्ता नाम या डिस्प्ले नाम खोजें...",
- "searchMessageButtonText": "संदेश",
- "searchFollowButtonText": "अनुसरण करना",
- "searchFollowingButtonText": "अनफ़ॉलो",
- "searchNoResultFoundText": "कोई परिणाम नहीं मिला।",
-
- #Profile
- "profilePageTittle": "प्रोफ़ाइल",
- "profileRankAIText": "ए.आई. रैंक",
- "profileRankUserText1": " उपयोगकर्ता रैंक",
- "profileRankUserText2": " रैंक",
- "profileFollowButton": "अनुसरण करना",
- "profileFollowingButton": "अनफ़ॉलो",
- "profileTitleText1": "42 स्कूल समुदाय",
- "profileTitleText2": "पॉन्ग खिलाड़ी",
-
- "profileLinkedinSocialText": "कोई लिंक्डइन नहीं",
- "profileTwitterSocialText": "कोई ट्विटर नहीं",
- "profileGithubSocialText": "कोई गिटहब नहीं",
- "profileIntra42SocialText": "कोई इंट्रा नहीं",
-
- "profileMatchHistoryText1": "प्रतिद्वंद्वी",
- "profileMatchHistoryText2": "परिणाम",
- "profileMatchHistoryText3": "अंक",
- "profileMatchHistoryText4": "अवधि",
-
- "profileMatchHistoryWinText": "जीता",
- "profileMatchHistoryLoseText": "हारा",
-
- "profileRankText1": "रैंक",
- "profileStatsText": "आंकड़े",
-
- "profileGameStats1": "खेल खेले गए:",
- "profileGameStats2": "जीतें:",
- "profileGameStats3": "हारें:",
- "profileGameStats4": "जीतने की दर:",
- "profileGameStats5": "औसत अंक जीते:",
- "profileGameStats6": "औसत अंक हारे:",
-
- #Friends
- "friendsPageTittle": "मित्र",
- "friendsMessageButtonText": "संदेश",
- "friendsNoResultFoundText": "कोई परिणाम नहीं मिला।",
-
-
- #ProfileSettings
- "profileSettingsPageTittle": "प्रोफ़ाइल सेटिंग्स",
- "profileSettingsNavbar1": "प्रोफ़ाइल संपादित करें",
- "profileSettingsNavbar2": "पासवर्ड बदलें",
- "profileSettingsNavbar3": "सोशल्स जोड़ें",
- "profileSettingsNavbar4": "अवरुद्ध उपयोगकर्ता",
- "profileSettingsNavbar5": "खाता बंद करें",
-
- #Edit-Profile
- "editProfileChangeImageText": "छवि बदलें",
- "editProfileUsernameText": "उपयोगकर्ता नाम (आपका नाम साइट पर अन्य उपयोगकर्ताओं के लिए कैसे दिखाई देगा)",
- "editProfileUsernameTimeText": "आप अपना उपयोगकर्ता नाम एक बार बदल सकते हैं।",
- "editProfileEmailText": "ईमेल",
- "editProfile42EmailText": "चूंकि आप 42 के साथ लॉग इन हैं, आपकी ईमेल सेटिंग सुविधा अक्षम है।",
- "editProfileDisplayNameText": "प्रदर्शन नाम",
- "editProfileSaveButtonText": "परिवर्तन सहेजें",
-
- #Change-Password
- "changePasswordCurrentPasswordText": "वर्तमान पासवर्ड",
- "changePasswordNewPasswordText": "नया पासवर्ड",
- "changePasswordNewConfirmPasswordText": "नया पासवर्ड पुष्टि करें",
- "changePassword42Text": "चूंकि आप 42 के साथ लॉग इन हैं, आपकी पासवर्ड सेटिंग सुविधा अक्षम है।",
- "changePasswordSaveButtonText": "पासवर्ड सहेजें",
-
- #Add-Socials
- "addSocialsLinkedinInputText": "अपना LinkedIn उपयोगकर्ता नाम दर्ज करें",
- "addSocialsTwitterInputText": "अपना Twitter उपयोगकर्ता नाम दर्ज करें",
- "addSocialsGithubInputText": "अपना Github उपयोगकर्ता नाम दर्ज करें",
- "addSocialsIntraInputText": "अपना 42 Intra उपयोगकर्ता नाम दर्ज करें",
- "addSocialsSaveButtonText": "सोशल्स सहेजें",
-
- #Blocked-Users
- "blockedUsersHeaderText": "अवरुद्ध खाते",
- "blockedUsersSubHeaderText": "आप यहां अपने द्वारा अवरुद्ध किए गए खातों को अनवरोधित कर सकते हैं।",
- "blockedStatusText": "अवरुद्ध",
-
- #Close-Account
- "closeAccountHeaderText": "खाता बंद करें",
- "closeAccountInputText": "ईमेल",
- "closeAccountSubHeaderText": "आप यहां अपना खाता हटा सकते हैं। यह कार्रवाई अपरिवर्तनीय है।",
- "closeAccountButton": "खाता बंद करें",
-
- }
+def get_langs(lang):
+ if lang == "en":
+ return get_lang_en()
+ if lang == "hi":
+ return get_lang_hi()
+ if lang == "tr":
+ return get_lang_tr()
+ if lang == "pt":
+ return get_lang_pt()
+
+
+def get_lang_en():
+ context = {
+ #index
+ "basePageTittle": "Indian-Pong",
+ "baseHeaderText": "Indian-Pong",
+ "baseSubHeaderText": "Indian-Pong created for 42 school by Indian Dev!",
+ "basePlayButtonText": "Get Started!",
+
+ "baseInfoHeaderText": "Welcome to Indian-Pong!",
+ "baseInfoHeaderDescription": "Pong brings the excitement and competition of classic table tennis to the internet. On this platform, you can have fun, showcase your skills, and rise in the rankings to become one of the best.",
+ "baseInfoSubHeaderText": "Play and Win",
+ "baseInfoSubHeaderDescription1": "Gain Pong Points with each game you win to climb the ranks.",
+ "baseInfoSubHeaderDescription2": "Use your earnings to purchase new items, rackets, and tables from the store to enhance your gaming experience.",
+ "baseInfoSubHeaderText2": "Get Started Now",
+ "baseInfoSubHeaderDescription3": "Create an account to personalize your profile, track your statistics, and see where you stand in the rankings.",
+ "baseInfoSubHeaderText3": "More Features",
+ "baseInfoSubHeaderDescription4": "Participate in tournaments to face off against your opponents.",
+ "baseInfoSubHeaderDescription5": "Enjoy quality time with your friends by hosting private games.",
+ "baseInfoSubHeaderDescription6": "Chat with other players, share tactics, and join the Pong community.",
+
+ #Login
+ "loginPageTittle": "Login",
+ "loginHeaderText1": "Welcome,",
+ "loginHeaderText2": "sign in to continue",
+ "loginInputUsernameText": "Username",
+ "loginInputPasswordText": "Password",
+ "loginForgotPasswordText": "Forgot Password?",
+ "loginButtonLogin": "Let's go",
+ "loginButtonJoin": "Join Us",
+
+ #404
+ "notFoundPageTittle": "404 Not Found",
+ "notFoundHeaderText": "404 ERROR",
+ "notFoundSubHeaderText": "Probably you lost in our website!",
+ "notFoundButtonText": "GO HOME",
+
+ #Signup
+ "signupPageTittle": "Sign Up",
+ "signupHeaderText1": "Welcome,",
+ "signupHeaderText2": "sign up to continue",
+ "signupInputUsernameText": "Username",
+ "signupInputDisplayNameText": "Display Name",
+ "signupInputEmailText": "Email",
+ "signupInputPasswordText": "Password",
+ "signupInputConfirmPasswordText": "Password (again)",
+ "signupImageUploadText": "Upload Image",
+ "signupGdprText1": "I accept the",
+ "signupGdprText2": "GDPR Privacy Policy",
+ "signupButtonSignup": "Let's shine!",
+
+ #ForgotPassword
+ "forgotPasswordPageTittle": "Forgot Password",
+ "forgotPasswordHeaderText": "Forgot Password",
+ "forgotPasswordInputEmailText": "Email",
+ "forgotPasswordButtonSend": "Send Email",
+ "forgotPasswordLinkText": "Don't have an account?",
+ "forgotPasswordLinkButtonText": "Join Us",
+
+ #Password-Reset-Done
+ "passwordResetDonePageTittle": "Email Send Done",
+ "passwordResetDoneHeaderText": "EMAIL SEND DONE",
+ "passwordResetDoneSubHeaderText": "We have emailed your password reset link. Please check your email.",
+ "passwordResetButtonText": "GO LOGIN",
+
+ #ChangePassword
+ "changePasswordPageTittle": "Change Password",
+ "changePasswordHeaderText": "Change Password",
+ "changePassswordSubHeaderText": "change your password",
+
+ #Dashboard
+ "dashboardPageTittle": "Dashboard",
+ "dashboardText1": "Welcome, ",
+ "dashboardText2": "Indian Pong is a collaborative project developed for the 42 school community, offering a nostalgic gaming experience through the classic Atari game, Ping-Pong. This platform allows users to engage in Ping-Pong matches with each other, fostering a sense of friendly competition. In addition to the gaming aspect, Indian Pong provides a social dimension, featuring chat rooms where users can communicate and connect with one another. The platform also enables users to expand their network by adding friends within the 42 school community. Overall, Indian Pong combines the joy of retro gaming with modern social interaction, creating a vibrant and interactive experience for the 42 school community.",
+
+ "dashboardGamesPlayed": "Games Played",
+ "dashboardWinCount": "Win Count",
+ "dashboardWinStreak": "Win Streak",
+ "dashboardLoseStreak": "Lose Streak",
+ "dashboardWinRate": "Win Rate",
+ "dashboardAverageGameDuration": "Average Game Duration",
+ "dashboardAveragePointsWon": "Average Points Won",
+ "dashboardAveragePointsLost": "Average Points Lost",
+
+ #Chat
+ "chatPageTittle": "Chat",
+ "chatHeaderText": "Chats",
+ "chatRecentlyText": "Recently",
+ "chatDMText": "Direct Messages",
+ "chatContainerSelectText": "Select a chat to start messaging",
+ "chatTodayText": "Today",
+ "chatTypeHereText": "Type a message here...",
+
+
+ #Pong-Game
+ "pongGamePageTittle": "Pong Game",
+ "pongGameHeaderText": "Welcome to Pong Lobby",
+ "pongGameSubHeaderText": "You can improve yourself by playing with Artificial Intelligence. If you want to play with a real person, consider the other option; if we don't find someone to match with in 5 minutes, the match will be canceled. Good luck before we forget!",
+ "pongGameAIButtonText": "Play with AI",
+ "pongGameLocalButtonText": "Local Game",
+ "pongGameRemoteButtonText": "Remote Player",
+ "pongGameLocalTournamentButtonText": "Local Tournament",
+ "pongGameTournamentButtonText": "Tournament",
+
+ #AI-Game
+ "aiGamePageTittle": "AI Game",
+ "aiGameReactionDelayText": "Reaction Delay",
+ "aiGameGetReadyText": "Get Ready",
+ "aiGameStartButtonText": "Start",
+
+ "aiGameGameOverText": "Game Over",
+ "aiGameRestartButtonText": "Restart",
+ "aiGameExitButtonText": "Exit",
+
+ "aiGameInfoHeaderText": "About the Game",
+ "aiGameInfoSubHeaderText": "How to Play the Game?",
+ "aiGameInfoSubHeaderDescription1": "In Pong game, players engage in a table tennis match against their opponents. The W-S keys (or up-down arrow keys) are used to control the ball.",
+ "aiGameInfoSubHeaderText2": "Win and Improve",
+ "aiGameInfoSubHeaderDescription2": "You earn Pong Points with every game you win. With these points, you can purchase new items, rackets, and tables from the store to enhance your gaming experience.",
+ "aiGameInfoSubHeaderText3": "Get Started Now",
+ "aiGameInfoSubHeaderDescription3": "You can create an account to personalize your gaming experience. With an account, you can track your statistics and see your position in the rankings.",
+ "aiGameInfoSubHeaderText4": "More Features",
+ "aiGameInfoSubHeaderDescription4": "You can participate in tournaments to face off against your opponents and test your skills. Additionally, you can create private games with your friends and join the Pong community.",
+
+ "aiGameInfoSubHeaderText5": "Controls",
+ "aiGameInfoSubHeaderDescription5": "Up",
+ "aiGameInfoSubHeaderDescription6": "Down",
+ "aiGameInfoSubHeaderText6": "Skills",
+ "aiGameInfoSubHeaderDescription7": "Like a Cheater",
+ "aiGameInfoSubHeaderDescription8": "Fast and Furious",
+ "aiGameInfoSubHeaderDescription9": "Frozen Ball",
+
+ #Local-Game
+ "localGamePageTittle": "Local Game",
+ "localGameHeaderText": "1v1 Local Game",
+ "localGamePlayer1Text": "Player1 Name",
+ "localGamePlayer2Text": "Player2 Name",
+ "localGameMaxScoreText": "Max Score",
+ "localGameGameModeText": "Game Mode",
+ "localGameChooseModeText1": "Vanilla",
+ "localGameChooseModeText2": "Abilities",
+ "localGameButtonStart": "Start",
+
+ #Local-Tournament
+ "localTournamentPageTittle": "Local Tournament",
+ "localTournamentGameHeaderText": "Local Tournament",
+ "localTournamentPlayer1Text": "Player1 Name",
+ "localTournamentPlayer2Text": "Player2 Name",
+ "localTournamentPlayer3Text": "Player3 Name",
+ "localTournamentPlayer4Text": "Player4 Name",
+ "localTournamentMaxScoreText": "Max Score",
+ "localTournamentGameModeText": "Game Mode",
+ "localTournamentChooseModeText1": "Vanilla",
+ "localTournamentChooseModeText2": "Abilities",
+ "localTournamentButtonStart": "Start & Bracket",
+ "localTournamentBracketTitle": "Tournament Bracket",
+ "localTournamentBracketStartButtonText": "Start Tournament",
+ "localTournamentTournamentOverText": "Tournament Over",
+ "localTournamentOverButtonText": "Over",
+
+ "localTournamentNextButtonText": "Next",
+
+
+ #Tournament
+ "tournamentPageTittle": "Tournament",
+ "tournamentHeaderText": "Welcome to Tournament Lobby for Pong",
+ "tournamentSubHeaderText": "Here you can join a tournament lobby or create your own tournament lobby. You can invite your friends by sharing the invite code after creating the room. Good luck before I forget!",
+ "tournamentJoinButtonText": "Join Tournament",
+ "tournamentCreateButtonText": "Create Tournament",
+
+ #Tournament-Create
+ "tournamentCreatePageTittle": "Create Tournament",
+ "tournamentCreateHeaderText": "CREATE TOURNAMENT",
+ "tournamentCreateSubHeaderText": "To create a tournament I need a tournament name, how many max points each game will have. Good luck before I forget!",
+ "tournamentCreateNameText": "Tournament Name",
+ "tournamentCreateMaxPointsText": "Max Score Games",
+ "tournamentCreateGameModeText": "Game Mode",
+ "tournamentCreateChooseModeText1": "Vanilla",
+ "tournamentCreateChooseModeText2": "Abilities",
+ "tournamentCreateButtonCreate": "Create Tournament",
+
+ #Joined-Tournament-Room
+ "tournamentroomPageTittle": "Tournament Room",
+ "tournamentroomHeaderText": "Tournament Room",
+ "tournamentroomRoomText": "Room",
+ "tournamentroomLeaveButtonText": "LEAVE TOURNAMENT",
+ "tournamentroomStartButtonText": "START TOURNAMENT",
+ "tournamentroomJoinButtonText": "JOIN TOURNAMENT",
+ "tournamentCheckBracketButtonText": "CHECK BRACKET",
+ "tournamentOverWinnerGuyText": "the tournament is over and the only person worthy of this throne",
+ "tournamentOverLosersText": "the tournament is over and these are the losers club",
+ "tournamentroomTournamentRoomButton": "TOURNAMENT ROOM",
+ "tournamentroomWaitingText": "Waiting",
+ "tournamentroomForPlayerText": "for player...",
+
+ #Tournament Room List
+ "tournamentRoomListPageTittle": "Tournament Rooms",
+ "tournamentRoomListHeaderText": "Tournament Rooms",
+
+ #Remote Pong Game
+ "remotePongGamePageTittle": "Remote Pong Game",
+ "remotePongGameTableName": "Name",
+ "remotePongGameTableActions": "Actions",
+ "remotePongGameMatchmakingButtonText": "MATCHMAKING",
+ "remotePongGameLeaveButtonText": "LEAVE",
+ "remotePongGameStartText": "Before to start, u can choose game mode!",
+ "remotePongGameStartButtonText": "START GAME",
+ "remotePongSelectedMode": "Vanilla",
+
+
+ #RPS Game
+ "rpsGamePageTittle": "Rock Paper Scissors",
+ "rpsGameText1": "Welcome to RPS Lobby",
+ "rpsGameText2": "You can improve yourself by playing with Artificial Intelligence. If you want to play with a real person, consider the other option; if we don't find someone to match with in 5 minutes, the match will be canceled. Good luck before we forget!",
+ "rpsGameAIButtonText": "Play with AI",
+ "rpsGameLocalButtonText": "Local Game",
+ "rpsGameSearchOpponentButtonText": "Search Opponent ",
+ "rpsUserCountText": "number of people looking for a match right now",
+
+ #AI-Game
+ "rpsGamePageTittle": "RPS Game with Artificial Intelligence",
+ "rpsGameScoreText": "score",
+ "rpsGameRockText": "ROCK",
+ "rpsGamePaperText": "PAPER",
+ "rpsGameScissorsText": "SCISSORS",
+ "rpsGamePickedText": "you picked",
+ "rpsGamePickedText2": "the house picked",
+ "rpsGameAgainText": "Play again",
+ "rpsGameGameOverText": "Game Over",
+ "rpsGameRestartButtonText": "Restart",
+ "rpsGameExitButtonText": "Exit",
+
+ #Rankings
+ "rankingsPageTittle": "Rankings",
+ "rankingsTableRankText": "Rank",
+ "rankingsTableNameText": "Name",
+ "rankingsTableUsernameText": "Username",
+ "rankingsTableWinsText": "Wins",
+ "rankingsTableLossesText": "Losses",
+ "rankingsTableWinRateText": "Win Rate",
+ "rankingsTablePongPointsText": "Pong Point",
+
+ #Store
+ "storePageTittle": "Store",
+ "storeText": "Store",
+ "storeTagText": "All",
+ "storeWalletText": "Wallet",
+ "storeWalleinfoText1": "Oyun oynayarak ",
+ "storeWalleinfoText2": " kazanabilirsin.",
+
+ #Inventory
+ "inventoryPageTittle": "Inventory",
+ "inventoryText": "Inventory",
+ "inventoryTagText": "All",
+ "inventoryWalletText": "Wallet",
+ "inventoryWalleinfoText1": " playing games",
+ "inventoryWalleinfoText2": " can win.",
+ "inventoryModalHeaderText": "Set Featured Item",
+ "inventoryModalSaveButton": "Save",
+ "inventoryModalCloseButton": "Close",
+ "inventoryItemKeyboardInfoText": "Use the",
+ "inventoryItemKeyboardInfoText2": "key to use this ability. And remember, you must equip this ability.",
+ "inventoryItemKeyboardInfoText3": "There is no special keypad for this item, it is used automatically.",
+
+ #Search
+ "searchPageTittle": "Search",
+ "searchInputText": "Email or Username or Displayname Search...",
+ "searchMessageButtonText": "Message",
+ "searchFollowButtonText": "Follow",
+ "searchFollowingButtonText": "Unfollow",
+ "searchNoResultFoundText": "No result found.",
+
+ #Profile
+ "profilePageTittle": "Profile",
+ "profileRankAIText": "I'M JUST ROBOT",
+ "profileRankUserText1": " IN RANKINGS",
+ "profileRankUserText2": " NO RANKING",
+ "profileFollowButton": "Follow",
+ "profileFollowingButton": "Unfollow",
+ "profileTitleText1": "42 Kocaeli Student",
+ "profileTitleText2": "Software Developer",
+
+ "profileLinkedinSocialText": "No Linkedin",
+ "profileGithubSocialText": "No Github",
+ "profileTwitterSocialText": "No Twitter",
+ "profileIntra42SocialText": "No Intra42",
+
+ "profileMatchHistoryText1": "Opponent",
+ "profileMatchHistoryText2": "Result",
+ "profileMatchHistoryText3": "Score",
+ "profileMatchHistoryText4": "Duration",
+
+ "profileMatchHistoryWinText": "Win",
+ "profileMatchHistoryLoseText": "Lose",
+
+ "profileRankText1": "Rank",
+ "profileStatsText": "Stats",
+
+ "profileGameStats1": "Games Played:",
+ "profileGameStats2": "Wins:",
+ "profileGameStats3": "Loses:",
+ "profileGameStats4": "Win Rate:",
+ "profileGameStats5": "Win Streak:",
+ "profileGameStats6": "Average Game Duration:",
+
+ #Friends
+ "friendsPageTittle": "Friends",
+ "friendsMessageButtonText": "Message",
+ "friendsNoResultFoundText": "No result found.",
+
+ #ProfileSettings
+ "profileSettingsPageTittle": "Profile Settings",
+ "profileSettingsNavbar1": "Edit Profile",
+ "profileSettingsNavbar2": "Change Password",
+ "profileSettingsNavbar3": "Add Socials",
+ "profileSettingsNavbar4": "Blocked Users",
+ "profileSettingsNavbar5": "Close Account",
+
+ #Edit-Profile
+ "editProfileChangeImageText": "Change Image",
+ "editProfileUsernameText": "Username (how your name will appear to other users on the site)",
+ "editProfileUsernameTimeText": "You can change your username every 7 days.",
+ "editProfileEmailText": "Email",
+ "editProfile42EmailText": "Since you are logged in with 42, your email setting feature is disabled.",
+ "editProfileDisplayNameText": "Display Name",
+ "editProfileSaveButtonText": "Save Changes",
+
+ #Change-Passwordg
+ "changePasswordCurrentPasswordText": "Current Password",
+ "changePasswordNewPasswordText": "New Password",
+ "changePasswordNewConfirmPasswordText": "Confirm New Password",
+ "changePassword42Text": "Since you are logged in with 42, your password setting feature is disabled.",
+ "changePasswordSaveButtonText": "Save Password",
+
+ #Add-Socials
+ "addSocialsLinkedinInputText": "Enter your LinkedIn username",
+ "addSocialsTwitterInputText": "Enter your Twitter username",
+ "addSocialsGithubInputText": "Enter your Github username",
+ "addSocialsIntraInputText": "Enter your 42 Intra username",
+ "addSocialsSaveButtonText": "Save Socials",
+
+ #Blocked-Users
+ "blockedUsersHeaderText": "Blocked Accounts",
+ "blockedUsersSubHeaderText": "You can unblock the accounts you have blocked here.",
+ "blockedStatusText": "Blocked",
+
+ #Close-Account
+ "closeAccountHeaderText": "Close Account",
+ "closeAccountInputText": "Email",
+ "closeAccountSubHeaderText": "You can delete your account here. This action is irreversible.",
+ "closeAccountButton": "Close Account",
+
+
+ }
+ return context
+
+def get_lang_tr():
+ context = {
+ #index
+ "basePageTittle": "Indian-Pong",
+ "baseHeaderText": "Indian-Pong",
+ "baseSubHeaderText": "Indian-Pong Hintli geliştiriciler tarafından 42 okulu için geliştirilmiştir!",
+ "basePlayButtonText": "YOLCULUĞA BAŞLA!",
+
+ "baseInfoHeaderText": "Indian-Pong'a hoş geldiniz!",
+ "baseInfoHeaderDescription": "Pong, klasik masa tenisi oyununun heyecanını ve rekabetini internet ortamına taşıyor. Bu platformda hem eğlenebilir hem de yeteneğini konuşturabilir, sıralamada yükselip en iyiler arasına girebilirsin.",
+ "baseInfoSubHeaderText": "Oyna ve Kazan",
+ "baseInfoSubHeaderDescription1": "Her oyun kazandığında Pong Point kazanarak sıralamada yüksel.",
+ "baseInfoSubHeaderDescription2": "Kazançlarınla mağazadan yeni eşyalar, raket ve masalar satın alarak oyun deneyimini geliştir.",
+ "baseInfoSubHeaderText2": "Hemen Başla",
+ "baseInfoSubHeaderDescription3": "Hesap oluşturarak profilini kişiselleştir, istatistiklerini takip et ve sıralamadaki yerini gör.",
+ "baseInfoSubHeaderText3": "Daha Fazlası",
+ "baseInfoSubHeaderDescription4": "Turnuvalara katılarak rakiplerinle yüzleş.",
+ "baseInfoSubHeaderDescription5": "Arkadaşlarınla özel oyunlar kurarak keyifli vakit geçir.",
+ "baseInfoSubHeaderDescription6": "Diğer oyuncularla sohbet et, taktikler paylaş ve Pong topluluğuna katıl.",
+
+ #Login
+ "loginPageTittle": "Giriş Yap",
+ "loginHeaderText1": "Hoş geldiniz,",
+ "loginHeaderText2": "devam etmek için giriş yapın",
+ "loginInputUsernameText": "Kullanıcı Adı",
+ "loginInputPasswordText": "Şifre",
+ "loginForgotPasswordText": "Şifremi Unuttum?",
+ "loginButtonLogin": "Giriş Yap",
+ "loginButtonJoin": "Üye Ol",
+
+ #404
+ "notFoundPageTittle": "Sayfa Bulunamadı",
+ "notFoundHeaderText": "404 HATA",
+ "notFoundSubHeaderText": "Muhtemelen sitemizde kayboldunuz!",
+ "notFoundButtonText": "ANA SAYFA'YA DÖN",
+
+ #Signup
+ "signupPageTittle": "Kayıt Ol",
+ "signupHeaderText1": "Hoş geldiniz,",
+ "signupHeaderText2": "devam etmek için kayıt olun",
+ "signupInputUsernameText": "Kullanıcı Adı",
+ "signupInputDisplayNameText": "Görünen Ad",
+ "signupInputEmailText": "E-posta",
+ "signupInputPasswordText": "Şifre",
+ "signupInputConfirmPasswordText": "Şifreyi Onayla",
+ "signupImageUploadText": "Resim Yükle",
+ "signupGdprText1": "Kabul ediyorum",
+ "signupGdprText2": "GDPR Gizlilik Politikası",
+ "signupButtonSignup": "Kayıt Ol",
+
+ #ForgotPassword
+ "forgotPasswordPageTittle": "Şifremi Unuttum",
+ "forgotPasswordHeaderText": "Şifremi Unuttum",
+ "forgotPasswordInputEmailText": "E-posta",
+ "forgotPasswordButtonSend": "E-posta Gönder",
+ "forgotPasswordLinkText": "Hesabınız yok mu?",
+ "forgotPasswordLinkButtonText": "Kayıt Ol",
+
+ #Password-Reset-Done
+ "passwordResetDonePageTittle": "E-Posta Gönderildi",
+ "passwordResetDoneHeaderText": "E-POSTA GÖNDERİLDİ",
+ "passwordResetDoneSubHeaderText": "Şifre sıfırlama bağlantınızı e-posta ile gönderdik. Lütfen e-postanızı kontrol edin.",
+ "passwordResetButtonText": "GİRİŞ'E DÖN",
+
+ #ChangePassword
+ "changePasswordPageTittle": "Şifre Değiştir",
+ "changePasswordHeaderText": "Şifre Değiştir",
+ "changePassswordSubHeaderText": "şifreni değiştir",
+
+ #Dashboard
+ "dashboardPageTittle": "Ana Sayfa",
+ "dashboardText1": "HOŞ GELDİNİZ, ",
+ "dashboardText2": "Indian Pong, 42 okulu toplulugu için geliştirilmiş bir takım projesidir ve klasik Atari oyunu Ping-Pong ile nostaljik bir oyun deneyimi sunar. Bu platform, kullanıcıların birbirleriyle Ping-Pong maçlari yapmalarina olanak tanır ve dostane rekabet ortamı oluşturur. Oyun deneyimi dışında, Indian Pong, kullanıcıların birbirleriyle iletişim kurabileceği ve bağlanti kurabilecegi sohbet odalarını içeren bir sosyal boyut sunar. Platform ayrıca, kullanicilarin 42 okulu topluluğunda arkadaş ekleyerek ağlarını genişletmelerine olanak tanır. Genel olarak, Indian Pong, retro oyun keyfini modern sosyal etkileşimle birleştirerek, 42 okulu topluluğu icin canlı ve etkileşimli bir deneyim sunar.",
+
+ "dashboardGamesPlayed": "Oynanan Oyunlar",
+ "dashboardWinCount": "Kazanma Sayısı",
+ "dashboardWinStreak": "Kazanma Serisi",
+ "dashboardLoseStreak": "Kaybetme Serisi",
+ "dashboardWinRate": "Kazanma Oranı",
+ "dashboardAverageGameDuration": "Ortalama Oyun Süresi",
+ "dashboardAveragePointsWon": "Ortalama Kazanılan Puanlar",
+ "dashboardAveragePointsLost": "Ortalama Kaybedilen Puanlar",
+
+ #Chat
+ "chatPageTittle": "Sohbet",
+ "chatHeaderText": "Sohbetler",
+ "chatRecentlyText": "Son Zamanlar",
+ "chatDMText": "Direkt Mesajlar",
+ "chatContainerSelectText": "Mesajlaşmaya başlamak için bir sohbet seçin",
+ "chatTodayText": "Bugün",
+ "chatTypeHereText": "Bir mesaj yazın...",
+
+ #Pong-Game
+ "pongGamePageTittle": "Pong Oyunu",
+ "pongGameHeaderText": "Pong Lobisine Hoş Geldiniz",
+ "pongGameSubHeaderText": "Yapay Zeka ile oynayarak kendinizi geliştirebilir. Gerçek bir kişiyle oynamak istiyorsanız, diğer seçeneği düşünün; 5 dakika içinde eşleşecek birini bulamazsak, eşleşme iptal edilecektir. Unutmadan önce iyi şanslar!",
+ "pongGameAIButtonText": "Yapay Zeka Oyunu",
+ "pongGameLocalButtonText": "Yerel Oyun",
+ "pongGameRemoteButtonText": "Uzak Oyuncu",
+ "pongGameLocalTournamentButtonText": "Yerel Turnuva",
+ "pongGameTournamentButtonText": "Turnuva",
+
+ #AI-Game
+ "aiGamePageTittle": "Pong Yapay Zeka Oyunu",
+ "aiGameReactionDelayText": "Tepki Gecikmesi",
+ "aiGameGetReadyText": "Hazir Ol",
+ "aiGameStartButtonText": "Başlat",
+
+ "aiGameGameOverText": "Oyun Bitti",
+ "aiGameRestartButtonText": "Yeniden",
+ "aiGameExitButtonText": "Cikis",
+
+ "aiGameInfoHeaderText": "Oyun Hakkında",
+ "aiGameInfoSubHeaderText": "Oyunu Nasıl Oynarım?",
+ "aiGameInfoSubHeaderDescription1": "Pong oyununda oyuncular rakiplerine karşı bir masa tenisi maçı yaparlar. W-S tuşları (veya yukarı-aşağı ok tuşları) topu kontrol etmek için kullanılır.",
+ "aiGameInfoSubHeaderText2": "Kazan ve Geliş",
+ "aiGameInfoSubHeaderDescription2": "Her oyun kazandığında Pong Puan kazanırsın. Bu puanlarla mağazadan yeni eşyalar, raket ve masalar satın alarak oyun deneyimini geliştirebilirsin.",
+ "aiGameInfoSubHeaderText3": "Hemen Başla",
+ "aiGameInfoSubHeaderDescription3": "Hesap oluşturarak oyun deneyimini kişiselleştirebilirsin. Bir hesapla istatistiklerini takip edebilir ve sıralamandaki yerini görebilirsin.",
+ "aiGameInfoSubHeaderText4": "Daha Fazlası",
+ "aiGameInfoSubHeaderDescription4": "Rakiplerinle yüzleşmek ve becerilerini test etmek icin turnuvalara katılabilirsin. Ayrıca arkadaşlarınla özel oyunlar oluşturabilir ve Pong topluluğuna katılabilirsin.",
+
+ "aiGameInfoSubHeaderText5": "Kontroller",
+ "aiGameInfoSubHeaderDescription5": "Yukarı",
+ "aiGameInfoSubHeaderDescription6": "Aşağı",
+ "aiGameInfoSubHeaderText6": "Yetenekler",
+ "aiGameInfoSubHeaderDescription7": "Bir Hilekar Gibi",
+ "aiGameInfoSubHeaderDescription8": "Hızlı ve Öfkeli",
+ "aiGameInfoSubHeaderDescription9": "Dondurulmuş Top",
+
+ #Local-Game
+ "localGamePageTittle": "Yerel Oyun",
+ "localGameHeaderText": "1v1 Yerel Oyun",
+ "localGamePlayer1Text": "1. Oyuncu Adı",
+ "localGamePlayer2Text": "2. Oyuncu Adı",
+ "localGameMaxScoreText": "Maksimum Skor",
+ "localGameGameModeText": "Oyun Modu",
+ "localGameChooseModeText1": "Klasik",
+ "localGameChooseModeText2": "Yetenekler",
+ "localGameButtonStart": "Başla",
+
+ #Local-Tournament
+ "localTournamentPageTittle": "Yerel Turnuva",
+ "localTournamentGameHeaderText": "Yerel Turnuva",
+ "localTournamentPlayer1Text": "1. Oyuncu Adı",
+ "localTournamentPlayer2Text": "2. Oyuncu Adı",
+ "localTournamentPlayer3Text": "3. Oyuncu Adı",
+ "localTournamentPlayer4Text": "4. Oyuncu Adı",
+ "localTournamentMaxScoreText": "Maksimum Skor",
+ "localTournamentGameModeText": "Oyun Modu",
+ "localTournamentChooseModeText1": "Klasik",
+ "localTournamentChooseModeText2": "Yetenekler",
+ "localTournamentButtonStart": "Başlat & Eşleşme",
+ "localTournamentBracketTitle": "Turnuva Eşleşmesi",
+ "localTournamentBracketStartButtonText": "Turnuvayı Başlat",
+ "localTournamentTournamentOverText": "Turnuva Bitti",
+ "localTournamentOverButtonText": "Bitti",
+
+ "localTournamentNextButtonText": "Sonraki",
+
+ #Tournament
+ "tournamentPageTittle": "Turnuva",
+ "tournamentHeaderText": "Pong için Turnuva Lobisine Hoş Geldiniz",
+ "tournamentSubHeaderText": "Burada bir turnuva lobisine katılabilir veya kendi turnuva lobinizi oluşturabilirsiniz. Odanızı oluşturduktan sonra davet kodunu paylaşarak arkadaşlarınızı davet edebilirsiniz. Unutmadan önce iyi şanslar!",
+ "tournamentJoinButtonText": "Turnuvaya Katıl",
+ "tournamentCreateButtonText": "Turnuva Oluştur",
+
+ #Tournament-Create
+ "tournamentCreatePageTittle": "Turnuva Oluştur",
+ "tournamentCreateHeaderText": "TURNUVA OLUŞTUR",
+ "tournamentCreateSubHeaderText": "Bir turnuva oluşturmak için bir turnuva adına ve her oyunun maksimum kaç puan alacağına ihtiyacım var. Unutmadan önce iyi şanslar!",
+ "tournamentCreateNameText": "Turnuva Adı",
+ "tournamentCreateMaxPointsText": "Oyun Başına Maksimum Skor",
+ "tournamentCreateGameModeText": "Oyun Modu",
+ "tournamentCreateChooseModeText1": "Klasik",
+ "tournamentCreateChooseModeText2": "Yetenekler",
+ "tournamentCreateButtonCreate": "Turnuva Oluştur",
+
+ #Joined-Tournament-Room
+ "tournamentroomPageTittle": "Turnuva Odası",
+ "tournamentroomHeaderText": "Turnuva Odası",
+ "tournamentroomRoomText": "Oda",
+ "tournamentroomLeaveButtonText": "TURNUVADAN AYRIL",
+ "tournamentroomStartButtonText": "TURNUVAYI BAŞLAT",
+ "tournamentroomJoinButtonText": "TURNUVAYA KATIL",
+ "tournamentCheckBracketButtonText": "BRAKETI GÖRÜNTÜLE",
+ "tournamentOverWinnerGuyText": "turnuva bitti ve tahtın tek kişilik hakimi",
+ "tournamentOverLosersText": "turnuva bitti ve işte kaybedenler kulübü",
+ "tournamentroomTournamentRoomButton": "TURNUVA ODASI",
+ "tournamentroomWaitingText": "Bekleniyor,",
+ "tournamentroomForPlayerText": " oyuncu...",
+
+ #Tournament Room List
+ "tournamentRoomListPageTittle": "Turnuva Odaları",
+ "tournamentRoomListHeaderText": "Turnuva Odaları",
+
+ #Remote Pong Game
+ "remotePongGamePageTittle": "Pong Oyunu",
+ "remotePongGameTableName": "Ad",
+ "remotePongGameTableActions": "Eylemler",
+ "remotePongGameMatchmakingButtonText": "EŞLEŞME",
+ "remotePongGameLeaveButtonText": "AYRIL",
+ "remotePongGameStartText": "Başlamadan önce, oyun modunu seçebilirsin!",
+ "remotePongGameStartButtonText": "OYUNU BAŞLAT",
+ "remotePongSelectedMode": "Vanilya",
+
+
+
+ #RPS Game
+ "rpsGamePageTittle": "Taş Kağıt Makas",
+ "rpsGameText1": "Taş Taş Kağıt Makas Lobisine Hoş Geldiniz",
+ "rpsGameText2": "Yapay Zeka ile oynayarak kendinizi geliştirebilir. Gerçek bir kişiyle oynamak istiyorsanız, diğer seçeneği düşünün; 5 dakika içinde eşleşecek birini bulamazsak, eşleşme iptal edilecektir. Unutmadan önce iyi şanslar!",
+ "rpsGameAIButtonText": "Yapay Zeka Oyunu",
+ "rpsGameLocalButtonText": "Yerel Oyun",
+ "rpsGameSearchOpponentButtonText": "Rakip Arayın ",
+ "rpsUserCountText": "şu anda eşleşme arayan kişi sayısı",
+
+ #AI-Game
+ "rpsGamePageTittle": "RPS Yapay Zeka Oyunu",
+ "rpsGameScoreText": "skor",
+ "rpsGameRockText": "TAŞ",
+ "rpsGamePaperText": "KAĞIT",
+ "rpsGameScissorsText": "MAKAS",
+ "rpsGamePickedText": "seçtin",
+ "rpsGamePickedText2": "rakibin seçti",
+ "rpsGameAgainText": "tekrar oyna",
+ "rpsGameGameOverText": "Oyun Bitti",
+ "rpsGameRestartButtonText": "Yeniden",
+ "rpsGameExitButtonText": "Çıkış",
+
+
+ #Rankings
+ "rankingsPageTittle": "Sıralamalar",
+ "rankingsTableRankText": "Sıra",
+ "rankingsTableNameText": "Ad",
+ "rankingsTableUsernameText": "Kullanıcı Adı",
+ "rankingsTableWinsText": "Kazanmalar",
+ "rankingsTableLossesText": "Kayıplar",
+ "rankingsTableWinRateText": "Kazanma Yüzdesi",
+ "rankingsTablePongPointsText": "Pong Puanı",
+
+ #Store
+ "storePageTittle": "Mağaza",
+ "storeText": "Mağaza",
+ "storeTagText": "Tümü",
+ "storeWalletText": "Cüzdan",
+ "storeWalleinfoText1": "Oyun oynayarak ",
+ "storeWalleinfoText2": " kazanabilirsin.",
+
+ #Inventory
+ "inventoryPageTittle": "Envanter",
+ "inventoryText": "Envanter",
+ "inventoryTagText": "Tümü",
+ "inventoryWalletText": "Cüzdan",
+ "inventoryWalleinfoText1": "Oyun oynayarak ",
+ "inventoryWalleinfoText2": " kazanabilirsin.",
+ "inventoryModalHeaderText": "Öğeyi Ayarla",
+ "inventoryModalSaveButton": "Kaydet",
+ "inventoryModalCloseButton": "Kapat",
+ "inventoryItemKeyboardInfoText": "Yetenek kullanmak için",
+ "inventoryItemKeyboardInfoText2": "tuşunu kullan. Unutma, bu yeteneği kullanabilmek için kuşanmalısın.",
+ "inventoryItemKeyboardInfoText3": "Bu öğe için özel bir tuş takımı yok, otomatik olarak kullanılır.",
+
+
+ #Search
+ "searchPageTittle": "Arama",
+ "searchInputText": "E-posta, kullanıcı adı veya görünen ad ara...",
+ "searchMessageButtonText": "Mesaj Gönder",
+ "searchFollowButtonText": "Takip Et",
+ "searchFollowingButtonText": "Takipten Çık",
+
+
+ "searchNoResultFoundText": "Sonuç bulunamadı.",
+
+ #Profile
+ "profilePageTittle": "Profili",
+ "profileRankAIText": "SADECE ROBOTUM",
+ "profileRankUserText1": " SIRALAMADA",
+ "profileRankUserText2": " SIRALAMA YOK",
+ "profileFollowButton": "Takip Et",
+ "profileFollowingButton": "Takipten Çık",
+ "profileTitleText1": "42 Kocaeli Öğrencisi",
+ "profileTitleText2": "Yazılım Geliştirici",
+
+ "profileLinkedinSocialText": "LinkedIn Yok",
+ "profileGithubSocialText": "Github Yok",
+ "profileTwitterSocialText": "Twitter Yok",
+ "profileIntra42SocialText": "Intra42 Yok",
+
+ "profileMatchHistoryText1": "Rakip",
+ "profileMatchHistoryText2": "Sonuç",
+ "profileMatchHistoryText3": "Puan",
+ "profileMatchHistoryText4": "Süre",
+
+ "profileMatchHistoryWinText": "Kazandı",
+ "profileMatchHistoryLoseText": "Kaybetti",
+
+ "profileRankText1": "Sıra",
+ "profileStatsText": "İstatistikler",
+
+ "profileGameStats1": "Oynanan Oyunlar:",
+ "profileGameStats2": "Kazanmalar:",
+ "profileGameStats3": "Kayıplar:",
+ "profileGameStats4": "Kazanma Oranı:",
+ "profileGameStats5": "Kazanma Serisi:",
+ "profileGameStats6": "Ortalama Oyun Süresi:",
+
+ #Friends
+ "friendsPageTittle": "Arkadaşlar",
+ "friendsMessageButtonText": "Mesaj Gönder",
+ "friendsNoResultFoundText": "Sonuç bulunamadı.",
+
+ #ProfileSettings
+ "profileSettingsPageTittle": "Profil Ayarları",
+ "profileSettingsNavbar1": "Profili Düzenle",
+ "profileSettingsNavbar2": "Şifre Değişitr",
+ "profileSettingsNavbar3": "Sosyal Medya Ekle",
+ "profileSettingsNavbar4": "Engellenen Kullanıcılar",
+ "profileSettingsNavbar5": "Hesabı Kapat",
+
+ #Edit-Profile
+ "editProfileChangeImageText": "Resmi Değiştir",
+ "editProfileUsernameText": "Kullanıcı Adı (sitenin diğer kullanıcıları tarafından nasıl görüneceği)",
+ "editProfileUsernameTimeText": "Kullanıcı adınızı her 7 günde bir değiştirebilirsiniz.",
+ "editProfileEmailText": "E-posta",
+ "editProfile42EmailText": "42 ile oturum açtığınız için e-posta ayarlama özelliği devre dışı bırakılmıştır.",
+ "editProfileDisplayNameText": "Görünen Ad",
+ "editProfileSaveButtonText": "Değişiklikleri Kaydet",
+
+ #Change-Passwordg
+ "changePasswordCurrentPasswordText": "Mevcut Şifre",
+ "changePasswordNewPasswordText": "Yeni Şifre",
+ "changePasswordNewConfirmPasswordText": "Yeni Şifreyi Onayla",
+ "changePassword42Text": "42 ile oturum açtığınız için şifre ayarlama özelliği devre dışı bırakılmıştır.",
+ "changePasswordSaveButtonText": "Şifreyi Kaydet",
+
+ #Add-Socials
+ "addSocialsLinkedinInputText": "LinkedIn kullanıcı adınızı girin",
+ "addSocialsTwitterInputText": "Twitter kullanıcı adınızı girin",
+ "addSocialsGithubInputText": "Github kullanıcı adınızı girin",
+ "addSocialsIntraInputText": "42 Intra kullanıcı adınızı girin",
+ "addSocialsSaveButtonText": "Sosyal Medyaları Kaydet",
+
+ #Blocked-Users
+ "blockedUsersHeaderText": "Engellenen Hesaplar",
+ "blockedUsersSubHeaderText": "Burada engellediğiniz hesapları açabilirsiniz.",
+ "blockedStatusText": "Engellendi",
+
+ #Close-Account
+ "closeAccountHeaderText": "Hesabı Kapat",
+ "closeAccountInputText": "E-posta",
+ "closeAccountSubHeaderText": "Burada hesabınızı silebilirsiniz. Bu işlem geri alınamaz.",
+ "closeAccountButton": "Hesabı Kapat",
+
+
+ }
+ return context
+
+
+def get_lang_pt():
+ context = {
+ #index
+ "basePageTittle": "Indian-Pong",
+ "baseHeaderText": "Indian-Pong",
+ "baseSubHeaderText": "A versão indiana do clássico jogo Pong",
+ "basePlayButtonText": "Vamos Comecar!",
+
+ "baseInfoHeaderText": "Bem-vindo ao Indian-Pong!",
+ "baseInfoHeaderDescription": "Pong traz a emoção e a competição do tênis de mesa clássico para a internet. Nesta plataforma, você pode se divertir, mostrar suas habilidades e subir no ranking para se tornar um dos melhores.",
+ "baseInfoSubHeaderText": "Jogue e Ganhe",
+ "baseInfoSubHeaderDescription1": "Ganhe Pong Points a cada jogo que vencer para subir no ranking.",
+ "baseInfoSubHeaderDescription2": "Use seus ganhos para comprar novos itens, raquetes e mesas da loja para aprimorar sua experiência de jogo.",
+ "baseInfoSubHeaderText2": "Comece Agora",
+ "baseInfoSubHeaderDescription3": "Crie uma conta para personalizar seu perfil, acompanhar suas estatísticas e ver onde você está no ranking.",
+ "baseInfoSubHeaderText3": "Mais Recursos",
+ "baseInfoSubHeaderDescription4": "Participe de torneios para enfrentar seus oponentes.",
+ "baseInfoSubHeaderDescription5": "Divirta-se com seus amigos hospedando jogos privados.",
+ "baseInfoSubHeaderDescription6": "Converse com outros jogadores, compartilhe táticas e participe da comunidade Pong.",
+
+ #Login
+ "loginPageTittle": "Iniciar sessão",
+ "loginHeaderText1": "Bem-vindo,",
+ "loginHeaderText2": "faca login para continuar",
+ "loginInputUsernameText": "Nome de Usuário",
+ "loginInputPasswordText": "Senha",
+ "loginForgotPasswordText": "Esqueceu a Senha?",
+ "loginButtonLogin": "Vamos lá",
+ "loginButtonJoin": "Junte-se",
+
+ #404
+ "notFoundPageTittle": "Página não encontrada",
+ "notFoundHeaderText": "404 ERRO",
+ "notFoundSubHeaderText": "Você provavelmente se perdeu em nosso site!",
+ "notFoundButtonText": "VENHA PARA CASA",
+
+ #Signup
+ "signupPageTittle": "Inscreva-se",
+ "signupHeaderText1": "Bem-vindo,",
+ "signupHeaderText2": "inscreva-se para continuar",
+ "signupInputUsernameText": "Nome de Usuário",
+ "signupInputDisplayNameText": "Nome de Exibicão",
+ "signupInputEmailText": "E-mail",
+ "signupInputPasswordText": "Senha",
+ "signupInputConfirmPasswordText": "Senha (novamente)",
+ "signupImageUploadText": "Imagem",
+ "signupGdprText1": "Concordo ",
+ "signupGdprText2": "GDPR Política de Privacidade",
+ "signupButtonSignup": "Vamos!",
+
+ #ForgotPassword
+ "forgotPasswordPageTittle": "Esqueceu a Senha",
+ "forgotPasswordHeaderText": "Esqueceu a Senha",
+ "forgotPasswordInputEmailText": "E-mail",
+ "forgotPasswordButtonSend": "Enviar E-mail",
+ "forgotPasswordLinkText": "Não tem uma conta?",
+ "forgotPasswordLinkButtonText": "Junte-se a Nós",
+
+ #Password-Reset-Done
+ "passwordResetDonePageTittle": "Email Enviado",
+ "passwordResetDoneHeaderText": "EMAIL ENVIADO",
+ "passwordResetDoneSubHeaderText": "Enviamos o link de redefinição de senha para o seu e-mail. Por favor, verifique seu e-mail.",
+ "passwordResetButtonText": "VOLTAR AO LOGIN",
+
+ #ChangePassword
+ "changePasswordPageTittle": "Mudar Senha",
+ "changePasswordHeaderText": "Mudar Senha",
+ "changePassswordSubHeaderText": "alterar a sua palavra-passe",
+
+
+ #Dashboard
+ "dashboardPageTittle": "Painel",
+ "dashboardText1": "Bem-vindo, ",
+ "dashboardText2": "O Indian Pong é um projeto colaborativo desenvolvido para a comunidade da escola 42, oferecendo uma experiência de jogo nostálgica através do clássico jogo Atari, Ping-Pong. Esta plataforma permite que os usuários participem de partidas de Ping-Pong uns com os outros, promovendo uma sensacão de competicão amigável. Além do aspecto de jogo, o Indian Pong oferece uma dimensão social, apresentando salas de bate-papo onde os usuários podem se comunicar e se conectar uns com os outros. A plataforma também permite que os usuários expandam sua rede adicionando amigos dentro da comunidade da escola 42. No geral, o Indian Pong combina a alegria dos jogos retrô com a interacão social moderna, criando uma experiência vibrante e interativa para a comunidade da escola 42.",
+
+ "dashboardGamesPlayed": "Jogos Jogados",
+ "dashboardWinCount": "Contagem de Vitórias",
+ "dashboardWinStreak": "Sequência de Vitórias",
+ "dashboardLoseStreak": "Sequência de Derrotas",
+ "dashboardWinRate": "Taxa de Vitória",
+ "dashboardAverageGameDuration": "Duracão Média do Jogo",
+ "dashboardAveragePointsWon": "Pontos Médios Ganhos",
+ "dashboardAveragePointsLost": "Pontos Médios Perdidos",
+
+ #Chat
+ "chatPageTittle": "Bate-papo",
+ "chatHeaderText": "Bate-papos",
+ "chatRecentlyText": "Recentemente",
+ "chatDMText": "Mensagens Diretas",
+ "chatContainerSelectText": "Selecione um bate-papo para começar a conversar",
+ "chatTodayText": "Hoje",
+ "chatTypeHereText": "Digite uma mensagem...",
+
+
+ #Pong-Game
+ "pongGamePageTittle": "Jogo de Pong",
+ "pongGameHeaderText": "Bem-vindo ao Lobby de Pong",
+ "pongGameSubHeaderText": "Podes melhorar o teu desempenho jogando com a Inteligência Artificial. Se quiseres jogar com uma pessoa real, considera a outra opção; se não encontrarmos alguém com quem jogar no espaço de 5 minutos, o jogo será cancelado. Boa sorte antes que nos esqueçamos!",
+ "pongGameAIButtonText": "Jogar com a IA",
+ "pongGameLocalButtonText": "Jogo Local",
+ "pongGameRemoteButtonText": "Jogador Remoto",
+ "pongGameLocalTournamentButtonText": "Locais Torneio",
+ "pongGameTournamentButtonText": "Torneio",
+
+ #AI-Game
+ "aiGamePageTittle": "Jogo de Pong com a IA",
+ "aiGameReactionDelayText": "Atraso na Reacão",
+ "aiGameGetReadyText": "Prepare-se",
+ "aiGameStartButtonText":"Começar",
+
+ "aiGameGameOverText": "Fim de Jogo",
+ "aiGameRestartButtonText": "Reiniciar",
+ "aiGameExitButtonText": "Sair",
+
+ "aiGameInfoHeaderText": "Sobre o Jogo",
+ "aiGameInfoSubHeaderText": "Como Jogar o Jogo?",
+ "aiGameInfoSubHeaderDescription1": "No jogo Pong, os jogadores participam de uma partida de tênis de mesa contra seus oponentes. As teclas W-S (ou as setas cima-baixo) são usadas para controlar a bola.",
+ "aiGameInfoSubHeaderText2": "Ganhe e Melhore",
+ "aiGameInfoSubHeaderDescription2": "Você ganha Pong Points a cada jogo que vence. Com esses pontos, você pode comprar novos itens, raquetes e mesas da loja para aprimorar sua experiência de jogo.",
+ "aiGameInfoSubHeaderText3": "Comece Agora",
+ "aiGameInfoSubHeaderDescription3": "Você pode criar uma conta para personalizar sua experiência de jogo. Com uma conta, você pode acompanhar suas estatísticas e ver sua posição no ranking.",
+ "aiGameInfoSubHeaderText4": "Mais Recursos",
+ "aiGameInfoSubHeaderDescription4": "Você pode participar de torneios para enfrentar seus oponentes e testar suas habilidades. Além disso, você pode criar jogos privados com seus amigos e se juntar à comunidade Pong.",
+
+ "aiGameInfoSubHeaderText5": "Controles",
+ "aiGameInfoSubHeaderDescription5": "Cima",
+ "aiGameInfoSubHeaderDescription6": "Baixo",
+ "aiGameInfoSubHeaderText6": "Habilidades",
+ "aiGameInfoSubHeaderDescription7": "Como um Trapaceiro",
+ "aiGameInfoSubHeaderDescription8": "Veloz e Furioso",
+ "aiGameInfoSubHeaderDescription9": "Bola Congelada",
+
+ #Local-Game
+ "localGamePageTittle": "Jogo Local",
+ "localGameHeaderText": "Jogo Local 1v1",
+ "localGamePlayer1Text": "Nome do Jogador 1",
+ "localGamePlayer2Text": "Nome do Jogador 2",
+ "localGameMaxScoreText": "Pontuacão Máxima",
+ "localGameGameModeText": "Modo de Jogo",
+ "localGameChooseModeText1": "Vanilla",
+ "localGameChooseModeText2": "Habilidades",
+ "localGameButtonStart": "Iniciar",
+
+ #Local-Tournament
+ "localTournamentPageTittle": "Torneio Local",
+ "localTournamentGameHeaderText": "Torneio Local",
+ "localTournamentPlayer1Text": "Nome do Jogador 1",
+ "localTournamentPlayer2Text": "Nome do Jogador 2",
+ "localTournamentPlayer3Text": "Nome do Jogador 3",
+ "localTournamentPlayer4Text": "Nome do Jogador 4",
+ "localTournamentMaxScoreText": "Pontuacão Máxima",
+ "localTournamentGameModeText": "Modo de Jogo",
+ "localTournamentChooseModeText1": "Vanilla",
+ "localTournamentChooseModeText2": "Habilidades",
+ "localTournamentButtonStart": "Iniciar & Empar.",
+ "localTournamentBracketTitle": "Empar. Torneio",
+ "localTournamentBracketStartButtonText": "Iniciar Torneio",
+ "localTournamentTournamentOverText": "Torneio Terminado",
+ "localTournamentOverButtonText": "Terminado",
+
+ "localTournamentNextButtonText": "Próximo",
+
+ #Tournament
+ "tournamentPageTittle": "Torneio",
+ "tournamentHeaderText": "Bem-vindo ao Lobby do Torneio de Pong",
+ "tournamentSubHeaderText": "Aqui você pode entrar em um lobby de torneio ou criar seu próprio lobby de torneio. Você pode convidar seus amigos compartilhando o código de convite após criar a sala. Boa sorte antes que eu esqueca!",
+ "tournamentJoinButtonText": "Entrar no Torneio",
+ "tournamentCreateButtonText": "Criar Torneio",
+
+ #Tournament-Create
+ "tournamentCreatePageTittle": "Criar Torneio",
+ "tournamentCreateHeaderText": "CRIAR TORNEIO",
+ "tournamentCreateSubHeaderText": "Para criar um torneio, eu preciso de um nome de torneio, quantos pontos máximos cada jogo terá. Boa sorte antes que eu esqueca!",
+ "tournamentCreateNameText": "Nome do Torneio",
+ "tournamentCreateMaxPointsText": "Pontuacão Máxima dos Jogos",
+ "tournamentCreateGameModeText": "Modo de Jogo",
+ "tournamentCreateChooseModeText1": "Vanilla",
+ "tournamentCreateChooseModeText2": "Habilidades",
+ "tournamentCreateButtonCreate": "Criar Torneio",
+
+ #Joined-Tournament-Room
+ "tournamentroomPageTittle": "Sala de Torneio",
+ "tournamentroomHeaderText": "Sala de Torneio",
+ "tournamentroomRoomText": "Sala",
+ "tournamentroomLeaveButtonText": "SAIR DO TORNEIO",
+ "tournamentroomStartButtonText": "INICIAR TORNEIO",
+ "tournamentroomJoinButtonText": "ENTRAR NO TORNEIO",
+ "tournamentCheckBracketButtonText": "VER BRACKET",
+ "tournamentOverWinnerGuyText": "o torneio acabou e o rei da mesa é",
+ "tournamentOverLosersText": "o torneio acabou e aqui está o clube dos perdedores",
+ "tournamentroomTournamentRoomButton": "SALA DE TORNEIO",
+ "tournamentroomWaitingText": "Aguardando,",
+ "tournamentroomForPlayerText": "jogadores...",
+
+ #Tournament Room List
+ "tournamentRoomListPageTittle": "Salas de Torneio",
+ "tournamentRoomListHeaderText": "Salas de Torneio",
+
+ #Remote Pong Game
+ "remotePongGamePageTittle": "Jogo de Pong",
+ "remotePongGameTableName": "Nome",
+ "remotePongGameTableActions": "Ações",
+ "remotePongGameMatchmakingButtonText": "MATCHMAKING",
+ "remotePongGameLeaveButtonText": "SAIR",
+ "remotePongGameStartText": "Antes de começar, você pode escolher o modo de jogo!",
+ "remotePongGameStartButtonText": "INICIAR JOGO",
+ "remotePongSelectedMode": "Vanilla",
+
+ #RPS Game
+ "rpsGamePageTittle": "Pedra, Papel e Tesoura",
+ "rpsGameText1": "Bem-vindo ao Lobby de Pedra, Papel e Tesoura",
+ "rpsGameText2": "Podes melhorar o teu desempenho jogando com a Inteligência Artificial. Se quiseres jogar com uma pessoa real, considera a outra opção; se não encontrarmos alguém com quem jogar no espaço de 5 minutos, o jogo será cancelado. Boa sorte antes que nos esqueçamos!",
+ "rpsGameAIButtonText": "Jogar com a IA",
+ "rpsGameLocalButtonText": "Jogo Local",
+ "rpsGameSearchOpponentButtonText": "Buscar Oponente ",
+ "rpsUserCountText": "Jogadores Online",
+
+ #AI-Game
+ "rpsGamePageTittle": "Jogo de Pedra, Papel e Tesoura com Inteligência Artificial",
+ "rpsGameScoreText": "pontuação",
+ "rpsGameRockText": "PEDRA",
+ "rpsGamePaperText": "PAPEL",
+ "rpsGameScissorsText": "TESOURA",
+ "rpsGamePickedText": "escolheste",
+ "rpsGamePickedText2": "o adversário escolheu",
+ "rpsGameAgainText": "jogar novamente",
+ "rpsGameGameOverText": "Jogo Terminado",
+ "rpsGameRestartButtonText": "Reiniciar",
+ "rpsGameExitButtonText": "Sair",
+
+ #Rankings
+ "rankingsPageTittle": "Classificacão",
+ "rankingsTableRankText": "Classificacão",
+ "rankingsTableNameText": "Nome",
+ "rankingsTableUsernameText": "Nome de Usuário",
+ "rankingsTableWinsText": "Vitórias",
+ "rankingsTableLossesText": "Derrotas",
+ "rankingsTableWinRateText": "Taxa de Vitória",
+ "rankingsTablePongPointsText": "Pontos Pong",
+
+ #Store
+ "storePageTittle": "Loja",
+ "storeText": "Loja",
+ "storeTagText": "Tudo",
+ "storeWalletText": "Carteira",
+ "storeWalleinfoText1": "Você pode ganhar ",
+ "storeWalleinfoText2": " jogando.",
+
+ #Inventory
+ "inventoryPageTittle": "Inventário",
+ "inventoryText": "Inventário",
+ "inventoryTagText": "Tudo",
+ "inventoryWalletText": "Carteira",
+ "inventoryWalleinfoText1": "Você pode ganhar ",
+ "inventoryWalleinfoText2": " jogando.",
+ "inventoryModalHeaderText": "Definir Item",
+ "inventoryModalSaveButton": "Salvar",
+ "inventoryModalCloseButton": "Fechar",
+ "inventoryItemKeyboardInfoText": "Use a tecla",
+ "inventoryItemKeyboardInfoText2": "para usar essa habilidade. E lembre-se, você deve equipar essa habilidade.",
+ "inventoryItemKeyboardInfoText3": "Este item não tem um teclado personalizado, é usado automaticamente.",
+
+
+ #Search
+ "searchPageTittle": "Procurar",
+ "searchInputText": "Procurar por e-mail, nome de usuário ou nome de exibicão...",
+ "searchMessageButtonText": "Mensagem",
+ "searchFollowButtonText": "Seguir",
+ "searchFollowingButtonText": "Deixar",
+ "searchNoResultFoundText": "Nenhum resultado encontrado.",
+
+ #Profile
+ "profilePageTittle": "Perfil",
+ "profileRankAIText": "APENAS ROBÔ",
+ "profileRankUserText1": " RANKING",
+ "profileRankUserText2": " SEM RANKING",
+ "profileFollowButton": "Seguir",
+ "profileFollowingButton": "Deixar",
+ "profileTitleText1": "Estudante da 42 Kocaeli",
+ "profileTitleText2": "Desenvolvedor de Software",
+
+ "profileLinkedinSocialText": "Sem LinkedIn",
+ "profileGithubSocialText": "Sem Github",
+ "profileTwitterSocialText": "Sem Twitter",
+ "profileIntra42SocialText": "Sem Intra42",
+
+ "profileMatchHistoryText1": "Oponente",
+ "profileMatchHistoryText2": "Resultado",
+ "profileMatchHistoryText3": "Pontos",
+ "profileMatchHistoryText4": "Tempo",
+
+ "profileMatchHistoryWinText": "Venceu",
+ "profileMatchHistoryLoseText": "Perdeu",
+
+ "profileRankText1": "Classificacão",
+ "profileStatsText": "Estatísticas",
+
+ "profileGameStats1": "Jogos Jogados:",
+ "profileGameStats2": "Vitórias:",
+ "profileGameStats3": "Derrotas:",
+ "profileGameStats4": "Taxa de Vitória:",
+ "profileGameStats5": "Sequência de Vitórias:",
+ "profileGameStats6": "Duração Média do Jogo:",
+
+ #Friends
+ "friendsPageTittle": "Amigos",
+ "friendsMessageButtonText": "Mensagem",
+ "friendsNoResultFoundText": "Nenhum resultado encontrado.",
+
+ #ProfileSettings
+ "profileSettingsPageTittle": "Configurações do Perfil",
+ "profileSettingsNavbar1": "Editar Perfil",
+ "profileSettingsNavbar2": "Alterar Senha",
+ "profileSettingsNavbar3": "Adicionar Redes Sociais",
+ "profileSettingsNavbar4": "Usuários Bloqueados",
+ "profileSettingsNavbar5": "Fechar Conta",
+
+ #Edit-Profile
+ "editProfileChangeImageText": "Alterar Imagem",
+ "editProfileUsernameText": "Nome de usuário (como seu nome aparecerá para outros usuários no site)",
+ "editProfileUsernameTimeText": "Você pode alterar seu nome de usuário a cada 7 dias.",
+ "editProfileEmailText": "Email",
+ "editProfile42EmailText": "Como você está logado com 42, o recurso de configuração de e-mail está desativado.",
+ "editProfileDisplayNameText": "Nome de Exibição",
+ "editProfileSaveButtonText": "Salvar Alterações",
+
+ #Change-Password
+ "changePasswordCurrentPasswordText": "Senha Atual",
+ "changePasswordNewPasswordText": "Nova Senha",
+ "changePasswordNewConfirmPasswordText": "Confirmar Nova Senha",
+ "changePassword42Text": "Como você está logado com 42, o recurso de configuração de senha está desativado.",
+ "changePasswordSaveButtonText": "Salvar Senha",
+
+ #Add-Socials
+ "addSocialsLinkedinInputText": "Insira seu nome de usuário do LinkedIn",
+ "addSocialsTwitterInputText": "Insira seu nome de usuário do Twitter",
+ "addSocialsGithubInputText": "Insira seu nome de usuário do Github",
+ "addSocialsIntraInputText": "Insira seu nome de usuário do 42 Intra",
+ "addSocialsSaveButtonText": "Salvar Redes Sociais",
+
+ #Blocked-Users
+ "blockedUsersHeaderText": "Contas Bloqueadas",
+ "blockedUsersSubHeaderText": "Você pode desbloquear as contas que bloqueou aqui.",
+ "blockedStatusText": "Bloqueado",
+
+
+ #Close-Account
+ "closeAccountHeaderText": "Fechar Conta",
+ "closeAccountInputText": "E-mail",
+ "closeAccountSubHeaderText": "Você pode excluir sua conta aqui. Esta ação é irreversível.",
+ "closeAccountButton": "Fechar Conta",
+ }
+ return context
+
+def get_lang_hi():
+ context = {
+ #index
+ "basePageTittle": "इंडियन-पॉन्ग",
+ "baseHeaderText": "इंडियन-पॉन्ग",
+ "baseSubHeaderText": "प्रसिद्ध खेल पॉन्ग का भारतीय संस्करण",
+ "basePlayButtonText": "शुरू करें!",
+
+ "baseInfoHeaderText": "इंडियन-पॉन्ग में आपका स्वागत है!",
+ "baseInfoHeaderDescription": "पॉन्ग इंटरनेट पर क्लासिक टेबल टेनिस खेल के उत्साह और प्रतिस्पर्धा को लाता है। इस प्लेटफ़ॉर्म पर आप मजा कर सकते हैं, अपने कौशल का परिचय दे सकते हैं और शीर्ष में आने के लिए रैंकिंग में चढ़ सकते हैं।",
+ "baseInfoSubHeaderText": "खेलें और जीतें",
+ "baseInfoSubHeaderDescription1": "जीतने पर प्रत्येक खेल से पॉन्ग पॉइंट्स कमाकर रैंकिंग में चढ़ें।",
+ "baseInfoSubHeaderDescription2": "अपनी जीत से नए आइटम, रैकेट और टेबल्स खरीदने के लिए दुकान से खर्च करें।",
+ "baseInfoSubHeaderText2": "अभी शुरू करें",
+ "baseInfoSubHeaderDescription3": "प्रोफ़ाइल को व्यक्तिगत बनाने, अपने स्टैटिस्टिक्स को ट्रैक करने और रैंकिंग में अपनी जगह देखने के लिए खाता बनाएं।",
+ "baseInfoSubHeaderText3": "अधिक सुविधाएं",
+ "baseInfoSubHeaderDescription4": "अपने प्रतिद्वंद्वियों के साथ टूर्नामेंट में भाग लेने के लिए।",
+ "baseInfoSubHeaderDescription5": "अपने दोस्तों के साथ निजी खेल खेलकर मजा करें।",
+ "baseInfoSubHeaderDescription6": "अन्य खिलाड़ियों के साथ चैट करें, रणनीतियाँ साझा करें और पॉन्ग समुदाय में शामिल हों।",
+
+ #Login
+ "loginPageTittle": "लॉग इन करें",
+ "loginHeaderText1": "स्वागत है,",
+ "loginHeaderText2": "जारी रखने के लिए साइन इन करें",
+ "loginInputUsernameText": "उपयोगकर्ता नाम",
+ "loginInputPasswordText": "पासवर्ड",
+ "loginForgotPasswordText": "पासवर्ड भूल गए?",
+ "loginButtonLogin": "चलो चलते हैं",
+ "loginButtonJoin": "हमारे साथ",
+
+ #404
+ "notFoundPageTittle": "पृष्ठ नहीं मिला",
+ "notFoundHeaderText": "404 त्रुटि",
+ "notFoundSubHeaderText": "आप शायद हमारी वेबसाइट में खो गए हैं!",
+ "notFoundButtonText": "घर वापस जाओ",
+
+ #Signup
+ "signupPageTittle": "साइन अप करें",
+ "signupHeaderText1": "स्वागत है,",
+ "signupHeaderText2": "जारी रखने के लिए साइन अप करें",
+ "signupInputUsernameText": "उपयोगकर्ता नाम",
+ "signupInputDisplayNameText": "डिस्प्ले नाम",
+ "signupInputEmailText": "ईमेल",
+ "signupInputPasswordText": "पासवर्ड",
+ "signupInputConfirmPasswordText": "पासवर्ड (फिर से)",
+ "signupImageUploadText": "छवि अपलोड करें",
+ "signupGdprText1": "मैं सहमत हूं",
+ "signupGdprText2": "GDPR गोपनीयता नीति",
+ "signupButtonSignup": "चमकाओ!",
+
+ #ForgotPassword
+ "forgotPasswordPageTittle": "पासवर्ड भूल गए",
+ "forgotPasswordHeaderText": "पासवर्ड भूल गए",
+ "forgotPasswordInputEmailText": "ईमेल",
+ "forgotPasswordButtonSend": "ईमेल भेजें",
+ "forgotPasswordLinkText": "खाता नहीं है?",
+ "forgotPasswordLinkButtonText": "हमारे साथ शामिल हों",
+
+ #Password-Reset-Done
+ "passwordResetDonePageTittle": "ईमेल भेजा गया",
+ "passwordResetDoneHeaderText": "ईमेल भेजा गया",
+ "passwordResetDoneSubHeaderText": "हमने आपके ईमेल पर पासवर्ड रीसेट लिंक भेज दिया है। कृपया अपने ईमेल की जाँच करें।",
+ "passwordResetButtonText": "ईमेल भेजा गया",
+
+ #ChangePassword
+ "changePasswordPageTittle": "पासवर्ड बदलें",
+ "changePasswordHeaderText": "पासवर्ड बदलें",
+ "changePassswordSubHeaderText": "अपना पासवर्ड बदलें",
+
+
+ #Dashboard
+ "dashboardPageTittle": "डैशबोर्ड",
+ "dashboardText1": "स्वागत, ",
+ "dashboardText2": "इंडियन पॉन्ग एक सहयोगी परियोजना है जो 42 स्कूल समुदाय के लिए विकसित की गई है, जो शास्त्रीय खेल पिंग-पोंग के माध्यम से नोस्टाल्जिक गेमिंग अनुभव प्रदान करता है। यह प्लेटफ़ॉर्म प्रतिद्वंद्वियों के साथ पिंग-पोंग मैच खेलने की अनुमति देता है, जो एक दूसरे के साथ दोस्ताना प्रतिस्पर्धा का मूल्यांकन करता है। खेल के पहले पहल में, इंडियन पॉन्ग को सामाजिक आयाम प्रदान करता है, जिसमें उपयोगकर्ताओं को एक-दूसरे के साथ संवाद करने और जुड़ने का अवसर प्रदान किया जाता है। प्लेटफ़ॉर्म उपयोगकर्ताओं को 42 स्कूल समुदाय के भीतर दोस्तों को जोड़ने की सुविधा भी प्रदान करता है। समग्र रूप में, इंडियन पॉन्ग पुराने गेमिंग का आनंद और आधुनिक सामाजिक आक्रोश जोड़ते हैं, 42 स्कूल समुदाय के लिए एक जीवंत और अंतर्क्रियात्मक अनुभव बनाते हैं।",
+
+ "dashboardGamesPlayed": "खेल खेले गए",
+ "dashboardWinCount": "जीत की गई बार",
+ "dashboardWinStreak": "जीत की रेकार्ड",
+ "dashboardLoseStreak": "हार की रेकार्ड",
+ "dashboardWinRate": "जीतने की दर",
+ "dashboardAverageGameDuration": "औसत खेल की अवधि",
+ "dashboardAveragePointsWon": "औसत अंक जीते",
+ "dashboardAveragePointsLost": "औसत अंक हारे",
+
+ #Chat
+ "chatPageTittle": "चैट",
+ "chatHeaderText": "चैट",
+ "chatRecentlyText": "हाल ही में",
+ "chatDMText": "डायरेक्ट मैसेज",
+ "chatContainerSelectText": "चैट शुरू करने के लिए एक चैट चुनें",
+ "chatTodayText": "आज",
+ "chatTypeHereText": "एक संदेश लिखें...",
+
+
+ #Pong-Game
+ "pongGamePageTittle": "पॉन्ग खेल",
+ "pongGameHeaderText": "पॉन्ग लॉबी में आपका स्वागत है",
+ "pongGameSubHeaderText": "आप आर्टिफिशियल इंटेलिजेंस के साथ खेलकर खुद को बेहतर बना सकते हैं। यदि आप किसी वास्तविक व्यक्ति के साथ खेलना चाहते हैं, तो दूसरे विकल्प पर विचार करें; यदि हमें 5 मिनट के भीतर मैच के लिए कोई नहीं मिल सका, तो मैच रद्द कर दिया जाएगा। इससे पहले कि मैं भूल जाऊँ, शुभकामनाएँ!",
+ "pongGameAIButtonText": "ए.आई. के साथ खेलें",
+ "pongGameLocalButtonText": "स्थानीय खेल",
+ "pongGameRemoteButtonText": "दूरस्थ खिलाड़ी",
+ "pongGameLocalTournamentButtonText": "स्थानीय टूर्नामेंट",
+ "pongGameTournamentButtonText": "टूर्नामेंट",
+
+ #AI-Game
+ "aiGamePageTittle": "ए.आई. के साथ पॉन्ग खेल",
+ "aiGameReactionDelayText": "प्रतिक्रिया में देरी",
+ "aiGameGetReadyText": "तैयार हो जाओ",
+ "aiGameStartButtonText": "शुरू करें",
+
+ "aiGameGameOverText": "खेल समाप्त हो गया",
+ "aiGameRestartButtonText": "पुनः आरंभ",
+ "aiGameExitButtonText": "निकास",
+
+ "aiGameInfoHeaderText": "खेल के बारे में",
+ "aiGameInfoSubHeaderText": "खेल कैसे खेलें?",
+ "aiGameInfoSubHeaderDescription1": "पॉन्ग खेल में खिलाड़ी अपने प्रतिद्वंद्वी के खिलाफ एक टेनिस की मैच खेलते हैं। W-S (या ऊपर-नीचे तीर) तीरों को नियंत्रित करने के लिए उपयोग किया जाता है।",
+ "aiGameInfoSubHeaderText2": "जीतें और सुधारें",
+ "aiGameInfoSubHeaderDescription2": "आप हर जीते खेल के बाद पॉन्ग पॉइंट्स कमाते हैं। इन पॉइंट्स के साथ आप खेल का अनुभव बेहतर बनाने के लिए दुकान से नए आइटम, रैकेट और टेबल खरीद सकते हैं।",
+ "aiGameInfoSubHeaderText3": "अभी शुरू करें",
+ "aiGameInfoSubHeaderDescription3": "आप अपने खेल का अनुभव व्यक्तिगत करने के लिए एक खाता बना सकते हैं। एक खाते के साथ, आप अपने स्टैटिस्टिक्स को ट्रैक कर सकते हैं और रैंकिंग में अपनी जगह देख सकते हैं।",
+ "aiGameInfoSubHeaderText4": "अधिक सुविधाएं",
+ "aiGameInfoSubHeaderDescription4": "आप अपने प्रतिद्वंद्वियों के साथ टूर्नामेंट में भाग लेने के लिए और अपने कौशल का परीक्षण करने के लिए टूर्नामेंट में भाग ले सकते हैं। इसके अलावा, आप अपने दोस्तों के साथ निजी खेल बना सकते हैं और पॉन्ग समुदाय में शामिल हो सकते हैं।",
+
+ "aiGameInfoSubHeaderText5": "नियंत्रण",
+ "aiGameInfoSubHeaderDescription5": "ऊपर",
+ "aiGameInfoSubHeaderDescription6": "नीचे",
+ "aiGameInfoSubHeaderText6": "कौशल",
+ "aiGameInfoSubHeaderDescription7": "जैसे एक धोखेबाज",
+ "aiGameInfoSubHeaderDescription8": "तेज और उत्तेजित",
+ "aiGameInfoSubHeaderDescription9": "जमीन गेंद",
+
+ #Local-Game
+ "localGamePageTittle": "स्थानीय खेल",
+ "localGameHeaderText": "1v1 स्थानीय खेल",
+ "localGamePlayer1Text": "प्लेयर1 नाम",
+ "localGamePlayer2Text": "प्लेयर2 नाम",
+ "localGameMaxScoreText": "अधिकतम स्कोर",
+ "localGameGameModeText": "खेल मोड",
+ "localGameChooseModeText1": "वनिला",
+ "localGameChooseModeText2": "क्षमताएँ",
+ "localGameButtonStart": "प्रारंभ करें",
+
+ #Local-Tournament
+ "localTournamentPageTittle": "स्थानीय टूर्नामेंट",
+ "localTournamentGameHeaderText": "स्थानीय टूर्नामेंट",
+ "localTournamentPlayer1Text": "1. खिलाड़ी नाम",
+ "localTournamentPlayer2Text": "2. खिलाड़ी नाम",
+ "localTournamentPlayer3Text": "3. खिलाड़ी नाम",
+ "localTournamentPlayer4Text": "4. खिलाड़ी नाम",
+ "localTournamentMaxScoreText": "अधिकतम स्कोर",
+ "localTournamentGameModeText": "खेल मोड",
+ "localTournamentChooseModeText1": "वनिला",
+ "localTournamentChooseModeText2": "क्षमताएँ",
+ "localTournamentButtonStart": "टूर्नामेंट शुरू करें",
+ "localTournamentBracketTitle": "ब्रैकेट",
+ "localTournamentBracketStartButtonText": "टूर्नामेंट शुरू करें",
+ "localTournamentTournamentOverText": "टूर्नामेंट खत्म हो गया",
+ "localTournamentOverButtonText": "खत्म करें",
+
+
+ "localTournamentNextButtonText": "अगला",
+
+ #Tournament
+ "tournamentPageTittle": "टूर्नामेंट",
+ "tournamentHeaderText": "पॉन्ग के टूर्नामेंट लॉबी में आपका स्वागत है",
+ "tournamentSubHeaderText": "यहां आप एक टूर्नामेंट लॉबी में शामिल हो सकते हैं या अपनी खुद की टूर्नामेंट लॉबी बना सकते हैं। आप अपने दोस्तों को रुम बनाने के बाद इनवाइट कोड साझा करके इन्वाइट कर सकते हैं। भूलने से पहले शुभकामनाएं!",
+ "tournamentJoinButtonText": "टूर्नामेंट में शामिल हों",
+ "tournamentCreateButtonText": "टूर्नामेंट बनाएं",
+
+ #Tournament-Create
+ "tournamentCreatePageTittle": "टूर्नामेंट बनाएं",
+ "tournamentCreateHeaderText": "टूर्नामेंट बनाएं",
+ "tournamentCreateSubHeaderText": "एक टूर्नामेंट बनाने के लिए मुझे एक टूर्नामेंट का नाम, हर खेल के लिए कितना अधिकतम स्कोर होगा। भूलने से पहले शुभकामनाएं!",
+ "tournamentCreateNameText": "टूर्नामेंट का नाम",
+ "tournamentCreateMaxPointsText": "अधिकतम स्कोर खेलें",
+ "tournamentCreateGameModeText": "खेल मोड",
+ "tournamentCreateChooseModeText1": "वनिला",
+ "tournamentCreateChooseModeText2": "क्षमताएँ",
+ "tournamentCreateButtonCreate": "टूर्नामेंट बनाएं",
+
+ #Joined-Tournament-Room
+ "tournamentroomPageTittle": "टूर्नामेंट रूम",
+ "tournamentroomHeaderText": "टूर्नामेंट रूम",
+ "tournamentroomLeaveButtonText": "छोड़ें",
+ "tournamentroomRoomText": "रूम",
+ "tournamentroomStartButtonText": "शुरू करें",
+ "tournamentroomJoinButtonText": "शामिल हों",
+ "tournamentCheckBracketButtonText": "ब्रैकेट देखें",
+ "tournamentOverWinnerGuyText": "विजेता",
+ "tournamentOverLosersText": "हारने वाले",
+ "tournamentroomTournamentRoomButton": "टूर्नामेंट रूम",
+ "tournamentroomWaitingText": "इंतजार कर",
+ "tournamentroomForPlayerText": "खिलाड़ी ",
+
+ #Tournament Room List
+ "tournamentRoomListPageTittle": "टूर्नामेंट रूम सूची",
+ "tournamentRoomListHeaderText": "टूर्नामेंट रूम सूची",
+
+ #Remote Pong Game
+ "remotePongGamePageTittle": "दूरस्थ पॉन्ग खेल",
+ "remotePongGameTableName": "नाम",
+ "remotePongGameTableActions": "कार्रवाई",
+ "remotePongGameMatchmakingButtonText": "मैचमेकिंग",
+ "remotePongGameLeaveButtonText": "छोड़ें",
+ "remotePongGameStartText": "शुरू करें",
+ "remotePongGameStartButtonText": "शुरू करें",
+ "remotePongSelectedMode": "चयनित मोड",
+
+
+
+ #RPS Game
+ "rpsGamePageTittle": "रॉक-पेपर-सैंड खेल",
+ "rpsGameText1": "रॉक-पेपर-सैंड लॉबी में आपका स्वागत है",
+ "rpsGameText2": "आप आर्टिफिशियल इंटेलिजेंस के साथ खेलकर खुद को बेहतर बना सकते हैं। यदि आप किसी वास्तविक व्यक्ति के साथ खेलना चाहते हैं, तो दूसरे विकल्प पर विचार करें; यदि हमें 5 मिनट के भीतर मैच के लिए कोई नहीं मिल सका, तो मैच रद्द कर दिया जाएगा। इससे पहले कि मैं भूल जाऊँ, शुभकामनाएँ!",
+ "rpsGameAIButtonText": "ए.आई. के साथ खेलें",
+ "rpsGameLocalButtonText": "स्थानीय खेल",
+ "rpsGameSearchOpponentButtonText": "विरोधी खोजें ",
+ "rpsUserCountText": "उपयोगकर्ता",
+ #AI-Game
+ "rpsGamePageTittle": "रॉक कागज कैंची आर्टिफिशियल इंटेलिजेंस गेम",
+ "rpsGameScoreText": "स्कोर",
+ "rpsGameRockText": "पत्थर",
+ "rpsGamePaperText": "कागज",
+ "rpsGameScissorsText": "कैंची",
+ "rpsGamePickedText": "तुमने चुना",
+ "rpsGamePickedText2": "विरोधी चुना",
+ "rpsGameAgainText": "फिर से खेलें",
+ "rpsGameGameOverText": "खेल समाप्त",
+ "rpsGameRestartButtonText": "फिर से शुरू करें",
+ "rpsGameExitButtonText": "बाहर जाएं",
+
+
+ #Rankings
+ "rankingsPageTittle": "रैंकिंग",
+ "rankingsTableRankText": "रैंक",
+ "rankingsTableNameText": "नाम",
+ "rankingsTableUsernameText": "उपयोगकर्ता नाम",
+ "rankingsTableWinsText": "जीतें",
+ "rankingsTableLossesText": "हारें",
+ "rankingsTableWinRateText": "जीतने की दर",
+ "rankingsTablePongPointsText": "पॉन्ग अंक",
+
+ #Store
+ "storePageTittle": "दुकान",
+ "storeText": "दुकान",
+ "storeTagText": "सभी",
+ "storeWalletText": "वॉलेट",
+ "storeWalleinfoText1": "खेल खेलकर ",
+ "storeWalleinfoText2": " जीत सकते हैं।",
+
+ #Inventory
+ "inventoryPageTittle": "इन्वेंटरी",
+ "inventoryText": "इन्वेंटरी",
+ "inventoryTagText": "सभी",
+ "inventoryWalletText": "वॉलेट",
+ "inventoryWalleinfoText1": "खेल खेलकर ",
+ "inventoryWalleinfoText2": " जीत सकते हैं।",
+ "inventoryModalHeaderText": "आइटम खरीदें",
+ "inventoryModalSaveButton": "खरीदें",
+ "inventoryModalCloseButton": "बंद करें",
+ "inventoryItemKeyboardInfoText": "उपयोग",
+ "inventoryItemKeyboardInfoText2": "इस आइटम के लिए कोई विशेष कीपैड नहीं है, यह स्वचालित रूप से उपयोग किया जाता है।",
+ "inventoryItemKeyboardInfoText3": "इस आइटम के लिए कोई विशेष कीपैड नहीं है, यह स्वचालित रूप से उपयोग किया जाता है।",
+
+
+ #Search
+ "searchPageTittle": "खोजें",
+ "searchInputText": "ईमेल या उपयोगकर्ता नाम या डिस्प्ले नाम खोजें...",
+ "searchMessageButtonText": "संदेश",
+ "searchFollowButtonText": "अनुसरण करना",
+ "searchFollowingButtonText": "अनफ़ॉलो",
+ "searchNoResultFoundText": "कोई परिणाम नहीं मिला।",
+
+ #Profile
+ "profilePageTittle": "प्रोफ़ाइल",
+ "profileRankAIText": "ए.आई. रैंक",
+ "profileRankUserText1": " उपयोगकर्ता रैंक",
+ "profileRankUserText2": " रैंक",
+ "profileFollowButton": "अनुसरण करना",
+ "profileFollowingButton": "अनफ़ॉलो",
+ "profileTitleText1": "42 स्कूल समुदाय",
+ "profileTitleText2": "पॉन्ग खिलाड़ी",
+
+ "profileLinkedinSocialText": "कोई लिंक्डइन नहीं",
+ "profileTwitterSocialText": "कोई ट्विटर नहीं",
+ "profileGithubSocialText": "कोई गिटहब नहीं",
+ "profileIntra42SocialText": "कोई इंट्रा नहीं",
+
+ "profileMatchHistoryText1": "प्रतिद्वंद्वी",
+ "profileMatchHistoryText2": "परिणाम",
+ "profileMatchHistoryText3": "अंक",
+ "profileMatchHistoryText4": "अवधि",
+
+ "profileMatchHistoryWinText": "जीता",
+ "profileMatchHistoryLoseText": "हारा",
+
+ "profileRankText1": "रैंक",
+ "profileStatsText": "आंकड़े",
+
+ "profileGameStats1": "खेल खेले गए:",
+ "profileGameStats2": "जीतें:",
+ "profileGameStats3": "हारें:",
+ "profileGameStats4": "जीतने की दर:",
+ "profileGameStats5": "औसत अंक जीते:",
+ "profileGameStats6": "औसत अंक हारे:",
+
+ #Friends
+ "friendsPageTittle": "मित्र",
+ "friendsMessageButtonText": "संदेश",
+ "friendsNoResultFoundText": "कोई परिणाम नहीं मिला।",
+
+
+ #ProfileSettings
+ "profileSettingsPageTittle": "प्रोफ़ाइल सेटिंग्स",
+ "profileSettingsNavbar1": "प्रोफ़ाइल संपादित करें",
+ "profileSettingsNavbar2": "पासवर्ड बदलें",
+ "profileSettingsNavbar3": "सोशल्स जोड़ें",
+ "profileSettingsNavbar4": "अवरुद्ध उपयोगकर्ता",
+ "profileSettingsNavbar5": "खाता बंद करें",
+
+ #Edit-Profile
+ "editProfileChangeImageText": "छवि बदलें",
+ "editProfileUsernameText": "उपयोगकर्ता नाम (आपका नाम साइट पर अन्य उपयोगकर्ताओं के लिए कैसे दिखाई देगा)",
+ "editProfileUsernameTimeText": "आप अपना उपयोगकर्ता नाम एक बार बदल सकते हैं।",
+ "editProfileEmailText": "ईमेल",
+ "editProfile42EmailText": "चूंकि आप 42 के साथ लॉग इन हैं, आपकी ईमेल सेटिंग सुविधा अक्षम है।",
+ "editProfileDisplayNameText": "प्रदर्शन नाम",
+ "editProfileSaveButtonText": "परिवर्तन सहेजें",
+
+ #Change-Password
+ "changePasswordCurrentPasswordText": "वर्तमान पासवर्ड",
+ "changePasswordNewPasswordText": "नया पासवर्ड",
+ "changePasswordNewConfirmPasswordText": "नया पासवर्ड पुष्टि करें",
+ "changePassword42Text": "चूंकि आप 42 के साथ लॉग इन हैं, आपकी पासवर्ड सेटिंग सुविधा अक्षम है।",
+ "changePasswordSaveButtonText": "पासवर्ड सहेजें",
+
+ #Add-Socials
+ "addSocialsLinkedinInputText": "अपना LinkedIn उपयोगकर्ता नाम दर्ज करें",
+ "addSocialsTwitterInputText": "अपना Twitter उपयोगकर्ता नाम दर्ज करें",
+ "addSocialsGithubInputText": "अपना Github उपयोगकर्ता नाम दर्ज करें",
+ "addSocialsIntraInputText": "अपना 42 Intra उपयोगकर्ता नाम दर्ज करें",
+ "addSocialsSaveButtonText": "सोशल्स सहेजें",
+
+ #Blocked-Users
+ "blockedUsersHeaderText": "अवरुद्ध खाते",
+ "blockedUsersSubHeaderText": "आप यहां अपने द्वारा अवरुद्ध किए गए खातों को अनवरोधित कर सकते हैं।",
+ "blockedStatusText": "अवरुद्ध",
+
+ #Close-Account
+ "closeAccountHeaderText": "खाता बंद करें",
+ "closeAccountInputText": "ईमेल",
+ "closeAccountSubHeaderText": "आप यहां अपना खाता हटा सकते हैं। यह कार्रवाई अपरिवर्तनीय है।",
+ "closeAccountButton": "खाता बंद करें",
+
+ }
return context
\ No newline at end of file
diff --git a/indianpong/pong/management/commands/populate.py b/indianpong/pong/management/commands/populate.py
index badca14..f151eb4 100644
--- a/indianpong/pong/management/commands/populate.py
+++ b/indianpong/pong/management/commands/populate.py
@@ -1,67 +1,67 @@
-from django.contrib.auth.hashers import make_password
-from pong.models import UserProfile, UserGameStat, Social
-from random import randint, choice
-from django.core.management.base import BaseCommand
-from datetime import timedelta
-
-class Command(BaseCommand):
- help = 'Populates the database with users'
-
- def add_arguments(self, parser):
- parser.add_argument('num_users', type=int, help='Number of users to create')
-
- def handle(self, *args, **options):
- num_users = options['num_users']
- user_game_stats_pong = []
- socials = []
- user_profiles = []
- password = make_password('123456a.')
-
- for i in range(num_users):
- username = "Indian" + str(i)
- displayname = "Original Indian" + str(i)
- email = username + '@indian.com'
-
- # Prepare UserGameStat instance
- game_stat = UserGameStat(
- total_games_pong=randint(0, 100),
- total_win_pong=randint(0, 100),
- total_lose_pong=randint(0, 100),
- total_win_streak_pong=randint(0, 100),
- total_lose_streak_pong=randint(0, 100),
- total_win_rate_pong=randint(0, 100) / 100.0,
- total_avg_game_duration_pong=timedelta(seconds=randint(0, 3600)),
- total_avg_points_won_pong=randint(0, 100),
- total_avg_points_lost_pong=randint(0, 100)
- )
- user_game_stats_pong.append(game_stat)
-
- # Prepare Social instance
- social = Social(
- intra42 = username,
- linkedin = username,
- github = username,
- twitter= username,
- )
- socials.append(social)
-
- # Prepare UserProfile instance
- user_profile = UserProfile(
- username=username,
- email=email,
- displayname=displayname,
- password=password,
- game_stats_pong=game_stat,
- social=social
- )
- user_profiles.append(user_profile)
-
- # Create instances in database
- UserGameStat.objects.bulk_create(user_game_stats_pong)
- Social.objects.bulk_create(socials)
- #UserProfile.objects.bulk_create(user_profiles)
- # Create UserProfile instances individually to trigger save method
- for user_profile in user_profiles:
- user_profile.save()
-
+from django.contrib.auth.hashers import make_password
+from pong.models import UserProfile, UserGameStat, Social
+from random import randint, choice
+from django.core.management.base import BaseCommand
+from datetime import timedelta
+
+class Command(BaseCommand):
+ help = 'Populates the database with users'
+
+ def add_arguments(self, parser):
+ parser.add_argument('num_users', type=int, help='Number of users to create')
+
+ def handle(self, *args, **options):
+ num_users = options['num_users']
+ user_game_stats_pong = []
+ socials = []
+ user_profiles = []
+ password = make_password('123456a.')
+
+ for i in range(num_users):
+ username = "Indian" + str(i)
+ displayname = "Original Indian" + str(i)
+ email = username + '@indian.com'
+
+ # Prepare UserGameStat instance
+ game_stat = UserGameStat(
+ total_games_pong=randint(0, 100),
+ total_win_pong=randint(0, 100),
+ total_lose_pong=randint(0, 100),
+ total_win_streak_pong=randint(0, 100),
+ total_lose_streak_pong=randint(0, 100),
+ total_win_rate_pong=randint(0, 100) / 100.0,
+ total_avg_game_duration_pong=timedelta(seconds=randint(0, 3600)),
+ total_avg_points_won_pong=randint(0, 100),
+ total_avg_points_lost_pong=randint(0, 100)
+ )
+ user_game_stats_pong.append(game_stat)
+
+ # Prepare Social instance
+ social = Social(
+ intra42 = username,
+ linkedin = username,
+ github = username,
+ twitter= username,
+ )
+ socials.append(social)
+
+ # Prepare UserProfile instance
+ user_profile = UserProfile(
+ username=username,
+ email=email,
+ displayname=displayname,
+ password=password,
+ game_stats_pong=game_stat,
+ social=social
+ )
+ user_profiles.append(user_profile)
+
+ # Create instances in database
+ UserGameStat.objects.bulk_create(user_game_stats_pong)
+ Social.objects.bulk_create(socials)
+ #UserProfile.objects.bulk_create(user_profiles)
+ # Create UserProfile instances individually to trigger save method
+ for user_profile in user_profiles:
+ user_profile.save()
+
self.stdout.write(self.style.SUCCESS(f'Successfully populated the database with {num_users} users.'))
\ No newline at end of file
diff --git a/indianpong/pong/rps.py b/indianpong/pong/rps.py
index a1d9997..1b0ea88 100644
--- a/indianpong/pong/rps.py
+++ b/indianpong/pong/rps.py
@@ -1,124 +1,124 @@
-from enum import Enum
-import time
-
-class Choices(Enum):
- ROCK = 0
- PAPER = 1
- SCISSORS = 2
-
-class Abilities(Enum):
- LIKEACHEATER = 3,
- GODOFTHINGS = 4
-
-class RoundResult(Enum):
- DRAW = 0
- PLAYER1_WIN = 1
- PLAYER2_WIN = 2
-
-KV_CHOICES = {'rock': Choices.ROCK, 'paper': Choices.PAPER, 'scissors': Choices.SCISSORS, 'godthings': Abilities.GODOFTHINGS, 'cheater': Abilities.LIKEACHEATER}
-
-class Shaker:
- def __init__(self, username):
- self.username = username
- self.score = 0
- self.choices = []
-
-class RPS:
- def __init__(self, player1, player2):
- self.shaker1 = Shaker(player1)
- self.shaker2 = Shaker(player2)
- self.max_score = 3
- self.group_name = f'rps_{player1}_{player2}'
- self.start_time = 0
- self.end_time = 0
-
- def play(self, username, choice):
- if (self.start_time == 0):
- self.start_time = time.time()
- if username == self.shaker1.username:
- self.shaker1.choices.append(KV_CHOICES[choice])
- elif username == self.shaker2.username:
- self.shaker2.choices.append(KV_CHOICES[choice])
-
- def ability_result(self, choice1, choice2):
- ab1 = choice1 == Abilities.LIKEACHEATER or choice1 == Abilities.GODOFTHINGS
- ab2 = choice2 == Abilities.LIKEACHEATER or choice2 == Abilities.GODOFTHINGS
- if ab1 and ab2: #both played this it's draw
- return 0
- elif ab1 and choice1 == Abilities.LIKEACHEATER: #stole opponent score if greater than 0
- if self.shaker2.score > 0:
- self.shaker2.score -= 1
- self.shaker1.score += 1
- return 1
- elif ab2 and choice2 == Abilities.LIKEACHEATER: #won round instantly
- if self.shaker1.score > 0:
- self.shaker1.score -= 1
- self.shaker2.score += 1
- return 2
- elif ab1 and choice1 == Abilities.GODOFTHINGS:
- self.shaker1.score += 1
- return 1
- elif ab2 and choice2 == Abilities.GODOFTHINGS:
- self.shaker2.score += 1
- return 2
- else:
- return 3
-
-
- def round_result(self):
- shaker1_choice = self.shaker1.choices.pop()
- shaker2_choice = self.shaker2.choices.pop()
- result = self.ability_result(shaker1_choice, shaker2_choice)
- if result == 0:
- return RoundResult.DRAW.name
- elif result == 1:
- return RoundResult.PLAYER1_WIN.name
- elif result == 2:
- return RoundResult.PLAYER2_WIN.name
- result = (shaker1_choice.value - shaker2_choice.value) % 3
- if result == 0:
- return RoundResult.DRAW.name
- elif result == 1:
- self.shaker1.score += 1
- return RoundResult.PLAYER1_WIN.name
- else:
- self.shaker2.score += 1
- return RoundResult.PLAYER2_WIN.name
-
- def check_is_over(self):
- if self.shaker1.score == self.max_score or self.shaker2.score == self.max_score:
- self.end_time = time.time()
- return True
- return False
-
- def get_winner_loser(self):
- if self.shaker1.score > self.shaker2.score:
- return self.shaker1.username, self.shaker2.username
- else:
- return self.shaker2.username, self.shaker1.username
-
- def otherPlayer(self, username):
- if username == self.shaker1.username:
- return self.shaker2.username
- else:
- return self.shaker1.username
-
- def get_scores(self):
- return self.shaker1.score, self.shaker2.score
-
- def getDuration(self):
- if self.end_time == 0:
- self.end_time = time.time()
- return self.end_time - self.start_time
-
- def getWinnerLoserandScores(self):
- if self.shaker1.score > self.shaker2.score:
- return self.shaker1.username, self.shaker2.username, self.shaker1.score, self.shaker2.score
- else:
- return self.shaker2.username, self.shaker1.username, self.shaker2.score, self.shaker1.score
-
- def both_played(self):
- return len(self.shaker1.choices) == len(self.shaker2.choices) == 1
-
- def getChoices(self):
- return self.shaker1.choices[0].name, self.shaker2.choices[0].name
+from enum import Enum
+import time
+
+class Choices(Enum):
+ ROCK = 0
+ PAPER = 1
+ SCISSORS = 2
+
+class Abilities(Enum):
+ LIKEACHEATER = 3,
+ GODOFTHINGS = 4
+
+class RoundResult(Enum):
+ DRAW = 0
+ PLAYER1_WIN = 1
+ PLAYER2_WIN = 2
+
+KV_CHOICES = {'rock': Choices.ROCK, 'paper': Choices.PAPER, 'scissors': Choices.SCISSORS, 'godthings': Abilities.GODOFTHINGS, 'cheater': Abilities.LIKEACHEATER}
+
+class Shaker:
+ def __init__(self, username):
+ self.username = username
+ self.score = 0
+ self.choices = []
+
+class RPS:
+ def __init__(self, player1, player2):
+ self.shaker1 = Shaker(player1)
+ self.shaker2 = Shaker(player2)
+ self.max_score = 3
+ self.group_name = f'rps_{player1}_{player2}'
+ self.start_time = 0
+ self.end_time = 0
+
+ def play(self, username, choice):
+ if (self.start_time == 0):
+ self.start_time = time.time()
+ if username == self.shaker1.username:
+ self.shaker1.choices.append(KV_CHOICES[choice])
+ elif username == self.shaker2.username:
+ self.shaker2.choices.append(KV_CHOICES[choice])
+
+ def ability_result(self, choice1, choice2):
+ ab1 = choice1 == Abilities.LIKEACHEATER or choice1 == Abilities.GODOFTHINGS
+ ab2 = choice2 == Abilities.LIKEACHEATER or choice2 == Abilities.GODOFTHINGS
+ if ab1 and ab2: #both played this it's draw
+ return 0
+ elif ab1 and choice1 == Abilities.LIKEACHEATER: #stole opponent score if greater than 0
+ if self.shaker2.score > 0:
+ self.shaker2.score -= 1
+ self.shaker1.score += 1
+ return 1
+ elif ab2 and choice2 == Abilities.LIKEACHEATER: #won round instantly
+ if self.shaker1.score > 0:
+ self.shaker1.score -= 1
+ self.shaker2.score += 1
+ return 2
+ elif ab1 and choice1 == Abilities.GODOFTHINGS:
+ self.shaker1.score += 1
+ return 1
+ elif ab2 and choice2 == Abilities.GODOFTHINGS:
+ self.shaker2.score += 1
+ return 2
+ else:
+ return 3
+
+
+ def round_result(self):
+ shaker1_choice = self.shaker1.choices.pop()
+ shaker2_choice = self.shaker2.choices.pop()
+ result = self.ability_result(shaker1_choice, shaker2_choice)
+ if result == 0:
+ return RoundResult.DRAW.name
+ elif result == 1:
+ return RoundResult.PLAYER1_WIN.name
+ elif result == 2:
+ return RoundResult.PLAYER2_WIN.name
+ result = (shaker1_choice.value - shaker2_choice.value) % 3
+ if result == 0:
+ return RoundResult.DRAW.name
+ elif result == 1:
+ self.shaker1.score += 1
+ return RoundResult.PLAYER1_WIN.name
+ else:
+ self.shaker2.score += 1
+ return RoundResult.PLAYER2_WIN.name
+
+ def check_is_over(self):
+ if self.shaker1.score == self.max_score or self.shaker2.score == self.max_score:
+ self.end_time = time.time()
+ return True
+ return False
+
+ def get_winner_loser(self):
+ if self.shaker1.score > self.shaker2.score:
+ return self.shaker1.username, self.shaker2.username
+ else:
+ return self.shaker2.username, self.shaker1.username
+
+ def otherPlayer(self, username):
+ if username == self.shaker1.username:
+ return self.shaker2.username
+ else:
+ return self.shaker1.username
+
+ def get_scores(self):
+ return self.shaker1.score, self.shaker2.score
+
+ def getDuration(self):
+ if self.end_time == 0:
+ self.end_time = time.time()
+ return self.end_time - self.start_time
+
+ def getWinnerLoserandScores(self):
+ if self.shaker1.score > self.shaker2.score:
+ return self.shaker1.username, self.shaker2.username, self.shaker1.score, self.shaker2.score
+ else:
+ return self.shaker2.username, self.shaker1.username, self.shaker2.score, self.shaker1.score
+
+ def both_played(self):
+ return len(self.shaker1.choices) == len(self.shaker2.choices) == 1
+
+ def getChoices(self):
+ return self.shaker1.choices[0].name, self.shaker2.choices[0].name
diff --git a/indianpong/pong/templates/_nav.html b/indianpong/pong/templates/_nav.html
index dbda809..f51ab4f 100644
--- a/indianpong/pong/templates/_nav.html
+++ b/indianpong/pong/templates/_nav.html
@@ -69,7 +69,7 @@
initializeBurger();
}
- var socket = new WebSocket('ws://' + window.location.host + '/ws/online_status/');
+ var socket = new WebSocket('wss://' + window.location.host + '/ws/online_status/');
socket.onopen = function(e) {
console.log('User is connected');
diff --git a/indianpong/pong/templates/local-game.html b/indianpong/pong/templates/local-game.html
index af7bb96..d504125 100644
--- a/indianpong/pong/templates/local-game.html
+++ b/indianpong/pong/templates/local-game.html
@@ -1,116 +1,116 @@
-{% extends "base.html" %}
-
-{% load static %}
-
-{% block title %}{{context.localGamePageTittle}}{% endblock title %}
-
-{% block stylesheet %}{% endblock %}
-
-{% block app %}
-
-
-
-
-
-
-
{{context.localGameHeaderText}}
-
-
-
-
-
-
-
-
- {{context.aiGameGameOverText}}
-
-
-
-
-
-
-
+{% extends "base.html" %}
+
+{% load static %}
+
+{% block title %}{{context.localGamePageTittle}}{% endblock title %}
+
+{% block stylesheet %}{% endblock %}
+
+{% block app %}
+
+
+
+
+
+
+
{{context.localGameHeaderText}}
+
+
+
+
+
+
+
+
+ {{context.aiGameGameOverText}}
+
+
+
+
+
+
+
{% endblock %}
\ No newline at end of file
diff --git a/indianpong/pong/templates/local-tournament.html b/indianpong/pong/templates/local-tournament.html
index e14c806..584b21d 100644
--- a/indianpong/pong/templates/local-tournament.html
+++ b/indianpong/pong/templates/local-tournament.html
@@ -1,190 +1,190 @@
-{% extends "base.html" %}
-
-{% load static %}
-
-{% block title %}{{context.localTournamentPageTittle}}{% endblock title %}
-
-
-{% block app %}
-
-
-
-
-
-
-
{{context.localTournamentGameHeaderText}}
-
-
-
-
-
{{context.localTournamentBracketTitle}}
-
-
-
-
-
-
- 1
-
-
-
- 2
-
-
-
-
-
-
-
- 3
-
-
-
- 4
-
-
-
-
-
-
-
-
-
- 5
-
-
-
- 6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{context.aiGameGameOverText}}
-
-
-
-
-
- {{context.localTournamentTournamentOverText}}
-
-
-
-
-
+{% extends "base.html" %}
+
+{% load static %}
+
+{% block title %}{{context.localTournamentPageTittle}}{% endblock title %}
+
+
+{% block app %}
+
+
+
+
+
+
+
{{context.localTournamentGameHeaderText}}
+
+
+
+
+
{{context.localTournamentBracketTitle}}
+
+
+
+
+
+
+ 1
+
+
+
+ 2
+
+
+
+
+
+
+
+ 3
+
+
+
+ 4
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+ 6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{context.aiGameGameOverText}}
+
+
+
+
+
+ {{context.localTournamentTournamentOverText}}
+
+
+
+
+
{% endblock %}
\ No newline at end of file
diff --git a/indianpong/pong/templates/play-rps-ai.html b/indianpong/pong/templates/play-rps-ai.html
index 5bdcd01..b39d180 100644
--- a/indianpong/pong/templates/play-rps-ai.html
+++ b/indianpong/pong/templates/play-rps-ai.html
@@ -1,81 +1,81 @@
-{% extends 'base.html' %}
-
-{% load static %}
-
-{% block title %}
- {{context.rpsGamePageTittle}}
-{% endblock %}
-
-{% block stylesheet %}{% endblock %}
-
-{% block app %}
-
-
-
- {% if cheater_rps == "true" %}
-
- {% endif %}
- {% if godthings_rps == "true" %}
-
- {% endif %}
-
-
-
-
-
-
-
- {{context.rpsGamePickedText}}
- {{context.rpsGamePickedText2}}
-
-
-
-
-
-
-
-
-
-
- {{context.rpsGameGameOverText}}
-
-
-
-
-
- {% csrf_token %}
-{% endblock %}
+{% extends 'base.html' %}
+
+{% load static %}
+
+{% block title %}
+ {{context.rpsGamePageTittle}}
+{% endblock %}
+
+{% block stylesheet %}{% endblock %}
+
+{% block app %}
+
+
+
+ {% if cheater_rps == "true" %}
+
+ {% endif %}
+ {% if godthings_rps == "true" %}
+
+ {% endif %}
+
+
+
+
+
+
+
+ {{context.rpsGamePickedText}}
+ {{context.rpsGamePickedText2}}
+
+
+
+
+
+
+
+
+
+
+ {{context.rpsGameGameOverText}}
+
+
+
+
+
+ {% csrf_token %}
+{% endblock %}
diff --git a/indianpong/pong/templates/play-rps.html b/indianpong/pong/templates/play-rps.html
index 6435248..c068fff 100644
--- a/indianpong/pong/templates/play-rps.html
+++ b/indianpong/pong/templates/play-rps.html
@@ -1,111 +1,111 @@
-{% extends 'base.html' %}
-
-{% load static %}
-
-{% block title %}
- Remote RPS
-{% endblock %}
-
-{% block stylesheet %}
-
-{% endblock %}
-
-{% block app %}
-
-
-
-
-
- {% if cheater_rps == "true" %}
-
- {% endif %}
- {% if godthings_rps == "true" %}
-
- {% endif %}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{context.rpsGameGameOverText}}
-
-
-
-
-
-
-{% endblock %}
+{% extends 'base.html' %}
+
+{% load static %}
+
+{% block title %}
+ Remote RPS
+{% endblock %}
+
+{% block stylesheet %}
+
+{% endblock %}
+
+{% block app %}
+
+
+
+
+
+ {% if cheater_rps == "true" %}
+
+ {% endif %}
+ {% if godthings_rps == "true" %}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{context.rpsGameGameOverText}}
+
+
+
+
+
+
+{% endblock %}
diff --git a/indianpong/pong/templates/remote-game.html b/indianpong/pong/templates/remote-game.html
index a731b87..93328ad 100644
--- a/indianpong/pong/templates/remote-game.html
+++ b/indianpong/pong/templates/remote-game.html
@@ -1,77 +1,77 @@
- {% extends 'base.html' %}
-{% load static %}
-
-{% block title %}
- {{context.remotePongGamePageTittle}}
-{% endblock %}
-
-{% block stylesheet %}
-
-
-{% endblock %}
-
-{% block app %}
-
-
-
-
-
-
- {{context.remotePongGameTableName}} |
- {{context.remotePongGameTableActions}} |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% comment %}
-
- {% endcomment %}
-
-
-
-
-
-
-
-
- {{context.aiGameGameOverText}}
-
-
-
-
-
-{% csrf_token %}
+ {% extends 'base.html' %}
+{% load static %}
+
+{% block title %}
+ {{context.remotePongGamePageTittle}}
+{% endblock %}
+
+{% block stylesheet %}
+
+
+{% endblock %}
+
+{% block app %}
+
+
+
+
+
+
+ {{context.remotePongGameTableName}} |
+ {{context.remotePongGameTableActions}} |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% comment %}
+
+ {% endcomment %}
+
+
+
+
+
+
+
+
+ {{context.aiGameGameOverText}}
+
+
+
+
+
+{% csrf_token %}
{% endblock %}
\ No newline at end of file
diff --git a/indianpong/pong/templates/room.html b/indianpong/pong/templates/room.html
index 03613c3..58adbc6 100644
--- a/indianpong/pong/templates/room.html
+++ b/indianpong/pong/templates/room.html
@@ -1,170 +1,170 @@
-{% extends 'base.html' %}
-
-{% load static %}
-{% load status %}
-
-{% block title %}
-{{context.chatPageTittle}}
-{% endblock %}
-
-{% block stylesheet %}{% endblock %}
-{% block app %}
-
-{% load custom_filters %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% if room.first_user == request.user %}
-
- ![]({{ room.second_user.avatar.url }})
-
- {{ room.second_user }}
-
- {% else %}
-
- ![]({{ room.first_user.avatar.url }})
-
- {{ room.first_user }}
-
- {% endif %}
-
-
-
-
-
- {% if not user_friends_status|get_item:room.second_user.username %}
-
-
- {% else %}
-
-
- {% endif %}
- {% if user_blocked_status|get_item:room.second_user.username or user_blocked_status|get_item:room.first_user.username %}
-
-
- {% else %}
-
-
- {% endif %}
-
-
-
-
-
-
-
- {{context.chatTodayText}}
-
-
- {% for message in messages %}
-
- {% if request.user == message.user %}
-
-
-
-
-
-
-
- {{ message.content }}
-
{{ message.get_short_date }}
-
-
-
-
-
- {% else %}
-
-
-
-
-
-
- {{ message.content }}
-
{{ message.get_short_date }}
-
-
-
-
-
-
- {% endif %}
- {% endfor %}
-
-
-
-
-
-
-
-
- {{ room_name|json_script:"room-name" }}
- {{ request.user.username|json_script:"user" }}
-
-
-
-
-
-
- {% csrf_token %}
+{% extends 'base.html' %}
+
+{% load static %}
+{% load status %}
+
+{% block title %}
+{{context.chatPageTittle}}
+{% endblock %}
+
+{% block stylesheet %}{% endblock %}
+{% block app %}
+
+{% load custom_filters %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% if room.first_user == request.user %}
+
+ ![]({{ room.second_user.avatar.url }})
+
+ {{ room.second_user }}
+
+ {% else %}
+
+ ![]({{ room.first_user.avatar.url }})
+
+ {{ room.first_user }}
+
+ {% endif %}
+
+
+
+
+
+ {% if not user_friends_status|get_item:room.second_user.username %}
+
+
+ {% else %}
+
+
+ {% endif %}
+ {% if user_blocked_status|get_item:room.second_user.username or user_blocked_status|get_item:room.first_user.username %}
+
+
+ {% else %}
+
+
+ {% endif %}
+
+
+
+
+
+
+
+ {{context.chatTodayText}}
+
+
+ {% for message in messages %}
+
+ {% if request.user == message.user %}
+
-
+
+
+
+
+
+ {{ message.content }}
+
{{ message.get_short_date }}
+
+
+
+
+
+ {% else %}
+
-
+
+
+
+
+ {{ message.content }}
+
{{ message.get_short_date }}
+
+
+
+
+
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+
+
+
+ {{ room_name|json_script:"room-name" }}
+ {{ request.user.username|json_script:"user" }}
+
+
+
+
+
+
+ {% csrf_token %}
{% endblock %}
\ No newline at end of file
diff --git a/indianpong/pong/templates/tournament-create.html b/indianpong/pong/templates/tournament-create.html
index c71dad5..d516630 100644
--- a/indianpong/pong/templates/tournament-create.html
+++ b/indianpong/pong/templates/tournament-create.html
@@ -1,47 +1,47 @@
-{% extends 'base.html' %}
-{% load static %}
-
-{% block title %}{{context.tournamentCreatePageTittle}}{% endblock title %}
-{% block stylesheet %}{% endblock stylesheet %}
-
-{% block app %}
-
-
-
-
{{context.tournamentCreateHeaderText}}
-
- {{context.tournamentCreateSubHeaderText}}
-
-
-
-
-
-
-
-
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{{context.tournamentCreatePageTittle}}{% endblock title %}
+{% block stylesheet %}{% endblock stylesheet %}
+
+{% block app %}
+
+
+
+
{{context.tournamentCreateHeaderText}}
+
+ {{context.tournamentCreateSubHeaderText}}
+
+
+
+
+
+
+
+
{% endblock %}
\ No newline at end of file
diff --git a/indianpong/pong/templates/tournament-room-list.html b/indianpong/pong/templates/tournament-room-list.html
index 43b9daf..5226e88 100644
--- a/indianpong/pong/templates/tournament-room-list.html
+++ b/indianpong/pong/templates/tournament-room-list.html
@@ -1,90 +1,90 @@
-{% extends "base.html" %}
-{% load static %}
-
-{% block stylesheet %}
-
-{% endblock stylesheet %}
-
-{% block title %} {{context.tournamentRoomListPageTittle}} {% endblock title %}
-
-{% block app %}
-
-
-
-
{{context.tournamentRoomListHeaderText}}
-
- {% for tournament in tournaments %}
-
- {% endfor %}
-{% comment %}
-
{% endcomment %}
-
-
-
-
-
-
-
-
-
-
-{% endblock %}
-
+{% extends "base.html" %}
+{% load static %}
+
+{% block stylesheet %}
+
+{% endblock stylesheet %}
+
+{% block title %} {{context.tournamentRoomListPageTittle}} {% endblock title %}
+
+{% block app %}
+
+
+
+
{{context.tournamentRoomListHeaderText}}
+
+ {% for tournament in tournaments %}
+
+ {% endfor %}
+{% comment %}
+
{% endcomment %}
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
diff --git a/indianpong/pong/templates/tournament.html b/indianpong/pong/templates/tournament.html
index 0943514..2bc800c 100644
--- a/indianpong/pong/templates/tournament.html
+++ b/indianpong/pong/templates/tournament.html
@@ -1,28 +1,28 @@
-{% extends 'base.html' %}
-{% load static %}
-
-{% block title %}{{context.tournamentPageTittle}}{% endblock title %}
-{% block stylesheet %}{% endblock stylesheet %}
-
-{% block app %}
-
-
-
{{context.tournamentHeaderText}}
-
- {{context.tournamentSubHeaderText}}
-
-
-
-
-
-
-{% endblock %}
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{{context.tournamentPageTittle}}{% endblock title %}
+{% block stylesheet %}{% endblock stylesheet %}
+
+{% block app %}
+
+
+
{{context.tournamentHeaderText}}
+
+ {{context.tournamentSubHeaderText}}
+
+
+
+
+
+
+{% endblock %}
diff --git a/indianpong/pong/templatetags/custom_filters.py b/indianpong/pong/templatetags/custom_filters.py
index a5316d0..b785291 100644
--- a/indianpong/pong/templatetags/custom_filters.py
+++ b/indianpong/pong/templatetags/custom_filters.py
@@ -1,7 +1,7 @@
-from django import template
-
-register = template.Library()
-
-@register.filter
-def get_item(dictionary, key):
- return dictionary.get(key, False)
+from django import template
+
+register = template.Library()
+
+@register.filter
+def get_item(dictionary, key):
+ return dictionary.get(key, False)
diff --git a/indianpong/pong/templatetags/status.py b/indianpong/pong/templatetags/status.py
index a0deb53..d72983d 100644
--- a/indianpong/pong/templatetags/status.py
+++ b/indianpong/pong/templatetags/status.py
@@ -1,12 +1,12 @@
-from django import template
-from django.core.cache import cache
-
-register = template.Library()
-
-@register.simple_tag
-def is_user_online(user_username):
- return cache.get(f'online_{user_username}', default=False)
-
-@register.simple_tag
-def is_user_playing(user_username):
+from django import template
+from django.core.cache import cache
+
+register = template.Library()
+
+@register.simple_tag
+def is_user_online(user_username):
+ return cache.get(f'online_{user_username}', default=False)
+
+@register.simple_tag
+def is_user_playing(user_username):
return cache.get(f'playing_{user_username}', default=False)
\ No newline at end of file
diff --git a/indianpong/pong/templatetags/transnav.py b/indianpong/pong/templatetags/transnav.py
index a7f928c..a25c032 100644
--- a/indianpong/pong/templatetags/transnav.py
+++ b/indianpong/pong/templatetags/transnav.py
@@ -1,22 +1,22 @@
-from django import template
-
-
-register = template.Library()
-
-@register.simple_tag(takes_context=True)
-def transnav(context):
- request = context['request']
- lang = request.COOKIES.get('selectedLanguage', 'en')
- d = {'tr': "Ana Sayfa", 'en': "Dashboard", 'hi': "डैशबोर्ड", 'pt': "Página Inicial"}
- c = {'tr': "Sohbet", 'en': "Chat", 'hi': "चैट", 'pt': "Bate-papo"}
- p = {'tr': "Pong Oyunu", 'en': "Pong Game", 'hi': "पोंग खेल", 'pt': "Jogo de Pong"}
- t = {'tr': "TKM Oyunu", 'en': "RPS Game", 'hi': "पत्थर-कागज-कैंची", 'pt': "PPT Jogo"}
- r = {'tr': "Sıralama", 'en': "Ranking", 'hi': "रैंकिंग", 'pt': "Classificação"}
- s = {'tr': "Mağaza", 'en': "Store", 'hi': "स्टोर", 'pt': "Loja"}
- a = {'tr': "Arama", 'en': "Search", 'hi': "खोज", 'pt': "Pesquisa"}
- h = {'tr': "Hakkımızda", 'en': "About Us", 'hi': "हमारे बारे में", 'pt': "Sobre nós"}
- f = {'tr': "Profil", 'en': "Profile", 'hi': "प्रोफाइल", 'pt': "Perfil"}
- k = {'tr': "Arkadaşlar", 'en': "Friends", 'hi': "मित्र", 'pt': "Amigos"}
- g = {'tr': "Profil Ayarları", 'en': "Profile Settings", 'hi': "प्रोफाइल सेटिंग्स", 'pt': "Configurações do Perfil"}
- o = {'tr': "Çıkış", 'en': "Logout", 'hi': "लॉग आउट", 'pt': "Sair"}
- return d[lang], c[lang], p[lang], t[lang], r[lang], s[lang], a[lang], h[lang], f[lang], k[lang], g[lang], o[lang]
+from django import template
+
+
+register = template.Library()
+
+@register.simple_tag(takes_context=True)
+def transnav(context):
+ request = context['request']
+ lang = request.COOKIES.get('selectedLanguage', 'en')
+ d = {'tr': "Ana Sayfa", 'en': "Dashboard", 'hi': "डैशबोर्ड", 'pt': "Página Inicial"}
+ c = {'tr': "Sohbet", 'en': "Chat", 'hi': "चैट", 'pt': "Bate-papo"}
+ p = {'tr': "Pong Oyunu", 'en': "Pong Game", 'hi': "पोंग खेल", 'pt': "Jogo de Pong"}
+ t = {'tr': "TKM Oyunu", 'en': "RPS Game", 'hi': "पत्थर-कागज-कैंची", 'pt': "PPT Jogo"}
+ r = {'tr': "Sıralama", 'en': "Ranking", 'hi': "रैंकिंग", 'pt': "Classificação"}
+ s = {'tr': "Mağaza", 'en': "Store", 'hi': "स्टोर", 'pt': "Loja"}
+ a = {'tr': "Arama", 'en': "Search", 'hi': "खोज", 'pt': "Pesquisa"}
+ h = {'tr': "Hakkımızda", 'en': "About Us", 'hi': "हमारे बारे में", 'pt': "Sobre nós"}
+ f = {'tr': "Profil", 'en': "Profile", 'hi': "प्रोफाइल", 'pt': "Perfil"}
+ k = {'tr': "Arkadaşlar", 'en': "Friends", 'hi': "मित्र", 'pt': "Amigos"}
+ g = {'tr': "Profil Ayarları", 'en': "Profile Settings", 'hi': "प्रोफाइल सेटिंग्स", 'pt': "Configurações do Perfil"}
+ o = {'tr': "Çıkış", 'en': "Logout", 'hi': "लॉग आउट", 'pt': "Sair"}
+ return d[lang], c[lang], p[lang], t[lang], r[lang], s[lang], a[lang], h[lang], f[lang], k[lang], g[lang], o[lang]
diff --git a/indianpong/pong/templatetags/user_info.py b/indianpong/pong/templatetags/user_info.py
index 5331751..19959a2 100644
--- a/indianpong/pong/templatetags/user_info.py
+++ b/indianpong/pong/templatetags/user_info.py
@@ -1,15 +1,15 @@
-from django import template
-from django.shortcuts import get_object_or_404
-from django.core.cache import cache
-from pong.models import UserProfile
-
-register = template.Library()
-
-@register.simple_tag(takes_context=True)
-def user_info(context):
- request = context['request']
-
- profile = get_object_or_404(UserProfile, username=request.user.username)
- is_online = cache.get(f'online_{profile.username}', default=False)
- is_playing = cache.get(f'playing_{profile.username}', default=False)
+from django import template
+from django.shortcuts import get_object_or_404
+from django.core.cache import cache
+from pong.models import UserProfile
+
+register = template.Library()
+
+@register.simple_tag(takes_context=True)
+def user_info(context):
+ request = context['request']
+
+ profile = get_object_or_404(UserProfile, username=request.user.username)
+ is_online = cache.get(f'online_{profile.username}', default=False)
+ is_playing = cache.get(f'playing_{profile.username}', default=False)
return {'username': profile.username, 'avatar': profile.avatar.url, 'is_online': is_online, 'is_playing': is_playing}
\ No newline at end of file
diff --git a/indianpong/pong/update.py b/indianpong/pong/update.py
index ce7006d..e9ede4d 100644
--- a/indianpong/pong/update.py
+++ b/indianpong/pong/update.py
@@ -1,128 +1,128 @@
-
-from datetime import timedelta
-import random
-
-def update_tournament(game):
- from .models import Tournament
-
- tournament = Tournament.objects.get(id=game.tournament_id)
- tournament.played_games_count += 1
- if tournament.played_games_count == 2:
- tournament.create_final_round_matches()
- elif tournament.played_games_count == 3:
- tournament.status = "ended"
- tournament.winner = game.winner
- #? Maybe save end_date
- tournament.save()
-
-
-def update_wallet_elo(winner, loser):
- winner.indian_wallet += random.randint(300, 500)
- winner.elo_point += random.randint(20, 30)
-
- loser.indian_wallet += random.randint(20, 30)
- lose_elo = random.randint(10, 20)
- if lose_elo < loser.elo_point:
- loser.elo_point -= lose_elo
- winner.save()
- loser.save()
-
-
-def update_stats_pong(winner, loser, winnerscore, loserscore, game_duration, game_type):
- # Update total games count
- winner.game_stats_pong.total_games_pong += 1
- loser.game_stats_pong.total_games_pong += 1
-
-
- # Update stats for winner
- winner.game_stats_pong.total_win_pong += 1
- winner.game_stats_pong.total_win_streak_pong += 1
- winner.game_stats_pong.total_lose_streak_pong = 0
-
- # Update average points won and lost for winner
- winner.game_stats_pong.total_avg_points_won_pong = ((winner.game_stats_pong.total_avg_points_won_pong * (winner.game_stats_pong.total_win_pong - 1)) + winnerscore) / winner.game_stats_pong.total_win_pong
- winner.game_stats_pong.total_avg_points_lost_pong = ((winner.game_stats_pong.total_avg_points_lost_pong * (winner.game_stats_pong.total_win_pong - 1)) + loserscore) / winner.game_stats_pong.total_win_pong
-
- # Update stats for loser
- loser.game_stats_pong.total_lose_pong += 1
- loser.game_stats_pong.total_win_rate_pong = (loser.game_stats_pong.total_win_pong / loser.game_stats_pong.total_games_pong)
- loser.game_stats_pong.total_win_streak_pong = 0
- loser.game_stats_pong.total_lose_streak_pong += 1
-
- # Update average points won and lost for loser
- loser.game_stats_pong.total_avg_points_won_pong = ((loser.game_stats_pong.total_avg_points_won_pong * (loser.game_stats_pong.total_lose_pong - 1)) + loserscore) / loser.game_stats_pong.total_lose_pong
- loser.game_stats_pong.total_avg_points_lost_pong = ((loser.game_stats_pong.total_avg_points_lost_pong * (loser.game_stats_pong.total_lose_pong - 1)) + winnerscore) / loser.game_stats_pong.total_lose_pong
-
- # Update total win rate
- winner.game_stats_pong.total_win_rate_pong = (winner.game_stats_pong.total_win_pong / winner.game_stats_pong.total_games_pong)
- loser.game_stats_pong.total_win_rate_pong = (loser.game_stats_pong.total_win_pong / loser.game_stats_pong.total_games_pong)
-
- # Update total average game duration for both winner and loser
- winner_total_game_duration_seconds = winner.game_stats_pong.total_avg_game_duration_pong.total_seconds() * (winner.game_stats_pong.total_games_pong - 1)
- loser_total_game_duration_seconds = loser.game_stats_pong.total_avg_game_duration_pong.total_seconds() * (loser.game_stats_pong.total_games_pong - 1)
-
- if game_type != "not_remote":
- winner_total_game_duration_seconds += game_duration
- loser_total_game_duration_seconds += game_duration
- else:
- winner_total_game_duration_seconds += game_duration.total_seconds()
- loser_total_game_duration_seconds += game_duration.total_seconds()
-
- winner_avg_game_duration_seconds = winner_total_game_duration_seconds / winner.game_stats_pong.total_games_pong
- winner.game_stats_pong.total_avg_game_duration_pong = timedelta(seconds=winner_avg_game_duration_seconds)
- loser_avg_game_duration_seconds = loser_total_game_duration_seconds / loser.game_stats_pong.total_games_pong
- loser.game_stats_pong.total_avg_game_duration_pong = timedelta(seconds=loser_avg_game_duration_seconds)
-
- # Save updated stats
- winner.game_stats_pong.save()
- loser.game_stats_pong.save()
-
-
-def update_stats_rps(winner, loser, winnerscore, loserscore, game_duration, game_type):
- # Update total games count
- winner.game_stats_rps.total_games_rps += 1
- loser.game_stats_rps.total_games_rps += 1
-
- # Update stats for winner
- winner.game_stats_rps.total_win_rps += 1
- winner.game_stats_rps.total_win_streak_rps += 1
- winner.game_stats_rps.total_lose_streak_rps = 0
-
- # Update average points won and lost for winner
- winner.game_stats_rps.total_avg_points_won_rps = ((winner.game_stats_rps.total_avg_points_won_rps * (winner.game_stats_rps.total_win_rps - 1)) + winnerscore) / winner.game_stats_rps.total_win_rps
- winner.game_stats_rps.total_avg_points_lost_rps = ((winner.game_stats_rps.total_avg_points_lost_rps * (winner.game_stats_rps.total_win_rps - 1)) + loserscore) / winner.game_stats_rps.total_win_rps
-
-
- # Update stats for loser
- loser.game_stats_rps.total_lose_rps += 1
- loser.game_stats_rps.total_win_rate_rps = (loser.game_stats_rps.total_win_rps / loser.game_stats_rps.total_games_rps)
- loser.game_stats_rps.total_win_streak_rps = 0
- loser.game_stats_rps.total_lose_streak_rps += 1
-
- # Update average points won and lost for loser
- loser.game_stats_rps.total_avg_points_won_rps = ((loser.game_stats_rps.total_avg_points_won_rps * (loser.game_stats_rps.total_lose_rps - 1)) + loserscore) / loser.game_stats_rps.total_lose_rps
- loser.game_stats_rps.total_avg_points_lost_rps = ((loser.game_stats_rps.total_avg_points_lost_rps * (loser.game_stats_rps.total_lose_rps - 1)) + winnerscore) / loser.game_stats_rps.total_lose_rps
-
- # Update total win rate
- winner.game_stats_rps.total_win_rate_rps = (winner.game_stats_rps.total_win_rps / winner.game_stats_rps.total_games_rps)
- loser.game_stats_rps.total_win_rate_rps = (loser.game_stats_rps.total_win_rps / loser.game_stats_rps.total_games_rps)
-
- winner_total_game_duration_seconds = winner.game_stats_rps.total_avg_game_duration_rps.total_seconds() * (winner.game_stats_rps.total_games_rps - 1)
- loser_total_game_duration_seconds = loser.game_stats_rps.total_avg_game_duration_rps.total_seconds() * (loser.game_stats_rps.total_games_rps - 1)
- # Update total average game duration for winner
- if game_type != "not_remote":
- winner_total_game_duration_seconds += game_duration
- loser_total_game_duration_seconds += game_duration
- else:
- winner_total_game_duration_seconds += game_duration.total_seconds()
- loser_total_game_duration_seconds += game_duration.total_seconds()
-
-
- winner_avg_game_duration_seconds = winner_total_game_duration_seconds / winner.game_stats_rps.total_games_rps
- winner.game_stats_rps.total_avg_game_duration_rps = timedelta(seconds=winner_avg_game_duration_seconds)
- loser_avg_game_duration_seconds = loser_total_game_duration_seconds / loser.game_stats_rps.total_games_rps
- loser.game_stats_rps.total_avg_game_duration_rps = timedelta(seconds=loser_avg_game_duration_seconds)
-
- # Save updated stats
- winner.game_stats_rps.save()
+
+from datetime import timedelta
+import random
+
+def update_tournament(game):
+ from .models import Tournament
+
+ tournament = Tournament.objects.get(id=game.tournament_id)
+ tournament.played_games_count += 1
+ if tournament.played_games_count == 2:
+ tournament.create_final_round_matches()
+ elif tournament.played_games_count == 3:
+ tournament.status = "ended"
+ tournament.winner = game.winner
+ #? Maybe save end_date
+ tournament.save()
+
+
+def update_wallet_elo(winner, loser):
+ winner.indian_wallet += random.randint(300, 500)
+ winner.elo_point += random.randint(20, 30)
+
+ loser.indian_wallet += random.randint(20, 30)
+ lose_elo = random.randint(10, 20)
+ if lose_elo < loser.elo_point:
+ loser.elo_point -= lose_elo
+ winner.save()
+ loser.save()
+
+
+def update_stats_pong(winner, loser, winnerscore, loserscore, game_duration, game_type):
+ # Update total games count
+ winner.game_stats_pong.total_games_pong += 1
+ loser.game_stats_pong.total_games_pong += 1
+
+
+ # Update stats for winner
+ winner.game_stats_pong.total_win_pong += 1
+ winner.game_stats_pong.total_win_streak_pong += 1
+ winner.game_stats_pong.total_lose_streak_pong = 0
+
+ # Update average points won and lost for winner
+ winner.game_stats_pong.total_avg_points_won_pong = ((winner.game_stats_pong.total_avg_points_won_pong * (winner.game_stats_pong.total_win_pong - 1)) + winnerscore) / winner.game_stats_pong.total_win_pong
+ winner.game_stats_pong.total_avg_points_lost_pong = ((winner.game_stats_pong.total_avg_points_lost_pong * (winner.game_stats_pong.total_win_pong - 1)) + loserscore) / winner.game_stats_pong.total_win_pong
+
+ # Update stats for loser
+ loser.game_stats_pong.total_lose_pong += 1
+ loser.game_stats_pong.total_win_rate_pong = (loser.game_stats_pong.total_win_pong / loser.game_stats_pong.total_games_pong)
+ loser.game_stats_pong.total_win_streak_pong = 0
+ loser.game_stats_pong.total_lose_streak_pong += 1
+
+ # Update average points won and lost for loser
+ loser.game_stats_pong.total_avg_points_won_pong = ((loser.game_stats_pong.total_avg_points_won_pong * (loser.game_stats_pong.total_lose_pong - 1)) + loserscore) / loser.game_stats_pong.total_lose_pong
+ loser.game_stats_pong.total_avg_points_lost_pong = ((loser.game_stats_pong.total_avg_points_lost_pong * (loser.game_stats_pong.total_lose_pong - 1)) + winnerscore) / loser.game_stats_pong.total_lose_pong
+
+ # Update total win rate
+ winner.game_stats_pong.total_win_rate_pong = (winner.game_stats_pong.total_win_pong / winner.game_stats_pong.total_games_pong)
+ loser.game_stats_pong.total_win_rate_pong = (loser.game_stats_pong.total_win_pong / loser.game_stats_pong.total_games_pong)
+
+ # Update total average game duration for both winner and loser
+ winner_total_game_duration_seconds = winner.game_stats_pong.total_avg_game_duration_pong.total_seconds() * (winner.game_stats_pong.total_games_pong - 1)
+ loser_total_game_duration_seconds = loser.game_stats_pong.total_avg_game_duration_pong.total_seconds() * (loser.game_stats_pong.total_games_pong - 1)
+
+ if game_type != "not_remote":
+ winner_total_game_duration_seconds += game_duration
+ loser_total_game_duration_seconds += game_duration
+ else:
+ winner_total_game_duration_seconds += game_duration.total_seconds()
+ loser_total_game_duration_seconds += game_duration.total_seconds()
+
+ winner_avg_game_duration_seconds = winner_total_game_duration_seconds / winner.game_stats_pong.total_games_pong
+ winner.game_stats_pong.total_avg_game_duration_pong = timedelta(seconds=winner_avg_game_duration_seconds)
+ loser_avg_game_duration_seconds = loser_total_game_duration_seconds / loser.game_stats_pong.total_games_pong
+ loser.game_stats_pong.total_avg_game_duration_pong = timedelta(seconds=loser_avg_game_duration_seconds)
+
+ # Save updated stats
+ winner.game_stats_pong.save()
+ loser.game_stats_pong.save()
+
+
+def update_stats_rps(winner, loser, winnerscore, loserscore, game_duration, game_type):
+ # Update total games count
+ winner.game_stats_rps.total_games_rps += 1
+ loser.game_stats_rps.total_games_rps += 1
+
+ # Update stats for winner
+ winner.game_stats_rps.total_win_rps += 1
+ winner.game_stats_rps.total_win_streak_rps += 1
+ winner.game_stats_rps.total_lose_streak_rps = 0
+
+ # Update average points won and lost for winner
+ winner.game_stats_rps.total_avg_points_won_rps = ((winner.game_stats_rps.total_avg_points_won_rps * (winner.game_stats_rps.total_win_rps - 1)) + winnerscore) / winner.game_stats_rps.total_win_rps
+ winner.game_stats_rps.total_avg_points_lost_rps = ((winner.game_stats_rps.total_avg_points_lost_rps * (winner.game_stats_rps.total_win_rps - 1)) + loserscore) / winner.game_stats_rps.total_win_rps
+
+
+ # Update stats for loser
+ loser.game_stats_rps.total_lose_rps += 1
+ loser.game_stats_rps.total_win_rate_rps = (loser.game_stats_rps.total_win_rps / loser.game_stats_rps.total_games_rps)
+ loser.game_stats_rps.total_win_streak_rps = 0
+ loser.game_stats_rps.total_lose_streak_rps += 1
+
+ # Update average points won and lost for loser
+ loser.game_stats_rps.total_avg_points_won_rps = ((loser.game_stats_rps.total_avg_points_won_rps * (loser.game_stats_rps.total_lose_rps - 1)) + loserscore) / loser.game_stats_rps.total_lose_rps
+ loser.game_stats_rps.total_avg_points_lost_rps = ((loser.game_stats_rps.total_avg_points_lost_rps * (loser.game_stats_rps.total_lose_rps - 1)) + winnerscore) / loser.game_stats_rps.total_lose_rps
+
+ # Update total win rate
+ winner.game_stats_rps.total_win_rate_rps = (winner.game_stats_rps.total_win_rps / winner.game_stats_rps.total_games_rps)
+ loser.game_stats_rps.total_win_rate_rps = (loser.game_stats_rps.total_win_rps / loser.game_stats_rps.total_games_rps)
+
+ winner_total_game_duration_seconds = winner.game_stats_rps.total_avg_game_duration_rps.total_seconds() * (winner.game_stats_rps.total_games_rps - 1)
+ loser_total_game_duration_seconds = loser.game_stats_rps.total_avg_game_duration_rps.total_seconds() * (loser.game_stats_rps.total_games_rps - 1)
+ # Update total average game duration for winner
+ if game_type != "not_remote":
+ winner_total_game_duration_seconds += game_duration
+ loser_total_game_duration_seconds += game_duration
+ else:
+ winner_total_game_duration_seconds += game_duration.total_seconds()
+ loser_total_game_duration_seconds += game_duration.total_seconds()
+
+
+ winner_avg_game_duration_seconds = winner_total_game_duration_seconds / winner.game_stats_rps.total_games_rps
+ winner.game_stats_rps.total_avg_game_duration_rps = timedelta(seconds=winner_avg_game_duration_seconds)
+ loser_avg_game_duration_seconds = loser_total_game_duration_seconds / loser.game_stats_rps.total_games_rps
+ loser.game_stats_rps.total_avg_game_duration_rps = timedelta(seconds=loser_avg_game_duration_seconds)
+
+ # Save updated stats
+ winner.game_stats_rps.save()
loser.game_stats_rps.save()
\ No newline at end of file
diff --git a/indianpong/static/assets/intra-42-white.svg b/indianpong/static/assets/intra-42-white.svg
index 767d8bf..9f71c8c 100644
--- a/indianpong/static/assets/intra-42-white.svg
+++ b/indianpong/static/assets/intra-42-white.svg
@@ -1,9 +1,9 @@
-