-
Notifications
You must be signed in to change notification settings - Fork 177
LambdaMUD-Project - Jonathan Laluces #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
993b3d1
6abaf89
242b6f8
3ab18b8
f24fc2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ __pycache__/ | |
| *.py[cod] | ||
| *$py.class | ||
|
|
||
|
|
||
| # Django stuff: | ||
| *.log | ||
| local_settings.py | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,4 +64,13 @@ def move(request): | |
| @api_view(["POST"]) | ||
| def say(request): | ||
| # IMPLEMENT | ||
| return JsonResponse({'error':"Not yet implemented"}, safe=True, status=500) | ||
| player = request.user.player # --> Grab player | ||
| data = json.loads(request.body) | ||
| player_id = player.id | ||
| response = data['message'] | ||
| room = player.room() # --> Grab room | ||
| currentPlayerUUIDs = room.playerUUIDs(player_id) | ||
| for uuid in currentPlayerUUIDs: | ||
| pusher.trigger(f'p-channel-{uuid}', u'broadcast', {'say': f'{player.user.username} says {response}'}) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this broadcasts an alert to the player who said the message too, but ideally you would want to exclude the player who performed say from the list of who receives the alert. This differentiates "say" from "shout" |
||
|
|
||
| return JsonResponse({'say': f'{player.user.username} says {response}'}, safe=True) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Generated by Django 2.1.4 on 2018-12-10 17:41 | ||
|
|
||
| from django.conf import settings | ||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
| import uuid | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| initial = True | ||
|
|
||
| dependencies = [ | ||
| migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='Player', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('currentRoom', models.IntegerField(default=0)), | ||
| ('uuid', models.UUIDField(default=uuid.uuid4, unique=True)), | ||
| ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
| ], | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Room', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('title', models.CharField(default='DEFAULT TITLE', max_length=50)), | ||
| ('description', models.CharField(default='DEFAULT DESCRIPTION', max_length=500)), | ||
| ('n_to', models.IntegerField(default=0)), | ||
| ('s_to', models.IntegerField(default=0)), | ||
| ('e_to', models.IntegerField(default=0)), | ||
| ('w_to', models.IntegerField(default=0)), | ||
| ], | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,32 @@ | ||
| asn1crypto==0.24.0 | ||
| certifi==2018.8.24 | ||
| certifi==2018.11.29 | ||
| cffi==1.11.5 | ||
| chardet==3.0.4 | ||
| cryptography==2.3.1 | ||
| cryptography==2.4.2 | ||
| defusedxml==0.5.0 | ||
| dj-database-url==0.5.0 | ||
| Django==2.1.1 | ||
| django-allauth==0.37.1 | ||
| Django==2.1.4 | ||
| django-allauth==0.38.0 | ||
| django-cors-headers==2.4.0 | ||
| django-heroku==0.3.1 | ||
| django-rest-api==0.1.5 | ||
| django-rest-auth==0.9.3 | ||
| djangorestframework==3.8.2 | ||
| djangorestframework==3.9.0 | ||
| gunicorn==19.9.0 | ||
| idna==2.7 | ||
| idna==2.8 | ||
| ndg-httpsclient==0.5.1 | ||
| oauthlib==2.1.0 | ||
| psycopg2==2.7.5 | ||
| pusher==2.0.1 | ||
| psycopg2==2.7.6.1 | ||
| psycopg2-binary==2.7.6.1 | ||
| pusher==2.0.2 | ||
| pyasn1==0.4.4 | ||
| pycparser==2.19 | ||
| pyOpenSSL==18.0.0 | ||
| python-decouple==3.1 | ||
| python3-openid==3.1.0 | ||
| pytz==2018.5 | ||
| requests==2.19.1 | ||
| pytz==2018.7 | ||
| requests==2.21.0 | ||
| requests-oauthlib==1.0.0 | ||
| six==1.11.0 | ||
| urllib3==1.23 | ||
| whitenoise==4.1 | ||
| six==1.12.0 | ||
| urllib3==1.24.1 | ||
| whitenoise==4.1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good comment here, would be nice to have a few more throughout your code.