mirror of
https://github.com/solero/houdini.git
synced 2024-11-22 05:27:23 +00:00
Move all enums and constants into their own module
This commit is contained in:
parent
8a9f2e8b99
commit
9806bcf82e
@ -4,9 +4,7 @@ import argparse
|
|||||||
import config
|
import config
|
||||||
|
|
||||||
from houdini.houdini import Houdini
|
from houdini.houdini import Houdini
|
||||||
from houdini import ConflictResolution
|
from houdini.constants import ConflictResolution, Language, ClientType
|
||||||
from houdini import Language
|
|
||||||
from houdini import ClientType
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logger = logging.getLogger('houdini')
|
logger = logging.getLogger('houdini')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from houdini import ConflictResolution, Language, ClientType
|
from houdini.constants import ConflictResolution, Language, ClientType
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
'Address': 'localhost',
|
'Address': 'localhost',
|
||||||
|
@ -3,42 +3,22 @@ from types import FunctionType
|
|||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import enum
|
|
||||||
import logging
|
import logging
|
||||||
import importlib
|
import importlib
|
||||||
import pkgutil
|
import pkgutil
|
||||||
|
|
||||||
|
|
||||||
class StatusField(enum.IntEnum):
|
def get_package_modules(package):
|
||||||
OpenedIglooViewer = 1
|
package_modules = []
|
||||||
ActiveIglooLayoutOpenFlag = 2
|
for importer, module_name, is_package in pkgutil.iter_modules(package.__path__):
|
||||||
PuffleTreasureInfographic = 512
|
full_module_name = f'{package.__name__}.{module_name}'
|
||||||
PlayerOptInAbTestDayZero = 1024
|
subpackage_object = importlib.import_module(full_module_name, package=package.__path__)
|
||||||
PlayerSwapPuffle = 2048
|
if is_package:
|
||||||
MoreThanTenPufflesBackyardMessage = 4096
|
sub_package_modules = get_package_modules(subpackage_object)
|
||||||
VisitBackyardFirstTime = 8192
|
|
||||||
HasWalkedPuffleFirstTime = 65536
|
|
||||||
HasWalkedPuffleSecondTime = 131072
|
|
||||||
|
|
||||||
package_modules = package_modules + sub_package_modules
|
package_modules = package_modules + sub_package_modules
|
||||||
class ConflictResolution(enum.Enum):
|
package_modules.append(subpackage_object)
|
||||||
Silent = 0
|
return package_modules
|
||||||
Append = 1
|
|
||||||
Exception = 2
|
|
||||||
|
|
||||||
|
|
||||||
class Language(enum.IntEnum):
|
|
||||||
En = 1
|
|
||||||
Pt = 2
|
|
||||||
Fr = 4
|
|
||||||
Es = 8
|
|
||||||
De = 32
|
|
||||||
Ru = 64
|
|
||||||
|
|
||||||
|
|
||||||
class ClientType(enum.Enum):
|
|
||||||
Legacy = 'legacy'
|
|
||||||
Vanilla = 'vanilla'
|
|
||||||
|
|
||||||
|
|
||||||
class _AbstractManager(dict):
|
class _AbstractManager(dict):
|
||||||
|
@ -3,7 +3,8 @@ import config
|
|||||||
|
|
||||||
from houdini import handlers
|
from houdini import handlers
|
||||||
from houdini import plugins
|
from houdini import plugins
|
||||||
from houdini import ConflictResolution, _AbstractManager
|
from houdini import _AbstractManager
|
||||||
|
from houdini.constants import ConflictResolution
|
||||||
|
|
||||||
from houdini.converters import _ArgumentDeserializer, _listener
|
from houdini.converters import _ArgumentDeserializer, _listener
|
||||||
|
|
||||||
|
33
houdini/constants.py
Normal file
33
houdini/constants.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import enum
|
||||||
|
|
||||||
|
|
||||||
|
class StatusField(enum.IntEnum):
|
||||||
|
OpenedIglooViewer = 1
|
||||||
|
ActiveIglooLayoutOpenFlag = 2
|
||||||
|
PuffleTreasureInfographic = 512
|
||||||
|
PlayerOptInAbTestDayZero = 1024
|
||||||
|
PlayerSwapPuffle = 2048
|
||||||
|
MoreThanTenPufflesBackyardMessage = 4096
|
||||||
|
VisitBackyardFirstTime = 8192
|
||||||
|
HasWalkedPuffleFirstTime = 65536
|
||||||
|
HasWalkedPuffleSecondTime = 131072
|
||||||
|
|
||||||
|
|
||||||
|
class ConflictResolution(enum.Enum):
|
||||||
|
Silent = 0
|
||||||
|
Append = 1
|
||||||
|
Exception = 2
|
||||||
|
|
||||||
|
|
||||||
|
class Language(enum.IntEnum):
|
||||||
|
En = 1
|
||||||
|
Pt = 2
|
||||||
|
Fr = 4
|
||||||
|
Es = 8
|
||||||
|
De = 32
|
||||||
|
Ru = 64
|
||||||
|
|
||||||
|
|
||||||
|
class ClientType(enum.Enum):
|
||||||
|
Legacy = 'legacy'
|
||||||
|
Vanilla = 'vanilla'
|
@ -1,15 +1,11 @@
|
|||||||
import inspect
|
import inspect
|
||||||
import enum
|
import enum
|
||||||
import itertools
|
import itertools
|
||||||
import importlib
|
|
||||||
import sys
|
|
||||||
import config
|
|
||||||
from types import FunctionType
|
from types import FunctionType
|
||||||
|
|
||||||
from houdini.converters import _listener, _ArgumentDeserializer, get_converter, do_conversion, _ConverterContext
|
from houdini.converters import _listener, _ArgumentDeserializer, get_converter, do_conversion, _ConverterContext
|
||||||
|
|
||||||
from houdini.cooldown import _Cooldown, _CooldownMapping, BucketType
|
from houdini.cooldown import _Cooldown, _CooldownMapping, BucketType
|
||||||
from houdini import plugins, _AbstractManager
|
from houdini import plugins, _AbstractManager, get_package_modules
|
||||||
|
|
||||||
|
|
||||||
class AuthorityError(Exception):
|
class AuthorityError(Exception):
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import config
|
import config
|
||||||
|
|
||||||
from houdini import handlers, ClientType
|
from houdini import handlers
|
||||||
from houdini.handlers import XMLPacket
|
from houdini.handlers import XMLPacket
|
||||||
from houdini.converters import VersionChkConverter
|
from houdini.converters import VersionChkConverter
|
||||||
|
from houdini.constants import ClientType
|
||||||
|
|
||||||
from houdini.data.buddy import BuddyList
|
from houdini.data.buddy import BuddyList
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
from houdini import handlers, ClientType
|
from houdini import handlers
|
||||||
from houdini.handlers import XMLPacket, login
|
from houdini.handlers import XMLPacket
|
||||||
from houdini.handlers.login import get_server_presence
|
from houdini.handlers.login import get_server_presence
|
||||||
from houdini.converters import Credentials
|
from houdini.converters import Credentials
|
||||||
from houdini.data.penguin import Penguin
|
from houdini.data.penguin import Penguin
|
||||||
from houdini.data.moderator import Ban
|
from houdini.data.moderator import Ban
|
||||||
from houdini.crypto import Crypto
|
from houdini.crypto import Crypto
|
||||||
|
from houdini.constants import ClientType
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import bcrypt
|
import bcrypt
|
||||||
@ -97,6 +98,3 @@ async def handle_login(p, credentials: Credentials):
|
|||||||
data.email)
|
data.email)
|
||||||
else:
|
else:
|
||||||
await p.send_xt('l', data.id, login_key, world_populations, buddy_presence)
|
await p.send_xt('l', data.id, login_key, world_populations, buddy_presence)
|
||||||
|
|
||||||
handle_version_check = login.handle_version_check
|
|
||||||
handle_random_key = login.handle_random_key
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import config
|
import config
|
||||||
|
|
||||||
from houdini import handlers, ClientType
|
from houdini import handlers
|
||||||
from houdini.handlers import XMLPacket, login
|
from houdini.handlers import XMLPacket, login
|
||||||
from houdini.converters import WorldCredentials, Credentials
|
from houdini.converters import WorldCredentials, Credentials
|
||||||
from houdini.data.penguin import Penguin
|
from houdini.data.penguin import Penguin
|
||||||
from houdini.data.moderator import Ban
|
from houdini.data.moderator import Ban
|
||||||
from houdini.crypto import Crypto
|
from houdini.crypto import Crypto
|
||||||
|
from houdini.constants import ClientType
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ from houdini.handlers.play.navigation import handle_join_room
|
|||||||
|
|
||||||
from houdini.data.penguin import Penguin
|
from houdini.data.penguin import Penguin
|
||||||
from houdini.data.buddy import BuddyList, BuddyRequest
|
from houdini.data.buddy import BuddyList, BuddyRequest
|
||||||
from houdini import ClientType
|
from houdini.constants import ClientType
|
||||||
|
|
||||||
|
|
||||||
async def update_player_presence(p):
|
async def update_player_presence(p):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from houdini import handlers, ClientType
|
from houdini import handlers
|
||||||
from houdini.handlers import XTPacket
|
from houdini.handlers import XTPacket
|
||||||
from houdini.data.penguin import Penguin
|
from houdini.data.penguin import Penguin
|
||||||
|
from houdini.constants import ClientType
|
||||||
|
|
||||||
from aiocache import cached
|
from aiocache import cached
|
||||||
import random
|
import random
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from houdini import handlers, ClientType
|
from houdini import handlers
|
||||||
from houdini.handlers import XTPacket
|
from houdini.handlers import XTPacket
|
||||||
|
from houdini.constants import ClientType
|
||||||
|
|
||||||
|
|
||||||
@handlers.handler(XTPacket('t', 'at'))
|
@handlers.handler(XTPacket('t', 'at'))
|
||||||
|
Loading…
Reference in New Issue
Block a user