Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player count update #33

Merged
merged 10 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions server/client_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,24 +629,24 @@ def set_area(self, area, target_pos=""):

self.area.area_manager.send_arup_players()

if self.viewing_hub_list:
for hub in self.server.hub_manager.hubs:
count = 0
for a in hub.areas:
for c in a.clients:
if not a.hide_clients and not c.hidden:
count = count + 1
hub.count = count
self.send_command(
"FA",
*[
"{ Hubs }\n Double-Click me to see Areas\n _______",
for hub in self.server.hub_manager.hubs:
count = 0
for c in hub.clients:
if not c.area.hide_clients and not c.hidden:
count = count + 1
hub.count = count
for c in self.server.client_manager.clients:
if c.viewing_hub_list:
c.send_command(
"FA",
*[
f"[{hub.id}] {hub.name} (users: {hub.count})"
for hub in self.server.hub_manager.hubs
"{ Hubs }\n Double-Click me to see Areas\n _______",
*[
f"[{hub.id}] {hub.name} (users: {hub.count})"
for hub in self.server.hub_manager.hubs
],
],
],
)
)

# Update everyone's available characters list
# Commented out due to potentially causing clientside lag...
Expand Down Expand Up @@ -1520,6 +1520,24 @@ def remove_client(self, client):
if c.following == client:
c.unfollow()
self.clients.remove(client)
for hub in self.server.hub_manager.hubs:
count = 0
for c in hub.clients:
if not c.area.hide_clients and not c.hidden:
count = count + 1
hub.count = count
for c in self.server.client_manager.clients:
if c.viewing_hub_list:
c.send_command(
"FA",
*[
"{ Hubs }\n Double-Click me to see Areas\n _______",
*[
f"[{hub.id}] {hub.name} (users: {hub.count})"
for hub in self.server.hub_manager.hubs
],
],
)

def get_targets(self, client, key, value, local=False, single=False):
"""
Expand Down
7 changes: 3 additions & 4 deletions server/network/aoprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,10 +1338,9 @@ def net_cmd_mc(self, args):
self.client.send_command("FL", *preflist)
for hub in self.client.server.hub_manager.hubs:
count = 0
for area in hub.areas:
for c in area.clients:
if not area.hide_clients and not c.hidden:
count = count + 1
for c in hub.clients:
if not c.area.hide_clients and not c.hidden:
count = count + 1
hub.count = count
self.client.send_command(
"FA",
Expand Down