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)
评论列表
文章目录