Skip to content

Commit

Permalink
Merge pull request #157 from Chrezm/4.3.3-dev
Browse files Browse the repository at this point in the history
4.3.3
  • Loading branch information
Chrezm authored Jul 17, 2022
2 parents 23053d9 + 22fb031 commit af54a85
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 94 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -763,3 +763,13 @@
### 220610a (4.3.2-post1)
* Fixed /zone_global displaying area numbers to nonGMs
* Fixed sending "ackMS" packets to clients that didn't need it, delaying the rendering of self-sent messages for such clients

### 220717a (4.3.3)
* Added ambient sound effects for areas. Players entering areas with such sound effects set up (and with Danganronpa Online 1.2.0 or higher) will start listening to the sound effect. These are the commands (all GM+ only except ambient_info, which is available for all):
- /ambient
- /ambient_end
- /ambient_info
- /zone_ambient
- /zone_ambient_end
* Added support for Danganronpa Online 1.2.0 incoming packet `joined_area`, by sending such packet when a player joins an area rather than manually sending a blankpost
* Fixed /zone_tick_remove expecting 1 argument, when it should have expected no arguments
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ It is highly recommended you read through all the installation steps first befor
* If everything was set up correctly, you will see something like this appear:

```
[2022-06-08T10:20:20]: Starting...
[2022-06-08T10:20:20]: Launching TsuserverDR 4.3.2 (220609a)...
[2022-06-08T10:20:20]: Loading server configurations...
[2022-06-08T10:20:20]: Server configurations loaded successfully!
[2022-06-08T10:20:20]: Starting a nonlocal server...
[2022-06-08T10:20:20]: Server started successfully!
[2022-06-08T10:20:21]: Server should be now accessible from 192.0.2.0:50000:My First DR Server
[2022-07-17T10:20:20]: Starting...
[2022-07-17T10:20:20]: Launching TsuserverDR 4.3.3 (220717a)...
[2022-07-17T10:20:20]: Loading server configurations...
[2022-07-17T10:20:20]: Server configurations loaded successfully!
[2022-07-17T10:20:20]: Starting a nonlocal server...
[2022-07-17T10:20:20]: Server started successfully!
[2022-07-17T10:20:21]: Server should be now accessible from 192.0.2.0:50000:My First DR Server
```

* If you are listing your server in the Attorney Online master server, make sure its details are set up correctly. In particular, make sure that your server name and description are correct, as that is how players will find your server. If everything was set up correctly, you will see something like this appear:

```
[2022-06-08T10:20:21]: Attempting to connect to the master server at https://servers.aceattorneyonline.com/servers with the following details:
[2022-06-08T10:20:21]: *Server name: My First DR Server
[2022-06-08T10:20:21]: *Server description: This is my flashy new DR server
[2022-06-08T10:20:22]: Connected to the master server.
[2022-07-17T10:20:21]: Attempting to connect to the master server at https://servers.aceattorneyonline.com/servers with the following details:
[2022-07-17T10:20:21]: *Server name: My First DR Server
[2022-07-17T10:20:21]: *Server description: This is my flashy new DR server
[2022-07-17T10:20:22]: Connected to the master server.
```

