__init__.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:PyPlanet 作者: PyPlanet 项目源码 文件源码
def pay_to_player(self, player, data, **kwargs):
        try:
            amount = abs(int(data.amount))

            planets = await self.instance.gbx('GetServerPlanets')
            if amount <= (planets - 2 - math.floor(amount * 0.05)):
                async with self.lock:
                    bill_id = await self.instance.gbx('Pay', data.login, amount, 'Payment from the server')
                    self.current_bills[bill_id] = dict(bill=bill_id, admin=player, player=data.login, amount=-amount)
            else:
                message = '$i$f00Insufficient balance for paying $fff{}$f00 ($fff{}$f00 inc. tax) planets, only got $fff{}$f00.'.format(
                    amount, (amount + 2 + math.floor(amount * 0.05)), planets
                )
                await self.instance.chat(message, player)
        except ValueError:
            message = '$z$s$fff» $i$f00The amount should be a numeric value.'
            await self.instance.chat(message, player)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号