-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.py
56 lines (47 loc) · 1.5 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- coding: utf-8 -*-
from google.appengine.ext import db
class User(db.Model):
name = db.StringProperty()
access_key = db.StringProperty()
email = db.StringProperty()
password = db.StringProperty()
is_admin = db.BooleanProperty()
@property
def chars(self):
return Char.all().filter('owner = ', self.key())
def generateAccessKey(self):
import random
random.seed()
hash = random.getrandbits(128)
self.access_key = "%016x" % hash
class Char(db.Model):
owner = db.ReferenceProperty(User)
name = db.StringProperty()
class CharStats(db.Model):
char = db.ReferenceProperty(Char)
shard = db.StringProperty()
name = db.StringProperty()
coordx = db.StringProperty()
coordy = db.StringProperty()
coordz = db.StringProperty()
world = db.StringProperty()
direction = db.StringProperty()
connected = db.StringProperty()
dead = db.StringProperty()
str = db.StringProperty()
dex = db.StringProperty()
int = db.StringProperty()
life = db.StringProperty()
maxlife = db.StringProperty()
stam= db.StringProperty()
maxstam = db.StringProperty()
mana = db.StringProperty()
maxmana = db.StringProperty()
class CharJournal(db.Model):
char = db.ReferenceProperty(Char)
lines = db.StringListProperty()
class Skill(db.Model):
char = db.ReferenceProperty(Char, collection_name='skills')
name = db.StringProperty()
current = db.FloatProperty()
increased = db.FloatProperty()