mirror of
https://github.com/solero/houdini.git
synced 2024-11-12 21:58:20 +00:00
Stealth moderator implementation
This commit is contained in:
parent
675099f70c
commit
1ec827b543
@ -455,6 +455,7 @@ CREATE TABLE penguin (
|
|||||||
last_paycheck TIMESTAMP NOT NULL,
|
last_paycheck TIMESTAMP NOT NULL,
|
||||||
minutes_played INT NOT NULL DEFAULT 0,
|
minutes_played INT NOT NULL DEFAULT 0,
|
||||||
moderator BOOLEAN NOT NULL DEFAULT FALSE,
|
moderator BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
stealth_moderator BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
character INT DEFAULT NULL,
|
character INT DEFAULT NULL,
|
||||||
igloo INT DEFAULT NULL,
|
igloo INT DEFAULT NULL,
|
||||||
coins INT NOT NULL DEFAULT 500,
|
coins INT NOT NULL DEFAULT 500,
|
||||||
|
@ -28,6 +28,7 @@ class Penguin(db.Model):
|
|||||||
last_paycheck = db.Column(db.DateTime, nullable=False, server_default=db.text("now()"))
|
last_paycheck = db.Column(db.DateTime, nullable=False, server_default=db.text("now()"))
|
||||||
minutes_played = db.Column(db.Integer, nullable=False, server_default=db.text("0"))
|
minutes_played = db.Column(db.Integer, nullable=False, server_default=db.text("0"))
|
||||||
moderator = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
moderator = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||||
|
stealth_moderator = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||||
character = db.Column(db.ForeignKey('character.id', ondelete='CASCADE', onupdate='CASCADE'))
|
character = db.Column(db.ForeignKey('character.id', ondelete='CASCADE', onupdate='CASCADE'))
|
||||||
igloo = db.Column(db.ForeignKey('penguin_igloo_room.id', ondelete='CASCADE', onupdate='CASCADE'))
|
igloo = db.Column(db.ForeignKey('penguin_igloo_room.id', ondelete='CASCADE', onupdate='CASCADE'))
|
||||||
coins = db.Column(db.Integer, nullable=False, server_default=db.text("500"))
|
coins = db.Column(db.Integer, nullable=False, server_default=db.text("500"))
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from houdini.data import db, BaseCrumbsCollection
|
from houdini.data import db, BaseCrumbsCollection
|
||||||
|
from houdini.constants import ClientType
|
||||||
|
|
||||||
|
|
||||||
class Room(db.Model):
|
class Room(db.Model):
|
||||||
@ -31,12 +32,23 @@ class Room(db.Model):
|
|||||||
self.penguins.append(p)
|
self.penguins.append(p)
|
||||||
|
|
||||||
p.room = self
|
p.room = self
|
||||||
|
if p.client_type == ClientType.Vanilla:
|
||||||
await p.send_xt('jr', self.id, await self.get_string())
|
if p.data.stealth_moderator:
|
||||||
await self.send_xt('ap', await p.string)
|
await p.send_xt('jr', self.id, (await self.get_string(p) + await p.string))
|
||||||
|
await p.send_xt('ap', await p.string)
|
||||||
|
else:
|
||||||
|
await p.send_xt('jr', self.id, await self.get_string(p))
|
||||||
|
await self.send_xt('ap', await p.string)
|
||||||
|
else:
|
||||||
|
await p.send_xt('jr', self.id, await self.get_string(p))
|
||||||
|
await self.send_xt('ap', await p.string)
|
||||||
|
|
||||||
async def remove_penguin(self, p):
|
async def remove_penguin(self, p):
|
||||||
await self.send_xt('rp', p.data.id)
|
if p.client_type == ClientType.Vanilla:
|
||||||
|
if not p.data.stealth_moderator:
|
||||||
|
await self.send_xt('rp', p.data.id)
|
||||||
|
else:
|
||||||
|
await self.send_xt('rp', p.data.id)
|
||||||
|
|
||||||
self.penguins.remove(p)
|
self.penguins.remove(p)
|
||||||
p.room = None
|
p.room = None
|
||||||
@ -44,9 +56,13 @@ class Room(db.Model):
|
|||||||
p.toy = None
|
p.toy = None
|
||||||
|
|
||||||
async def refresh(self, p):
|
async def refresh(self, p):
|
||||||
await p.send_xt('grs', self.id, await self.get_string())
|
if p.client_type == ClientType.Vanilla:
|
||||||
|
return await p.send_xt('grs', self.id, (await self.get_string(p) + await p.string))
|
||||||
|
await p.send_xt('grs', self.id, await self.get_string(p))
|
||||||
|
|
||||||
async def get_string(self):
|
async def get_string(self, p):
|
||||||
|
if p.client_type == ClientType.Vanilla:
|
||||||
|
return '%'.join([await p.string for p in self.penguins if not p.data.stealth_moderator])
|
||||||
return '%'.join([await p.string for p in self.penguins])
|
return '%'.join([await p.string for p in self.penguins])
|
||||||
|
|
||||||
async def send_xt(self, *data):
|
async def send_xt(self, *data):
|
||||||
|
@ -16,8 +16,11 @@ async def handle_join_server(p, penguin_id: int, login_key: str):
|
|||||||
return await p.close()
|
return await p.close()
|
||||||
|
|
||||||
await p.send_xt('activefeatures')
|
await p.send_xt('activefeatures')
|
||||||
|
|
||||||
|
moderator_status = 3 if p.data.character else 2 if p.data.stealth_moderator else 1 if p.data.moderator else 0
|
||||||
|
|
||||||
await p.send_xt('js', int(p.data.agent_status), int(0),
|
await p.send_xt('js', int(p.data.agent_status), int(0),
|
||||||
int(p.data.moderator), int(p.data.book_modified))
|
moderator_status, int(p.data.book_modified))
|
||||||
|
|
||||||
current_time = int(time.time())
|
current_time = int(time.time())
|
||||||
penguin_standard_time = current_time * 1000
|
penguin_standard_time = current_time * 1000
|
||||||
|
Loading…
Reference in New Issue
Block a user