mirror of
https://github.com/solero/houdini.git
synced 2024-12-24 22:43:36 +00:00
Increase server population in join server handler
This commit is contained in:
parent
3c4d8461f1
commit
864268afff
@ -37,7 +37,7 @@ async def get_server_presence(p, pid):
|
|||||||
|
|
||||||
for server_name, server_config in config.servers.items():
|
for server_name, server_config in config.servers.items():
|
||||||
if server_config['World']:
|
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']
|
server_population = (7 if int(server_population) == server_config['Capacity']
|
||||||
else int(server_population) / (server_config['Capacity'] / 6)) \
|
else int(server_population) / (server_config['Capacity'] / 6)) \
|
||||||
if server_population else 0
|
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))
|
world_populations.append('{},{}'.format(server_config['Id'], server_population))
|
||||||
|
|
||||||
server_key = '{}.players'.format(server_config['Id'])
|
server_key = '{}.players'.format(server_config['Id'])
|
||||||
|
|
||||||
if await p.server.redis.scard(server_key):
|
if await p.server.redis.scard(server_key):
|
||||||
async with p.server.db.transaction():
|
async with p.server.db.transaction():
|
||||||
buddies = BuddyList.select('buddy_id').where(BuddyList.penguin_id == pid).gino.iterate()
|
buddies = BuddyList.select('buddy_id').where(BuddyList.penguin_id == pid).gino.iterate()
|
||||||
|
@ -41,6 +41,8 @@ async def handle_join_server(p, penguin_id: int, login_key: str):
|
|||||||
|
|
||||||
p.joined_world = True
|
p.joined_world = True
|
||||||
|
|
||||||
|
await p.server.redis.hincrby('population', p.server.server_config['Id'], 1)
|
||||||
|
|
||||||
|
|
||||||
@handlers.handler(XTPacket('j', 'jr'))
|
@handlers.handler(XTPacket('j', 'jr'))
|
||||||
@handlers.cooldown(1)
|
@handlers.cooldown(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user