Browse Source

inital commit

Gesche 1 year ago
commit
44036e57e9

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
1
+.idea
2
+__pycache__

+ 0
- 0
accounts/__init__.py View File


+ 25
- 0
accounts/admin.py View File

@@ -0,0 +1,25 @@
1
+from django.contrib import admin
2
+
3
+from .models import Accounts, Players, Towns
4
+
5
+class AccountsAdmin(admin.ModelAdmin):
6
+    list_display = ('name',)
7
+    fields = ['name', 'password', 'type', 'email']
8
+
9
+class PlayersAdmin(admin.ModelAdmin):
10
+    list_display = ('name', 'account',)
11
+    fields = [
12
+        'name', 'group_id', 'account', 'level', 'vocation',
13
+        'health', 'healthmax', 'maglevel', 'mana', 'manamax',
14
+        'town_id', 'posx', 'posy', 'posz', 'cap', 'sex', 'balance',
15
+        'skill_fist', 'skill_club', 'skill_sword', 'skill_axe',
16
+        'skill_dist', 'skill_shielding',
17
+        'skill_fishing',
18
+    ]
19
+
20
+class TownsAdmin(admin.ModelAdmin):
21
+    list_display = ('name',)
22
+
23
+admin.site.register(Accounts, AccountsAdmin)
24
+admin.site.register(Players, PlayersAdmin)
25
+admin.site.register(Towns, TownsAdmin)

+ 5
- 0
accounts/apps.py View File

@@ -0,0 +1,5 @@
1
+from django.apps import AppConfig
2
+
3
+
4
+class AccountsConfig(AppConfig):
5
+    name = 'accounts'

+ 436
- 0
accounts/migrations/0001_initial.py View File

