mirror of
https://github.com/solero/houdini.git
synced 2024-11-08 20:28:20 +00:00
Support for status field updates
This commit is contained in:
parent
399df4ad16
commit
91a4d8acd5
@ -103,6 +103,10 @@ class Penguin(db.Model):
|
||||
def safe_nickname(self, language_bitmask):
|
||||
return self.nickname if self.approval & language_bitmask else "P" + str(self.id)
|
||||
|
||||
async def status_field_set(self, field_bitmask):
|
||||
if (self.status_field & field_bitmask) == 0:
|
||||
await self.update(status_field=self.status_field ^ field_bitmask).apply()
|
||||
|
||||
@property
|
||||
def minutes_played_today(self):
|
||||
async def get_minutes():
|
||||
|
@ -6,7 +6,7 @@ from datetime import datetime, timedelta
|
||||
from houdini import handlers
|
||||
from houdini.handlers import XTPacket
|
||||
from houdini.converters import SeparatorConverter
|
||||
from houdini.constants import ClientType
|
||||
from houdini.constants import ClientType, StatusField
|
||||
from houdini.handlers.play.navigation import handle_join_server
|
||||
|
||||
from houdini.data import db
|
||||
@ -161,7 +161,8 @@ async def handle_get_igloo_details(p, penguin_id: int):
|
||||
|
||||
@handlers.handler(XTPacket('g', 'gail'), client=ClientType.Vanilla)
|
||||
async def handle_get_all_igloo_layouts(p):
|
||||
await p.send_xt('gail', p.data.id, 0, await get_all_igloo_layouts(p))
|
||||
await p.status_field_set(StatusField.OpenedIglooViewer)
|
||||
await p.send_xt('gail', p.id, 0, await get_all_igloo_layouts(p))
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('g', 'ag'))
|
||||
@ -296,7 +297,8 @@ async def handle_update_igloo_slot_summary(p, igloo_id: int, slot_summary: _slot
|
||||
|
||||
if igloo_id == p.igloo:
|
||||
if not locked:
|
||||
p.server.open_igloos_by_penguin_id[p.data.id] = igloo
|
||||
await p.status_field_set(StatusField.ActiveIglooLayoutOpenFlag)
|
||||
p.server.open_igloos_by_penguin_id[p.id] = igloo
|
||||
|
||||
if igloo.locked != bool(locked):
|
||||
await igloo.update(locked=bool(locked)).apply()
|
||||
|
@ -4,7 +4,7 @@ from houdini.data.room import Room
|
||||
from houdini.data.penguin import Login
|
||||
from houdini.data.penguin import Penguin
|
||||
from houdini.data.room import PenguinIglooRoom, PenguinBackyardRoom
|
||||
from houdini.constants import ClientType
|
||||
from houdini.constants import ClientType, StatusField
|
||||
|
||||
import random
|
||||
import time
|
||||
@ -91,6 +91,7 @@ async def handle_join_player_room(p, penguin_id: int, room_type: str):
|
||||
backyard = PenguinBackyardRoom()
|
||||
await p.send_xt('jp', backyard.id, backyard.id, room_type)
|
||||
await p.join_room(backyard)
|
||||
await p.status_field_set(StatusField.VisitBackyardFirstTime)
|
||||
elif room_type == 'igloo':
|
||||
igloo = await create_temporary_room(p, penguin_id)
|
||||
await p.send_xt('jp', igloo.external_id, igloo.external_id, room_type)
|
||||
|
Loading…
Reference in New Issue
Block a user