tibia-website/accounts/utils.py

30 lines
734 B
Python
Raw Normal View History

import hashlib
class LoginHelper(object):
@staticmethod
def hash_password(password):
hashed_password = hashlib.sha1(password.encode('utf-8'))\
.hexdigest()
2019-01-23 23:53:13 +01:00
return hashed_password
class VocationHelper(object):
mapper = {
0: 'None',
1: 'Sorcerer',
2: 'Druid',
3: 'Paladin',
4: 'Knight',
5: 'Master Sorcerer',
6: 'Elder Druid',
7: 'Royal Paladin',
8: 'Elite Knight',
}
@staticmethod
def vocation_to_string(vocation_id):
return VocationHelper.mapper[vocation_id]
@staticmethod
def get_base_vocation_choices():
return tuple([(k, v) for k, v, in VocationHelper.mapper.items() if k <= 4])