@@ -0,0 +1,436 @@
1
+# Generated by Django 2.1.5 on 2019-01-20 14:24
2
+
3
+from django.db import migrations, models
4
+import django.db.models.deletion
5
+
6
+
7
+class Migration(migrations.Migration):
8
+
9
+    initial = True
10
+
11
+    dependencies = [
12
+    ]
13
+
14
+    operations = [
15
+        migrations.CreateModel(
16
+            name='AccountBanHistory',
17
+            fields=[
18
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
19
+                ('reason', models.CharField(max_length=255)),
20
+                ('banned_at', models.BigIntegerField()),
21
+                ('expired_at', models.BigIntegerField()),
22
+            ],
23
+            options={
24
+                'db_table': 'account_ban_history',
25
+                'managed': False,
26
+            },
27
+        ),
28
+        migrations.CreateModel(
29
+            name='Accounts',
30
+            fields=[
31
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
32
+                ('name', models.CharField(max_length=32, unique=True)),
33
+                ('password', models.CharField(max_length=40)),
34
+                ('secret', models.CharField(blank=True, max_length=16, null=True)),
35
+                ('type', models.IntegerField()),
36
+                ('premdays', models.IntegerField()),
37
+                ('lastday', models.PositiveIntegerField()),
38
+                ('email', models.CharField(max_length=255)),
39
+                ('creation', models.IntegerField()),
40
+            ],
41
+            options={
42
+                'db_table': 'accounts',
43
+                'managed': False,
44
+            },
45
+        ),
46
+        migrations.CreateModel(
47
+            name='AccountViplist',
48
+            fields=[
49
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
50
+                ('description', models.CharField(max_length=128)),
51
+                ('icon', models.PositiveIntegerField()),
52
+                ('notify', models.IntegerField()),
53
+            ],
54
+            options={
55
+                'db_table': 'account_viplist',
56
+                'managed': False,
57
+            },
58
+        ),
59
+        migrations.CreateModel(
60
+            name='GuildRanks',
61
+            fields=[
62
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
63
+                ('name', models.CharField(max_length=255)),
64
+                ('level', models.IntegerField()),
65
+            ],
66
+            options={
67
+                'db_table': 'guild_ranks',
68
+                'managed': False,
69
+            },
70
+        ),
71
+        migrations.CreateModel(
72
+            name='Guilds',
73
+            fields=[
74
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
75
+                ('name', models.CharField(max_length=255, unique=True)),
76
+                ('creationdata', models.IntegerField()),
77
+                ('motd', models.CharField(max_length=255)),
78
+            ],
79
+            options={
80
+                'db_table': 'guilds',
81
+                'managed': False,
82
+            },
83
+        ),
84
+        migrations.CreateModel(
85
+            name='GuildwarKills',
86
+            fields=[
87
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
88
+                ('killer', models.CharField(max_length=50)),
89
+                ('target', models.CharField(max_length=50)),
90
+                ('killerguild', models.IntegerField()),
91
+                ('targetguild', models.IntegerField()),
92
+                ('time', models.BigIntegerField()),
93
+            ],
94
+            options={
95
+                'db_table': 'guildwar_kills',
96
+                'managed': False,
97
+            },
98
+        ),
99
+        migrations.CreateModel(
100
+            name='GuildWars',
101
+            fields=[
102
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
103
+                ('guild1', models.IntegerField()),
104
+                ('guild2', models.IntegerField()),
105
+                ('name1', models.CharField(max_length=255)),
106
+                ('name2', models.CharField(max_length=255)),
107
+                ('status', models.IntegerField()),
108
+                ('started', models.BigIntegerField()),
109
+                ('ended', models.BigIntegerField()),
110
+            ],
111
+            options={
112
+                'db_table': 'guild_wars',
113
+                'managed': False,
114
+            },
115
+        ),
116
+        migrations.CreateModel(
117
+            name='HouseLists',
118
+            fields=[
119
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
120
+                ('listid', models.IntegerField()),
121
+                ('list', models.TextField()),
122
+            ],
123
+            options={
124
+                'db_table': 'house_lists',
125
+                'managed': False,
126
+            },
127
+        ),
128
+        migrations.CreateModel(
129
+            name='Houses',
130
+            fields=[
131
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
132
+                ('owner', models.IntegerField()),
133
+                ('paid', models.PositiveIntegerField()),
134
+                ('warnings', models.IntegerField()),
135
+                ('name', models.CharField(max_length=255)),
136
+                ('rent', models.IntegerField()),
137
+                ('town_id', models.IntegerField()),
138
+                ('bid', models.IntegerField()),
139
+                ('bid_end', models.IntegerField()),
140
+                ('last_bid', models.IntegerField()),
141
+                ('highest_bidder', models.IntegerField()),
142
+                ('size', models.IntegerField()),
143
+                ('beds', models.IntegerField()),
144
+            ],
145
+            options={
146
+                'db_table': 'houses',
147
+                'managed': False,
148
+            },
149
+        ),
150
+        migrations.CreateModel(
151
+            name='IpBans',
152
+            fields=[
153
+                ('ip', models.PositiveIntegerField(primary_key=True, serialize=False)),
154
+                ('reason', models.CharField(max_length=255)),
155
+                ('banned_at', models.BigIntegerField()),
156
+                ('expires_at', models.BigIntegerField()),
157
+            ],
158
+            options={
159
+                'db_table': 'ip_bans',
160
+                'managed': False,
161
+            },
162
+        ),
163
+        migrations.CreateModel(
164
+            name='MarketHistory',
165
+            fields=[
166
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
167
+                ('sale', models.IntegerField()),
168
+                ('itemtype', models.PositiveIntegerField()),
169
+                ('amount', models.PositiveSmallIntegerField()),
170
+                ('price', models.PositiveIntegerField()),
171
+                ('expires_at', models.BigIntegerField()),
172
+                ('inserted', models.BigIntegerField()),
173
+                ('state', models.PositiveIntegerField()),
174
+            ],
175
+            options={
176
+                'db_table': 'market_history',
177
+                'managed': False,
178
+            },
179
+        ),
180
+        migrations.CreateModel(
181
+            name='MarketOffers',
182
+            fields=[
183
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
184
+                ('sale', models.IntegerField()),
185
+                ('itemtype', models.PositiveIntegerField()),
186
+                ('amount', models.PositiveSmallIntegerField()),
187
+                ('created', models.BigIntegerField()),
188
+                ('anonymous', models.IntegerField()),
189
+                ('price', models.PositiveIntegerField()),
190
+            ],
191
+            options={
192
+                'db_table': 'market_offers',
193
+                'managed': False,
194
+            },
195
+        ),
196
+        migrations.CreateModel(
197
+            name='PlayerDeaths',
198
+            fields=[
199
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
200
+                ('time', models.BigIntegerField()),
201
+                ('level', models.IntegerField()),
202
+                ('killed_by', models.CharField(max_length=255)),
203
+                ('is_player', models.IntegerField()),
204
+                ('mostdamage_by', models.CharField(max_length=100)),
205
+                ('mostdamage_is_player', models.IntegerField()),
206
+                ('unjustified', models.IntegerField()),
207
+                ('mostdamage_unjustified', models.IntegerField()),
208
+            ],
209
+            options={
210
+                'db_table': 'player_deaths',
211
+                'managed': False,
212
+            },
213
+        ),
214
+        migrations.CreateModel(
215
+            name='PlayerDepotitems',
216
+            fields=[
217
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
218
+                ('sid', models.IntegerField()),
219
+                ('pid', models.IntegerField()),
220
+                ('itemtype', models.SmallIntegerField()),
221
+                ('count', models.SmallIntegerField()),
222
+                ('attributes', models.TextField()),
223
+            ],
224
+            options={
225
+                'db_table': 'player_depotitems',
226
+                'managed': False,
227
+            },
228
+        ),
229
+        migrations.CreateModel(
230
+            name='PlayerInboxitems',
231
+            fields=[
232
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
233
+                ('sid', models.IntegerField()),
234
+                ('pid', models.IntegerField()),
235
+                ('itemtype', models.SmallIntegerField()),
236
+                ('count', models.SmallIntegerField()),
237
+                ('attributes', models.TextField()),
238
+            ],
239
+            options={
240
+                'db_table': 'player_inboxitems',
241
+                'managed': False,
242
+            },
243
+        ),
244
+        migrations.CreateModel(
245
+            name='PlayerItems',
246
+            fields=[
247
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
248
+                ('pid', models.IntegerField()),
249
+                ('sid', models.IntegerField()),
250
+                ('itemtype', models.SmallIntegerField()),
251
+                ('count', models.SmallIntegerField()),
252
+                ('attributes', models.TextField()),
253
+            ],
254
+            options={
255
+                'db_table': 'player_items',
256
+                'managed': False,
257
+            },
258
+        ),
259
+        migrations.CreateModel(
260
+            name='Players',
261
+            fields=[
262
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
263
+                ('name', models.CharField(max_length=255, unique=True)),
264
+                ('group_id', models.IntegerField()),
265
+                ('level', models.IntegerField()),
266
+                ('vocation', models.IntegerField()),
267
+                ('health', models.IntegerField()),
268
+                ('healthmax', models.IntegerField()),
269
+                ('experience', models.BigIntegerField()),
270
+                ('lookbody', models.IntegerField()),
271
+                ('lookfeet', models.IntegerField()),
272
+                ('lookhead', models.IntegerField()),
273
+                ('looklegs', models.IntegerField()),
274
+                ('looktype', models.IntegerField()),
275
+                ('lookaddons', models.IntegerField()),
276
+                ('maglevel', models.IntegerField()),
277
+                ('mana', models.IntegerField()),
278
+                ('manamax', models.IntegerField()),
279
+                ('manaspent', models.PositiveIntegerField()),
280
+                ('soul', models.PositiveIntegerField()),
281
+                ('town_id', models.IntegerField()),
282
+                ('posx', models.IntegerField()),
283
+                ('posy', models.IntegerField()),
284
+                ('posz', models.IntegerField()),
285
+                ('conditions', models.TextField()),
286
+                ('cap', models.IntegerField()),
287
+                ('sex', models.IntegerField()),
288
+                ('lastlogin', models.BigIntegerField()),
289
+                ('lastip', models.PositiveIntegerField()),
290
+                ('save', models.IntegerField()),
291
+                ('skull', models.IntegerField()),
292
+                ('skulltime', models.IntegerField()),
293
+                ('lastlogout', models.BigIntegerField()),
294
+                ('blessings', models.IntegerField()),
295
+                ('onlinetime', models.IntegerField()),
296
+                ('deletion', models.BigIntegerField()),
297
+                ('balance', models.BigIntegerField()),
298
+                ('offlinetraining_time', models.PositiveSmallIntegerField()),
299
+                ('offlinetraining_skill', models.IntegerField()),
300
+                ('stamina', models.PositiveSmallIntegerField()),
301
+                ('skill_fist', models.PositiveIntegerField()),
302
+                ('skill_fist_tries', models.BigIntegerField()),
303
+                ('skill_club', models.PositiveIntegerField()),
304
+                ('skill_club_tries', models.BigIntegerField()),
305
+                ('skill_sword', models.PositiveIntegerField()),
306
+                ('skill_sword_tries', models.BigIntegerField()),
307
+                ('skill_axe', models.PositiveIntegerField()),
308
+                ('skill_axe_tries', models.BigIntegerField()),
309
+                ('skill_dist', models.PositiveIntegerField()),
310
+                ('skill_dist_tries', models.BigIntegerField()),
311
+                ('skill_shielding', models.PositiveIntegerField()),
312
+                ('skill_shielding_tries', models.BigIntegerField()),
313
+                ('skill_fishing', models.PositiveIntegerField()),
314
+                ('skill_fishing_tries', models.BigIntegerField()),
315
+            ],
316
+            options={
317
+                'db_table': 'players',
318
+                'managed': False,
319
+            },
320
+        ),
321
+        migrations.CreateModel(
322
+            name='PlayersOnline',
323
+            fields=[
324
+                ('player_id', models.IntegerField(primary_key=True, serialize=False)),
325
+            ],
326
+            options={
327
+                'db_table': 'players_online',
328
+                'managed': False,
329
+            },
330
+        ),
331
+        migrations.CreateModel(
332
+            name='PlayerSpells',
333
+            fields=[
334
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
335
+                ('name', models.CharField(max_length=255)),
336
+            ],
337
+            options={
338
+                'db_table': 'player_spells',
339
+                'managed': False,
340
+            },
341
+        ),
342
+        migrations.CreateModel(
343
+            name='ServerConfig',
344
+            fields=[
345
+                ('config', models.CharField(max_length=50, primary_key=True, serialize=False)),
346
+                ('value', models.CharField(max_length=256)),
347
+            ],
348
+            options={
349
+                'db_table': 'server_config',
350
+                'managed': False,
351
+            },
352
+        ),
353
+        migrations.CreateModel(
354
+            name='TileStore',
355
+            fields=[
356
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
357
+                ('data', models.TextField()),
358
+            ],
359
+            options={
360
+                'db_table': 'tile_store',
361
+                'managed': False,
362
+            },
363
+        ),
364
+        migrations.CreateModel(
365
+            name='Towns',
366
+            fields=[
367
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
368
+                ('name', models.CharField(max_length=255, unique=True)),
369
+                ('posx', models.IntegerField()),
370
+                ('posy', models.IntegerField()),
371
+                ('posz', models.IntegerField()),
372
+            ],
373
+            options={
374
+                'db_table': 'towns',
375
+                'managed': False,
376
+            },
377
+        ),
378
+        migrations.CreateModel(
379
+            name='AccountBans',
380
+            fields=[
381
+                ('account', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, serialize=False, to='accounts.Accounts')),
382
+                ('reason', models.CharField(max_length=255)),
383
+                ('banned_at', models.BigIntegerField()),
384
+                ('expires_at', models.BigIntegerField()),
385
+            ],
386
+            options={
387
+                'db_table': 'account_bans',
388
+                'managed': False,
389
+            },
390
+        ),
391
+        migrations.CreateModel(
392
+            name='GuildInvites',
393
+            fields=[
394
+                ('player', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, serialize=False, to='accounts.Players')),
395
+            ],
396
+            options={
397
+                'db_table': 'guild_invites',
398
+                'managed': False,
399
+            },
400
+        ),
401
+        migrations.CreateModel(
402
+            name='GuildMembership',
403
+            fields=[
404
+                ('player', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, serialize=False, to='accounts.Players')),
405
+                ('nick', models.CharField(max_length=15)),
406
+            ],
407
+            options={
408
+                'db_table': 'guild_membership',
409
+                'managed': False,
410
+            },
411
+        ),
412
+        migrations.CreateModel(
413
+            name='PlayerNamelocks',
414
+            fields=[
415
+                ('player', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, serialize=False, to='accounts.Players')),
416
+                ('reason', models.CharField(max_length=255)),
417
+                ('namelocked_at', models.BigIntegerField()),
418
+            ],
419
+            options={
420
+                'db_table': 'player_namelocks',
421
+                'managed': False,
422
+            },
423
+        ),
424
+        migrations.CreateModel(
425
+            name='PlayerStorage',
426
+            fields=[
427
+                ('player', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, serialize=False, to='accounts.Players')),
428
+                ('key', models.PositiveIntegerField()),
429
+                ('value', models.IntegerField()),
430
+            ],
431
+            options={
432
+                'db_table': 'player_storage',
433
+                'managed': False,
434
+            },
435
+        ),
436
+    ]