- The server will make a single ping to [ipify](https://api.ipify.org) in order to obtain its public IP address. If it fails to do that, it will let you know that, as it means there is probably something wrong with your internet connection and that other players may not be able to connect to your server.
Expand All @@ -76,9 +76,9 @@ It is highly recommended you read through all the installation steps first befor
* To stop the server, press Ctrl+C once from your terminal. This will initiate a shutdown sequence and notify you when it is done. If the shutdown finished successfully, you will see something like this appear:

```
[2022-06-08T22:23:04]: You have initiated a server shut down.
[2022-06-08T22:23:04]: Kicking 12 remaining clients.
[2022-06-08T22:23:04]: Server has successfully shut down.
[2022-07-17T22:23:04]: You have initiated a server shut down.
[2022-07-17T22:23:04]: Kicking 12 remaining clients.
[2022-07-17T22:23:04]: Server has successfully shut down.
```

* If you do not see anything after a few seconds of starting a shutdown, you can try spamming Ctrl+C to try and force a shutdown or directly close out your terminal. This is not recommended due to the cleanup process not finishing correctly but it is doable.
Expand Down Expand Up @@ -107,6 +107,8 @@ Additional notes are listed at the end of the command list. Unless otherwise spe
- Displays help for a command, or links to the server repository if not given an argument.
* **help_more** "command name"
- Displays extended help for a command, usually significantly longer than what /help does.
* **ambient_info**
- Displays the current area ambient sound effect.
* **area** "area number"
- Moves you to an area by its numerical ID if it is reachable from your own, or displays all areas if not given a number.
* **autopass**
Expand Down Expand Up @@ -323,6 +325,10 @@ GMs can:
- Bypass area passages and locks.
- Receive special RP notifications.
- Use GM commands.
* **ambient** "name"
- Changes the ambient sound effect of your current area.
* **ambient_end**
- Clears the ambient sound effect of your current area.
* **area_kick** "ID" "area number"
- Kicks target from your area to the intended area and remove them from its invite-list.
- If not given a target area, it will use the server's default area (usually area 0).
Expand Down Expand Up @@ -599,6 +605,10 @@ GMs can:
- You are automatically set to watch the zones you create like this.
* **zone_add** "area"
- Adds an area by name or ID to the zone you are watching.
* **zone_ambient** "name"
- Changes the ambient sound effect of all areas of the zone you are watching.
* **zone_ambient_end**
- Clears the ambient sound effect of all areas of the zone you are watching.
* **zone_autopass**
- Changes the autopass status of the zone you are watching. If turned on, turns autopass on for players in an area part of a zone and players that later join; otherwise, it turns it off for players in an area part of the zone
* **zone_end**
Expand Down
1 change: 1 addition & 0 deletions server/area_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def __init__(self, area_id: int, server: TsuserverDR, parameters: Dict[str, Any]
self.lurk_length = 0
self._in_zone = None
self.noteworthy = False
self.ambient = ''

self.name = parameters['area']
self.background = parameters['background']
Expand Down
7 changes: 6 additions & 1 deletion server/client_changearea.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,10 @@ def change_area(self, area: AreaManager.Area, override_all: bool = False,
client.send_background(name=client.area.background,
tod_backgrounds=client.area.get_background_tod())
client.send_evidence_list()
client.send_ic_blankpost()
if client.packet_handler.HAS_JOINED_AREA:
client.send_joined_area()
else:
client.send_ic_blankpost()

if found_something:
client.send_ic_attention()
Expand Down Expand Up @@ -851,6 +854,8 @@ def change_area(self, area: AreaManager.Area, override_all: bool = False,
if area.id not in client.remembered_locked_passages:
client.remembered_locked_passages[area.id] = set()

client.send_area_ambient(area.ambient)

old_area.publisher.publish('area_client_left_final', {
'client': client,
'old_displayname': old_dname,
Expand Down
41 changes: 18 additions & 23 deletions server/client_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, server: TsuserverDR, transport, user_id: int, ipid: int,
self.required_packets_received = set() # Needs to have length 2 to actually connect
self.can_askchaa = True # Needs to be true to process an askchaa packet
self.version = ('Undefined', 'Undefined') # AO version used established through ID pack
self.packet_handler = clients.ClientDRO1d1d0()
self.packet_handler = clients.ClientDRO1d2d0()
self.bad_version = False
self.publisher = Publisher(self)

Expand Down Expand Up @@ -314,20 +314,6 @@ def send_ic(self, params: List = None, sender: ClientManager.Client = None,
if char_id == ignored_player.char_id:
return

# If self is ignoring sender, now is the moment to discard
if sender and sender in self.ignored_players:
return
# FIXME: Workaround because lazy. Proper fix is change all send_ic that specify
# char_id to also specify sender. However, there are potentially ugly issues lurking
# with first person/forward sprites mode here which I don't have the heart to figure
# out right now. Once fixed, remove the upcoming lines.
# Right now, this feature makes it emulate the old client behavior of ignoring based
# on character match.
if char_id:
for ignored_player in self.ignored_players:
if char_id == ignored_player.char_id:
return

# Remove None values from pargs, which could have happened while setting default values
# from the function call
to_pop = list()
Expand Down Expand Up @@ -459,19 +445,18 @@ def pop_if_there(dictionary, argument):
not pargs['msg'] in allowed_messages) or
(sender and sender.is_gagged and gag_replaced)):
pargs['msg'] = '(Your ears are ringing)'
if (self.send_deaf_space
and self.packet_handler not in
[clients.ClientDRO1d0d0(), clients.ClientDRO1d1d0()]):
if (not self.packet_handler.ALLOWS_REPEATED_MESSAGES_FROM_SAME_CHAR
and self.send_deaf_space):
pargs['msg'] = pargs['msg'] + ' '
self.send_deaf_space = not self.send_deaf_space

# TEMPORARY: REMOVE FOR 4.3+CLIENT UPDATE
# Remove globalIC prefix to everyone but sender, but only if in DRO 1.0.0, to work
# Remove globalIC prefix to everyone but sender, but only if in DRO 1.0.0+, to work
# around old client bug
if sender and sender.multi_ic and sender.multi_ic_pre:
if pargs['msg'].startswith(sender.multi_ic_pre):
if (self != sender or self.packet_handler in
[clients.ClientDRO1d0d0(), clients.ClientDRO1d1d0()]):
if (self.packet_handler.ALLOWS_CLEARING_MODIFIED_MESSAGE_FROM_SELF
or self != sender):
pargs['msg'] = pargs['msg'].replace(sender.multi_ic_pre, '', 1)

# Modify shownames as needed
Expand Down Expand Up @@ -556,7 +541,7 @@ def send_ic_attention(self):
self.send_ic(msg='(Something catches your attention)', ding=1, hide_character=1)

def send_ic_blankpost(self):
if self.packet_handler in [clients.ClientDRO1d0d0(), clients.ClientDRO1d1d0()]:
if self.packet_handler.ALLOWS_INVISIBLE_BLANKPOSTS:
self.send_ic(msg='', hide_character=1, bypass_text_replace=True)

def send_background(self, name: str = None, pos: str = None,
Expand Down Expand Up @@ -610,7 +595,8 @@ def send_health(self, side=None, health=None):

def send_music(self, name=None, char_id=None, showname=None, force_same_restart=None,
loop=None, channel=None, effects=None):
if not self.packet_handler.HAS_CLIENTSIDE_MUSIC_LOOPING and self.packet_handler != clients.ClientDRO1d1d0():
if (not self.packet_handler.HAS_CLIENTSIDE_MUSIC_LOOPING
and self.packet_handler.REPLACES_BASE_OPUS_FOR_MP3):
if name in self.server.new_110_music:
name = name.replace('.opus', '.mp3')
name = '/'.join(name.split('/')[1:])
Expand Down Expand Up @@ -684,6 +670,15 @@ def send_chat_tick_rate(self, chat_tick_rate: int = None):
'chat_tick_rate': chat_tick_rate,
})

def send_area_ambient(self, name: str = ''):
self.send_command_dict('area_ambient', {
'name': name,
})

def send_joined_area(self):
self.send_command_dict('joined_area', {
})

def disconnect(self):
self.disconnected = True
self.transport.close()
Expand Down
60 changes: 59 additions & 1 deletion server/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ class DefaultDROProtocol(_Singleton):
def __eq__(self, other):
return type(self).__name__ == type(other).__name__

VERSION_TO_SEND = [1, 2, 0]

HAS_CLIENTSIDE_MUSIC_LOOPING = False
HAS_DISTINCT_AREA_AND_MUSIC_LIST_OUTGOING_PACKETS = True
HAS_ACKMS = False
HAS_JOINED_AREA = True
ALLOWS_REPEATED_MESSAGES_FROM_SAME_CHAR = True
ALLOWS_CLEARING_MODIFIED_MESSAGE_FROM_SELF = True
ALLOWS_INVISIBLE_BLANKPOSTS = True
REPLACES_BASE_OPUS_FOR_MP3 = False

DECRYPTOR_OUTBOUND = [
('key', 34), # 0
Expand Down Expand Up @@ -322,13 +329,27 @@ def __eq__(self, other):
('url', ArgType.STR_OR_EMPTY), # 0
]

AREA_AMBIENT_OUTBOUND = [
('name', ArgType.STR_OR_EMPTY), # 0
]

JOINED_AREA_OUTBOUND = [
]

class ClientDRO1d2d0(DefaultDROProtocol):
VERSION_TO_SEND = [1, 2, 0]

class ClientDRO1d1d0(DefaultDROProtocol):
pass
VERSION_TO_SEND = [1, 1, 0]
HAS_JOINED_AREA = False

class ClientDRO1d0d0(DefaultDROProtocol):
VERSION_TO_SEND = [1, 0, 0]
HAS_CLIENTSIDE_MUSIC_LOOPING = False
HAS_DISTINCT_AREA_AND_MUSIC_LIST_OUTGOING_PACKETS = False
HAS_ACKMS = True
HAS_JOINED_AREA = False
REPLACES_BASE_OPUS_FOR_MP3 = True

MS_INBOUND = [
('msg_type', ArgType.STR), # 0
Expand Down Expand Up @@ -377,6 +398,11 @@ class ClientDRO1d0d0(DefaultDROProtocol):
class ClientDROLegacy(DefaultDROProtocol):
HAS_CLIENTSIDE_MUSIC_LOOPING = False
HAS_DISTINCT_AREA_AND_MUSIC_LIST_OUTGOING_PACKETS = False
HAS_JOINED_AREA = False
ALLOWS_REPEATED_MESSAGES_FROM_SAME_CHAR = False
ALLOWS_CLEARING_MODIFIED_MESSAGE_FROM_SELF = False
ALLOWS_INVISIBLE_BLANKPOSTS = False
REPLACES_BASE_OPUS_FOR_MP3 = True

MS_INBOUND = [
('msg_type', ArgType.STR), # 0
Expand Down Expand Up @@ -433,6 +459,11 @@ class ClientDROLegacy(DefaultDROProtocol):
class ClientAO2d6(DefaultDROProtocol):
HAS_CLIENTSIDE_MUSIC_LOOPING = False
HAS_DISTINCT_AREA_AND_MUSIC_LIST_OUTGOING_PACKETS = False
HAS_JOINED_AREA = False
ALLOWS_REPEATED_MESSAGES_FROM_SAME_CHAR = False
ALLOWS_CLEARING_MODIFIED_MESSAGE_FROM_SELF = False
ALLOWS_INVISIBLE_BLANKPOSTS = False
REPLACES_BASE_OPUS_FOR_MP3 = True

MS_INBOUND = [
('msg_type', ArgType.STR), # 0
Expand Down Expand Up @@ -502,6 +533,11 @@ class ClientAO2d6(DefaultDROProtocol):
class ClientAO2d7(DefaultDROProtocol):
HAS_CLIENTSIDE_MUSIC_LOOPING = False
HAS_DISTINCT_AREA_AND_MUSIC_LIST_OUTGOING_PACKETS = False
HAS_JOINED_AREA = False
ALLOWS_REPEATED_MESSAGES_FROM_SAME_CHAR = False
ALLOWS_CLEARING_MODIFIED_MESSAGE_FROM_SELF = False
ALLOWS_INVISIBLE_BLANKPOSTS = False
REPLACES_BASE_OPUS_FOR_MP3 = True

MS_INBOUND = [
('msg_type', ArgType.STR), # 0
Expand Down Expand Up @@ -583,6 +619,12 @@ class ClientAO2d7(DefaultDROProtocol):


class ClientAO2d8d4(DefaultDROProtocol):
HAS_JOINED_AREA = False
ALLOWS_REPEATED_MESSAGES_FROM_SAME_CHAR = False
ALLOWS_CLEARING_MODIFIED_MESSAGE_FROM_SELF = False
ALLOWS_INVISIBLE_BLANKPOSTS = False
REPLACES_BASE_OPUS_FOR_MP3 = True

MS_INBOUND = [
('msg_type', ArgType.STR), # 0
('pre', ArgType.STR_OR_EMPTY), # 1
Expand Down Expand Up @@ -668,6 +710,12 @@ class ClientAO2d8d4(DefaultDROProtocol):


class ClientAO2d9d0(DefaultDROProtocol):
HAS_JOINED_AREA = False
ALLOWS_REPEATED_MESSAGES_FROM_SAME_CHAR = False
ALLOWS_CLEARING_MODIFIED_MESSAGE_FROM_SELF = False
ALLOWS_INVISIBLE_BLANKPOSTS = False
REPLACES_BASE_OPUS_FOR_MP3 = True

ASKCHAA_INBOUND = [
('ao290doesnotsupportpacketswithnoarguments', ArgType.STR_OR_EMPTY), # 0
]
Expand Down Expand Up @@ -771,8 +819,18 @@ class ClientAO2d9d0(DefaultDROProtocol):
('pos', ''), # 1
]

PW_INBOUND = [
('password', ArgType.STR_OR_EMPTY), # 0
]


class ClientAO2d10(ClientAO2d9d0):
HAS_JOINED_AREA = False
ALLOWS_REPEATED_MESSAGES_FROM_SAME_CHAR = False
ALLOWS_CLEARING_MODIFIED_MESSAGE_FROM_SELF = False
ALLOWS_INVISIBLE_BLANKPOSTS = False
REPLACES_BASE_OPUS_FOR_MP3 = True

ASKCHAA_INBOUND = []

RC_INBOUND = []
Expand Down
Loading

0 comments on commit af54a85

Please sign in to comment.