Move crumbs collection setup to their own handlers

This commit is contained in:
Ben 2019-12-02 23:22:37 +00:00
parent 4703c9f789
commit c59e6fa8c4
7 changed files with 72 additions and 2 deletions

View File

@ -25,6 +25,15 @@ async def update_player_presence(p):
await penguin.send_xt('caon', p.character, p.server.config.id, p.room.id) await penguin.send_xt('caon', p.character, p.server.config.id, p.room.id)
@handlers.handler(XTPacket('j', 'js'), after=handle_join_server)
@handlers.player_attribute(joined_world=True)
@handlers.allow_once
async def load_buddy_inventory(p):
p.buddies = await BuddyListCollection.get_collection(p.id)
p.buddy_requests = await BuddyRequestCollection.get_collection(p.id)
p.character_buddies = await CharacterBuddyCollection.get_collection(p.id)
@handlers.handler(XTPacket('j', 'jr'), after=handle_join_room, client=ClientType.Vanilla) @handlers.handler(XTPacket('j', 'jr'), after=handle_join_room, client=ClientType.Vanilla)
async def handle_send_room_presence(p): async def handle_send_room_presence(p):
await update_player_presence(p) await update_player_presence(p)

View File

@ -12,7 +12,10 @@ from houdini.handlers.play.navigation import handle_join_server
from houdini.data import db from houdini.data import db
from houdini.data.penguin import Penguin from houdini.data.penguin import Penguin
from houdini.data.room import PenguinIglooRoom from houdini.data.room import PenguinIglooRoom
from houdini.data.igloo import IglooFurniture, IglooLike, Igloo, Furniture, Flooring, Location from houdini.data.igloo import IglooFurniture, IglooLike, Igloo, Furniture, Flooring, Location, \
PenguinIglooCollection, PenguinFurnitureCollection, \
PenguinFlooringCollection, PenguinLocationCollection
from houdini.data.room import PenguinIglooRoomCollection
from sqlalchemy.dialects.postgresql import insert from sqlalchemy.dialects.postgresql import insert
@ -137,6 +140,17 @@ async def save_igloo_furniture(p, furniture_list=None):
await IglooFurniture.insert().values(furniture).gino.status() await IglooFurniture.insert().values(furniture).gino.status()
@handlers.handler(XTPacket('j', 'js'), after=handle_join_server)
@handlers.player_attribute(joined_world=True)
@handlers.allow_once
async def load_igloo_inventory(p):
p.igloos = await PenguinIglooCollection.get_collection(p.id)
p.igloo_rooms = await PenguinIglooRoomCollection.get_collection(p.id)
p.furniture = await PenguinFurnitureCollection.get_collection(p.id)
p.flooring = await PenguinFlooringCollection.get_collection(p.id)
p.locations = await PenguinLocationCollection.get_collection(p.id)
@handlers.handler(XTPacket('g', 'gm')) @handlers.handler(XTPacket('g', 'gm'))
@handlers.cooldown(1) @handlers.cooldown(1)
async def handle_get_igloo_details(p, penguin_id: int): async def handle_get_igloo_details(p, penguin_id: int):

View File

@ -1,8 +1,16 @@
from houdini import handlers from houdini import handlers
from houdini.handlers import XTPacket from houdini.handlers import XTPacket
from houdini.handlers.play.navigation import handle_join_server
from houdini.data.penguin import Penguin from houdini.data.penguin import Penguin
from houdini.data.buddy import IgnoreList from houdini.data.buddy import IgnoreList, IgnoreListCollection
@handlers.handler(XTPacket('j', 'js'), after=handle_join_server)
@handlers.player_attribute(joined_world=True)
@handlers.allow_once
async def load_ignore_inventory(p):
p.ignore = await IgnoreListCollection.get_collection(p.id)
@handlers.handler(XTPacket('n', 'gn')) @handlers.handler(XTPacket('n', 'gn'))

View File

@ -1,6 +1,8 @@
from houdini import handlers from houdini import handlers
from houdini.handlers import XTPacket from houdini.handlers import XTPacket
from houdini.handlers.play.navigation import handle_join_server
from houdini.data.item import Item, PenguinItemCollection from houdini.data.item import Item, PenguinItemCollection
from houdini.data.permission import PenguinPermissionCollection
import time import time
from aiocache import cached from aiocache import cached
@ -43,6 +45,14 @@ async def get_awards_string(p, player_id):
return '%'.join(awards) return '%'.join(awards)
@handlers.handler(XTPacket('j', 'js'), after=handle_join_server)
@handlers.player_attribute(joined_world=True)
@handlers.allow_once
async def load_inventory(p):
p.inventory = await PenguinItemCollection.get_collection(p.id)
p.permissions = await PenguinPermissionCollection.get_collection(p.id)
@handlers.handler(XTPacket('i', 'gi')) @handlers.handler(XTPacket('i', 'gi'))
@handlers.allow_once @handlers.allow_once
async def handle_get_inventory(p): async def handle_get_inventory(p):

View File

@ -0,0 +1,11 @@
from houdini import handlers
from houdini.handlers import XTPacket
from houdini.handlers.play.navigation import handle_join_server
from houdini.data.ninja import PenguinCardCollection
@handlers.handler(XTPacket('j', 'js'), after=handle_join_server)
@handlers.player_attribute(joined_world=True)
@handlers.allow_once
async def load_ninja_inventory(p):
p.cards = await PenguinCardCollection.get_collection(p.id)

View File

@ -1,7 +1,18 @@
from houdini import handlers from houdini import handlers
from houdini.handlers import XTPacket from houdini.handlers import XTPacket
from houdini.handlers.play.navigation import handle_join_server
from houdini.constants import ClientType from houdini.constants import ClientType
from houdini.data.pet import PenguinPuffleCollection, PenguinPuffleItemCollection
@handlers.handler(XTPacket('j', 'js'), after=handle_join_server)
@handlers.player_attribute(joined_world=True)
@handlers.allow_once
async def load_pet_inventory(p):
p.puffles = await PenguinPuffleCollection.get_collection(p.id)
p.puffle_items = await PenguinPuffleItemCollection.get_collection(p.id)
@handlers.handler(XTPacket('p', 'getdigcooldown'), pre_login=True) @handlers.handler(XTPacket('p', 'getdigcooldown'), pre_login=True)
async def handle_get_dig_cooldown(p): async def handle_get_dig_cooldown(p):

View File

@ -47,6 +47,13 @@ async def get_player_stamps_string(p, player_id):
return '|'.join(map(str, stamp_inventory.keys())) return '|'.join(map(str, stamp_inventory.keys()))
@handlers.handler(XTPacket('j', 'js'), after=handle_join_server)
@handlers.player_attribute(joined_world=True)
@handlers.allow_once
async def load_stamp_inventory(p):
p.stamps = await PenguinStampCollection.get_collection(p.id)
@handlers.handler(XTPacket('j', 'js'), after=handle_join_server) @handlers.handler(XTPacket('j', 'js'), after=handle_join_server)
@handlers.allow_once @handlers.allow_once
async def handle_get_stamps(p): async def handle_get_stamps(p):