Skip to content
Open
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
44 changes: 44 additions & 0 deletions server/client_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,11 @@ def change_character(self, char_id, force=False):
self.area,
message={"from": old_char, "to": new_char},
)
# 2.11 player list support
for target in self.server.client_manager.clients:
if target.area.id == self.area.id:
target.send_command("PU", self.id, 1, self.char_name)

# Inform the CMs of character change
self.area.send_owner_command(
"CT",
Expand Down Expand Up @@ -1248,6 +1253,28 @@ def change_area(self, area, password=""):
self.set_area(area, target_pos)
self.last_move_time = round(time.time() * 1000.0)

# 2.11 player list support
for target in self.server.client_manager.clients:
if target.area.id == old_area.id and target.id != self.id:
self.send_command("PR", target.id, 1) # remove clients from previous area
target.send_command("PR", self.id, 1) # remove self from previous area to other clients
if target.area.id == self.area.id and target.id != self.id:
target.send_command("PR", self.id, 0) # add self to new area to other clients
target.send_command("PU", self.id, 0, self.name) # send name to other clients
target.send_command("PU", self.id, 1, self.char_name) # send char id to other clients
if self.showname != self.char_name:
target.send_command("PU", self.id, 2, self.showname) # send showname to other clients
target.send_command("PU", self.id, 3, self.area.id) # send area id to other clients

self.send_command("PR", target.id, 0) # add client from new area
self.send_command("PU", target.id, 0, target.name)
self.send_command("PU", target.id, 1, target.char_name)
if target.showname != target.char_name:
self.send_command("PU", target.id, 2, target.showname)
self.send_command("PU", target.id, 3, target.area.id)

self.send_command("PU", self.id, 3, self.area.id) # send area id to self

for c in self.server.client_manager.clients:
# If target c is following us
if c.following == self:
Expand Down Expand Up @@ -2292,6 +2319,20 @@ def new_client(self, transport):
for client in self.server.client_manager.clients:
if client.ipid == temp_ipid:
client.clientscon += 1
# 2.11 player list support
c.send_command("PR", c.id, 0)
c.send_command("PU", c.id, 0, c.name)
for target in self.server.client_manager.clients:
if target.area.id == 0 and target.id != c.id:
target.send_command("PR", c.id, 0) #register new client to others in lobby
target.send_command("PU", c.id, 0, c.name) #register name of new client to others in lobby

c.send_command("PR", target.id, 0) #register others in lobby to new client
c.send_command("PU", target.id, 0, target.name) #fetch names of others in lobby
c.send_command("PU", target.id, 1, target.char_name) #fetch chars of others in lobby
if target.showname != target.char_name:
c.send_command("PU", target.id, 2, target.showname) #fetch shownames of others in lobby
c.send_command("PU", target.id, 3, target.area.id) #fetch area of others in lobby
return c

def remove_client(self, client):
Expand All @@ -2316,6 +2357,9 @@ def remove_client(self, client):
c.clientscon -= 1
if c.following == client:
c.unfollow()
# 2.11 player list support
if c.area.id == client.area.id:
c.send_command("PR", client.id, 1)
self.clients.remove(client)

# TODO: Maybe take into account than sending the "CU" packet can reveal your cover.
Expand Down
14 changes: 14 additions & 0 deletions server/network/aoprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,13 @@ def net_cmd_ms(self, args):
):
additive = 0

# 2.11 player list support
if self.client.showname != self.client.char_name:
for target in self.client.server.client_manager.clients:
if target.area.id == self.client.area.id:
target.send_command("PU", self.client.id, 2, self.client.showname)
self.client.send_command("PU", self.client.id, 2, self.client.showname)

self.client.area.send_ic(
client=self.client,
msg_type=msg_type,
Expand Down Expand Up @@ -1718,6 +1725,13 @@ def net_cmd_ct(self, args):
args[1] = self.client.shake_message(args[1])
if self.client.disemvowel:
args[1] = self.client.disemvowel_message(args[1])

# 2.11 player list support
for target in self.client.server.client_manager.clients:
if target.area.id == self.client.area.id:
target.send_command("PU", self.client.id, 0, self.client.name)
self.client.send_command("PU", self.client.id, 0, self.client.name)

self.client.area.send_command("CT", name, args[1])
self.client.area.send_owner_command(
"CT", f"[{self.client.area.id}]{name}", args[1]
Expand Down
Loading