+ 0
- 0
accounts/migrations/__init__.py View File


+ 384
- 0
accounts/models.py View File

@@ -0,0 +1,384 @@
1
+# This is an auto-generated Django model module.
2
+# You'll have to do the following manually to clean this up:
3
+#   * Rearrange models' order
4
+#   * Make sure each model has one field with primary_key=True
5
+#   * Make sure each ForeignKey has `on_delete` set to the desired behavior.
6
+#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
7
+# Feel free to rename the models, but don't rename db_table values or field names.
8
+from django.db import models
9
+
10
+
11
+class AccountBanHistory(models.Model):
12
+    account = models.ForeignKey('Accounts', models.DO_NOTHING)
13
+    reason = models.CharField(max_length=255)
14
+    banned_at = models.BigIntegerField()
15
+    expired_at = models.BigIntegerField()
16
+    banned_by = models.ForeignKey('Players', models.DO_NOTHING, db_column='banned_by')
17
+
18
+    class Meta:
19
+        managed = False
20
+        db_table = 'account_ban_history'
21
+
22
+
23
+class AccountBans(models.Model):
24
+    account = models.OneToOneField('Accounts', models.DO_NOTHING, primary_key=True)
25
+    reason = models.CharField(max_length=255)
26
+    banned_at = models.BigIntegerField()
27
+    expires_at = models.BigIntegerField()
28
+    banned_by = models.ForeignKey('Players', models.DO_NOTHING, db_column='banned_by')
29
+
30
+    class Meta:
31
+        managed = False
32
+        db_table = 'account_bans'
33
+
34
+
35
+class AccountViplist(models.Model):
36
+    account = models.ForeignKey('Accounts', models.DO_NOTHING)
37
+    player = models.ForeignKey('Players', models.DO_NOTHING)
38
+    description = models.CharField(max_length=128)
39
+    icon = models.PositiveIntegerField()
40
+    notify = models.IntegerField()
41
+
42
+    class Meta:
43
+        managed = False
44
+        db_table = 'account_viplist'
45
+        unique_together = (('account', 'player'),)
46
+
47
+
48
+class Accounts(models.Model):
49
+    name = models.CharField(unique=True, max_length=32)
50
+    password = models.CharField(max_length=40)
51
+    secret = models.CharField(max_length=16, blank=True, null=True)
52
+    type = models.IntegerField(default=1)
53
+    premdays = models.IntegerField(default=0)
54
+    lastday = models.PositiveIntegerField(default=0)
55
+    email = models.CharField(max_length=255)
56
+    creation = models.IntegerField(default=0)
57
+
58
+    class Meta:
59
+        managed = False
60
+        db_table = 'accounts'
61
+
62
+
63
+class GuildInvites(models.Model):
64
+    player = models.ForeignKey('Players', models.DO_NOTHING, primary_key=True)
65
+    guild = models.ForeignKey('Guilds', models.DO_NOTHING)
66
+
67
+    class Meta:
68
+        managed = False
69
+        db_table = 'guild_invites'
70
+        unique_together = (('player', 'guild'),)
71
+
72
+
73
+class GuildMembership(models.Model):
74
+    player = models.ForeignKey('Players', models.DO_NOTHING, primary_key=True)
75
+    guild = models.ForeignKey('Guilds', models.DO_NOTHING)
76
+    rank = models.ForeignKey('GuildRanks', models.DO_NOTHING)
77
+    nick = models.CharField(max_length=15)
78
+
79
+    class Meta:
80
+        managed = False
81
+        db_table = 'guild_membership'
82
+
83
+
84
+class GuildRanks(models.Model):
85
+    guild = models.ForeignKey('Guilds', models.DO_NOTHING)
86
+    name = models.CharField(max_length=255)
87
+    level = models.IntegerField()
88
+
89
+    class Meta:
90
+        managed = False
91
+        db_table = 'guild_ranks'
92
+
93
+
94
+class GuildWars(models.Model):
95
+    guild1 = models.IntegerField()
96
+    guild2 = models.IntegerField()
97
+    name1 = models.CharField(max_length=255)
98
+    name2 = models.CharField(max_length=255)
99
+    status = models.IntegerField()
100
+    started = models.BigIntegerField()
101
+    ended = models.BigIntegerField()
102
+
103
+    class Meta:
104
+        managed = False
105
+        db_table = 'guild_wars'
106
+
107
+
108
+class Guilds(models.Model):
109
+    name = models.CharField(unique=True, max_length=255)
110
+    ownerid = models.ForeignKey('Players', models.DO_NOTHING, db_column='ownerid', unique=True)
111
+    creationdata = models.IntegerField()
112
+    motd = models.CharField(max_length=255)
113
+
114
+    class Meta:
115
+        managed = False
116
+        db_table = 'guilds'
117
+
118
+
119
+class GuildwarKills(models.Model):
120
+    killer = models.CharField(max_length=50)
121
+    target = models.CharField(max_length=50)
122
+    killerguild = models.IntegerField()
123
+    targetguild = models.IntegerField()
124
+    warid = models.ForeignKey(GuildWars, models.DO_NOTHING, db_column='warid')
125
+    time = models.BigIntegerField()
126
+
127
+    class Meta:
128
+        managed = False
129
+        db_table = 'guildwar_kills'
130
+
131
+
132
+class HouseLists(models.Model):
133
+    house = models.ForeignKey('Houses', models.DO_NOTHING)
134
+    listid = models.IntegerField()
135
+    list = models.TextField()
136
+
137
+    class Meta:
138
+        managed = False
139
+        db_table = 'house_lists'
140
+
141
+
142
+class Houses(models.Model):
143
+    owner = models.IntegerField()
144
+    paid = models.PositiveIntegerField()
145
+    warnings = models.IntegerField()
146
+    name = models.CharField(max_length=255)
147
+    rent = models.IntegerField()
148
+    town_id = models.IntegerField()
149
+    bid = models.IntegerField()
150
+    bid_end = models.IntegerField()
151
+    last_bid = models.IntegerField()
152
+    highest_bidder = models.IntegerField()
153
+    size = models.IntegerField()
154
+    beds = models.IntegerField()
155
+
156
+    class Meta:
157
+        managed = False
158
+        db_table = 'houses'
159
+
160
+
161
+class IpBans(models.Model):
162
+    ip = models.PositiveIntegerField(primary_key=True)
163
+    reason = models.CharField(max_length=255)
164
+    banned_at = models.BigIntegerField()
165
+    expires_at = models.BigIntegerField()
166
+    banned_by = models.ForeignKey('Players', models.DO_NOTHING, db_column='banned_by')
167
+
168
+    class Meta:
169
+        managed = False
170
+        db_table = 'ip_bans'
171
+
172
+
173
+class MarketHistory(models.Model):
174
+    player = models.ForeignKey('Players', models.DO_NOTHING)
175
+    sale = models.IntegerField()
176
+    itemtype = models.PositiveIntegerField()
177
+    amount = models.PositiveSmallIntegerField()
178
+    price = models.PositiveIntegerField()
179
+    expires_at = models.BigIntegerField()
180
+    inserted = models.BigIntegerField()
181
+    state = models.PositiveIntegerField()
182
+
183
+    class Meta:
184
+        managed = False
185
+        db_table = 'market_history'
186
+
187
+
188
+class MarketOffers(models.Model):
189
+    player = models.ForeignKey('Players', models.DO_NOTHING)
190
+    sale = models.IntegerField()
191
+    itemtype = models.PositiveIntegerField()
192
+    amount = models.PositiveSmallIntegerField()
193
+    created = models.BigIntegerField()
194
+    anonymous = models.IntegerField()
195
+    price = models.PositiveIntegerField()
196
+
197
+    class Meta:
198
+        managed = False
199
+        db_table = 'market_offers'
200
+
201
+
202
+class PlayerDeaths(models.Model):
203
+    player = models.ForeignKey('Players', models.DO_NOTHING)
204
+    time = models.BigIntegerField()
205
+    level = models.IntegerField()
206
+    killed_by = models.CharField(max_length=255)
207
+    is_player = models.IntegerField()
208
+    mostdamage_by = models.CharField(max_length=100)
209
+    mostdamage_is_player = models.IntegerField()
210
+    unjustified = models.IntegerField()
211
+    mostdamage_unjustified = models.IntegerField()
212
+
213
+    class Meta:
214
+        managed = False
215
+        db_table = 'player_deaths'
216
+
217
+
218
+class PlayerDepotitems(models.Model):
219
+    player = models.ForeignKey('Players', models.DO_NOTHING)
220
+    sid = models.IntegerField()
221
+    pid = models.IntegerField()
222
+    itemtype = models.SmallIntegerField()
223
+    count = models.SmallIntegerField()
224
+    attributes = models.TextField()
225
+
226
+    class Meta:
227
+        managed = False
228
+        db_table = 'player_depotitems'
229
+        unique_together = (('player', 'sid'),)
230
+
231
+
232
+class PlayerInboxitems(models.Model):
233
+    player = models.ForeignKey('Players', models.DO_NOTHING)
234
+    sid = models.IntegerField()
235
+    pid = models.IntegerField()
236
+    itemtype = models.SmallIntegerField()
237
+    count = models.SmallIntegerField()
238
+    attributes = models.TextField()
239
+
240
+    class Meta:
241
+        managed = False
242
+        db_table = 'player_inboxitems'
243
+        unique_together = (('player', 'sid'),)
244
+
245
+
246
+class PlayerItems(models.Model):
247
+    player = models.ForeignKey('Players', models.DO_NOTHING)
248
+    pid = models.IntegerField()
249
+    sid = models.IntegerField()
250
+    itemtype = models.SmallIntegerField()
251
+    count = models.SmallIntegerField()
252
+    attributes = models.TextField()
253
+
254
+    class Meta:
255
+        managed = False
256
+        db_table = 'player_items'
257
+
258
+
259
+class PlayerNamelocks(models.Model):
260
+    player = models.ForeignKey('Players', models.DO_NOTHING, primary_key=True)
261
+    reason = models.CharField(max_length=255)
262
+    namelocked_at = models.BigIntegerField()
263
+    namelocked_by = models.ForeignKey('Players', models.DO_NOTHING, db_column='namelocked_by', related_name='namelocks')
264
+
265
+    class Meta:
266
+        managed = False
267
+        db_table = 'player_namelocks'
268
+
269
+
270
+class PlayerSpells(models.Model):
271
+    player = models.ForeignKey('Players', models.DO_NOTHING)
272
+    name = models.CharField(max_length=255)
273
+
274
+    class Meta:
275
+        managed = False
276
+        db_table = 'player_spells'
277
+
278
+
279
+class PlayerStorage(models.Model):
280
+    player = models.ForeignKey('Players', models.DO_NOTHING, primary_key=True)
281
+    key = models.PositiveIntegerField()
282
+    value = models.IntegerField()
283
+
284
+    class Meta:
285
+        managed = False
286
+        db_table = 'player_storage'
287
+        unique_together = (('player', 'key'),)
288
+
289
+
290
+class Players(models.Model):
291
+    name = models.CharField(unique=True, max_length=255)
292
+    group_id = models.IntegerField()
293
+    account = models.ForeignKey(Accounts, models.DO_NOTHING)
294
+    level = models.IntegerField()
295
+    vocation = models.IntegerField()
296
+    health = models.IntegerField()
297
+    healthmax = models.IntegerField()
298
+    experience = models.BigIntegerField()
299
+    lookbody = models.IntegerField()
300
+    lookfeet = models.IntegerField()
301
+    lookhead = models.IntegerField()
302
+    looklegs = models.IntegerField()
303
+    looktype = models.IntegerField()
304
+    lookaddons = models.IntegerField()
305
+    maglevel = models.IntegerField()
306
+    mana = models.IntegerField()
307
+    manamax = models.IntegerField()
308
+    manaspent = models.PositiveIntegerField()
309
+    soul = models.PositiveIntegerField()
310
+    town_id = models.IntegerField()
311
+    posx = models.IntegerField()
312
+    posy = models.IntegerField()
313
+    posz = models.IntegerField()
314
+    conditions = models.TextField()
315
+    cap = models.IntegerField()
316
+    sex = models.IntegerField()
317
+    lastlogin = models.BigIntegerField()
318
+    lastip = models.PositiveIntegerField()
319
+    save = models.IntegerField()
320
+    skull = models.IntegerField()
321
+    skulltime = models.IntegerField()
322
+    lastlogout = models.BigIntegerField()
323
+    blessings = models.IntegerField()
324
+    onlinetime = models.IntegerField()
325
+    deletion = models.BigIntegerField()
326
+    balance = models.BigIntegerField()
327
+    offlinetraining_time = models.PositiveSmallIntegerField()
328
+    offlinetraining_skill = models.IntegerField()
329
+    stamina = models.PositiveSmallIntegerField()
330
+    skill_fist = models.PositiveIntegerField()
331
+    skill_fist_tries = models.BigIntegerField()
332
+    skill_club = models.PositiveIntegerField()
333
+    skill_club_tries = models.BigIntegerField()
334
+    skill_sword = models.PositiveIntegerField()
335
+    skill_sword_tries = models.BigIntegerField()
336
+    skill_axe = models.PositiveIntegerField()
337
+    skill_axe_tries = models.BigIntegerField()
338
+    skill_dist = models.PositiveIntegerField()
339
+    skill_dist_tries = models.BigIntegerField()
340
+    skill_shielding = models.PositiveIntegerField()
341
+    skill_shielding_tries = models.BigIntegerField()
342
+    skill_fishing = models.PositiveIntegerField()
343
+    skill_fishing_tries = models.BigIntegerField()
344
+
345
+    class Meta:
346
+        managed = False
347
+        db_table = 'players'
348
+
349
+
350
+class PlayersOnline(models.Model):
351
+    player_id = models.IntegerField(primary_key=True)
352
+
353
+    class Meta:
354
+        managed = False
355
+        db_table = 'players_online'
356
+
357
+
358
+class ServerConfig(models.Model):
359
+    config = models.CharField(primary_key=True, max_length=50)
360
+    value = models.CharField(max_length=256)
361
+
362
+    class Meta:
363
+        managed = False
364
+        db_table = 'server_config'
365
+
366
+
367
+class TileStore(models.Model):
368
+    house = models.ForeignKey(Houses, models.DO_NOTHING)
369
+    data = models.TextField()
370
+
371
+    class Meta:
372
+        managed = False
373
+        db_table = 'tile_store'
374
+
375
+
376
+class Towns(models.Model):
377
+    name = models.CharField(unique=True, max_length=255)
378
+    posx = models.IntegerField()
379
+    posy = models.IntegerField()
380
+    posz = models.IntegerField()
381
+
382
+    class Meta:
383
+        managed = False
384
+        db_table = 'towns'

