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
|
||||
|
||||
from houdini.houdini import Houdini
|
||||
from houdini import ConflictResolution
|
||||
from houdini import Language
|
||||
from houdini import ClientType
|
||||
from houdini.constants import ConflictResolution, Language, ClientType
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = logging.getLogger('houdini')
|
||||
|
@ -1,4 +1,4 @@
|
||||
from houdini import ConflictResolution, Language, ClientType
|
||||
from houdini.constants import ConflictResolution, Language, ClientType
|
||||
|
||||
database = {
|
||||
'Address': 'localhost',
|
||||
|
@ -3,42 +3,22 @@ from types import FunctionType
|
||||
from abc import abstractmethod
|
||||
|
||||
import asyncio
|
||||
import enum
|
||||
import logging
|
||||
import importlib
|
||||
import pkgutil
|
||||
|
||||
|
||||
class StatusField(enum.IntEnum):
|
||||
OpenedIglooViewer = 1
|
||||
ActiveIglooLayoutOpenFlag = 2
|
||||
PuffleTreasureInfographic = 512
|
||||
PlayerOptInAbTestDayZero = 1024
|
||||
PlayerSwapPuffle = 2048
|
||||
MoreThanTenPufflesBackyardMessage = 4096
|
||||
VisitBackyardFirstTime = 8192
|
||||
HasWalkedPuffleFirstTime = 65536
|
||||
HasWalkedPuffleSecondTime = 131072
|
||||
def get_package_modules(package):
|
||||
package_modules = []
|
||||
for importer, module_name, is_package in pkgutil.iter_modules(package.__path__):
|
||||
full_module_name = f'{package.__name__}.{module_name}'
|
||||
subpackage_object = importlib.import_module(full_module_name, package=package.__path__)
|
||||
if is_package:
|
||||
sub_package_modules = get_package_modules(subpackage_object)
|
||||
|
||||
package_modules = package_modules + sub_package_modules
|
||||
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'
|
||||
package_modules.append(subpackage_object)
|
||||
return package_modules
|
||||
|
||||
|
||||
class _AbstractManager(dict):
|
||||
|
@ -3,7 +3,8 @@ import config
|
||||
|
||||
from houdini import handlers
|
||||
from houdini import plugins
|
||||
from houdini import ConflictResolution, _AbstractManager
|
||||
from houdini import _AbstractManager
|
||||
from houdini.constants import ConflictResolution
|
||||
|
||||
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 enum
|
||||
import itertools
|
||||
import importlib
|
||||
import sys
|
||||
import config
|
||||
from types import FunctionType
|
||||
|
||||
from houdini.converters import _listener, _ArgumentDeserializer, get_converter, do_conversion, _ConverterContext
|
||||
|
||||
from houdini.cooldown import _Cooldown, _CooldownMapping, BucketType
|
||||
from houdini import plugins, _AbstractManager
|
||||
from houdini import plugins, _AbstractManager, get_package_modules
|
||||
|
||||
|
||||
class AuthorityError(Exception):
|
||||
|
@ -1,8 +1,9 @@
|
||||
import config
|
||||
|
||||
from houdini import handlers, ClientType
|
||||
from houdini import handlers
|
||||
from houdini.handlers import XMLPacket
|
||||
from houdini.converters import VersionChkConverter
|
||||
from houdini.constants import ClientType
|
||||
|
||||
from houdini.data.buddy import BuddyList
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
from houdini import handlers, ClientType
|
||||
from houdini.handlers import XMLPacket, login
|
||||
from houdini import handlers
|
||||
from houdini.handlers import XMLPacket
|
||||
from houdini.handlers.login import get_server_presence
|
||||
from houdini.converters import Credentials
|
||||
from houdini.data.penguin import Penguin
|
||||
from houdini.data.moderator import Ban
|
||||
from houdini.crypto import Crypto
|
||||
from houdini.constants import ClientType
|
||||
|
||||
import asyncio
|
||||
import bcrypt
|
||||
@ -97,6 +98,3 @@ async def handle_login(p, credentials: Credentials):
|
||||
data.email)
|
||||
else:
|
||||
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
|
||||
|
||||
from houdini import handlers, ClientType
|
||||
from houdini import handlers
|
||||
from houdini.handlers import XMLPacket, login
|
||||
from houdini.converters import WorldCredentials, Credentials
|
||||
from houdini.data.penguin import Penguin
|
||||
from houdini.data.moderator import Ban
|
||||
from houdini.crypto import Crypto
|
||||
from houdini.constants import ClientType
|
||||
|
||||
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.buddy import BuddyList, BuddyRequest
|
||||
from houdini import ClientType
|
||||
from houdini.constants import ClientType
|
||||
|
||||
|
||||
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.data.penguin import Penguin
|
||||
from houdini.constants import ClientType
|
||||
|
||||
from aiocache import cached
|
||||
import random
|
||||
|
@ -1,5 +1,6 @@
|
||||
from houdini import handlers, ClientType
|
||||
from houdini import handlers
|
||||
from houdini.handlers import XTPacket
|
||||
from houdini.constants import ClientType
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('t', 'at'))
|
||||
|
Loading…
Reference in New Issue
Block a user