From bb94b1729a14cca20feaf90c31747d9800c722cd Mon Sep 17 00:00:00 2001 From: ro <44623254+rsakeys@users.noreply.github.com> Date: Sun, 9 Jun 2019 20:25:33 +0200 Subject: [PATCH] Update player item method created in the Penguin class - To be used in e.g. the plugin system --- houdini/penguin.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/houdini/penguin.py b/houdini/penguin.py index 2b899f8..980d795 100644 --- a/houdini/penguin.py +++ b/houdini/penguin.py @@ -164,7 +164,53 @@ class Penguin(Spheniscidae): async def _client_connected(self): await super()._client_connected() + + + async def update_color(self, item_id): + self.logger.info('{} updated their color to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(color=item_id).apply() + await self.room.send_xt('upc', self.data.id, item_id) + async def update_head(self, item_id): + self.logger.info('{} updated their head to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(head=item_id).apply() + await self.room.send_xt('uph', self.data.id, item_id) + + async def update_face(self, item_id): + self.logger.info('{} updated their face to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(face=item_id).apply() + await self.room.send_xt('upf', self.data.id, item_id) + + async def update_neck(self, item_id): + self.logger.info('{} updated their neck to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(neck=item_id).apply() + await self.room.send_xt('upn', self.data.id, item_id) + + async def update_body(self, item_id): + self.logger.info('{} updated their body to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(body=item_id).apply() + await self.room.send_xt('upb', self.data.id, item_id) + + async def update_hand(self, item_id): + self.logger.info('{} updated their hand to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(hand=item_id).apply() + await self.room.send_xt('upa', self.data.id, item_id) + + async def update_feet(self, item_id): + self.logger.info('{} updated their feet to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(feet=item_id).apply() + await self.room.send_xt('upe', self.data.id, item_id) + + async def update_flag(self, item_id): + self.logger.info('{} updated their pin to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(flag=item_id).apply() + await self.room.send_xt('upl', self.data.id, item_id) + + async def update_photo(self, item_id): + self.logger.info('{} updated their background to \'{}\' '.format(self.data.username, item_id)) + await self.data.update(photo=item_id).apply() + await self.room.send_xt('upp', self.data.id, item_id) + def __repr__(self): if self.data is not None: return ''.format(self.data.id, self.data.username)