+ 22
- 0
accounts/templates/index.html View File

@@ -0,0 +1,22 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <title>Highscore</title>
6
+</head>
7
+<body>
8
+
9
+{% if best_players %}
10
+    <ul>
11
+    {% for player in best_players %}
12
+        <li>{{ player.name }} - {{ player.level }}</li>
13
+    {% endfor %}
14
+    </ul>
15
+{% else %}
16
+    <p>No players registered.</p>
17
+{% endif %}
18
+
19
+<a href="{% url 'accounts:register' %}">Register now!</a>
20
+
21
+</body>
22
+</html>

+ 17
- 0
accounts/templates/register_account.html View File

@@ -0,0 +1,17 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <title>Register Account</title>
6
+
7
+
8
+</head>
9
+<body>
10
+
11
+    <form method="post">{% csrf_token %}
12
+    {{ form.as_p }}
13
+    <input type="submit" value="Save">
14
+</form>
15
+
16
+</body>
17
+</html>

+ 3
- 0
accounts/tests.py View File

@@ -0,0 +1,3 @@
1
+from django.test import TestCase
2
+
3
+# Create your tests here.

+ 11
- 0
accounts/urls.py View File

@@ -0,0 +1,11 @@
1
+from django.urls import path
2
+
3
+
4
+from . import views
5
+
6
+app_name = 'accounts'
7
+
8
+urlpatterns = [
9
+    path('', views.IndexView.as_view(), name='index'),
10
+    path('register/', views.RegisterAccountView.as_view(), name='register'),
11
+]

