Increase server population in join server handler

This commit is contained in:
Ben 2019-08-19 02:20:46 +01:00
parent 3c4d8461f1
commit 864268afff
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,7 @@ async def get_server_presence(p, pid):
for server_name, server_config in config.servers.items():
if server_config['World']:
server_population = await p.server.redis.hget('population', server_name)
server_population = await p.server.redis.hget('population', server_config['Id'])
server_population = (7 if int(server_population) == server_config['Capacity']
else int(server_population) / (server_config['Capacity'] / 6)) \
if server_population else 0
@ -45,7 +45,6 @@ async def get_server_presence(p, pid):
world_populations.append('{},{}'.format(server_config['Id'], server_population))
server_key = '{}.players'.format(server_config['Id'])
if await p.server.redis.scard(server_key):
async with p.server.db.transaction():
buddies = BuddyList.select('buddy_id').where(BuddyList.penguin_id == pid).gino.iterate()

View File

@ -41,6 +41,8 @@ async def handle_join_server(p, penguin_id: int, login_key: str):
p.joined_world = True
await p.server.redis.hincrby('population', p.server.server_config['Id'], 1)
@handlers.handler(XTPacket('j', 'jr'))
@handlers.cooldown(1)