+ 27
- 0
accounts/views.py View File

@@ -0,0 +1,27 @@
1
+from django.shortcuts import render, render_to_response
2
+from django.views import generic
3
+from django.views.generic.edit import CreateView
4
+# Create your views here.
5
+from accounts.models import Accounts, Players
6
+
7
+
8
+class RegisterAccountView(CreateView):
9
+    model = Accounts
10
+    fields = ['name', 'password', 'email']
11
+    template_name = 'register_account.html'
12
+
13
+    def form_valid(self, form):
14
+        import hashlib
15
+        self.object = form.save(commit=False)
16
+        hashed_password = hashlib.sha1(self.object.password.encode('utf-8')).hexdigest()
17
+        self.object.password = hashed_password
18
+        self.object.save()
19
+
20
+        return render_to_response(self.template_name, self.get_context_data())
21
+
22
+class IndexView(generic.ListView):
23
+    template_name = 'index.html'
24
+    context_object_name = 'best_players'
25
+
26
+    def get_queryset(self):
27
+        return Players.objects.order_by('-level')[:10]

+ 15
- 0
manage.py View File

@@ -0,0 +1,15 @@
1
+#!/usr/bin/env python
2
+import os
3
+import sys
4
+
5
+if __name__ == '__main__':
6
+    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tibia_website.settings')
7
+    try:
8
+        from django.core.management import execute_from_command_line
9
+    except ImportError as exc:
10
+        raise ImportError(
11
+            "Couldn't import Django. Are you sure it's installed and "
12
+            "available on your PYTHONPATH environment variable? Did you "
13
+            "forget to activate a virtual environment?"
14
+        ) from exc
15
+    execute_from_command_line(sys.argv)

+ 0
- 0
tibia_website/__init__.py View File


+ 125
- 0
tibia_website/settings.py View File

@@ -0,0 +1,125 @@
1
+"""
2
+Django settings for tibia_website project.
3
+
4
+Generated by 'django-admin startproject' using Django 2.1.5.
5
+
6
+For more information on this file, see
7
+https://docs.djangoproject.com/en/2.1/topics/settings/
8
+
9
+For the full list of settings and their values, see
10
+https://docs.djangoproject.com/en/2.1/ref/settings/
11
+"""
12
+
13
+import os
14
+
15
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
+
18
+
19
+# Quick-start development settings - unsuitable for production
20
+# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
21
+
22
+# SECURITY WARNING: keep the secret key used in production secret!
23
+SECRET_KEY = '0bup5^j9qen7!g8i5ngkc0_n+0wh@8n8j@_j+$vj06l3v2)esl'
24
+
25
+# SECURITY WARNING: don't run with debug turned on in production!
26
+DEBUG = True
27
+
28
+ALLOWED_HOSTS = []
29
+
30
+
31
+# Application definition
32
+
33
+INSTALLED_APPS = [
34
+    'accounts.apps.AccountsConfig',
35
+    'django.contrib.admin',
36
+    'django.contrib.auth',
37
+    'django.contrib.contenttypes',
38
+    'django.contrib.sessions',
39
+    'django.contrib.messages',
40
+    'django.contrib.staticfiles',
41
+]
42
+
43
+MIDDLEWARE = [
44
+    'django.middleware.security.SecurityMiddleware',
45
+    'django.contrib.sessions.middleware.SessionMiddleware',
46
+    'django.middleware.common.CommonMiddleware',
47
+    'django.middleware.csrf.CsrfViewMiddleware',
48
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
49
+    'django.contrib.messages.middleware.MessageMiddleware',
50
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
51
+]
52
+
53
+ROOT_URLCONF = 'tibia_website.urls'
54
+
55
+TEMPLATES = [
56
+    {
57
+        'BACKEND': 'django.template.backends.django.DjangoTemplates',
58
+        'DIRS': [],
59
+        'APP_DIRS': True,
60
+        'OPTIONS': {
61
+            'context_processors': [
62
+                'django.template.context_processors.debug',
63
+                'django.template.context_processors.request',
64
+                'django.contrib.auth.context_processors.auth',
65
+                'django.contrib.messages.context_processors.messages',
66
+            ],
67
+        },
68
+    },
69
+]
70
+
71
+WSGI_APPLICATION = 'tibia_website.wsgi.application'
72
+
73
+
74
+# Database
75
+# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
76
+
77
+DATABASES = {
78
+    'default': {
79
+        'ENGINE': 'django.db.backends.mysql',
80
+        'NAME': 'tibia3',
81
+        'USER': 'tibia',
82
+        'PASSWORD': 'dVS5iy3R7Q9kMZd7',
83
+        'HOST': 'localhost',   # Or an IP Address that your DB is hosted on
84
+        'PORT': '3306',
85
+    }
86
+}
87
+
88
+
89
+# Password validation
90
+# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
91
+
92
+AUTH_PASSWORD_VALIDATORS = [
93
+    {
94
+        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
95
+    },
96
+    {
97
+        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
98
+    },
99
+    {
100
+        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
101
+    },
102
+    {
103
+        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
104
+    },
105
+]
106
+
107
+
108
+# Internationalization
109
+# https://docs.djangoproject.com/en/2.1/topics/i18n/
110
+
111
+LANGUAGE_CODE = 'en-us'
112
+
113
+TIME_ZONE = 'UTC'
114
+
115
+USE_I18N = True
116
+
117
+USE_L10N = True
118
+
119
+USE_TZ = True
120
+
121
+
122
+# Static files (CSS, JavaScript, Images)
123
+# https://docs.djangoproject.com/en/2.1/howto/static-files/
124
+
125
+STATIC_URL = '/static/'

+ 22
- 0
tibia_website/urls.py View File

@@ -0,0 +1,22 @@
1
+"""tibia_website URL Configuration
2
+
3
+The `urlpatterns` list routes URLs to views. For more information please see:
4
+    https://docs.djangoproject.com/en/2.1/topics/http/urls/
5
+Examples:
6
+Function views
7
+    1. Add an import:  from my_app import views
8
+    2. Add a URL to urlpatterns:  path('', views.home, name='home')
9
+Class-based views
10
+    1. Add an import:  from other_app.views import Home
11
+    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
12
+Including another URLconf
13
+    1. Import the include() function: from django.urls import include, path
14
+    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
15
+"""
16
+from django.contrib import admin
17
+from django.urls import path, include
18
+
19
+urlpatterns = [
20
+    path('admin/', admin.site.urls),
21
+    path('accounts/', include('accounts.urls') )
22
+]

+ 16
- 0
tibia_website/wsgi.py View File

@@ -0,0 +1,16 @@
1
+"""
2
+WSGI config for tibia_website project.
3
+
4
+It exposes the WSGI callable as a module-level variable named ``application``.
5
+
6
+For more information on this file, see
7
+https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
8
+"""
9
+
10
+import os
11
+
12
+from django.core.wsgi import get_wsgi_application
13
+
14
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tibia_website.settings')
15
+
16
+application = get_wsgi_application()

Loading…
Cancel
Save